Files
PC-202306242200\Administrator dac42e3b0c first commit
2026-03-28 23:09:02 +08:00

144 lines
5.1 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const api_api = require("../../api/api.js");
if (!Array) {
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
const _easycom_up_code2 = common_vendor.resolveComponent("up-code");
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
(_easycom_up_input2 + _easycom_up_code2 + _easycom_up_button2)();
}
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_code = () => "../../uni_modules/uview-plus/components/u-code/u-code.js";
const _easycom_up_button = () => "../../uni_modules/uview-plus/components/u-button/u-button.js";
if (!Math) {
(_easycom_up_input + _easycom_up_code + _easycom_up_button)();
}
const _sfc_main = {
__name: "phone",
setup(__props) {
let _getInfo = common_vendor.ref({});
let tips1 = common_vendor.ref("");
let tips2 = common_vendor.ref("");
let uCode1 = common_vendor.ref(null);
let uCode2 = common_vendor.ref(null);
let enterprise = common_vendor.reactive({
newPhone: "",
newPhoneSmsCode: "",
oldPhoneSmsCode: ""
});
common_vendor.onLoad(async (options) => {
_getInfo.value = await api_api.userInfo();
});
let addBank = async () => {
await api_api.updatePhone(enterprise);
common_vendor.index.showToast({ title: "修改成功", icon: "none" });
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
};
let codeChange1 = (text) => {
tips1.value = text;
};
let codeChange2 = (text) => {
tips2.value = text;
};
let getCode1 = (e) => {
if (!e)
return common_vendor.index.showToast({ title: "请输入手机号", icon: "none" });
if (uCode1.value.canGetCode) {
common_vendor.index.showLoading({
title: "正在获取验证码"
});
api_api.smsCode({
phone: e
}).then((res) => {
common_vendor.index.hideLoading();
common_vendor.index.$u.toast("验证码已发送");
uCode1.value.start();
});
} else {
common_vendor.index.$u.toast("倒计时结束后再发送");
}
};
let getCode2 = (e) => {
if (!e)
return common_vendor.index.showToast({ title: "请输入手机号", icon: "none" });
if (uCode2.value.canGetCode) {
common_vendor.index.showLoading({
title: "正在获取验证码"
});
api_api.smsCode({
phone: e
}).then((res) => {
common_vendor.index.hideLoading();
common_vendor.index.$u.toast("验证码已发送");
uCode2.value.start();
});
} else {
common_vendor.index.$u.toast("倒计时结束后再发送");
}
};
return (_ctx, _cache) => {
return {
a: common_vendor.o(($event) => common_vendor.unref(_getInfo).phone = $event),
b: common_vendor.p({
border: false,
disabledColor: "#fff",
placeholder: "请输入",
disabled: true,
modelValue: common_vendor.unref(_getInfo).phone
}),
c: common_vendor.o(($event) => common_vendor.unref(enterprise).oldPhoneSmsCode = $event),
d: common_vendor.p({
border: false,
placeholder: "请输入",
modelValue: common_vendor.unref(enterprise).oldPhoneSmsCode
}),
e: () => ({
r: uCode1,
k: "uCode1"
}),
f: common_vendor.o(common_vendor.unref(codeChange1)),
g: common_vendor.p({
["keep-running"]: true,
["start-text"]: "点我获取验证码"
}),
h: common_vendor.t(common_vendor.unref(tips1)),
i: common_vendor.o(($event) => common_vendor.unref(getCode1)(common_vendor.unref(_getInfo).phone)),
j: common_vendor.p({
color: "#4874e5"
}),
k: common_vendor.o(($event) => common_vendor.unref(enterprise).newPhone = $event),
l: common_vendor.p({
border: false,
placeholder: "请输入",
modelValue: common_vendor.unref(enterprise).newPhone
}),
m: common_vendor.o(($event) => common_vendor.unref(enterprise).newPhoneSmsCode = $event),
n: common_vendor.p({
border: false,
placeholder: "请输入",
modelValue: common_vendor.unref(enterprise).newPhoneSmsCode
}),
o: () => ({
r: uCode2,
k: "uCode2"
}),
p: common_vendor.o(common_vendor.unref(codeChange2)),
q: common_vendor.p({
["keep-running"]: true,
["start-text"]: "点我获取验证码"
}),
r: common_vendor.t(common_vendor.unref(tips2)),
s: common_vendor.o(($event) => common_vendor.unref(getCode2)(common_vendor.unref(enterprise).newPhone)),
t: common_vendor.p({
color: "#4874e5"
}),
v: common_vendor.o((...args) => common_vendor.unref(addBank) && common_vendor.unref(addBank)(...args))
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bad7965c"]]);
my.createPage(MiniProgramPage);