bayi 2 年之前
父节点
当前提交
eb752b8920
共有 4 个文件被更改,包括 29 次插入10 次删除
  1. 3 3
      components/uploadFile/index.js
  2. 13 5
      pages/pkResult/index.js
  3. 2 2
      pages/pkResult/index.wxml
  4. 11 0
      pages/reading/index.js

+ 3 - 3
components/uploadFile/index.js

@@ -88,10 +88,10 @@ Component({
         "originVideo": this.data.readDetail.originVideo,
       };
       let res
-      if (!this.properties.readingType) {
-        res = await publishWorks(data)
-      } else {
+      if (this.properties.readingType == 'readMatch') {
         res = await publishRankWorks(data)
+      } else {
+        res = await publishWorks(data)
       }
       wx.setStorageSync('shareVideoId', res.id)
       let _data = this.data.readDetail

+ 13 - 5
pages/pkResult/index.js

@@ -36,7 +36,7 @@ Page({
       pkRecord,
       pkRecordVOS
     } = await getPkResult(options.id)
-    console.log(pkRecord,
+    console.log(options.id, pkRecord,
       pkRecordVOS);
     this.setData({
       pkId: options.id,
@@ -50,12 +50,12 @@ Page({
     let first = resultData[0]
     let second = resultData[1]
     let victory = first.userRead.score > second.userRead.score ? first : second
-    let defeated = second.userRead.score <= first.userRead.score ? second : first
+    let defeated = second.userRead.score < first.userRead.score ? second : first
     this.setData({
       equal: first.userRead.score == second.userRead.score,
       victory: first.userRead.score > second.userRead.score ? first : second,
       defeated,
-      vEnd:setDuration(victory.userRead.duration),
+      vEnd: setDuration(victory.userRead.duration),
       dEnd: setDuration(defeated.userRead.duration),
     })
   },
@@ -170,10 +170,18 @@ Page({
             ctx.textAlign = "center";
             var lnamex = this.data.equal ? 100 : 100,
               lnamey = this.data.equal ? 125 : 115;
-            ctx.fillText(this.data.victory.user.nickName, lnamex, lnamey)
+            var vName = this.data.victory.user.nickName || this.data.victory.user.eid
+            if (vName.length > 4) {
+              vName = vName.slice(0, 4) + '...'
+            }
+            ctx.fillText(vName, lnamex, lnamey)
             var rnamex = this.data.equal ? 280 : 280,
               rnamey = this.data.equal ? 125 : 140;
-            ctx.fillText(this.data.defeated.user.nickName, rnamex, rnamey)
+            var dName = this.data.defeated.user.nickName || this.data.defeated.user.eid
+            if (dName.length > 4) {
+              dName = dName.slice(0, 4) + '...'
+            }
+            ctx.fillText(dName, rnamex, rnamey)
             ctx.font = '19px PingFang';
             var lnumx = this.data.equal ? 100 : 100,
               lnumy = this.data.equal ? 150 : 140;

+ 2 - 2
pages/pkResult/index.wxml

@@ -5,7 +5,7 @@
   <view class="body">
     <view class="left {{equal?'equal':''}}">
       <image src="{{victory.user.avatar}}" class="avatar avatarL" />
-      <view class="bodyTitle textOver">{{victory.user.nickName}}</view>
+      <view class="bodyTitle textOver">{{victory.user.nickName||victory.user.eid}}</view>
       <view class="bodyScore">{{victory.userRead.score}}分</view>
       <image src="{{vState?'/static/work.png':'/static/play-big.png'}}" class="bodyPlay" bindtap="playAudio"
         data-type="victory" />
@@ -17,7 +17,7 @@
     </view>
     <view class="right {{equal?'equalRight':''}}">
       <image src="{{defeated.user.avatar}}" class="avatar avatarR" />
-      <view class="bodyTitle textOver">{{defeated.user.nickName}}</view>
+      <view class="bodyTitle textOver">{{defeated.user.nickName||defeated.user.eid}}</view>
       <view class="bodyScore">{{defeated.userRead.score}}分</view>
       <image src="{{dState?'/static/work.png':'/static/play-big.png'}}" class="bodyPlay" bindtap="playAudio"
         data-type="defeated" />

+ 11 - 0
pages/reading/index.js

@@ -67,6 +67,7 @@ Page({
   },
   onLoad(options) {
     let videoId = options.videoId
+    console.log(videoId);
     this.getreadInfo(videoId, options.reset)
     this.setData({
       readingReset: options.reset || false,
@@ -311,6 +312,7 @@ Page({
   },
   // 获取测评结果
   getRecordScore(res) {
+    console.log('评测结果:', res);
     const result = res.result;
     const integrity = Math.floor(result.integrity); //完成度
     const tone = Math.floor(result.tone); // 语调声调
@@ -360,6 +362,14 @@ Page({
           audioPath
         })
         let _data = this.data.readDetail
+        console.log('挑战分数-----:', {
+          "userReadId": uploadRes.id,
+          "complete": _data.integrity,
+          "accuracy": _data.accuracy,
+          "speed": _data.fluency,
+          "intonation": _data.tone,
+          "score": _data.myOverall
+        });
         postWorksScore({
           "userReadId": uploadRes.id,
           "complete": _data.integrity,
@@ -373,6 +383,7 @@ Page({
           userReadId: this.data.pkData.id,
           winnerUId: this.data.pkData.score > _data.myOverall ? this.data.pkData.uid : this.data.pkData.score == _data.myOverall ? '' : wx.getStorageSync('uid')
         }
+        console.log('uploadPk-----', data);
         let result = await uploadPk(data)
         wx.redirectTo({
           url: `/pages/pkResult/index?id=${result.id}`