bayi пре 2 година
родитељ
комит
57e6057d7b

+ 23 - 21
api/works.js

@@ -1,25 +1,27 @@
 import {
-  request
+    request
 } from "../utils/request";
 module.exports = {
-  // 获取作品类目
-  getCategoryList: data => request('/v3/column', 'get', data),
-  // 获取作品二级类目内容
-  getCategoryWorks: data => request('/v3/column/opus', 'get', data),
-  // 作品查询
-  searchWorks: data => request('/v3/recommend/query', 'get', data),
-  // 获取优秀作品展播列表
-  getHotrecommendList: data => request('/userRead/recommend', 'get', data),
-  // 获取官方推荐作品列表
-  getAuthorityList: data => request('/v3/recommend', 'get', data),
-  // 发布作品
-  publishWorks: data => request('/userRead', 'post', data),
-  // 上传挑战结果
-  uploadPk: data => request('/v3/pk', 'post', data),
-  // 获取关注的人的作品
-  getFollowWorks: data => request('/fans/interest', 'get', data),
-  // 获取作品的挑战记录
-  getPkRecord: data => request('/v3/pk', 'get', data),
-  // 发布朗读赛作品
-  publishRankWorks: data => request('/activityRead', 'post', data),
+    // 获取作品类目
+    getCategoryList: data => request('/v3/column', 'get', data),
+    // 获取作品二级类目内容
+    getCategoryWorks: data => request('/v3/column/opus', 'get', data),
+    // 作品查询
+    searchWorks: data => request('/v3/recommend/query', 'get', data),
+    // 获取优秀作品展播列表
+    getHotrecommendList: data => request('/userRead/recommend', 'get', data),
+    // 获取官方推荐作品列表
+    getAuthorityList: data => request('/v3/recommend', 'get', data),
+    // 发布作品
+    publishWorks: data => request('/userRead', 'post', data),
+    // 上传挑战结果
+    uploadPk: data => request('/v3/pk', 'post', data),
+    // 获取关注的人的作品
+    getFollowWorks: data => request('/fans/interest', 'get', data),
+    // 获取作品的挑战记录
+    getPkRecord: data => request('/v3/pk', 'get', data),
+    // 发布朗读赛作品
+    publishRankWorks: data => request('/activityRead', 'post', data),
+    // 上传作品评分
+    postWorksScore: data => request('/assessment', 'post', data),
 }

+ 1 - 1
components/comment/index.js

@@ -70,7 +70,7 @@ Component({
       let params = {
         columnId: this.data.columnId,
         pageNo: 1,
-        pageSize: 10000
+        pageSize: 100
       }
       let {
         totalSize,

+ 206 - 203
components/videoPreview/index.js

@@ -1,226 +1,229 @@
 import {
-  storeBindingsBehavior
+    storeBindingsBehavior
 } from 'mobx-miniprogram-bindings'
 import {
-  store
+    store
 } from '~/store/index'
 import {
-  setVideoStatus,
-  likeVideo,
-  collectVideo,
+    setVideoStatus,
+    likeVideo,
+    collectVideo,
 } from '~/api/video'
 import {
-  setFans
+    setFans
 } from '~/api/user'
 
 Component({
-  behaviors: [storeBindingsBehavior],
-  storeBindings: {
-    store,
-    fields: {
-      pkData: 'pkData'
-    },
-    actions: {
-      setPkData: 'setPkData'
-    }
-  },
-  /**
-   * 组件的属性列表
-   */
-  properties: {
-    videoInfo: {
-      type: Object,
-      value: {},
-      observer(newVal) {
-        this.setData({
-          videoInfoCopy: newVal
-        })
-      }
-    },
-    videoType: {
-      type: String,
-      // value 为public时是默认公共样式,为my时为“我的”样式,展示下载删除是否公开,pk为pk的样式文案,excellent是优秀作品展播
-      value: 'public'
-    },
-    currentId: {
-      type: Number,
-    }
-  },
-  data: {
-    selfUid: wx.getStorageSync('uid'),
-    videoInfoCopy: {}
-  },
-  methods: {
-    // 播放视频
-    playVideo() {
-      this.triggerEvent('playVideo', this.properties.videoInfo.userRead.id)
+    behaviors: [storeBindingsBehavior],
+    storeBindings: {
+        store,
+        fields: {
+            pkData: 'pkData'
+        },
+        actions: {
+            setPkData: 'setPkData'
+        }
     },
-    // 设置视频公开还是隐私
-    async setVideoPublic() {
-      let info = this.properties.videoInfo.userRead
-      let data = {
-        id: info.id,
-        status: info.status === 'NORMAL' ? 'DISABLE' : 'NORMAL'
-      }
-      let res = await setVideoStatus(data)
-      if (res.status == 'DISABLE') {
-        wx.showToast({
-          title: '该作品仅自己可见',
-          icon: 'none',
-          duration: 2000
-        })
-      }
-      this.setData({
-        ['videoInfoCopy.userRead.status']: info.status === 'NORMAL' ? 'DISABLE' : 'NORMAL'
-      })
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        videoInfo: {
+            type: Object,
+            value: {},
+            observer(newVal) {
+                if (newVal.userReadExtend && newVal.userReadExtend.resourcesType == 1) {
+                    newVal.userRead.title = newVal.userRead.title.split('\n')
+                    console.log(newVal);
+                }
+                this.setData({
+                    videoInfoCopy: newVal
+                })
+            }
+        },
+        videoType: {
+            type: String,
+            // value 为public时是默认公共样式,为my时为“我的”样式,展示下载删除是否公开,pk为pk的样式文案,excellent是优秀作品展播
+            value: 'public'
+        },
+        currentId: {
+            type: Number,
+        }
     },
-    // 点赞
-    async likeVideo() {
-      let {
-        id
-      } = this.properties.videoInfo.userRead
-      if (this.properties.videoInfo.isLike) {
-        return
-      }
-      await likeVideo(id)
-      this.setData({
-        ['videoInfoCopy.isLike']: true,
-        ['videoInfoCopy.userRead.likeAmount']: this.data.videoInfoCopy.userRead.likeAmount + 1
-      })
+    data: {
+        selfUid: wx.getStorageSync('uid'),
+        videoInfoCopy: {}
     },
-    // 下载视频
-    download() {
-      wx.showLoading({
-        title: '保存到本地',
-        mask: true
-      })
-      const url = this.properties.videoInfo.userRead.markPath || ''
-      wx.downloadFile({
-        url,
-        success(res) {
-          if (res.statusCode === 200) {
-            wx.saveVideoToPhotosAlbum({
-              filePath: res.tempFilePath,
-              success(res) {
-                wx.hideLoading()
+    methods: {
+        // 播放视频
+        playVideo() {
+            this.triggerEvent('playVideo', this.properties.videoInfo.userRead.id)
+        },
+        // 设置视频公开还是隐私
+        async setVideoPublic() {
+            let info = this.properties.videoInfo.userRead
+            let data = {
+                id: info.id,
+                status: info.status === 'NORMAL' ? 'DISABLE' : 'NORMAL'
+            }
+            let res = await setVideoStatus(data)
+            if (res.status == 'DISABLE') {
                 wx.showToast({
-                  title: '成功保存到相册!',
-                  duration: 3000,
-                  icon: 'success',
-                  mask: true
+                    title: '该作品仅自己可见',
+                    icon: 'none',
+                    duration: 2000
                 })
-              },
-              fail() {
-                wx.hideLoading()
-                wx.showToast({
-                  title: '网络不给力',
-                  icon: 'error',
-                  duration: 3000,
-                  mask: true
+            }
+            this.setData({
+                ['videoInfoCopy.userRead.status']: info.status === 'NORMAL' ? 'DISABLE' : 'NORMAL'
+            })
+        },
+        // 点赞
+        async likeVideo() {
+            let {
+                id
+            } = this.properties.videoInfo.userRead
+            if (this.properties.videoInfo.isLike) {
+                return
+            }
+            await likeVideo(id)
+            this.setData({
+                ['videoInfoCopy.isLike']: true,
+                ['videoInfoCopy.userRead.likeAmount']: this.data.videoInfoCopy.userRead.likeAmount + 1
+            })
+        },
+        // 下载视频
+        download() {
+            wx.showLoading({
+                title: '保存到本地',
+                mask: true
+            })
+            const url = this.properties.videoInfo.userRead.markPath || ''
+            wx.downloadFile({
+                url,
+                success(res) {
+                    if (res.statusCode === 200) {
+                        wx.saveVideoToPhotosAlbum({
+                            filePath: res.tempFilePath,
+                            success(res) {
+                                wx.hideLoading()
+                                wx.showToast({
+                                    title: '成功保存到相册!',
+                                    duration: 3000,
+                                    icon: 'success',
+                                    mask: true
+                                })
+                            },
+                            fail() {
+                                wx.hideLoading()
+                                wx.showToast({
+                                    title: '网络不给力',
+                                    icon: 'error',
+                                    duration: 3000,
+                                    mask: true
+                                })
+                            }
+                        })
+                    }
+                },
+                fail() {
+                    wx.hideLoading()
+                    wx.showToast({
+                        title: '网络不给力',
+                        icon: 'error',
+                        duration: 3000,
+                        mask: true
+                    })
+                }
+            })
+        },
+        //评论
+        openComment() {
+            this.triggerEvent('openComment')
+        },
+        // 删除
+        delete() {
+            let {
+                id
+            } = this.properties.videoInfo.userRead
+            wx.showModal({
+                title: '确认删除吗?',
+                content: '作品将被永久删除,无法找回。',
+                confirmText: '确认',
+                cancelText: '取消',
+                success: async (res) => {
+                    if (res.confirm) {
+                        let data = {
+                            id,
+                            status: 'DEL'
+                        }
+                        await setVideoStatus(data)
+                        wx.showToast({
+                            title: '删除成功!',
+                            icon: "none"
+                        })
+                        this.triggerEvent('getList')
+                    }
+                }
+            })
+        },
+        // 收藏课程
+        async collect() {
+            let {
+                id,
+                type,
+                uid
+            } = this.properties.videoInfo.userRead
+            if (wx.getStorageSync('uid') == uid) {
+                return wx.showToast({
+                    title: '不能收藏自己作品哦!',
+                    icon: "none"
                 })
-              }
+            }
+            await collectVideo({
+                targetCode: id,
+                favoritesType: type
+            })
+            this.setData({
+                ['videoInfoCopy.isFavorites']: !this.data.videoInfoCopy.isFavorites
             })
-          }
         },
-        fail() {
-          wx.hideLoading()
-          wx.showToast({
-            title: '网络不给力',
-            icon: 'error',
-            duration: 3000,
-            mask: true
-          })
-        }
-      })
-    },
-    //评论
-    openComment() {
-      this.triggerEvent('openComment')
-    },
-    // 删除
-    delete() {
-      let {
-        id
-      } = this.properties.videoInfo.userRead
-      wx.showModal({
-        title: '确认删除吗?',
-        content: '作品将被永久删除,无法找回。',
-        confirmText: '确认',
-        cancelText: '取消',
-        success: async (res) => {
-          if (res.confirm) {
-            let data = {
-              id,
-              status: 'DEL'
+        // 关注
+        async setFans() {
+            if (this.properties.videoInfo.isFans) {
+                return
             }
-            await setVideoStatus(data)
-            wx.showToast({
-              title: '删除成功!',
-              icon: "none"
+            await setFans({
+                uid: this.properties.videoInfo.user.uid
             })
-            this.triggerEvent('getList')
-          }
+            this.triggerEvent('setListFans', this.properties.videoInfo.user.uid)
+        },
+        toPkPage() {
+            let videoInfo = this.data.videoInfoCopy
+            if (this.properties.videoType == 'pk') {
+                this.setPkData({
+                    nickName: videoInfo.user.nickName || videoInfo.user.eid,
+                    avatar: videoInfo.user.avatar,
+                    score: videoInfo.userRead.score,
+                    audioPath: videoInfo.userRead.audioPath,
+                    exampleId: videoInfo.userRead.exampleId,
+                    id: videoInfo.userRead.id
+                })
+            }
+            let readId = videoInfo.userRead.id
+            let url = this.properties.videoType == 'excellent' ? `/pages/pkPage/index?videoId=${readId}` : `/pages/reading/index?videoId=${videoInfo.userRead.exampleId}&readingType=${this.properties.videoType}`
+            wx.navigateTo({
+                url
+            })
+        },
+        jumpUserInfo() {
+            wx.navigateTo({
+                url: `/pages/personal/index?uid=${this.data.videoInfoCopy.user.uid}&type=user`,
+            })
+        },
+        // 控制音频播放
+        audioPlay() {
+            this.triggerEvent('playAudio')
         }
-      })
-    },
-    // 收藏课程
-    async collect() {
-      let {
-        id,
-        type,
-        uid
-      } = this.properties.videoInfo.userRead
-      if (wx.getStorageSync('uid') == uid) {
-        return wx.showToast({
-          title: '不能收藏自己作品哦!',
-          icon: "none"
-        })
-      }
-      await collectVideo({
-        targetCode: id,
-        favoritesType: type
-      })
-      this.setData({
-        ['videoInfoCopy.isFavorites']: !this.data.videoInfoCopy.isFavorites
-      })
-    },
-    // 关注
-    async setFans() {
-      if (this.properties.videoInfo.isFans) {
-        return
-      }
-      await setFans({
-        uid: this.properties.videoInfo.user.uid
-      })
-      this.triggerEvent('setListFans', this.properties.videoInfo.user.uid)
-    },
-    toPkPage() {
-      let videoInfo = this.data.videoInfoCopy
-      console.log(videoInfo, this.properties.videoType);
-      if (this.properties.videoType == 'pk') {
-        this.setPkData({
-          nickName: videoInfo.user.nickName || videoInfo.user.eid,
-          avatar: videoInfo.user.avatar,
-          score: videoInfo.userRead.score,
-          audioPath: videoInfo.userRead.audioPath,
-          exampleId: videoInfo.userRead.exampleId,
-          id: videoInfo.userRead.id
-        })
-      }
-      let readId = videoInfo.userRead.id
-      let url = this.properties.videoType == 'excellent' ? `/pages/pkPage/index?videoId=${readId}` : `/pages/reading/index?videoId=${videoInfo.userRead.exampleId}&readingType=${this.properties.videoType}`
-      wx.navigateTo({
-        url
-      })
-    },
-    jumpUserInfo() {
-      wx.navigateTo({
-        url: `/pages/personal/index?uid=${this.data.videoInfoCopy.user.uid}&type=user`,
-      })
-    },
-    // 控制音频播放
-    audioPlay() {
-      this.triggerEvent('playAudio')
     }
-  }
 })

+ 236 - 223
components/videoPreview/index.less

@@ -1,248 +1,261 @@
 .work {
-  margin-bottom: 24rpx;
-  background-color: white;
-  border-radius: 32rpx;
-  box-shadow: rgba(99, 99, 99, 0.1) 0px 2px 8px 0px;
-  padding-bottom: 20rpx;
-
-  .workHead {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    padding: 20rpx;
-
-    .wH-left {
-      display: flex;
-      justify-content: space-between;
-      align-items: center;
-
-      .avatar {
-        width: 80rpx;
-        height: 80rpx;
-        border-radius: 50%;
-        overflow: hidden;
-        background-color: rgb(228, 225, 225);
-      }
-
-      .wH-left-user {
-        margin-left: 18rpx;
-
-        .nickname {
-          max-width: 320rpx;
-          font-size: 30rpx;
-          font-weight: bold;
-          color: #000;
+    margin-bottom: 24rpx;
+    background-color: white;
+    border-radius: 32rpx;
+    box-shadow: rgba(99, 99, 99, 0.1) 0px 2px 8px 0px;
+    padding-bottom: 20rpx;
+
+    .workHead {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        padding: 20rpx;
+
+        .wH-left {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+
+            .avatar {
+                width: 80rpx;
+                height: 80rpx;
+                border-radius: 50%;
+                overflow: hidden;
+                background-color: rgb(228, 225, 225);
+            }
+
+            .wH-left-user {
+                margin-left: 18rpx;
+
+                .nickname {
+                    max-width: 320rpx;
+                    font-size: 30rpx;
+                    font-weight: bold;
+                    color: #000;
+                }
+
+                .time {
+                    margin-top: 4rpx;
+                    font-size: 26rpx;
+                    color: rgba(0, 0, 0, 0.6);
+                }
+            }
         }
 
-        .time {
-          margin-top: 4rpx;
-          font-size: 26rpx;
-          color: rgba(0, 0, 0, 0.6);
+        .wH-right {
+            display: flex;
+            align-items: center;
+
+            .wH-right-btn {
+                text-align: center;
+                margin-right: 30rpx;
+
+                .img {
+                    width: 27rpx;
+                    height: 32rpx;
+                }
+
+                .text {
+                    font-size: 26rpx;
+                    color: rgba(0, 0, 0, 0.74);
+                }
+            }
+
+            .follow {
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                width: 140rpx;
+                font-size: 24rpx;
+                padding: 8rpx 0rpx;
+                border-radius: 50rpx;
+                border: 1rpx solid #1BC665;
+                color: #1BC665;
+
+                .character {
+                    width: 22rpx;
+                    height: 22rpx;
+                    margin-right: 6rpx;
+                }
+            }
+
+            .isFans {
+                border: 1rpx solid #969696;
+                color: #969696;
+            }
+
+            .pkNum {
+                color: #30C866;
+                font-size: 44rpx;
+                margin-right: 20rpx;
+            }
         }
-      }
     }
 
-    .wH-right {
-      display: flex;
-      align-items: center;
-
-      .wH-right-btn {
-        text-align: center;
-        margin-right: 30rpx;
+    .workContent {
+        font-size: 0px;
+
+        .videoBox {
+            position: relative;
+            width: 100%;
+            height: 422rpx;
+
+            .maskBg {
+                position: absolute;
+                top: 0px;
+                left: 0px;
+                width: 100%;
+                height: 100%;
+                background-color: rgba(0, 0, 0, 0.5);
+            }
+
+            .maskImg {
+                z-index: 10;
+                width: 215rpx;
+                height: 215rpx;
+                position: absolute;
+                top: 0px;
+                right: 0px;
+                left: 0px;
+                bottom: 0px;
+                margin: auto;
+            }
+
+            .play {
+                position: absolute;
+                left: 50%;
+                top: 40%;
+                width: 90rpx;
+                height: 90rpx;
+                transform: translate(-50%);
+            }
+
+            .cover {
+                width: 100%;
+                height: 100%;
+            }
+        }
 
-        .img {
-          width: 27rpx;
-          height: 32rpx;
+        .video {
+            width: 100%;
+            height: 422rpx;
         }
 
-        .text {
-          font-size: 26rpx;
-          color: rgba(0, 0, 0, 0.74);
+        .audioBox {
+            position: relative;
+            height: 208rpx;
+            overflow: hidden;
+            display: flex;
+            align-items: center;
+
+            .readingTips {
+                position: absolute;
+                right: 14rpx;
+                bottom: 14rpx;
+                width: 32rpx;
+                height: 32rpx;
+                z-index: 2;
+                background-color: rgba(0, 0, 0, 0.28);
+                padding: 12rpx;
+                border-radius: 50%;
+
+            }
+
+            .audioBg {
+                position: absolute;
+                width: 100%;
+                height: 100%;
+            }
+
+            .audioPlay {
+                position: relative;
+                margin: 20rpx 10rpx 20rpx 120rpx;
+                width: 220rpx;
+                height: 174rpx;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+
+                .audioPlayBg {
+                    width: 150rpx;
+                    height: 150rpx;
+                }
+
+                .audioPlayZhen {
+                    position: absolute;
+                    right: 30rpx;
+                    top: 16rpx;
+                    width: 32rpx;
+                    height: 40rpx;
+                }
+
+                .cover {
+                    position: absolute;
+                    width: 130rpx;
+                    height: 130rpx;
+                    border-radius: 50%;
+                }
+
+                .circle {
+                    animation: identifier 12s infinite linear;
+                }
+            }
+
+            .titleBox {
+                position: relative;
+                width: 256rpx;
+                font-size: 30rpx;
+                line-height: 54rpx;
+                color: white;
+                text-align: center;
+            }
         }
-      }
+    }
 
-      .follow {
+    .workFooter {
+        margin-top: 15rpx;
         display: flex;
+        justify-content: space-between;
         align-items: center;
-        justify-content: center;
-        width: 140rpx;
-        font-size: 24rpx;
-        padding: 8rpx 0rpx;
-        border-radius: 50rpx;
-        border: 1rpx solid #1BC665;
-        color: #1BC665;
-
-        .character {
-          width: 22rpx;
-          height: 22rpx;
-          margin-right: 6rpx;
+        padding: 14rpx 20rpx 30rpx;
+
+        .mangeL-box {
+            display: flex;
+            align-items: center;
+            margin-right: 30rpx;
+
+            .icon {
+                width: 44rpx;
+                height: 44rpx;
+            }
+
+            .icon-name {
+                margin-left: 8rpx;
+                font-size: 28rpx;
+            }
         }
-      }
-
-      .isFans {
-        border: 1rpx solid #969696;
-        color: #969696;
-      }
-
-      .pkNum {
-        color: #30C866;
-        font-size: 44rpx;
-        margin-right: 20rpx;
-      }
-    }
-  }
-
-  .workContent {
-    font-size: 0px;
-
-    .videoBox {
-      position: relative;
-      width: 100%;
-      height: 422rpx;
-
-      .maskBg {
-        position: absolute;
-        top: 0px;
-        left: 0px;
-        width: 100%;
-        height: 100%;
-        background-color: rgba(0, 0, 0, 0.5);
-      }
-
-      .maskImg {
-        z-index: 10;
-        width: 215rpx;
-        height: 215rpx;
-        position: absolute;
-        top: 0px;
-        right: 0px;
-        left: 0px;
-        bottom: 0px;
-        margin: auto;
-      }
-
-      .play {
-        position: absolute;
-        left: 50%;
-        top: 40%;
-        width: 90rpx;
-        height: 90rpx;
-        transform: translate(-50%);
-      }
-
-      .cover {
-        width: 100%;
-        height: 100%;
-      }
     }
 
-    .video {
-      width: 100%;
-      height: 422rpx;
-    }
-
-    .audioBox {
-      position: relative;
-      height: 208rpx;
-      overflow: hidden;
-      display: flex;
-      align-items: center;
-
-      .audioBg {
-        position: absolute;
-        width: 100%;
-        height: 100%;
-      }
-
-      .audioPlay {
-        position: relative;
-        margin: 20rpx 10rpx 20rpx 120rpx;
-        width: 220rpx;
-        height: 174rpx;
+    .toReading {
+        width: 166rpx;
+        margin: 0 auto;
         display: flex;
         align-items: center;
         justify-content: center;
+        padding: 12rpx 32rpx;
+        border-radius: 50rpx;
+        background-image: linear-gradient(270deg, #33C3FF 0%, #81C7FF 100%, #14C962 100%);
+        box-shadow: 0 4rpx 10rpx 0 rgba(50, 197, 255, 0.46);
 
-        .audioPlayBg {
-          width: 150rpx;
-          height: 150rpx;
-        }
-
-        .audioPlayZhen {
-          position: absolute;
-          right: 30rpx;
-          top: 16rpx;
-          width: 32rpx;
-          height: 40rpx;
-        }
-
-        .cover {
-          position: absolute;
-          width: 130rpx;
-          height: 130rpx;
-          border-radius: 50%;
+        .reading {
+            width: 24rpx;
+            height: 32rpx;
         }
 
-        .circle {
-          animation: identifier 12s infinite linear;
+        .reading-text {
+            color: white;
+            font-size: 30rpx;
+            margin-left: 12rpx;
         }
-      }
-
-      .titleBox {
-        position: relative;
-        width: 256rpx;
-        font-size: 30rpx;
-        line-height: 54rpx;
-        color: white;
-        text-align: center;
-      }
-    }
-  }
-
-  .workFooter {
-    margin-top: 15rpx;
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    padding: 14rpx 20rpx 30rpx;
-
-    .mangeL-box {
-      display: flex;
-      align-items: center;
-      margin-right: 30rpx;
-
-      .icon {
-        width: 44rpx;
-        height: 44rpx;
-      }
-
-      .icon-name {
-        margin-left: 8rpx;
-        font-size: 28rpx;
-      }
-    }
-  }
-
-  .toReading {
-    width: 166rpx;
-    margin: 0 auto;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    padding: 12rpx 32rpx;
-    border-radius: 50rpx;
-    background-image: linear-gradient(270deg, #33C3FF 0%, #81C7FF 100%, #14C962 100%);
-    box-shadow: 0 4rpx 10rpx 0 rgba(50, 197, 255, 0.46);
-
-    .reading {
-      width: 24rpx;
-      height: 32rpx;
-    }
-
-    .reading-text {
-      color: white;
-      font-size: 30rpx;
-      margin-left: 12rpx;
     }
-  }
 }

+ 101 - 97
components/videoPreview/index.wxml

@@ -1,106 +1,110 @@
 <wxs src="../../utils/filter.wxs" module="filters" />
 <view class="work">
-  <view class="workHead">
-    <view class="wH-left">
-      <image src="{{videoInfoCopy.user.avatar}}" class="avatar" bindtap="jumpUserInfo" />
-      <view class="wH-left-user">
-        <view class="nickname textOver">{{videoInfoCopy.user.nickName||videoInfoCopy.user.eid}}</view>
-        <view class="time">{{videoInfoCopy.userRead.day}}</view>
-      </view>
-    </view>
-    <view class="wH-right" wx:if="{{videoType=='my'&&videoInfo.userRead.status!='CHECK'}}">
-      <view class="wH-right-btn" bindtap="download">
-        <image class="img" src="/static/down.png" mode="" />
-        <view class="text">下载</view>
-      </view>
-      <view class="wH-right-btn" bindtap="delete">
-        <image class=" img" style="width:24rpx" src="/static/delete.png" mode="" />
-        <view class="text">删除</view>
-      </view>
-      <view class="wH-right-btn" bindtap="setVideoPublic">
-        <image class="img" style="width:30rpx"
-          src="{{videoInfoCopy.userRead.status==='NORMAL'? '/static/unlock.png': '/static/lock.png'}}" />
-        <view class="text">
-          {{videoInfoCopy.userRead.status==='NORMAL'? '公开': '私密'}}
+    <view class="workHead">
+        <view class="wH-left">
+            <image src="{{videoInfoCopy.user.avatar}}" class="avatar" bindtap="jumpUserInfo" />
+            <view class="wH-left-user">
+                <view class="nickname textOver">{{videoInfoCopy.user.nickName||videoInfoCopy.user.eid}}</view>
+                <view class="time">{{videoInfoCopy.userRead.day}}</view>
+            </view>
         </view>
-      </view>
-    </view>
-    <view class="wH-right"
-      wx:elif="{{videoType=='public'&&selfUid!=videoInfoCopy.user.uid||videoType=='excellent'&&selfUid!=videoInfoCopy.user.uid}}">
-      <view class="follow {{videoInfoCopy.isFans?'isFans':''}}" bindtap="setFans">
-        <image src="{{videoInfoCopy.isFans?'/static/follow_2.png':'/static/follow_1.png'}}" class="character" mode="" />
-        <text class="text">{{videoInfoCopy.isFans?'已关注':'关注'}}</text>
-      </view>
-    </view>
-    <view class="wH-right" wx:elif="{{videoType=='pk'}}">
-      <view class="pkNum">
-        {{videoInfoCopy.userRead.score||'暂无评'}}分
-      </view>
-    </view>
-  </view>
-  <!-- 视频 -->
-  <view class="workContent" wx:if="{{!videoInfoCopy.userReadExtend||videoInfoCopy.userReadExtend.resourcesType==0}}">
-    <!-- 审核中遮罩 -->
-    <view class="videoBox" wx:if="{{videoInfoCopy.userRead.status=='CHECK'&&videoInfoCopy.userRead.id!=currentId}}">
-      <view class="maskBg"></view>
-      <image class="maskImg" src="/static/checking.png" />
-      <image class="cover" src="{{videoInfoCopy.userRead.coverImg}}" />
-    </view>
-    <!--未播放-->
-    <view class="videoBox" wx:if="{{videoInfoCopy.userRead.status!='CHECK'&&videoInfoCopy.userRead.id!=currentId}}"
-      bindtap="playVideo">
-      <image class="play" src="/static/play-btn.png" />
-      <image class="cover" src="{{videoInfoCopy.userRead.coverImg}}" />
-    </view>
-    <!-- 播放时渲染的video -->
-    <video class="video" id="myVideo" wx:if="{{videoInfoCopy.userRead.id==currentId}}"
-      src="{{videoInfoCopy.userRead.videoPath}}" autoplay="true" object-fit="contain">
-    </video>
-  </view>
-  <!-- 音频 -->
-  <view class="workContent" wx:else>
-    <view class="audioBox">
-      <image src=" {{videoInfoCopy.userReadExtend.backgroundVirtualImg}}" class="audioBg" mode="aspectFill" />
-      <view class="audioPlay" bindtap="audioPlay">
-        <image src="/static/audioBg.png" class="audioPlayBg {{videoInfoCopy.userRead.id==currentId?'circle':''}}" />
-        <image src="/static/zhen.png" class="audioPlayZhen" />
-        <image src="{{videoInfoCopy.userRead.coverImg}}"
-          class="cover {{videoInfoCopy.userRead.id==currentId?'circle':''}}" mode="" />
-      </view>
-      <view class="titleBox">
-        <view class="textOver">
-          {{videoInfoCopy.userRead.title}}
+        <view class="wH-right" wx:if="{{videoType=='my'&&videoInfo.userRead.status!='CHECK'}}">
+            <view class="wH-right-btn" bindtap="download">
+                <image class="img" src="/static/down.png" mode="" />
+                <view class="text">下载</view>
+            </view>
+            <view class="wH-right-btn" bindtap="delete">
+                <image class=" img" style="width:24rpx" src="/static/delete.png" mode="" />
+                <view class="text">删除</view>
+            </view>
+            <view class="wH-right-btn" bindtap="setVideoPublic">
+                <image class="img" style="width:30rpx"
+                    src="{{videoInfoCopy.userRead.status==='NORMAL'? '/static/unlock.png': '/static/lock.png'}}" />
+                <view class="text">
+                    {{videoInfoCopy.userRead.status==='NORMAL'? '公开': '私密'}}
+                </view>
+            </view>
+        </view>
+        <view class="wH-right"
+            wx:elif="{{videoType=='public'&&selfUid!=videoInfoCopy.user.uid||videoType=='excellent'&&selfUid!=videoInfoCopy.user.uid}}">
+            <view class="follow {{videoInfoCopy.isFans?'isFans':''}}" bindtap="setFans">
+                <image src="{{videoInfoCopy.isFans?'/static/follow_2.png':'/static/follow_1.png'}}" class="character"
+                    mode="" />
+                <text class="text">{{videoInfoCopy.isFans?'已关注':'关注'}}</text>
+            </view>
+        </view>
+        <view class="wH-right" wx:elif="{{videoType=='pk'}}">
+            <view class="pkNum">
+                {{videoInfoCopy.userRead.score||'暂无评'}}分
+            </view>
         </view>
-      </view>
-    </view>
-  </view>
-  <view class="workFooter" wx:if="{{videoInfo.userRead.status!='CHECK'}}">
-    <button class="resetBtn mangeL-box" open-type="share" data-info='{{videoInfo}}'>
-      <image src="/static/share.png" mode="" class="icon" />
-      <view class="icon-name">分享</view>
-    </button>
-    <view class="mangeL-box" bindtap="collect">
-      <image src="{{videoInfoCopy.isFavorites ? '/static/star_colored.png' : '/static/star.png'}}" mode=""
-        class="icon" />
-      <view class="icon-name">{{videoInfoCopy.isFavorites?'已收藏':'收藏'}}</view>
-    </view>
-    <view class="mangeL-box" bindtap="openComment">
-      <image src="/static/comment.png" mode="" class="icon" />
-      <view class="icon-name">{{filters.numFilter(videoInfoCopy.userRead.commentAmount)}}</view>
     </view>
-    <view class="mangeL-box" bindtap="likeVideo">
-      <image src="{{videoInfoCopy.isLike ? '/static/heart_colored.png' : '/static/heart.png'}}" mode="" class="icon" />
-      <view class="icon-name">{{filters.numFilter(videoInfoCopy.userRead.likeAmount)}}</view>
+    <!-- 视频 -->
+    <view class="workContent" wx:if="{{!videoInfoCopy.userReadExtend||videoInfoCopy.userReadExtend.resourcesType==0}}">
+        <!-- 审核中遮罩 -->
+        <view class="videoBox" wx:if="{{videoInfoCopy.userRead.status=='CHECK'&&videoInfoCopy.userRead.id!=currentId}}">
+            <view class="maskBg"></view>
+            <image class="maskImg" src="/static/checking.png" />
+            <image class="cover" src="{{videoInfoCopy.userRead.coverImg}}" />
+        </view>
+        <!--未播放-->
+        <view class="videoBox" wx:if="{{videoInfoCopy.userRead.status!='CHECK'&&videoInfoCopy.userRead.id!=currentId}}"
+            bindtap="playVideo">
+            <image class="play" src="/static/play-btn.png" />
+            <image class="cover" src="{{videoInfoCopy.userRead.coverImg}}" />
+        </view>
+        <!-- 播放时渲染的video -->
+        <video class="video" id="myVideo" wx:if="{{videoInfoCopy.userRead.id==currentId}}"
+            src="{{videoInfoCopy.userRead.videoPath}}" autoplay="true" object-fit="contain">
+        </video>
     </view>
-  </view>
-  <block wx:if="{{videoType!='my'}}">
-    <view class="toReading" bindtap="toPkPage" wx:if="{{videoInfo.userRead.type=='READ'}}">
-      <image src="/static/reading.png" class="reading" mode="" />
-      <view class="reading-text">挑战PK</view>
+    <!-- 音频 -->
+    <view class="workContent" wx:else>
+        <view class="audioBox" bindtap="audioPlay">
+            <image src="/static/readingNow.gif" class="readingTips" wx:if="{{videoInfoCopy.userRead.id==currentId}}" />
+            <image src=" {{videoInfoCopy.userReadExtend.backgroundVirtualImg}}" class="audioBg" mode="aspectFill" />
+            <view class="audioPlay">
+                <image src="/static/audioBg.png"
+                    class="audioPlayBg {{videoInfoCopy.userRead.id==currentId?'circle':''}}" />
+                <image src="/static/zhen.png" class="audioPlayZhen" />
+                <image src="{{videoInfoCopy.userRead.coverImg}}"
+                    class="cover {{videoInfoCopy.userRead.id==currentId?'circle':''}}" />
+            </view>
+            <view class="titleBox">
+                <view class="textOver" wx:for="{{videoInfoCopy.userRead.title}}" wx:key="index">
+                    {{item}}
+                </view>
+            </view>
+        </view>
     </view>
-    <view class="toReading" bindtap="toPkPage" wx:if="{{videoInfo.userRead.type=='EXAMPLE'}}">
-      <image src="/static/reading.png" class="reading" mode="" />
-      <view class="reading-text">去朗读</view>
+    <view class="workFooter" wx:if="{{videoInfo.userRead.status!='CHECK'}}">
+        <button class="resetBtn mangeL-box" open-type="share" data-info='{{videoInfo}}'>
+            <image src="/static/share.png" mode="" class="icon" />
+            <view class="icon-name">分享</view>
+        </button>
+        <view class="mangeL-box" bindtap="collect">
+            <image src="{{videoInfoCopy.isFavorites ? '/static/star_colored.png' : '/static/star.png'}}" mode=""
+                class="icon" />
+            <view class="icon-name">{{videoInfoCopy.isFavorites?'已收藏':'收藏'}}</view>
+        </view>
+        <view class="mangeL-box" bindtap="openComment">
+            <image src="/static/comment.png" mode="" class="icon" />
+            <view class="icon-name">{{filters.numFilter(videoInfoCopy.userRead.commentAmount)}}</view>
+        </view>
+        <view class="mangeL-box" bindtap="likeVideo">
+            <image src="{{videoInfoCopy.isLike ? '/static/heart_colored.png' : '/static/heart.png'}}" mode=""
+                class="icon" />
+            <view class="icon-name">{{filters.numFilter(videoInfoCopy.userRead.likeAmount)}}</view>
+        </view>
     </view>
-  </block>
+    <block wx:if="{{videoType!='my'}}">
+        <view class="toReading" bindtap="toPkPage" wx:if="{{videoInfo.userRead.type=='READ'}}">
+            <image src="/static/reading.png" class="reading" mode="" />
+            <view class="reading-text">挑战PK</view>
+        </view>
+        <view class="toReading" bindtap="toPkPage" wx:if="{{videoInfo.userRead.type=='EXAMPLE'}}">
+            <image src="/static/reading.png" class="reading" mode="" />
+            <view class="reading-text">去朗读</view>
+        </view>
+    </block>
 </view>

+ 11 - 0
components/videoPreview/index.wxss

@@ -128,6 +128,17 @@
   display: flex;
   align-items: center;
 }
+.work .workContent .audioBox .readingTips {
+  position: absolute;
+  right: 14rpx;
+  bottom: 14rpx;
+  width: 32rpx;
+  height: 32rpx;
+  z-index: 2;
+  background-color: rgba(0, 0, 0, 0.28);
+  padding: 12rpx;
+  border-radius: 50%;
+}
 .work .workContent .audioBox .audioBg {
   position: absolute;
   width: 100%;

+ 15 - 9
pages/reading/index.js

@@ -3,7 +3,8 @@ import {
 } from '~/api/video'
 import {
     publishWorks,
-    uploadPk
+    uploadPk,
+    postWorksScore
 } from '~/api/works'
 import {
     userEvent
@@ -241,9 +242,7 @@ Page({
             //TODO 调用feed接口传递音频片给驰声评测引擎
             wsEngine.feed({
                 data: frameBuffer, // frameBuffer为微信录音机回调的音频数据
-                success: () => {
-                    console.log('feed success.监听已录制完指定帧大小的文件事件')
-                },
+                success: () => {},
                 fail: (res) => {
                     console.log('监听已录制完指定帧大小报错', res)
                 },
@@ -264,7 +263,6 @@ Page({
     },
     // 获取测评结果
     getRecordScore(res) {
-        console.log('获取评测结果');
         const result = res.result;
         const integrity = Math.floor(result.integrity); //完成度
         const tone = Math.floor(result.tone); // 语调声调
@@ -311,13 +309,21 @@ Page({
                     exampleId: this.data.pkData.exampleId,
                     audioPath
                 })
-                console.log('uploadRes', uploadRes);
-                /*  let winnerUId = this.data.pkData > detail.myOverall ? this.data.pkData.exampleId : this.data.pkData < detail.myOverall ? detail.id : '' */
+                let _data = this.data.readDetail
+                postWorksScore({
+                    "userReadId": uploadRes.id,
+                    "complete": _data.integrity,
+                    "accuracy": _data.accuracy,
+                    "speed": _data.fluency,
+                    "intonation": _data.tone,
+                    "score": _data.myOverall
+                })
                 let data = {
                     challengerUserReadId: uploadRes.id,
                     userReadId: this.data.pkData.id,
                 }
-                await uploadPk(data)
+                let result = await uploadPk(data)
+                console.log(result, 'pk结果');
                 wx.redirectTo({
                     url: '/pages/pkResult/index'
                 })
@@ -394,7 +400,7 @@ Page({
         }
         await userEvent({
             action: 'READING',
-            readId:this.data.videoInfo.userRead.id
+            readId: this.data.videoInfo.userRead.id
         })
     },
     // 控制视频或音频的暂停状态

+ 32 - 32
pages/works/index.less

@@ -1,40 +1,40 @@
 .worksBox {
 
-  .selectType {
-    padding: 30rpx 15rpx 30rpx 26rpx;
-    display: flex;
-    align-items: center;
-    justify-content: space-between;
-    z-index: 20;
+    .selectType {
+        padding: 30rpx 15rpx 30rpx 26rpx;
+        display: flex;
+        align-items: center;
+        justify-content: space-around;
+        z-index: 20;
 
-    .type {
-      padding: 14rpx 0rpx;
-      width: 200rpx;
-      box-sizing: border-box;
-      text-align: center;
-      border: 1rpx solid #9f9f9fa4;
-      border-radius: 50rpx;
-      color: #1A1A1A;
-      font-size: 24rpx;
-    }
+        .type {
+            padding: 14rpx 0rpx;
+            width: 200rpx;
+            box-sizing: border-box;
+            text-align: center;
+            border: 1rpx solid #9f9f9fa4;
+            border-radius: 50rpx;
+            color: #1A1A1A;
+            font-size: 24rpx;
+        }
 
-    .currentType {
-      border: none;
-      box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
-      background-color: white;
-      font-weight: bold;
-    }
+        .currentType {
+            border: none;
+            box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
+            background-color: white;
+            font-weight: bold;
+        }
 
-    .search {
-      padding: 8rpx 20rpx;
-      text-align: center;
-      border: 1rpx solid #9f9f9fa4;
-      border-radius: 50rpx;
+        .search {
+            padding: 8rpx 20rpx;
+            text-align: center;
+            border: 1rpx solid #9f9f9fa4;
+            border-radius: 50rpx;
 
-      .searchImg {
-        width: 26rpx;
-        height: 26rpx;
-      }
+            .searchImg {
+                width: 26rpx;
+                height: 26rpx;
+            }
+        }
     }
-  }
 }

+ 1 - 1
pages/works/index.wxss

@@ -2,7 +2,7 @@
   padding: 30rpx 15rpx 30rpx 26rpx;
   display: flex;
   align-items: center;
-  justify-content: space-between;
+  justify-content: space-around;
   z-index: 20;
 }
 .worksBox .selectType .type {