bayi 2 年 前
コミット
8e9067852f
3 ファイル変更56 行追加52 行削除
  1. 0 1
      components/worksList/index.js
  2. 55 50
      pages/pkPage/index.js
  3. 1 1
      pages/pkPage/index.wxml

+ 0 - 1
components/worksList/index.js

@@ -84,7 +84,6 @@ Component({
         worksListCopy
       })
     },
-
     addCommentNum({
       detail
     }) {

+ 55 - 50
pages/pkPage/index.js

@@ -1,58 +1,63 @@
 import behavior from '~/mixins/video'
 import share from '~/mixins/share'
 import {
-    getreadInfo
+  getreadInfo
 } from '~/api/video'
 import {
-    getPkRecord
+  getPkRecord
 } from '~/api/works'
 Page({
-    behaviors: [behavior, share],
-    data: {
-        videoInfo: '',
-        videoId: '',
-        recordList: []
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-        let videoId = options.videoId
-        this.setData({
-            videoId
-        })
-        this.getreadInfo(videoId)
-        this.getPkRecord()
-    },
-    async getreadInfo(videoId) {
-        let videoInfo = await getreadInfo(videoId)
-        wx.setNavigationBarTitle({
-            title: videoInfo.userRead.title
-        })
-        this.setData({
-            videoInfo
-        })
-    },
-    async getPkRecord() {
-        let recordList = await getPkRecord({
-            userReadId: this.data.videoId
-        })
-        this.setData({
-            recordList
-        })
-        console.log(recordList);
-    },
-    jumpUserInfo({
-        currentTarget
-    }) {
-        wx.navigateTo({
-            url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
-        })
-    },
-    onUnload() {
-        this.resetAudio()
-        this.setData({
-            currentId: ''
-        })
-    }
+  behaviors: [behavior, share],
+  data: {
+    videoInfo: '',
+    videoId: '',
+    recordList: []
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    let videoId = options.videoId
+    this.setData({
+      videoId
+    })
+    this.getreadInfo(videoId)
+    this.getPkRecord()
+  },
+  async getreadInfo(videoId) {
+    let videoInfo = await getreadInfo(videoId)
+    wx.setNavigationBarTitle({
+      title: videoInfo.userRead.title
+    })
+    this.setData({
+      videoInfo
+    })
+  },
+  async getPkRecord() {
+    let recordList = await getPkRecord({
+      userReadId: this.data.videoId
+    })
+    this.setData({
+      recordList
+    })
+    console.log(recordList);
+  },
+  jumpUserInfo({
+    currentTarget
+  }) {
+    wx.navigateTo({
+      url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
+    })
+  },
+  addCommentNum() {
+    this.setData({
+      ['videoInfo.userRead.commentAmount']: ++this.data.videoInfo.userRead.commentAmount
+    })
+  },
+  onUnload() {
+    this.resetAudio()
+    this.setData({
+      currentId: ''
+    })
+  }
 })

+ 1 - 1
pages/pkPage/index.wxml

@@ -26,6 +26,6 @@
       </view>
     </scroll-view>
   </view>
-  <Comment id="comment" />
+  <Comment id="comment" bind:addCommentNum="addCommentNum" />
   <canvas id='share' type="2d"> </canvas>
 </view>