"use strict"; const common_vendor = require("../../common/vendor.js"); const utils_auth = require("../../utils/auth.js"); const _sfc_main = { __name: "mine", setup(__props) { const isLoggedIn = common_vendor.ref(false); const userInfo = common_vendor.ref({ nickname: "", avatar: "", phone: "" }); const points = common_vendor.ref(900); common_vendor.onMounted(() => { loadUserInfo(); }); const loadUserInfo = () => { isLoggedIn.value = utils_auth.isLoggedIn(); if (isLoggedIn.value) { const storedInfo = utils_auth.getUserInfo(); if (storedInfo) { userInfo.value = storedInfo; } } }; const toggleLogin = () => { if (isLoggedIn.value) { common_vendor.index.showModal({ title: "提示", content: "确定要退出登录吗?", success: (res) => { if (res.confirm) { utils_auth.logout(); isLoggedIn.value = false; userInfo.value = { nickname: "", avatar: "", phone: "" }; common_vendor.index.showToast({ title: "已退出登录", icon: "none" }); } } }); } else { common_vendor.index.navigateTo({ url: "/pages/login/login" }); } }; const handleRecharge = () => { if (!utils_auth.checkLogin(() => { handleRecharge(); })) { return; } common_vendor.index.showToast({ title: "充值功能开发中", icon: "none" }); }; const handleHistory = () => { if (!utils_auth.checkLogin(() => { handleHistory(); })) { return; } common_vendor.index.showToast({ title: "记录功能开发中", icon: "none" }); }; return (_ctx, _cache) => { return common_vendor.e({ a: isLoggedIn.value && userInfo.value.avatar ? userInfo.value.avatar : "/static/images/tab_mine_active.png", b: common_vendor.t(isLoggedIn.value ? userInfo.value.nickname || "微信用户" : "游客"), c: isLoggedIn.value && userInfo.value.phone }, isLoggedIn.value && userInfo.value.phone ? { d: common_vendor.t(userInfo.value.phone) } : {}, { e: common_vendor.t(isLoggedIn.value ? points.value : 0), f: common_vendor.o(handleRecharge), g: common_vendor.o(handleHistory), h: common_vendor.t(isLoggedIn.value ? "退出登录" : "登录"), i: common_vendor.o(toggleLogin) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/program/gupiao-wx/src/pages/mine/mine.vue"]]); wx.createPage(MiniProgramPage);