调整微信小程序的报错。
This commit is contained in:
49
unpackage/dist/dev/mp-weixin/uni_modules/uni-feedback/js_sdk/validator/opendb-feedback.js
vendored
Normal file
49
unpackage/dist/dev/mp-weixin/uni_modules/uni-feedback/js_sdk/validator/opendb-feedback.js
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
const validator = {
|
||||
"content": {
|
||||
"rules": [
|
||||
{
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"format": "string"
|
||||
}
|
||||
],
|
||||
"label": "留言内容/回复内容"
|
||||
},
|
||||
"imgs": {
|
||||
"rules": [
|
||||
{
|
||||
"format": "array"
|
||||
},
|
||||
{
|
||||
"arrayType": "file"
|
||||
},
|
||||
{
|
||||
"maxLength": 6
|
||||
}
|
||||
],
|
||||
"label": "图片列表"
|
||||
},
|
||||
"contact": {
|
||||
"rules": [
|
||||
{
|
||||
"format": "string"
|
||||
}
|
||||
],
|
||||
"label": "联系人"
|
||||
},
|
||||
"mobile": {
|
||||
"rules": [
|
||||
{
|
||||
"format": "string"
|
||||
},
|
||||
{
|
||||
"pattern": "^\\+?[0-9-]{3,20}$"
|
||||
}
|
||||
],
|
||||
"label": "联系电话"
|
||||
}
|
||||
};
|
||||
exports.validator = validator;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-feedback/js_sdk/validator/opendb-feedback.js.map
|
||||
131
unpackage/dist/dev/mp-weixin/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback.js
vendored
Normal file
131
unpackage/dist/dev/mp-weixin/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback.js
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uniFeedback_js_sdk_validator_opendbFeedback = require("../../js_sdk/validator/opendb-feedback.js");
|
||||
common_vendor.index.__f__("log", "at uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback.vue:29", uni_modules_uniFeedback_js_sdk_validator_opendbFeedback.validator);
|
||||
const db = common_vendor.tr.database();
|
||||
const dbCollectionName = "opendb-feedback";
|
||||
function getValidator(fields) {
|
||||
let result = {};
|
||||
for (let key in uni_modules_uniFeedback_js_sdk_validator_opendbFeedback.validator) {
|
||||
if (fields.indexOf(key) > -1) {
|
||||
result[key] = uni_modules_uniFeedback_js_sdk_validator_opendbFeedback.validator[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
let formData = {
|
||||
"content": "",
|
||||
"imgs": [],
|
||||
"contact": "",
|
||||
"mobile": ""
|
||||
};
|
||||
return {
|
||||
formData,
|
||||
formOptions: {},
|
||||
rules: {
|
||||
...getValidator(Object.keys(formData))
|
||||
}
|
||||
};
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.form.setRules(this.rules);
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 触发表单提交
|
||||
*/
|
||||
submit() {
|
||||
common_vendor.index.showLoading({
|
||||
mask: true
|
||||
});
|
||||
this.$refs.form.validate().then((res) => {
|
||||
this.submitForm(res);
|
||||
}).catch(() => {
|
||||
common_vendor.index.hideLoading();
|
||||
});
|
||||
},
|
||||
submitForm(value) {
|
||||
db.collection(dbCollectionName).add(value).then((res) => {
|
||||
common_vendor.index.showToast({
|
||||
icon: "none",
|
||||
title: "提交成功"
|
||||
});
|
||||
this.getOpenerEventChannel().emit("refreshData");
|
||||
setTimeout(() => common_vendor.index.navigateBack(), 500);
|
||||
}).catch((err) => {
|
||||
common_vendor.index.showModal({
|
||||
content: err.message || "请求服务失败",
|
||||
showCancel: false
|
||||
});
|
||||
}).finally(() => {
|
||||
common_vendor.index.hideLoading();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item");
|
||||
const _easycom_uni_file_picker2 = common_vendor.resolveComponent("uni-file-picker");
|
||||
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
|
||||
const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms");
|
||||
(_easycom_uni_forms_item2 + _easycom_uni_file_picker2 + _easycom_uni_easyinput2 + _easycom_uni_forms2)();
|
||||
}
|
||||
const _easycom_uni_forms_item = () => "../../../uni-forms/components/uni-forms-item/uni-forms-item.js";
|
||||
const _easycom_uni_file_picker = () => "../../../uni-file-picker/components/uni-file-picker/uni-file-picker.js";
|
||||
const _easycom_uni_easyinput = () => "../../../uni-easyinput/components/uni-easyinput/uni-easyinput.js";
|
||||
const _easycom_uni_forms = () => "../../../uni-forms/components/uni-forms/uni-forms.js";
|
||||
if (!Math) {
|
||||
(_easycom_uni_forms_item + _easycom_uni_file_picker + _easycom_uni_easyinput + _easycom_uni_forms)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.o([($event) => $data.formData.content = $event.detail.value, ($event) => _ctx.binddata("content", $event.detail.value)]),
|
||||
b: $data.formData.content,
|
||||
c: common_vendor.p({
|
||||
name: "content",
|
||||
label: "留言内容/回复内容",
|
||||
required: true
|
||||
}),
|
||||
d: common_vendor.o(($event) => $data.formData.imgs = $event),
|
||||
e: common_vendor.p({
|
||||
["file-mediatype"]: "image",
|
||||
limit: 6,
|
||||
["return-type"]: "array",
|
||||
modelValue: $data.formData.imgs
|
||||
}),
|
||||
f: common_vendor.p({
|
||||
name: "imgs",
|
||||
label: "图片列表"
|
||||
}),
|
||||
g: common_vendor.o(($event) => $data.formData.contact = $event),
|
||||
h: common_vendor.p({
|
||||
trim: "both",
|
||||
modelValue: $data.formData.contact
|
||||
}),
|
||||
i: common_vendor.p({
|
||||
name: "contact",
|
||||
label: "联系人"
|
||||
}),
|
||||
j: common_vendor.o(($event) => $data.formData.mobile = $event),
|
||||
k: common_vendor.p({
|
||||
trim: "both",
|
||||
modelValue: $data.formData.mobile
|
||||
}),
|
||||
l: common_vendor.p({
|
||||
name: "mobile",
|
||||
label: "联系电话"
|
||||
}),
|
||||
m: common_vendor.o((...args) => $options.submit && $options.submit(...args)),
|
||||
n: common_vendor.sr("form", "0ca07cc8-0"),
|
||||
o: common_vendor.p({
|
||||
value: $data.formData,
|
||||
["validate-trigger"]: "submit",
|
||||
["err-show-type"]: "toast"
|
||||
})
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback.js.map
|
||||
10
unpackage/dist/dev/mp-weixin/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback.json
vendored
Normal file
10
unpackage/dist/dev/mp-weixin/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"navigationBarTitleText": "意见反馈",
|
||||
"enablePullDownRefresh": false,
|
||||
"usingComponents": {
|
||||
"uni-forms-item": "../../../uni-forms/components/uni-forms-item/uni-forms-item",
|
||||
"uni-file-picker": "../../../uni-file-picker/components/uni-file-picker/uni-file-picker",
|
||||
"uni-easyinput": "../../../uni-easyinput/components/uni-easyinput/uni-easyinput",
|
||||
"uni-forms": "../../../uni-forms/components/uni-forms/uni-forms"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="uni-container"><uni-forms wx:if="{{o}}" class="r" u-s="{{['d']}}" u-r="form" u-i="0ca07cc8-0" bind:__l="__l" u-p="{{o}}"><uni-forms-item wx:if="{{c}}" u-s="{{['d']}}" u-i="0ca07cc8-1,0ca07cc8-0" bind:__l="__l" u-p="{{c}}"><block wx:if="{{r0}}"><textarea bindinput="{{a}}" class="uni-textarea-border" trim="right" value="{{b}}"></textarea></block></uni-forms-item><uni-forms-item wx:if="{{f}}" u-s="{{['d']}}" u-i="0ca07cc8-2,0ca07cc8-0" bind:__l="__l" u-p="{{f}}"><uni-file-picker wx:if="{{e}}" u-i="0ca07cc8-3,0ca07cc8-2" bind:__l="__l" bindupdateModelValue="{{d}}" u-p="{{e}}"></uni-file-picker></uni-forms-item><uni-forms-item wx:if="{{i}}" u-s="{{['d']}}" u-i="0ca07cc8-4,0ca07cc8-0" bind:__l="__l" u-p="{{i}}"><uni-easyinput wx:if="{{h}}" u-i="0ca07cc8-5,0ca07cc8-4" bind:__l="__l" bindupdateModelValue="{{g}}" u-p="{{h}}"></uni-easyinput></uni-forms-item><uni-forms-item wx:if="{{l}}" u-s="{{['d']}}" u-i="0ca07cc8-6,0ca07cc8-0" bind:__l="__l" u-p="{{l}}"><uni-easyinput wx:if="{{k}}" u-i="0ca07cc8-7,0ca07cc8-6" bind:__l="__l" bindupdateModelValue="{{j}}" u-p="{{k}}"></uni-easyinput></uni-forms-item><view class="uni-button-group"><button type="primary" class="uni-button" bindtap="{{m}}">提交</button></view></uni-forms></view>
|
||||
36
unpackage/dist/dev/mp-weixin/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback.wxss
vendored
Normal file
36
unpackage/dist/dev/mp-weixin/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback.wxss
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
.uni-container {
|
||||
padding: 15px;
|
||||
}
|
||||
.uni-input-border,
|
||||
.uni-textarea-border {
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
border: 1px #e5e5e5 solid;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.uni-input-border {
|
||||
padding: 0 10px;
|
||||
height: 35px;
|
||||
}
|
||||
.uni-textarea-border {
|
||||
padding: 10px;
|
||||
height: 80px;
|
||||
}
|
||||
.uni-button-group {
|
||||
margin-top: 50px;
|
||||
|
||||
display: flex;
|
||||
|
||||
justify-content: center;
|
||||
}
|
||||
.uni-button {
|
||||
width: 184px;
|
||||
padding: 12px 20px;
|
||||
font-size: 14px;
|
||||
border-radius: 4px;
|
||||
line-height: 1;
|
||||
margin: 0;
|
||||
}
|
||||
Reference in New Issue
Block a user