Browse Source

开发阅读页面逻辑

sun2511 2 years atrás
parent
commit
a651739543

+ 192 - 0
component/readingTips/index.js

@@ -0,0 +1,192 @@
+import {
+    getProducts,
+    getTasks,
+    buyVip,
+    buyNum,
+    submitTask
+} from '~/api/global'
+import {
+    getUserInfo,
+    getVipInfo
+} from '~/api/user'
+const app = getApp()
+
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {},
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+        //弹窗显示控制 
+        showModalStatus: false,
+        isIos: app.globalData.isIOS,
+        userInfo: {},
+        productNum: {},
+        productVip: {},
+        userInfo: {},
+        vipTime: '',
+    },
+    lifetimes: {
+        attached() {
+            this.getProducts()
+            this.setUserInfo()
+        },
+    },
+    methods: {
+        // 提交任务
+        async submitTask({
+            currentTarget
+        }) {
+            let id = currentTarget.dataset.type
+            await submitTask({
+                id
+            })
+            wx.showToast({
+                title: id == '1' ? '签到成功!' : id == 3 ? "观看成功!" : "",
+                icon: "none"
+            })
+            this.setUserInfo()
+        },
+        async getProducts() {
+            let products = await getProducts()
+            let productVip = products.find(item => {
+                return item.type == 1
+            })
+            let productNum = products.find(item => {
+                return item.type == 2
+            })
+            this.setData({
+                productNum,
+                productVip
+            })
+        },
+        // 设置用户信息及vip状态和任务完成情况
+        async setUserInfo() {
+            let userInfo = await getUserInfo()
+            let vipTime = await getVipInfo()
+            this.getTasks()
+            this.setData({
+                userInfo,
+                vipTime,
+            })
+        },
+        // 调起广告
+        rewardedVideo() {
+            if (this.data.tasks.length != 3 || this.data.tasks[2].completed) {
+                return
+            }
+            this.selectComponent('#advert').rewardedVideo();
+        },
+        async getTasks() {
+            let tasks = await getTasks()
+            this.setData({
+                tasks
+            })
+        },
+        //购买vip和购买次数不是一个接口 type 1001是vip,1010是次数
+        async toBuy({
+            currentTarget
+        }) {
+            let productId = currentTarget.dataset.type
+            wx.showLoading({
+                title: '提交中',
+                mask: true
+            })
+            let res = ''
+            if (productId == '1001') {
+                res = await buyVip({
+                    productId
+                }).finally(() => {
+                    wx.hideLoading()
+                })
+            } else if (productId == '1010') {
+                res = await buyNum({
+                    productId
+                }).finally(() => {
+                    wx.hideLoading()
+                })
+            } else {
+                wx.hideLoading()
+                wx.showToast({
+                    title: "支付失败,请重试",
+                    icon: "none"
+                })
+            }
+            let {
+                timeStamp,
+                nonceStr,
+                signType,
+                paySign
+            } = res
+            // package保留字
+            wx.requestPayment({
+                timeStamp,
+                nonceStr,
+                package: res.package,
+                signType,
+                paySign,
+                success(res) {
+                    wx.showToast({
+                        title: "支付成功",
+                        duration: 2500
+                    })
+                    setTimeout(() => {
+                        this.setUserInfo()
+                    }, 1500)
+
+                },
+                fail(res) {
+                    wx.showToast({
+                        title: "支付失败",
+                        icon: "none"
+                    })
+                }
+            })
+        },
+        //底部弹出框
+        showModal: function() {
+            // 背景遮罩层
+            var animation = wx.createAnimation({
+                duration: 200,
+                timingFunction: "linear",
+                delay: 0
+            })
+            animation.translateY(300).step()
+            this.setData({
+                animationData: animation.export(),
+                showModalStatus: true
+            })
+            setTimeout(function() {
+                animation.translateY(0).step()
+                this.setData({
+                    animationData: animation.export()
+                })
+            }.bind(this), 200)
+        },
+
+        //点击背景面任意一处时,弹出框隐藏
+        hideModal: function() {
+            //弹出框消失动画
+            var animation = wx.createAnimation({
+                duration: 200,
+                timingFunction: "linear",
+                delay: 0
+            })
+            animation.translateY(300).step()
+            this.setData({
+                animationData: animation.export(),
+            })
+            setTimeout(function() {
+                animation.translateY(0).step()
+                this.setData({
+                    animationData: animation.export(),
+                    showModalStatus: false
+                })
+            }.bind(this), 200)
+        },
+    }
+})

+ 7 - 0
component/readingTips/index.json

@@ -0,0 +1,7 @@
+{
+    "component": true,
+    "usingComponents": {
+        "rewardedVideo": "/component/rewardedVideo/index"
+    },
+    "styleIsolation": "apply-shared"
+}

+ 219 - 0
component/readingTips/index.less

@@ -0,0 +1,219 @@
+/*使屏幕变暗  */
+.background_screen {
+    width: 100%;
+    height: 100%;
+    position: fixed;
+    top: 0;
+    left: 0;
+    background: #000;
+    opacity: 0.4;
+    overflow: hidden;
+    z-index: 3;
+    color: #fff;
+}
+
+/*对话框 */
+.attr_box {
+    width: 100%;
+    position: fixed;
+    bottom: 0;
+    left: 0;
+    z-index: 4;
+    background-image: linear-gradient(180deg, #FFEBC1 1%, #FEEFCD 54%, #FFFCF0 100%);
+    border-radius: 40px 40px 0 0;
+    border-radius: 40px 40px 0px 0px;
+    border-top-left-radius: 30rpx;
+    border-top-right-radius: 30rpx;
+    padding: 29rpx 18rpx;
+    box-sizing: border-box;
+    /*兼容 IOS<11.2*/
+    padding-bottom: constant(safe-area-inset-bottom);
+    /*兼容 IOS>11.2*/
+    padding-bottom: env(safe-area-inset-bottom);
+
+
+    .payBox {
+        margin-top: 20rpx;
+        padding: 13rpx 30rpx;
+        background-color: white;
+        border-radius: 20rpx;
+
+        .title {
+            font-size: 34rpx;
+            font-weight: bold;
+            color: #000;
+        }
+
+        .pay {
+            margin: 20rpx 0rpx;
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            padding: 0rpx 30rpx;
+            border-radius: 22rpx;
+            overflow: hidden;
+
+            .payLeft {
+                .pLTitle {
+                    font-size: 36rpx;
+                    font-weight: bold;
+                }
+
+                .pLcontent {
+                    font-size: 22rpx;
+                }
+            }
+
+            .payRight {
+                margin: 24rpx 0rpx;
+                padding: 12rpx 28rpx;
+                border-radius: 40rpx;
+                font-size: 24rpx;
+                font-weight: bold;
+            }
+        }
+
+        .vipPay {
+            background: url('http://reader-wx.ai160.com/images/reader/v3/year.png') no-repeat;
+            background-size: cover;
+
+            .vipTitle {
+                color: #FFE6B9;
+            }
+
+            .vipContent {
+                margin-top: 4rpx;
+                color: #FFE6B9;
+            }
+
+            .vipBtn {
+                background-image: linear-gradient(to bottom, #F4E7A8, #F9EDCF);
+                color: #211501;
+            }
+        }
+
+        .buyPay {
+            background: url('http://reader-wx.ai160.com/images/reader/v3/10yuan.png') no-repeat;
+            background-size: cover;
+
+            .payLeft {
+                color: #7D320A;
+                font-size: 36rpx;
+                font-weight: bold;
+            }
+
+            .buyBtn {
+                border: 1rpx solid white;
+                color: white;
+                background-color: #7D320A;
+            }
+        }
+    }
+
+    .surplus {
+        margin-top: 20rpx;
+        padding: 22rpx 30rpx;
+        background-color: white;
+        border-radius: 20rpx;
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        font-size: 32rpx;
+
+        .title {
+            font-size: 34rpx;
+            font-weight: bold;
+            color: #000;
+        }
+
+        .num {
+            color: #F97419;
+            font-weight: bold;
+            margin-right: 10rpx;
+        }
+    }
+
+    .taskBox {
+        margin-top: 20rpx;
+        padding: 20rpx 10rpx 0rpx;
+        background-color: white;
+        border-radius: 20rpx;
+
+        .title {
+            padding: 0rpx 20rpx;
+            font-size: 34rpx;
+            font-weight: bold;
+            color: #000;
+        }
+
+        .task {
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            padding: 30rpx 22rpx;
+            border-bottom: 1px solid #EAEAEA;
+
+            .taskLeft {
+                display: flex;
+                align-items: center;
+                justify-content: space-between;
+
+                .img {
+                    width: 76rpx;
+                    height: 76rpx;
+                    border-radius: 50%;
+                }
+
+                .taskContent {
+                    margin-left: 40rpx;
+
+                    .tcTitle {
+                        font-size: 30rpx;
+                        font-weight: bold;
+                        color: #333;
+                    }
+
+                    .tcNum {
+                        color: #FF6259;
+                        font-size: 26rpx;
+                    }
+                }
+            }
+
+            .taskRight {
+                width: 138rpx;
+                text-align: center;
+                padding: 10rpx 0rpx;
+                border-radius: 40rpx;
+                color: white;
+                background-color: #FC614E;
+                font-size: 30rpx;
+            }
+
+            .taskRight-close {
+                color: #6C6C6C;
+                background: #D0D0D0;
+                box-shadow: 0 2px 2px 0 #AEABAB;
+            }
+
+            .taskSurplus {
+                text-align: center;
+                margin-top: 4rpx;
+                color: #686868;
+                font-size: 20rpx;
+            }
+        }
+
+        .advert {
+            border: none;
+        }
+    }
+
+    .share_cancel {
+        position: absolute;
+        right: 50rpx;
+        top: -80rpx;
+        width: 60rpx;
+        height: 80rpx;
+    }
+}

+ 89 - 0
component/readingTips/index.wxml

@@ -0,0 +1,89 @@
+<view class="half-screen">
+    <!--屏幕背景变暗的背景  -->
+    <view class="background_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view>
+    <!--弹出框  -->
+    <view animation="{{animationData}}" class="attr_box" wx:if="{{showModalStatus}}">
+        <image class="share_cancel" bindtap="hideModal" src="/static/image/lollipop.png"></image>
+        <!-- 支付 -->
+        <view class="payBox" wx:if="{{!isIos}}">
+            <view class="title">
+                付费购
+            </view>
+            <view class="pay vipPay">
+                <view class="payLeft">
+                    <view class="pLTitle vipTitle">
+                        {{productVip.title}}
+                    </view>
+                    <view class="pLcontent vipContent">
+                        {{vipTime?filters.formatDate(vipTime)+'过期':'购买VIP会员,即可畅读全部资源'}}
+                    </view>
+                </view>
+                <view class="payRight vipBtn" bindtap="toBuy" data-type="{{productVip.id}}">
+                    {{vipTime?'立即续费':'立即开通'}}
+                </view>
+            </view>
+            <view class="pay buyPay">
+                <view class="payLeft">
+                    {{productNum.title}}
+                </view>
+                <view class="payRight buyBtn" bindtap="toBuy" data-type="{{productNum.id}}">
+                    立即购买
+                </view>
+            </view>
+        </view>
+        <!-- 剩余使用次数 -->
+        <view class="surplus">
+            <view class="title">剩余使用次数:</view>
+            <view class="num">{{userInfo.experienceAmount}}次</view>
+        </view>
+        <!-- 任务活动 -->
+        <view class="taskBox">
+            <view class="title">免费获取</view>
+            <view class="task">
+                <view class="taskLeft">
+                    <image class="img" src="/static/image/task1.png" alt="" mode="" />
+                    <view class="taskContent">
+                        <view class="tcTitle">
+                            {{tasks[0].title}}
+                        </view>
+                        <view class="tcNum">+{{tasks[0].award}}次</view>
+                    </view>
+                </view>
+                <view class="taskRight {{tasks[0].completed?'taskRight-close':''}}" bindtap="submitTask" data-type='{{tasks[0].id}}'>
+                    {{tasks[0].completed?'已签到':'签到'}}</view>
+            </view>
+            <view class="task">
+                <view class="taskLeft">
+                    <image class="img" src="/static/image/task2.png" alt="" mode="" />
+                    <view class="taskContent">
+                        <view class="tcTitle">
+                            {{tasks[1].title}}
+                        </view>
+                        <view class="tcNum">+{{tasks[1].award}}次/每位</view>
+                    </view>
+                </view>
+                <button open-type="share" class="resetBtn taskRight">去邀请</button>
+            </view>
+            <view class="task advert">
+                <view class="taskLeft">
+                    <image class="img" src="/static/image/task3.png" alt="" mode="" />
+                    <view class="taskContent">
+                        <view class="tcTitle">
+                            {{tasks[2].title}}
+                        </view>
+                        <view class="tcNum">+{{tasks[2].award}}次/每条</view>
+                    </view>
+                </view>
+                <view class="taskRightBox">
+                    <view class="taskRight {{tasks[2].completed?'taskRight-close':''}}" bindtap="rewardedVideo">去观看
+                    </view>
+                    <view class="taskSurplus">
+                        剩余次数:{{tasks[2].completedNum}}/{{tasks[2].num}}
+                    </view>
+                </view>
+            </view>
+        </view>
+    </view>
+</view>
+<!-- 广告组件 -->
+<rewardedVideo id='advert' bind:taskOver="setUserInfo" />

+ 186 - 0
component/readingTips/index.wxss

@@ -0,0 +1,186 @@
+/*使屏幕变暗  */
+.background_screen {
+  width: 100%;
+  height: 100%;
+  position: fixed;
+  top: 0;
+  left: 0;
+  background: #000;
+  opacity: 0.4;
+  overflow: hidden;
+  z-index: 3;
+  color: #fff;
+}
+/*对话框 */
+.attr_box {
+  width: 100%;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  z-index: 4;
+  background-image: linear-gradient(180deg, #FFEBC1 1%, #FEEFCD 54%, #FFFCF0 100%);
+  border-radius: 40px 40px 0 0;
+  border-radius: 40px 40px 0px 0px;
+  border-top-left-radius: 30rpx;
+  border-top-right-radius: 30rpx;
+  padding: 29rpx 18rpx;
+  box-sizing: border-box;
+  /*兼容 IOS<11.2*/
+  padding-bottom: constant(safe-area-inset-bottom);
+  /*兼容 IOS>11.2*/
+  padding-bottom: env(safe-area-inset-bottom);
+}
+.attr_box .payBox {
+  margin-top: 20rpx;
+  padding: 13rpx 30rpx;
+  background-color: white;
+  border-radius: 20rpx;
+}
+.attr_box .payBox .title {
+  font-size: 34rpx;
+  font-weight: bold;
+  color: #000;
+}
+.attr_box .payBox .pay {
+  margin: 20rpx 0rpx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 0rpx 30rpx;
+  border-radius: 22rpx;
+  overflow: hidden;
+}
+.attr_box .payBox .pay .payLeft .pLTitle {
+  font-size: 36rpx;
+  font-weight: bold;
+}
+.attr_box .payBox .pay .payLeft .pLcontent {
+  font-size: 22rpx;
+}
+.attr_box .payBox .pay .payRight {
+  margin: 24rpx 0rpx;
+  padding: 12rpx 28rpx;
+  border-radius: 40rpx;
+  font-size: 24rpx;
+  font-weight: bold;
+}
+.attr_box .payBox .vipPay {
+  background: url('http://reader-wx.ai160.com/images/reader/v3/year.png') no-repeat;
+  background-size: cover;
+}
+.attr_box .payBox .vipPay .vipTitle {
+  color: #FFE6B9;
+}
+.attr_box .payBox .vipPay .vipContent {
+  margin-top: 4rpx;
+  color: #FFE6B9;
+}
+.attr_box .payBox .vipPay .vipBtn {
+  background-image: linear-gradient(to bottom, #F4E7A8, #F9EDCF);
+  color: #211501;
+}
+.attr_box .payBox .buyPay {
+  background: url('http://reader-wx.ai160.com/images/reader/v3/10yuan.png') no-repeat;
+  background-size: cover;
+}
+.attr_box .payBox .buyPay .payLeft {
+  color: #7D320A;
+  font-size: 36rpx;
+  font-weight: bold;
+}
+.attr_box .payBox .buyPay .buyBtn {
+  border: 1rpx solid white;
+  color: white;
+  background-color: #7D320A;
+}
+.attr_box .surplus {
+  margin-top: 20rpx;
+  padding: 22rpx 30rpx;
+  background-color: white;
+  border-radius: 20rpx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  font-size: 32rpx;
+}
+.attr_box .surplus .title {
+  font-size: 34rpx;
+  font-weight: bold;
+  color: #000;
+}
+.attr_box .surplus .num {
+  color: #F97419;
+  font-weight: bold;
+  margin-right: 10rpx;
+}
+.attr_box .taskBox {
+  margin-top: 20rpx;
+  padding: 20rpx 10rpx 0rpx;
+  background-color: white;
+  border-radius: 20rpx;
+}
+.attr_box .taskBox .title {
+  padding: 0rpx 20rpx;
+  font-size: 34rpx;
+  font-weight: bold;
+  color: #000;
+}
+.attr_box .taskBox .task {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 30rpx 22rpx;
+  border-bottom: 1px solid #EAEAEA;
+}
+.attr_box .taskBox .task .taskLeft {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+.attr_box .taskBox .task .taskLeft .img {
+  width: 76rpx;
+  height: 76rpx;
+  border-radius: 50%;
+}
+.attr_box .taskBox .task .taskLeft .taskContent {
+  margin-left: 40rpx;
+}
+.attr_box .taskBox .task .taskLeft .taskContent .tcTitle {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333;
+}
+.attr_box .taskBox .task .taskLeft .taskContent .tcNum {
+  color: #FF6259;
+  font-size: 26rpx;
+}
+.attr_box .taskBox .task .taskRight {
+  width: 138rpx;
+  text-align: center;
+  padding: 10rpx 0rpx;
+  border-radius: 40rpx;
+  color: white;
+  background-color: #FC614E;
+  font-size: 30rpx;
+}
+.attr_box .taskBox .task .taskRight-close {
+  color: #6C6C6C;
+  background: #D0D0D0;
+  box-shadow: 0 2px 2px 0 #AEABAB;
+}
+.attr_box .taskBox .task .taskSurplus {
+  text-align: center;
+  margin-top: 4rpx;
+  color: #686868;
+  font-size: 20rpx;
+}
+.attr_box .taskBox .advert {
+  border: none;
+}
+.attr_box .share_cancel {
+  position: absolute;
+  right: 50rpx;
+  top: -80rpx;
+  width: 60rpx;
+  height: 80rpx;
+}

+ 0 - 60
component/shareSelect/index.js

@@ -1,60 +0,0 @@
-Component({
-    /**
-     * 组件的属性列表
-     */
-    properties: {},
-
-    /**
-     * 组件的初始数据
-     */
-    data: {
-        //弹窗显示控制 
-        showModalStatus: true
-    },
-    /**
-     * 组件的方法列表
-     */
-    methods: {
-        //底部弹出框
-        showModal: function () {
-            // 背景遮罩层
-            var animation = wx.createAnimation({
-                duration: 200,
-                timingFunction: "linear",
-                delay: 0
-            })
-            animation.translateY(300).step()
-            this.setData({
-                animationData: animation.export(),
-                showModalStatus: true
-            })
-            setTimeout(function () {
-                animation.translateY(0).step()
-                this.setData({
-                    animationData: animation.export()
-                })
-            }.bind(this), 200)
-        },
-
-        //点击背景面任意一处时,弹出框隐藏
-        hideModal: function () {
-            //弹出框消失动画
-            var animation = wx.createAnimation({
-                duration: 200,
-                timingFunction: "linear",
-                delay: 0
-            })
-            animation.translateY(300).step()
-            this.setData({
-                animationData: animation.export(),
-            })
-            setTimeout(function () {
-                animation.translateY(0).step()
-                this.setData({
-                    animationData: animation.export(),
-                    showModalStatus: false
-                })
-            }.bind(this), 200)
-        },
-    }
-})

+ 0 - 4
component/shareSelect/index.json

@@ -1,4 +0,0 @@
-{
-    "component": true,
-    "usingComponents": {}
-}

+ 0 - 61
component/shareSelect/index.less

@@ -1,61 +0,0 @@
-/*使屏幕变暗  */
-.background_screen {
-    width: 100%;
-    height: 100%;
-    position: fixed;
-    top: 0;
-    left: 0;
-    background: #000;
-    opacity: 0.2;
-    overflow: hidden;
-    z-index: 3;
-    color: #fff;
-}
-
-/*对话框 */
-.attr_box {
-    width: 100%;
-    overflow: hidden;
-    position: fixed;
-    bottom: 0;
-    left: 0;
-    z-index: 4;
-    background: #fff;
-    border-top-left-radius: 30rpx;
-    border-top-right-radius: 30rpx;
-    padding-top: 20rpx;
-    /*兼容 IOS<11.2*/
-    padding-bottom: constant(safe-area-inset-bottom);
-    /*兼容 IOS>11.2*/
-    padding-bottom: env(safe-area-inset-bottom);
-
-    .share_selects {
-        display: flex;
-        align-items: center;
-        justify-content: space-between;
-        padding: 30rpx 150rpx;
-
-        .share_select {
-            text-align: center;
-
-            .img {
-                width: 90rpx;
-                height: 90rpx;
-            }
-
-            .text {
-                font-size: 28rpx;
-                color: #333;
-            }
-        }
-    }
-
-    .share_cancel {
-        padding: 30rpx 0rpx;
-        border-top: 1px solid #97979763;
-        text-align: center;
-        font-size: 32rpx;
-        letter-spacing: 4rpx;
-        color: #666;
-    }
-}

+ 0 - 22
component/shareSelect/index.wxml

@@ -1,22 +0,0 @@
-<view class="half-screen">
-    <!--屏幕背景变暗的背景  -->
-    <view class="background_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view>
-    <!--弹出框  -->
-    <view animation="{{animationData}}" class="attr_box" wx:if="{{showModalStatus}}">
-        <view class="share_selects">
-            <view class="share_select">
-                <image class="img" src="/static/groupImg/weixin.png" mode="" />
-                <view class="text">
-                    微信好友
-                </view>
-            </view>
-            <view class="share_select">
-                <image class="img" src="/static/groupImg/circle.png" mode="" />
-                <view class="text">
-                    微信朋友圈
-                </view>
-            </view>
-        </view>
-        <view class="share_cancel" bindtap="hideModal">取消</view>
-    </view>
-</view>

+ 0 - 55
component/shareSelect/index.wxss

@@ -1,55 +0,0 @@
-/*使屏幕变暗  */
-.background_screen {
-  width: 100%;
-  height: 100%;
-  position: fixed;
-  top: 0;
-  left: 0;
-  background: #000;
-  opacity: 0.2;
-  overflow: hidden;
-  z-index: 3;
-  color: #fff;
-}
-/*对话框 */
-.attr_box {
-  width: 100%;
-  overflow: hidden;
-  position: fixed;
-  bottom: 0;
-  left: 0;
-  z-index: 4;
-  background: #fff;
-  border-top-left-radius: 30rpx;
-  border-top-right-radius: 30rpx;
-  padding-top: 20rpx;
-  /*兼容 IOS<11.2*/
-  padding-bottom: constant(safe-area-inset-bottom);
-  /*兼容 IOS>11.2*/
-  padding-bottom: env(safe-area-inset-bottom);
-}
-.attr_box .share_selects {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  padding: 30rpx 150rpx;
-}
-.attr_box .share_selects .share_select {
-  text-align: center;
-}
-.attr_box .share_selects .share_select .img {
-  width: 90rpx;
-  height: 90rpx;
-}
-.attr_box .share_selects .share_select .text {
-  font-size: 28rpx;
-  color: #333;
-}
-.attr_box .share_cancel {
-  padding: 30rpx 0rpx;
-  border-top: 1px solid #97979763;
-  text-align: center;
-  font-size: 32rpx;
-  letter-spacing: 4rpx;
-  color: #666;
-}

+ 3 - 1
pages/index/index.js

@@ -945,7 +945,9 @@ Page({
         let data = {
             grade
         };
-        httpRequestApi.settingUserInfo(data).success(res => {})
+        httpRequestApi.settingUserInfo(data).success(res => {
+            this.showPage()
+        })
         return;
         /*  getOpenidNoLogin((res) => {
              console.log('getOpenidNoLogin', res)

+ 1 - 16
pages/my/index.js

@@ -25,11 +25,6 @@ Page({
     },
     onLoad() {
         this.getProducts()
-            /* app.watch(() => {
-                console.log('执行了');
-                this.getProducts()
-                this.setUserInfo()
-            }) */
     },
     async onShow() {
         let uid = wx.getStorageSync('uid') || ''
@@ -50,13 +45,6 @@ Page({
             userInfo,
             vipTime,
         })
-        console.log(userInfo);
-        // 如果用户没有头像及昵称的话就提醒获取
-        // if (!userInfo.user.avatar && !userInfo.user.nickName) {
-        //     wx.navigateTo({
-        //         url: `/pages/login/login`
-        //     });
-        // }
     },
     async getTasks() {
         let tasks = await getTasks()
@@ -149,7 +137,7 @@ Page({
             title: id == '1' ? '签到成功!' : id == 3 ? "观看成功!" : "",
             icon: "none"
         })
-        this.getTasks()
+        this.setUserInfo()
     },
     jump({
         currentTarget
@@ -173,9 +161,6 @@ Page({
         }
         this.selectComponent('#advert').rewardedVideo();
     },
-    /* showShare() {
-        this.selectComponent('#shareSelect').showModal()
-    }, */
     // 分享配置
     onShareAppMessage: function(res) {
         const user = wx.getStorageSync('user');

+ 1 - 2
pages/my/index.json

@@ -1,7 +1,6 @@
 {
     "usingComponents": {
-        "rewardedVideo": "/component/rewardedVideo/index",
-        "shareSelect": "/component/shareSelect/index"
+        "rewardedVideo": "/component/rewardedVideo/index"
     },
     "enablePullDownRefresh": false
 }

+ 1 - 3
pages/my/index.wxml

@@ -153,6 +153,4 @@
     </view>
 </view>
 <!-- 广告组件 -->
-<rewardedVideo id='advert' bind:taskOver="getTasks" />
-<!-- 选择分享方式 -->
-<!-- <shareSelect id="shareSelect" /> -->
+<rewardedVideo id='advert' bind:taskOver="setUserInfo" />

+ 13 - 19
pages/reading/reading.js

@@ -251,22 +251,21 @@ Page({
      *      2 录音结束
      ***/
     audioRecord: function() {
-
-        console.log('111111111111111recordFlag', this.data.recordFlag)
-            // 判断是否有权限朗读 不是vip 并且 不是活动作品
+        // 判断是否有权限朗读 不是vip 并且 不是活动作品
         const isVip = wx.getStorageSync('vip');
         console.log('判断', !isVip && !this.data.isActivityRead)
         if (!isVip && !this.data.isActivityRead) {
-            const imgName = this.data.isIOS ? 'ios_read' : 'android_read';
-            if (!this.data.isIOS) {
-                this.setData({
-                    payPrice: wx.getStorageSync('price')
-                })
-            }
-            this.setData({
-                authHide: !this.data.authHide,
-                authImg: `http://reader-wx.ai160.com/images/reader/pay/${imgName}.png`
-            })
+            this.selectComponent('#readingTips').showModal();
+            /*   const imgName = this.data.isIOS ? 'ios_read' : 'android_read';
+              if (!this.data.isIOS) {
+                  this.setData({
+                      payPrice: wx.getStorageSync('price')
+                  })
+              }
+              this.setData({
+                  authHide: !this.data.authHide,
+                  authImg: `http://reader-wx.ai160.com/images/reader/pay/${imgName}.png`
+              }) */
         } else {
             if (this.recorderManager) {
                 this.recorderManager.stop();
@@ -784,16 +783,11 @@ Page({
         this.getClassInfo(id)
     },
     onShareAppMessage: function(res) {
-        console.log('点击分享按钮', res)
-        console.log('onShareAppMessage', this.data.shareTitle)
-        console.log('onShareAppMessage', this.data.shareId)
-        console.log('onShareAppMessage', this.data.shareImg)
         if (res.from === 'button') {
             return {
                 title: '请欣赏我的课文朗读作品,点赞+评论。',
-                path: `/pages/index/index?readId=${this.data.shareId}&activity=${this.data.ifTapActivity}`,
+                path: `/pages/index/index?readId=${this.data.shareId}&activity=${this.data.ifTapActivity}}&uid=${wx.getStorageSync('uid')}`,
                 imageUrl: this.data.shareImg
-
             }
         } else {
             return {

+ 2 - 1
pages/reading/reading.json

@@ -3,7 +3,8 @@
         "VideoSwiper": "../../../component/video-swiper/index",
         "Comment": "../../../component/comment/comment",
         "StatusBar": "../../../component/statusBar/statusBar",
-        "flowerBox": "../../../component/flowerBox/flowerBox"
+        "flowerBox": "../../../component/flowerBox/flowerBox",
+        "readingTips": "/component/readingTips/index"
 
     },
     "enablePullDownRefresh": false

+ 4 - 13
pages/reading/reading.wxml

@@ -12,10 +12,6 @@
             <image src="../../static/index/listen.png" />
             <text>试听</text>
         </view>
-        <!-- <view class="readingBtn footerBtn" bindtap="audioRecord">
-            <image class="microphone" src="{{btnImgFlag ? recordingGif :microphonePng}}" />
-            <text>{{btnImgFlag ? '点击结束' : btnFlag ? '点击重录' : '开始朗读'}}</text>
-        </view> -->
         <view class="btn_wrapper" bindtap="audioRecord">
             <view class="reading_btn">
                 <image class="microphone" src="{{btnImgFlag ? recordingGif :microphonePng}}" />
@@ -28,12 +24,6 @@
         </view>
     </view>
     <scroll-view class="textSection" wx:if="{{ifTextShow}}" scroll-y="true">
-        <!-- <view class="btn_wrapper" bindtap="audioRecord">
-            <view class="reading_btn">
-                <image src="../../../static/index/star.png" />
-                <text>{{btnImgFlag ? '点击结束' : btnFlag ? '点击重录' : '开始朗读'}}</text>
-            </view>
-        </view> -->
         <text class="textContent">{{readingText}}</text>
     </scroll-view>
     <view class="read_num" wx:if="{{isVideoListShow && totalSize > 0}}">
@@ -119,7 +109,7 @@
         <image class="close_icon" src="../../static/index/close.png" />
     </view>
 </view>
-<view class="auth" hidden="{{authHide}}">
+<!-- <view class="auth" hidden="{{authHide}}">
   <view class="auth-main">
     <image class="auth-icon" src="{{authImg}}" bindtap="goToAuth"></image>
     <view class="auth-price" wx:if="{{payPrice}}">
@@ -132,5 +122,6 @@
     </view>
     <image class="auth-close" bindtap="hideAuth" src="../../static/image/close.png"></image>
   </view>
-</view>
-<flowerBox id="flower-toast" flowerNum="{{flowerNum}}" />
+</view> -->
+<readingTips id="readingTips"></readingTips>
+<flowerBox id="flower-toast" flowerNum="{{flowerNum}}" />