"use strict"; const common_vendor = require("../../common/vendor.js"); const common_assets = require("../../common/assets.js"); const hooks_useNav = require("../../hooks/useNav.js"); const api_api = require("../../api/api.js"); if (!Array) { const _easycom_statusBar2 = common_vendor.resolveComponent("statusBar"); const _easycom_up_swiper2 = common_vendor.resolveComponent("up-swiper"); const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon"); const _easycom_up_grid_item2 = common_vendor.resolveComponent("up-grid-item"); const _easycom_up_grid2 = common_vendor.resolveComponent("up-grid"); const _easycom_tabbar2 = common_vendor.resolveComponent("tabbar"); (_easycom_statusBar2 + _easycom_up_swiper2 + _easycom_up_icon2 + _easycom_up_grid_item2 + _easycom_up_grid2 + _easycom_tabbar2)(); } const _easycom_statusBar = () => "../../components/statusBar/statusBar.js"; const _easycom_up_swiper = () => "../../uni_modules/uview-plus/components/u-swiper/u-swiper.js"; const _easycom_up_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js"; const _easycom_up_grid_item = () => "../../uni_modules/uview-plus/components/u-grid-item/u-grid-item.js"; const _easycom_up_grid = () => "../../uni_modules/uview-plus/components/u-grid/u-grid.js"; const _easycom_tabbar = () => "../../components/tabbar/tabbar.js"; if (!Math) { (_easycom_statusBar + _easycom_up_swiper + _easycom_up_icon + _easycom_up_grid_item + _easycom_up_grid + _easycom_tabbar)(); } const _sfc_main = { __name: "index", setup(__props) { const { nav, navTo } = hooks_useNav.useNav(); common_vendor.reactive([ "https://cdn.uviewui.com/uview/swiper/swiper1.png", "https://cdn.uviewui.com/uview/swiper/swiper2.png", "https://cdn.uviewui.com/uview/swiper/swiper3.png" ]); const paging = common_vendor.ref(null); let dataList = common_vendor.ref([]); common_vendor.ref([]); let banner = common_vendor.ref([]); let contentList = common_vendor.ref([]); common_vendor.onShow(async () => { common_vendor.index.hideTabBar(); }); common_vendor.onLoad(async (options) => { common_vendor.index.hideTabBar(); if (options.q) { const q = decodeURIComponent(options.q); const query = getUrlParam(q); if (query.num) { common_vendor.index.setStorageSync("invite_code", query.num); } } bannerList(); let _res = await api_api.getContentList({ cid: 1 }); contentList.value = _res.records; getList(); }); function getList() { api_api.shopPage().then((res) => { dataList.value = res.records; }); } function getUrlParam(url, paramName) { let pattern = /([^?&=]+)=([^&]+)/g; let params = {}; let match; while ((match = pattern.exec(url)) !== null) { let key = decodeURIComponent(match[1]); let value = decodeURIComponent(match[2]); if (params[key]) { if (Array.isArray(params[key])) { params[key].push(value); } else { params[key] = [params[key], value]; } } else { params[key] = value; } } if (!paramName) { return params; } else { if (params[paramName]) { return params[paramName]; } else { return ""; } } } let bannerList = async () => { let _res = await api_api.bannerInfo(); banner.value = _res; }; let isPagingRefNotFound = () => { return !paging.value; }; common_vendor.onPullDownRefresh(() => { if (isPagingRefNotFound()) return; paging.value.reload().catch(() => { }); }); common_vendor.onPageScroll((e) => { if (isPagingRefNotFound()) return; paging.value.updatePageScrollTop(e.scrollTop); e.scrollTop < 10 && paging.value.doChatRecordLoadMore(); }); common_vendor.onReachBottom(() => { if (isPagingRefNotFound()) return; paging.value.pageReachBottom(); }); const baseList = common_vendor.reactive([ { img: "/static/icon/dz.png", name: "我的电桩", path: "/pages/piles/piles", login: true }, { img: "/static/icon/zd.png", name: "我的账单", path: "/pages/mine/balanceIncome", login: true }, { img: "/static/icon/hd.png", name: "活动", path: "/pages/activity/index", login: false }, { img: "/static/icon/kf.png", name: "联系客服", call: true } ]); let toShop = (e) => { common_vendor.index.navigateTo({ url: "/pages/shop/shop?id=" + e.id }); }; let bannerClick = (e) => { let data = banner.value[e]; if (data.jumpUrl) { common_vendor.index.navigateTo({ url: data.jumpUrl }); } }; let changeTab = () => { common_vendor.index.switchTab({ url: "/pages/market/market" }); }; return (_ctx, _cache) => { return { a: common_vendor.o(common_vendor.unref(bannerClick)), b: common_vendor.p({ list: common_vendor.unref(banner), keyName: "imageUrl", height: "388rpx", indicator: true }), c: common_vendor.f(baseList, (item, index, i0) => { return { a: "1cf27b2a-4-" + i0 + "," + ("1cf27b2a-3-" + i0), b: common_vendor.p({ imgMode: "widthFix", name: item.img, size: 27 }), c: common_vendor.t(item.name), d: item.openType, e: index, f: common_vendor.o(($event) => common_vendor.unref(navTo)(item.path, item.login, item.call)), g: "1cf27b2a-3-" + i0 + ",1cf27b2a-2" }; }), d: common_vendor.p({ bgColor: "#fff" }), e: common_vendor.p({ border: false, col: "4" }), f: common_vendor.p({ name: "arrow-right", color: "#4874e5", size: "14" }), g: common_vendor.o((...args) => common_vendor.unref(changeTab) && common_vendor.unref(changeTab)(...args)), h: common_vendor.f(common_vendor.unref(contentList), (item, index, i0) => { return common_vendor.e({ a: index <= 2 }, index <= 2 ? { b: common_vendor.t(item.title), c: `/pages/market/detail?id=${item.id}` } : {}, { d: index }); }), i: common_vendor.o(($event) => common_vendor.unref(nav)({ path: "/pages/setMealList/setMealList" })), j: common_assets._imports_0, k: common_assets._imports_1, l: common_vendor.f(common_vendor.unref(dataList), (i, k0, i0) => { return { a: JSON.parse(i.picture)[0], b: common_vendor.t(i.goodsName), c: common_vendor.t(i.salePrice), d: i, e: common_vendor.o(($event) => common_vendor.unref(toShop)(i)) }; }), m: common_vendor.p({ path: "/pages/index/index" }) }; }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1cf27b2a"]]); _sfc_main.__runtimeHooks = 1; my.createPage(MiniProgramPage);