index.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. const $api = common_vendor.inject("$api");
  21. common_vendor.inject("$config");
  22. const config$1 = common_vendor.ref({ logo: [], icon: [], file: [] });
  23. const show = common_vendor.ref(false);
  24. const user = common_vendor.computed(() => {
  25. return common_vendor.index.getStorageSync("user");
  26. });
  27. const genderList = common_vendor.ref([]);
  28. common_vendor.onShow(async () => {
  29. await searchConfig();
  30. await searchOther();
  31. await search();
  32. if (!user.value)
  33. show.value = true;
  34. });
  35. const searchConfig = async () => {
  36. config$1.value = common_vendor.index.getStorageSync("config");
  37. };
  38. const searchOther = async () => {
  39. let res;
  40. res = await $api(`dictData`, "GET", { code: "gender", is_use: "0" });
  41. if (res.errcode === 0)
  42. genderList.value = res.data;
  43. };
  44. const search = async () => {
  45. };
  46. const showChange = () => {
  47. show.value = false;
  48. };
  49. const getGender = (i) => {
  50. if (i) {
  51. const r = genderList.value.find((f) => f.value === i);
  52. if (r)
  53. return r.label;
  54. else
  55. return "暂无";
  56. } else
  57. return "暂无";
  58. };
  59. const toRoute = (item) => {
  60. if (user.value && user.value._id) {
  61. common_vendor.index.navigateTo({
  62. url: `/${item.route}?status=${item.status}`
  63. });
  64. } else
  65. show.value = true;
  66. };
  67. const toCommon = (e) => {
  68. if (user.value && user.value._id) {
  69. common_vendor.index.navigateTo({
  70. url: `/${e}`
  71. });
  72. } else
  73. show.value = true;
  74. };
  75. return (_ctx, _cache) => {
  76. return common_vendor.e({
  77. a: common_vendor.unref(user) && common_vendor.unref(user)._id
  78. }, common_vendor.unref(user) && common_vendor.unref(user)._id ? common_vendor.e({
  79. b: common_vendor.unref(user).icon && common_vendor.unref(user).icon.length > 0
  80. }, common_vendor.unref(user).icon && common_vendor.unref(user).icon.length > 0 ? {
  81. c: common_vendor.unref(user).icon[0].url
  82. } : {
  83. d: config$1.value.icon[0].url
  84. }, {
  85. e: common_vendor.t(common_vendor.unref(user).nick_name || "暂无昵称"),
  86. f: common_vendor.t(getGender(common_vendor.unref(user).gender))
  87. }) : {
  88. g: config$1.value.icon[0].url,
  89. h: common_vendor.o(($event) => show.value = true)
  90. }, {
  91. i: common_vendor.p({
  92. name: "arrow-right",
  93. size: "16"
  94. }),
  95. j: common_vendor.o(($event) => toCommon(`pagesMy/order/index?status=${"-1"}`)),
  96. k: common_vendor.f(common_vendor.unref(config.configInfo).orderList, (item, index, i0) => {
  97. return {
  98. a: common_vendor.n(item.icon),
  99. b: common_vendor.t(item.title),
  100. c: "f97bc692-1-" + i0,
  101. d: common_vendor.p({
  102. text: item.num,
  103. absolute: "rightTop",
  104. size: "normal"
  105. }),
  106. e: index,
  107. f: common_vendor.o(($event) => toRoute(item), index)
  108. };
  109. }),
  110. l: common_vendor.f(common_vendor.unref(config.configInfo).menuList, (item, index, i0) => {
  111. return {
  112. a: common_vendor.n(item.icon),
  113. b: common_vendor.t(item.title),
  114. c: "f97bc692-2-" + i0,
  115. d: index,
  116. e: common_vendor.o(($event) => toCommon(item.route), index)
  117. };
  118. }),
  119. m: common_vendor.p({
  120. name: "arrow-right",
  121. size: "16"
  122. }),
  123. n: common_vendor.o(showChange),
  124. o: common_vendor.p({
  125. show: show.value
  126. })
  127. });
  128. };
  129. }
  130. });
  131. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f97bc692"], ["__file", "D:/project/学吧/learn_applet/pages/my/index.vue"]]);
  132. wx.createPage(MiniProgramPage);