index.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_swiper2 = common_vendor.resolveComponent("u-swiper");
  5. const _easycom_up_notice_bar2 = common_vendor.resolveComponent("up-notice-bar");
  6. const _easycom_up_tabs2 = common_vendor.resolveComponent("up-tabs");
  7. const _easycom_up_avatar2 = common_vendor.resolveComponent("up-avatar");
  8. const _easycom_up_cell2 = common_vendor.resolveComponent("up-cell");
  9. const _easycom_up_list_item2 = common_vendor.resolveComponent("up-list-item");
  10. const _easycom_up_list2 = common_vendor.resolveComponent("up-list");
  11. const _easycom_up_overlay2 = common_vendor.resolveComponent("up-overlay");
  12. (_easycom_u_swiper2 + _easycom_up_notice_bar2 + _easycom_up_tabs2 + _easycom_up_avatar2 + _easycom_up_cell2 + _easycom_up_list_item2 + _easycom_up_list2 + _easycom_up_overlay2)();
  13. }
  14. const _easycom_u_swiper = () => "../../node-modules/uview-plus/components/u-swiper/u-swiper.js";
  15. const _easycom_up_notice_bar = () => "../../node-modules/uview-plus/components/u-notice-bar/u-notice-bar.js";
  16. const _easycom_up_tabs = () => "../../node-modules/uview-plus/components/u-tabs/u-tabs.js";
  17. const _easycom_up_avatar = () => "../../node-modules/uview-plus/components/u-avatar/u-avatar.js";
  18. const _easycom_up_cell = () => "../../node-modules/uview-plus/components/u-cell/u-cell.js";
  19. const _easycom_up_list_item = () => "../../node-modules/uview-plus/components/u-list-item/u-list-item.js";
  20. const _easycom_up_list = () => "../../node-modules/uview-plus/components/u-list/u-list.js";
  21. const _easycom_up_overlay = () => "../../node-modules/uview-plus/components/u-overlay/u-overlay.js";
  22. if (!Math) {
  23. (_easycom_u_swiper + _easycom_up_notice_bar + _easycom_up_tabs + _easycom_up_avatar + _easycom_up_cell + _easycom_up_list_item + _easycom_up_list + login + _easycom_up_overlay)();
  24. }
  25. const login = () => "../../components/login.js";
  26. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  27. __name: "index",
  28. setup(__props) {
  29. var _a, _b;
  30. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  31. (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$apifile;
  32. const typeList = common_vendor.ref([
  33. { name: "兴趣", icon: "t-icon-xingqu", type: "0" },
  34. { name: "小学", icon: "t-icon-xiaoxue", type: "1" },
  35. { name: "中学", icon: "t-icon-zhongxue", type: "2" },
  36. { name: "高中", icon: "t-icon-gaozhong", type: "3" }
  37. ]);
  38. const config = common_vendor.ref({ icon: [], logo: [], file: [] });
  39. const list = common_vendor.ref([]);
  40. common_vendor.ref(0);
  41. const subjectList = common_vendor.ref([]);
  42. const show = common_vendor.ref(false);
  43. const user = common_vendor.computed(() => {
  44. return common_vendor.index.getStorageSync("user");
  45. });
  46. common_vendor.onShow(async () => {
  47. await searchConfig();
  48. await searchOther();
  49. await search();
  50. if (!user.value)
  51. show.value = true;
  52. loadmore();
  53. });
  54. const urls = [
  55. "https://cdn.uviewui.com/uview/album/1.jpg",
  56. "https://cdn.uviewui.com/uview/album/2.jpg",
  57. "https://cdn.uviewui.com/uview/album/3.jpg",
  58. "https://cdn.uviewui.com/uview/album/4.jpg",
  59. "https://cdn.uviewui.com/uview/album/5.jpg",
  60. "https://cdn.uviewui.com/uview/album/6.jpg",
  61. "https://cdn.uviewui.com/uview/album/7.jpg",
  62. "https://cdn.uviewui.com/uview/album/8.jpg",
  63. "https://cdn.uviewui.com/uview/album/9.jpg",
  64. "https://cdn.uviewui.com/uview/album/10.jpg"
  65. ];
  66. const scrolltolower = () => {
  67. loadmore();
  68. };
  69. const loadmore = () => {
  70. for (let i = 0; i < 30; i++) {
  71. list.value.push({
  72. url: urls[common_vendor.index.$u.random(0, urls.length - 1)]
  73. });
  74. }
  75. };
  76. const searchConfig = async () => {
  77. config.value = common_vendor.index.getStorageSync("config");
  78. };
  79. const searchOther = async () => {
  80. let res;
  81. res = await $api(`dictData`, "GET", { code: "subject", is_use: "0" });
  82. if (res.errcode === 0)
  83. subjectList.value = res.data;
  84. };
  85. const search = async () => {
  86. };
  87. const toTab = async (data) => {
  88. console.log(data);
  89. };
  90. const showChange = () => {
  91. show.value = false;
  92. };
  93. return (_ctx, _cache) => {
  94. return common_vendor.e({
  95. a: common_vendor.p({
  96. radius: 0,
  97. list: config.value.file,
  98. height: "240px",
  99. indicator: true,
  100. indicatorMode: "dot",
  101. circular: true
  102. }),
  103. b: config.value.notice
  104. }, config.value.notice ? {
  105. c: common_vendor.p({
  106. text: config.value.notice,
  107. duration: "3000"
  108. })
  109. } : {}, {
  110. d: common_vendor.f(typeList.value, (item, index, i0) => {
  111. return {
  112. a: common_vendor.n(item.icon),
  113. b: common_vendor.t(item.name),
  114. c: index
  115. };
  116. }),
  117. e: common_vendor.o(toTab),
  118. f: common_vendor.p({
  119. list: subjectList.value,
  120. keyName: "label"
  121. }),
  122. g: common_vendor.f(list.value, (item, index, i0) => {
  123. return {
  124. a: "4978fed5-6-" + i0 + "," + ("4978fed5-5-" + i0),
  125. b: common_vendor.p({
  126. shape: "square",
  127. size: "35",
  128. src: item.url,
  129. customStyle: "margin: -3px 5px -3px 0"
  130. }),
  131. c: "4978fed5-5-" + i0 + "," + ("4978fed5-4-" + i0),
  132. d: common_vendor.p({
  133. title: `列表长度-${index + 1}`
  134. }),
  135. e: index,
  136. f: "4978fed5-4-" + i0 + ",4978fed5-3"
  137. };
  138. }),
  139. h: common_vendor.o(scrolltolower),
  140. i: common_vendor.o(showChange),
  141. j: common_vendor.p({
  142. show: show.value
  143. })
  144. });
  145. };
  146. }
  147. });
  148. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4978fed5"], ["__file", "D:/project/学吧/learn_applet/pages/home/index.vue"]]);
  149. wx.createPage(MiniProgramPage);