Files
t-admin/unpackage/dist/dev/mp-weixin/pages/uni-id-log/add.js
T
2025-06-13 21:16:12 +08:00

245 lines
7.2 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const js_sdk_validator_uniIdLog = require("../../js_sdk/validator/uni-id-log.js");
const db = common_vendor.er.database();
db.command;
const dbCollectionName = "uni-id-log";
function getValidator(fields) {
let result = {};
for (let key in js_sdk_validator_uniIdLog.validator) {
if (fields.includes(key)) {
result[key] = js_sdk_validator_uniIdLog.validator[key];
}
}
return result;
}
const _sfc_main = {
data() {
let formData = {
"create_date": null,
"device_uuid": "",
"ip": "",
"state": null,
"type": "",
"ua": "",
"user_id": "",
"username": "",
"email": "",
"mobile": "",
"appid": ""
};
return {
formData,
formOptions: {
"type_localdata": [
{
"value": "logout",
"text": "logout"
},
{
"value": "login",
"text": "login"
},
{
"value": "register",
"text": "register"
},
{
"value": "reset-pwd",
"text": "reset-pwd"
},
{
"value": "bind-mobile",
"text": "bind-mobile"
},
{
"value": "bind-weixin",
"text": "bind-weixin"
},
{
"value": "bind-qq",
"text": "bind-qq"
},
{
"value": "bind-apple",
"text": "bind-apple"
},
{
"value": "bind-alipay",
"text": "bind-alipay"
}
]
},
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) => {
return this.submitForm(res);
}).catch(() => {
}).finally(() => {
common_vendor.index.hideLoading();
});
},
/**
* 提交表单
*/
submitForm(value) {
return db.collection(dbCollectionName).add(value).then((res) => {
common_vendor.index.showToast({
title: "新增成功"
});
this.getOpenerEventChannel().emit("refreshData");
setTimeout(() => common_vendor.index.navigateBack(), 500);
}).catch((err) => {
common_vendor.index.showModal({
content: err.message || "请求服务失败",
showCancel: false
});
});
}
}
};
if (!Array) {
const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker");
const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item");
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
const _easycom_uni_data_checkbox2 = common_vendor.resolveComponent("uni-data-checkbox");
const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms");
(_easycom_uni_datetime_picker2 + _easycom_uni_forms_item2 + _easycom_uni_easyinput2 + _easycom_uni_data_checkbox2 + _easycom_uni_forms2)();
}
const _easycom_uni_datetime_picker = () => "../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
const _easycom_uni_forms_item = () => "../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js";
const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
const _easycom_uni_data_checkbox = () => "../../uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.js";
const _easycom_uni_forms = () => "../../uni_modules/uni-forms/components/uni-forms/uni-forms.js";
if (!Math) {
(_easycom_uni_datetime_picker + _easycom_uni_forms_item + _easycom_uni_easyinput + _easycom_uni_data_checkbox + _easycom_uni_forms)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.o(($event) => $data.formData.create_date = $event),
b: common_vendor.p({
["return-type"]: "timestamp",
modelValue: $data.formData.create_date
}),
c: common_vendor.p({
name: "create_date",
label: ""
}),
d: common_vendor.o(($event) => $data.formData.device_uuid = $event),
e: common_vendor.p({
placeholder: "设备唯一标识",
modelValue: $data.formData.device_uuid
}),
f: common_vendor.p({
name: "device_uuid",
label: ""
}),
g: common_vendor.o(($event) => $data.formData.ip = $event),
h: common_vendor.p({
placeholder: "ip地址",
modelValue: $data.formData.ip
}),
i: common_vendor.p({
name: "ip",
label: ""
}),
j: common_vendor.o(($event) => $data.formData.state = $event),
k: common_vendor.p({
placeholder: "结果:0 失败、1 成功",
type: "number",
modelValue: $data.formData.state
}),
l: common_vendor.p({
name: "state",
label: ""
}),
m: common_vendor.o(($event) => $data.formData.type = $event),
n: common_vendor.p({
localdata: $data.formOptions.type_localdata,
modelValue: $data.formData.type
}),
o: common_vendor.p({
name: "type",
label: ""
}),
p: common_vendor.o(($event) => $data.formData.ua = $event),
q: common_vendor.p({
placeholder: "userAgent",
modelValue: $data.formData.ua
}),
r: common_vendor.p({
name: "ua",
label: ""
}),
s: common_vendor.o(($event) => $data.formData.user_id = $event),
t: common_vendor.p({
placeholder: "用户id,参考uni-id-users表",
modelValue: $data.formData.user_id
}),
v: common_vendor.p({
name: "user_id",
label: "",
required: true
}),
w: common_vendor.o(($event) => $data.formData.username = $event),
x: common_vendor.p({
placeholder: "用户名",
modelValue: $data.formData.username
}),
y: common_vendor.p({
name: "username",
label: ""
}),
z: common_vendor.o(($event) => $data.formData.email = $event),
A: common_vendor.p({
placeholder: "邮箱",
modelValue: $data.formData.email
}),
B: common_vendor.p({
name: "email",
label: ""
}),
C: common_vendor.o(($event) => $data.formData.mobile = $event),
D: common_vendor.p({
placeholder: "手机号",
modelValue: $data.formData.mobile
}),
E: common_vendor.p({
name: "mobile",
label: ""
}),
F: common_vendor.o(($event) => $data.formData.appid = $event),
G: common_vendor.p({
placeholder: "客户端DCloud AppId",
modelValue: $data.formData.appid
}),
H: common_vendor.p({
name: "appid",
label: ""
}),
I: common_vendor.o((...args) => $options.submit && $options.submit(...args)),
J: common_vendor.sr("form", "5fd4ffea-0"),
K: common_vendor.p({
model: $data.formData,
validateTrigger: "bind"
})
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/uni-id-log/add.js.map