"use strict"; const common_vendor = require("../../common/vendor.js"); const _sfc_main = { __name: "profile", setup(__props) { const userInfo = common_vendor.ref({ avatar: "/static/avatar/default.jpg", nickname: "张三", gender: 1, birthday: "1990-01-01", phone: "13800138000", email: "example@email.com", verified: true }); const privacy = common_vendor.ref({ publicProfile: true, allowMessage: false }); const formatPhone = (phone) => { if (!phone) return "未绑定"; return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2"); }; const changeAvatar = () => { common_vendor.index.chooseImage({ count: 1, success: (res) => { userInfo.value.avatar = res.tempFilePaths[0]; } }); }; const editNickname = () => { common_vendor.index.navigateTo({ url: "/pages/my/edit-nickname" }); }; const editGender = () => { common_vendor.index.showActionSheet({ itemList: ["男", "女"], success: (res) => { userInfo.value.gender = res.tapIndex + 1; } }); }; const editBirthday = () => { common_vendor.index.showDatePicker({ current: userInfo.value.birthday, success: (res) => { userInfo.value.birthday = res.date; } }); }; const editPhone = () => { common_vendor.index.navigateTo({ url: "/pages/my/edit-phone" }); }; const editEmail = () => { common_vendor.index.navigateTo({ url: "/pages/my/edit-email" }); }; const goVerify = () => { common_vendor.index.navigateTo({ url: "/pages/my/verify" }); }; const togglePrivacy = (key, value) => { privacy.value[key] = value; }; const changePassword = () => { common_vendor.index.navigateTo({ url: "/pages/my/change-password" }); }; const bindPhone = () => { common_vendor.index.navigateTo({ url: "/pages/my/bind-phone" }); }; const logout = () => { common_vendor.index.showModal({ title: "提示", content: "确定要退出登录吗?", success: (res) => { if (res.confirm) { common_vendor.index.reLaunch({ url: "/pages/login/Login" }); } } }); }; return (_ctx, _cache) => { return { a: userInfo.value.avatar, b: common_vendor.o(changeAvatar), c: common_vendor.t(userInfo.value.nickname), d: common_vendor.o(editNickname), e: common_vendor.t(userInfo.value.gender === 1 ? "男" : "女"), f: common_vendor.o(editGender), g: common_vendor.t(userInfo.value.birthday || "请选择"), h: common_vendor.o(editBirthday), i: common_vendor.t(formatPhone(userInfo.value.phone)), j: common_vendor.o(editPhone), k: common_vendor.t(userInfo.value.email || "未绑定"), l: common_vendor.o(editEmail), m: common_vendor.t(userInfo.value.verified ? "已认证" : "未认证"), n: common_vendor.o(goVerify), o: privacy.value.publicProfile, p: common_vendor.o((e) => togglePrivacy("publicProfile", e.detail.value)), q: privacy.value.allowMessage, r: common_vendor.o((e) => togglePrivacy("allowMessage", e.detail.value)), s: common_vendor.o(changePassword), t: common_vendor.t(formatPhone(userInfo.value.phone)), v: common_vendor.o(bindPhone), w: common_vendor.o(logout), x: common_vendor.gei(_ctx, "") }; }; } }; wx.createPage(_sfc_main); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/my/profile.js.map