|
@@ -1,64 +1,78 @@
|
|
|
import {
|
|
|
- getActivityList
|
|
|
+ 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
|
|
|
+ /**
|
|
|
+ * 页面的初始数据
|
|
|
+ */
|
|
|
+ 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',
|
|
|
- })
|
|
|
- },
|
|
|
+ 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'
|
|
|
+ }
|
|
|
+ },
|
|
|
})
|