1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- // components/activity/activity.js
- const {
- urlParse
- } = require('../../utils/util.js');
- const app = getApp();
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- className: String,
- adList: Array
- },
- /**
- * 组件的初始数据
- */
- data: {
- _adList: null,
- autoplay: true,
- interval: 5000,
- selectIndex: 0
- },
- lifetimes: {
- attached: function () {
- this.setData({
- _adList: this.properties.adList.map(item => {
- const {
- query,
- url
- } = urlParse(item.appUrl || item.url)
- item.url = url || ''
- item.query = query || {}
-
- return item
- })
- })
- }
- },
- methods: {
- onSlideChangeEnd: function (e) {
- if (this.properties.adList.length > 1) {
- this.setData({
- selectIndex: e.detail.current
- })
- } else {
- return false
- }
- },
- handleTapAction:function(e) {
- const {item} = e.currentTarget.dataset;
- const userInfo = wx.getStorageSync("userInfo");
- if (userInfo && userInfo.token) {
- wx.navigateTo({
- url: "/pages/login/login"
- });
- } else {
- const {model,miniId,path,data,url} = item.query
- if (parseInt(model) == 30) {
- wx.navigateToMiniProgram({
- appId: miniId || '',
- path: path || '',
- extraData:data || {}
- });
- } else {
- wx.navigateTo({
- url: url
- });
- }
- }
- }
- }
- })
|