9.20/1
This commit is contained in:
110
frontend/unpackage/dist/dev/mp-weixin/pages/my/index.js
vendored
Normal file
110
frontend/unpackage/dist/dev/mp-weixin/pages/my/index.js
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_http = require("../../common/http.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
avatarUrl: "/static/logo.png",
|
||||
shopName: "我的店铺",
|
||||
mobile: ""
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.fetchProfile();
|
||||
},
|
||||
computed: {
|
||||
mobileDisplay() {
|
||||
const m = String(this.mobile || "");
|
||||
return m.length === 11 ? m.slice(0, 3) + "****" + m.slice(7) : m || "未绑定手机号";
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async fetchProfile() {
|
||||
try {
|
||||
await common_http.get("/api/dashboard/overview");
|
||||
} catch (e) {
|
||||
}
|
||||
try {
|
||||
const storeName = common_vendor.index.getStorageSync("SHOP_NAME") || "";
|
||||
const avatar = common_vendor.index.getStorageSync("USER_AVATAR") || "";
|
||||
const phone = common_vendor.index.getStorageSync("USER_MOBILE") || "";
|
||||
if (storeName)
|
||||
this.shopName = storeName;
|
||||
if (avatar)
|
||||
this.avatarUrl = avatar;
|
||||
this.mobile = phone;
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
onAvatarError() {
|
||||
this.avatarUrl = "/static/logo.png";
|
||||
},
|
||||
goVip() {
|
||||
common_vendor.index.showToast({ title: "VIP会员(开发中)", icon: "none" });
|
||||
},
|
||||
goMyOrders() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/detail/index" });
|
||||
},
|
||||
goSupplier() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/supplier/select" });
|
||||
},
|
||||
goCustomer() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/customer/select" });
|
||||
},
|
||||
goCustomerQuote() {
|
||||
common_vendor.index.showToast({ title: "客户报价(开发中)", icon: "none" });
|
||||
},
|
||||
goShop() {
|
||||
common_vendor.index.showToast({ title: "店铺管理(开发中)", icon: "none" });
|
||||
},
|
||||
editProfile() {
|
||||
common_vendor.index.showToast({ title: "账号与安全(开发中)", icon: "none" });
|
||||
},
|
||||
goProductSettings() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/product/settings" });
|
||||
},
|
||||
goSystemParams() {
|
||||
common_vendor.index.showToast({ title: "系统参数(开发中)", icon: "none" });
|
||||
},
|
||||
goAbout() {
|
||||
common_vendor.index.navigateTo({ url: "/pages/my/about" });
|
||||
},
|
||||
logout() {
|
||||
try {
|
||||
common_vendor.index.removeStorageSync("TOKEN");
|
||||
common_vendor.index.removeStorageSync("USER_AVATAR");
|
||||
common_vendor.index.removeStorageSync("USER_NAME");
|
||||
common_vendor.index.removeStorageSync("USER_MOBILE");
|
||||
common_vendor.index.removeStorageSync("SHOP_NAME");
|
||||
common_vendor.index.showToast({ title: "已退出", icon: "none" });
|
||||
setTimeout(() => {
|
||||
common_vendor.index.reLaunch({ url: "/pages/index/index" });
|
||||
}, 300);
|
||||
} catch (e) {
|
||||
common_vendor.index.reLaunch({ url: "/pages/index/index" });
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: $data.avatarUrl,
|
||||
b: common_vendor.o((...args) => $options.onAvatarError && $options.onAvatarError(...args)),
|
||||
c: common_vendor.t($data.shopName),
|
||||
d: common_vendor.t($options.mobileDisplay),
|
||||
e: common_vendor.o((...args) => $options.goVip && $options.goVip(...args)),
|
||||
f: common_vendor.o((...args) => $options.goMyOrders && $options.goMyOrders(...args)),
|
||||
g: common_vendor.o((...args) => $options.goSupplier && $options.goSupplier(...args)),
|
||||
h: common_vendor.o((...args) => $options.goCustomer && $options.goCustomer(...args)),
|
||||
i: common_vendor.o((...args) => $options.goCustomerQuote && $options.goCustomerQuote(...args)),
|
||||
j: common_vendor.o((...args) => $options.goShop && $options.goShop(...args)),
|
||||
k: common_vendor.o((...args) => $options.editProfile && $options.editProfile(...args)),
|
||||
l: common_vendor.o((...args) => $options.goProductSettings && $options.goProductSettings(...args)),
|
||||
m: common_vendor.o((...args) => $options.goSystemParams && $options.goSystemParams(...args)),
|
||||
n: common_vendor.o((...args) => $options.goAbout && $options.goAbout(...args)),
|
||||
o: common_vendor.o((...args) => $options.logout && $options.logout(...args))
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/my/index.js.map
|
||||
Reference in New Issue
Block a user