Sfoglia il codice sorgente

区分活动和排行榜

bayi 2 anni fa
parent
commit
ec121fdcbf

+ 5 - 1
components/activityList/index.js

@@ -112,8 +112,12 @@ Component({
         })
       }
       if (type == 5) {
+        console.log(type,
+          id,
+          title,
+          explain);
         wx.navigateTo({
-          url: `/pages/match/index`,
+          url: `/pages/match/index?activityId=${id}`,
         })
       }
       if ([2, 3, 4].includes(type)) {

+ 1 - 1
components/banner/index.js

@@ -38,7 +38,7 @@ Component({
         })
       } else if (type == 5) {
         wx.navigateTo({
-          url: '/pages/match/index',
+          url: `/pages/match/index?activityId=${content}`,
         })
       } else if (type == 1) {
         wx.navigateTo({

+ 1 - 1
pages/index/index.js

@@ -17,7 +17,7 @@ Page({
   data: {
     navBarHeight: app.globalData.navBarHeight,
     background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
-    currentType: '2',
+    currentType: '3',
     // 控制一级分类是否固定
     isFixed: false,
     desktopTips: app.globalData.desktopTips,

+ 13 - 5
pages/match/index.js

@@ -28,12 +28,17 @@ Page({
     activityUserList: [],
     bannerList: [],
     myActivityUser: {},
-    explain: ''
+    explain: '',
+    activityId: ''
   },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
+    console.log(options);
+    this.setData({
+      activityId: options.activityId
+    })
     this.getLocUserInfo()
     if (Object.keys(this.data.userInfo).length > 0) {
       this.reload()
@@ -63,7 +68,8 @@ Page({
   // 获取范文
   async getModelTexts() {
     let bannerList = await getModelTexts({
-      grade: this.data.userInfo.grade
+      grade: this.data.userInfo.grade,
+      activityId: this.data.activityId
     })
     this.setData({
       bannerList
@@ -74,7 +80,9 @@ Page({
       activityUserList,
       myActivityUser,
       activity
-    } = await getReadRanking()
+    } = await getReadRanking({
+      activityId: this.data.activityId
+    })
     this.setData({
       activityUserList,
       myActivityUser,
@@ -123,6 +131,7 @@ Page({
     from,
     target
   }) {
+    console.log(this.data.activityId);
     if (from == 'button') {
       let video = target.dataset.info
       console.log(video);
@@ -140,13 +149,12 @@ Page({
     } else {
       return {
         title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
-        path: `/pages/match/index?uid=${wx.getStorageSync('uid')}`,
+        path: `/pages/match/index?uid=${wx.getStorageSync('uid')}&activityId=${this.data.activityId}`,
         imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300-1.jpg'
       }
     }
   },
   creatShare(video) {
-    console.log(video);
     return new Promise(async (resolve, reject) => {
       let isActivity = await isActivityWork(video.userRead.id)
       let context = wx.createSelectorQuery(video.id);