Files
dajiankang-uniapp/unpackage/dist/dev/mp-weixin/pages/mine/mobile.js
PC-202306242200\Administrator 1c24452b6c first commit
2026-03-28 23:10:55 +08:00

134 lines
4.3 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_fun = require("../../utils/fun.js");
const uni_modules_wotDesignUni_components_composables_useCountDown = require("../../uni_modules/wot-design-uni/components/composables/useCountDown.js");
require("../../uni_modules/wot-design-uni/locale/index.js");
require("../../uni_modules/wot-design-uni/dayjs/index.js");
const api_index = require("../../api/index.js");
const store_index = require("../../store/index.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "mobile",
setup(__props) {
const store = store_index.Store();
const userInfo = common_vendor.computed(
() => store.userInfo || {
inviteCode: "",
nickname: "",
mobile: "",
avatar: "",
paywallet: {
balance: 0
}
}
);
common_vendor.onShow(async () => {
await store.usersGetInfo();
});
const codeIngo1 = common_vendor.ref("获取验证码");
const codeIngo2 = common_vendor.ref("获取验证码");
const formData = common_vendor.ref({
code: "",
mobile: "",
oldCode: ""
});
const {
start: start1,
pause: pause1,
reset: reset1,
current: current1
} = uni_modules_wotDesignUni_components_composables_useCountDown.useCountDown({
time: 60 * 1e3,
onChange(current) {
},
onFinish() {
codeIngo1.value = "重新发送";
}
});
const {
start: start2,
pause: pause2,
reset: reset2,
current: current2
} = uni_modules_wotDesignUni_components_composables_useCountDown.useCountDown({
time: 60 * 1e3,
onChange(current) {
},
onFinish() {
codeIngo2.value = "重新发送";
}
});
const getCode1 = (e) => {
if (!userInfo.value.mobile) {
utils_fun.toast("请输入旧手机号");
return;
}
if (current1.value.seconds) {
utils_fun.toast("请等待倒计时结束");
return;
}
api_index.api.smsCode({
mobile: userInfo.value.mobile,
scene: 2
}).then((res) => {
start1();
utils_fun.toast("验证码发送成功");
}).catch((err) => {
common_vendor.index.__f__("log", "at pages/mine/mobile.vue:126", err);
utils_fun.toast("验证码发送失败");
});
};
const getCode2 = (e) => {
if (!formData.value.mobile) {
utils_fun.toast("请输入旧手机号");
return;
}
if (current2.value.seconds) {
utils_fun.toast("请等待倒计时结束");
return;
}
api_index.api.smsCode({
mobile: formData.value.mobile,
scene: 2
}).then((res) => {
start2();
utils_fun.toast("验证码发送成功");
}).catch((err) => {
common_vendor.index.__f__("log", "at pages/mine/mobile.vue:152", err);
utils_fun.toast("验证码发送失败");
});
};
const handleSubmit = () => {
api_index.api.updateMobile(formData.value).then((res) => {
common_vendor.index.showModal({
title: "提示",
content: "修改成功",
showCancel: false,
success: async () => {
await store.usersGetInfo();
common_vendor.index.navigateBack();
}
});
});
};
return (_ctx, _cache) => {
return {
a: userInfo.value.mobile,
b: formData.value.oldCode,
c: common_vendor.o(($event) => formData.value.oldCode = $event.detail.value),
d: common_vendor.t(common_vendor.unref(current1).seconds || codeIngo1.value),
e: common_vendor.o(getCode1),
f: formData.value.mobile,
g: common_vendor.o(($event) => formData.value.mobile = $event.detail.value),
h: formData.value.code,
i: common_vendor.o(($event) => formData.value.code = $event.detail.value),
j: common_vendor.t(common_vendor.unref(current2).seconds || codeIngo2.value),
k: common_vendor.o(getCode2),
l: common_vendor.o(handleSubmit)
};
};
}
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9262aba8"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine/mobile.js.map