index.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = {
  4. data() {
  5. return {
  6. avatarUrl: "",
  7. phone: "",
  8. nickname: "",
  9. studyList: [
  10. { title: "日历", icon: "/static/calender.png", path: "/pages/calendar/index" },
  11. { title: "我的下载", icon: "/static/xiazai.png", path: "/pages/search/index" },
  12. { title: "错题本", icon: "/static/cuotiben.png", path: "/pages/search/index" },
  13. { title: "超级会员", icon: "/static/supperhuiyuan.png", path: "/pages/discover/index" },
  14. { title: "订阅店铺", icon: "/static/dingyuedianpu.png", path: "/pages/discover/index" }
  15. ],
  16. menuList: [
  17. // <!-- 商家后台模块 -->
  18. { title: "商家店铺后台", icon: "/static/shangjiadianpu.png", path: "/pages/mine/Merchant" },
  19. { title: "回收站", icon: "/static/huishouzhan.png", path: "/pages/mine/recycle" },
  20. { title: "通知设置", icon: "/static/tongzhi.png", path: "/pages/mine/notify" },
  21. { title: "意见反馈", icon: "/static/yijianfankui.png", path: "/pages/mine/feedback" },
  22. { title: "在线客服", icon: "/static/kefu.png", path: "/pages/mine/service" },
  23. { title: "了解小鹅通", icon: "/static/liaojie.png", path: "/pages/mine/about" },
  24. { title: "设置", icon: "/static/shezhi.png", path: "/pages/mine/setting" }
  25. ]
  26. };
  27. },
  28. onLoad() {
  29. this.getUid();
  30. },
  31. methods: {
  32. goToProfile() {
  33. common_vendor.index.navigateTo({ url: "/pages/mine/profile" });
  34. },
  35. goTo(path) {
  36. common_vendor.index.navigateTo({ url: path });
  37. },
  38. async getUid() {
  39. try {
  40. const res = await common_vendor.index.request({
  41. url: "http://localhost:9527/api/getUid",
  42. method: "GET"
  43. });
  44. common_vendor.index.__f__("log", "at pages/mine/index.vue:82", res);
  45. if (res.statusCode === 200) {
  46. this.nickname = res.data.data.nickname;
  47. this.avatarUrl = res.data.data.avatarUrl;
  48. this.phone = res.data.data.phone;
  49. } else {
  50. this.avatarUrl = this.defaultAvatar;
  51. this.phone = "获取失败";
  52. }
  53. } catch (e) {
  54. this.avatarUrl = this.defaultAvatar;
  55. this.phone = "网络错误";
  56. }
  57. }
  58. }
  59. };
  60. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  61. return {
  62. a: $data.avatarUrl,
  63. b: common_vendor.t($data.nickname),
  64. c: common_vendor.t($data.phone),
  65. d: common_vendor.o((...args) => $options.goToProfile && $options.goToProfile(...args)),
  66. e: common_vendor.f($data.studyList, (item, k0, i0) => {
  67. return {
  68. a: item.icon,
  69. b: common_vendor.t(item.title),
  70. c: item.title,
  71. d: common_vendor.o(($event) => $options.goTo(item.path), item.title)
  72. };
  73. }),
  74. f: common_vendor.f($data.menuList, (item, idx, i0) => {
  75. return common_vendor.e({
  76. a: item.icon,
  77. b: common_vendor.t(item.title),
  78. c: common_vendor.o(($event) => $options.goTo(item.path), item.title),
  79. d: idx !== $data.menuList.length - 1
  80. }, idx !== $data.menuList.length - 1 ? {} : {}, {
  81. e: item.title
  82. });
  83. })
  84. };
  85. }
  86. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  87. wx.createPage(MiniProgramPage);
  88. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine/index.js.map