index.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const config = require("../../config.js");
  4. if (!Array) {
  5. const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
  6. const _easycom_uni_badge2 = common_vendor.resolveComponent("uni-badge");
  7. const _easycom_up_overlay2 = common_vendor.resolveComponent("up-overlay");
  8. (_easycom_up_icon2 + _easycom_uni_badge2 + _easycom_up_overlay2)();
  9. }
  10. const _easycom_up_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
  11. const _easycom_uni_badge = () => "../../uni_modules/uni-badge/components/uni-badge/uni-badge.js";
  12. const _easycom_up_overlay = () => "../../node-modules/uview-plus/components/u-overlay/u-overlay.js";
  13. if (!Math) {
  14. (_easycom_up_icon + _easycom_uni_badge + login + _easycom_up_overlay)();
  15. }
  16. const login = () => "../../components/login.js";
  17. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  18. __name: "index",
  19. setup(__props) {
  20. var _a, _b;
  21. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  22. (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  23. const config$1 = common_vendor.ref({ logo: [], icon: [], file: [] });
  24. const show = common_vendor.ref(false);
  25. const user = common_vendor.computed(() => {
  26. return common_vendor.index.getStorageSync("user");
  27. });
  28. const genderList = common_vendor.ref([]);
  29. common_vendor.onShow(async () => {
  30. await searchConfig();
  31. await searchOther();
  32. await search();
  33. if (!user.value)
  34. show.value = true;
  35. });
  36. const searchConfig = async () => {
  37. config$1.value = common_vendor.index.getStorageSync("config");
  38. };
  39. const searchOther = async () => {
  40. let res;
  41. res = await $api(`dictData`, "GET", { code: "gender", is_use: "0" });
  42. if (res.errcode === 0)
  43. genderList.value = res.data;
  44. };
  45. const search = async () => {
  46. };
  47. const showChange = () => {
  48. show.value = false;
  49. };
  50. const getGender = (i) => {
  51. if (i) {
  52. const r = genderList.value.find((f) => f.value === i);
  53. if (r)
  54. return r.label;
  55. else
  56. return "暂无";
  57. } else
  58. return "暂无";
  59. };
  60. const toRoute = (item) => {
  61. if (user.value && user.value._id) {
  62. common_vendor.index.navigateTo({
  63. url: `/${item.route}?status=${item.status}`
  64. });
  65. } else
  66. show.value = true;
  67. };
  68. const toCommon = (e) => {
  69. if (user.value && user.value._id) {
  70. common_vendor.index.navigateTo({
  71. url: `/${e}`
  72. });
  73. } else
  74. show.value = true;
  75. };
  76. return (_ctx, _cache) => {
  77. return common_vendor.e({
  78. a: common_vendor.unref(user) && common_vendor.unref(user)._id
  79. }, common_vendor.unref(user) && common_vendor.unref(user)._id ? common_vendor.e({
  80. b: common_vendor.unref(user).icon && common_vendor.unref(user).icon.length > 0
  81. }, common_vendor.unref(user).icon && common_vendor.unref(user).icon.length > 0 ? {
  82. c: common_vendor.unref(user).icon[0].url
  83. } : {
  84. d: config$1.value.icon[0].url
  85. }, {
  86. e: common_vendor.t(common_vendor.unref(user).nick_name || "暂无昵称"),
  87. f: common_vendor.t(getGender(common_vendor.unref(user).gender))
  88. }) : {
  89. g: config$1.value.icon[0].url,
  90. h: common_vendor.o(($event) => show.value = true)
  91. }, {
  92. i: common_vendor.p({
  93. name: "arrow-right",
  94. size: "16"
  95. }),
  96. j: common_vendor.o(($event) => toCommon(`pagesMy/order/index?status=${"-1"}`)),
  97. k: common_vendor.f(common_vendor.unref(config.configInfo).orderList, (item, index, i0) => {
  98. return {
  99. a: common_vendor.n(item.icon),
  100. b: common_vendor.t(item.title),
  101. c: "f97bc692-1-" + i0,
  102. d: common_vendor.p({
  103. text: item.num,
  104. absolute: "rightTop",
  105. size: "normal"
  106. }),
  107. e: index,
  108. f: common_vendor.o(($event) => toRoute(item), index)
  109. };
  110. }),
  111. l: common_vendor.f(common_vendor.unref(config.configInfo).menuList, (item, index, i0) => {
  112. return {
  113. a: common_vendor.n(item.icon),
  114. b: common_vendor.t(item.title),
  115. c: "f97bc692-2-" + i0,
  116. d: index,
  117. e: common_vendor.o(($event) => toCommon(item.route), index)
  118. };
  119. }),
  120. m: common_vendor.p({
  121. name: "arrow-right",
  122. size: "16"
  123. }),
  124. n: common_vendor.o(showChange),
  125. o: common_vendor.p({
  126. show: show.value
  127. })
  128. });
  129. };
  130. }
  131. });
  132. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f97bc692"], ["__file", "D:/project/学吧/learn_applet/pages/my/index.vue"]]);
  133. wx.createPage(MiniProgramPage);