sun2511 2 jaren geleden
bovenliggende
commit
b63b292f84

+ 1 - 1
app.json

@@ -1,9 +1,9 @@
 {
     "pages": [
         "pages/index/index",
+        "pages/login/login",
         "pages/my/index",
         "pages/userWorks/index",
-        "pages/login/login",
         "pages/reading/reading",
         "pages/social/works/works",
         "pages/social/insideMessage/insideMessage",

+ 202 - 212
component/comment/comment.js

@@ -1,234 +1,224 @@
 // component/comment.js
 import httpRequestApi from '../../utils/APIClient';
 import {
-  formatDate
+    formatDate
 } from '../../utils/util';
 
 Component({
-  /**
-   * 组件的属性列表
-   */
-  properties: {
-    commentId: {
-      type: Number,
-      observer: function observer(id) {
-        this.getReply(id)
-      }
-    }
-
-  },
-
-  /**
-   * 组件的初始数据
-   */
-  data: {
-    inputValue: '',
-    showControl: 0,
-    commentNum: 0,
-    commentList: [],
-    ifGetFocus: false,
-    replyType: 'works' ,// 回复类型,works是回复作品,comment是回复评论
-    isScroll: true,
-    adjustPosition: true
-  },
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        commentId: {
+            type: Number,
+            observer: function observer(id) {
+                this.getReply(id)
+            }
+        }
 
-  /**
-   * 组件的方法列表
-   */
-  methods: {
-    // 获取评论信息
-    getReply: function (columnId) {
-      httpRequestApi.getReply(this.uid, columnId, 1, 10).success((res) => {
-        console.log('reply', res)
-        const commentList = res.data.data.list;
-        const commentNum = res.data.data.totalSize;
-        console.log('评论数量', commentNum)
-        commentList.forEach((item) => {
-          const temp = {};
-          temp.nickName = item.user.wechatName;
-          temp.avatar = item.user.avatar;
-          temp.uid = item.user.uid;
-          temp.text = item.detailDesc;
-          temp.id = item.id;
-          temp.replyCount = item.replyCount;
-          temp.time = formatDate(item.gmtCreated, 3);
-          temp.likes = item.likeCount || 0;
-          temp.isLike = item.isLike;
-          temp.replyList = item.replyVOList;
-          temp.showControl = 0;
-          this.data.commentList.push(temp);
-        });
-        this.setData({
-          commentList: this.data.commentList,
-          commentNum: commentNum
-        }, () => {
-          console.log('评论列表', this.data.commentList)
-        })
-      });
-    },
-    showMore: function showMore(e) {
-      let index = e.currentTarget.dataset.index || index === 0 ? e.currentTarget.dataset.index : e.target.dataset.index;
-      let str = `commentList[${index}].showControl`;
-      this.setData({
-        [str]: 10
-      })
-      console.log('showControl', this.data.commentList[index].showControl)
     },
 
-    textInput: function (e) {
-      console.log('键入', e.detail.value)
-      this.setData({
-        inputValue: e.detail.value
-      })
-    },
-    // 获取焦点事件
-    bindfocus(e) {
-      this.setData({
-        isScroll: false
-      })
-      // this.triggerEvent('inputFocus');
+    /**
+     * 组件的初始数据
+     */
+    data: {
+        inputValue: '',
+        showControl: 0,
+        commentNum: 0,
+        commentList: [],
+        ifGetFocus: false,
+        replyType: 'works', // 回复类型,works是回复作品,comment是回复评论
+        isScroll: true,
+        adjustPosition: true
     },
-    // 失去焦点事件
-    closeblur(e) {
-      this.setData({
-        isScroll: true
-      })
-      // this.triggerEvent('inputBlur');
-    },
-    // 评论作品
-    sendReply: function sendReply(e) {
-      console.log('sendReply', e.detail.value)
-      if (this.data.replyType === 'works') {
-        let data = {
-          columnId: this.data.commentId,
-          colunmNames: 'what',
-          detailDesc: e.detail.value ? e.detail.value : this.data.inputValue,
-        }
-        this.replyWorks(data);
-      }
-      if (this.data.replyType === 'comment') {
-        let data = {
-          postsId: this.data.postId,
-          content: e.detail.value ? e.detail.value : this.data.inputValue
-        }
-        console.log(321232123123, data)
-
-        this.replyComment(data);
-      }
 
-    },
-    // 点赞评论
-    likeComment: function (e) {
-      console.log(e);
-      let postId = e.currentTarget.dataset.id ? e.currentTarget.dataset.id : e.target.dataset.id;
-      let index = e.currentTarget.dataset.index || e.currentTarget.dataset.index === 0 ? e.currentTarget.dataset.index : e.target.dataset.index;
-      httpRequestApi.likeCommend(postId).success(res => {
-        console.log('点赞点赞点赞', res.data);
-        const str = `commentList[${index}].likes`;
-        const strImg = `commentList[${index}].isLike`;
-        if (res.data.data) {
-          this.setData({
-            [str]: res.data.data,
-            [strImg]: true
-          })
-        }
-        if (res.data.count > 0) {
-          this.setData({
-            flowerNum: res.data.count
-          })
-          this.flowerAnimationHandler();
-        }
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        // 获取评论信息
+        getReply: function(columnId) {
+            httpRequestApi.getReply(this.uid, columnId, 1, 10).success((res) => {
+                console.log('reply', res)
+                const commentList = res.data.data.list;
+                const commentNum = res.data.data.totalSize;
+                console.log('评论数量', commentNum)
+                commentList.forEach((item) => {
+                    const temp = {};
+                    temp.nickName = item.user.nickName;
+                    temp.avatar = item.user.avatar;
+                    temp.uid = item.user.uid;
+                    temp.text = item.detailDesc;
+                    temp.id = item.id;
+                    temp.replyCount = item.replyCount;
+                    temp.time = formatDate(item.gmtCreated, 3);
+                    temp.likes = item.likeCount || 0;
+                    temp.isLike = item.isLike;
+                    temp.replyList = item.replyVOList;
+                    temp.showControl = 0;
+                    this.data.commentList.push(temp);
+                });
+                this.setData({
+                    commentList: this.data.commentList,
+                    commentNum: commentNum
+                }, () => {
+                    console.log('评论列表', this.data.commentList)
+                })
+            });
+        },
+        showMore: function showMore(e) {
+            let index = e.currentTarget.dataset.index || index === 0 ? e.currentTarget.dataset.index : e.target.dataset.index;
+            let str = `commentList[${index}].showControl`;
+            this.setData({
+                [str]: 10
+            })
+            console.log('showControl', this.data.commentList[index].showControl)
+        },
 
-      });
-    },
-    // 回复作品
-    replyWorks: function (data) {
-      httpRequestApi.postReply(data).success(res => {
-        console.log(res)
-        this.setData({
-          pageNo: 1,
-          commentList: []
-        }, () => {
-          this.getReply(this.data.commentId);
-          this.setData({
-            inputValue: '',
-          })
-          if (res.data.count > 0) {
+        textInput: function(e) {
+            console.log('键入', e.detail.value)
             this.setData({
-              flowerNum: res.data.count
+                inputValue: e.detail.value
             })
-            this.flowerAnimationHandler();
-          }
+        },
+        // 获取焦点事件
+        bindfocus(e) {
+            this.setData({
+                    isScroll: false
+                })
+                // this.triggerEvent('inputFocus');
+        },
+        // 失去焦点事件
+        closeblur(e) {
+            this.setData({
+                    isScroll: true
+                })
+                // this.triggerEvent('inputBlur');
+        },
+        // 评论作品
+        sendReply: function sendReply(e) {
+            if (this.data.replyType === 'works') {
+                let data = {
+                    columnId: this.data.commentId,
+                    colunmNames: 'what',
+                    detailDesc: e.detail.value ? e.detail.value : this.data.inputValue,
+                }
+                this.replyWorks(data);
+            }
+            if (this.data.replyType === 'comment') {
+                let data = {
+                    postsId: this.data.postId,
+                    content: e.detail.value ? e.detail.value : this.data.inputValue
+                }
+                console.log(321232123123, data)
 
-        })
-      });
-    },
-    catchComment: function catchComment(e) {
-      let postId = e.currentTarget.dataset.id ? e.currentTarget.dataset.id : e.target.dataset.id;
-      let index = e.currentTarget.dataset.index || e.currentTarget.dataset.index === 0 ? e.currentTarget.dataset.index : e.target.dataset.index;
-      this.setData({
-        postId: postId,
-        replyType: 'comment',
-        ifGetFocus: true,
-        postIndex: index
-      })
-      console.log(this.data.ifGetFocus)
+                this.replyComment(data);
+            }
 
-    },
-    // 回复评论
-    replyComment: function (data) {
-      httpRequestApi.postReplyComment(data).success(res => {
+        },
+        // 点赞评论
+        likeComment: function(e) {
+            console.log(e);
+            let postId = e.currentTarget.dataset.id ? e.currentTarget.dataset.id : e.target.dataset.id;
+            let index = e.currentTarget.dataset.index || e.currentTarget.dataset.index === 0 ? e.currentTarget.dataset.index : e.target.dataset.index;
+            httpRequestApi.likeCommend(postId).success(res => {
+                console.log('点赞点赞点赞', res.data);
+                const str = `commentList[${index}].likes`;
+                const strImg = `commentList[${index}].isLike`;
+                if (res.data.data) {
+                    this.setData({
+                        [str]: res.data.data,
+                        [strImg]: true
+                    })
+                }
+                if (res.data.count > 0) {
+                    this.setData({
+                        flowerNum: res.data.count
+                    })
+                }
 
-        this.setData({
-          replyInfo: '',
-        }, () => {
-          this.getReplyInner(this.data.commentId);
-          this.setData({
-            inputValue: '',
-            replyType: 'works',
-            ifGetFocus: false
-          })
-          if (res.data.count > 0) {
-            this.setData({
-              flowerNum: res.data.count
-            })
-            this.flowerAnimationHandler();
-          }
-        });
-      });
-    },
-    // 发布楼中楼评论后渲染之前列表
-    getReplyInner: function (columnId) {
-      httpRequestApi.getReply(this.uid, columnId, 1, 10).success((res) => {
-        const commentList = res.data.data.list;
-        commentList.forEach((item, index) => {
-          console.log('回复列表', index)
-          console.log('回复列表', this.data.postIndex)
+            });
+        },
+        // 回复作品
+        replyWorks: function(data) {
+            httpRequestApi.postReply(data).success(res => {
+                console.log(res)
+                this.setData({
+                    pageNo: 1,
+                    commentList: []
+                }, () => {
+                    this.getReply(this.data.commentId);
+                    this.setData({
+                        inputValue: '',
+                    })
+                    if (res.data.count > 0) {
+                        this.setData({
+                            flowerNum: res.data.count
+                        })
+                    }
 
-          if (index === this.data.postIndex) {
-            let replyList = item.replyVOList;
-            console.log('回复列表', replyList)
-            let str = `commentList[${index}].replyList`;
-            let strShow = `commentList[${index}].showControl`;
-            let strReply = `commentList[${index}].replyCount`;
+                })
+            });
+        },
+        catchComment: function catchComment(e) {
+            let postId = e.currentTarget.dataset.id ? e.currentTarget.dataset.id : e.target.dataset.id;
+            let index = e.currentTarget.dataset.index || e.currentTarget.dataset.index === 0 ? e.currentTarget.dataset.index : e.target.dataset.index;
             this.setData({
-              [str]: replyList,
-              [strShow]: 10,
-              [strReply]: replyList.length
-            }, () => {
-              console.log('刷新后列表', this.data.commentList)
+                postId: postId,
+                replyType: 'comment',
+                ifGetFocus: true,
+                postIndex: index
             })
-            return;
-          };
-        })
+        },
+        // 回复评论
+        replyComment: function(data) {
+            httpRequestApi.postReplyComment(data).success(res => {
 
-      });
-    },
-    flowerAnimationHandler: function () {
-      this.flowerBox = this.selectComponent("#flower-toast");
-      console.log('this.flower', this.flowerBox)
-      this.flowerBox.comeOut();
-    },
-  }
+                this.setData({
+                    replyInfo: '',
+                }, () => {
+                    this.getReplyInner(this.data.commentId);
+                    this.setData({
+                        inputValue: '',
+                        replyType: 'works',
+                        ifGetFocus: false
+                    })
+                    if (res.data.count > 0) {
+                        this.setData({
+                            flowerNum: res.data.count
+                        })
+                    }
+                });
+            });
+        },
+        // 发布楼中楼评论后渲染之前列表
+        getReplyInner: function(columnId) {
+            httpRequestApi.getReply(this.uid, columnId, 1, 10).success((res) => {
+                const commentList = res.data.data.list;
+                commentList.forEach((item, index) => {
+                    console.log('回复列表', index)
+                    console.log('回复列表', this.data.postIndex)
+
+                    if (index === this.data.postIndex) {
+                        let replyList = item.replyVOList;
+                        console.log('回复列表', replyList)
+                        let str = `commentList[${index}].replyList`;
+                        let strShow = `commentList[${index}].showControl`;
+                        let strReply = `commentList[${index}].replyCount`;
+                        this.setData({
+                            [str]: replyList,
+                            [strShow]: 10,
+                            [strReply]: replyList.length
+                        }, () => {
+                            console.log('刷新后列表', this.data.commentList)
+                        })
+                        return;
+                    };
+                })
+
+            });
+        },
+
+    }
 
-})
+})

+ 1 - 2
component/comment/comment.wxml

@@ -11,7 +11,7 @@
                 <text class="comment_text" space="false">{{item.text}}</text>
                 <view class="comment_reply_wrapper" wx:if="{{item.replyCount > 0}}">
                     <view class="comment_reply_item" wx:for="{{item.replyList}}" wx:for-item="inner" wx:if="{{index <= item.showControl}}" wx:key="id">
-                        <text class="reply_nickname">{{inner.user.wechatName}}:</text>
+                        <text class="reply_nickname">{{inner.user.nickName}}:</text>
                         <text class="reply_text">{{inner.content}}</text>
                     </view>
                     <view wx:if="{{item.replyCount > 1 && item.showControl == 0}}" catchtap="showMore" data-index="{{index}}" class="more_btn">
@@ -34,7 +34,6 @@
             </view>
         </view>
     </view>
-    <flowerBox id="flower-toast" flowerNum="{{flowerNum}}" />
 </scroll-view>
 <view class="comment_input">
     <input name="send_input" adjust-position="{{adjustPosition}}" bindfocus="bindfocus" bindblur="closeblur" class="send_input" confirm-type="hold" focus="{{ifGetFocus}}" value="{{inputValue}}" bindinput="textInput" bindconfirm="sendReply" placeholder="留下你的赞美,鼓励一下。" />

+ 190 - 190
component/group/group.js

@@ -2,202 +2,202 @@ import httpRequestApi from '../../utils/APIClient';
 import util from '../../utils/util';
 const app = getApp();
 export const groupInit = (that) => {
-  if(!that.data.groupData){
-    that.setData({
-      groupData: {
-        recommendList: [],
-        bookList: [],
-        sendGroupFlag: true,
-        selectFlag: [],
-        isIPX: app.globalData.isIPX,
-        timeList: [],
-        listLength: '',
-        baseIndex: 0,
-        isIOS: app.globalData.isIOS,
-        alertFlag: false,
-        myGroupGoing: 0
-      },
-      groupIndex: 1
-    })
-  }
+    if (!that.data.groupData) {
+        that.setData({
+            groupData: {
+                recommendList: [],
+                bookList: [],
+                sendGroupFlag: true,
+                selectFlag: [],
+                isIPX: app.globalData.isIPX,
+                timeList: [],
+                listLength: '',
+                baseIndex: 0,
+                isIOS: app.globalData.isIOS,
+                alertFlag: false,
+                myGroupGoing: 0
+            },
+            groupIndex: 1
+        })
+    }
+
+    //推荐团购 flag是判断是否获取全部课程
+    that.recommend = function() {
+        if (that.data.groupData.bookList.length === 0) {
+            that.getGroupList();
+        }
+        console.log(that.data.listLength)
+        let osType = app.globalData.isIOS ? 'IOS' : 'ANDROID'
+        httpRequestApi.getGroupList(that.data.groupIndex, osType).success((res) => {
 
-  //推荐团购 flag是判断是否获取全部课程
-  that.recommend = function () {
-    if(that.data.groupData.bookList.length === 0){
-      that.getGroupList();
+            const recommendListTemp = [];
+            res.data.data.list.forEach(item => {
+                const temp = {};
+                temp.avatar = item.organizer.avatar;
+                temp.nickName = item.organizer.nickName;
+                temp.productTitle = item.groupPurchaseOrder.productTitle;
+                temp.headCount = item.groupPurchaseOrder.headcount;
+                temp.joinCount = item.groupPurchaseOrder.joinCount;
+                temp.lastTime = item.groupPurchaseOrder.closeTime - item.currentTime <= 0 ? '时间不足,' : util.lastHours(item.groupPurchaseOrder.closeTime - item.currentTime);
+                temp.id = item.groupPurchaseOrder.id;
+                // that.data.groupData.recommendList.push(temp);
+                recommendListTemp.push(temp);
+            })
+            const recommendListStr = "groupData.recommendList";
+            const listLengthStr = "groupData.listLength";
+            const totalSizeStr = "groupData.totalSize";
+            // const recommendListThreeStr = "groupData.recommendListThree";
+            that.setData({
+                [recommendListStr]: recommendListTemp,
+                // [recommendListThreeStr]: that.data.groupData.recommendList.slice(that.data.groupData.baseIndex, that.data.groupData.baseIndex + 3),
+                listLength: res.data.data.totalNo,
+                [listLengthStr]: res.data.data.totalNo,
+                [totalSizeStr]: res.data.data.totalSize
+            })
+            that.getMyGroupGoing()
+        }).fail((error) => {
+            console.log('错误', error)
+        })
     }
-    console.log(that.data.listLength)
-    let osType = app.globalData.isIOS ? 'IOS' : 'ANDROID'
-    httpRequestApi.getGroupList(that.data.groupIndex,osType).success((res) => {
-      
-      const recommendListTemp = [];
-      res.data.data.list.forEach(item => {
-        const temp = {};
-        temp.avatar = item.organizer.avatar;
-        temp.wechatName = item.organizer.wechatName;
-        temp.productTitle = item.groupPurchaseOrder.productTitle;
-        temp.headCount = item.groupPurchaseOrder.headcount;
-        temp.joinCount = item.groupPurchaseOrder.joinCount;
-        temp.lastTime = item.groupPurchaseOrder.closeTime - item.currentTime <= 0 ? '时间不足,' : util.lastHours(item.groupPurchaseOrder.closeTime - item.currentTime);
-        temp.id = item.groupPurchaseOrder.id;
-        // that.data.groupData.recommendList.push(temp);
-        recommendListTemp.push(temp);
-      })
-      const recommendListStr = "groupData.recommendList";
-      const listLengthStr = "groupData.listLength";
-      const totalSizeStr = "groupData.totalSize";
-      // const recommendListThreeStr = "groupData.recommendListThree";
-      that.setData({
-        [recommendListStr]: recommendListTemp,
-        // [recommendListThreeStr]: that.data.groupData.recommendList.slice(that.data.groupData.baseIndex, that.data.groupData.baseIndex + 3),
-        listLength: res.data.data.totalNo,
-        [listLengthStr]: res.data.data.totalNo,
-        [totalSizeStr]: res.data.data.totalSize
-      })
-      that.getMyGroupGoing()
-    }).fail((error) => {
-      console.log('错误', error)
-    })
-  }
 
-  // 获取我的正在进行中的团
-  that.getMyGroupGoing = function(){
-    httpRequestApi.getMyGroupGoing().success(res=>{
-      console.log(res)
-      const str = 'groupData.myGroupGoing';
-      that.setData({
-        [str]: res.data.data
-      })
-    })
-  },
-  //请求数据封装
-  that.getGroupList = function () {
-    httpRequestApi.getAllBooks(1, 10).success((res) => {
-      console.log('全部课', res.data.data.list)
-      that.data.groupData.bookList = res.data.data.list;
-      console.log(that.data.groupData.bookList)
-      res.data.data.list.forEach(element => {
-        that.data.groupData.selectFlag.push(true);
-      });
-      that.setData({
-        groupData: that.data.groupData
-      })
-      httpRequestApi.userIntoPage('pages/index/index','首页热团').success((res)=>{
-        
-      })
-    }).fail((error) => {
-      console.log('错误', error)
-    })
-  };
+    // 获取我的正在进行中的团
+    that.getMyGroupGoing = function() {
+            httpRequestApi.getMyGroupGoing().success(res => {
+                console.log(res)
+                const str = 'groupData.myGroupGoing';
+                that.setData({
+                    [str]: res.data.data
+                })
+            })
+        },
+        //请求数据封装
+        that.getGroupList = function() {
+            httpRequestApi.getAllBooks(1, 10).success((res) => {
+                console.log('全部课', res.data.data.list)
+                that.data.groupData.bookList = res.data.data.list;
+                console.log(that.data.groupData.bookList)
+                res.data.data.list.forEach(element => {
+                    that.data.groupData.selectFlag.push(true);
+                });
+                that.setData({
+                    groupData: that.data.groupData
+                })
+                httpRequestApi.userIntoPage('pages/index/index', '首页热团').success((res) => {
 
-  that.recommend();
+                })
+            }).fail((error) => {
+                console.log('错误', error)
+            })
+        };
 
-  //点击换一换
-  that.change = function () {
-    that.data.groupIndex++
-    console.log(that.data.listLength)
-    console.log(that.data.groupIndex)
-    if (that.data.groupIndex > that.data.listLength) {
-      that.setData({
-        groupIndex: 1
-      })
-    } else {
-      that.setData({
-        groupIndex: that.data.groupIndex
-      })
-    }
-    that.recommend(that.data.groupIndex)
-  }
-  //点击跳转
-  that.more = function ({
-    currentTarget
-  }) {
-    wx.navigateTo({
-      url: `../main/books/books`
-    })
-  }
-  //发起团购
-  that.sendGroup = function () {
-    that.data.groupData.sendGroupFlag = !that.data.groupData.sendGroupFlag;
-    that.setData({
-      groupData: that.data.groupData
-    })
-  }
-  //选中团购课程
-  that.selectImg = function ({
-    currentTarget
-  }) {
-    const ind = currentTarget.dataset.ind;
-    //判断单选
-    that.data.groupData.selectFlag.forEach((item, index) => {
-      if (index == ind) {
-        that.data.groupData.selectFlag[ind] = !that.data.groupData.selectFlag[ind];
-      } else {
-        that.data.groupData.selectFlag[index] = true;
-      }
-    })
-    that.setData({
-      groupData: that.data.groupData
-    })
-  }
-  //点击确定
-  that.sure = function () {
-    that.data.groupData.selectFlag.forEach((item, index) => {
-      if (!item) {
-        const productId = that.data.groupData.bookList[index].id;
-        const title = that.data.groupData.bookList[index].title
-        wx.navigateTo({
-          url: `/pages/groupPage/grade-details/grade-details?productId=${productId}&title=${title}`
-        })
-      }
-    })
+    that.recommend();
 
-  }
-  //跳转到我的团购
-  that.myGroup = function () {
-    wx.navigateTo({
-      url: `/pages/groupPage/my-group/my-group`
-    })
-    wx.setNavigationBarTitle({
-      title: '我的团购'
-    })
-  }
-  // IOS提示不能参团
-  that.showAlert = function () {
-    let str = "groupData.alertFlag"
-    that.setData({
-      [str]: !that.data.groupData.alertFlag
-    })
-    console.log(that.data.groupData.alertFlag)
-  }
-  //跳转到团购详情页
-  that.groupDetail = function ({
-    currentTarget
-  }) {
-    // if (that.data.groupData.isIOS) {
-    //   that.showAlert();
-    //   return;
-    // }
-    const productId = currentTarget.dataset.productid;
-    const id = currentTarget.dataset.id;
-    const groupId = currentTarget.dataset.groupid;
-    const ind = currentTarget.dataset.ind;
-    const groupType = that.data.groupData.recommendList[ind].groupType;
-    console.log(id)
-    wx.navigateTo({
-      // url: `/pages/groupPage/group-details/group-details?productId=${productId}&id=${id}&groupId=${groupId}`
-      url: `/pages/groupPage/group-details/group-details?productId=${id}`
-    })
-    // if(groupType === "PROMOTION") {
-    //   wx.navigateTo({
-    //     url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${id}&groupId=${groupId}`
-    //   })
-    // }else  {
-    //   wx.navigateTo({
-    //     url: `/pages/groupPage/group-details/group-details?productId=${productId}&id=${id}&groupId=${groupId}`
-    //   })
-    // }
+    //点击换一换
+    that.change = function() {
+            that.data.groupIndex++
+                console.log(that.data.listLength)
+            console.log(that.data.groupIndex)
+            if (that.data.groupIndex > that.data.listLength) {
+                that.setData({
+                    groupIndex: 1
+                })
+            } else {
+                that.setData({
+                    groupIndex: that.data.groupIndex
+                })
+            }
+            that.recommend(that.data.groupIndex)
+        }
+        //点击跳转
+    that.more = function({
+            currentTarget
+        }) {
+            wx.navigateTo({
+                url: `../main/books/books`
+            })
+        }
+        //发起团购
+    that.sendGroup = function() {
+            that.data.groupData.sendGroupFlag = !that.data.groupData.sendGroupFlag;
+            that.setData({
+                groupData: that.data.groupData
+            })
+        }
+        //选中团购课程
+    that.selectImg = function({
+            currentTarget
+        }) {
+            const ind = currentTarget.dataset.ind;
+            //判断单选
+            that.data.groupData.selectFlag.forEach((item, index) => {
+                if (index == ind) {
+                    that.data.groupData.selectFlag[ind] = !that.data.groupData.selectFlag[ind];
+                } else {
+                    that.data.groupData.selectFlag[index] = true;
+                }
+            })
+            that.setData({
+                groupData: that.data.groupData
+            })
+        }
+        //点击确定
+    that.sure = function() {
+            that.data.groupData.selectFlag.forEach((item, index) => {
+                if (!item) {
+                    const productId = that.data.groupData.bookList[index].id;
+                    const title = that.data.groupData.bookList[index].title
+                    wx.navigateTo({
+                        url: `/pages/groupPage/grade-details/grade-details?productId=${productId}&title=${title}`
+                    })
+                }
+            })
 
-  }
+        }
+        //跳转到我的团购
+    that.myGroup = function() {
+            wx.navigateTo({
+                url: `/pages/groupPage/my-group/my-group`
+            })
+            wx.setNavigationBarTitle({
+                title: '我的团购'
+            })
+        }
+        // IOS提示不能参团
+    that.showAlert = function() {
+            let str = "groupData.alertFlag"
+            that.setData({
+                [str]: !that.data.groupData.alertFlag
+            })
+            console.log(that.data.groupData.alertFlag)
+        }
+        //跳转到团购详情页
+    that.groupDetail = function({
+        currentTarget
+    }) {
+        // if (that.data.groupData.isIOS) {
+        //   that.showAlert();
+        //   return;
+        // }
+        const productId = currentTarget.dataset.productid;
+        const id = currentTarget.dataset.id;
+        const groupId = currentTarget.dataset.groupid;
+        const ind = currentTarget.dataset.ind;
+        const groupType = that.data.groupData.recommendList[ind].groupType;
+        console.log(id)
+        wx.navigateTo({
+                // url: `/pages/groupPage/group-details/group-details?productId=${productId}&id=${id}&groupId=${groupId}`
+                url: `/pages/groupPage/group-details/group-details?productId=${id}`
+            })
+            // if(groupType === "PROMOTION") {
+            //   wx.navigateTo({
+            //     url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${id}&groupId=${groupId}`
+            //   })
+            // }else  {
+            //   wx.navigateTo({
+            //     url: `/pages/groupPage/group-details/group-details?productId=${productId}&id=${id}&groupId=${groupId}`
+            //   })
+            // }
+
+    }
 
 }

+ 1 - 1
component/group/group.wxml

@@ -6,7 +6,7 @@
           <view class="group-bars">
             <view class="group-head">
               <image src="{{item.avatar}}"></image>
-              <text>{{item.wechatName}}</text>
+              <text>{{item.nickName}}</text>
             </view>
             <view class="group-jion">
               <view class="top-title">

+ 294 - 294
component/hot/hot.js

@@ -1,330 +1,330 @@
 import httpRequestApi from '../../utils/APIClient';
 import {
-  formatDate
+    formatDate
 } from '../../utils/util';
 export const hotInit = (that) => {
-  if (!that.data.hotData) {
-    that.setData({
-      hotData: {
-        title: '热门',
-        autoplay: false,
-        swiperCurrent: 0,
-        interval: 5000,
-        duration: 700,
-        circular: true,
-        hotWareCardFirst: 'hotWareCardFirst',
-        hotWareCard: 'hotWareCard',
-        hotSearch: '',
-        banner: [],
-        recommend: [],
-        hotWorks: [],
-        winH: that.data.winH,
-        searchIcon: true,
-        unReadMessageNum: 0,
-        myCourse: [],
-        inputFocus: false,
-        inputValue: '',
-        baiduFlag: false
-        // circular: true
-      }
-    })
-  }
-  // 搜索方法
-  that.searchHandler = () => {
-    if (that.data.hotInput.lenght !== 0) {
-        wx.navigateTo({
-          url: `../main/searchResult/searchResult?keyWords=${that.data.hotInput}`
+    if (!that.data.hotData) {
+        that.setData({
+            hotData: {
+                title: '热门',
+                autoplay: false,
+                swiperCurrent: 0,
+                interval: 5000,
+                duration: 700,
+                circular: true,
+                hotWareCardFirst: 'hotWareCardFirst',
+                hotWareCard: 'hotWareCard',
+                hotSearch: '',
+                banner: [],
+                recommend: [],
+                hotWorks: [],
+                winH: that.data.winH,
+                searchIcon: true,
+                unReadMessageNum: 0,
+                myCourse: [],
+                inputFocus: false,
+                inputValue: '',
+                baiduFlag: false
+                    // circular: true
+            }
+        })
+    }
+    // 搜索方法
+    that.searchHandler = () => {
+        if (that.data.hotInput.lenght !== 0) {
+            wx.navigateTo({
+                url: `../main/searchResult/searchResult?keyWords=${that.data.hotInput}`
+            })
+        }
+        const str = 'hotData.inputValue';
+        that.setData({
+            [str]: ''
         })
-      }
-      const str = 'hotData.inputValue';
-      that.setData({
-        [str]: ''
-      })
     };
     // 输入框获取焦点 放大镜消失
     that.searchIconDisappear = () => {
-      const str = 'hotData.searchIcon'
-      that.setData({
-        [str]: false
-      })
+        const str = 'hotData.searchIcon'
+        that.setData({
+            [str]: false
+        })
     };
     that.searchIconCome = () => {
-      const str = 'hotData.searchIcon'
-      that.setData({
-        [str]: true
-      })
+        const str = 'hotData.searchIcon'
+        that.setData({
+            [str]: true
+        })
     };
     // 百度弹窗弹出
     that.clickBaidu = () => {
-      const str = 'hotData.baiduFlag'
-      that.setData({
-        [str]: true
-      });
+        const str = 'hotData.baiduFlag'
+        that.setData({
+            [str]: true
+        });
     };
     // 百度弹窗关闭
     that.xiaoduClick = () => {
-      const str = 'hotData.baiduFlag'
-      that.setData({
-        [str]: false
-      });
+        const str = 'hotData.baiduFlag'
+        that.setData({
+            [str]: false
+        });
     };
     // 百度保存图片
-    that.PreservationXiaodu =  () => {
-      wx.getImageInfo({
-        src: 'https://reader.image.lingjiao.cn/reader/resource/海报.png',
-        success (res) {
-          wx.saveImageToPhotosAlbum({
-            filePath: res.path,
-            success: (res) => {
-              wx.showModal({
-                title: '海报已保存至相册',
-                content: '快去分享给小伙伴吧',
-                confirmText: '我知道了',
-                showCancel: false,
-                success(res) {
-                  console.log('用户点击确定')
-                }
-              })
-              const str = 'hotData.baiduFlag'
-              that.setData({
-                [str]: false
-              });
-            },
-            fail: res => {
-              console.log(res)
-              wx.getSetting({
-                success(res) {
-                  if (!res.authSetting['scope.writePhotosAlbum']) {
-                    wx.showModal({
-                      title: '无法保存分享图片到相册',
-                      content: '点击右上角浮点按钮->设置,进行授权',
-                      confirmText: '我知道了',
-                      showCancel: false,
-                      success(res) {
-                        console.log('用户点击确定')
-                      }
-                    })
-                  }
-                }
-              })
+    that.PreservationXiaodu = () => {
+        wx.getImageInfo({
+            src: 'https://reader.image.lingjiao.cn/reader/resource/海报.png',
+            success(res) {
+                wx.saveImageToPhotosAlbum({
+                    filePath: res.path,
+                    success: (res) => {
+                        wx.showModal({
+                            title: '海报已保存至相册',
+                            content: '快去分享给小伙伴吧',
+                            confirmText: '我知道了',
+                            showCancel: false,
+                            success(res) {
+                                console.log('用户点击确定')
+                            }
+                        })
+                        const str = 'hotData.baiduFlag'
+                        that.setData({
+                            [str]: false
+                        });
+                    },
+                    fail: res => {
+                        console.log(res)
+                        wx.getSetting({
+                            success(res) {
+                                if (!res.authSetting['scope.writePhotosAlbum']) {
+                                    wx.showModal({
+                                        title: '无法保存分享图片到相册',
+                                        content: '点击右上角浮点按钮->设置,进行授权',
+                                        confirmText: '我知道了',
+                                        showCancel: false,
+                                        success(res) {
+                                            console.log('用户点击确定')
+                                        }
+                                    })
+                                }
+                            }
+                        })
+                    }
+                })
             }
-          })
-        }
-      })
+        })
 
     };
-  // 输入框输入
-  that.inputHandler = (e) => {
-      that.setData({
-        hotInput: e.detail.value
-      });
+    // 输入框输入
+    that.inputHandler = (e) => {
+        that.setData({
+            hotInput: e.detail.value
+        });
     };
     // 输入框聚焦
     that.inputFocus = () => {
-      const str = 'hotData.inputFocus'
-      that.setData({
-        [str]: true
-      });
-      console.log(that.data.hotData.inputFocus)
+        const str = 'hotData.inputFocus'
+        that.setData({
+            [str]: true
+        });
+        console.log(that.data.hotData.inputFocus)
     };
     // 打开全部课本
     that.openBooks = (e) => {
-      wx.navigateTo({
-        url: `../main/books/books`
-      })
-    }
-  // 打开更多页面
-  that.openMore = () => {
-    wx.navigateTo({
-      url: `../main/week/week`
-    })
-  }
-  // 打开课程页面
-  that.openClass = (e, lessonId) => {
-    if (lessonId) {
-      wx.navigateTo({
-        url: `../main/class/class?id=${lessonId}`
-      })
-    } else {
-      let id = e.currentTarget.dataset.classid;
-      let title = e.currentTarget.dataset.title;
-      wx.navigateTo({
-        url: `../main/class/class?id=${id}&title=${title}`
-      })
+            wx.navigateTo({
+                url: `../main/books/books`
+            })
+        }
+        // 打开更多页面
+    that.openMore = () => {
+            wx.navigateTo({
+                url: `../main/week/week`
+            })
+        }
+        // 打开课程页面
+    that.openClass = (e, lessonId) => {
+            if (lessonId) {
+                wx.navigateTo({
+                    url: `../main/class/class?id=${lessonId}`
+                })
+            } else {
+                let id = e.currentTarget.dataset.classid;
+                let title = e.currentTarget.dataset.title;
+                wx.navigateTo({
+                    url: `../main/class/class?id=${id}&title=${title}`
+                })
+            }
+        }
+        // 打开用户作品页面
+    that.openWorks = (e) => {
+        let readId = e.currentTarget.dataset.readid;
+        let title = e.currentTarget.dataset.title;
+        wx.navigateTo({
+            url: `../social/works/works?id=${readId}&title=${title}`
+        })
     }
-  }
-  // 打开用户作品页面
-  that.openWorks = (e) => {
-    let readId = e.currentTarget.dataset.readid;
-    let title = e.currentTarget.dataset.title;
-    wx.navigateTo({
-      url: `../social/works/works?id=${readId}&title=${title}`
-    })
-  }
-  that.getIndex = () => {
-    const uid = wx.getStorageSync('uid');
-    httpRequestApi.getIndex(
-      uid
-    ).success((res) => {
-      const recommend = res.data.data.recommendLesson;
-      const recommendTemp = [];
-      recommend.forEach(item => {
-        const oTemp = {};
-        oTemp.img = item.boothContent;
-        oTemp.classId = item.operationContent;
-        oTemp.title = item.title;
-        oTemp.summary = item.summary;
-        recommendTemp.push(oTemp);
-      });
-      let recommendIndex = 'hotData.recommend';
-      that.setData({
-        [recommendIndex]: recommendTemp
-      });
-      httpRequestApi.userIntoPage('pages/index/index', '首页推荐').success((res) => {
+    that.getIndex = () => {
+        const uid = wx.getStorageSync('uid');
+        httpRequestApi.getIndex(
+            uid
+        ).success((res) => {
+            const recommend = res.data.data.recommendLesson;
+            const recommendTemp = [];
+            recommend.forEach(item => {
+                const oTemp = {};
+                oTemp.img = item.boothContent;
+                oTemp.classId = item.operationContent;
+                oTemp.title = item.title;
+                oTemp.summary = item.summary;
+                recommendTemp.push(oTemp);
+            });
+            let recommendIndex = 'hotData.recommend';
+            that.setData({
+                [recommendIndex]: recommendTemp
+            });
+            httpRequestApi.userIntoPage('pages/index/index', '首页推荐').success((res) => {
 
-      })
-    })
-  }
-  that.getHotRecommend = (uid) => {
-    httpRequestApi.getHotRecommend(
-      uid
-    ).success((res) => {
-      // 点击切换按钮时 只刷新我的课程和未读消息 官方推荐和热门不加载
-      const recommendRes = res.data.data;
-      console.log(that.data.hotData.hotWorks.length)
-      if (that.data.hotData.hotWorks.length > 0) {
-        const myCourseStr = 'hotData.myCourse'
-        const isMessageNormal = 'hotData.isMessageNormal'
-        const unReadMessageContent = 'hotData.unReadMessageContent'
-        // unread为true时显示 未读消息,unread为false时显示通知消息,并且通知消息不可读
-        that.setData({
-          [myCourseStr]: recommendRes.myCourse,
-          [isMessageNormal]: recommendRes.unread,
-          // [unReadMessageContent]: recommendRes.unread ? recommendRes.unreadMsg.title : '',
-          // [unReadMessageContent]: recommendRes.unread ? recommendRes.unreadMsg.title : recommendRes.annunciateMsg.title
-          [unReadMessageContent]: ''
+            })
         })
+    }
+    that.getHotRecommend = (uid) => {
+        httpRequestApi.getHotRecommend(
+            uid
+        ).success((res) => {
+            // 点击切换按钮时 只刷新我的课程和未读消息 官方推荐和热门不加载
+            const recommendRes = res.data.data;
+            console.log(that.data.hotData.hotWorks.length)
+            if (that.data.hotData.hotWorks.length > 0) {
+                const myCourseStr = 'hotData.myCourse'
+                const isMessageNormal = 'hotData.isMessageNormal'
+                const unReadMessageContent = 'hotData.unReadMessageContent'
+                    // unread为true时显示 未读消息,unread为false时显示通知消息,并且通知消息不可读
+                that.setData({
+                    [myCourseStr]: recommendRes.myCourse,
+                    [isMessageNormal]: recommendRes.unread,
+                    // [unReadMessageContent]: recommendRes.unread ? recommendRes.unreadMsg.title : '',
+                    // [unReadMessageContent]: recommendRes.unread ? recommendRes.unreadMsg.title : recommendRes.annunciateMsg.title
+                    [unReadMessageContent]: ''
+                })
 
-        return;
-      }
-      recommendRes.hotReader.forEach(item => {
-        const temp = {};
-        temp.title = item.userRead ? item.userRead.title : '';
-        temp.summary = item.userRead.summary;
-        temp.img = item.userRead.iconImg;
-        temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
-        temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
-        temp.classId = item.userRead.id;
-        temp.time = formatDate(item.userRead.gmtCreated, 3);
-        temp.avatar = item.user ? item.user.avatar : '';
-        temp.profession = item.user ? item.user.profession : '';
-        temp.uid = item.user ? item.user.uid : '';
-        // temp.avatar = item.user.avatar;
-        temp.nickName = item.user ? item.user.wechatName : '';
-        // recommendWorks.push(temp);
-        that.data.hotData.hotWorks.push(temp);
-      });
-      const hotStr = 'hotData.hotWorks'
-      const myCourseStr = 'hotData.myCourse'
-      const isMessageNormal = 'hotData.isMessageNormal'
-      const unReadMessageContent = 'hotData.unReadMessageContent'
-      that.setData({
-        [hotStr]: that.data.hotData.hotWorks,
-        [myCourseStr]: recommendRes.myCourse,
-        [isMessageNormal]: recommendRes.unread,
-        // [unReadMessageContent]: recommendRes.unread ? recommendRes.unreadMsg.title : recommendRes.annunciateMsg.title,
-        [unReadMessageContent]: '',
-        unfinishedCount: recommendRes.unfinishedCount
-      })
-    })
-  }
+                return;
+            }
+            recommendRes.hotReader.forEach(item => {
+                const temp = {};
+                temp.title = item.userRead ? item.userRead.title : '';
+                temp.summary = item.userRead.summary;
+                temp.img = item.userRead.iconImg;
+                temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
+                temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
+                temp.classId = item.userRead.id;
+                temp.time = formatDate(item.userRead.gmtCreated, 3);
+                temp.avatar = item.user ? item.user.avatar : '';
+                temp.profession = item.user ? item.user.profession : '';
+                temp.uid = item.user ? item.user.uid : '';
+                // temp.avatar = item.user.avatar;
+                temp.nickName = item.user ? item.user.nickName : '';
+                // recommendWorks.push(temp);
+                that.data.hotData.hotWorks.push(temp);
+            });
+            const hotStr = 'hotData.hotWorks'
+            const myCourseStr = 'hotData.myCourse'
+            const isMessageNormal = 'hotData.isMessageNormal'
+            const unReadMessageContent = 'hotData.unReadMessageContent'
+            that.setData({
+                [hotStr]: that.data.hotData.hotWorks,
+                [myCourseStr]: recommendRes.myCourse,
+                [isMessageNormal]: recommendRes.unread,
+                // [unReadMessageContent]: recommendRes.unread ? recommendRes.unreadMsg.title : recommendRes.annunciateMsg.title,
+                [unReadMessageContent]: '',
+                unfinishedCount: recommendRes.unfinishedCount
+            })
+        })
+    }
 
-  that.getHotRecommendSecond = (uid, pageNo, pageSize) => {
-    httpRequestApi.getHotRecommendSecond(uid, pageNo, pageSize).success(res => {
-      console.log(res)
-      const recommendRes = res.data.data.list;
-      if (recommendRes.length === 0) return;
-      // const recommendWorks = [];
-      recommendRes.forEach(item => {
-        const temp = {};
-        temp.title = item.userRead.title;
-        temp.summary = item.userRead.summary;
-        temp.img = item.userRead.iconImg;
-        temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
-        temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
-        temp.classId = item.userRead.id;
-        temp.time = formatDate(item.userRead.gmtCreated, 3);
-        temp.avatar = item.user.avatar;
-        temp.profession = item.user.profession;
-        temp.uid = item.user.uid;
-        // temp.avatar = item.user.avatar;
-        temp.nickName = item.user.wechatName;
-        // recommendWorks.push(temp);
-        that.data.hotData.hotWorks.push(temp);
-      });
-      const hotStr = 'hotData.hotWorks'
-      that.setData({
-        [hotStr]: that.data.hotData.hotWorks,
-        recommendTotalNo: res.data.data.totalNo
-      })
-    })
-  }
-  // 去全部课本
-  that.goToBooks = () => {
-    wx.navigateTo({
-      url: `../main/books/books`
-    })
-  }
-  that.bannerTap = (e) => {
-      const type = e.currentTarget.dataset.type;
-      const id = e.currentTarget.dataset.id;
-      switch (type) {
-        case 'LESSON':
-          that.openClass('tap', id);
-          break;
-      }
-    },
-    that.goToUsers = (e) => {
-      console.log(e)
-      let uid = e.currentTarget.dataset.uid;
-      wx.navigateTo({
-        url: `../../pages/user/myworks/myworks?uid=${uid}`
-      });
+    that.getHotRecommendSecond = (uid, pageNo, pageSize) => {
+            httpRequestApi.getHotRecommendSecond(uid, pageNo, pageSize).success(res => {
+                console.log(res)
+                const recommendRes = res.data.data.list;
+                if (recommendRes.length === 0) return;
+                // const recommendWorks = [];
+                recommendRes.forEach(item => {
+                    const temp = {};
+                    temp.title = item.userRead.title;
+                    temp.summary = item.userRead.summary;
+                    temp.img = item.userRead.iconImg;
+                    temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
+                    temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
+                    temp.classId = item.userRead.id;
+                    temp.time = formatDate(item.userRead.gmtCreated, 3);
+                    temp.avatar = item.user.avatar;
+                    temp.profession = item.user.profession;
+                    temp.uid = item.user.uid;
+                    // temp.avatar = item.user.avatar;
+                    temp.nickName = item.user.nickName;
+                    // recommendWorks.push(temp);
+                    that.data.hotData.hotWorks.push(temp);
+                });
+                const hotStr = 'hotData.hotWorks'
+                that.setData({
+                    [hotStr]: that.data.hotData.hotWorks,
+                    recommendTotalNo: res.data.data.totalNo
+                })
+            })
+        }
+        // 去全部课本
+    that.goToBooks = () => {
+        wx.navigateTo({
+            url: `../main/books/books`
+        })
     }
-  // 下拉加载
-  that.scrollUpdate = (e) => {
-    console.log(e)
-  }
-  console.log(that.data.hotData.recommend)
+    that.bannerTap = (e) => {
+            const type = e.currentTarget.dataset.type;
+            const id = e.currentTarget.dataset.id;
+            switch (type) {
+                case 'LESSON':
+                    that.openClass('tap', id);
+                    break;
+            }
+        },
+        that.goToUsers = (e) => {
+            console.log(e)
+            let uid = e.currentTarget.dataset.uid;
+            wx.navigateTo({
+                url: `../../pages/user/myworks/myworks?uid=${uid}`
+            });
+        }
+        // 下拉加载
+    that.scrollUpdate = (e) => {
+        console.log(e)
+    }
+    console.log(that.data.hotData.recommend)
 
-  if (wx.getStorageSync('uid')) {
-    that.getIndex();
-    that.getHotRecommend(wx.getStorageSync('uid'));
-  }
-  // that.getIndex();
+    if (wx.getStorageSync('uid')) {
+        that.getIndex();
+        that.getHotRecommend(wx.getStorageSync('uid'));
+    }
+    // that.getIndex();
 
-  // 获取全部课本
-  // that.getBookList();
-  // that.swiperChange = (e) => {
-  //   const str = 'hotData.swiperCurrent'
-  //   that.setData({
-  //     [str]: e.detail.current
-  //   });
-  // }
-  //跳转到课程详情
-  that.goToBook = function (e) {
-    console.log(e.currentTarget.dataset)
-    let id = e.currentTarget.dataset.id;
-    let title = e.currentTarget.dataset.title;
-    console.log(id)
-    wx.navigateTo({
-      url: `/pages/groupPage/grade-details/grade-details?productId=${id}&title=${title}`
-    })
-  }
-  that.swiperChange = (e) => {
-    const str = 'hotData.swiperCurrent'
-    that.setData({
-      [str]: e.detail.current
-    });
-  }
+    // 获取全部课本
+    // that.getBookList();
+    // that.swiperChange = (e) => {
+    //   const str = 'hotData.swiperCurrent'
+    //   that.setData({
+    //     [str]: e.detail.current
+    //   });
+    // }
+    //跳转到课程详情
+    that.goToBook = function(e) {
+        console.log(e.currentTarget.dataset)
+        let id = e.currentTarget.dataset.id;
+        let title = e.currentTarget.dataset.title;
+        console.log(id)
+        wx.navigateTo({
+            url: `/pages/groupPage/grade-details/grade-details?productId=${id}&title=${title}`
+        })
+    }
+    that.swiperChange = (e) => {
+        const str = 'hotData.swiperCurrent'
+        that.setData({
+            [str]: e.detail.current
+        });
+    }
 }

+ 93 - 93
component/my/my.js

@@ -1,106 +1,106 @@
 import APIClient from '../../utils/APIClient';
 const app = getApp();
 import {
-  formatDate
+    formatDate
 } from '../../utils/util';
 export const myInit = (that) => {
-  console.log(123123123, app.globalData.isIOS)
-  that.setData({
-    myData: {
-      isVIP: wx.getStorageSync('vip'),
-      price: wx.getStorageSync('price'),
-      date: wx.getStorageSync('date')
-    },
-    followData: []
-  });
-  that.getUserWorksInfo();
-  // that.getUserAuth(); //用户鉴权
-  // that.getMyRead();
-  console.log(that.data.myData)
-  that.toMyEdit = (e) => {
-      let title = e.currentTarget.dataset.title;
-      wx.navigateTo({
-        url: `../user/myEdit/myEdit?title=修改资料`
-      });
-      APIClient.userEvent('MY_INFO');
-    },
-    that.toMyConcern = e => {
-      wx.navigateTo({
-        url: `../myconcern/myconcern?title=我的关注`
-      });
-      APIClient.userEvent('MY_SUBSCRIBE');
+    console.log(123123123, app.globalData.isIOS)
+    that.setData({
+        myData: {
+            isVIP: wx.getStorageSync('vip'),
+            price: wx.getStorageSync('price'),
+            date: wx.getStorageSync('date')
+        },
+        followData: []
+    });
+    that.getUserWorksInfo();
+    // that.getUserAuth(); //用户鉴权
+    // that.getMyRead();
+    console.log(that.data.myData)
+    that.toMyEdit = (e) => {
+            let title = e.currentTarget.dataset.title;
+            wx.navigateTo({
+                url: `../user/myEdit/myEdit?title=修改资料`
+            });
+            APIClient.userEvent('MY_INFO');
+        },
+        that.toMyConcern = e => {
+            wx.navigateTo({
+                url: `../myconcern/myconcern?title=我的关注`
+            });
+            APIClient.userEvent('MY_SUBSCRIBE');
 
-    }
-  that.toMyRead = e => {
-      wx.navigateTo({
-        url: `../user/myread/myread?title=我的朗读`
-      });
-    },
-    that.toMyKeep = e => {
-      wx.navigateTo({
-        url: `../mycollection/mycollection`
-      });
-      APIClient.userEvent('MY_FAVORITES');
+        }
+    that.toMyRead = e => {
+            wx.navigateTo({
+                url: `../user/myread/myread?title=我的朗读`
+            });
+        },
+        that.toMyKeep = e => {
+            wx.navigateTo({
+                url: `../mycollection/mycollection`
+            });
+            APIClient.userEvent('MY_FAVORITES');
 
-    },
+        },
 
-    that.getFollowWorks = (pageNo, pageSize) => {
-      APIClient.getFollowWorks(pageNo, pageSize).success(res => {
-        console.log(res)
-        const followData = res.data.data.list;
-        // const followTemp = [];
-        followData.forEach(item => {
-          const temp = {};
-          console.log(item.userRead.id)
-          temp.nickName = item.user.wechatName;
-          temp.avatar = item.user.avatar;
-          temp.uid = item.user.uid;
-          temp.plays = item.userRead.playAmount;
-          temp.likes = item.userRead.likeAmount;
-          temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
-          temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
-          temp.img = item.userRead.iconImg;
-          temp.id = item.userRead.id;
-          temp.title = item.userRead.title;
-          temp.summary = item.userRead.summary;
-          temp.type = item.userRead.type;
-          temp.isLike = item.isLike;
-          temp.isFavorite = item.isFavorites;
-          temp.time = formatDate(item.userRead.gmtCreated, 3);
-          // 还差一些字段
-          that.data.followData.push(temp);
-        });
-        // console.log(followTemp);
-        that.setData({
-          followData: that.data.followData,
-          followPageTotalNo: res.data.data.totalNo
-        })
-      });
-    },
-    that.toWalletDetail = function (e) {
-      wx.navigateTo({
-        url: `../../pages/user/walletDetails/walletDetails?title=资金明细`
-      });
-    },
-    that.toVIPBuy = function (e) {
-      if (app.globalData.isIOS) {
-        wx.navigateTo({
-          url: `../../pages/vipPage/vipCode/vipCode`
-        });
+        that.getFollowWorks = (pageNo, pageSize) => {
+            APIClient.getFollowWorks(pageNo, pageSize).success(res => {
+                console.log(res)
+                const followData = res.data.data.list;
+                // const followTemp = [];
+                followData.forEach(item => {
+                    const temp = {};
+                    console.log(item.userRead.id)
+                    temp.nickName = item.user.nickName;
+                    temp.avatar = item.user.avatar;
+                    temp.uid = item.user.uid;
+                    temp.plays = item.userRead.playAmount;
+                    temp.likes = item.userRead.likeAmount;
+                    temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
+                    temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
+                    temp.img = item.userRead.iconImg;
+                    temp.id = item.userRead.id;
+                    temp.title = item.userRead.title;
+                    temp.summary = item.userRead.summary;
+                    temp.type = item.userRead.type;
+                    temp.isLike = item.isLike;
+                    temp.isFavorite = item.isFavorites;
+                    temp.time = formatDate(item.userRead.gmtCreated, 3);
+                    // 还差一些字段
+                    that.data.followData.push(temp);
+                });
+                // console.log(followTemp);
+                that.setData({
+                    followData: that.data.followData,
+                    followPageTotalNo: res.data.data.totalNo
+                })
+            });
+        },
+        that.toWalletDetail = function(e) {
+            wx.navigateTo({
+                url: `../../pages/user/walletDetails/walletDetails?title=资金明细`
+            });
+        },
+        that.toVIPBuy = function(e) {
+            if (app.globalData.isIOS) {
+                wx.navigateTo({
+                    url: `../../pages/vipPage/vipCode/vipCode`
+                });
 
-      } else {
-        wx.navigateTo({
-          url: `../../pages/vipPage/vip/vip`
-        });
-      }
+            } else {
+                wx.navigateTo({
+                    url: `../../pages/vipPage/vip/vip`
+                });
+            }
 
 
-    },
-    /**创建支付订单 */
-    that.moneyBuy = function () {
-      // that.messageAuth();
-      that.goToPruduct();
+        },
+        /**创建支付订单 */
+        that.moneyBuy = function() {
+            // that.messageAuth();
+            that.goToPruduct();
 
-    }
-  that.getFollowWorks(1, 3);
+        }
+    that.getFollowWorks(1, 3);
 }

+ 2 - 3
component/my/my.wxml

@@ -5,18 +5,17 @@
         <view class='follow-details'>
             <view class='follow-info'>
                 <view class="info-placerholder"></view>
-                <view class='set-msg' wx:if="{{myData.userInfo.wechatName }}" bindtap="toMyEdit">
+                <view class='set-msg' wx:if="{{myData.userInfo.nickName }}" bindtap="toMyEdit">
                     <view class='avatar-box'>
                         <image class='avatar-image' src='{{ myData.userInfo.avatar  }}'></image>
                         <!-- <view class='occupation-title' wx:if="{{myData.user.user.profession}}">{{ myData.user.user.profession }}</view> -->
                     </view>
                     <view class='avatar-msg'>
-                        <view class='avatar-nickname'>昵称:{{ myData.userInfo.wechatName }}</view>
+                        <view class='avatar-nickname'>昵称:{{ myData.userInfo.nickName }}</view>
                         <view class='avatar-nickname'>年级:{{myData.userInfo.gradeText }}</view>
                         <image class="edit-img" src="../../static/index/edit.png" />
                         <view class='mine-category'>
                             <view class='amount-text'>播放 {{ myData.user.playAmount || 0 }} </view>
-                            <!-- <view class='amount-text'>{{ myData.user.likeAmount || 0 }} 赞</view> -->
                             <view class='amount-text'>粉丝 {{ myData.user.fansAmount || 0 }}</view>
                             <view class='amount-text'>作品 {{ myData.user.readAmount || 0 }} </view>
                         </view>

+ 25 - 37
component/video-swiper/index.js

@@ -49,8 +49,7 @@ Component({
                     if (newVideoShow !== oldVideoShow && oldVideoShow) {
                         console.log('把值设置为true')
                         newValue[this.data.activeIndex].videoShow = true;
-                        this.setData({
-                        })
+                        this.setData({})
                     }
                 }
                 let newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -99,13 +98,13 @@ Component({
 
             var data = this.data;
             console.log('newVal', newVal)
-            newVal.forEach(function (item) {
+            newVal.forEach(function(item) {
                 data.nextQueue.push(item);
             });
             if (data.curQueue.length === 0) {
                 this.setData({
                     curQueue: data.nextQueue.splice(0, 3)
-                }, function () {
+                }, function() {
                     _this.playCurrent(1);
                     // _this.playCurrent(0);
                 });
@@ -183,20 +182,20 @@ Component({
         },
         playCurrent: function playCurrent(current) {
             console.log('playCurrent', current)
-            // return; // 注掉自动播放
-            this.data._videoContexts.forEach(function (ctx, index) {
+                // return; // 注掉自动播放
+            this.data._videoContexts.forEach(function(ctx, index) {
                 index !== current ? ctx.pause() : ctx.play();
             });
         },
         onPlay: function onPlay(e) {
             console.log('播放记录', e)
             httpRequestApi.playLogReport({
-                userReadId: e.currentTarget.dataset.id,
-                playStopTime: 1000
-            }).success(res => {
-                console.log('播放记录', res)
-            })
-            // this.trigger(e, 'play');
+                    userReadId: e.currentTarget.dataset.id,
+                    playStopTime: 1000
+                }).success(res => {
+                    console.log('播放记录', res)
+                })
+                // this.trigger(e, 'play');
         },
         onPlayList: function onPlayList(e) {
             console.log('lastVideoId', this.data.lastVideoId);
@@ -226,11 +225,11 @@ Component({
         },
         onEnded: function onEnded(e) {
             console.log('播放结束', e)
-            // this.trigger(e, 'ended');
+                // this.trigger(e, 'ended');
         },
         onError: function onError(e) {
             console.log('视频出错', e)
-            // this.trigger(e, 'error');
+                // this.trigger(e, 'error');
         },
         onTimeUpdate: function onTimeUpdate(e) {
             this.trigger(e, 'timeupdate');
@@ -251,7 +250,7 @@ Component({
             console.log(e)
             let index = e.currentTarget.dataset.index;
             this.setData({
-                activeIndex:index
+                activeIndex: index
             })
             this.trigger(e, 'openComment')
         },
@@ -277,15 +276,13 @@ Component({
         },
         // 点击头部
         headTap: function headTap(e) {
-            if (!wx.getStorageSync('user').wechatName) {
+            if (!wx.getStorageSync('uid')) {
                 wx.navigateTo({
                     url: `../../pages/login/login`
                 });
                 return;
             }
             let uid = e.target.dataset.uid ? e.target.dataset.uid : e.currentTarget.dataset.uid;
-            // this.trigger(e, 'headTap')
-            console.log('点击头像', e)
             wx.navigateTo({
                 url: `../../pages/myworks/myworks?uid=${uid}`,
                 fail: (err) => {
@@ -304,7 +301,7 @@ Component({
         },
         // 收藏课程
         collectTap: function collectClass(e) {
-            if (!wx.getStorageSync('user').wechatName) {
+            if (!wx.getStorageSync('uid')) {
                 wx.navigateTo({
                     url: `../../pages/login/login`
                 });
@@ -317,7 +314,7 @@ Component({
             }
             const index = e.target.dataset.index ? e.target.dataset.index : e.currentTarget.dataset.index;
             this.setData({
-                activeIndex:index
+                activeIndex: index
             })
             console.log('视频index', index);
             if (this.data.curQueue.length <= 0) {
@@ -331,7 +328,6 @@ Component({
                         this.setData({
                             flowerNum: res.data.count
                         })
-                        this.flowerAnimationHandler();
                     }
                     this.triggerEvent('collectTap', {
                         index,
@@ -353,8 +349,7 @@ Component({
         },
         // 点赞
         likeTap: function likeTap(e) {
-
-            if (!wx.getStorageSync('user').wechatName) {
+            if (!wx.getStorageSync('uid')) {
                 wx.navigateTo({
                     url: `../../pages/login/login`
                 });
@@ -398,7 +393,6 @@ Component({
                         this.setData({
                             flowerNum: res.data.count
                         })
-                        this.flowerAnimationHandler();
                     }
                     this.triggerEvent('likeTap', {
                         index,
@@ -406,7 +400,7 @@ Component({
                 });
             }
         },
-        addShareAmount: function (e) {
+        addShareAmount: function(e) {
             console.log('+++++1', e.detail.index);
 
             this.triggerEvent('addShareAmount', {
@@ -414,7 +408,7 @@ Component({
             })
         },
         // 下载视频
-        download: function (e) {
+        download: function(e) {
             // console.log(e.currentTarget.dataset)
             wx.showLoading({
                 title: '保存到本地',
@@ -457,7 +451,7 @@ Component({
                 }
             })
         },
-        delete: function (e) {
+        delete: function(e) {
             console.log('删除', e)
             wx.showModal({
                 title: '确认删除吗?',
@@ -488,7 +482,7 @@ Component({
                 }
             })
         },
-        hide: function (e) {
+        hide: function(e) {
             console.log('隐藏', e)
             const status = e.currentTarget.dataset.status ? e.currentTarget.dataset.status : e.target.dataset.status
             console.log('当前状态', status)
@@ -509,7 +503,7 @@ Component({
                 this.triggerEvent('delHideMyWork');
             })
         },
-        openShare: function (e) {
+        openShare: function(e) {
             this.triggerEvent('openShare', e)
             const obj = e.currentTarget.dataset
             const scene = obj.activity ? `${obj.id}&activity=true` : obj.id
@@ -532,15 +526,9 @@ Component({
                 noScroll: 'noScroll'
             })
             this.shareDialog.share(data);
-            // this.shareDialog.shareFriend();
-        },
-        flowerAnimationHandler: function () {
-            this.flowerBox = this.selectComponent("#flower-toast");
-            console.log('this.flower', this.flowerBox)
-            this.flowerBox.comeOut();
         },
         trigger: function trigger(e, type) {
-            if (!wx.getStorageSync('user').wechatName) {
+            if (!wx.getStorageSync('uid')) {
                 wx.navigateTo({
                     url: `../../pages/login/login`
                 });
@@ -562,4 +550,4 @@ Component({
               }), ext)); */
         }
     }
-});
+});

+ 32 - 59
component/video-swiper/index.wxml

@@ -1,6 +1,5 @@
 <view class="swiper_container">
-    <swiper wx:if="{{isSwiper}}" class="video-swiper" circular="{{circular}}" easing-function="{{easingFunction}}"
-        vertical current="0" duration="{{duration}}" next-margin="{{nextMargin}}" bindanimationfinish="animationfinish">
+    <swiper wx:if="{{isSwiper}}" class="video-swiper" circular="{{circular}}" easing-function="{{easingFunction}}" vertical current="0" duration="{{duration}}" next-margin="{{nextMargin}}" bindanimationfinish="animationfinish">
         <!-- curQueue 循环会导致video重新插入,objectFit 不可变更 -->
         <swiper-item class="swiper_item" wx:for="{{curQueue}}" data-id="{{item.id}}" wx:key="id">
             <view class="head_box">
@@ -22,40 +21,30 @@
                         <text>删除</text>
                     </view>
                     <view catchtap="hide" data-status="{{item.status}}" data-id="{{item.id}}">
-                        <image
-                            src="{{item.status==='NORMAL'? '../../static/index/show_icon.png': '../../static/index/hide_icon.png'}}" />
+                        <image src="{{item.status==='NORMAL'? '../../static/index/show_icon.png': '../../static/index/hide_icon.png'}}" />
                         <text>{{item.status==='NORMAL'? '隐藏': '展示'}}</text>
                     </view>
                 </view>
             </view>
-            <video id="video_{{index}}" class="video_item" loop="{{loop}}" enable-play-gesture enable-progress-gesture
-                show-center-play-btn="{{false}}" controls="{{true}}" src="{{item.url}}" object-fit="contain"
-                data-index="{{index}}" data-id="{{item.id}}" bindplay="onPlay" bindended="onEnded">
+            <video id="video_{{index}}" class="video_item" loop="{{loop}}" enable-play-gesture enable-progress-gesture show-center-play-btn="{{false}}" controls="{{true}}" src="{{item.url}}" object-fit="contain" data-index="{{index}}" data-id="{{item.id}}" bindplay="onPlay" bindended="onEnded">
             </video>
             <view class="video_title">
                 <text>{{item.title}}</text>
             </view>
             <view class="foot_box">
                 <view class="foot_left">
-                    <view class="video_btn collect_btn" catchtap="collectTap" data-index="{{index}}"
-                        data-id="{{item.id}}" data-type="{{item.type}}">
-                        <image class="collect_btn_icon"
-                            src="{{item.isFavorite ? '../../static/index/star_colored.png' : '../../static/index/star.png'}}" />
+                    <view class="video_btn collect_btn" catchtap="collectTap" data-index="{{index}}" data-id="{{item.id}}" data-type="{{item.type}}">
+                        <image class="collect_btn_icon" src="{{item.isFavorite ? '../../static/index/star_colored.png' : '../../static/index/star.png'}}" />
                         <text>收藏</text>
                     </view>
-                    <view class="video_btn share_btn" bindtap="openShare" data-index="{{index}}" data-id="{{item.id}}"
-                        data-avatar="{{item.avatar}}" data-author="{{item.nickName}}" data-uid="{{item.uid}}"
-                        data-img="{{item.img}}" data-title="{{item.title}}" data-type="{{item.type}}"
-                        ata-activity="{{item.activity}}">
+                    <view class="video_btn share_btn" bindtap="openShare" data-index="{{index}}" data-id="{{item.id}}" data-avatar="{{item.avatar}}" data-author="{{item.nickName}}" data-uid="{{item.uid}}" data-img="{{item.img}}" data-title="{{item.title}}" data-type="{{item.type}}" ata-activity="{{item.activity}}">
                         <image class="share_btn_icon" src="../../static/index/share.png" lazy-load="true" />
                         <text>分享</text>
                     </view>
                 </view>
                 <view class="foot_right">
-                    <view class="video_btn flower_btn" catchtap="{{item.isLike ?  null : 'likeTap'}}"
-                        data-index="{{index}}" data-id="{{item.id}}" data-islike="{{item.isLike}}">
-                        <image class="flower_btn_icon"
-                            src="{{item.isLike ? '../../static/index/heart_colored.png' : '../../static/index/heart.png'}}" />
+                    <view class="video_btn flower_btn" catchtap="{{item.isLike ?  null : 'likeTap'}}" data-index="{{index}}" data-id="{{item.id}}" data-islike="{{item.isLike}}">
+                        <image class="flower_btn_icon" src="{{item.isLike ? '../../static/index/heart_colored.png' : '../../static/index/heart.png'}}" />
                         <text>{{item.likes}}</text>
                     </view>
                     <view class="video_btn comment_btn" catchtap="openComment" data-id="{{item.id}}">
@@ -73,8 +62,7 @@
         </swiper-item>
     </swiper>
     <!-- // 非swiper -->
-    <view wx:if="{{!isSwiper}}" class="swiper_item no_swiper" wx:for="{{sonVideoList}}" data-id="{{item.id}}"
-        wx:key="id">
+    <view wx:if="{{!isSwiper}}" class="swiper_item no_swiper" wx:for="{{sonVideoList}}" data-id="{{item.id}}" wx:key="id">
         <view class="head_box">
             <image class="tag_icon" wx:if="{{item.hasTag}}" src="{{item.tagUrl}}" />
             <view class="user_box" catchtap="{{ifHeadTap ? 'headTap' : null}}" data-uid="{{item.uid}}">
@@ -89,8 +77,7 @@
                 <text>发布时间:{{item.time}}</text>
             </view>
             <view wx:if="{{item.showMyBtn && !item.ifCheck}}" class="my_btn">
-                <view class="delete" catchtap="download" data-url="{{item.markPath ? item.markPath : '' }}"
-                    data-id="{{item.id}}">
+                <view class="delete" catchtap="download" data-url="{{item.markPath ? item.markPath : '' }}" data-id="{{item.id}}">
                     <image class="download_image" src="../../static/index/down.png" />
                     <text class="delete_text">下载</text>
                 </view>
@@ -98,60 +85,48 @@
                     <image class="delete_image" src="../../static/index/delete.png" />
                     <text class="delete_text">删除</text>
                 </view>
-                <view class="hide" catchtap="hide" wx:if="{{!item.activity}}" data-status="{{item.status}}"
-                    data-id="{{item.id}}">
+                <view class="hide" catchtap="hide" wx:if="{{!item.activity}}" data-status="{{item.status}}" data-id="{{item.id}}">
                     <!-- <image class="hide_image" src="{{item.status==='NORMAL'? '../../static/index/hide_icon.png': '../../static/index/show_icon.png'}}" /> -->
-                    <image class="hide_image"
-                        src="{{item.status==='NORMAL'? '../../static/index/unlock.png': '../../static/index/lock.png'}}" />
+                    <image class="hide_image" src="{{item.status==='NORMAL'? '../../static/index/unlock.png': '../../static/index/lock.png'}}" />
                     <text class="hide_text">{{item.status==='NORMAL'? '公开': '私密'}}</text>
                 </view>
             </view>
         </view>
-        <view class="video_place" wx:if="{{!item.videoShow}}" catchtap="{{item.ifCheck ? null : 'showVideo'}}"
-            data-index="{{index}}">
+        <view class="video_place" wx:if="{{!item.videoShow}}" catchtap="{{item.ifCheck ? null : 'showVideo'}}" data-index="{{index}}">
             <image class="place_img" src="{{item.coverImg}}" />
             <image class="play_btn" src="../../static/image/play-btn.png" />
-            <image class="activity_tigs" wx:if="{{item.activity && item.type != 'EXAMPLE'}}"
-                src="http://reader-wx.ai160.com/images/reader/activity/activity1.png" />
+            <image class="activity_tigs" wx:if="{{item.activity && item.type != 'EXAMPLE'}}" src="http://reader-wx.ai160.com/images/reader/activity/activity1.png" />
             <view class="video_item_dialog" wx:if="{{item.ifCheck}}">
-                <image class="video_item_dialog_img" src="../../static/index/checking.png"
-                    mode="aspectFit|aspectFill|widthFix" />
+                <image class="video_item_dialog_img" src="../../static/index/checking.png" mode="aspectFit|aspectFill|widthFix" />
             </view>
         </view>
-        <video wx:if="{{item.videoShow}}" id="video_{{index}}" class="video_item" loop="{{loop}}"
-            show-center-play-btn="{{!item.ifCheck ? true : false}}" controls="{{!item.ifCheck ? true : false}}"
-            src="{{item.url ? item.url : '' }}" autoplay="{{true}}" object-fit="contain" data-index="{{index}}"
-            data-id="{{item.id}}" bindplay="onPlayList" bindended="onEndedList" binderror="onError">
+        <video wx:if="{{item.videoShow}}" id="video_{{index}}" class="video_item" loop="{{loop}}" show-center-play-btn="{{!item.ifCheck ? true : false}}" controls="{{!item.ifCheck ? true : false}}" src="{{item.url ? item.url : '' }}" autoplay="{{true}}" object-fit="contain" data-index="{{index}}" data-id="{{item.id}}" bindplay="onPlayList" bindended="onEndedList" binderror="onError">
         </video>
         <view class="video_title">
             <text>{{item.title}}</text>
         </view>
         <view class="foot_box" wx:if="{{!item.ifCheck}}">
             <view class="foot_left">
-                <view class="video_btn collect_btn" catchtap="collectTap" data-index="{{index}}" data-id="{{item.id}}"
-                    data-type="{{item.type}}">
-                    <image class="collect_btn_icon"
-                        src="{{item.isFavorite ? '../../static/index/star_colored.png' : '../../static/index/star.png'}}" />
+                <view class="video_btn collect_btn" catchtap="collectTap" data-index="{{index}}" data-id="{{item.id}}" data-type="{{item.type}}">
+                    <image class="collect_btn_icon" src="{{item.isFavorite ? '../../static/index/star_colored.png' : '../../static/index/star.png'}}" />
                     <text>{{item.favoritesAmount === 0 ? '收藏' : item.favoritesAmount}}</text>
                 </view>
-                <view class="video_btn share_btn" bindtap="openShare" data-author="{{item.nickName}}"
-                    data-index="{{index}}" data-id="{{item.id}}" data-avatar="{{item.avatar}}" data-uid="{{item.uid}}"
-                    data-img="{{item.img}}" data-title="{{item.title}}" data-shareimg="{{item.shareImg}}"
-                    data-grade="{{item.grade}}" data-type="{{item.type}}" data-activity="{{item.activity}}">
+                <button class="resetBtn video_btn share_btn" open-type="share" data-info='{{item}}'>
                     <image class="share_btn_icon" src="../../static/index/share.png" />
                     <text>{{item.shareAmount === 0 ? '分享' : item.shareAmount}}</text>
-                </view>
+                </button>
+                <!--   <view class="video_btn share_btn" bindtap="openShare" data-author="{{item.nickName}}" data-index="{{index}}" data-id="{{item.id}}" data-avatar="{{item.avatar}}" data-uid="{{item.uid}}" data-img="{{item.img}}" data-title="{{item.title}}" data-shareimg="{{item.shareImg}}" data-grade="{{item.grade}}" data-type="{{item.type}}" data-activity="{{item.activity}}">
+                    <image class="share_btn_icon" src="../../static/index/share.png" />
+                    <text>{{item.shareAmount === 0 ? '分享' : item.shareAmount}}</text>
+                </view> -->
             </view>
             <view class="foot_right">
-                <view class="video_btn flower_btn" catchtap="{{item.isLike ?  null : 'likeTap'}}" data-index="{{index}}"
-                    data-id="{{item.id}}" data-islike="{{item.isLike}}">
-                    <view class="animation-flower {{addComeOut === index ? 'add-one-come-out' : ''}}">
-                        <image class="animation-flower-icon"
-                            src="{{item.activity ? '../../static/activity/popularity1.png' : '../../static/image/flower_small.png'}}" />
+                <view class="video_btn flower_btn" catchtap="{{item.isLike ?  null : 'likeTap'}}" data-index="{{index}}" data-id="{{item.id}}" data-islike="{{item.isLike}}">
+                    <!--  <view class="animation-flower {{addComeOut === index ? 'add-one-come-out' : ''}}">
+                        <image class="animation-flower-icon" src="{{item.activity ? '../../static/activity/popularity1.png' : '../../static/image/flower_small.png'}}" />
                         <text>+1</text>
-                    </view>
-                    <image class="flower_btn_icon"
-                        src="{{item.isLike ? '../../static/index/heart_colored.png' : '../../static/index/heart.png'}}" />
+                    </view> -->
+                    <image class="flower_btn_icon" src="{{item.isLike ? '../../static/index/heart_colored.png' : '../../static/index/heart.png'}}" />
                     <text>{{item.likes === 0 ? '点赞' : item.likes}}</text>
                 </view>
                 <view class="video_btn comment_btn" catchtap="openComment" data-id="{{item.id}}" data-index="{{index}}">
@@ -160,8 +135,7 @@
                 </view>
             </view>
         </view>
-        <view class="btn_wrapper" wx:if="{{!item.noReading && !item.ifCheck}}" catchtap="goToReading"
-            data-id="{{item.classId}}">
+        <view class="btn_wrapper" wx:if="{{!item.noReading && !item.ifCheck}}" catchtap="goToReading" data-id="{{item.classId}}">
             <view class="reading_btn">
                 <image src="../../static/index/microphone.png" />
                 <text>我要配音</text>
@@ -172,6 +146,5 @@
         <text class="no_work_text">已经到底啦!</text>
     </view>
 </view>
-<flowerBox id="flower-toast" flowerNum="{{flowerNum}}" />
-<shareDialog id="share-dialog" shareType='works' bindShareDialogClose="shareDialogClose"
-    bindaddShareAmount="addShareAmount" shareId="{{id}}" />
+<!-- <flowerBox id="flower-toast" flowerNum="{{flowerNum}}" /> -->
+<shareDialog id="share-dialog" shareType='works' bindShareDialogClose="shareDialogClose" bindaddShareAmount="addShareAmount" shareId="{{id}}" />

+ 1 - 1
component/videoPreview/index.wxml

@@ -4,7 +4,7 @@
         <view class="wH-left">
             <image src="{{videoInfo.user.avatar}}" class="avatar" mode="" />
             <view class="wH-left-user">
-                <view class="nickname textOver">{{videoInfo.user.wechatName}}</view>
+                <view class="nickname textOver">{{videoInfo.user.nickName}}</view>
                 <view class="time">发布时间:{{videoInfo.userRead.day}}</view>
             </view>
         </view>

+ 413 - 413
pages/activity/index/index.js

@@ -1,452 +1,452 @@
 // pages/activity/index/index.js
 import httpRequestApi from '../../../utils/APIClient';
 import {
-  formatDate
+    formatDate
 } from '../../../utils/util';
 Page({
 
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    activityReadData: [],
-    selectInd: 0,
-    selectBg: ['../../../static/activity/right.png', '../../../static/activity/left.png'],
-    activityMyReadData: [],
-    nextMargin: '400rpx', // 视频下边距
-    isSwiper: false,
-    noMoreWork: false,
-    hotAmountTopData: [],
-    sortImg: ['../../../static/activity/1.png', '../../../static/activity/2.png', '../../../static/activity/3.png'],
-    grades: '',
-    gradeObj: {
-      "PRIMARY_FIRST_GRADE": "一年级",
-      "PRIMARY_SECOND_GRADE": "二年级",
-      "PRIMARY_THREE_GRADE": "三年级",
-      "PRIMARY_SENIOR_GRADE": "四年级",
-      "PRESCHOOL": "学前班",
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        activityReadData: [],
+        selectInd: 0,
+        selectBg: ['../../../static/activity/right.png', '../../../static/activity/left.png'],
+        activityMyReadData: [],
+        nextMargin: '400rpx', // 视频下边距
+        isSwiper: false,
+        noMoreWork: false,
+        hotAmountTopData: [],
+        sortImg: ['../../../static/activity/1.png', '../../../static/activity/2.png', '../../../static/activity/3.png'],
+        grades: '',
+        gradeObj: {
+            "PRIMARY_FIRST_GRADE": "一年级",
+            "PRIMARY_SECOND_GRADE": "二年级",
+            "PRIMARY_THREE_GRADE": "三年级",
+            "PRIMARY_SENIOR_GRADE": "四年级",
+            "PRESCHOOL": "学前班",
+        },
+        myHotAmountData: {},
+        commentShow: false,
+        commentList: [],
+        commentNum: 0,
     },
-    myHotAmountData: {},
-    commentShow: false,
-    commentList: [],
-    commentNum: 0,
-  },
 
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    // 接口调用
-    const grade = wx.getStorageSync('grade')
-    this.setData({
-      grades: this.data.gradeObj[grade]
-    })
-    httpRequestApi.getActivityRead(grade).success(res => {
-      if (res.data.code === 200) {
-        const activityReadData = [...res.data.data]
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function(options) {
+        // 接口调用
+        const grade = wx.getStorageSync('grade')
         this.setData({
-          activityReadData
+            grades: this.data.gradeObj[grade]
         })
-      }
-    })
-    // 统计数据
-    httpRequestApi.postActEvent('ACTIVITY_PAGE').success(res => {
-      console.log('活动页', res)
-    })
-  },
+        httpRequestApi.getActivityRead(grade).success(res => {
+                if (res.data.code === 200) {
+                    const activityReadData = [...res.data.data]
+                    this.setData({
+                        activityReadData
+                    })
+                }
+            })
+            // 统计数据
+        httpRequestApi.postActEvent('ACTIVITY_PAGE').success(res => {
+            console.log('活动页', res)
+        })
+    },
 
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
     /**
-     * 获取排名信息
+     * 生命周期函数--监听页面显示
      */
-    httpRequestApi.getHotAmountTop().success(res => {
-      if (res.data.code === 200) {
-        const hotAmountTopData = [...res.data.data]
-        this.setData({
-          hotAmountTopData
+    onShow: function() {
+        /**
+         * 获取排名信息
+         */
+        httpRequestApi.getHotAmountTop().success(res => {
+                if (res.data.code === 200) {
+                    const hotAmountTopData = [...res.data.data]
+                    this.setData({
+                        hotAmountTopData
+                    })
+                }
+            })
+            /**
+             * 获取我的排名信息
+             */
+        httpRequestApi.getMyHotAmount().success(res => {
+            if (res.data.code === 200) {
+                // console.log(res)
+                const myHotAmountData = res.data.data
+                this.setData({
+                    myHotAmountData
+                })
+            }
         })
-      }
-    })
+        if (this.data.fromReading) {
+            this.setData({
+                selectInd: 1
+            })
+            this.getMyRead();
+        }
+    },
+
     /**
-     * 获取我的排名信息
+     * 生命周期函数--监听页面隐藏
      */
-    httpRequestApi.getMyHotAmount().success(res => {
-      if (res.data.code === 200) {
-        // console.log(res)
-        const myHotAmountData = res.data.data
-        this.setData({
-          myHotAmountData
-        })
-      }
-    })
-    if (this.data.fromReading) {
-      this.setData({
-        selectInd: 1
-      })
-      this.getMyRead();
-    }
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
+    onHide: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function() {
 
-  },
-  /**
-   * 下拉
-   */
-  onPullDownRefresh: function () {
-    wx.showNavigationBarLoading() //在标题栏中显示加载
+    },
+    /**
+     * 下拉
+     */
+    onPullDownRefresh: function() {
+        wx.showNavigationBarLoading() //在标题栏中显示加载
+            /**
+             * 获取排名信息
+             */
+        httpRequestApi.getHotAmountTop().success(res => {
+                if (res.data.code === 200) {
+                    const hotAmountTopData = [...res.data.data]
+                    this.setData({
+                        hotAmountTopData
+                    })
+                    wx.hideNavigationBarLoading() //完成停止加载
+                    wx.stopPullDownRefresh() //停止下拉刷新
+                }
+            })
+            /**
+             * 获取我的排名信息
+             */
+        httpRequestApi.getMyHotAmount().success(res => {
+            if (res.data.code === 200) {
+                // console.log(res)
+                const myHotAmountData = res.data.data
+                this.setData({
+                    myHotAmountData
+                })
+            }
+        })
+    },
     /**
-     * 获取排名信息
+     *
+     * @param {*} res
+     * 分享
      */
-    httpRequestApi.getHotAmountTop().success(res => {
-      if (res.data.code === 200) {
-        const hotAmountTopData = [...res.data.data]
+    onShareAppMessage: function(res) {
+        console.log('onShareAppMessage>>>>>>>>>>>>')
+        if (res.from === 'button') {
+            return {
+                title: '请欣赏我的课文朗读作品,点赞+评论。',
+                path: `/pages/index/index?readId=${this.data.shareId}&activity=true`,
+                imageUrl: this.data.shareImg
+            }
+        } else {
+            return {
+                title: '课文朗读,从未如此有趣。',
+                path: '/pages/index/index',
+            }
+        }
+    },
+    /**
+     * 活动页点击切换
+     */
+    tabSelect({
+        currentTarget
+    }) {
+        const selectInd = currentTarget.dataset.index * 1
+        if (selectInd === this.data.selectInd) return;
+        this.setData({
+            selectInd
+        });
+        if (selectInd === 1) {
+            this.getMyRead();
+        }
+    },
+    /**
+     * 去比赛
+     */
+    goToReading({
+        currentTarget
+    }) {
+        const id = currentTarget.dataset.id
+        wx.navigateTo({
+            url: `../../reading/reading?id=${id}`
+        });
+    },
+    /**
+     * 修改list列表
+     * @param {*} 列表
+     */
+    formatWorksList(list) {
+        this.data.activityMyReadData = [];
+        list.forEach((item) => {
+            const temp = {};
+            temp.title = item.userRead.title;
+            temp.summary = item.userRead.summary;
+            temp.img = item.userRead.iconImg;
+            temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
+            temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
+            temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
+            temp.shareAmount = item.userRead.shareAmount;
+            temp.favoritesAmount = item.userRead.favoritesAmount;
+            temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
+            temp.time = formatDate(item.userRead.gmtCreated, 3);
+            temp.avatar = item.user.avatar;
+            temp.profession = item.user.profession;
+            temp.uid = item.user.uid;
+            temp.markPath = item.userRead.markPath ? item.userRead.markPath : item.userRead.videoPath;
+            temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
+            temp.id = item.userRead.id;
+            temp.type = item.userRead.type;
+            temp.nickName = item.user.nickName;
+            temp.isLike = item.isLike;
+            temp.isFavorite = item.isFavorites;
+            temp.showMyBtn = true;
+            temp.nickName = item.user.nickName;
+            temp.status = item.userRead.status;
+            temp.ifCheck = item.userRead.status === 'CHECK' ? true : false;
+            temp.coverImg = item.userRead.coverImg;
+            temp.grade = item.userRead.grade
+            temp.isFans = true;
+            temp.videoShow = false;
+            temp.shareImg = item.userRead.shareImg;
+            temp.activity = true;
+            temp.noReading = true;
+            this.data.activityMyReadData.push(temp);
+            // tempList.push(temp);
+        });
+        // if (!notSet) {
         this.setData({
-          hotAmountTopData
+                activityMyReadData: this.data.activityMyReadData
+            })
+            // }
+
+    },
+    /**
+     * 获取我的朗读
+     */
+    getMyRead() {
+        httpRequestApi.getActivityMyRead().success(res => {
+            if (res.data.code === 200) {
+                const recommendRes = res.data.data;
+                this.formatWorksList(recommendRes);
+            }
         })
-        wx.hideNavigationBarLoading() //完成停止加载
-        wx.stopPullDownRefresh() //停止下拉刷新
-      }
-    })
+    },
     /**
-     * 获取我的排名信息
+     * 点击删除按钮
      */
-    httpRequestApi.getMyHotAmount().success(res => {
-      if (res.data.code === 200) {
-        // console.log(res)
-        const myHotAmountData = res.data.data
+    delHideMyWork() {
+        this.getMyRead()
+    },
+    /**
+     * 点击收藏按钮
+     */
+    collectTap(e) {
+        const index = e.detail.index;
+        let str = `activityMyReadData[${index}].isFavorite`;
+        let str2 = `activityMyReadData[${index}].favoritesAmount`;
+        let favoritesAmount = e.detail.isCollect ? this.data.activityMyReadData[index].favoritesAmount + 1 : this.data.activityMyReadData[index].favoritesAmount - 1
         this.setData({
-          myHotAmountData
+            [str]: e.detail.isCollect,
+            [str2]: favoritesAmount
         })
-      }
-    })
-  },
-  /**
-   *
-   * @param {*} res
-   * 分享
-   */
-  onShareAppMessage: function (res) {
-    console.log('onShareAppMessage>>>>>>>>>>>>')
-    if (res.from === 'button') {
-      return {
-        title: '请欣赏我的课文朗读作品,点赞+评论。',
-        path: `/pages/index/index?readId=${this.data.shareId}&activity=true`,
-        imageUrl: this.data.shareImg
-      }
-    } else {
-      return {
-        title: '课文朗读,从未如此有趣。',
-        path: '/pages/index/index',
-      }
-    }
-  },
-  /**
-   * 活动页点击切换
-   */
-  tabSelect({
-    currentTarget
-  }) {
-    const selectInd = currentTarget.dataset.index * 1
-    if (selectInd === this.data.selectInd) return;
-    this.setData({
-      selectInd
-    });
-    if (selectInd === 1) {
-      this.getMyRead();
-    }
-  },
-  /**
-   * 去比赛
-   */
-  goToReading({
-    currentTarget
-  }) {
-    const id = currentTarget.dataset.id
-    wx.navigateTo({
-      url: `../../reading/reading?id=${id}`
-    });
-  },
-  /**
-   * 修改list列表
-   * @param {*} 列表
-   */
-  formatWorksList(list) {
-    this.data.activityMyReadData = [];
-    list.forEach((item) => {
-      const temp = {};
-      temp.title = item.userRead.title;
-      temp.summary = item.userRead.summary;
-      temp.img = item.userRead.iconImg;
-      temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
-      temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
-      temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
-      temp.shareAmount = item.userRead.shareAmount;
-      temp.favoritesAmount = item.userRead.favoritesAmount;
-      temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
-      temp.time = formatDate(item.userRead.gmtCreated, 3);
-      temp.avatar = item.user.avatar;
-      temp.profession = item.user.profession;
-      temp.uid = item.user.uid;
-      temp.markPath = item.userRead.markPath ? item.userRead.markPath : item.userRead.videoPath;
-      temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
-      temp.id = item.userRead.id;
-      temp.type = item.userRead.type;
-      temp.nickName = item.user.wechatName;
-      temp.isLike = item.isLike;
-      temp.isFavorite = item.isFavorites;
-      temp.showMyBtn = true;
-      temp.nickName = item.user.wechatName;
-      temp.status = item.userRead.status;
-      temp.ifCheck = item.userRead.status === 'CHECK' ? true : false;
-      temp.coverImg = item.userRead.coverImg;
-      temp.grade = item.userRead.grade
-      temp.isFans = true;
-      temp.videoShow = false;
-      temp.shareImg = item.userRead.shareImg;
-      temp.activity = true;
-      temp.noReading = true;
-      this.data.activityMyReadData.push(temp);
-      // tempList.push(temp);
-    });
-    // if (!notSet) {
-    this.setData({
-      activityMyReadData: this.data.activityMyReadData
-    })
-    // }
+    },
+    /**
+     * 点赞执行事件
+     */
+    likeTap(e) {
+        const index = e.detail.index;
+        let likeStr = `activityMyReadData[${index}].isLike`;
+        let likeNumStr = `activityMyReadData[${index}].likes`;
+        this.setData({
+                [likeStr]: true,
+                [likeNumStr]: this.data.activityMyReadData[index].likes + 1
+            })
+            // this.flowerAnimationHandler()
+    },
+    /**
+     * 打开评论
+     */
+    openComment: function(e) {
+        //
+        this.setData({
+            commentShow: !this.data.commentShow,
+            commentId: e.detail.activeId,
+            commentIndex: e.detail.activeIndex
+        });
+    },
+    /**
+     * 评论区点击
+     */
+    commentTap: function(e) {
+        console.log('点击评论区', e)
+        if (e.target.dataset.type === 'blank') {
+            if (this.data.commentShow && this.data.commentId) {
+                httpRequestApi.getClassDetail(this.data.commentId).success(res => {
+                    console.log('评论回显', res.data.data.userRead.commentAmount)
+                    let str = `activityMyReadData[${this.data.commentIndex}].commentAmount`;
+                    this.setData({
+                        [str]: res.data.data.userRead.commentAmount
+                    })
+                })
+            }
+            this.setData({
+                commentShow: false
+            })
+        }
+    },
+    /**
+     * 获取评论信息
+     */
+    getReply: function(columnId) {
+        // let columnId = this.data.id;
+        console.log(123123123, columnId)
+            // let pageNo = this.data.pageNo;
+            // let pageSize = this.data.pageSize;
+        httpRequestApi.getReply(this.uid, columnId, 1, 10).success((res) => {
+            console.log('reply', res)
+            const commentList = res.data.data.list;
+            const commentNum = res.data.data.totalSize;
+            console.log('评论数量', commentNum)
+            commentList.forEach((item) => {
+                const temp = {};
+                temp.nickName = item.user.nickName;
+                temp.avatar = item.user.avatar;
+                temp.uid = item.user.uid;
+                temp.text = item.detailDesc;
+                temp.id = item.id;
+                temp.replyCount = item.replyCount;
+                temp.time = formatDate(item.gmtCreated, 3);
+                temp.likes = item.postsAttributeInfo.favors || 0;
+                temp.isLike = item.isLike;
+                temp.replyList = item.replyVOList;
+                this.data.commentList.push(temp);
+            });
+            this.setData({
+                commentList: this.data.commentList,
+                commentNum: commentNum
+            })
+        });
+    },
+    /**
+     * 发布回复
+     */
+    sendReply: function(e) {
+        console.log('triger', e.detail.content);
+        let data = {
+            columnId: this.data.commentId,
+            colunmNames: 'what',
+            detailDesc: e.detail.content,
+            // productId: this.data.productId
+        }
+        httpRequestApi.postReply(this.uid, data).success(res => {
+            console.log(res)
+            this.setData({
+                pageNo: 1,
+                commentList: []
+            }, () => {
+                this.getReply(this.data.commentId);
+            })
+        });
+    },
+    /**
+     * 点击分享
+     */
+    openShare(e) {
 
-  },
-  /**
-   * 获取我的朗读
-   */
-  getMyRead() {
-    httpRequestApi.getActivityMyRead().success(res => {
-      if (res.data.code === 200) {
-        const recommendRes = res.data.data;
-        this.formatWorksList(recommendRes);
-      }
-    })
-  },
-  /**
-   * 点击删除按钮
-   */
-  delHideMyWork() {
-    this.getMyRead()
-  },
-  /**
-   * 点击收藏按钮
-   */
-  collectTap(e) {
-    const index = e.detail.index;
-    let str = `activityMyReadData[${index}].isFavorite`;
-    let str2 = `activityMyReadData[${index}].favoritesAmount`;
-    let favoritesAmount = e.detail.isCollect ? this.data.activityMyReadData[index].favoritesAmount + 1 : this.data.activityMyReadData[index].favoritesAmount - 1
-    this.setData({
-      [str]: e.detail.isCollect,
-      [str2]: favoritesAmount
-    })
-  },
-  /**
-   * 点赞执行事件
-   */
-  likeTap(e) {
-    const index = e.detail.index;
-    let likeStr = `activityMyReadData[${index}].isLike`;
-    let likeNumStr = `activityMyReadData[${index}].likes`;
-    this.setData({
-      [likeStr]: true,
-      [likeNumStr]: this.data.activityMyReadData[index].likes + 1
-    })
-    // this.flowerAnimationHandler()
-  },
-  /**
-   * 打开评论
-   */
-  openComment: function (e) {
-    //
-    this.setData({
-      commentShow: !this.data.commentShow,
-      commentId: e.detail.activeId,
-      commentIndex: e.detail.activeIndex
-    });
-  },
-  /**
-   * 评论区点击
-   */
-  commentTap: function (e) {
-    console.log('点击评论区', e)
-    if (e.target.dataset.type === 'blank') {
-      if (this.data.commentShow && this.data.commentId) {
-        httpRequestApi.getClassDetail(this.data.commentId).success(res => {
-          console.log('评论回显', res.data.data.userRead.commentAmount)
-          let str = `activityMyReadData[${this.data.commentIndex}].commentAmount`;
-          this.setData({
-            [str]: res.data.data.userRead.commentAmount
-          })
+        this.setData({
+            shareTitle: e.detail.currentTarget.dataset.title,
+            shareId: e.detail.currentTarget.dataset.id,
+            shareImg: e.detail.currentTarget.dataset.shareimg,
+            goToShare: true
         })
-      }
-      this.setData({
-        commentShow: false
-      })
-    }
-  },
-  /**
-   * 获取评论信息
-   */
-  getReply: function (columnId) {
-    // let columnId = this.data.id;
-    console.log(123123123, columnId)
-    // let pageNo = this.data.pageNo;
-    // let pageSize = this.data.pageSize;
-    httpRequestApi.getReply(this.uid, columnId, 1, 10).success((res) => {
-      console.log('reply', res)
-      const commentList = res.data.data.list;
-      const commentNum = res.data.data.totalSize;
-      console.log('评论数量', commentNum)
-      commentList.forEach((item) => {
-        const temp = {};
-        temp.nickName = item.user.wechatName;
-        temp.avatar = item.user.avatar;
-        temp.uid = item.user.uid;
-        temp.text = item.detailDesc;
-        temp.id = item.id;
-        temp.replyCount = item.replyCount;
-        temp.time = formatDate(item.gmtCreated, 3);
-        temp.likes = item.postsAttributeInfo.favors || 0;
-        temp.isLike = item.isLike;
-        temp.replyList = item.replyVOList;
-        this.data.commentList.push(temp);
-      });
-      this.setData({
-        commentList: this.data.commentList,
-        commentNum: commentNum
-      })
-    });
-  },
-  /**
-   * 发布回复
-   */
-  sendReply: function (e) {
-    console.log('triger', e.detail.content);
-    let data = {
-      columnId: this.data.commentId,
-      colunmNames: 'what',
-      detailDesc: e.detail.content,
-      // productId: this.data.productId
-    }
-    httpRequestApi.postReply(this.uid, data).success(res => {
-      console.log(res)
-      this.setData({
-        pageNo: 1,
-        commentList: []
-      }, () => {
-        this.getReply(this.data.commentId);
-      })
-    });
-  },
-  /**
-   * 点击分享
-   */
-  openShare(e) {
-    
-    this.setData({
-      shareTitle: e.detail.currentTarget.dataset.title,
-      shareId: e.detail.currentTarget.dataset.id,
-      shareImg: e.detail.currentTarget.dataset.shareimg,
-      goToShare: true
-    })
-  },
+    },
 
-  /**
-   * 点击活动
-   */
-  rule() {
-    wx.navigateTo({
-      url: `../rule/rule`
-    });
-  },
-  /**
-   * 点击攻略
-   */
-  strategy() {
-    wx.navigateTo({
-      url: `../strategy/strategy`
-    });
-  },
-  getPrice() {
-    wx.navigateTo({
-      url: `../priceList/priceList`
-    });
-  },
-  /**
-   * 点击头像
-   */
-  headTap(e) {
-    if (!wx.getStorageSync('user').wechatName) {
-      wx.navigateTo({
-        url: `../../pages/login/login`
-      });
-      return;
-    }
-    let uid = e.target.dataset.uid ? e.target.dataset.uid : e.currentTarget.dataset.uid;
-    // this.trigger(e, 'headTap')
-    console.log('点击头像', e)
-    wx.navigateTo({
-      url: `../../pages/myworks/myworks?uid=${uid}`,
-      fail: (err) => {
-        console.log('跳转错误', err)
+    /**
+     * 点击活动
+     */
+    rule() {
+        wx.navigateTo({
+            url: `../rule/rule`
+        });
+    },
+    /**
+     * 点击攻略
+     */
+    strategy() {
+        wx.navigateTo({
+            url: `../strategy/strategy`
+        });
+    },
+    getPrice() {
+        wx.navigateTo({
+            url: `../priceList/priceList`
+        });
+    },
+    /**
+     * 点击头像
+     */
+    headTap(e) {
+        if (!wx.getStorageSync('uid')) {
+            wx.navigateTo({
+                url: `../../pages/login/login`
+            });
+            return;
+        }
+        let uid = e.target.dataset.uid ? e.target.dataset.uid : e.currentTarget.dataset.uid;
+        // this.trigger(e, 'headTap')
+        console.log('点击头像', e)
         wx.navigateTo({
-          url: `../../../pages/myworks/myworks?uid=${uid}`
+            url: `../../pages/myworks/myworks?uid=${uid}`,
+            fail: (err) => {
+                console.log('跳转错误', err)
+                wx.navigateTo({
+                    url: `../../../pages/myworks/myworks?uid=${uid}`
+                });
+            }
         });
-      }
-    });
 
-  },
-  /**
-   * 点击关注
-   */
-  follow(e) {
-    const followUid = e.target.dataset.uid ? e.target.dataset.uid : e.currentTarget.dataset.uid;
-    const uid = wx.getStorageSync('uid');
-    httpRequestApi.followUser(uid, followUid).success((res) => {
-      // this.setData({
-      //   isFans: true
-      // })
-      wx.showToast({
-        title: '关注啦',
-        icon: 'success',
-        duration: 1000
-      })
-    });
-    httpRequestApi.getHotAmountTop().success(res => {
-      if (res.data.code === 200) {
-        const hotAmountTopData = [...res.data.data]
-        this.setData({
-          hotAmountTopData
+    },
+    /**
+     * 点击关注
+     */
+    follow(e) {
+        const followUid = e.target.dataset.uid ? e.target.dataset.uid : e.currentTarget.dataset.uid;
+        const uid = wx.getStorageSync('uid');
+        httpRequestApi.followUser(uid, followUid).success((res) => {
+            // this.setData({
+            //   isFans: true
+            // })
+            wx.showToast({
+                title: '关注啦',
+                icon: 'success',
+                duration: 1000
+            })
+        });
+        httpRequestApi.getHotAmountTop().success(res => {
+            if (res.data.code === 200) {
+                const hotAmountTopData = [...res.data.data]
+                this.setData({
+                    hotAmountTopData
+                })
+            }
         })
-      }
-    })
-  }
+    }
 })
 
 /* 

+ 2 - 2
pages/activity/index/index.wxml

@@ -55,7 +55,7 @@
                                 data-fans="{{item.isFans}}"></image>
                         </view>
                         <view class="reanking-message-name">
-                            <text>{{item.user.wechatName}}</text>
+                            <text>{{item.user.nickName}}</text>
                             <view class="operation">
                                 <view class="forward">
                                     <image src="../../../static/activity/forward1.png"></image>
@@ -86,7 +86,7 @@
                     <image class="haed-url" src="{{myHotAmountData.user.avatar}}"></image>
                 </view>
                 <view class="reanking-message-name" style="color: #fff;">
-                    <text style="color: #fff;">{{myHotAmountData.user.wechatName}}</text>
+                    <text style="color: #fff;">{{myHotAmountData.user.nickName}}</text>
                     <view class="operation" style="color: #fff;">
                         <view class="forward">
                             <image src="../../../static/activity/forward.png"></image>

+ 267 - 165
pages/index/index.js

@@ -91,14 +91,15 @@ Page({
         payPrice: '',
         iphoneType: '',
         isVip: null,
-        isIos: null
+        isIos: null,
+        temporaryGrade: null
     },
-    jurisdiction: function () {
+    jurisdiction: function() {
         //隐藏弹框
         this.setData({
-            hide: !this.data.hide
-        })
-        //登录页信息
+                hide: !this.data.hide
+            })
+            //登录页信息
         this.updateData(0)
     },
     // 隐藏升级弹窗
@@ -108,19 +109,19 @@ Page({
         })
     },
     jumpMy() {
-        wx.reLaunch({
-            url: `/pages/my/index`
+        wx.navigateTo({
+            url: '/pages/my/index'
         });
     },
     //tab点击
-    switcher: function ({
+    switcher: function({
         currentTarget
     }) {
         if (currentTarget.dataset.index === this.data.myIndex) return;
         this.updateData(currentTarget.dataset.index);
     },
     // 根据index 更新template
-    updateData: function (index) {
+    updateData: function(index) {
         let myIndex = parseInt(index);
         this.setData({
             myIndex,
@@ -151,7 +152,7 @@ Page({
         }
 
         console.log('继续')
-        // 刷新关注列表
+            // 刷新关注列表
         if (myIndex == 1) {
             this.setData({
                 videoList: [],
@@ -188,7 +189,7 @@ Page({
             return;
         }
     },
-    showPage: function () {
+    showPage: function() {
         let options = this.data.options;
         if (this.data.workId) {
             // 需要在推荐第一个上插入一条分享或者刚朗读完数据
@@ -261,18 +262,14 @@ Page({
             }
         }, 2800)
     },
-    onLoad: function (options) {
+    onLoad: function(options) {
         this.setData({
             isIos: app.globalData.isIOS
         })
-        console.log('onload', options);
         if (options.tabbarIndx) {
             this.updateData(options.tabbarIndx);
         }
         if (options.scene) {
-            // this.setData({
-            //   workId: options.scene
-            // })
             let optionsStr = decodeURIComponent(options.scene);
             let optionsArr = optionsStr.split('&');
             // 暂时这样写
@@ -284,8 +281,6 @@ Page({
                 options.readId = optionsArr[0];
                 options.activity = optionsArr[1];
             }
-
-            console.log('整理后options', options)
         }
         if (options.readId) {
             this.setData({
@@ -304,26 +299,28 @@ Page({
         this.setData({
             iphoneType: options.type || ''
         })
+        console.log('onload', options);
+        let shareUid = options.uid
         getOpenidNoLogin((res) => {
             console.log('getOpenidNoLogin', res)
-            /**获取权限和订单信息 */
-            // 获取商品信息
+                /**获取权限和订单信息 */
+                // 获取商品信息
             httpRequestApi.getProductActivity().success(res => {
-                wx.setStorageSync('price', res.data.data.price / 100)
-                wx.setStorageSync('productId', res.data.data.id)
-                if (options.type && options.type === 'iphone') {
-                    this.setData({
-                        payPrice: res.data.data.price / 100
-                    })
-                }
-            }).fail(error => {
-                console.log(error)
-            })
-            // 获取用户权限
+                    wx.setStorageSync('price', res.data.data.price / 100)
+                    wx.setStorageSync('productId', res.data.data.id)
+                    if (options.type && options.type === 'iphone') {
+                        this.setData({
+                            payPrice: res.data.data.price / 100
+                        })
+                    }
+                }).fail(error => {
+                    console.log(error)
+                })
+                // 获取用户权限
             this.getHelpAuth()
             if (!res.data.data.grade) {
                 // 没有年级的老用户
-                if (res.data.data.wechatName) {
+                if (res.data.data.nickName) {
                     this.setData({
                         isGradeShow: true,
                         options,
@@ -340,7 +337,7 @@ Page({
                 })
                 return
             } else {
-                if (res.data.data.wechatName) {
+                if (res.data.data.nickName) {
                     this.setData({
                         isLogin: true
                     }, () => {
@@ -351,10 +348,21 @@ Page({
                     this.showPage();
                 }
             }
-            // 登录或注册完成 展示页面
-        }, (error) => {
-            console.log('获取失败', error)
-        });
+            // 获取商品信息
+            httpRequestApi.getProductActivity().success(res => {
+                    wx.setStorageSync('price', res.data.data.price / 100)
+                    wx.setStorageSync('productId', res.data.data.id)
+                    if (options.type && options.type === 'iphone') {
+                        this.setData({
+                            payPrice: res.data.data.price / 100
+                        })
+                    }
+                }).fail(error => {
+                    console.log(error)
+                })
+                // 获取用户权限
+            this.getHelpAuth()
+        }, () => {}, shareUid);
         this.uid = wx.getStorageSync('uid');
         if (options.sid) {
             httpRequestApi.getUserRec(options.sid).success(res => {
@@ -366,27 +374,18 @@ Page({
         }
         wx.getSystemInfo({
             success: (res) => {
-                console.log('系统', res)
-                console.log('nextMargin', res.pixelRatio)
-                console.log('windowHeight', res.windowHeight)
-                console.log('windowWidth', res.windowWidth)
-                // let ratio = res.pixelRatio;
                 let ratio = (res.screenHeight / res.screenWidth) * 1.1;
-                console.log('比例系数', ratio)
                 let winH = res.windowHeight * ratio;
                 let x1 = 465 * ratio;
                 let x2 = 603 * ratio;
                 let minusNumber = (winH * x1) / x2;
                 let nextMargin = parseInt(winH - minusNumber);
                 app.globalData.nextMargin = nextMargin;
-
                 this.setData({
                     winH: winH,
                     devicePixelRatio: res.pixelRatio,
                     nextMargin: nextMargin + 'rpx'
-
                 });
-
             }
         });
     },
@@ -418,7 +417,7 @@ Page({
             })
         }
     },
-    onShow: function () {
+    onShow: function() {
         let grade = wx.getStorageSync('grade');
         this.setData({
             gradeActivity: grade
@@ -437,7 +436,7 @@ Page({
             let userInfo = wx.getStorageSync('user');
             this.setData({
                 fromLoginIndex: null,
-                isLogin: userInfo.wechatName ? true : false
+                isLogin: userInfo.nickName ? true : false
             }, () => {
                 this.updateData(index)
             })
@@ -458,7 +457,7 @@ Page({
         })
     },
 
-    onHide: function () {
+    onHide: function() {
         const str = 'hotData.inputFocus'
         this.setData({
             [str]: false
@@ -467,7 +466,7 @@ Page({
     /* 两个接口维护同一个数组,手动的结束后添加算法的 */
     // 推荐页信息 获取消息和手动推荐内容
     // 获取热门作品 算法出来的
-    getHotRecommend: function () {
+    getHotRecommend: function() {
         let grade = wx.getStorageSync('grade')
         let pageNo = this.data.recommendPageNo;
         let pageSize = this.data.recommendPageSize;
@@ -519,7 +518,7 @@ Page({
             temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
             temp.id = item.userRead.id;
             temp.type = item.userRead.type;
-            temp.nickName = item.user.wechatName;
+            temp.nickName = item.user.nickName;
             temp.isLike = item.isLike;
             temp.isFans = item.isFans ? true : item.user.uid === this.uid ? true : false;
             temp.isFavorite = item.isFavorites;
@@ -536,23 +535,23 @@ Page({
             // tempList.push(temp);
         });
         console.log('当前list', this.data.videoList)
-        // if (!notSet) {
+            // if (!notSet) {
         this.setData({
-            videoList: this.data.videoList
-        })
-        // }
+                videoList: this.data.videoList
+            })
+            // }
 
     },
     // 获取用户信息
-    getUserWorksInfo: function (flag) {
+    getUserWorksInfo: function(flag) {
         if (flag) {
             httpRequestApi.getUserWorksInfo().success(res => {
                 const userInfo = this.formatGrade(res.data.data.user);
-                const str = 'myData.userInfo.wechatName';
+                const str = 'myData.userInfo.nickName';
                 const avatarStr = 'myData.userInfo.avatar';
                 const gradeTextStr = 'myData.userInfo.gradeText';
                 this.setData({
-                    [str]: userInfo.wechatName,
+                    [str]: userInfo.nickName,
                     [avatarStr]: userInfo.avatar,
                     [gradeTextStr]: userInfo.gradeText
                 })
@@ -598,7 +597,7 @@ Page({
         }
         return userInfo;
     },
-    videoChange: function (e) {
+    videoChange: function(e) {
         if (e.detail.activeId === this.data.updateId) {
             console.log('应该刷新')
             if (this.data.myIndex === 1) {
@@ -621,7 +620,7 @@ Page({
 
     },
     // 触底加载
-    onReachBottom: function () {
+    onReachBottom: function() {
         if (this.data.myIndex === 2) {
             this.setData({
                 coursePageNo: this.data.coursePageNo + 1
@@ -661,17 +660,17 @@ Page({
         // }
 
     },
-    onPullDownRefresh: function () {
+    onPullDownRefresh: function() {
         //当前在团购页下拉加载
         this.updateData(this.data.myIndex)
         wx.showNavigationBarLoading() //在标题栏中显示加载
-        //模拟加载
-        setTimeout(function () {
+            //模拟加载
+        setTimeout(function() {
             wx.hideNavigationBarLoading() //完成停止加载
             wx.stopPullDownRefresh() //停止下拉刷新
         }, 1000);
     },
-    goToMessage: function () {
+    goToMessage: function() {
         wx.navigateTo({
             url: `../../pages/social/insideMessage/insideMessage`
         });
@@ -681,10 +680,10 @@ Page({
             [str]: 0
         })
     },
-    goToService: function () {
+    goToService: function() {
         httpRequestApi.userEvent('SERVICE');
     },
-    toMyCollage: function (e) {
+    toMyCollage: function(e) {
         if (app.globalData.isIOS) {
             wx.navigateTo({
                 url: `../../pages/groupPage/my-group/my-group?title=我的助力`
@@ -696,19 +695,19 @@ Page({
         }
 
     },
-    toMyCourse: function () {
+    toMyCourse: function() {
         wx.navigateTo({
             url: `../../pages/user/mycourse/mycourse?title=我的课程`
         });
     },
-    goToFlower: function () {
+    goToFlower: function() {
         wx.navigateTo({
             url: `../../pages/social/littleFlower/littleFlower`
         });
         httpRequestApi.userEvent('INTEGRAL');
 
     },
-    signInBtn: function (e) {
+    signInBtn: function(e) {
         this.setData({
             indexSignDialog: false
         })
@@ -718,13 +717,13 @@ Page({
         })
         this.goToFlower();
     },
-    missionBtn: function () {
+    missionBtn: function() {
         this.setData({
             indexMissionDialog: false
         })
         this.goToFlower();
     },
-    getUserAuth: function () {
+    getUserAuth: function() {
         httpRequestApi.getUserAuth().success(res => {
             console.log(res)
             const str = 'myData.isVIP'
@@ -739,11 +738,11 @@ Page({
             }
         })
     },
-    delHideMyWork: function () {
+    delHideMyWork: function() {
         this.getMyRead()
     },
     // 获取我的朗读
-    getMyRead: function () {
+    getMyRead: function() {
         httpRequestApi.myRead().success(res => {
             console.log(123123, res)
             console.log('mydata', this.data.myData)
@@ -776,11 +775,11 @@ Page({
                 temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
                 temp.id = item.userRead.id;
                 temp.type = item.userRead.type;
-                temp.nickName = item.user.wechatName;
+                temp.nickName = item.user.nickName;
                 temp.isLike = item.isLike;
                 temp.isFavorite = item.isFavorites;
                 temp.showMyBtn = true;
-                temp.nickName = this.data.myData.userInfo.wechatName;
+                temp.nickName = this.data.myData.userInfo.nickName;
                 temp.status = item.userRead.status;
                 temp.ifCheck = item.userRead.status === 'CHECK' ? true : false;
                 temp.coverImg = item.userRead.coverImg;
@@ -801,7 +800,7 @@ Page({
         })
     },
     // 评论区点击
-    commentTap: function (e) {
+    commentTap: function(e) {
         console.log('点击评论区', e)
         if (e.target.dataset.type === 'blank') {
             if (this.data.commentShow && this.data.commentId) {
@@ -818,11 +817,11 @@ Page({
             })
         }
     },
-    touchMove: function (e) {
+    touchMove: function(e) {
         return
     },
     // 打开评论
-    openComment: function (e) {
+    openComment: function(e) {
         //
         console.log('id', e.detail.activeId)
         console.log('id', e)
@@ -830,17 +829,17 @@ Page({
             commentShow: !this.data.commentShow,
             commentId: e.detail.activeId,
             commentIndex: e.detail.activeIndex
-            // commentList: []
+                // commentList: []
         });
         // this.getReply(e.detail.activeId);
     },
     // 获取评论信息
-    getReply: function (columnId) {
+    getReply: function(columnId) {
         debugger
         // let columnId = this.data.id;
         console.log(123123123, columnId)
-        // let pageNo = this.data.pageNo;
-        // let pageSize = this.data.pageSize;
+            // let pageNo = this.data.pageNo;
+            // let pageSize = this.data.pageSize;
         httpRequestApi.getReply(this.uid, columnId, 1, 10).success((res) => {
             console.log('reply', res)
             const commentList = res.data.data.list;
@@ -848,7 +847,7 @@ Page({
             console.log('评论数量', commentNum)
             commentList.forEach((item) => {
                 const temp = {};
-                temp.nickName = item.user.wechatName;
+                temp.nickName = item.user.nickName;
                 temp.avatar = item.user.avatar;
                 temp.uid = item.user.uid;
                 temp.text = item.detailDesc;
@@ -867,7 +866,7 @@ Page({
         });
     },
     // 发布回复
-    sendReply: function (e) {
+    sendReply: function(e) {
         console.log('triger', e.detail.content);
         let data = {
             columnId: this.data.commentId,
@@ -885,13 +884,13 @@ Page({
             })
         });
     },
-    gradeTap: function () {
+    gradeTap: function() {
         // console.log("组件回调,返回上一页");
         this.setData({
             isGradeShow: true
         })
     },
-    onShareAppMessage: function (res) {
+    onShareAppMessage: function(res) {
         if (res.from === 'button') {
             return {
                 title: '请欣赏我的课文朗读作品,点赞+评论。',
@@ -905,21 +904,40 @@ Page({
             }
         }
     },
-    openShare: function (e) {
+    openShare: function(e) {
         console.log('点击分享', e)
+            /*  this.setData({
+                 shareTitle: e.detail.currentTarget.dataset.title,
+                 shareId: e.detail.currentTarget.dataset.id,
+                 shareImg: e.detail.currentTarget.dataset.shareimg,
+                 goToShare: true,
+                 ifTapActivity: e.detail.currentTarget.dataset.activity
+             }) */
+    },
+    // 选择年纪
+    selectGrade({
+        target
+    }) {
+        let code = target.dataset.code
+        if (!code) {
+            return
+        }
         this.setData({
-            shareTitle: e.detail.currentTarget.dataset.title,
-            shareId: e.detail.currentTarget.dataset.id,
-            shareImg: e.detail.currentTarget.dataset.shareimg,
-            goToShare: true,
-            ifTapActivity: e.detail.currentTarget.dataset.activity
+            temporaryGrade: code
         })
+        console.log(code);
     },
     // 修改年级
-    changeGrade: function (e) {
-        const grade = e.target.dataset.code;
-        console.log(grade);
-      /*   wx.setStorageSync('grade', grade)
+    changeGrade: function(e) {
+        const grade = this.data.temporaryGrade
+        if (!grade) {
+            return wx.showToast({
+                title: '请选择年级',
+                icon: 'none',
+                duration: 2000
+            })
+        }
+        wx.setStorageSync('grade', grade)
         this.setData({
             isGradeShow: false,
             grade
@@ -928,15 +946,13 @@ Page({
             let data = {
                 grade: e.target.dataset.code
             };
-            httpRequestApi.settingUserInfo(data).success(res => {
-
-            })
+            httpRequestApi.settingUserInfo(data).success(res => {})
             return;
         };
         getOpenidNoLogin((res) => {
             console.log('getOpenidNoLogin', res)
-            // 登录或注册完成 展示页面
-            if (res.data.data.wechatName) {
+                // 登录或注册完成 展示页面
+            if (res.data.data.nickName) {
                 this.setData({
                     isLogin: true
                 })
@@ -952,10 +968,10 @@ Page({
             this.setData({
                 hide: !this.data.hide
             })
-        }, grade); */
+        }, grade);
     },
 
-    getFollowData: function () {
+    getFollowData: function() {
         httpRequestApi.getFollowWorks(this.data.followPageNo, this.data.followPageSize).success(res => {
             if (res.data.data.totalSize === 0) {
                 this.setData({
@@ -978,7 +994,7 @@ Page({
         httpRequestApi.userEvent('SUBSCRIBE');
     },
     // 点击用户头像区域
-    headTapHandler: function (e) {
+    headTapHandler: function(e) {
         console.log('点击头像', e)
         let tapId = e.detail.activeId;
         // 点击头像既关注 测试
@@ -986,7 +1002,7 @@ Page({
             console.log(res)
         })
     },
-    getCoursesList: function () {
+    getCoursesList: function() {
         const grade = wx.getStorageSync('grade');
         const data = {
             pageNo: this.data.coursePageNo,
@@ -1006,7 +1022,7 @@ Page({
         })
         httpRequestApi.userEvent('RESOURCES');
     },
-    goToReading: function (e) {
+    goToReading: function(e) {
         console.log('去朗读', e)
         const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
         const index = e.currentTarget.dataset.index;
@@ -1067,16 +1083,16 @@ Page({
         if (1) {
             this.shareDialog = this.selectComponent("#share-dialog");
             const data = {
-                avatar: obj.avatar,
-                author: obj.author,
-                iconImg: obj.iconImg,
-                title: obj.title,
-                path: `pages/index/index`,
-                scene: obj.id,
-                productId: 1
-                // tip: this.data.tip,
-            }
-            // console.log(data)
+                    avatar: obj.avatar,
+                    author: obj.author,
+                    iconImg: obj.iconImg,
+                    title: obj.title,
+                    path: `pages/index/index`,
+                    scene: obj.id,
+                    productId: 1
+                        // tip: this.data.tip,
+                }
+                // console.log(data)
             this.setData({
                 noScroll: 'noScroll',
                 shareTitle: obj.title,
@@ -1086,7 +1102,7 @@ Page({
             this.shareDialog.share(data);
         }
     },
-    collectTap: function (e) {
+    collectTap: function(e) {
         const index = e.detail.index;
         let str = `videoList[${index}].isFavorite`;
         let str2 = `videoList[${index}].favoritesAmount`;
@@ -1096,7 +1112,7 @@ Page({
             [str2]: favoritesAmount
         })
     },
-    likeTap: function (e) {
+    likeTap: function(e) {
         console.log('点赞', e)
         const index = e.detail.index;
         let likeStr = `videoList[${index}].isLike`;
@@ -1105,15 +1121,8 @@ Page({
             [likeStr]: true,
             [likeNumStr]: this.data.videoList[index].likes + 1
         })
-        // this.flowerAnimationHandler()
-    },
-    flowerAnimationHandler: function () {
-        this.flowerBox = this.selectComponent("#flower-box");
-        console.log('this.flower', this.flowerBox)
-        this.flowerBox.comeOut();
     },
-    addShareAmount: function (e) {
-        console.log('+++++1', e)
+    addShareAmount: function(e) {
         let str = `videoList[${e.detail.index}].shareAmount`;
         this.setData({
             [str]: this.data.videoList[e.detail.index].shareAmount + 1
@@ -1124,12 +1133,12 @@ Page({
      */
     goToActivity() {
         httpRequestApi.postActEvent('BANNER').success(res => {
-            console.log('活动banner', res)
-        })
-        // wx.navigateTo({
-        //   url: `../activity/index/index`
-        //   // url: `../activity/rule/rule`
-        // });
+                console.log('活动banner', res)
+            })
+            // wx.navigateTo({
+            //   url: `../activity/index/index`
+            //   // url: `../activity/rule/rule`
+            // });
         wx.navigateTo({
             url: `../activity/goodList/goodList`
         });
@@ -1151,41 +1160,41 @@ Page({
         }
     },
     /**活动改版 */
-    myPlase() {
-        if (!wx.getStorageSync('message')) {
-            wx.requestSubscribeMessage({
-                tmplIds: ['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY',
-                    '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'
-                ],
-                success: (res) => {
-                    console.log(res)
-                    if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'reject') {
-                        console.log('用户不同意订阅')
-                        // 用户不同意订阅
-                        wx.setStorageSync('message', false)
-                    } else if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
-                        console.log('订阅成功')
-                        // 用户点击统一订阅
-                        wx.setStorageSync('message', true)
-                    }
-                    wx.navigateTo({
-                        url: `../vipActivity/vipActivity`
-                    });
-                },
-                fail: () => {
-                    wx.navigateTo({
-                        url: `../vipActivity/vipActivity`
-                    });
-                }
-            })
-        } else {
-            wx.navigateTo({
-                url: `../vipActivity/vipActivity`
-            });
-        }
+    // myPlase() {
+    //     if (!wx.getStorageSync('message')) {
+    //         wx.requestSubscribeMessage({
+    //             tmplIds: ['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY',
+    //                 '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'
+    //             ],
+    //             success: (res) => {
+    //                 console.log(res)
+    //                 if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'reject') {
+    //                     console.log('用户不同意订阅')
+    //                         // 用户不同意订阅
+    //                     wx.setStorageSync('message', false)
+    //                 } else if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
+    //                     console.log('订阅成功')
+    //                         // 用户点击统一订阅
+    //                     wx.setStorageSync('message', true)
+    //                 }
+    //                 wx.navigateTo({
+    //                     url: `../vipActivity/vipActivity`
+    //                 });
+    //             },
+    //             fail: () => {
+    //                 wx.navigateTo({
+    //                     url: `../vipActivity/vipActivity`
+    //                 });
+    //             }
+    //         })
+    //     } else {
+    //         wx.navigateTo({
+    //             url: `../vipActivity/vipActivity`
+    //         });
+    //     }
 
 
-    },
+    // },
     // 弹窗提示
     helpPayHideEvent() {
         this.setData({
@@ -1331,5 +1340,98 @@ Page({
         }).fail(error => {
             console.log(error)
         })
+    },
+    // 分享作品逻辑
+    creatShare(video) {
+        return new Promise((resolve, reject) => {
+            let context = wx.createSelectorQuery();
+            context
+                .select('#share')
+                .fields({
+                    node: true,
+                    size: true
+                }).exec((res) => {
+                    const canvas = res[0].node;
+                    const ctx = canvas.getContext('2d');
+                    const dpr = wx.getSystemInfoSync().pixelRatio;
+                    canvas.width = res[0].width * dpr;
+                    canvas.height = res[0].height * dpr;
+                    ctx.scale(dpr, dpr);
+                    ctx.font = '14px PingFang';
+                    let pic = canvas.createImage();
+                    pic.src = video.coverImg; //可以是本地,也可以是网络图片
+                    pic.onload = () => {
+                        ctx.drawImage(pic, 0, 0, 375, 211);
+                    }
+                    let peiyin = canvas.createImage();
+                    peiyin.src = '/static/image/peiyin.jpg';
+                    peiyin.onload = () => {
+                        ctx.drawImage(peiyin, 0, 211, 375, 89);
+                        // 收藏,一个一个渲染
+                        let sc = canvas.createImage();
+                        sc.src = '/static/image/no_collect.png'
+                        sc.onload = () => {
+                            ctx.drawImage(sc, 12, 220, 20, 20)
+                            ctx.fillText('收藏', 36, 238)
+                                //分享
+                            let fx = canvas.createImage();
+                            fx.src = '/static/index/share.png'
+                            fx.onload = () => {
+                                ctx.drawImage(fx, 78, 220, 22, 22)
+                                ctx.fillText('分享', 104, 238)
+                                    //点赞
+                                let dz = canvas.createImage();
+                                dz.src = video.isLike ? '/static/index/heart_colored.png' : '/static/index/heart.png'
+
+                                dz.onload = () => {
+                                    ctx.drawImage(dz, 258, 222, 22, 22)
+                                    ctx.fillText(video.likes, 284, 238)
+                                        //评论
+                                    let pl = canvas.createImage();
+                                    pl.src = '/static/index/comment.png'
+                                    pl.onload = () => {
+                                        ctx.drawImage(pl, 318, 222, 22, 22)
+                                        ctx.fillText(video.commentAmount, 340, 238)
+                                        setTimeout(() => {
+                                            wx.canvasToTempFilePath({
+                                                canvas: canvas,
+                                                success(res) {
+                                                    resolve({
+                                                        title: video.title,
+                                                        path: `/pages/index/index?readId=${video.id}&uid=${wx.getStorageSync('uid')}`,
+                                                        imageUrl: res.tempFilePath
+                                                    })
+                                                },
+                                                fail(res) {
+                                                    reject()
+                                                }
+                                            }, this)
+                                        }, 500)
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+                })
+        })
+    },
+    onShareAppMessage({
+        target
+    }) {
+        let video = target.dataset.info
+        console.log(`/pages/index/index?readId=${video.id}&uid=${wx.getStorageSync('uid')}`)
+        const promise = new Promise(resolve => {
+            this.creatShare(video).then(res => {
+                resolve(res)
+            })
+        })
+
+        return {
+            title: video.title,
+            path: `/pages/index/index?readId=${video.id}&uid=${wx.getStorageSync('uid')}`,
+            imageUrl: video.coverImg,
+            promise
+        }
     }
 })

+ 29 - 25
pages/index/index.wxml

@@ -1,7 +1,6 @@
 <!-- index.wxml -->
 <!-- <StatusBar receiveData="{{statusbarobj}}" grade="{{grade}}" bindgradeTap="gradeTap" /> -->
 <mp-navigation-bar title="UI组件库"></mp-navigation-bar>
-<setGrade wx:if="{{isGradeShow}}"></setGrade>
 <!-- <view class="change_grade" wx:if="{{isGradeShow}}">
     <view class="change_brage_wrapper">
         <text class="title">分龄选择</text>
@@ -19,6 +18,25 @@
         </view>
     </view>
 </view> -->
+<view class="gradeContainer" catchtouchmove='true' wx:if="{{isGradeShow}}">
+    <view class="gradeBox" bindtap="selectGrade">
+        <view class="title">年级选择</view>
+        <view class="content">
+            <view class="grade {{temporaryGrade=='PRESCHOOL'?'check':''}}" data-code="PRESCHOOL">学前班</view>
+            <view class="grade {{temporaryGrade=='PRIMARY_FIRST_GRADE'?'check':''}}" data-code="PRIMARY_FIRST_GRADE">一年级</view>
+        </view>
+        <view class="content">
+            <view class="grade {{temporaryGrade=='PRIMARY_SECOND_GRADE'?'check':''}}" data-code="PRIMARY_SECOND_GRADE">二年级</view>
+            <view class="grade {{temporaryGrade=='PRIMARY_THREE_GRADE'?'check':''}}" data-code="PRIMARY_THREE_GRADE">三年级</view>
+        </view>
+        <view class="content">
+            <view class="grade {{temporaryGrade=='PRIMARY_SENIOR_GRADE'?'check':''}}" data-code="PRIMARY_SENIOR_GRADE">四年级</view>
+        </view>
+        <view class="submitBox">
+            <button class="resetBtn submit" bindtap="changeGrade">登录</button>
+        </view>
+    </view>
+</view>
 <view class="container">
     <!-- 引入组件 -->
     <import src="/component/my/my.wxml" />
@@ -41,31 +59,19 @@
             <text>资源</text>
         </view>
     </view>
-
     <!-- <view hidden="{{gradeActivity === 'PRIMARY_SENIOR_GRADE' || gradeActivity === 'PRESCHOOL' || 0 != myIndex}}" class="activity-img" bindtap="goToActivity"> -->
     <view hidden="{{0 != myIndex}}" class="activity-img" bindtap="goToActivity">
         <image src="http://reader-wx.ai160.com/images/reader/activity/banner.jpg"></image>
     </view>
-
-    <!-- <view hidden="{{(!isIos && isVip) || 0 != myIndex }}" class="activity-img" bindtap="bannerTap">
-    <image src="http://reader-wx.ai160.com/images/reader/pay/{{isIos ? 'ios_banner' : 'android_banner'}}.jpg"></image>
-  </view>-->
-    <view wx:if="{{isIos ||  isVip}}" class="activity-buy" bindtap="myPlase">
+    <!--  <view wx:if="{{isIos ||  isVip}}" class="activity-buy" bindtap="myPlase">
         <image src="http://reader-wx.ai160.com/images/reader/pay/vip_icon.png"></image>
-    </view>
+    </view> -->
     <!-- 调用组件 -->
-    <template is="{{templates}}" wx:if="{{myIndex === 3 || myIndex === 2}}"
-        data="{{myData: myData,coursesData:coursesData,noMoreWork:noMoreWork}}"></template>
-    <VideoSwiper wx:if="{{videoList.length > 0}}" class="video-swiper" video-list="{{videoList}}"
-        nextMargin="{{nextMargin}}" isSwiper="{{isSwiper}}" noMoreWork="{{noMoreWork}}" ifHeadTap="{{true}}"
-        bindopenShare="openShare" bindopenComment="openComment" bindheadTap="headTapHandler"
-        bindgoToReading="goToReading" bindcollectTap="collectTap" bindlikeTap="likeTap"
-        binddelHideMyWork="delHideMyWork" bindaddShareAmount="addShareAmount" bindchange="videoChange">
+    <template is="{{templates}}" wx:if="{{myIndex === 3 || myIndex === 2}}" data="{{myData: myData,coursesData:coursesData,noMoreWork:noMoreWork}}"></template>
+    <VideoSwiper wx:if="{{videoList.length > 0}}" class="video-swiper" video-list="{{videoList}}" nextMargin="{{nextMargin}}" isSwiper="{{isSwiper}}" noMoreWork="{{noMoreWork}}" ifHeadTap="{{true}}" bindopenShare="openShare" bindopenComment="openComment" bindheadTap="headTapHandler" bindgoToReading="goToReading" bindcollectTap="collectTap" bindlikeTap="likeTap" binddelHideMyWork="delHideMyWork" bindaddShareAmount="addShareAmount" bindchange="videoChange">
     </VideoSwiper>
-    <view class="comment_section" catchtouchmove="touchMove" catchtap="commentTap" data-type="blank"
-        wx:if="{{commentShow}}">
-        <Comment data-type="list" commentId="{{commentId}}" commentNum="{{commentNum}}" inputValue="{{inputValue}}"
-            bindsendReply="sendReply" />
+    <view class="comment_section" catchtouchmove="touchMove" catchtap="commentTap" data-type="blank" wx:if="{{commentShow}}">
+        <Comment data-type="list" commentId="{{commentId}}" commentNum="{{commentNum}}" inputValue="{{inputValue}}" bindsendReply="sendReply" />
     </view>
     <view class="no_follow" wx:if="{{myIndex === 1 && videoList.length <= 0 && noFollow}}">
         <image class="no_follow_icon" src="../../static/index/no_follow.png" />
@@ -91,12 +97,10 @@
 <!-- <view class="upgrade" hidden="{{gradeActivity === 'PRIMARY_SENIOR_GRADE' || gradeActivity === 'PRESCHOOL' || upgradeHide}}"> -->
 <view class="upgrade" hidden="{{upgradeHide}}" bindtap="hideUpgrade">
     <view class="upgrade-main">
-        <image class="upgrade-icon" src="http://reader-wx.ai160.com/images/reader/activity/activity_dialog.png"
-            catchtap="goToActivity"></image>
+        <image class="upgrade-icon" src="http://reader-wx.ai160.com/images/reader/activity/activity_dialog.png" catchtap="goToActivity"></image>
         <image class="close" catchtap="hideUpgrade" src="../../static/image/close.png"></image>
     </view>
 </view>
-<shareDialog id="share-dialog" shareType='works' bindaddShareAmount="addShareAmount"
-    bindShareDialogClose="shareDialogClose" shareId="{{id}}" />
-<canvas canvas-id="myCanvas"
-    style="width:300px; height: 525px; position: absolute; left: -999rpx; top: -9999rpx;"></canvas>
+<shareDialog id="share-dialog" shareType='works' bindaddShareAmount="addShareAmount" bindShareDialogClose="shareDialogClose" shareId="{{id}}" />
+<canvas canvas-id="myCanvas" style="width:300px; height: 525px; position: absolute; left: -999rpx; top: -9999rpx;"></canvas>
+<canvas id='share' type="2d"> </canvas>

+ 318 - 309
pages/index/index.wxss

@@ -1,491 +1,500 @@
 /**index.wxss**/
+
+
 /*热门推荐*/
+
+
 /* @import "/component/hot/hot.wxss"; */
+
+@import "/component/setGrade/index.wxss";
+
 /*热团*/
+
 @import "/component/group/group.wxss";
+
 /*关注*/
+
+
 /* @import "/component/follow/follow.wxss"; */
+
+
 /*我的*/
+
 @import "/component/my/my.wxss";
 @import "/templates/courses/courses.wxss";
-
 .container {
-  /* background: rgba(242, 242, 242, 1); */
-  /* background: #eee; */
-  height: 100%;
-  /* overflow: hidden; */
+    /* background: rgba(242, 242, 242, 1); */
+    /* background: #eee; */
+    height: 100%;
+    /* overflow: hidden; */
 }
 
 .template {
-  height: 100%;
+    height: 100%;
 }
 
 .scroll-view {
-  height: 100%;
+    height: 100%;
 }
 
 .top-tab {
-  position: fixed;
-  top: 0;
-  /* top: 118rpx; */
-  width: 100%;
-  height: 80rpx;
-  background: #ededed;
-  /* color: #383838; */
-  box-sizing: border-box;
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  /* margin-bottom: 15rpx; */
-  z-index: 999;
-  padding: 0 48rpx 0 48rpx;
-
+    position: fixed;
+    top: 0;
+    /* top: 118rpx; */
+    width: 100%;
+    height: 80rpx;
+    background: #ededed;
+    /* color: #383838; */
+    box-sizing: border-box;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    /* margin-bottom: 15rpx; */
+    z-index: 999;
+    padding: 0 48rpx 0 48rpx;
 }
 
 .activity-img {
-  width: 100%;
-  height: 321rpx;
+    width: 100%;
+    height: 321rpx;
 }
 
 .activity-img image {
-  width: 100%;
-  height: 100%;
+    width: 100%;
+    height: 100%;
 }
 
 .activity-buy {
-  position: fixed;
-  right: 17rpx;
-  bottom: 300rpx;
-  width: 148rpx;
-  height: 149rpx;
-  z-index: 999;
+    position: fixed;
+    right: 17rpx;
+    bottom: 300rpx;
+    width: 148rpx;
+    height: 149rpx;
+    z-index: 999;
 }
 
 .activity-buy image {
-  width: 100%;
-  height: 100%;
+    width: 100%;
+    height: 100%;
 }
 
 .no_follow {
-  display: flex;
-  width: 100%;
-  height: 98%;
-  align-items: center;
-  justify-content: center;
-  color: rgba(0, 0, 0, .4);
-  font-size: 34rpx;
-  flex-direction: column;
+    display: flex;
+    width: 100%;
+    height: 98%;
+    align-items: center;
+    justify-content: center;
+    color: rgba(0, 0, 0, .4);
+    font-size: 34rpx;
+    flex-direction: column;
 }
 
 .no_follow_icon {
-  width: 274rpx;
-  height: 258rpx;
+    width: 274rpx;
+    height: 258rpx;
 }
 
 .tabbar {
-  /* flex: 1; */
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  width: 100rpx;
-  height: 58rpx;
-  line-height: 60rpx;
-  font-size: 40rpx;
-  opacity: 0.7;
-  font-weight: 800;
-  /* border-radius: 30rpx; */
-  /* background: #fff; */
-  border-bottom: none;
-  color: #333;
+    /* flex: 1; */
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    width: 100rpx;
+    height: 58rpx;
+    line-height: 60rpx;
+    font-size: 40rpx;
+    opacity: 0.7;
+    font-weight: 800;
+    /* border-radius: 30rpx; */
+    /* background: #fff; */
+    border-bottom: none;
+    color: #333;
 }
 
 .select {
-  color: #333;
-  /* font-size: 40rpx; */
-  /* font-family: SourceHanSansSC-bold; */
-  /* background: #61ca54; */
-  font-size: 40rpx;
-  border-bottom: 6rpx solid #14c962;
-  opacity: 1;
+    color: #333;
+    /* font-size: 40rpx; */
+    /* font-family: SourceHanSansSC-bold; */
+    /* background: #61ca54; */
+    font-size: 40rpx;
+    border-bottom: 6rpx solid #14c962;
+    opacity: 1;
 }
 
 .bottom-tab image {
-  width: 54rpx;
-  height: 54rpx;
-  margin-right: 20rpx;
+    width: 54rpx;
+    height: 54rpx;
+    margin-right: 20rpx;
 }
 
 .jurisdiction {
-  position: absolute;
-  left: 50%;
-  top: 50%;
-  transform: translate(-50%, -50%);
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    transform: translate(-50%, -50%);
 }
 
+
 /* 部分公用css */
+
 .red-text {
-  color: #ff3600;
+    color: #ff3600;
 }
 
+
 /* 作品列表 */
 
 .hotWares {
-  display: flex;
-  flex-wrap: wrap;
-  /* background: #e8e8e8; */
+    display: flex;
+    flex-wrap: wrap;
+    /* background: #e8e8e8; */
 }
 
 .recommdSection .hotWares .worksCard {
-  position: relative;
-  overflow: hidden;
-  width: 100%;
-  height: 496rpx;
-  background: #fff;
-  /* padding: 26rpx; */
-  /* border-radius: 12rpx; */
-  /* margin: 0 0 18rpx 16rpx; */
-  margin: 0 auto 20rpx;
-  /* box-shadow: 0 8rpx 6rpx 0 rgba(0, 0, 0, .28); */
+    position: relative;
+    overflow: hidden;
+    width: 100%;
+    height: 496rpx;
+    background: #fff;
+    /* padding: 26rpx; */
+    /* border-radius: 12rpx; */
+    /* margin: 0 0 18rpx 16rpx; */
+    margin: 0 auto 20rpx;
+    /* box-shadow: 0 8rpx 6rpx 0 rgba(0, 0, 0, .28); */
 }
 
 .worksCard {
-  position: relative;
-  overflow: hidden;
-  width: 100%;
-  height: 496rpx;
-  background: #fff;
-  margin: 0 auto 20rpx;
+    position: relative;
+    overflow: hidden;
+    width: 100%;
+    height: 496rpx;
+    background: #fff;
+    margin: 0 auto 20rpx;
 }
 
 .worksCard .wareCardImg {
-  display: block;
-  width: 704rpx;
-  height: 290rpx;
-  margin: 21rpx auto 0;
-  border-radius: 20rpx;
+    display: block;
+    width: 704rpx;
+    height: 290rpx;
+    margin: 21rpx auto 0;
+    border-radius: 20rpx;
 }
 
 .worksCard .titleSummary {
-  display: flex;
-  justify-content: space-between;
-  margin-top: 12rpx;
+    display: flex;
+    justify-content: space-between;
+    margin-top: 12rpx;
 }
 
 .worksCard .wareCardTitle {
-  /* margin: 0 auto; */
-  width: 80%;
-  height: 46rpx;
-  display: block;
-  /* text-align: left; */
-  color: #444;
-  font-size: 32rpx;
-  /* letter-spacing: 4rpx; */
-  margin-left: 28rpx;
-  font-family: MicrosoftYaHei;
+    /* margin: 0 auto; */
+    width: 80%;
+    height: 46rpx;
+    display: block;
+    /* text-align: left; */
+    color: #444;
+    font-size: 32rpx;
+    /* letter-spacing: 4rpx; */
+    margin-left: 28rpx;
+    font-family: MicrosoftYaHei;
 }
 
 .worksCard .topData {
-  height: 92rpx;
-  margin-top: 22rpx;
-  display: flex;
-  flex-direction: row;
-  /* justify-content: space-between; */
-  align-items: center;
+    height: 92rpx;
+    margin-top: 22rpx;
+    display: flex;
+    flex-direction: row;
+    /* justify-content: space-between; */
+    align-items: center;
 }
 
 .worksLeft {
-  display: flex;
-  flex-direction: row;
-  flex: 1;
-  margin-left: 10rpx;
-  position: relative;
+    display: flex;
+    flex-direction: row;
+    flex: 1;
+    margin-left: 10rpx;
+    position: relative;
 }
 
 .worksLeft .worksInfo .authorName {
-  color: #393939;
-  font-size: 30rpx;
-  margin-top: 8rpx;
-
+    color: #393939;
+    font-size: 30rpx;
+    margin-top: 8rpx;
 }
 
 .worksLeft .worksInfo .time {
-  color: #393939;
-  font-size: 30rpx;
-
+    color: #393939;
+    font-size: 30rpx;
 }
 
 .worksCard .topData .wareCardPlays {
-  width: 100rpx;
-  /* margin-left: 270rpx; */
-  display: flex;
-  flex-direction: row-reverse;
-  align-items: center;
-  padding-right: 35rpx;
-  margin-bottom: 6rpx;
-  margin-left: 4rpx;
+    width: 100rpx;
+    /* margin-left: 270rpx; */
+    display: flex;
+    flex-direction: row-reverse;
+    align-items: center;
+    padding-right: 35rpx;
+    margin-bottom: 6rpx;
+    margin-left: 4rpx;
 }
 
 .worksCard .topData .authorAvatar {
-  width: 92rpx;
-  height: 92rpx;
-  margin: 0 22rpx 0 22rpx;
-  display: block;
-  border: 4rpx solid #61CA54;
-  border-radius: 50%;
+    width: 92rpx;
+    height: 92rpx;
+    margin: 0 22rpx 0 22rpx;
+    display: block;
+    border: 4rpx solid #61CA54;
+    border-radius: 50%;
 }
 
 .worksCard .topData .profession {
-  width: 60rpx;
-  height: 30rpx;
-  background: rgba(97, 202, 84, 1);
-  border-radius: 15rpx;
-  font-size: 22rpx;
-  /* font-family: PingFangSC-Medium; */
-  font-weight: 800;
-  color: rgba(255, 255, 255, 1);
-  line-height: 30rpx;
-  text-align: center;
-  position: absolute;
-  bottom: -7rpx;
-  left: 42rpx;
-
+    width: 60rpx;
+    height: 30rpx;
+    background: rgba(97, 202, 84, 1);
+    border-radius: 15rpx;
+    font-size: 22rpx;
+    /* font-family: PingFangSC-Medium; */
+    font-weight: 800;
+    color: rgba(255, 255, 255, 1);
+    line-height: 30rpx;
+    text-align: center;
+    position: absolute;
+    bottom: -7rpx;
+    left: 42rpx;
 }
 
 .topData .numberInfo {
-  display: flex;
-  flex-direction: column;
-  margin-top: -5rpx;
-
+    display: flex;
+    flex-direction: column;
+    margin-top: -5rpx;
 }
 
 .worksCard .wareCardTip {
-  width: 178rpx;
-  height: 40rpx;
-  display: block;
-  text-align: left;
-  color: #444;
-  font-size: 24rpx;
-  line-height: 44rpx;
-
+    width: 178rpx;
+    height: 40rpx;
+    display: block;
+    text-align: left;
+    color: #444;
+    font-size: 24rpx;
+    line-height: 44rpx;
 }
 
 .worksCard .wareCardPlays .wareCardPlaysImg {
-  width: 30rpx;
-  height: 26rpx;
-  margin-left: 7rpx;
-  float: right;
+    width: 30rpx;
+    height: 26rpx;
+    margin-left: 7rpx;
+    float: right;
 }
 
 .worksCard .wareCardPlays text {
-  /* margin-left: 4rpx; */
-  color: #848484;
-  font-size: 24rpx;
-  text-align: right;
-  /* width:57%; */
-  float: right;
-  line-height: 37rpx;
-
+    /* margin-left: 4rpx; */
+    color: #848484;
+    font-size: 24rpx;
+    text-align: right;
+    /* width:57%; */
+    float: right;
+    line-height: 37rpx;
 }
 
 .worksCard .wareCardLikes {
-  width: 100rpx;
-  margin-right: 18rpx;
-  display: flex;
-  flex-direction: row-reverse;
-  align-items: center;
+    width: 100rpx;
+    margin-right: 18rpx;
+    display: flex;
+    flex-direction: row-reverse;
+    align-items: center;
 }
 
 .worksCard .wareCardLikes .wareCardLikesImg {
-  width: 22rpx;
-  height: 26rpx;
-  margin-left: 7rpx;
+    width: 22rpx;
+    height: 26rpx;
+    margin-left: 7rpx;
 }
 
 .worksCard .wareCardLikes text {
-  /* margin-left: 4rpx; */
-  color: #848484;
-  font-size: 24rpx;
+    /* margin-left: 4rpx; */
+    color: #848484;
+    font-size: 24rpx;
 }
 
 .index-dialog {
-  width: 100%;
-  height: 100%;
-  position: fixed;
-  top: 0;
-  left: 0;
-  z-index: 3;
-  background: rgba(0, 0, 0, .3)
+    width: 100%;
+    height: 100%;
+    position: fixed;
+    top: 0;
+    left: 0;
+    z-index: 3;
+    background: rgba(0, 0, 0, .3)
 }
 
 .index-dialog-wrapper {
-  width: 392rpx;
-  height: 240rpx;
-  background: #fff;
-  border-radius: 30rpx;
-  box-shadow: 0 0 10 0 rgba(0, 0, 0, .5);
-  position: fixed;
-  top: 281rpx;
-  left: 0;
-  right: 0;
-  margin: 0 auto;
+    width: 392rpx;
+    height: 240rpx;
+    background: #fff;
+    border-radius: 30rpx;
+    box-shadow: 0 0 10 0 rgba(0, 0, 0, .5);
+    position: fixed;
+    top: 281rpx;
+    left: 0;
+    right: 0;
+    margin: 0 auto;
 }
 
 .index-dialog-text {
-  width: 100%;
-  font-size: 29rpx;
-  color: #535353;
-  font-weight: 800;
-  text-align: center;
-  margin-top: 59rpx;
+    width: 100%;
+    font-size: 29rpx;
+    color: #535353;
+    font-weight: 800;
+    text-align: center;
+    margin-top: 59rpx;
 }
 
 .index-dialog-btn {
-  width: 160rpx;
-  height: 50rpx;
-  border: 3rpx solid #f75642;
-  border-radius: 25rpx;
-  line-height: 50rpx;
-  text-align: center;
-  color: #f75642;
-  font-size: 30rpx;
-  font-weight: 800;
-  margin: 41rpx auto;
+    width: 160rpx;
+    height: 50rpx;
+    border: 3rpx solid #f75642;
+    border-radius: 25rpx;
+    line-height: 50rpx;
+    text-align: center;
+    color: #f75642;
+    font-size: 30rpx;
+    font-weight: 800;
+    margin: 41rpx auto;
 }
 
 .index-dialog-btn-hide {
-  width: 100%;
-  height: 100%;
-  position: absolute;
-  background: rgba(0, 0, 0, 0);
-  top: 0;
+    width: 100%;
+    height: 100%;
+    position: absolute;
+    background: rgba(0, 0, 0, 0);
+    top: 0;
 }
 
 .comment_section {
-  position: fixed;
-  top: 0;
-  left: 0;
-  width: 100%;
-  height: 100%;
-  z-index: 9999;
-  background: rgba(0, 0, 0, .3);
-  overflow: hidden;
+    position: fixed;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 100%;
+    z-index: 9999;
+    background: rgba(0, 0, 0, .3);
+    overflow: hidden;
 }
 
 .change_grade {
-  width: 100%;
-  height: 100%;
-  background: rgba(0, 0, 0, .7);
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  position: fixed;
-  top: 0;
-  left: 0;
-  z-index: 9999;
+    width: 100%;
+    height: 100%;
+    background: rgba(0, 0, 0, .7);
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    position: fixed;
+    top: 0;
+    left: 0;
+    z-index: 9999;
 }
 
 .change_grade .change_brage_wrapper {
-  width: 548rpx;
-  /* height: 453rpx; */
-  background: #fff;
-  border-radius: 20rpx;
+    width: 548rpx;
+    /* height: 453rpx; */
+    background: #fff;
+    border-radius: 20rpx;
 }
 
 .change_grade .change_brage_wrapper .title {
-  width: 100%;
-  text-align: center;
-  color: rgba(0, 0, 0, .6);
-  font-size: 40rpx;
-  margin-top: 33rpx;
-  margin-bottom: 66rpx;
-  display: flex;
-  justify-content: center;
+    width: 100%;
+    text-align: center;
+    color: rgba(0, 0, 0, .6);
+    font-size: 40rpx;
+    margin-top: 33rpx;
+    margin-bottom: 66rpx;
+    display: flex;
+    justify-content: center;
 }
 
 .change_grade .change_brage_wrapper .change_row {
-  width: 100%;
-  display: flex;
-  justify-content: space-around;
-  margin-bottom: 65rpx;
+    width: 100%;
+    display: flex;
+    justify-content: space-around;
+    margin-bottom: 65rpx;
 }
 
 .change_grade .change_brage_wrapper .change_row .change_item {
-  width: 220rpx;
-  height: 68rpx;
-  background: #14c962;
-  border-radius: 100rpx;
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  font-size: 36rpx;
-  color: #fff;
+    width: 220rpx;
+    height: 68rpx;
+    background: #14c962;
+    border-radius: 100rpx;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    font-size: 36rpx;
+    color: #fff;
 }
 
 .change_grade .change_brage_wrapper .change_item_blank {
-  background: #ffffff !important;
+    background: #ffffff !important;
 }
 
 .upgrade,
 .help-pay {
-  position: fixed;
-  left: 0;
-  top: 0;
-  width: 100%;
-  height: 100%;
-  background: rgba(0, 0, 0, .75);
-  z-index: 9999;
+    position: fixed;
+    left: 0;
+    top: 0;
+    width: 100%;
+    height: 100%;
+    background: rgba(0, 0, 0, .75);
+    z-index: 9999;
 }
 
 .help-pay-main,
 .upgrade-main {
-  position: absolute;
-  left: 50%;
-  top: 14%;
-  transform: translate(-50%, 0);
+    position: absolute;
+    left: 50%;
+    top: 14%;
+    transform: translate(-50%, 0);
 }
 
 .upgrade-icon {
-  width: 629rpx;
-  height: 692rpx;
+    width: 629rpx;
+    height: 692rpx;
 }
 
 .upgrade-main .close {
-  width: 50rpx;
-  height: 50rpx;
-  position: absolute;
-  left: 0;
-  right: 0;
-  margin: 0 auto;
-  top: 103%;
+    width: 50rpx;
+    height: 50rpx;
+    position: absolute;
+    left: 0;
+    right: 0;
+    margin: 0 auto;
+    top: 103%;
 }
 
 .help-pay-icon {
-  width: 570rpx;
-  height: 747rpx;
+    width: 570rpx;
+    height: 747rpx;
 }
 
 .tips-icon {
-  width: 570rpx;
-  height: 390rpx;
+    width: 570rpx;
+    height: 390rpx;
 }
 
 .help-close {
-  position: absolute;
-  left: 50%;
-  transform: translateX(-50%);
-  bottom: -100rpx;
-  width: 65rpx;
-  height: 65rpx;
+    position: absolute;
+    left: 50%;
+    transform: translateX(-50%);
+    bottom: -100rpx;
+    width: 65rpx;
+    height: 65rpx;
 }
 
 .pay-price {
-  position: absolute;
-  bottom: 65rpx;
-  left: 88rpx;
-  color: #FFFFFF;
-  font-size: 49rpx;
+    position: absolute;
+    bottom: 65rpx;
+    left: 88rpx;
+    color: #FFFFFF;
+    font-size: 49rpx;
 }
 
 .pay-price text {
-  font-size: 30rpx;
+    font-size: 30rpx;
 }

+ 73 - 73
pages/login/login.js

@@ -25,7 +25,7 @@ Page({
      * 生命周期函数--监听页面加载
      */
 
-    onLoad: function (options) {
+    onLoad: function(options) {
         if (options.index) {
             this.setData({
                 index: options.index
@@ -37,7 +37,7 @@ Page({
             })
         }
     },
-    userLoginRecord: function (uid) {
+    userLoginRecord: function(uid) {
         if (wx.getStorageSync('uid')) {
             console.log('调用方法')
             let url = getAPIUrl('wx/loginLog');
@@ -46,79 +46,79 @@ Page({
             }).method('POST').url(url).send().success(() => {}).fail(() => {});
         }
     },
-    getUserProfile: function (e) {
+    getUserProfile: function(e) {
         wx.getUserProfile({
             desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
             success: (userProfile) => {
                 console.log('getUserProfile', userProfile);
                 const userInfo = userProfile.userInfo;
                 this.getOpenId((openidData) => {
-                    console.log('openid', openidData)
-                    let url = getAPIUrl('wx/user');
-                    const userData = {
-                        openId: openidData.data.data.openid,
-                        unionId: openidData.data.data.unionid,
-                        wechatName: userInfo.nickName,
-                        gender: userInfo.gender,
-                        avatar: userInfo.avatarUrl
-                    }
-                    request.getInstance().url(url).header({}).data(userData).method('POST').send().success(res => {
-                        console.log('登陆成功', res)
-                        wx.hideToast()
-                        wx.showToast({
-                            title: '登录成功',
-                            icon: 'success',
-                            duration: 1500,
-                            mask: true
-                        })
-                        wx.setStorageSync('uid', res.data.data.data.uid)
-                        wx.setStorageSync('user', res.data.data.data)
-                        this.userLoginRecord();
-                        const pages = getCurrentPages();
-                        const prevPage = pages[pages.length - 2];
-                        prevPage.setData({
-                            fromLoginIndex: this.data.index, // 有id就塞到第一位
-                        }, () => {
-                            wx.navigateBack({
-                                delta: 1
+                        console.log('openid', openidData)
+                        let url = getAPIUrl('wx/user');
+                        const userData = {
+                            openId: openidData.data.data.openid,
+                            unionId: openidData.data.data.unionid,
+                            nickName: userInfo.nickName,
+                            gender: userInfo.gender,
+                            avatar: userInfo.avatarUrl
+                        }
+                        request.getInstance().url(url).header({}).data(userData).method('POST').send().success(res => {
+                            console.log('登陆成功', res)
+                            wx.hideToast()
+                            wx.showToast({
+                                title: '登录成功',
+                                icon: 'success',
+                                duration: 1500,
+                                mask: true
                             })
-                        })
-                    });
-                })
-                // getOpenidSessionKey((res) => {
-                //   console.log('getUserProfilegetUserProfile', res)
-                //   wx.showToast({
-                //     title: '登录成功',
-                //     icon: 'fail',
-                //     duration: 1000,
-                //     success: () => {
-                //       const pages = getCurrentPages();
-                //       const prevPage = pages[pages.length - 2];
-                //       prevPage.setData({
-                //         fromLoginIndex: this.data.index, // 有id就塞到第一位
-                //       }, () => {
-                //         wx.navigateBack({
-                //           delta: 1
-                //         })
-                //       })
-                //     }
-                //   })
-                // }, (error) => {
-                //   wx.showToast({
-                //     title: '登录失败',
-                //     icon: 'fail',
-                //     duration: 1000,
-                //     success: () => {
-                //       wx.navigateBack()
-                //     }
-                //   })
-                // });
+                            wx.setStorageSync('uid', res.data.data.data.uid)
+                            wx.setStorageSync('user', res.data.data.data)
+                            this.userLoginRecord();
+                            const pages = getCurrentPages();
+                            const prevPage = pages[pages.length - 2];
+                            prevPage.setData({
+                                fromLoginIndex: this.data.index, // 有id就塞到第一位
+                            }, () => {
+                                wx.navigateBack({
+                                    delta: 1
+                                })
+                            })
+                        });
+                    })
+                    // getOpenidSessionKey((res) => {
+                    //   console.log('getUserProfilegetUserProfile', res)
+                    //   wx.showToast({
+                    //     title: '登录成功',
+                    //     icon: 'fail',
+                    //     duration: 1000,
+                    //     success: () => {
+                    //       const pages = getCurrentPages();
+                    //       const prevPage = pages[pages.length - 2];
+                    //       prevPage.setData({
+                    //         fromLoginIndex: this.data.index, // 有id就塞到第一位
+                    //       }, () => {
+                    //         wx.navigateBack({
+                    //           delta: 1
+                    //         })
+                    //       })
+                    //     }
+                    //   })
+                    // }, (error) => {
+                    //   wx.showToast({
+                    //     title: '登录失败',
+                    //     icon: 'fail',
+                    //     duration: 1000,
+                    //     success: () => {
+                    //       wx.navigateBack()
+                    //     }
+                    //   })
+                    // });
             }
         })
     },
-    getOpenId: function (successcallback, failcallback) {
+    getOpenId: function(successcallback, failcallback) {
         wx.login({
-            success: function (res) {
+            success: function(res) {
                 if (res.code) {
                     // 获取openid
                     console.log('openId', res.code)
@@ -133,7 +133,7 @@ Page({
             }
         })
     },
-    impower: function (e) {
+    impower: function(e) {
         console.log(e)
         var myEventDetail = {} // detail对象,提供给事件监听函数
         var myEventOption = {} // 触发事件的选项
@@ -166,55 +166,55 @@ Page({
             })
         });
     },
-    touchMove: function () {
+    touchMove: function() {
         return false
     },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady: function () {
+    onReady: function() {
 
     },
 
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow: function () {
+    onShow: function() {
 
     },
 
     /**
      * 生命周期函数--监听页面隐藏
      */
-    onHide: function () {
+    onHide: function() {
 
     },
 
     /**
      * 生命周期函数--监听页面卸载
      */
-    onUnload: function () {
+    onUnload: function() {
 
     },
 
     /**
      * 页面相关事件处理函数--监听用户下拉动作
      */
-    onPullDownRefresh: function () {
+    onPullDownRefresh: function() {
 
     },
 
     /**
      * 页面上拉触底事件的处理函数
      */
-    onReachBottom: function () {
+    onReachBottom: function() {
 
     },
 
     /**
      * 用户点击右上角分享
      */
-    onShareAppMessage: function () {
+    onShareAppMessage: function() {
 
     }
 })

+ 288 - 288
pages/main/class/class.js

@@ -1,316 +1,316 @@
 import httpRequestApi from '../../../utils/APIClient';
 import {
-  formatDate
+    formatDate
 } from '../../../utils/util';
 import {
-  getOpenidSessionKey
+    getOpenidSessionKey
 } from '../../../utils/httpUtil';
 const app = getApp()
 Page({
-  data: {
-    fullScreenBtn: false,
-    playBtn: true,
-    gesture: true,
-    centerBtn: true,
-    controls: true,
-    videoLoad: false,
-    autoPlay: true,
-    videoUrl: '',
-    poster: '',
-    works: [],
-    total: '',
-    title: '',
-    id: '',
-    iconImg: '',
-    pageNo: 1,
-    totalNo: 0,
-    collectFlag: false,
-    goBackHome: false,
-    lazyVideoUrl: '',
-    isIOS: app.globalData.isIOS,
-    modalType: "text",
-    hide: true,
+    data: {
+        fullScreenBtn: false,
+        playBtn: true,
+        gesture: true,
+        centerBtn: true,
+        controls: true,
+        videoLoad: false,
+        autoPlay: true,
+        videoUrl: '',
+        poster: '',
+        works: [],
+        total: '',
+        title: '',
+        id: '',
+        iconImg: '',
+        pageNo: 1,
+        totalNo: 0,
+        collectFlag: false,
+        goBackHome: false,
+        lazyVideoUrl: '',
+        isIOS: app.globalData.isIOS,
+        modalType: "text",
+        hide: true,
 
-    modalText: [{
-        text: '您还不是本课程的会员',
-        type: 'bigOrange'
-      },
-      {
-        text: '您可以开团,拼团成功获得使用权',
-        type: 'normal'
-      }
-    ],
-    modalBtnText: '去开团',
-    isModalShow: false,
-    productId: 0,
-    videoPlayTime: 0
-  },
-  jurisdiction: function() {
-    //隐藏弹框
-    this.setData({
-      hide: !this.data.hide
-    })
-    //登录页信息
-    this.goToReading()
-  },
-  onLoad: function (option) {
-    console.log(option);
-    if (option.scene || option.shareCard) {
-      this.setData({
-        goBackHome: true
-      })
-    }
-    this.setData({
-      // title: option.title,
-      id: option.id
-    })
+        modalText: [{
+                text: '您还不是本课程的会员',
+                type: 'bigOrange'
+            },
+            {
+                text: '您可以开团,拼团成功获得使用权',
+                type: 'normal'
+            }
+        ],
+        modalBtnText: '去开团',
+        isModalShow: false,
+        productId: 0,
+        videoPlayTime: 0
+    },
+    jurisdiction: function() {
+        //隐藏弹框
+        this.setData({
+                hide: !this.data.hide
+            })
+            //登录页信息
+        this.goToReading()
+    },
+    onLoad: function(option) {
+        console.log(option);
+        if (option.scene || option.shareCard) {
+            this.setData({
+                goBackHome: true
+            })
+        }
+        this.setData({
+            // title: option.title,
+            id: option.id
+        })
 
-    this.uid = wx.getStorageSync('uid');;
+        this.uid = wx.getStorageSync('uid');;
 
 
-    httpRequestApi.getClassDetail(this.uid, option.id).success(res => {
-      console.log(res);
-      const classId = this.data.id;
-      httpRequestApi.userIntoPage('pages/main/class/class', '官方课程页面').success((res) => {
+        httpRequestApi.getClassDetail(this.uid, option.id).success(res => {
+            console.log(res);
+            const classId = this.data.id;
+            httpRequestApi.userIntoPage('pages/main/class/class', '官方课程页面').success((res) => {
 
-      })
-      this.setData({
-        title: res.data.data.lesson.title,
-        videoUrl: res.data.data.lesson.playUrl,
-        iconImg: res.data.data.lesson.iconImg,
-        productId: res.data.data.product.id
-      })
-      wx.setNavigationBarTitle({
-        title: res.data.data.lesson.title //页面标题为路由参数
-      })
+            })
+            this.setData({
+                title: res.data.data.lesson.title,
+                videoUrl: res.data.data.lesson.playUrl,
+                iconImg: res.data.data.lesson.iconImg,
+                productId: res.data.data.product.id
+            })
+            wx.setNavigationBarTitle({
+                title: res.data.data.lesson.title //页面标题为路由参数
+            })
 
-      this.getReadInfo(1, 10);
-      this.checkLike();
-      // this.innerAudioContext = wx.createInnerAudioContext();
-      // this.innerAudioContext.onPause((res) => {
-      //   // 播放音频失败的回调
-      //   console.log('音频暂停')
-      // });
-      // this.innerAudioContext.onPlay(res => {
-      //   console.log('class页面视频播放了')
-      // })
-    })
-  },
-  // video组件在获得url时迅速退出页面会导致小程序闪退,官方还没修复(11/28),处理办法:懒加载思路,在用户点击时再获取videoUrl
-  // setVideoUrl: function(){
-  //   console.log('视频地址>>>>>>>>',this.data.lazyVideoUrl)
-  //   this.setData({
-  //     videoUrl: this.data.lazyVideoUrl,
-  //   })
-  // },
-  videoPlayHandler: function () {
-    this.setData({
-      videoLoad: true
-    }, () => {
-      this.videoClassCtx = wx.createVideoContext('classVideo', this);
-      this.videoClassCtx.play();
-    })
-  },
-  // 检查是否收藏
-  checkLike: function () {
-    httpRequestApi.classIsLike(this.uid, {
-      targetCode: this.data.id
-    }).success(res => {
-      this.setData({
-        collectFlag: res.data.data
-      })
-    })
-  },
-  goToReading: function () {
-    
-    getOpenidSessionKey((res) => {
-      httpRequestApi.getUserAuth().success(res => {
-        if (res.data.success) {
-          const that = this;
-          wx.authorize({
-            scope: 'scope.record',
-            success () {
-                // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
-                console.log('成功')
-                wx.navigateTo({
-                  url: `../../main/reading/reading?id=${that.data.id}`
-                })
-            },
-            fail () {
-                wx.showModal({
-                    title: '录音前请打开麦克风权限',
-                    content: '点击右上角浮点...,选择:设置-麦克风,点击/打开。',
-                    confirmText: '我知道了',
-                    showCancel: false,
-                    success(res) {
-                        console.log('用户点击确定')
+            this.getReadInfo(1, 10);
+            this.checkLike();
+            // this.innerAudioContext = wx.createInnerAudioContext();
+            // this.innerAudioContext.onPause((res) => {
+            //   // 播放音频失败的回调
+            //   console.log('音频暂停')
+            // });
+            // this.innerAudioContext.onPlay(res => {
+            //   console.log('class页面视频播放了')
+            // })
+        })
+    },
+    // video组件在获得url时迅速退出页面会导致小程序闪退,官方还没修复(11/28),处理办法:懒加载思路,在用户点击时再获取videoUrl
+    // setVideoUrl: function(){
+    //   console.log('视频地址>>>>>>>>',this.data.lazyVideoUrl)
+    //   this.setData({
+    //     videoUrl: this.data.lazyVideoUrl,
+    //   })
+    // },
+    videoPlayHandler: function() {
+        this.setData({
+            videoLoad: true
+        }, () => {
+            this.videoClassCtx = wx.createVideoContext('classVideo', this);
+            this.videoClassCtx.play();
+        })
+    },
+    // 检查是否收藏
+    checkLike: function() {
+        httpRequestApi.classIsLike(this.uid, {
+            targetCode: this.data.id
+        }).success(res => {
+            this.setData({
+                collectFlag: res.data.data
+            })
+        })
+    },
+    goToReading: function() {
+
+        getOpenidSessionKey((res) => {
+            httpRequestApi.getUserAuth().success(res => {
+                if (res.data.success) {
+                    const that = this;
+                    wx.authorize({
+                        scope: 'scope.record',
+                        success() {
+                            // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
+                            console.log('成功')
+                            wx.navigateTo({
+                                url: `../../main/reading/reading?id=${that.data.id}`
+                            })
+                        },
+                        fail() {
+                            wx.showModal({
+                                title: '录音前请打开麦克风权限',
+                                content: '点击右上角浮点...,选择:设置-麦克风,点击/打开。',
+                                confirmText: '我知道了',
+                                showCancel: false,
+                                success(res) {
+                                    console.log('用户点击确定')
+                                }
+                            })
+                        }
+                    })
+                } else {
+                    console.log('chulaiba')
+                    if (this.data.isIOS) {
+                        wx.navigateTo({
+                            url: `../../vipPage/wechat/wechat`
+                        })
+                    } else {
+                        this.setData({
+                            modalType: 'androidVIP',
+                            isModalShow: true
+                        })
                     }
-                })
+
+                }
+            })
+        }, (error) => {
+            this.setData({
+                hide: !this.data.hide
+            })
+            if (this.videoClassCtx) {
+                this.videoClassCtx.stop();
             }
-          })
+            return;
+        });
+
+
+    },
+    modalConfirmHandler: function() {
+        this.setData({
+            isModalShow: false
+        })
+        if (this.data.isIOS) {
+            // wx.navigateTo({
+            //   url: `../../vipPage/vipCode/vipCode`
+            // })
+            wx.navigateTo({
+                url: `../../vipPage/wechat/wechat`
+            })
         } else {
-          console.log('chulaiba')
-          if(this.data.isIOS){
             wx.navigateTo({
-              url: `../../vipPage/wechat/wechat`
+                url: `../../vipPage/vip/vip`
             })
-          }else{
-            this.setData({
-              modalType: 'androidVIP',
-              isModalShow: true
-          })
-          }
-          
         }
-      })
-    }, (error) => {
+
+    },
+    modalCloseHandler: function() {
         this.setData({
-            hide: !this.data.hide
+            isModalShow: false
         })
+    },
+    openShare: function(e) {
+        // this.setData({
+        //     shareFlag: !this.data.shareFlag
+        // })
+        this.shareDialog = this.selectComponent("#share-dialog");
+        const data = {
+            avatar: this.data.authorAvatar,
+            author: this.data.author,
+            iconImg: this.data.iconImg,
+            title: this.data.title,
+            path: `pages/social/works/works?id=${this.data.id}&title=${this.data.title}`
+                // tip: this.data.tip,
+        }
+        this.shareDialog.share(data);
+    },
+    onShareAppMessage: function(res) {
+        console.log(this.data.productId)
+        if (res.from === 'button') {
+            // 来自页面内转发按钮
+            console.log(res.target)
+        }
+        return {
+            title: '老师同学都在玩的配音show,你还在等什么?',
+            path: `pages/main/class/class?id=${this.data.id}&title=${this.data.title}&shareCard=true`,
+            imageUrl: `https://efunbox.lingjiao.cn/reader/resource/share/lesson_${this.data.productId}.jpg`
+        }
+    },
+    goToWorks: function(e) {
+        console.log(this.data.works)
+            // this.videoClassCtx = wx.createVideoContext('myVideo', this);
         if (this.videoClassCtx) {
-          this.videoClassCtx.stop();
+            this.videoClassCtx.stop();
         }
-        return;
-    });
+        console.log(e);
+        let readId = e.currentTarget.dataset.id;
+        let title = this.data.title;
+        wx.navigateTo({
+            url: `../../social/works/works?id=${readId}&title=${title}`
+        })
+    },
+    collect: function(e) {
+        // let uid =  wx.getStorageSync('uid');
+        let data = {
+            targetCode: this.data.id,
+            // title: this.data.title,
+            // iconImg: this.data.iconImg
+        }
+        httpRequestApi.collectClass(this.uid, data).success(res => {
+            this.setData({
+                collectFlag: !this.data.collectFlag
+            })
+        })
+    },
+    getReadInfo: function(pageNo, pageSize) {
+        // const uid =  wx.getStorageSync('uid');
+        const data = {
+            lessonId: this.data.id,
+            pageNo: this.data.pageNo,
+            pageSize: 10
+        };
+        httpRequestApi.getClassRead(this.uid, data).success(res => {
+            const readInfo = res.data.data.list;
+            const readTemp = [];
+            readInfo.forEach(item => {
+                const temp = {};
+                temp.nickName = item.user.nickName;
+                temp.time = formatDate(item.userRead.gmtCreated, 3);
+                temp.avatar = item.user.avatar;
+                temp.likes = item.userRead.playAmount ? item.userRead.playAmount : 0;
+                temp.uid = item.userRead.uid;
+                temp.id = item.userRead.id;
+                this.data.works.push(temp);
+            });
+            this.setData({
+                totalNo: res.data.data.totalNo,
+                total: res.data.data.totalSize,
+                works: this.data.works
+            })
+        });
+    },
+    // 下拉加载
+    onReachBottom: function(e) {
+        console.log(this.data.totalNo);
+        this.setData({
+            pageNo: this.data.pageNo + 1
+        })
+        if (this.data.pageNo <= this.data.totalNo) {
+            this.getReadInfo();
+        }
+    },
+    // 视频时间变动
+    videoTimeChange: function(e) {
+        this.videoPlayTime = e.detail.currentTime;
+    },
+    onHide: function() {
+        let videoClassCtx = wx.createVideoContext('classVideo', this);
+        videoClassCtx.stop();
+    },
+    onUnload: function() {
+        if (this.videoPlayTime) {
+            const data = {
+                "title": this.data.title,
+                "lessonId": this.data.id,
+                "productId": this.data.productId,
+                "playStopTime": this.videoPlayTime || 0,
+                "type": 'EXAMPLE',
+            }
 
+            httpRequestApi.playLogReport(data).success(res => {
+                console.log(res)
+            })
+        }
 
-  },
-  modalConfirmHandler: function () {
-    this.setData({
-      isModalShow: false
-    })
-    if(this.data.isIOS){
-      // wx.navigateTo({
-      //   url: `../../vipPage/vipCode/vipCode`
-      // })
-      wx.navigateTo({
-        url: `../../vipPage/wechat/wechat`
-      })
-    }else{
-      wx.navigateTo({
-        url: `../../vipPage/vip/vip`
-      })
-    }
-   
-  },
-  modalCloseHandler: function () {
-    this.setData({
-      isModalShow: false
-    })
-  },
-  openShare: function (e) {
-    // this.setData({
-    //     shareFlag: !this.data.shareFlag
-    // })
-    this.shareDialog = this.selectComponent("#share-dialog");
-    const data = {
-      avatar: this.data.authorAvatar,
-      author: this.data.author,
-      iconImg: this.data.iconImg,
-      title: this.data.title,
-      path: `pages/social/works/works?id=${this.data.id}&title=${this.data.title}`
-      // tip: this.data.tip,
-    }
-    this.shareDialog.share(data);
-  },
-  onShareAppMessage: function (res) {
-    console.log(this.data.productId)
-    if (res.from === 'button') {
-      // 来自页面内转发按钮
-      console.log(res.target)
-    }
-    return {
-      title: '老师同学都在玩的配音show,你还在等什么?',
-      path: `pages/main/class/class?id=${this.data.id}&title=${this.data.title}&shareCard=true`,
-      imageUrl: `https://efunbox.lingjiao.cn/reader/resource/share/lesson_${this.data.productId}.jpg`
-    }
-  },
-  goToWorks: function (e) {
-    console.log(this.data.works)
-    // this.videoClassCtx = wx.createVideoContext('myVideo', this);
-    if (this.videoClassCtx) {
-      this.videoClassCtx.stop();
-    }
-    console.log(e);
-    let readId = e.currentTarget.dataset.id;
-    let title = this.data.title;
-    wx.navigateTo({
-      url: `../../social/works/works?id=${readId}&title=${title}`
-    })
-  },
-  collect: function (e) {
-    // let uid =  wx.getStorageSync('uid');
-    let data = {
-      targetCode: this.data.id,
-      // title: this.data.title,
-      // iconImg: this.data.iconImg
-    }
-    httpRequestApi.collectClass(this.uid, data).success(res => {
-      this.setData({
-        collectFlag: !this.data.collectFlag
-      })
-    })
-  },
-  getReadInfo: function (pageNo, pageSize) {
-    // const uid =  wx.getStorageSync('uid');
-    const data = {
-      lessonId: this.data.id,
-      pageNo: this.data.pageNo,
-      pageSize: 10
-    };
-    httpRequestApi.getClassRead(this.uid, data).success(res => {
-      const readInfo = res.data.data.list;
-      const readTemp = [];
-      readInfo.forEach(item => {
-        const temp = {};
-        temp.nickName = item.user.wechatName;
-        temp.time = formatDate(item.userRead.gmtCreated, 3);
-        temp.avatar = item.user.avatar;
-        temp.likes = item.userRead.playAmount ? item.userRead.playAmount : 0;
-        temp.uid = item.userRead.uid;
-        temp.id = item.userRead.id;
-        this.data.works.push(temp);
-      });
-      this.setData({
-        totalNo: res.data.data.totalNo,
-        total: res.data.data.totalSize,
-        works: this.data.works
-      })
-    });
-  },
-  // 下拉加载
-  onReachBottom: function (e) {
-    console.log(this.data.totalNo);
-    this.setData({
-      pageNo: this.data.pageNo + 1
-    })
-    if (this.data.pageNo <= this.data.totalNo) {
-      this.getReadInfo();
-    }
-  },
-  // 视频时间变动
-  videoTimeChange: function (e) {
-    this.videoPlayTime = e.detail.currentTime;
-  },
-  onHide: function () {
-    let videoClassCtx = wx.createVideoContext('classVideo', this);
-    videoClassCtx.stop();
-  },
-  onUnload: function () {
-    if (this.videoPlayTime) {
-      const data = {
-        "title": this.data.title,
-        "lessonId": this.data.id,
-        "productId": this.data.productId,
-        "playStopTime": this.videoPlayTime || 0,
-        "type": 'EXAMPLE',
-      }
 
-      httpRequestApi.playLogReport(data).success(res => {
-        console.log(res)
-      })
     }
-
-
-  }
 })

+ 13 - 17
pages/my/index.js

@@ -25,20 +25,16 @@ Page({
     },
     onLoad() {
         this.getProducts()
-        /* app.watch(() => {
-            console.log('执行了');
-            this.getProducts()
-            this.setUserInfo()
-        }) */
+            /* app.watch(() => {
+                console.log('执行了');
+                this.getProducts()
+                this.setUserInfo()
+            }) */
     },
     async onShow() {
         let uid = wx.getStorageSync('uid') || ''
-        // 没登陆先走静默登录,登录后直接获取用户信息
-        /*  if (uid) {
-             this.setUserInfo()
-         } */
         if (!uid) {
-            getOpenidNoLogin(async () => {
+            getOpenidNoLogin(async() => {
                 this.setUserInfo()
             })
         } else {
@@ -56,11 +52,11 @@ Page({
         })
         console.log(userInfo);
         // 如果用户没有头像及昵称的话就提醒获取
-        if (!userInfo.user.avatar && !userInfo.user.wechatName) {
-            wx.navigateTo({
-                url: `/pages/login/login`
-            });
-        }
+        // if (!userInfo.user.avatar && !userInfo.user.nickName) {
+        //     wx.navigateTo({
+        //         url: `/pages/login/login`
+        //     });
+        // }
     },
     async getTasks() {
         let tasks = await getTasks()
@@ -166,7 +162,7 @@ Page({
     switcher({
         currentTarget
     }) {
-        wx.reLaunch({
+        wx.navigateTo({
             url: `/pages/index/index?tabbarIndx=${currentTarget.dataset.index}`
         });
     },
@@ -181,7 +177,7 @@ Page({
         this.selectComponent('#shareSelect').showModal()
     }, */
     // 分享配置
-    onShareAppMessage: function (res) {
+    onShareAppMessage: function(res) {
         const user = wx.getStorageSync('user');
         return {
             title: `邀请你一起来朗读课文`,

+ 1 - 1
pages/my/index.wxml

@@ -21,7 +21,7 @@
         <view class="userRight">
             <view class="uRtop">
                 <view class="uRtopleft">
-                    <view class="nickName textOver">昵称:{{userInfo.user.wechatName }}</view>
+                    <view class="nickName textOver">昵称:{{userInfo.user.nickName }}</view>
                     <view class="gradeText">年级:{{filters.gradeFilter(userInfo.user.grade)}}</view>
                 </view>
                 <view class="uRtopRight" bindtap="jump" data-url="/pages/user/myEdit/myEdit">

+ 234 - 234
pages/mycollection/mycollection.js

@@ -1,242 +1,242 @@
 import httpRequestApi from '../../utils/APIClient';
 import {
-  formatDate
+    formatDate
 } from '../../utils/util';
 Page({
 
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    collection_data: [],
-    line1: '您还没有收藏过哦',
-    line2: '快去收藏自己喜欢的吧',
-    videoList: [],
-    commentShow: false,
-    statusbarobj: {
-      isshowbtn: false, //是否显示按钮
-      title: "小学语文朗读配音", //标题
-    },
-  },
-
-  toClass: function (e) {
-    let targetCode = e.currentTarget.dataset.targetcode;
-    let title = e.currentTarget.dataset.title;
-    // wx.navigateTo({
-    //   url: `../../main/class/class?id=${targetCode}&title=${title}`
-    // });
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (option) {
-    console.log(option.title);
-    if (option.title) {
-      wx.setNavigationBarTitle({
-        title: '我的收藏' //页面标题为路由参数
-      });
-      this.setData({
-        title: option.title
-      });
-    }
-    httpRequestApi.myFavorites().success(res => {
-      this.formatWorksList(res.data.data.list)
-    });
-  },
-  formatWorksList(list) {
-    list.forEach(item => {
-      const temp = {};
-      temp.title = item.userRead.title;
-      temp.summary = item.userRead.summary;
-      temp.img = item.userRead.iconImg;
-      temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
-      temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
-      temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
-      temp.shareAmount = item.userRead.shareAmount;
-      temp.favoritesAmount = item.userRead.favoritesAmount;
-      temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
-      temp.time = formatDate(item.userRead.gmtCreated, 3);
-      temp.avatar = item.user.avatar;
-      temp.profession = item.user.profession;
-      temp.uid = item.user.uid;
-      temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
-      temp.id = item.userRead.id;
-      temp.type = item.userRead.type;
-      temp.nickName = item.user.wechatName;
-      temp.isLike = item.isLike;
-      temp.isFans = true;
-      temp.isFavorite = true;
-      temp.coverImg = item.userRead.coverImg;
-      temp.shareImg = item.userRead.shareImg;
-      temp.grade = item.userRead.grade;
-      temp.videoShow = false;
-      item.isActivity && (temp.activity = true);
-      this.data.videoList.push(temp);
-    });
-    this.setData({
-      videoList: this.data.videoList
-    }, () => {
-      console.log(this.data.videoList)
-    })
-
-  },
-  goToReading: function (e) {
-    console.log('去朗读', e)
-    const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
-    wx.navigateTo({
-      url: `../../pages/reading/reading?id=${id}`
-    });
-  },
-  // 评论区点击
-  commentTap: function (e) {
-    console.log('点击评论区', e)
-    if (e.target.dataset.type === 'blank') {
-      if (this.data.commentShow && this.data.commentId) {
-        httpRequestApi.getClassDetail(this.data.commentId).success(res => {
-          console.log('评论回显', res.data.data.userRead.commentAmount)
-          let str = `videoList[${this.data.commentIndex}].commentAmount`;
-          this.setData({
-            [str]: res.data.data.userRead.commentAmount
-          })
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        collection_data: [],
+        line1: '您还没有收藏过哦',
+        line2: '快去收藏自己喜欢的吧',
+        videoList: [],
+        commentShow: false,
+        statusbarobj: {
+            isshowbtn: false, //是否显示按钮
+            title: "小学语文朗读配音", //标题
+        },
+    },
+
+    toClass: function(e) {
+        let targetCode = e.currentTarget.dataset.targetcode;
+        let title = e.currentTarget.dataset.title;
+        // wx.navigateTo({
+        //   url: `../../main/class/class?id=${targetCode}&title=${title}`
+        // });
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function(option) {
+        console.log(option.title);
+        if (option.title) {
+            wx.setNavigationBarTitle({
+                title: '我的收藏' //页面标题为路由参数
+            });
+            this.setData({
+                title: option.title
+            });
+        }
+        httpRequestApi.myFavorites().success(res => {
+            this.formatWorksList(res.data.data.list)
+        });
+    },
+    formatWorksList(list) {
+        list.forEach(item => {
+            const temp = {};
+            temp.title = item.userRead.title;
+            temp.summary = item.userRead.summary;
+            temp.img = item.userRead.iconImg;
+            temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
+            temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
+            temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
+            temp.shareAmount = item.userRead.shareAmount;
+            temp.favoritesAmount = item.userRead.favoritesAmount;
+            temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
+            temp.time = formatDate(item.userRead.gmtCreated, 3);
+            temp.avatar = item.user.avatar;
+            temp.profession = item.user.profession;
+            temp.uid = item.user.uid;
+            temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
+            temp.id = item.userRead.id;
+            temp.type = item.userRead.type;
+            temp.nickName = item.user.nickName;
+            temp.isLike = item.isLike;
+            temp.isFans = true;
+            temp.isFavorite = true;
+            temp.coverImg = item.userRead.coverImg;
+            temp.shareImg = item.userRead.shareImg;
+            temp.grade = item.userRead.grade;
+            temp.videoShow = false;
+            item.isActivity && (temp.activity = true);
+            this.data.videoList.push(temp);
+        });
+        this.setData({
+            videoList: this.data.videoList
+        }, () => {
+            console.log(this.data.videoList)
+        })
+
+    },
+    goToReading: function(e) {
+        console.log('去朗读', e)
+        const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
+        wx.navigateTo({
+            url: `../../pages/reading/reading?id=${id}`
+        });
+    },
+    // 评论区点击
+    commentTap: function(e) {
+        console.log('点击评论区', e)
+        if (e.target.dataset.type === 'blank') {
+            if (this.data.commentShow && this.data.commentId) {
+                httpRequestApi.getClassDetail(this.data.commentId).success(res => {
+                    console.log('评论回显', res.data.data.userRead.commentAmount)
+                    let str = `videoList[${this.data.commentIndex}].commentAmount`;
+                    this.setData({
+                        [str]: res.data.data.userRead.commentAmount
+                    })
+                })
+            }
+            this.setData({
+                commentShow: false
+            })
+        }
+    },
+    // 打开评论
+    openComment: function(e) {
+        // 
+        console.log('id', e.detail.activeId)
+        this.setData({
+            commentShow: !this.data.commentShow,
+            commentId: e.detail.activeId,
+            commentIndex: e.detail.activeIndex
+                // commentList: []
+        });
+        // this.getReply(e.detail.activeId);
+    },
+
+    // 发布回复
+    sendReply: function(e) {
+        console.log('triger', e.detail.content);
+        let data = {
+            columnId: this.data.commentId,
+            colunmNames: 'what',
+            detailDesc: e.detail.content,
+            // productId: this.data.productId
+        }
+        httpRequestApi.postReply(this.uid, data).success(res => {
+            console.log(res)
+            this.setData({
+                pageNo: 1,
+                commentList: []
+            }, () => {
+                this.getReply(this.data.commentId);
+            })
+        });
+    },
+    commentTouchMove: function(e) {
+        return;
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function() {
+
+    },
+
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function() {
+
+    },
+    collectTap: function(e) {
+        const index = e.detail.index;
+        let str = `videoList[${index}].isFavorite`;
+        let str2 = `videoList[${index}].favoritesAmount`;
+        let favoritesAmount = e.detail.isCollect ? this.data.videoList[index].favoritesAmount + 1 : this.data.videoList[index].favoritesAmount - 1
+        this.setData({
+            [str]: e.detail.isCollect,
+            [str2]: favoritesAmount
+        })
+    },
+    likeTap: function(e) {
+        console.log('点赞', e)
+        const index = e.detail.index;
+        let likeStr = `videoList[${index}].isLike`;
+        let likeNumStr = `videoList[${index}].likes`;
+        this.setData({
+            [likeStr]: true,
+            [likeNumStr]: this.data.videoList[index].likes + 1
+        })
+    },
+    openShare: function(e) {
+        console.log('用户点击分享按钮', e)
+        this.setData({
+            shareTitle: e.detail.currentTarget.dataset.title,
+            shareId: e.detail.currentTarget.dataset.id,
+            shareImg: e.detail.currentTarget.dataset.shareimg,
+            ifTapActivity: e.detail.currentTarget.dataset.activity
+        })
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function(res) {
+        console.log('用户点分享', res)
+        if (res.from === 'button') {
+            return {
+                title: '请欣赏我的课文朗读作品,点赞+评论。',
+                path: `/pages/index/index?readId=${this.data.shareId}&activity=${this.data.ifTapActivity}`,
+                imageUrl: this.data.shareImg
+
+            }
+        } else {
+            return {
+                title: '课文朗读,从未如此有趣。',
+                path: '/pages/index/index',
+            }
+        }
+    },
+    addShareAmount: function(e) {
+        console.log('+++++1', e)
+        let str = `videoList[${e.detail.index}].shareAmount`;
+        this.setData({
+            [str]: this.data.videoList[e.detail.index].shareAmount + 1
         })
-      }
-      this.setData({
-        commentShow: false
-      })
-    }
-  },
-  // 打开评论
-  openComment: function (e) {
-    // 
-    console.log('id', e.detail.activeId)
-    this.setData({
-      commentShow: !this.data.commentShow,
-      commentId: e.detail.activeId,
-      commentIndex: e.detail.activeIndex
-      // commentList: []
-    });
-    // this.getReply(e.detail.activeId);
-  },
-
-  // 发布回复
-  sendReply: function (e) {
-    console.log('triger', e.detail.content);
-    let data = {
-      columnId: this.data.commentId,
-      colunmNames: 'what',
-      detailDesc: e.detail.content,
-      // productId: this.data.productId
-    }
-    httpRequestApi.postReply(this.uid, data).success(res => {
-      console.log(res)
-      this.setData({
-        pageNo: 1,
-        commentList: []
-      }, () => {
-        this.getReply(this.data.commentId);
-      })
-    });
-  },
-  commentTouchMove: function (e) {
-    return;
-  },
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-  collectTap: function (e) {
-    const index = e.detail.index;
-    let str = `videoList[${index}].isFavorite`;
-    let str2 = `videoList[${index}].favoritesAmount`;
-    let favoritesAmount = e.detail.isCollect ? this.data.videoList[index].favoritesAmount + 1 : this.data.videoList[index].favoritesAmount - 1
-    this.setData({
-      [str]: e.detail.isCollect,
-      [str2]: favoritesAmount
-    })
-  },
-  likeTap: function (e) {
-    console.log('点赞', e)
-    const index = e.detail.index;
-    let likeStr = `videoList[${index}].isLike`;
-    let likeNumStr = `videoList[${index}].likes`;
-    this.setData({
-      [likeStr]: true,
-      [likeNumStr]: this.data.videoList[index].likes + 1
-    })
-  },
-  openShare: function (e) {
-    console.log('用户点击分享按钮', e)
-    this.setData({
-      shareTitle: e.detail.currentTarget.dataset.title,
-      shareId: e.detail.currentTarget.dataset.id,
-      shareImg: e.detail.currentTarget.dataset.shareimg,
-      ifTapActivity: e.detail.currentTarget.dataset.activity
-    })
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function (res) {
-    console.log('用户点分享', res)
-    if (res.from === 'button') {
-      return {
-        title: '请欣赏我的课文朗读作品,点赞+评论。',
-        path: `/pages/index/index?readId=${this.data.shareId}&activity=${this.data.ifTapActivity}`,
-        imageUrl: this.data.shareImg
-
-      }
-    } else {
-      return {
-        title: '课文朗读,从未如此有趣。',
-        path: '/pages/index/index',
-      }
     }
-  },
-  addShareAmount: function (e) {
-    console.log('+++++1', e)
-    let str = `videoList[${e.detail.index}].shareAmount`;
-    this.setData({
-      [str]: this.data.videoList[e.detail.index].shareAmount + 1
-    })
-  }
 })

+ 1 - 1
pages/myconcern/myconcern.wxml

@@ -8,7 +8,7 @@
         <view class="user-profession">{{item.user.profession}}</view>
       </view>
       <view class="avatar-name">
-        <text class="nickName">{{ item.user.wechatName }}</text>
+        <text class="nickName">{{ item.user.nickName }}</text>
         <text class="time">{{ format.formatDate(item.fans.gmtCreated) }}</text>
       </view>
       <view class="avatar-follow" wx:if='{{ item.isEachOther }}'>

+ 265 - 265
pages/myworks/myworks.js

@@ -1,292 +1,292 @@
 // pages/user/myworks/myworks.js
 import APIClient from '../../utils/APIClient.js'
 import {
-  formatDate
+    formatDate
 } from '../../utils/util.js'
 Page({
 
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    wareCards: {},
-    pageNo: 1,
-    totalNo: 0,
-    uid: '',
-    videoList: [],
-    isFans: false,
-    isMyself: false,
-    commentId: '',
-    pageSize: 3,
-    statusbarobj: {
-      isshowbtn: false, //是否显示按钮
-      title: "小学语文朗读配音", //标题
-    },
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        wareCards: {},
+        pageNo: 1,
+        totalNo: 0,
+        uid: '',
+        videoList: [],
+        isFans: false,
+        isMyself: false,
+        commentId: '',
+        pageSize: 3,
+        statusbarobj: {
+            isshowbtn: false, //是否显示按钮
+            title: "小学语文朗读配音", //标题
+        },
 
-  },
-  // 打开评论
-  openComment: function (e) {
-    console.log('id', e.detail.activeId)
-    this.setData({
-      commentShow: !this.data.commentShow,
-      commentId: e.detail.activeId,
-      commentIndex: e.detail.activeIndex
-    });
-  },
-  toMyWorks: function (e) {
-    let id = e.currentTarget.dataset.readid;
-    let title = e.currentTarget.dataset.title;
-    wx.navigateTo({
-      url: `../../social/works/works?id=${id}&title=${title}`
-    });
-  },
-  // 评论区点击
-  commentTap: function (e) {
-    console.log('点击评论区', e)
-    if (e.target.dataset.type === 'blank') {
-      if (this.data.commentShow && this.data.commentId) {
-        APIClient.getClassDetail(this.data.commentId).success(res => {
-          console.log('评论回显', res.data.data.userRead.commentAmount)
-          let str = `videoList[${this.data.commentIndex}].commentAmount`;
-          this.setData({
-            [str]: res.data.data.userRead.commentAmount
-          })
-        })
-      }
-      this.setData({
-        commentShow: false
-      })
-    }
-  },
-  touchMove: function (e) {
-    return
-  },
-  goToReading: function (e) {
-    console.log('去朗读', e)
-    const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
-    wx.navigateTo({
-      url: `../../pages/reading/reading?id=${id}`
-    });
-  },
-  // 关注用户
-  follow: function () {
-    let followUid = this.data.uid;
-    const uid = wx.getStorageSync('uid');
-    if (this.data.isFans) {
-      APIClient.cancerFollow(uid, followUid).success((res) => {
-        this.setData({
-          isFans: false
-        })
-        wx.showToast({
-          title: '取消关注',
-          icon: 'success',
-          duration: 1000
-        })
-      });
-    } else {
-      APIClient.followUser(uid, followUid).success((res) => {
+    },
+    // 打开评论
+    openComment: function(e) {
+        console.log('id', e.detail.activeId)
         this.setData({
-          isFans: true
-        })
-        wx.showToast({
-          title: '关注啦',
-          icon: 'success',
-          duration: 1000
-        })
-      });
-    }
-  },
-  getResults() {
-    let pageNo = this.data.pageNo;
-    let pageSize = 3;
-    let uid = this.data.uid;
-    console.log('用户身份', uid);
-    APIClient.getUserMsg(uid, pageNo, pageSize).success(res => {
-      console.log(res)
-      res.data.data.user.birthday = formatDate(res.data.data.user.birthday, 4)
-      this.setData({
-        wareCards: res.data.data,
-        isFans: res.data.data.like
-      });
-      console.log(this.data.wareCards)
-      // wx.hideToast();
-      this.getUserWorks(uid, pageNo, pageSize)
-    }).fail(err => {
-      console.log(err);
-    });
+            commentShow: !this.data.commentShow,
+            commentId: e.detail.activeId,
+            commentIndex: e.detail.activeIndex
+        });
+    },
+    toMyWorks: function(e) {
+        let id = e.currentTarget.dataset.readid;
+        let title = e.currentTarget.dataset.title;
+        wx.navigateTo({
+            url: `../../social/works/works?id=${id}&title=${title}`
+        });
+    },
+    // 评论区点击
+    commentTap: function(e) {
+        console.log('点击评论区', e)
+        if (e.target.dataset.type === 'blank') {
+            if (this.data.commentShow && this.data.commentId) {
+                APIClient.getClassDetail(this.data.commentId).success(res => {
+                    console.log('评论回显', res.data.data.userRead.commentAmount)
+                    let str = `videoList[${this.data.commentIndex}].commentAmount`;
+                    this.setData({
+                        [str]: res.data.data.userRead.commentAmount
+                    })
+                })
+            }
+            this.setData({
+                commentShow: false
+            })
+        }
+    },
+    touchMove: function(e) {
+        return
+    },
+    goToReading: function(e) {
+        console.log('去朗读', e)
+        const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
+        wx.navigateTo({
+            url: `../../pages/reading/reading?id=${id}`
+        });
+    },
+    // 关注用户
+    follow: function() {
+        let followUid = this.data.uid;
+        const uid = wx.getStorageSync('uid');
+        if (this.data.isFans) {
+            APIClient.cancerFollow(uid, followUid).success((res) => {
+                this.setData({
+                    isFans: false
+                })
+                wx.showToast({
+                    title: '取消关注',
+                    icon: 'success',
+                    duration: 1000
+                })
+            });
+        } else {
+            APIClient.followUser(uid, followUid).success((res) => {
+                this.setData({
+                    isFans: true
+                })
+                wx.showToast({
+                    title: '关注啦',
+                    icon: 'success',
+                    duration: 1000
+                })
+            });
+        }
+    },
+    getResults() {
+        let pageNo = this.data.pageNo;
+        let pageSize = 3;
+        let uid = this.data.uid;
+        console.log('用户身份', uid);
+        APIClient.getUserMsg(uid, pageNo, pageSize).success(res => {
+            console.log(res)
+            res.data.data.user.birthday = formatDate(res.data.data.user.birthday, 4)
+            this.setData({
+                wareCards: res.data.data,
+                isFans: res.data.data.like
+            });
+            console.log(this.data.wareCards)
+                // wx.hideToast();
+            this.getUserWorks(uid, pageNo, pageSize)
+        }).fail(err => {
+            console.log(err);
+        });
 
-  },
+    },
 
 
 
-  getUserWorks(uid, pageNo, pageSize) {
-    APIClient.userWorks(this.data.uid, this.data.pageNo, this.data.pageSize).success(res => {
-      console.log(res)
-      const recommendRes = res.data.data.list;
-      if (recommendRes.length === 0) return;
-      recommendRes.forEach(item => {
-        const temp = {};
-        temp.title = item.userRead.title;
-        temp.summary = item.userRead.summary;
-        temp.img = item.userRead.iconImg;
-        temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
-        temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
-        temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
-        temp.shareAmount = item.userRead.shareAmount;
-        temp.favoritesAmount = item.userRead.favoritesAmount;
-        temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
-        temp.time = formatDate(item.userRead.gmtCreated, 3);
-        temp.avatar = item.user.avatar;
-        temp.profession = item.user.profession;
-        temp.uid = item.user.uid;
-        temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
-        temp.id = item.userRead.id;
-        temp.type = item.userRead.type;
-        // temp.avatar = item.user.avatar;
-        temp.nickName = item.user.wechatName;
-        temp.isLike = item.isLike;
-        temp.isFavorite = item.isFavorites;
-        temp.isFans = true;
-        temp.videoShow = false;
-        temp.coverImg = item.userRead.coverImg;
-        temp.shareImg = item.userRead.shareImg;
-        item.isActivity && (temp.activity = true);
-        // recommendWorks.push(temp);
-        this.data.videoList.push(temp);
+    getUserWorks(uid, pageNo, pageSize) {
+        APIClient.userWorks(this.data.uid, this.data.pageNo, this.data.pageSize).success(res => {
+            console.log(res)
+            const recommendRes = res.data.data.list;
+            if (recommendRes.length === 0) return;
+            recommendRes.forEach(item => {
+                const temp = {};
+                temp.title = item.userRead.title;
+                temp.summary = item.userRead.summary;
+                temp.img = item.userRead.iconImg;
+                temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
+                temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
+                temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
+                temp.shareAmount = item.userRead.shareAmount;
+                temp.favoritesAmount = item.userRead.favoritesAmount;
+                temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
+                temp.time = formatDate(item.userRead.gmtCreated, 3);
+                temp.avatar = item.user.avatar;
+                temp.profession = item.user.profession;
+                temp.uid = item.user.uid;
+                temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
+                temp.id = item.userRead.id;
+                temp.type = item.userRead.type;
+                // temp.avatar = item.user.avatar;
+                temp.nickName = item.user.nickName;
+                temp.isLike = item.isLike;
+                temp.isFavorite = item.isFavorites;
+                temp.isFans = true;
+                temp.videoShow = false;
+                temp.coverImg = item.userRead.coverImg;
+                temp.shareImg = item.userRead.shareImg;
+                item.isActivity && (temp.activity = true);
+                // recommendWorks.push(temp);
+                this.data.videoList.push(temp);
 
-      });
-      this.setData({
-        videoList: this.data.videoList,
-        totalNo: res.data.data.totalNo
-      })
-      console.log('dangqian', this.data.videoList)
-    })
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    // if (options.uid === wx.getStorageSync('uid') || options.uid === 'c7f0a8fdd3a549ea9109a7b7486775f2') {
-    if (options.uid === wx.getStorageSync('uid')) {
-      this.setData({
-        isMyself: true
-      })
-    }
-    this.setData({
-      uid: options.uid
-    }, () => {
-      console.log(options.uid);
-    });
-    // wx.showToast({
-    //   title: '加载中...',
-    //   icon: 'loading'
-    // });
-    this.getResults();
-  },
+            });
+            this.setData({
+                videoList: this.data.videoList,
+                totalNo: res.data.data.totalNo
+            })
+            console.log('dangqian', this.data.videoList)
+        })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function(options) {
+        // if (options.uid === wx.getStorageSync('uid') || options.uid === 'c7f0a8fdd3a549ea9109a7b7486775f2') {
+        if (options.uid === wx.getStorageSync('uid')) {
+            this.setData({
+                isMyself: true
+            })
+        }
+        this.setData({
+            uid: options.uid
+        }, () => {
+            console.log(options.uid);
+        });
+        // wx.showToast({
+        //   title: '加载中...',
+        //   icon: 'loading'
+        // });
+        this.getResults();
+    },
 
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function() {
 
-  },
+    },
 
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function() {
 
-  },
+    },
 
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-    this.setData({
-      pageNo: this.data.pageNo + 1
-    }, () => {
-      if (this.data.pageNo <= this.data.totalNo) {
-        this.getUserWorks();
-      }
-    })
-  },
-  collectTap: function (e) {
-    const index = e.detail.index;
-    let str = `videoList[${index}].isFavorite`;
-    let str2 = `videoList[${index}].favoritesAmount`;
-    let favoritesAmount = e.detail.isCollect ? this.data.videoList[index].favoritesAmount + 1 : this.data.videoList[index].favoritesAmount - 1
-    this.setData({
-      [str]: e.detail.isCollect,
-      [str2]: favoritesAmount
-    })
-  },
-  likeTap: function (e) {
-    console.log('点赞', e)
-    const index = e.detail.index;
-    let likeStr = `videoList[${index}].isLike`;
-    let likeNumStr = `videoList[${index}].likes`;
-    this.setData({
-      [likeStr]: true,
-      [likeNumStr]: this.data.videoList[index].likes + 1
-    })
-  },
-  openShare: function (e) {
-    console.log('用户点击分享按钮', e)
-    this.setData({
-      shareTitle: e.detail.currentTarget.dataset.title,
-      shareId: e.detail.currentTarget.dataset.id,
-      shareImg: e.detail.currentTarget.dataset.shareimg,
-      ifTapActivity: e.detail.currentTarget.dataset.activity
-    })
-  },
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function (res) {
-    console.log('点击分享按钮', res)
-    console.log('点击分享按钮', this.data.shareTitle)
-    console.log('点击分享按钮', this.data.shareId)
-    console.log('点击分享按钮', this.data.shareImg)
-    if (res.from === 'button') {
-      return {
-        title: '请欣赏我的课文朗读作品,点赞+评论。',
-        path: `/pages/index/index?readId=${this.data.shareId}&activity=${this.data.ifTapActivity}`,
-        imageUrl: this.data.shareImg
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function() {
+        this.setData({
+            pageNo: this.data.pageNo + 1
+        }, () => {
+            if (this.data.pageNo <= this.data.totalNo) {
+                this.getUserWorks();
+            }
+        })
+    },
+    collectTap: function(e) {
+        const index = e.detail.index;
+        let str = `videoList[${index}].isFavorite`;
+        let str2 = `videoList[${index}].favoritesAmount`;
+        let favoritesAmount = e.detail.isCollect ? this.data.videoList[index].favoritesAmount + 1 : this.data.videoList[index].favoritesAmount - 1
+        this.setData({
+            [str]: e.detail.isCollect,
+            [str2]: favoritesAmount
+        })
+    },
+    likeTap: function(e) {
+        console.log('点赞', e)
+        const index = e.detail.index;
+        let likeStr = `videoList[${index}].isLike`;
+        let likeNumStr = `videoList[${index}].likes`;
+        this.setData({
+            [likeStr]: true,
+            [likeNumStr]: this.data.videoList[index].likes + 1
+        })
+    },
+    openShare: function(e) {
+        console.log('用户点击分享按钮', e)
+        this.setData({
+            shareTitle: e.detail.currentTarget.dataset.title,
+            shareId: e.detail.currentTarget.dataset.id,
+            shareImg: e.detail.currentTarget.dataset.shareimg,
+            ifTapActivity: e.detail.currentTarget.dataset.activity
+        })
+    },
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function(res) {
+        console.log('点击分享按钮', res)
+        console.log('点击分享按钮', this.data.shareTitle)
+        console.log('点击分享按钮', this.data.shareId)
+        console.log('点击分享按钮', this.data.shareImg)
+        if (res.from === 'button') {
+            return {
+                title: '请欣赏我的课文朗读作品,点赞+评论。',
+                path: `/pages/index/index?readId=${this.data.shareId}&activity=${this.data.ifTapActivity}`,
+                imageUrl: this.data.shareImg
 
-      }
-    } else {
-      return {
-        title: '课文朗读,从未如此有趣。',
-        path: '/pages/index/index',
-      }
+            }
+        } else {
+            return {
+                title: '课文朗读,从未如此有趣。',
+                path: '/pages/index/index',
+            }
+        }
+    },
+    addShareAmount: function(e) {
+        console.log('+++++1', e)
+        let str = `videoList[${e.detail.index}].shareAmount`;
+        this.setData({
+            [str]: this.data.videoList[e.detail.index].shareAmount + 1
+        })
     }
-  },
-  addShareAmount: function (e) {
-    console.log('+++++1', e)
-    let str = `videoList[${e.detail.index}].shareAmount`;
-    this.setData({
-      [str]: this.data.videoList[e.detail.index].shareAmount + 1
-    })
-  }
 })

+ 1 - 1
pages/myworks/myworks.wxml

@@ -6,7 +6,7 @@
     <view class='follow-info'>
       <view class='set-msg'>
         <image class='avatar-image' src='{{ wareCards.user.avatar }}'></image>
-        <text class="avatar-nickname">{{ wareCards.user.wechatName }}</text>
+        <text class="avatar-nickname">{{ wareCards.user.nickName }}</text>
       </view>
       <view class="follow" wx:if="{{!isMyself}}" bindtap="follow">
         <!-- <image src="{{isFans? '../../static/index/followed.png' : '../../static/index/follow.png'}}" /> -->

+ 143 - 142
pages/reading/reading.js

@@ -52,36 +52,36 @@ Page({
         isIOS: app.globalData.isIOS,
         payPrice: ''
     },
-    onLoad: function (option) {
+    onLoad: function(option) {
         console.log(option);
         this.videoCtx = null;
         const uid = wx.getStorageSync('uid')
         this.getClassInfo(option.id);
         // this.getMicAuth()
     },
-    getClassInfo: function (id) {
+    getClassInfo: function(id) {
         httpRequestApi.getClassDetail(id).success(res => {
             console.log('课程信息', res)
             let reg = /\\n/g
             this.setData({
-                title: res.data.data.userRead.title,
-                videoUrl: res.data.data.userRead.videoPath,
-                videoPathTemp: res.data.data.userRead.videoPath,
-                originVideo: res.data.data.userRead.originVideo,
-                img: res.data.data.userRead.iconImg,
-                id: res.data.data.userRead.id,
-                readingText: res.data.data.userRead.lessonText,
-                grade: res.data.data.userRead.grade,
-                exampleId: res.data.data.userRead.exampleId,
-                summary: res.data.data.userRead.summary,
-                coverImg: res.data.data.userRead.coverImg,
-                shareImg: res.data.data.userRead.shareImg,
-                isActivityRead: res.data.data.isActivityRead,
-            })
-            // 参赛作品,增加数据
-            if(res.data.data.isActivityRead){
-                httpRequestApi.postActEvent('LESSON').success(res=>{
-                    console.log('示范朗读页',res)
+                    title: res.data.data.userRead.title,
+                    videoUrl: res.data.data.userRead.videoPath,
+                    videoPathTemp: res.data.data.userRead.videoPath,
+                    originVideo: res.data.data.userRead.originVideo,
+                    img: res.data.data.userRead.iconImg,
+                    id: res.data.data.userRead.id,
+                    readingText: res.data.data.userRead.lessonText,
+                    grade: res.data.data.userRead.grade,
+                    exampleId: res.data.data.userRead.exampleId,
+                    summary: res.data.data.userRead.summary,
+                    coverImg: res.data.data.userRead.coverImg,
+                    shareImg: res.data.data.userRead.shareImg,
+                    isActivityRead: res.data.data.isActivityRead,
+                })
+                // 参赛作品,增加数据
+            if (res.data.data.isActivityRead) {
+                httpRequestApi.postActEvent('LESSON').success(res => {
+                    console.log('示范朗读页', res)
                 })
             }
             this.getReadInfo(id)
@@ -90,7 +90,7 @@ Page({
             })
         })
     },
-    onHide: function () {
+    onHide: function() {
         console.log('onhide')
         if (this.data.btnImgFlag) {
             this.recorderManager.stop();
@@ -104,7 +104,7 @@ Page({
         })
 
     },
-    onUnload: function () {
+    onUnload: function() {
         console.log('onUnload')
         if (this.data.btnImgFlag) {
             this.recorderManager.stop();
@@ -113,23 +113,23 @@ Page({
             this.innerAudioContext.stop();
         }
     },
-    onShow: function () {
+    onShow: function() {
         this.videoCtx = wx.createVideoContext('myVideo', this);
         let data = requirePlugin("myPlugin");
         const obj = {
-            appid: 'a415',
-            userid: wx.getStorageSync('uid'),
-            getEvalMessage: (res) => {
-                this.getRecordScore(res)
-                // console.log('评测结果',res)
-            },
-            recorderCallback: (type, data) => {
-                // 录音测评监控回调
-                this.ssRecorderCallback(type, data)
-            }
+                appid: 'a415',
+                userid: wx.getStorageSync('uid'),
+                getEvalMessage: (res) => {
+                    this.getRecordScore(res)
+                        // console.log('评测结果',res)
+                },
+                recorderCallback: (type, data) => {
+                    // 录音测评监控回调
+                    this.ssRecorderCallback(type, data)
+                }
 
-        }
-        // this.ss = new data.ssEngine(obj);
+            }
+            // this.ss = new data.ssEngine(obj);
         this.recorderManager = wx.getRecorderManager();
         this.recorderManager.onStop((res) => {
             // wx.showToast({
@@ -151,10 +151,10 @@ Page({
                 success: () => {
                     console.log('====== wsEngine stop success ======');
                     wx.showLoading({
-                        title: '作品评测中',
-                        mask: true
-                    })
-                    // TODO: add your code here
+                            title: '作品评测中',
+                            mask: true
+                        })
+                        // TODO: add your code here
                 },
                 fail: (res) => {
                     console.log("====== wsEngine stop fail ======");
@@ -182,7 +182,7 @@ Page({
                 frameBuffer
             } = res
             console.log('frameBuffer.byteLength', frameBuffer.byteLength)
-            //TODO 调用feed接口传递音频片给驰声评测引擎
+                //TODO 调用feed接口传递音频片给驰声评测引擎
             this.wsEngine.feed({
                 data: frameBuffer, // frameBuffer为微信录音机回调的音频数据
                 success: () => {
@@ -200,10 +200,10 @@ Page({
         });
 
     },
-    ssRecorderCallback: function (type, data) {
+    ssRecorderCallback: function(type, data) {
         console.log('录音测评监控回调', type)
         console.log('录音测评监控回调', data)
-        /* 录音开始 */
+            /* 录音开始 */
         if (type === 'onStart') {
             this.setData({
                 btnImgFlag: true,
@@ -223,7 +223,7 @@ Page({
         }
     },
     // 录音中视频播放结束 (控制录音同时结束)
-    recordingVideoEnd: function () {
+    recordingVideoEnd: function() {
         console.log(this.data.videoCtr)
         console.log('recordingVideoEnd');
         //
@@ -239,7 +239,7 @@ Page({
         }
     },
     // 播放中视频播放结束 (控制录音同时结束)
-    playingVideoEnd: function () {
+    playingVideoEnd: function() {
         console.log('playingVideoEnd')
 
         // this.ss.stopPlay();
@@ -250,15 +250,15 @@ Page({
      *      1 录音中
      *      2 录音结束
      ***/
-    audioRecord: function () {
+    audioRecord: function() {
 
         console.log('111111111111111recordFlag', this.data.recordFlag)
-        // 判断是否有权限朗读 不是vip 并且 不是活动作品
+            // 判断是否有权限朗读 不是vip 并且 不是活动作品
         const isVip = wx.getStorageSync('vip');
-        console.log('判断',!isVip && !this.data.isActivityRead)
+        console.log('判断', !isVip && !this.data.isActivityRead)
         if (!isVip && !this.data.isActivityRead) {
             const imgName = this.data.isIOS ? 'ios_read' : 'android_read';
-            if(!this.data.isIOS) {
+            if (!this.data.isIOS) {
                 this.setData({
                     payPrice: wx.getStorageSync('price')
                 })
@@ -285,10 +285,10 @@ Page({
                     console.log('驰声createWsEngine失败', res);
                 })
                 this.videoComplete();
-                if(this.data.btnFlag){
+                if (this.data.btnFlag) {
                     httpRequestApi.userEvent('RERECORDING');
 
-                }else{
+                } else {
                     httpRequestApi.userEvent('READING');
 
                 }
@@ -315,7 +315,7 @@ Page({
             format: 'mp3', 格式
             frameSize: 50 制定帧大小
      */
-    recordStart: function () {
+    recordStart: function() {
         console.log('录音开始');
         const options = {
             duration: 600000,
@@ -336,7 +336,7 @@ Page({
         let timeStamp = new Date().getTime()
         let sig = sha1(`16075689600000da${timeStamp}caa8e60da6042731c230fe431ac9c7fd`)
         console.log('加密串', sig)
-        // return
+            // return
         let app = {
             applicationId: '16075689600000da',
             sig, //签名字符串 通过签名算法alg(appkey + timestamp + secretKey)生成
@@ -409,10 +409,10 @@ Page({
                         wx.openSetting({
                             success(res) {
                                 console.log('跳转到设置页', res.authSetting)
-                                // res.authSetting = {
-                                //   "scope.userInfo": true,
-                                //   "scope.userLocation": true
-                                // }
+                                    // res.authSetting = {
+                                    //   "scope.userInfo": true,
+                                    //   "scope.userLocation": true
+                                    // }
                             }
                         })
                     }
@@ -421,11 +421,11 @@ Page({
         })
     },
     // 录音结束
-    recordStop: function () {
+    recordStop: function() {
         this.setData({
-            muted: false
-        })
-        // this.ss.stopRecord();
+                muted: false
+            })
+            // this.ss.stopRecord();
         console.log('录音结束')
         this.recorderManager.stop();
         wx.hideLoading()
@@ -488,7 +488,7 @@ Page({
         })
     },
     // 播放录音
-    audioPlay: function () {
+    audioPlay: function() {
         /* 用了先声智能以后录音播放由先声只能接管 */
         if (this.innerAudioContext) {
             this.innerAudioContext.stop();
@@ -541,7 +541,7 @@ Page({
         } */
     },
 
-    exampleVideoPlay: function () {
+    exampleVideoPlay: function() {
         if (this.data.videoPathTemp == this.data.videoUrl) {
             // 播放记录增加一条
             httpRequestApi.playLogReport({
@@ -553,7 +553,7 @@ Page({
         }
         httpRequestApi.userEvent('EXAMPLE');
     },
-    videoComplete: function () {
+    videoComplete: function() {
         this.setData({
             recordFlag: 1,
             videoUrl: this.data.originVideo,
@@ -566,14 +566,14 @@ Page({
 
         }, () => {
             console.log('播放视频播放视频播放视频')
-            // this.videoCtx.seek(1);
+                // this.videoCtx.seek(1);
             this.videoCtx.stop();
             this.videoCtx.play();
             this.recordStart();
         })
     },
     // 上传
-    upload: function () {
+    upload: function() {
         if (this.videoCtx) {
             this.videoCtx.stop();
         }
@@ -604,7 +604,7 @@ Page({
             }
         })
     },
-    shareWorks: function (audio) {
+    shareWorks: function(audio) {
         const data = {
             "lessonId": this.data.id,
             "originVideo": this.data.videoUrl,
@@ -635,14 +635,14 @@ Page({
                             }
                             const _data = this.data;
                             const scoreData = {
-                                "userReadId": res.data.data.id,
-                                "complete": _data.integrity,
-                                "accuracy": _data.accuracy,
-                                "speed": _data.fluency,
-                                "intonation": _data.tone,
-                                "score": _data.overall
-                            }
-                            // 上传评分
+                                    "userReadId": res.data.data.id,
+                                    "complete": _data.integrity,
+                                    "accuracy": _data.accuracy,
+                                    "speed": _data.fluency,
+                                    "intonation": _data.tone,
+                                    "score": _data.overall
+                                }
+                                // 上传评分
                             httpRequestApi.postWorksScore(scoreData).success(res => {
                                 console.log(res)
                             });
@@ -677,7 +677,7 @@ Page({
     },
 
     // 获取本课朗读内容
-    getReadInfo: function (id, pageNo, pageSize) {
+    getReadInfo: function(id, pageNo, pageSize) {
         // const uid =  wx.getStorageSync('uid');
         const data = {
             exampleId: this.data.id || id,
@@ -705,7 +705,7 @@ Page({
                 temp.url = item.userRead.videoPath;
                 temp.isLike = item.isLike;
                 // temp.avatar = item.user.avatar;
-                temp.nickName = item.user ? item.user.wechatName : '';
+                temp.nickName = item.user ? item.user.nickName : '';
                 temp.id = item.userRead.id;
                 temp.noReading = true;
                 temp.isFans = item.isFans ? true : item.user.uid === this.uid ? true : false;
@@ -729,7 +729,7 @@ Page({
         });
     },
     // 评论区点击
-    commentTap: function (e) {
+    commentTap: function(e) {
         console.log('点击评论区', e)
         if (e.target.dataset.type === 'blank') {
             if (this.data.commentShow && this.data.commentId) {
@@ -746,7 +746,7 @@ Page({
             })
         }
     },
-    scrollToLower: function (e) {
+    scrollToLower: function(e) {
         console.log('滑动到底部', e)
         this.setData({
             pageNo: this.data.pageNo + 1
@@ -754,7 +754,7 @@ Page({
             this.getReadInfo()
         })
     },
-    onReachBottom: function (e) {
+    onReachBottom: function(e) {
         console.log('滑动到底部', e)
         this.setData({
             pageNo: this.data.pageNo + 1
@@ -762,12 +762,12 @@ Page({
             this.getReadInfo()
         })
     },
-    scrollToUpper: function (e) {
+    scrollToUpper: function(e) {
         console.log('滑动到顶部', e)
 
     },
     // 打开评论
-    openComment: function (e) {
+    openComment: function(e) {
         console.log('id', e.detail.activeId)
         this.setData({
             commentShow: !this.data.commentShow,
@@ -775,7 +775,7 @@ Page({
             commentIndex: e.detail.activeIndex
         });
     },
-    goToReading: function (e) {
+    goToReading: function(e) {
         this.setData({
             pageNo: 1,
             videoList: []
@@ -783,7 +783,7 @@ Page({
         const id = e.detail.activeId ? e.detail.activeId : e.currentTarget.dataset.id;
         this.getClassInfo(id)
     },
-    onShareAppMessage: function (res) {
+    onShareAppMessage: function(res) {
         console.log('点击分享按钮', res)
         console.log('onShareAppMessage', this.data.shareTitle)
         console.log('onShareAppMessage', this.data.shareId)
@@ -803,10 +803,10 @@ Page({
         }
 
     },
-    touchMove: function () {
+    touchMove: function() {
         return
     },
-    openShare: function (e) {
+    openShare: function(e) {
         console.log('用户点击分享按钮回调', e)
         this.setData({
             shareTitle: e.detail.currentTarget.dataset.title,
@@ -815,7 +815,7 @@ Page({
             ifTapActivity: e.detail.currentTarget.dataset.activity
         })
     },
-    onPlay: function (e) {
+    onPlay: function(e) {
         // 下边视频列表onplay
         console.log('视频播放视频播放')
         if (this.videoCtx) {
@@ -825,7 +825,7 @@ Page({
             this.videoCtx.stop();
         }
     },
-    collectTap: function (e) {
+    collectTap: function(e) {
         const index = e.detail.index;
         let str = `videoList[${index}].isFavorite`;
         let str2 = `videoList[${index}].favoritesAmount`;
@@ -835,7 +835,7 @@ Page({
             [str2]: favoritesAmount
         })
     },
-    likeTap: function (e) {
+    likeTap: function(e) {
         console.log('点赞', e)
         const index = e.detail.index;
         let likeStr = `videoList[${index}].isLike`;
@@ -845,7 +845,7 @@ Page({
             [likeNumStr]: this.data.videoList[index].likes + 1
         })
     },
-    flowerAnimationHandler: function () {
+    flowerAnimationHandler: function() {
         this.flowerBox = this.selectComponent("#flower-toast");
         console.log('this.flower', this.flowerBox)
         this.flowerBox.comeOut();
@@ -864,7 +864,7 @@ Page({
         })
         this.triggerEvent('inputBlur');
     },
-    addShareAmount: function (e) {
+    addShareAmount: function(e) {
         console.log('+++++1', e)
         let str = `videoList[${e.detail.index}].shareAmount`;
         this.setData({
@@ -873,67 +873,68 @@ Page({
     },
     // 去鉴权
     goToAuth() {
-      if (!wx.getStorageSync('message')) {
-        wx.requestSubscribeMessage({
-            tmplIds: ['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY',
-                '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'],
-            success: (res) => { 
-                console.log(res)
-                if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'reject') {
-                    console.log('用户不同意订阅')
-                    wx.setStorageSync('message', false)
-                } else if(res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
-                    console.log('订阅成功')
-                    wx.setStorageSync('message', true)
+        if (!wx.getStorageSync('message')) {
+            wx.requestSubscribeMessage({
+                tmplIds: ['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY',
+                    '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'
+                ],
+                success: (res) => {
+                    console.log(res)
+                    if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'reject') {
+                        console.log('用户不同意订阅')
+                        wx.setStorageSync('message', false)
+                    } else if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
+                        console.log('订阅成功')
+                        wx.setStorageSync('message', true)
+                    }
+                    this.userAuth()
+                },
+                fail: () => {
+                    this.userAuth()
                 }
-                this.userAuth()
-            },
-            fail: () => {
-                this.userAuth()
-            }
-          })
-      } else {
-        this.userAuth()
-      }
+            })
+        } else {
+            this.userAuth()
+        }
 
     },
     userAuth() {
-        if(this.data.isIOS) {
+        if (this.data.isIOS) {
             wx.navigateTo({
                 url: `../vipActivity/vipActivity`
-              });
+            });
         } else {
             const productId = wx.getStorageSync('productId');
             httpRequestApi.createOrder(productId).success(res => {
-              console.log(res.data.data.package);
-              const timeStamp = res.data.data.timeStamp;
-              const nonceStr = res.data.data.nonceStr;
-              const packages = res.data.data.package;
-              const paySign = res.data.data.sign;
-              wx.requestPayment({
-                timeStamp,
-                nonceStr,
-                package: packages,
-                signType: 'MD5',
-                paySign,
-                success: (res) => {
-                    this.setData({
-                        authHide: !this.data.authHide
-                    })
-                    httpRequestApi.getAuthActivity().success(res => {
-                    if (!res.data.data) {
-                        wx.setStorageSync('vip', false)
-                        wx.setStorageSync('date', '')
-                    } else {
-                        wx.setStorageSync('vip', true)
-                        wx.setStorageSync('date', res.data.data)
-                    }
-                    }).fail(error => {
-                        console.log(error)
-                    })
-                },
-                fail (res) { }
-              })
+                console.log(res.data.data.package);
+                const timeStamp = res.data.data.timeStamp;
+                const nonceStr = res.data.data.nonceStr;
+                const packages = res.data.data.package;
+                const paySign = res.data.data.sign;
+                wx.requestPayment({
+                    timeStamp,
+                    nonceStr,
+                    package: packages,
+                    signType: 'MD5',
+                    paySign,
+                    success: (res) => {
+                        this.setData({
+                            authHide: !this.data.authHide
+                        })
+                        httpRequestApi.getAuthActivity().success(res => {
+                            if (!res.data.data) {
+                                wx.setStorageSync('vip', false)
+                                wx.setStorageSync('date', '')
+                            } else {
+                                wx.setStorageSync('vip', true)
+                                wx.setStorageSync('date', res.data.data)
+                            }
+                        }).fail(error => {
+                            console.log(error)
+                        })
+                    },
+                    fail(res) {}
+                })
             })
         }
         this.hideAuth();

+ 11 - 11
pages/social/replyDetail/replyDetail.js

@@ -12,12 +12,12 @@ Page({
         count: '',
         flowerNum: 0,
     },
-    onLoad: function (option) {
+    onLoad: function(option) {
         console.log(option)
         this.setData({
             postId: option.id,
             productId: option.productId
-            // count: option.count === 'undefined' ? 0 : option.count
+                // count: option.count === 'undefined' ? 0 : option.count
         })
         wx.setNavigationBarTitle({
             // title: option.count + '条回复' //页面标题为路由参数
@@ -27,12 +27,12 @@ Page({
         this.getReplyDetail();
     },
     // 保存 回复的内容
-    saveValue: function (e) {
+    saveValue: function(e) {
         this.setData({
             replyInfo: e.detail.value
         });
     },
-    replyDone: function () {
+    replyDone: function() {
         console.log(this.data.productId)
         const data = {
             postsId: this.data.postId,
@@ -57,7 +57,7 @@ Page({
         }
     },
     // 查询回复详情
-    getReplyDetail: function () {
+    getReplyDetail: function() {
         // let uid = wx.getStorageSync('uid');
         httpRequestApi.getReplyComment(this.uid, this.data.postId).success((res) => {
             console.log(res);
@@ -65,7 +65,7 @@ Page({
             const replied = res.data.data;
             const replyTemp = [];
             const authorDetail = {};
-            authorDetail.name = replied.user.wechatName;
+            authorDetail.name = replied.user.nickName;
             authorDetail.text = decodeURI(replied.detailDesc);
             authorDetail.time = formatDate(replied.gmtCreated, 3);
             authorDetail.likes = replied.postsAttributeInfo.favors;
@@ -73,7 +73,7 @@ Page({
             replyTemp.push(authorDetail);
             replyList.forEach(item => {
                 const temp = {};
-                temp.name = item.user.wechatName;
+                temp.name = item.user.nickName;
                 temp.text = decodeURI(item.content);
                 temp.time = formatDate(item.gmtCreated, 3);
                 temp.likes = 0;
@@ -92,7 +92,7 @@ Page({
         });
     },
     // 点赞评论
-    likeCommend: function (e) {
+    likeCommend: function(e) {
         console.log(e);
         // let uid = wx.getStorageSync('uid');
         let followUid = e.currentTarget.dataset.id;
@@ -106,7 +106,7 @@ Page({
         });
     },
     // 设置点击时的id
-    setSBId: function (e) {
+    setSBId: function(e) {
         console.log(e)
         this.setData({
             // replySBId: e.currentTarget.dataset.id,
@@ -114,7 +114,7 @@ Page({
         })
     },
     // 回复某个评论
-    replySB: function () {
+    replySB: function() {
         const data = {
             postsId: this.data.postId,
             content: this.data.inputSBValue
@@ -127,7 +127,7 @@ Page({
         });
     },
     // 获取回复楼中楼的内容
-    inputSBValue: function (e) {
+    inputSBValue: function(e) {
         this.setData({
             inputSBValue: e.detail.value
         });

+ 106 - 106
pages/social/works/works.js

@@ -61,14 +61,14 @@ Page({
         addComeOut: '',
         flowerNum: '6',
         readIsRisky: ''
-        // shareFlag: false
+            // shareFlag: false
     },
-    showAlert: function () {
+    showAlert: function() {
         this.setData({
             alertFlag: !this.data.alertFlag
         })
     },
-    onLoad: function (option) {
+    onLoad: function(option) {
         console.log(option)
         console.log(option.flowerCount)
         console.log(option.flowerCount === 0)
@@ -116,14 +116,14 @@ Page({
 
         }, (error) => {
             wx.setStorageSync('userSourseType', 'reading')
-            // this.setData({
-            //     hide: !this.data.hide,
-            //     onLoadOption: option
-            // })
+                // this.setData({
+                //     hide: !this.data.hide,
+                //     onLoadOption: option
+                // })
             return;
         });
     },
-    onHide: function () {
+    onHide: function() {
         // this.data.stackSize >= 2
         console.log('=================================hide')
         if (this.innerAudioContext) {
@@ -133,7 +133,7 @@ Page({
         }
         // this.videoCtx = null
     },
-    onUnload: function () {
+    onUnload: function() {
         console.log('-------------------页面雨鞋')
         if (this.videoPlayTime) {
             const data = {
@@ -158,10 +158,10 @@ Page({
             this.innerAudioContext.destroy();
         }
         this.videoCtx = null
-        // let videoCtx = wx.createVideoContext('worksVideo', this);
-        // videoCtx.stop();
+            // let videoCtx = wx.createVideoContext('worksVideo', this);
+            // videoCtx.stop();
     },
-    getWorks: function (uid, id) {
+    getWorks: function(uid, id) {
         httpRequestApi.getWorksDetail(uid, id, this.data.goBackHome ? 'READ_SHARE' : '').success((res) => {
 
             const others = res.data.data.otherRead;
@@ -180,13 +180,13 @@ Page({
                 temp.uid = item.userRead.id;
                 temp.title = item.userRead.title;
                 temp.image = item.user.avatar;
-                temp.nickName = item.user.wechatName;
+                temp.nickName = item.user.nickName;
                 othersTemp.push(temp);
             });
             this.setData({
                 user: othersTemp,
                 totalRead: res.data.data.totalRead,
-                author: author.wechatName,
+                author: author.nickName,
                 authorAvatar: author.avatar,
                 authorProfession: author.profession,
                 authorUid: author.uid,
@@ -228,7 +228,7 @@ Page({
         });
     },
     onShow() {
-        this.timeOut = setInterval(()=>{
+        this.timeOut = setInterval(() => {
             if (this.data.id) {
                 clearInterval(this.timeOut)
                 this.setData({
@@ -239,10 +239,10 @@ Page({
                     this.getReply();
                 })
             }
-        },200)
-        
+        }, 200)
+
     },
-    videoPlayHandler: function () {
+    videoPlayHandler: function() {
         if (this.data.readIsRisky === 'DEL') {
             wx.showModal({
                 title: '提示',
@@ -262,11 +262,11 @@ Page({
             this.videoCtx.play();
         })
     },
-    likeWorks: function (e) {
+    likeWorks: function(e) {
         // + 1 + 1的动画
         this.setData({
             addComeOut: 'add-one-come-out'
-            // isLike: true
+                // isLike: true
         })
         setTimeout(() => {
             if (this.data.addComeOut) {
@@ -298,7 +298,7 @@ Page({
 
     },
     // 弹出分享框
-    openShare: function (e) {
+    openShare: function(e) {
         console.log(this.data.authorAvatar)
         console.log(this.data.author)
         console.log(this.data.iconImg)
@@ -307,16 +307,16 @@ Page({
         if (this.data.authorAvatar && this.data.author && this.data.iconImg && this.data.title && this.data.id) {
             this.shareDialog = this.selectComponent("#share-dialog");
             const data = {
-                avatar: this.data.authorAvatar,
-                author: this.data.author,
-                iconImg: this.data.iconImg,
-                title: this.data.title,
-                path: `pages/social/works/works`,
-                scene: this.data.id,
-                productId: this.data.productId
-                // tip: this.data.tip,
-            }
-            // console.log(data)
+                    avatar: this.data.authorAvatar,
+                    author: this.data.author,
+                    iconImg: this.data.iconImg,
+                    title: this.data.title,
+                    path: `pages/social/works/works`,
+                    scene: this.data.id,
+                    productId: this.data.productId
+                        // tip: this.data.tip,
+                }
+                // console.log(data)
             this.setData({
                 noScroll: 'noScroll'
             })
@@ -324,12 +324,12 @@ Page({
         }
     },
     // 分享框关闭
-    shareDialogClose: function (e) {
+    shareDialogClose: function(e) {
         this.setData({
             noScroll: ''
         })
     },
-    videoPlay: function (event) {
+    videoPlay: function(event) {
         console.log(11111, this.videoPlayTime)
         if (this.data.readIsRisky === 'DEL') {
             wx.showModal({
@@ -350,15 +350,15 @@ Page({
             }
         }
         console.log('============', this.data.goBackHome)
-        // 视频开始 先结束 再开始
-        // this.innerAudioContext.play();
-        // this.innerAudioContext.pause();
-        // wx.showToast({
-        //     title: '加载中',
-        //     icon: 'loading',
-        //     duration: 600
-        // })
-        // setTimeout(() => {
+            // 视频开始 先结束 再开始
+            // this.innerAudioContext.play();
+            // this.innerAudioContext.pause();
+            // wx.showToast({
+            //     title: '加载中',
+            //     icon: 'loading',
+            //     duration: 600
+            // })
+            // setTimeout(() => {
         this.innerAudioContext.play();
         // }, 800)
         // httpRequestApi.playWorks(this.uid, this.data.id).success(() => {
@@ -366,35 +366,35 @@ Page({
         // });
     },
     // 视频播放完毕销毁录音
-    videoEnd: function (e) {
+    videoEnd: function(e) {
         console.log(e)
 
         this.innerAudioContext.stop();
     },
-    videoPause: function (event) {
+    videoPause: function(event) {
         console.log('视频暂停')
         console.log('暂停', event)
         this.innerAudioContext.pause();
         this.innerAudioContext.volume = 0;
     },
-    videoWaiting: function () {
+    videoWaiting: function() {
         console.log('视频缓冲')
         this.innerAudioContext.pause();
     },
-    videoProgress: function (e) {
+    videoProgress: function(e) {
         if (e.detail.buffered <= 10) {
             this.innerAudioContext.pause();
         } else {
             this.innerAudioContext.play();
         }
     },
-    videoTimeupdate: function (e) {
+    videoTimeupdate: function(e) {
         this.videoPlayTime = e.detail.currentTime
-        // if (e.detail.currentTime - this.innerAudioContext.currentTime >= 1) {
-        //     this.innerAudioContext.seek(e.detail.currentTime - 0.1);
-        // } 
+            // if (e.detail.currentTime - this.innerAudioContext.currentTime >= 1) {
+            //     this.innerAudioContext.seek(e.detail.currentTime - 0.1);
+            // } 
     },
-    goToReading: function () {
+    goToReading: function() {
         // this.setData({
         //     isModalShow: true
         // })
@@ -451,7 +451,7 @@ Page({
             return;
         });
     },
-    onShareAppMessage: function () {
+    onShareAppMessage: function() {
         console.log(this.data.productId);
         const data = {
             shareTypeEnum: 'LINK',
@@ -467,7 +467,7 @@ Page({
             imageUrl: `https://efunbox.lingjiao.cn/reader/resource/share/read_${this.data.productId}.jpg`,
         }
     },
-    follow: function () {
+    follow: function() {
         let followUid = this.data.authorUid;
         if (this.data.isFans) {
             httpRequestApi.cancerFollow(this.uid, followUid).success((res) => {
@@ -494,7 +494,7 @@ Page({
         }
     },
     // 点赞评论
-    likeCommend: function (e) {
+    likeCommend: function(e) {
         console.log(e);
         // let uid = wx.getStorageSync('uid');
         let followUid = e.currentTarget.dataset.id;
@@ -510,14 +510,14 @@ Page({
         });
     },
     // 去用户主页
-    goToUsers: function (e) {
+    goToUsers: function(e) {
         let uid = e.currentTarget.dataset.uid;
         wx.navigateTo({
             url: `../../user/myworks/myworks?uid=${uid}`
         });
     },
     // 去其他用户的作品页
-    goToOthers: function (e) {
+    goToOthers: function(e) {
         this.data.stackSize++;
         console.log(this.data.stackSize)
         if (this.data.stackSize >= 3) {
@@ -534,7 +534,7 @@ Page({
 
     },
     // 查询回复
-    getReply: function () {
+    getReply: function() {
         // let uid = wx.getStorageSync('uid');
         let columnId = this.data.id;
         console.log(123123123, columnId)
@@ -545,7 +545,7 @@ Page({
             // const replyTemp = [];
             replyList.forEach((item) => {
                 const temp = {};
-                temp.nickName = item.user.wechatName;
+                temp.nickName = item.user.nickName;
                 temp.avatar = item.user.avatar;
                 temp.profession = item.user.profession;
                 temp.uid = item.user.uid;
@@ -568,7 +568,7 @@ Page({
         });
     },
     // 打开回复详情页
-    goToDetail: function (e) {
+    goToDetail: function(e) {
         let id = e.currentTarget.dataset.id;
         // let count = e.currentTarget.dataset.count;
         wx.navigateTo({
@@ -576,13 +576,13 @@ Page({
         })
     },
     //  绑定输入框内容
-    inputValue: function (e) {
+    inputValue: function(e) {
         this.setData({
             inputValue: e.detail.value
         });
     },
     // 发布回复
-    sendHandler: function () {
+    sendHandler: function() {
         console.log(this.data.productId)
         if (this.data.inputValue !== '') {
             // let uid = wx.getStorageSync('uid');
@@ -610,12 +610,12 @@ Page({
 
         }
     },
-    flowerAnimationHandler: function () {
+    flowerAnimationHandler: function() {
         this.flowerBox = this.selectComponent("#flower-box");
         this.flowerBox.comeOut();
     },
     // 触底加载
-    onReachBottom: function () {
+    onReachBottom: function() {
         // 当前在推荐页面 加载推荐
         if (this.data.pageNo <= this.data.totalPage) {
             this.setData({
@@ -628,7 +628,7 @@ Page({
 
     },
     // 设置点击时的id
-    setSBId: function (e) {
+    setSBId: function(e) {
         this.setData({
             replySBId: e.currentTarget.dataset.id,
             replyModal: true,
@@ -636,7 +636,7 @@ Page({
         })
     },
     // 回复某个评论
-    replySB: function () {
+    replySB: function() {
         const data = {
             postsId: this.data.replySBId,
             content: this.data.inputSBValue,
@@ -653,18 +653,18 @@ Page({
         });
     },
     // 获取回复楼中楼的内容
-    inputSBValue: function (e) {
+    inputSBValue: function(e) {
         this.setData({
             inputSBValue: e.detail.value
         });
     },
     // 选择金额
-    setMoney: function (e) {
+    setMoney: function(e) {
         this.setData({
             howMuch: e.currentTarget.dataset.money
         })
     },
-    reward: function () {
+    reward: function() {
         if (this.data.isIOS) {
             return
         };
@@ -672,18 +672,18 @@ Page({
             ifReward: true
         })
     },
-    quitReward: function () {
+    quitReward: function() {
         this.setData({
             ifReward: false
         })
     },
     // 奖励
-    rewardMoney: function () {
+    rewardMoney: function() {
         const data = {
-            targetUid: this.data.authorUid,
-            amount: this.data.howMuch
-        }
-        // let uid = wx.getStorageSync('uid');
+                targetUid: this.data.authorUid,
+                amount: this.data.howMuch
+            }
+            // let uid = wx.getStorageSync('uid');
         httpRequestApi.rewardMoney(this.uid, data).success(res => {
             if (res.data.message) {
                 wx.showModal({
@@ -704,7 +704,7 @@ Page({
 
     },
     //支付
-    payMoney: function (orderInfo) {
+    payMoney: function(orderInfo) {
         if (this.data.haveTapMoney) {
             return false
         }
@@ -720,28 +720,28 @@ Page({
             'paySign': orderInfo.sign,
             'success': res => {
                 this.setData({
-                    modalType: 'image',
-                    isModalShow: true,
-                    modalCloseShow: false,
-                    modalBtnText: '确定',
-                    haveTapMoney: false,
-                    ifReward: false
-                })
-                // wx.showModal({
-                //     title: '提示',
-                //     content: '支付成功',
-                //     success(res) {
-                //         if (res.confirm) {
-                //             this.setData({
-                //                 ifReward: false
-                //             })
-                //         } else if (res.cancel) {
-                //             this.setData({
-                //                 ifReward: false
-                //             })
-                //         }
-                //     }
-                // })
+                        modalType: 'image',
+                        isModalShow: true,
+                        modalCloseShow: false,
+                        modalBtnText: '确定',
+                        haveTapMoney: false,
+                        ifReward: false
+                    })
+                    // wx.showModal({
+                    //     title: '提示',
+                    //     content: '支付成功',
+                    //     success(res) {
+                    //         if (res.confirm) {
+                    //             this.setData({
+                    //                 ifReward: false
+                    //             })
+                    //         } else if (res.cancel) {
+                    //             this.setData({
+                    //                 ifReward: false
+                    //             })
+                    //         }
+                    //     }
+                    // })
 
             },
             'fail': res => {
@@ -753,12 +753,12 @@ Page({
         })
     },
     // 回到首页
-    goBackHome: function () {
+    goBackHome: function() {
         wx.redirectTo({
             url: '../../index/index'
         })
     },
-    modalConfirmHandler: function () {
+    modalConfirmHandler: function() {
         this.setData({
             isModalShow: false
         })
@@ -776,21 +776,21 @@ Page({
         }
 
     },
-    modalCloseHandler: function () {
+    modalCloseHandler: function() {
         this.setData({
             isModalShow: false
         })
     },
-    jurisdiction: function () {
+    jurisdiction: function() {
         //隐藏弹框
         this.setData({
-            hide: !this.data.hide
-        })
-        //登录页信息
-        // this.onLoad(this.data.onLoadOption);
+                hide: !this.data.hide
+            })
+            //登录页信息
+            // this.onLoad(this.data.onLoadOption);
         this.goToReading();
     },
-    goToClass: function () {
+    goToClass: function() {
 
         if (!this.data.isIOS && this.videoCtx) {
             this.innerAudioContext.stop();

+ 219 - 219
pages/user/myEdit/myEdit.js

@@ -1,250 +1,250 @@
 import httpRequestApi from '../../../utils/APIClient';
 import {
-  formatDate
+    formatDate
 } from '../../../utils/util';
 Page({
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    user: {},
-    sexs: [],
-    occupations: [],
-    date: '',
-    msg: '',
-    nickname: '',
-    gradeIndex: 0,
-    gradeArray: ['一年级', '二年级', '三年级','四年级', '学前班'],
-    gradeCode: '',
-    statusbarobj: {
-      isshowbtn: false, //是否显示按钮
-      title: "小学语文朗读配音", //标题
-    },
-    gradeObject: [{
-        code: 'PRIMARY_FIRST_GRADE',
-        name: '一年级'
-      },
-      {
-        code: 'PRIMARY_SECOND_GRADE',
-        name: '二年级'
-      },
-      {
-        code: 'PRIMARY_THREE_GRADE',
-        name: '三年级'
-      },
-      {
-        code: 'PRIMARY_SENIOR_GRADE',
-        name: '四年级'
-      },
-      {
-        code: 'PRESCHOOL',
-        name: '学前班'
-      }
-    ],
-  },
-  chooseGrade: function (e) {
-    console.log('选择年级')
-  },
-  saveNickName: function (e) {
-    let nickname = e.detail.value;
-    this.setData({
-      nicename: nickname
-    });
-  },
-  saveAddress: function (e) {
-    let msg = e.detail.value;
-    this.setData({
-      msg: msg
-    });
-  },
-  bindDateChange: function (e) {
-    console.log(e.detail.value)
-    this.setData({
-      date: e.detail.value
-    });
-  },
-  optionAction: function (e) {
-    console.log(e.detail.value);
-  },
-  optionSetting: function (e) {
-    console.log(e.detail.value);
-  },
-  changeAvatar: function (e) {
-    const _this = this;
-    wx.chooseImage({
-      count: 1,
-      sizeType: ['compressed'],
-      sourceType: ['album', 'camera'],
-      success(res) {
-        // tempFilePath可以作为img标签的src属性显示图片
-        const localImage = res.tempFilePaths[0];
-        wx.uploadFile({
-          url: 'https://reader-api.efunbox.cn/file/upload',
-          filePath: localImage,
-          name: '头像',
-          header: {
-            uid: wx.getStorageSync('uid')
-          },
-          success: (res) => {
-            // console.log(JSON.parse(res.data));
-            const newAvatar = JSON.parse(res.data).data;
-            const str = 'user.avatar'
-            _this.setData({
-              [str]: newAvatar
-            })
-          }
-        })
-      }
-    })
-  },
-  formSubmit: function (e) {
-    console.log(e.detail.value)
-    console.log(e)
-    if (e.detail.value.nickname === '') {
-      return false
-    }
-    // const uid = wx.getStorageSync('uid');
-    const data = {
-      wechatName: e.detail.value.nickname || '',
-      gender: e.detail.value.radioGroup1,
-      schoolName: e.detail.value.address || '',
-      birthday: e.detail.value.picker || '',
-      avatar: this.data.user.avatar,
-      grade: this.data.gradeCode
-    }
-    httpRequestApi.settingUserInfo(data).success(res => {
-      console.log(res.data.data); //修改资料成功后 调用 getUserInfo
-      // wx.redirectTo({
-      //   url: '/pages/index/index?index=3'
-      // });
-      wx.setStorageSync('user', res.data.data);
-      wx.setStorageSync('grade', res.data.data.grade);
-      wx.navigateBack({
-        delta: 1
-      })
-    });
-  },
-  bindGradeChange: function (e) {
-    console.log('年级选择', e)
-    this.setData({
-      gradeIndex: e.detail.value,
-      gradeCode: this.data.gradeObject[e.detail.value].code
-    }, () => {
-      console.log(this.data.gradeCode)
-    })
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  getUserInfo: function () {
-
-  },
-  onLoad: function (option) {
-    httpRequestApi.getUserInfo().success(res => {
-      const user = res.data.data;
-      let gradeIndex = 0;
-      this.data.gradeObject.forEach((item, index) => {
-        console.log('年级index', item)
-        console.log('年级index', item)
-        if (item.code === user.grade) {
-          console.log('年级index', index)
-          gradeIndex = index
-        }
-        console.log(user)
-        const birthday = user.birthday ? formatDate(user.birthday, 2) : '2018-01-01';
-        console.log(birthday)
-        this.setData({
-          user: user,
-          date: birthday,
-          sexs: [{
-              value: 2,
-              checked: user.gender === 2 ? true : false,
-              sex: '女'
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        user: {},
+        sexs: [],
+        occupations: [],
+        date: '',
+        msg: '',
+        nickname: '',
+        gradeIndex: 0,
+        gradeArray: ['一年级', '二年级', '三年级', '四年级', '学前班'],
+        gradeCode: '',
+        statusbarobj: {
+            isshowbtn: false, //是否显示按钮
+            title: "小学语文朗读配音", //标题
+        },
+        gradeObject: [{
+                code: 'PRIMARY_FIRST_GRADE',
+                name: '一年级'
             },
             {
-              value: 1,
-              checked: user.gender === 1 ? true : false,
-              sex: '男'
-            }
-          ],
-          occupations: [{
-              value: '家长',
-              checked: user.profession === '家长' ? true : false
+                code: 'PRIMARY_SECOND_GRADE',
+                name: '二年级'
+            },
+            {
+                code: 'PRIMARY_THREE_GRADE',
+                name: '三年级'
             },
             {
-              value: '老师',
-              checked: user.profession === '老师' ? true : false
+                code: 'PRIMARY_SENIOR_GRADE',
+                name: '四年级'
             },
             {
-              value: '学生',
-              checked: user.profession === '学生' ? true : false
+                code: 'PRESCHOOL',
+                name: '学前班'
             }
-          ],
-          gradeIndex
-        })
-      })
-      console.log(this.data.date)
-      if (option.title) {
-        wx.setNavigationBarTitle({
-          title: option.title //页面标题为路由参数
+        ],
+    },
+    chooseGrade: function(e) {
+        console.log('选择年级')
+    },
+    saveNickName: function(e) {
+        let nickname = e.detail.value;
+        this.setData({
+            nicename: nickname
+        });
+    },
+    saveAddress: function(e) {
+        let msg = e.detail.value;
+        this.setData({
+            msg: msg
         });
+    },
+    bindDateChange: function(e) {
+        console.log(e.detail.value)
         this.setData({
-          title: option.title
+            date: e.detail.value
         });
-      }
-      httpRequestApi.userIntoPage('pages/user/myEdit/myEdit', '修改资料页面').success((res) => {
+    },
+    optionAction: function(e) {
+        console.log(e.detail.value);
+    },
+    optionSetting: function(e) {
+        console.log(e.detail.value);
+    },
+    changeAvatar: function(e) {
+        const _this = this;
+        wx.chooseImage({
+            count: 1,
+            sizeType: ['compressed'],
+            sourceType: ['album', 'camera'],
+            success(res) {
+                // tempFilePath可以作为img标签的src属性显示图片
+                const localImage = res.tempFilePaths[0];
+                wx.uploadFile({
+                    url: 'https://reader-api.efunbox.cn/file/upload',
+                    filePath: localImage,
+                    name: '头像',
+                    header: {
+                        uid: wx.getStorageSync('uid')
+                    },
+                    success: (res) => {
+                        // console.log(JSON.parse(res.data));
+                        const newAvatar = JSON.parse(res.data).data;
+                        const str = 'user.avatar'
+                        _this.setData({
+                            [str]: newAvatar
+                        })
+                    }
+                })
+            }
+        })
+    },
+    formSubmit: function(e) {
+        console.log(e.detail.value)
+        console.log(e)
+        if (e.detail.value.nickname === '') {
+            return false
+        }
+        // const uid = wx.getStorageSync('uid');
+        const data = {
+            nickName: e.detail.value.nickname || '',
+            gender: e.detail.value.radioGroup1,
+            schoolName: e.detail.value.address || '',
+            birthday: e.detail.value.picker || '',
+            avatar: this.data.user.avatar,
+            grade: this.data.gradeCode
+        }
+        httpRequestApi.settingUserInfo(data).success(res => {
+            console.log(res.data.data); //修改资料成功后 调用 getUserInfo
+            // wx.redirectTo({
+            //   url: '/pages/index/index?index=3'
+            // });
+            wx.setStorageSync('user', res.data.data);
+            wx.setStorageSync('grade', res.data.data.grade);
+            wx.navigateBack({
+                delta: 1
+            })
+        });
+    },
+    bindGradeChange: function(e) {
+        console.log('年级选择', e)
+        this.setData({
+            gradeIndex: e.detail.value,
+            gradeCode: this.data.gradeObject[e.detail.value].code
+        }, () => {
+            console.log(this.data.gradeCode)
+        })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    getUserInfo: function() {
+
+    },
+    onLoad: function(option) {
+        httpRequestApi.getUserInfo().success(res => {
+            const user = res.data.data;
+            let gradeIndex = 0;
+            this.data.gradeObject.forEach((item, index) => {
+                console.log('年级index', item)
+                console.log('年级index', item)
+                if (item.code === user.grade) {
+                    console.log('年级index', index)
+                    gradeIndex = index
+                }
+                console.log(user)
+                const birthday = user.birthday ? formatDate(user.birthday, 2) : '2018-01-01';
+                console.log(birthday)
+                this.setData({
+                    user: user,
+                    date: birthday,
+                    sexs: [{
+                            value: 2,
+                            checked: user.gender === 2 ? true : false,
+                            sex: '女'
+                        },
+                        {
+                            value: 1,
+                            checked: user.gender === 1 ? true : false,
+                            sex: '男'
+                        }
+                    ],
+                    occupations: [{
+                            value: '家长',
+                            checked: user.profession === '家长' ? true : false
+                        },
+                        {
+                            value: '老师',
+                            checked: user.profession === '老师' ? true : false
+                        },
+                        {
+                            value: '学生',
+                            checked: user.profession === '学生' ? true : false
+                        }
+                    ],
+                    gradeIndex
+                })
+            })
+            console.log(this.data.date)
+            if (option.title) {
+                wx.setNavigationBarTitle({
+                    title: option.title //页面标题为路由参数
+                });
+                this.setData({
+                    title: option.title
+                });
+            }
+            httpRequestApi.userIntoPage('pages/user/myEdit/myEdit', '修改资料页面').success((res) => {
 
-      })
-    });
+            })
+        });
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function() {
 
-  },
+    },
 
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function() {
 
-  },
+    },
 
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function() {
 
-  },
+    },
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function() {
 
-  }
+    }
 })

+ 1 - 1
pages/user/myEdit/myEdit.wxml

@@ -13,7 +13,7 @@
       <view class='nickname-box'>
         <text class='setting-title'>昵称</text>
         <view class='user-action'>
-          <input name='nickname' class='nickname' type='text' maxlength="9" placeholder='{{user.wechatName}}' placeholder-class='placeholderStyle' focus='{{ true }}' value='{{user.wechatName}}' bindblur='saveNickName'></input>
+          <input name='nickname' class='nickname' type='text' maxlength="9" placeholder='{{user.nickName}}' placeholder-class='placeholderStyle' focus='{{ true }}' value='{{user.nickName}}' bindblur='saveNickName'></input>
         </view>
         <view class='edit-img'>
           <image src='../../../static/image/edit_new.png' class='icon'></image>

+ 2 - 2
pages/user/myread/myread.wxml

@@ -6,7 +6,7 @@
         <image class='avatar-image' src="{{ user.user.avatar }}" />
       </view>
       <view class="avatar-name">
-        <view>{{ user.user.wechatName }}</view>
+        <view>{{ user.user.nickName }}</view>
         <view>{{ format.formatDate(item.gmtCreated) }}</view>
       </view>
     </view>
@@ -36,7 +36,7 @@
         <image class="authorAvatar" lazy-load="true" src="{{user.user.avatar}}" />
         <view class="profession" wx:if="{{item.profession}}">{{user.user.profession}}</view>
         <view class="worksInfo">
-          <view class="authorName">{{user.user.wechatName}}</view>
+          <view class="authorName">{{user.user.nickName}}</view>
           <view class="time">{{format.formatDate(item.gmtCreated)}}</view>
         </view>
       </view>

+ 5 - 5
pages/userWorks/index.js

@@ -56,19 +56,19 @@ Page({
                         sc.onload = () => {
                             ctx.drawImage(sc, 12, 220, 20, 20)
                             ctx.fillText('收藏', 36, 238)
-                            //分享
+                                //分享
                             let fx = canvas.createImage();
                             fx.src = '/static/index/share.png'
                             fx.onload = () => {
                                 ctx.drawImage(fx, 78, 220, 22, 22)
                                 ctx.fillText('分享', 104, 238)
-                                //点赞
+                                    //点赞
                                 let dz = canvas.createImage();
                                 dz.src = video.isLike ? '/static/index/heart_colored.png' : '/static/index/heart.png'
                                 dz.onload = () => {
-                                    ctx.drawImage(dz, 268, 222, 22, 22)
-                                    ctx.fillText(video.userRead.likeAmount, 294, 238)
-                                    //评论
+                                    ctx.drawImage(dz, 258, 222, 22, 22)
+                                    ctx.fillText(video.userRead.likeAmount, 284, 238)
+                                        //评论
                                     let pl = canvas.createImage();
                                     pl.src = '/static/index/comment.png'
                                     pl.onload = () => {

+ 112 - 112
pages/vipActivity/vipActivity.js

@@ -3,130 +3,130 @@ import httpRequestApi from '../../utils/APIClient';
 const app = getApp()
 Page({
 
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    peopleNumData: [],
-    isIOS: app.globalData.isIOS,
-    date: ''
-  },
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        peopleNumData: [],
+        isIOS: app.globalData.isIOS,
+        date: ''
+    },
 
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    this.getVipData();
-    this.getHelp();
-  },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function(options) {
+        this.getVipData();
+        this.getHelp();
+    },
 
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function() {
 
-  },
+    },
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function() {
 
-  },
+    },
 
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-    this.getVipData();
-    this.getHelp();
-    wx.showNavigationBarLoading() //在标题栏中显示加载
-    //模拟加载
-    setTimeout(function () {
-      wx.hideNavigationBarLoading() //完成停止加载
-      wx.stopPullDownRefresh() //停止下拉刷新
-    }, 1000);
-  },
-  /**
-   * 点击分享e
-   */
-   shareRead(e) {
-    this.triggerEvent('openShare', e)
-    this.shareDialog = this.selectComponent("#share-dialog");
-    const user = wx.getStorageSync('user');
-    const type = this.data.isIOS ? 'ios' : 'iphone';
-    const data = {
-        avatar: user.avatar,
-        name: user.wechatName,
-        uid: user.uid,
-        type,
-        path: `pages/index/index`
-    }
-    this.setData({
-        noScroll: 'noScroll'
-    })
-    this.shareDialog.share(data);
-   },
-   onShareAppMessage: function (res) {
-    if (res.from === 'button') {
-      const type = this.data.isIOS ? 'ios' : 'iphone';
-      const user = wx.getStorageSync('user');
-      return {
-        title: `${user.wechatName}邀请你一起来朗读课文`,
-        path: `/pages/index/index?type=${type}&uid=${user.uid}`,
-        imageUrl: 'http://reader-wx.ai160.com/images/reader/pay/share_read_bg.png'
-      }
-    }
-  },
-  // 获取会员信息
-  getVipData() {
-    httpRequestApi.getAuthActivity().success(res => {
-      if (!res.data.data) {
-        wx.setStorageSync('vip', false)
-        wx.setStorageSync('date', '')
-      } else {
-        wx.setStorageSync('vip', true)
-        wx.setStorageSync('date', res.data.data)
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function() {
+        this.getVipData();
+        this.getHelp();
+        wx.showNavigationBarLoading() //在标题栏中显示加载
+            //模拟加载
+        setTimeout(function() {
+            wx.hideNavigationBarLoading() //完成停止加载
+            wx.stopPullDownRefresh() //停止下拉刷新
+        }, 1000);
+    },
+    /**
+     * 点击分享e
+     */
+    shareRead(e) {
+        this.triggerEvent('openShare', e)
+        this.shareDialog = this.selectComponent("#share-dialog");
+        const user = wx.getStorageSync('user');
+        const type = this.data.isIOS ? 'ios' : 'iphone';
+        const data = {
+            avatar: user.avatar,
+            name: user.nickName,
+            uid: user.uid,
+            type,
+            path: `pages/index/index`
+        }
         this.setData({
-          date: res.data.data
+            noScroll: 'noScroll'
         })
-      }
-    }).fail(error => {
-      console.log(error)
-    })
-  },
-  // 获取帮助的人
-  getHelp() {
-    if (this.data.isIOS) {
-      httpRequestApi.getHelpNum().success(res => {
-        this.setData({
-          peopleNumData: res.data.data.list
-        })
-      }).fail(error => {
-        console.log(error)
-      })
-    } else {
-      httpRequestApi.getOrderNum().success(res => {
-        this.setData({
-          peopleNumData: res.data.data.list
+        this.shareDialog.share(data);
+    },
+    onShareAppMessage: function(res) {
+        if (res.from === 'button') {
+            const type = this.data.isIOS ? 'ios' : 'iphone';
+            const user = wx.getStorageSync('user');
+            return {
+                title: `${user.nickName}邀请你一起来朗读课文`,
+                path: `/pages/index/index?type=${type}&uid=${user.uid}`,
+                imageUrl: 'http://reader-wx.ai160.com/images/reader/pay/share_read_bg.png'
+            }
+        }
+    },
+    // 获取会员信息
+    getVipData() {
+        httpRequestApi.getAuthActivity().success(res => {
+            if (!res.data.data) {
+                wx.setStorageSync('vip', false)
+                wx.setStorageSync('date', '')
+            } else {
+                wx.setStorageSync('vip', true)
+                wx.setStorageSync('date', res.data.data)
+                this.setData({
+                    date: res.data.data
+                })
+            }
+        }).fail(error => {
+            console.log(error)
         })
-      }).fail(error => {
-        console.log(error)
-      })
+    },
+    // 获取帮助的人
+    getHelp() {
+        if (this.data.isIOS) {
+            httpRequestApi.getHelpNum().success(res => {
+                this.setData({
+                    peopleNumData: res.data.data.list
+                })
+            }).fail(error => {
+                console.log(error)
+            })
+        } else {
+            httpRequestApi.getOrderNum().success(res => {
+                this.setData({
+                    peopleNumData: res.data.data.list
+                })
+            }).fail(error => {
+                console.log(error)
+            })
+        }
     }
-  }
 })

+ 1 - 1
pages/vipActivity/vipActivity.wxml

@@ -20,7 +20,7 @@
       <view class="friend-message" wx:for="{{peopleNumData}}" wx:key="{{item.user.uid}}">
         <image class="friend-head" src="{{item.user.avatar}}" />
         <view class="{{isIOS ? 'ios-name' : 'name'}}">
-          <text style="font-weight: 500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{item.user.wechatName}}</text>
+          <text style="font-weight: 500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{item.user.nickName}}</text>
           <text class="friend-date" hidden="{{isIOS}}">购买日期:{{filters.formatDate(item.orderInfo.gmtCreated)}}</text>
         </view>
         <text class="{{isIOS ? 'ios-friend-time' : 'friend-time'}}">{{isIOS ? filters.formatDate(item.userHelp.gmtCreated) : '+1个月'}}</text>

+ 4 - 3
project.private.config.json

@@ -6,9 +6,10 @@
         "miniprogram": {
             "list": [
                 {
-                    "name": "pages/vipPage/wechat/wechat",
-                    "pathName": "pages/vipPage/wechat/wechat",
-                    "query": "",
+                    "name": "/pages/index/index",
+                    "pathName": "/pages/index/index",
+                    "query": "readId=103127012&uid=4cb6ca9f5d7f45f6ad5429f3de080d2d",
+                    "launchMode": "default",
                     "scene": null
                 },
                 {

+ 24 - 25
utils/httpUtilNoLogin.js

@@ -11,15 +11,16 @@ function genAPIUrl(action) {
 }
 
 // 登录
-function wxLogin(successcallback, failcallback) {
+function wxLogin(successcallback, failcallback, shareUid) {
     wx.login({
-        success: function (res) {
+        success: function(res) {
             if (res.code) {
                 // 获取openid
                 console.log('登录登录登录登录code', res.code)
                 let url = genAPIUrl('wx/user/openId')
                 let data = {
-                    code: res.code
+                    code: res.code,
+                    shareUid
                 }
                 return request.getInstance().url(url).data(data).send().success(successcallback).fail(failcallback);
             } else {
@@ -31,31 +32,29 @@ function wxLogin(successcallback, failcallback) {
 
 // 获取原来的 openid 和 session_key
 /* 新增参数grade 需要给游客添加grade参数 */
-function getOpenidNoLogin(successcallback, failcallback, grade) {
-
-    wxLogin(function (res) {
+function getOpenidNoLogin(successcallback, failcallback, shareUid) {
+    wxLogin(function(res) {
         if (res.data.code == 200) {
-            let openId = res.data.data.openid;
-            let url = genAPIUrl('wx/user/register');
-            request.getInstance().method('POST').url(url).header({
-                'content-type': 'application/json'
-            }).data({
-                openId,
-                grade: grade ? grade : null
-            }).send().success((res) => {
-                if (res.data.code === 200) {
-                    wx.setStorageSync('uid', res.data.data.uid)
-                    wx.setStorageSync('grade', res.data.data.grade)
-                    wx.setStorageSync('user', res.data.data)
-                    console.log('wx.login', res)
-                    successcallback(res)
-                }
-            }).fail(() => {});
+            console.log(res);
+            // let openId = res.data.data.openid;
+            // let url = genAPIUrl('wx/user/register');
+            // request.getInstance().method('POST').url(url).header({
+            //     'content-type': 'application/json'
+            // }).data({
+            //     openId,
+            //     grade: grade ? grade : null
+            // }).send().success((res) => {
+            if (res.data.code === 200) {
+                wx.setStorageSync('uid', res.data.data.data.uid)
+                wx.setStorageSync('grade', res.data.data.data.grade)
+                wx.setStorageSync('user', res.data.data.data)
+                successcallback(res.data)
+            }
+            // }).fail(() => {});
         }
-
-    }, function (res) {
+    }, function(res) {
         failcallback(res);
-    })
+    }, shareUid)
 }