index.js 4.7 KB

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