// pages/publics/interpretation/interpretation.js import { imgUrl } from "../../api/request" Page({ /** * 页面的初始数据 */ data: { // 图片前缀 imgUrl: imgUrl, interpretationList: [{ title: '文字解读', channelId: '222894' }, { title: '图文解读', channelId: '158049' }, { title: '视频解读', channelId: '239780' }, { title: '媒体解读', channelId: '298206' } ], currentTab: 0, interpretationListInfo: [], page: 1 }, // 切换 tabNav(e) { let currentTab = e.currentTarget.dataset.index this.setData({ currentTab }) }, // 切换 handleSwiper(e) { let { current, source } = e.detail if (source === 'autoplay' || source === 'touch') { const currentTab = current this.setData({ currentTab }) } this.setData({ interpretationListInfo: [], page: 1 }) // if (current == 2 || current ==3) { // return; // } this.getInterpretationById(); }, // 获取政策解读列表 getInterpretationById() { wx.showToast({ title: '加载中', icon: 'loading', duration: 1500 }) wx.request({ url: 'https://data.cqna.gov.cn/mini/hlw/send?page=' + this.data.page + '&limit=10&channelId=' + this.data.interpretationList[this.data.currentTab].channelId, method: 'GET', success: res => { if (res.data.data.DATA.length > 0) { let temp = res.data.data.DATA; if (this.data.currentTab == 1||this.data.currentTab == 2) { // 图文解读 for (let i=0;i