Files
gxtyzx-uniapp/dist/dev/mp-weixin/package/user/personal.js
T

198 lines
6.4 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const store_modules_user = require("../../store/modules/user.js");
const api_booking_users_index = require("../../api/booking/users/index.js");
const api_cms_mpMenu_index = require("../../api/cms/mp-menu/index.js");
require("../../utils/request.js");
const utils_common = require("../../utils/common.js");
const store_modules_tenant = require("../../store/modules/tenant.js");
const api_system_file_index = require("../../api/system/file/index.js");
store_modules_tenant.useTenantStore();
const userStore = store_modules_user.useUserStore();
const _sfc_main = {
data() {
return {
statusBarHeight: 104,
isLogin: false,
form: null,
userInfo: {},
fields: {},
logo: "",
bookingUser: {},
server: [],
order: []
};
},
onLoad() {
this.reload();
},
methods: {
async reload(e) {
const app = this;
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
app.form = userInfo;
api_booking_users_index.getByPhone({
phone: userInfo.phone
}).then((data) => {
if (data) {
app.form = Object.assign({}, app.form, data);
}
});
} else {
app.isLogin = false;
app.form = {};
}
api_cms_mpMenu_index.listMpMenu({}).then((res) => {
app.server = res.filter((d) => d.type == 0);
app.order = res.filter((d) => d.type == 1);
});
},
navTo(item) {
if (!this.isLogin) {
this.$refs.login.open("bottom");
return false;
}
utils_common.openUrl(item);
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open("bottom");
return false;
}
},
async chooseAvatar({ detail }) {
const url = detail.avatarUrl;
this.form.avatarUrl = await api_system_file_index.uploadOssByPath(url);
api_booking_users_index.updateUsers({
uid: this.form.uid,
avatarUrl: `${this.form.avatarUrl}`
});
},
save() {
const { form } = this;
if (!common_vendor.index.$uv.test.idCard(form.idCard)) {
common_vendor.index.showToast({
title: "请填写真实身份证号",
icon: "none"
});
return false;
}
api_booking_users_index.updateUsers({
phone: form.phone,
realName: form.realName,
idCard: form.idCard,
uid: form.uid
}).then((res) => {
common_vendor.index.showToast({
title: "保存成功",
icon: "success"
});
});
}
}
};
if (!Array) {
const _easycom_uv_avatar2 = common_vendor.resolveComponent("uv-avatar");
const _easycom_uv_input2 = common_vendor.resolveComponent("uv-input");
const _easycom_uv_cell2 = common_vendor.resolveComponent("uv-cell");
const _component_uv_form_item = common_vendor.resolveComponent("uv-form-item");
const _component_uv_form = common_vendor.resolveComponent("uv-form");
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
(_easycom_uv_avatar2 + _easycom_uv_input2 + _easycom_uv_cell2 + _component_uv_form_item + _component_uv_form + _easycom_uni_card2 + _easycom_uv_button2 + _easycom_ws_login2)();
}
const _easycom_uv_avatar = () => "../../uni_modules/uv-avatar/components/uv-avatar/uv-avatar.js";
const _easycom_uv_input = () => "../../uni_modules/uv-input/components/uv-input/uv-input.js";
const _easycom_uv_cell = () => "../../uni_modules/uv-cell/components/uv-cell/uv-cell.js";
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js";
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
if (!Math) {
(_easycom_uv_avatar + _easycom_uv_input + _easycom_uv_cell + _easycom_uni_card + _easycom_uv_button + _easycom_ws_login)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.form
}, $data.form ? {
b: common_vendor.p({
src: $data.form.avatarUrl,
size: "100"
}),
c: common_vendor.o((...args) => $options.chooseAvatar && $options.chooseAvatar(...args)),
d: common_vendor.o(($event) => $data.form.phone = $event),
e: common_vendor.p({
placeholder: "请输入手机号码",
disabled: true,
maxlength: "11",
modelValue: $data.form.phone
}),
f: common_vendor.p({
title: "手机号码",
value: $data.form.phone
}),
g: common_vendor.p({
prop: "form.phone",
borderBottom: true
}),
h: common_vendor.o(($event) => $data.form.realName = $event),
i: common_vendor.p({
placeholder: "请输入真实姓名",
maxlength: "11",
modelValue: $data.form.realName
}),
j: common_vendor.p({
title: "真实姓名",
value: $data.form.realName
}),
k: common_vendor.p({
prop: "form.realName",
borderBottom: true
}),
l: common_vendor.o(($event) => $data.form.idCard = $event),
m: common_vendor.p({
placeholder: "请输入身份证号",
maxlength: "18",
modelValue: $data.form.idCard
}),
n: common_vendor.p({
title: "身份证号码",
value: $data.form.idCard
}),
o: common_vendor.p({
prop: "form.idCard",
borderBottom: true
}),
p: common_vendor.sr("form", "1f448c34-2,1f448c34-1"),
q: common_vendor.p({
labelPosition: "left",
model: $data.form,
rules: _ctx.rules
}),
r: common_vendor.p({
border: false,
["is-shadow"]: false,
padding: 0
}),
s: common_vendor.o($options.save),
t: common_vendor.p({
customStyle: {
background: "linear-gradient(to right, #70b915, #008e04)",
borderRadius: "30px",
color: "#ffffff"
},
text: "保存"
}),
v: common_vendor.sr("login", "1f448c34-13"),
w: common_vendor.o($options.reload),
x: common_vendor.p({
logo: $data.logo
})
} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/user/personal.vue"]]);
wx.createPage(MiniProgramPage);