index.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. const $api = common_vendor.inject("$api");
  30. common_vendor.inject("$apifile");
  31. const typeList = common_vendor.ref([
  32. { name: "兴趣", icon: "t-icon-xingqu", type: "0" },
  33. { name: "小学", icon: "t-icon-xiaoxue", type: "1" },
  34. { name: "中学", icon: "t-icon-zhongxue", type: "2" },
  35. { name: "高中", icon: "t-icon-gaozhong", type: "3" }
  36. ]);
  37. const config = common_vendor.ref({ icon: [], logo: [], file: [] });
  38. const list = common_vendor.ref([]);
  39. common_vendor.ref(0);
  40. const subjectList = common_vendor.ref([]);
  41. const show = common_vendor.ref(false);
  42. const user = common_vendor.computed(() => {
  43. return common_vendor.index.getStorageSync("user");
  44. });
  45. common_vendor.onShow(async () => {
  46. await searchConfig();
  47. await searchOther();
  48. await search();
  49. if (!user.value)
  50. show.value = true;
  51. loadmore();
  52. });
  53. const urls = [
  54. "https://cdn.uviewui.com/uview/album/1.jpg",
  55. "https://cdn.uviewui.com/uview/album/2.jpg",
  56. "https://cdn.uviewui.com/uview/album/3.jpg",
  57. "https://cdn.uviewui.com/uview/album/4.jpg",
  58. "https://cdn.uviewui.com/uview/album/5.jpg",
  59. "https://cdn.uviewui.com/uview/album/6.jpg",
  60. "https://cdn.uviewui.com/uview/album/7.jpg",
  61. "https://cdn.uviewui.com/uview/album/8.jpg",
  62. "https://cdn.uviewui.com/uview/album/9.jpg",
  63. "https://cdn.uviewui.com/uview/album/10.jpg"
  64. ];
  65. const scrolltolower = () => {
  66. loadmore();
  67. };
  68. const loadmore = () => {
  69. for (let i = 0; i < 30; i++) {
  70. list.value.push({
  71. url: urls[common_vendor.index.$u.random(0, urls.length - 1)]
  72. });
  73. }
  74. };
  75. const searchConfig = async () => {
  76. config.value = common_vendor.index.getStorageSync("config");
  77. };
  78. const searchOther = async () => {
  79. let res;
  80. res = await $api(`dictData`, "GET", { code: "subject", is_use: "0" });
  81. if (res.errcode === 0)
  82. subjectList.value = res.data;
  83. };
  84. const search = async () => {
  85. };
  86. const toTab = async (data) => {
  87. console.log(data);
  88. };
  89. const showChange = () => {
  90. show.value = false;
  91. };
  92. return (_ctx, _cache) => {
  93. return common_vendor.e({
  94. a: common_vendor.p({
  95. radius: 0,
  96. list: config.value.file,
  97. height: "240px",
  98. indicator: true,
  99. indicatorMode: "dot",
  100. circular: true
  101. }),
  102. b: config.value.notice
  103. }, config.value.notice ? {
  104. c: common_vendor.p({
  105. text: config.value.notice,
  106. duration: "3000"
  107. })
  108. } : {}, {
  109. d: common_vendor.f(typeList.value, (item, index, i0) => {
  110. return {
  111. a: common_vendor.n(item.icon),
  112. b: common_vendor.t(item.name),
  113. c: index
  114. };
  115. }),
  116. e: common_vendor.o(toTab),
  117. f: common_vendor.p({
  118. list: subjectList.value,
  119. keyName: "label"
  120. }),
  121. g: common_vendor.f(list.value, (item, index, i0) => {
  122. return {
  123. a: "4978fed5-6-" + i0 + "," + ("4978fed5-5-" + i0),
  124. b: common_vendor.p({
  125. shape: "square",
  126. size: "35",
  127. src: item.url,
  128. customStyle: "margin: -3px 5px -3px 0"
  129. }),
  130. c: "4978fed5-5-" + i0 + "," + ("4978fed5-4-" + i0),
  131. d: common_vendor.p({
  132. title: `列表长度-${index + 1}`
  133. }),
  134. e: index,
  135. f: "4978fed5-4-" + i0 + ",4978fed5-3"
  136. };
  137. }),
  138. h: common_vendor.o(scrolltolower),
  139. i: common_vendor.o(showChange),
  140. j: common_vendor.p({
  141. show: show.value
  142. })
  143. });
  144. };
  145. }
  146. });
  147. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4978fed5"], ["__file", "D:/project/学吧/learn_applet/pages/home/index.vue"]]);
  148. wx.createPage(MiniProgramPage);