index.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const services_ams = require("../../services/ams.js");
  4. const utils_system = require("../../utils/system.js");
  5. if (!Array) {
  6. const _easycom_wd_swiper2 = common_vendor.resolveComponent("wd-swiper");
  7. _easycom_wd_swiper2();
  8. }
  9. const _easycom_wd_swiper = () => "../../node-modules/wot-design-uni/components/wd-swiper/wd-swiper.js";
  10. if (!Math) {
  11. (_easycom_wd_swiper + UserLoginPopup)();
  12. }
  13. const UserLoginPopup = () => "../../components/userLoginPopup.js";
  14. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  15. __name: "index",
  16. setup(__props) {
  17. const current = common_vendor.ref(0);
  18. const appid = common_vendor.index.getStorageSync("appid");
  19. const onLogin = () => {
  20. common_vendor.index.login({
  21. //获取code,
  22. success: (res) => {
  23. services_ams.getOpenId(res.code).then((res2) => {
  24. common_vendor.index.setStorageSync("openid", res2.data.openid);
  25. });
  26. }
  27. });
  28. };
  29. const bannerList = common_vendor.ref([]);
  30. const getBanner = () => {
  31. services_ams.getCarousel(appid).then((res) => {
  32. bannerList.value = res.data;
  33. });
  34. };
  35. const loginRef = common_vendor.ref(null);
  36. const toActivity = () => {
  37. if (!utils_system.isGetPhone()) {
  38. loginRef.value.show = true;
  39. } else {
  40. common_vendor.index.navigateTo({
  41. url: "/pagesOne/winner/index"
  42. });
  43. }
  44. };
  45. common_vendor.onLoad(() => {
  46. onLogin();
  47. getBanner();
  48. });
  49. common_vendor.onShow(() => {
  50. utils_system.getActivityData();
  51. });
  52. return (_ctx, _cache) => {
  53. return {
  54. a: common_vendor.p({
  55. customClass: "customSwiper",
  56. list: bannerList.value,
  57. autoplay: true,
  58. ["value-key"]: "imageUrl",
  59. value: current.value
  60. }),
  61. b: common_vendor.o(toActivity),
  62. c: common_vendor.sr(loginRef, "f5f2151a-1", {
  63. "k": "loginRef"
  64. }),
  65. d: common_vendor.p({
  66. path: "/pagesOne/winner/index"
  67. })
  68. };
  69. };
  70. }
  71. });
  72. wx.createPage(_sfc_main);