hldy_app/unpackage/dist/dev/mp-weixin/component/public/reset.js

110 lines
3.4 KiB
JavaScript
Raw Normal View History

2025-08-21 16:51:53 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
const pages_Initialization_api = require("../../pages/Initialization/api.js");
const _sfc_main = {
__name: "reset",
props: {
show: {
type: Boolean,
default: true
}
},
emits: ["close"],
setup(__props, { emit: __emit }) {
const props = __props;
const form = common_vendor.reactive({
username: common_vendor.index.getStorageSync("username"),
oldpassword: "",
password: "",
confirmpassword: ""
});
const donghua = common_vendor.ref(false);
common_vendor.watch(
() => props.show,
(newVal, oldVal) => {
if (!oldVal && newVal) {
donghua.value = false;
setTimeout(() => donghua.value = true, 50);
}
}
);
const emit = __emit;
function handleClose() {
emit("close");
}
const go = () => {
if (!form.username || !form.oldpassword || !form.password || !form.confirmpassword) {
common_vendor.index.showToast({
title: "请完善信息",
icon: "error",
// 无图标,表示普通文本
duration: 2e3
});
return;
}
if (form.password.length < 6 || form.confirmpassword.length < 6) {
common_vendor.index.showToast({
title: "密码要多于六位",
icon: "none",
// 无图标,表示普通文本
duration: 2e3
});
return;
}
if (form.password !== form.confirmpassword) {
common_vendor.index.showToast({
title: "新密码与确认密码不一致",
icon: "none",
// 无图标,表示普通文本
duration: 2e3
});
return;
}
pages_Initialization_api.updatePassword(form).then((res) => {
common_vendor.index.__f__("log", "at component/public/reset.vue:105", "res", res);
if (res.success) {
common_vendor.index.showToast({
title: res.message,
icon: "none",
// 无图标,表示普通文本
duration: 2e3
});
setTimeout(() => {
common_vendor.index.setStorageSync("token", 1);
common_vendor.index.reLaunch({
url: "/pages/login/login"
// 请根据你项目的路径修改
});
}, 1e3);
} else {
common_vendor.index.showToast({
title: res.message,
icon: "none",
// 无图标,表示普通文本
duration: 2e3
});
}
});
};
return (_ctx, _cache) => {
return {
a: common_vendor.o(handleClose),
b: common_vendor.o(go),
c: form.oldpassword,
d: common_vendor.o(($event) => form.oldpassword = $event.detail.value),
e: form.password,
f: common_vendor.o(($event) => form.password = $event.detail.value),
g: form.confirmpassword,
h: common_vendor.o(($event) => form.confirmpassword = $event.detail.value),
i: common_vendor.o(() => {
}),
j: common_vendor.n(donghua.value ? "is-active" : ""),
k: __props.show
};
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a67d2760"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/component/public/reset.js.map