// template/xinHeadSwiper/xinHeadSwiper.js let app = getApp() var miucms = require('../../utils/miucms.js'); Component({ /** * 组件的属性列表 */ properties: { data: Array, page: String, }, /** * 组件的初始数据 */ data: { swiperCurrent: 0, HeadSwiperHeight: 100, swiperHeightObj: {}, loadIndex: 0, // 加载图片的数量 }, /** * 组件的方法列表 */ methods: { // 轮播图的加载事件 loadHeadSwiper(e) { const index = e.target.dataset.index || 0 let ratio = app.globalData.screen_data['windowWidth'] / 750 let originalWidth = e.detail.width; let originalHeight = e.detail.height; let height = originalHeight / originalWidth * 690 * ratio this.data.loadIndex++ let swiperHeightObj = this.data.swiperHeightObj || {} swiperHeightObj[index] = height this.setData({ swiperHeightObj, }) // if (height > this.data.HeadSwiperHeight) { // this.setData({ // HeadSwiperHeight: height // }) // } if (this.data.loadIndex != this.data.data.length) return this.triggerEvent("recordSwiperHeight") }, // 新 轮播图 自动滑动事件,修改下标 bindchangeSwiper(e) { let current = e.detail.current this.setData({ swiperCurrent: current }) }, // 新 轮播图 点击事件 handleSwiper(e) { let { appid, url, statid, finderusername, feedid, type, advtype, } = e.currentTarget.dataset let requestUrl = app.globalData.config.FormidInsert miucms.request(requestUrl, { statid, formid: e.detail.formId }).then(res => {}) // 跳转视频号 if ((type == 5) || (type == 'adv' && advtype == "videofeed_5")) { wx.openChannelsActivity({ finderUserName: finderusername, feedId: feedid }) return false } // 跳转直播 if ((type == 4) || (type == 'adv' && advtype == "videofeed_4")) { wx.openChannelsLive({ finderUserName: finderusername }) return false } // 判断跳转小程序 if (appid) { if (url.charAt(0) !== '/') url = "/" + url wx.navigateToMiniProgram({ appId: appid, path: url }) return false; } // 判断是否是h5页面的 if (url && url.indexOf('http') != -1) { wx.navigateTo({ url: `/pages/webViewwebweb/index?url=${ url }`, }) return false; } if (url) { if (url.charAt(0) !== '/') url = "/" + url wx.navigateTo({ url }) return false; } }, } })