bayi vor 1 Jahr
Ursprung
Commit
81279e81c6

+ 179 - 170
components/activityList/index.js

@@ -1,187 +1,196 @@
-const app = getApp()
-import {
-    getActivities,
-} from '~/api/global'
-import {
-    storeBindingsBehavior
-} from 'mobx-miniprogram-bindings'
-import {
-    store
-} from '~/store/index'
-Component({
-    behaviors: [storeBindingsBehavior],
-    storeBindings: {
-        store,
-        fields: {
-            userInfo: 'userInfo'
+    const app = getApp()
+    import {
+        getActivities,
+    } from '~/api/global'
+    import {
+        storeBindingsBehavior
+    } from 'mobx-miniprogram-bindings'
+    import {
+        store
+    } from '~/store/index'
+    Component({
+        behaviors: [storeBindingsBehavior],
+        storeBindings: {
+            store,
+            fields: {
+                userInfo: 'userInfo'
+            },
         },
-    },
-    properties: {
-        //1活动 2排行榜,3:由外部传参,4:只拿邀新活动
-        classify: {
-            type: Number,
-            value: 1
-        },
-        dataList: {
-            type: Array,
-            value: [],
-            observer(value) {
-                this.setData({
-                    activityList: value
-                })
+        properties: {
+            //1活动 2排行榜,3:由外部传参,4:只拿邀新活动
+            classify: {
+                type: Number,
+                value: 1
+            },
+            dataList: {
+                type: Array,
+                value: [],
+                observer(value) {
+                    this.setData({
+                        activityList: value
+                    })
+                }
             }
-        }
-    },
-    /**
-     * 组件的初始数据
-     */
-    data: {
-        //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章,7年包红包8,次数红包,9邀新
-        type: '',
-        activityList: [],
-        isIos: app.globalData.isIOS,
-        dsqList: []
-    },
-    lifetimes: {
-        attached() {
-            this.getActivities()
         },
-        detached() {
-            this.data.dsqList.forEach(item => {
-                clearInterval(item)
-            })
-        }
-    },
-    /**
-     * 组件的方法列表
-     */
-    methods: {
-        async getActivities() {
-            this.data.dsqList.forEach(item => {
-                clearInterval(item)
-            })
-            let activityList = []
-            if (this.properties.classify == '3') {
-                return
-            } else if (this.properties.classify == '4') {
-                activityList = await getActivities({
-                    classify: 3,
-                    grade: this.data.userInfo.grade
-                })
-            } else {
-                activityList = await getActivities({
-                    classify: this.properties.classify,
-                    grade: this.data.userInfo.grade
-                })
-            }
-
-            this.setData({
-                activityList,
-            })
-            activityList.forEach((item, index) => {
-                if (item.bannerType == 4 && item.voucherType) {
-                    this.activityTimeOut(item.endTime, index)
-                }
-            })
+        /**
+         * 组件的初始数据
+         */
+        data: {
+            //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章,7年包红包8,次数红包,9邀新
+            type: '',
+            activityList: [],
+            isIos: app.globalData.isIOS,
+            dsqList: []
         },
-        jumpUserInfo({
-            currentTarget
-        }) {
-            if (!currentTarget.dataset.uid) {
-                return
+        lifetimes: {
+            attached() {
+                this.getActivities()
+            },
+            detached() {
+                this.data.dsqList.forEach(item => {
+                    clearInterval(item)
+                })
             }
-            wx.navigateTo({
-                url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
-            })
         },
-        activityTimeOut(oTime, index) {
-            let inputTime = new Date(oTime)
-            let dsq = setInterval(() => {
-                var nowTime = new Date();
-                //把剩余时间毫秒数转化为秒
-                var times = (inputTime - nowTime) / 1000;
-                if (times <= 0) {
-                    this.setData({
-                        [`activityList[${index}].hour`]: '00',
-                        [`activityList[${index}].minute`]: '00',
-                        [`activityList[${index}].second`]: '00',
-                        [`activityList[${index}].finish`]: true,
+        /**
+         * 组件的方法列表
+         */
+        methods: {
+            async getActivities() {
+                this.data.dsqList.forEach(item => {
+                    clearInterval(item)
+                })
+                let activityList = []
+                if (this.properties.classify == '3') {
+                    return
+                } else if (this.properties.classify == '4') {
+                    activityList = await getActivities({
+                        classify: 3,
+                        grade: this.data.userInfo.grade
+                    })
+                } else {
+                    activityList = await getActivities({
+                        classify: this.properties.classify,
+                        grade: this.data.userInfo.grade
                     })
-                    return clearInterval(dsq)
                 }
-                //计算小时数 转化为整数
-                var h = parseInt(times / 60 / 60);
-                //如果小时数小于 10,要变成 0 + 数字的形式 赋值给盒子
-                let hour = h < 10 ? "0" + h : h;
-                //计算分钟数 转化为整数
-                var m = parseInt(times / 60 % 60);
-                //如果分钟数小于 10,要变成 0 + 数字的形式 赋值给盒子
-                let minute = m < 10 ? "0" + m : m;
-                //计算描述 转化为整数
-                var s = parseInt(times % 60);
-                //如果秒钟数小于 10,要变成 0 + 数字的形式 赋值给盒子
-                let second = s < 10 ? "0" + s : s;
+                console.log(activityList);
                 this.setData({
-                    [`activityList[${index}].hour`]: hour,
-                    [`activityList[${index}].minute`]: minute,
-                    [`activityList[${index}].second`]: second,
-                    [`activityList[${index}].finish`]: false,
+                    activityList,
                 })
-                times = --times;
-            }, 1000);
-            this.setData({
-                dsqList: [...this.data.dsqList, dsq]
-            })
-        },
-        activityEvent({
-            currentTarget
-        }) {
-            //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章,9:邀新,10ai头像
-            let {
-                type,
-                id,
-                title,
-                explain
-            } = currentTarget.dataset.info
-            if (type == 1) {
-                wx.navigateTo({
-                    url: `/pages/rankIntro/index?title=${title}&img=${explain}`,
+                activityList.forEach((item, index) => {
+                    if (item.bannerType == 4 && item.voucherType) {
+                        this.activityTimeOut(item.endTime, index)
+                    }
                 })
-            }
-            if (type == 5) {
-                wx.navigateTo({
-                    url: `/pages/match/index?activityId=${id}`,
-                })
-            }
-            if ([2, 3, 4].includes(type)) {
+            },
+            jumpUserInfo({
+                currentTarget
+            }) {
+                if (!currentTarget.dataset.uid) {
+                    return
+                }
                 wx.navigateTo({
-                    url: `/pages/ranking/index?id=${id}&type=${type}`,
+                    url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
                 })
-            }
-            if (type == 9) {
-                wx.navigateTo({
-                    url: "/pages/invite/index",
+            },
+            activityTimeOut(oTime, index) {
+                let inputTime = new Date(oTime)
+                let dsq = setInterval(() => {
+                    var nowTime = new Date();
+                    //把剩余时间毫秒数转化为秒
+                    var times = (inputTime - nowTime) / 1000;
+                    if (times <= 0) {
+                        this.setData({
+                            [`activityList[${index}].hour`]: '00',
+                            [`activityList[${index}].minute`]: '00',
+                            [`activityList[${index}].second`]: '00',
+                            [`activityList[${index}].finish`]: true,
+                        })
+                        return clearInterval(dsq)
+                    }
+                    //计算小时数 转化为整数
+                    var h = parseInt(times / 60 / 60);
+                    //如果小时数小于 10,要变成 0 + 数字的形式 赋值给盒子
+                    let hour = h < 10 ? "0" + h : h;
+                    //计算分钟数 转化为整数
+                    var m = parseInt(times / 60 % 60);
+                    //如果分钟数小于 10,要变成 0 + 数字的形式 赋值给盒子
+                    let minute = m < 10 ? "0" + m : m;
+                    //计算描述 转化为整数
+                    var s = parseInt(times % 60);
+                    //如果秒钟数小于 10,要变成 0 + 数字的形式 赋值给盒子
+                    let second = s < 10 ? "0" + s : s;
+                    this.setData({
+                        [`activityList[${index}].hour`]: hour,
+                        [`activityList[${index}].minute`]: minute,
+                        [`activityList[${index}].second`]: second,
+                        [`activityList[${index}].finish`]: false,
+                    })
+                    times = --times;
+                }, 1000);
+                this.setData({
+                    dsqList: [...this.data.dsqList, dsq]
                 })
-            }
-            if (type == 10) {
-                wx.navigateTo({
-                    url: "/pages/aiAvatar/index",
+            },
+            activityEvent({
+                currentTarget
+            }) {
+                //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章,9:邀新,10订购vip会员,11分销
+                let {
+                    type,
+                    id,
+                    title,
+                    explain
+                } = currentTarget.dataset.info
+                if (type == 1) {
+                    wx.navigateTo({
+                        url: `/pages/rankIntro/index?title=${title}&img=${explain}`,
+                    })
+                }
+                if (type == 5) {
+                    wx.navigateTo({
+                        url: `/pages/match/index?activityId=${id}`,
+                    })
+                }
+                if ([2, 3, 4].includes(type)) {
+                    wx.navigateTo({
+                        url: `/pages/ranking/index?id=${id}&type=${type}`,
+                    })
+                }
+                if (type == 9) {
+                    wx.navigateTo({
+                        url: "/pages/invite/index",
+                    })
+                }
+                if (type == 10) {
+                    this.selectComponent('#buyVip').open()
+                }
+                if (type == 11) {
+                    let url = ''
+                    if (!this.data.userInfo.saleUserId) {
+                        url = '/salesperson/pages/sale/index'
+                    } else {
+                        url = '/salesperson/pages/saleOffice/index'
+                    }
+                    wx.navigateTo({
+                        url
+                    })
+                }
+            },
+            drawVoucher({
+                currentTarget
+            }) {
+                let info = currentTarget.dataset.info
+                if (info.finish) {
+                    return
+                }
+                this.selectComponent('#voucher').open({
+                    type: info.type,
+                    id: info.id,
+                    voucherType: info.voucherType,
+                    preferential: info.price
                 })
             }
-        },
-        drawVoucher({
-            currentTarget
-        }) {
-            let info = currentTarget.dataset.info
-            if (info.finish) {
-                return
-            }
-            this.selectComponent('#voucher').open({
-                type: info.type,
-                id: info.id,
-                voucherType: info.voucherType,
-                preferential: info.price
-            })
         }
-    }
-})
+    })

+ 2 - 1
components/activityList/index.json

@@ -1,7 +1,8 @@
 {
   "component": true,
   "usingComponents": {
-    "Voucher": "/components/voucher/index"
+        "buyVip": "/components/buyVip/index",
+        "Voucher": "/components/voucher/index"
   },
   "styleIsolation": "apply-shared"
 }

+ 4 - 2
components/activityList/index.wxml

@@ -2,13 +2,14 @@
 <view class="activityList">
     <block wx:for="{{activityList}}" wx:key="id">
         <!-- 邀新活动 -->
-        <view class="newActivityBox" data-info="{{item}}" bindtap="activityEvent" wx:if="{{item.bannerType==6}}">
+        <view class="newActivityBox" data-info="{{item}}" bindtap="activityEvent"
+            wx:if="{{item.bannerType==6||item.bannerType==7||item.bannerType==8}}">
             <image src="{{item.icon}}" class="cover" />
             <view class="footer">
                 <view class="row">
                     <view class="title">{{item.title}}</view>
                     <view class="btn">
-                        立即参与
+                        {{item.type=='10'?'立即开通':'立即参与'}}
                     </view>
                 </view>
             </view>
@@ -137,4 +138,5 @@
         </view>
     </block>
 </view>
+<buyVip id="buyVip" bind:toBuy="toBuy" />
 <Voucher id="voucher" bind:reload='getActivities' />

+ 2 - 2
components/banner/index.wxml

@@ -8,5 +8,5 @@
             </swiper-item>
         </block>
     </swiper>
-    <buyVip id="buyVip" bind:toBuy="toBuy" />
-</view>
+</view>
+<buyVip id="buyVip" bind:toBuy="toBuy" />

+ 1 - 1
components/buyVip/index.less

@@ -1,6 +1,6 @@
 .buyVip {
     position: fixed;
-    z-index: 12;
+    z-index: 999;
     left: 0rpx;
     top: 0rpx;
     width: 100vw;

+ 1 - 1
components/buyVip/index.wxss

@@ -1,6 +1,6 @@
 .buyVip {
   position: fixed;
-  z-index: 12;
+  z-index: 999;
   left: 0rpx;
   top: 0rpx;
   width: 100vw;

+ 5 - 5
utils/request.js

@@ -6,13 +6,13 @@ const {
         envVersion
     }
 } = wx.getAccountInfoSync();
-if (envVersion == 'develop') {
+// 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'
-}
+// } 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 = {