123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import {
- getActivityList
- } from '~/api/activity'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- banner: '',
- cardActivityList: [],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.getActivityList()
- },
- async getActivityList() {
- let {
- banner,
- cardActivityList
- } = await getActivityList()
- cardActivityList.forEach(item => {
- item.currentIndex = 0
- })
- console.log(cardActivityList);
- this.setData({
- cardActivityList,
- banner
- })
- },
- // 换一换
- changeTemplate({
- currentTarget
- }) {
- let index = currentTarget.dataset.index
- let item = currentTarget.dataset.item
- let nextIndex = item.currentIndex
- if (item.currentIndex < item.templateList.length - 1) {
- nextIndex = ++item.currentIndex
- } else {
- nextIndex = 0
- }
- this.setData({
- [`cardActivityList[${index}].currentIndex`]: nextIndex
- })
- },
- toRecording({
- currentTarget
- }) {
- let index = currentTarget.dataset.index
- let target = this.data.cardActivityList[index]
- let id = target.templateList[target.currentIndex].id
- wx.navigateTo({
- url: `/pages/activityDet/index?id=${id}`,
- })
- },
- jumpMyGreeing() {
- wx.navigateTo({
- url: '/pages/greeting/index',
- })
- },
- onShareAppMessage() {
- return {
- title: '拜年还能这么玩?语音贺卡超有趣,点我开玩!',
- path: `/pages/activityList/index?uid=${wx.getStorageSync('uid')}`,
- imageUrl: 'http://reader-wx.ai160.com/images/reader/card/share-new-activity.png'
- }
- },
- onShareTimeline() {
- return {
- title: '拜年还能这么玩?语音贺卡超有趣,点我开玩!',
- query: `uid=${wx.getStorageSync('uid')}`,
- imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/xkx_logo.jpg'
- }
- },
- })
|