bayi 2 lat temu
rodzic
commit
f7cef0649b

+ 43 - 39
components/banner/index.js

@@ -1,42 +1,46 @@
 Component({
-  properties: {
-    bannerList: {
-      type: Array,
-      value: [],
-      observer() {
-        this.setData({
-          current: 0
-        })
-      }
-    }
-    // banner的classify是:1:官方推荐;2:作品展播;3:官方活动;4:关注作品;5:我的作品 6:收藏作品;
-  },
-  data: {
-    bannerList: [],
-    current: 0
-  },
-  methods: {
-    bannelEvent({
-      currentTarget
-    }) {
-      //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章
-      let {
-        type,
-        content
-      } = currentTarget.dataset
-      if ([2, 3, 4].includes(type)) {
-        wx.navigateTo({
-          url: `/pages/ranking/index?id=${content}&type=${type}`,
-        })
-      } else if (type == 5) {
-        wx.navigateTo({
-          url: `/pages/match/index?activityId=${content}`,
-        })
-      } else if (type == 1) {
-        wx.navigateTo({
-          url: `/pages/rankIntro/index?img=${content}`,
-        })
-      }
+    properties: {
+        bannerList: {
+            type: Array,
+            value: [],
+            observer() {
+                this.setData({
+                    current: 0
+                })
+            }
+        }
+        // banner的classify是:1:官方推荐;2:作品展播;3:官方活动;4:关注作品;5:我的作品 6:收藏作品;
+    },
+    data: {
+        bannerList: [],
+        current: 0
     },
-  }
+    methods: {
+        bannelEvent({
+            currentTarget
+        }) {
+            //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章
+            let {
+                type,
+                content
+            } = currentTarget.dataset
+            if ([2, 3, 4].includes(type)) {
+                wx.navigateTo({
+                    url: `/pages/ranking/index?id=${content}&type=${type}`,
+                })
+            } else if (type == 5) {
+                wx.navigateTo({
+                    url: `/pages/match/index?activityId=${content}`,
+                })
+            } else if (type == 1) {
+                wx.navigateTo({
+                    url: `/pages/rankIntro/index?img=${content}`,
+                })
+            } else if (type == 9) {
+                wx.navigateTo({
+                    url: '/pages/invite/index',
+                })
+            }
+        },
+    }
 })

+ 3 - 16
pages/invite/index.js

@@ -1,16 +1,14 @@
 import {
     getInviteList
 } from '~/api/user'
-Page({
+import share from '~/mixins/share'
 
-    /**
-     * 页面的初始数据
-     */
+Page({
+    behaviors: [share],
     data: {
         list: [],
         count: 0
     },
-
     async onShow() {
         let {
             list
@@ -29,15 +27,4 @@ Page({
     closeTranscript() {
         this.selectComponent("#popUp").hideModal()
     },
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-        const user = wx.getStorageSync('user');
-        return {
-            title: '自从用了它,家里朗朗书声,美妙极了!你家孩子也快来试试!',
-            path: `/pages/index/index?uid=${user.uid}`,
-            imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/learn/50fdd9225ae9b8c71a541981f2c46b95.png'
-        }
-    }
 })

+ 1 - 2
pages/invite/index.json

@@ -1,6 +1,5 @@
 {
     "usingComponents": {
         "popUp": "/components/popUp/index"
-    },
-    "navigationBarTitleText": "永久vip免费拿!"
+    }
 }

+ 0 - 6
pages/medalStore/index.js

@@ -59,10 +59,4 @@ Page({
 
   },
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
-
-  }
 })

+ 6 - 14
pages/my/index.js

@@ -67,6 +67,7 @@ Page({
             productList: products,
             isPreferential
         } = await getProducts()
+        console.log(products, isPreferential);
         this.setData({
             products,
             isPreferential
@@ -86,7 +87,6 @@ Page({
                         let activationRes = await getLearnCard({
                             cardNo: content
                         })
-                        console.log(activationRes);
                         if (activationRes.code == 200) {
                             activationRes = {
                                 code: 200,
@@ -124,15 +124,16 @@ Page({
     async toBuy({
         currentTarget
     }) {
-        // return this.selectComponent('#vipModal').open({
-        //     type: 'svip'
-        // })
+        let productId = currentTarget.dataset.id
+        if (this.data.vipTime == '1') {
+            return
+        }
         wx.showLoading({
             title: '提交中',
             mask: true
         })
         let res = await buyVip({
-            productId: currentTarget.dataset.id
+            productId
         })
         let {
             timeStamp,
@@ -174,15 +175,6 @@ Page({
         wx.navigateTo({
             url: url
         });
-        /*      wx.openChannelsUserProfile({
-               finderUserName: 'sphaBwcNkKMpmwi',
-               success: (res) => {
-                 console.log(res);
-               },
-               fail: (res) => {
-                 console.log(res);
-               }
-             }) */
     },
     clipboar() {
         wx.setClipboardData({

+ 4 - 4
pages/my/index.wxml

@@ -62,19 +62,19 @@
         <view class="tips">请输入学习卡激活码</view>
         <view class="subBtn">激活</view>
     </view>
-    <view class="payBox" wx:if="{{!isPreferential||vipTime=='1'}}">
-        <view class="buyBtn" bindtap="toBuy" data-id="{{products[0].id}}" wx:if="{{!isPreferential}}">
+    <view class="payBox" wx:if="{{!isPreferential||vipTime=='1'}}" bindtap="toBuy" data-id="{{products[0].id}}">
+        <view class="buyBtn" wx:if="{{!isPreferential}}">
             立即开通
         </view>
         <view class="buyBtn" wx:else>
             终身使用
         </view>
     </view>
-    <view class="payBox payBox2" wx:if="{{vipTime!='1'}}">
+    <view class="payBox payBox2" wx:if="{{vipTime!='1'}}" bindtap="toBuy" data-id="{{products[1].id}}">
         <view class="buyBtn" style="font-size: 22rpx;" wx:if="{{vipTime}}">
             有效期:{{filters.formatDate(vipTime,5)}}
         </view>
-        <view class="buyBtn" bindtap="toBuy" data-id="{{products[1].id}}" wx:else>
+        <view class="buyBtn" wx:else>
             {{!vipTime&&!isPreferential?'立即开通':'已到期 请续费使用'}}
         </view>
     </view>

+ 1 - 1
pages/pkResult/index.js

@@ -173,7 +173,7 @@ Page({
                         ctx.fillText(dName, rnamex, rnamey)
                         ctx.font = '19px PingFang';
                         if (this.data.victory.userReadExtend.businessType != 2) {
-                            var lnumx = this.data.equal ? 100 : 100,
+                             var lnumx = this.data.equal ? 100 : 100,
                                 lnumy = this.data.equal ? 150 : 140;
                             ctx.fillText(this.data.victory.userRead.score + '分', lnumx, lnumy)
                             var rnumx = this.data.equal ? 280 : 280,

+ 52 - 52
utils/request.js

@@ -2,62 +2,62 @@ let baseUrl = null
 let oldUrl = null
 
 const {
-  miniProgram: {
-    envVersion
-  }
+    miniProgram: {
+        envVersion
+    }
 } = wx.getAccountInfoSync();
-if (envVersion == 'develop') {
-  baseUrl = 'https://reader-api.efunbox.cn/wx'
-  oldUrl = 'https://reader-api.efunbox.cn'
-} else {
-  baseUrl = 'https://reader-api.ai160.com/wx'
-  oldUrl = 'https://reader-api.ai160.com'
-}
+// if (envVersion == 'develop') {
+baseUrl = 'https://reader-api.efunbox.cn/wx'
+oldUrl = 'https://reader-api.efunbox.cn'
+// } else {
+//   baseUrl = 'https://reader-api.ai160.com/wx'
+//   oldUrl = 'https://reader-api.ai160.com'
+// }
 
 function request(url, method, data, oldBaseUrl = false, intercept = true) {
-  let header = {
-    'uid': wx.getStorageSync('uid') || '',
-    'channelCode': '3001'
-  }
-  return new Promise((reslove, reject) => {
-    wx.request({
-      url: oldBaseUrl ? oldUrl + url : baseUrl + url,
-      method: method,
-      data: data,
-      header: header,
-      success: (result) => {
-        let {
-          data: {
-            code,
-            data = {},
-            message
-          }
-        } = result
-        if (intercept) {
-          if (code == '200') {
-            reslove(data)
-          } else if (code == '1102') {
-            console.log(code, '<=====code1', message);
-            wx.clearStorage()
-          } else if (code) {
-            console.log(code, '<=====code2', message);
-            wx.showToast({
-              title: message,
-              icon: "none",
-              duration: 3000
-            })
-          }
-        } else {
-          reslove(result.data)
-        }
-      },
-      fail: (res) => {
-        console.error(res)
-        reject(res)
-      },
+    let header = {
+        'uid': wx.getStorageSync('uid') || '',
+        'channelCode': '3001'
+    }
+    return new Promise((reslove, reject) => {
+        wx.request({
+            url: oldBaseUrl ? oldUrl + url : baseUrl + url,
+            method: method,
+            data: data,
+            header: header,
+            success: (result) => {
+                let {
+                    data: {
+                        code,
+                        data = {},
+                        message
+                    }
+                } = result
+                if (intercept) {
+                    if (code == '200') {
+                        reslove(data)
+                    } else if (code == '1102') {
+                        console.log(code, '<=====code1', message);
+                        wx.clearStorage()
+                    } else if (code) {
+                        console.log(code, '<=====code2', message);
+                        wx.showToast({
+                            title: message,
+                            icon: "none",
+                            duration: 3000
+                        })
+                    }
+                } else {
+                    reslove(result.data)
+                }
+            },
+            fail: (res) => {
+                console.error(res)
+                reject(res)
+            },
+        })
     })
-  })
 }
 module.exports = {
-  request,
+    request,
 }