bayi 1 ano atrás
pai
commit
59e35ac839
4 arquivos alterados com 251 adições e 30 exclusões
  1. 208 22
      pages/pkResult/index.js
  2. 25 4
      pages/pkResult/index.less
  3. 2 2
      pages/pkResult/index.wxml
  4. 16 2
      pages/pkResult/index.wxss

+ 208 - 22
pages/pkResult/index.js

@@ -28,6 +28,7 @@ Page({
         victory: {},
         defeated: {},
         equal: false,
+        win: false,
         // 是否是分享进来的
         isPlayback: false
     },
@@ -39,7 +40,6 @@ Page({
             pkRecord,
             pkRecordVOS
         } = await getPkResult(options.id)
-        console.log(pkRecordVOS);
         this.setData({
             pkId: options.id,
             pkRecord,
@@ -62,12 +62,197 @@ Page({
     compareScore(resultData) {
         let first = resultData[0]
         let second = resultData[1]
+      /*   let first = {
+            "readMaskTemplate": null,
+            "user": {
+                "avatar": "http://reader-wx.ai160.com/images/reader/v3/boy.png",
+                "birthday": null,
+                "channel": "3001",
+                "eid": "100511330001627",
+                "gender": 1,
+                "gmtCreated": 1676011831000,
+                "gmtModified": 1695283827000,
+                "grade": "PRIMARY_SENIOR_GRADE",
+                "loginDay": 0,
+                "logoutDate": null,
+                "mCount": null,
+                "messageCount": null,
+                "mobile": "",
+                "myCount": null,
+                "nickName": "",
+                "openId": "oWMml5LoKweewL78KYbkPoWL3taQ",
+                "profession": "学生",
+                "recOsType": null,
+                "recStatus": null,
+                "recUid": "",
+                "saleShareUid": "",
+                "saleUserId": null,
+                "schoolCity": "",
+                "schoolName": "",
+                "schoolProvince": "",
+                "shareUid": "",
+                "sourceType": "",
+                "statusEnum": "NORMAL",
+                "uid": "95d8d8f0815f44cfa9b9245b52eff5c4",
+                "unionId": "o8sgct5tbZfWQBv3Dd595sLS_ZZ4",
+                "userId": "",
+                "vipType": 0,
+                "wechatName": ""
+            },
+            "userRead": {
+                "activityId": null,
+                "audioPath": "https://reader-wx.ai160.com/reader/resource/20230215/1676453639830669.mp3",
+                "backgroundVideoNumber": "",
+                "backgroundVirtualImg": "",
+                "businessType": null,
+                "channel": "3001",
+                "commentAmount": 13,
+                "courseWareNumber": "",
+                "coverImg": "http://reader-wx.ai160.com/images/reader/v3/readIcon/SCJX.jpg",
+                "day": "2023-02-15",
+                "demoVideoNumber": "",
+                "duration": 20,
+                "eid": "",
+                "exampleId": 1675912836219052,
+                "favoritesAmount": 0,
+                "gmtCreated": 1676453641000,
+                "gmtModified": 1702345703000,
+                "grade": null,
+                "iconImg": "",
+                "id": 1676453641062792,
+                "lessonText": "",
+                "lessonText2": "",
+                "likeAmount": 2,
+                "markPath": "https://reader-wx.ai160.com/reader/resource/markVideo/1676453641062792.mp4",
+                "nickName": "",
+                "originVideo": "http://reader-wx.ai160.com/audio/reader/001/LD00103248/LD00103248005-2.mp3",
+                "playAmount": 358,
+                "resourcesType": null,
+                "score": 19,
+                "shareAmount": 0,
+                "shareImg": "",
+                "sort": 0,
+                "status": "NORMAL",
+                "summary": "",
+                "tag": "",
+                "title": "一剪梅\n[ 宋 ] 李清照",
+                "traceId": "3c6eb4c15961d904812cd2dccf422b12",
+                "type": "READ",
+                "uid": "95d8d8f0815f44cfa9b9245b52eff5c4",
+                "videoPath": "https://reader-wx.ai160.com/reader/resource/video/1676453641062792.mp4"
+            },
+            "userReadExtend": {
+                "backgroundVideoNumber": "LD00103248005-2",
+                "backgroundVirtualImg": "http://reader-wx.ai160.com/images/reader/v3/readIcon/SCJXBJ.jpg",
+                "businessType": 0,
+                "courseWareNumber": "LD00103248005",
+                "demoVideoNumber": "LD00103248005-1",
+                "id": 1675912836252266,
+                "readMaskId": 1,
+                "resourcesType": 1,
+                "userReadId": 1675912836219052
+            }
+        }
+        let second = {
+            "readMaskTemplate": null,
+            "user": {
+                "avatar": "http://reader-wx.ai160.com/images/reader/v3/boy.png",
+                "birthday": 1388505600000,
+                "channel": "3001",
+                "eid": "110010060125671",
+                "gender": 1,
+                "gmtCreated": 1699323582000,
+                "gmtModified": 1702023595000,
+                "grade": "PRIMARY_FIRST_GRADE",
+                "loginDay": 0,
+                "logoutDate": null,
+                "mCount": null,
+                "messageCount": null,
+                "mobile": "",
+                "myCount": null,
+                "nickName": "测试",
+                "openId": "oWMml5GGONTsOiIDIW-kTvdNIZjI",
+                "profession": "老师",
+                "recOsType": null,
+                "recStatus": null,
+                "recUid": "",
+                "saleShareUid": "",
+                "saleUserId": null,
+                "schoolCity": "",
+                "schoolName": "",
+                "schoolProvince": "",
+                "shareUid": "",
+                "sourceType": "",
+                "statusEnum": "NORMAL",
+                "uid": "d83d947655f6455a96f4197d31afa6d4",
+                "unionId": "o8sgct3D71o7iS8V-CvuDOsT_0kQ",
+                "userId": "",
+                "vipType": 0,
+                "wechatName": ""
+            },
+            "userRead": {
+                "activityId": null,
+                "audioPath": "https://reader-wx.ai160.com/reader/resource/20231212/1702345717581444.mp3",
+                "backgroundVideoNumber": "",
+                "backgroundVirtualImg": "",
+                "businessType": null,
+                "channel": "3001",
+                "commentAmount": 0,
+                "courseWareNumber": "",
+                "coverImg": "http://reader-wx.ai160.com/images/reader/v3/readIcon/SCJX.jpg",
+                "day": "2023-12-12",
+                "demoVideoNumber": "",
+                "duration": 3,
+                "eid": "",
+                "exampleId": 1675912836219052,
+                "favoritesAmount": 0,
+                "gmtCreated": 1702345717000,
+                "gmtModified": 1702345717000,
+                "grade": null,
+                "iconImg": "",
+                "id": 1702345717919478,
+                "lessonText": "",
+                "lessonText2": "",
+                "likeAmount": 0,
+                "markPath": "https://reader-wx.ai160.com/reader/resource/markVideo/1702345717919478.mp4",
+                "nickName": "",
+                "originVideo": "http://reader-wx.ai160.com/audio/reader/001/LD00103248/LD00103248005-2.mp3",
+                "playAmount": 0,
+                "resourcesType": null,
+                "score": 19,
+                "shareAmount": 0,
+                "shareImg": "",
+                "sort": 0,
+                "status": "CHECK",
+                "summary": "",
+                "tag": "",
+                "title": "一剪梅\n[ 宋 ] 李清照",
+                "traceId": "396d30110403fd2d8ee5b73f9b7853bc",
+                "type": "READ",
+                "uid": "d83d947655f6455a96f4197d31afa6d4",
+                "videoPath": "https://reader-wx.ai160.com/reader/resource/video/1702345717919478.mp4"
+            },
+            "userReadExtend": {
+                "backgroundVideoNumber": "LD00103248005-2",
+                "backgroundVirtualImg": "http://reader-wx.ai160.com/images/reader/v3/readIcon/SCJXBJ.jpg",
+                "businessType": 0,
+                "courseWareNumber": "LD00103248005",
+                "demoVideoNumber": "LD00103248005-1",
+                "id": 1675912836252266,
+                "readMaskId": 1,
+                "resourcesType": 1,
+                "userReadId": 1675912836219052
+            }
+        } */
         let victory = first.userRead.score > second.userRead.score ? first : second
         let defeated = second.userRead.score < first.userRead.score ? second : first
+        let uid = wx.getStorageSync('uid')
+        let equal = first.userReadExtend.businessType != 2 ? first.userRead.score == second.userRead.score : true
         this.setData({
-            equal: first.userReadExtend.businessType != 2 ? first.userRead.score == second.userRead.score : true,
             victory,
             defeated,
+            equal,
+            win: !equal && victory.userRead.uid == uid,
             vEnd: setDuration(victory.userRead.duration),
             dEnd: setDuration(defeated.userRead.duration),
         })
@@ -160,47 +345,48 @@ Page({
                     canvas.height = res[0].height * dpr;
                     ctx.scale(dpr, dpr);
                     ctx.font = '16px PingFang';
+                    ctx.fillStyle = '#F2F6FC';
                     let bgImg = canvas.createImage();
-                    bgImg.src = this.data.equal ? 'https://reader-wx.ai160.com/images/reader/v3/equal.png' : 'https://reader-wx.ai160.com/images/reader/v3/victory.png'
+                    bgImg.src = this.data.win ? 'https://reader-wx.ai160.com/images/reader/v3/win-share.jpg' : this.data.equal ? 'https://reader-wx.ai160.com/images/reader/v3/equal-share.jpg' : 'https://reader-wx.ai160.com/images/reader/v3/lose-share.jpg'
                     bgImg.onload = () => {
                         ctx.drawImage(bgImg, 0, 0, 375, 300);
                         ctx.textAlign = "center";
-                        var lnamex = this.data.equal ? 100 : 100,
-                            lnamey = this.data.equal ? 125 : 115;
+                        var lnamex = 100,
+                            lnamey = 205;
                         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;
+                        var rnamex = 280,
+                            rnamey = 205;
                         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';
+                        ctx.font = '20px PingFang';
                         if (this.data.victory.userReadExtend.businessType != 2) {
-                            var lnumx = this.data.equal ? 100 : 100,
-                                lnumy = this.data.equal ? 150 : 140;
+                            var lnumx = 100,
+                                lnumy = 230;
                             ctx.fillText(this.data.victory.userRead.score + '分', lnumx, lnumy)
-                            var rnumx = this.data.equal ? 280 : 280,
-                                rnumy = this.data.equal ? 150 : 165;
+                            var rnumx = 280,
+                                rnumy = 230;
                             ctx.fillText(this.data.defeated.userRead.score + '分', rnumx, rnumy)
                         }
-                        ctx.font = '13px PingFang';
-                        var ltimex = this.data.equal ? 136 : 136,
-                            ltimey = this.data.equal ? 252.5 : 239.5;
-                        ctx.fillText(this.data.vEnd, ltimex, ltimey)
-                        var rtimex = this.data.equal ? 320 : 320,
-                            rtimey = this.data.equal ? 253 : 267;
-                        ctx.fillText(this.data.dEnd, rtimex, rtimey)
+                        ctx.font = '15px PingFang';
+                        var ltimex = 88,
+                            ltimey = 288;
+                        ctx.fillText(`${this.data.vStart}/${this.data.vEnd}`, ltimex, ltimey)
+                        var rtimex = 280,
+                            rtimey = 288;
+                        ctx.fillText(`${this.data.dStart}/${this.data.dEnd}`, rtimex, rtimey)
                         // 圆形位置 大小
-                        var size = 55;
+                        var size = 62;
                         var lx = this.data.equal ? 71 : 72,
-                            ly = this.data.equal ? 45 : 38;
+                            ly = 120;
                         var rx = this.data.equal ? 252 : 247,
-                            ry = this.data.equal ? 45 : 60;
+                            ry = 120;
                         ctx.save(); // 保存
                         ctx.arc(size / 2 + lx, size / 2 + ly, size / 2, 0, Math.PI * 2, false);
                         ctx.arc(size / 2 + rx, size / 2 + ry, size / 2, 0, Math.PI * 2, false);

+ 25 - 4
pages/pkResult/index.less

@@ -12,8 +12,7 @@
         position: relative;
         width: 600rpx;
         height: 674rpx;
-        background: url('https://reader-wx.ai160.com/images/reader/v3/win.png') no-repeat;
-        background-size: 100% 100%;
+
 
         .userBox {
             position: absolute;
@@ -24,6 +23,7 @@
             height: 514rpx;
             text-align: center;
             color: white;
+
             .avatar {
                 width: 110rpx;
                 height: 110rpx;
@@ -79,13 +79,29 @@
             .duration {
                 padding-right: 20rpx;
                 text-align: right;
-                .time{
+
+                .time {
                     justify-content: flex-end;
                 }
             }
         }
     }
 
+    .body-win {
+        background: url('https://reader-wx.ai160.com/images/reader/v3/win.png') no-repeat;
+        background-size: 100% 100%;
+    }
+
+    .body-lose {
+        background: url('https://reader-wx.ai160.com/images/reader/v3/lose.png') no-repeat;
+        background-size: 100% 100%;
+    }
+
+    .body-equal {
+        background: url('https://reader-wx.ai160.com/images/reader/v3/equal.png') no-repeat;
+        background-size: 100% 100%;
+    }
+
     .footer {
         width: 600rpx;
         margin-top: 96rpx;
@@ -122,4 +138,9 @@
             }
         }
     }
-}
+}
+
+/* #share {
+    left: 0;
+    top: 0;
+} */

+ 2 - 2
pages/pkResult/index.wxml

@@ -1,6 +1,6 @@
 <wxs src="../../utils/filter.wxs" module="filters" />
 <view class="pkResult">
-    <view class="body">
+    <view class="body {{win?'body-win':equal?'body-equal':'body-lose'}}">
         <view class="userBox left">
             <image src="{{victory.user.avatar}}" class="avatar avatarL" />
             <view class="bodyTitle textOver">{{victory.user.nickName||victory.user.eid}}</view>
@@ -27,7 +27,7 @@
     <view class="footer" wx:if="{{!isplayback}}">
         <view class="stBtn" bindtap="result" data-type="reading">
             <image src="/static/pr1.png" class="imgBtn" />
-            <view class="text">重新调整</view>
+            <view class="text">重新挑战</view>
         </view>
         <button class="resetBtn stBtn" open-type="share">
             <image src="/static/pr2.png" class="imgBtn" />

+ 16 - 2
pages/pkResult/index.wxss

@@ -12,8 +12,6 @@
   position: relative;
   width: 600rpx;
   height: 674rpx;
-  background: url('https://reader-wx.ai160.com/images/reader/v3/win.png') no-repeat;
-  background-size: 100% 100%;
 }
 .pkResult .body .userBox {
   position: absolute;
@@ -75,6 +73,18 @@
 .pkResult .body .right .duration .time {
   justify-content: flex-end;
 }
+.pkResult .body-win {
+  background: url('https://reader-wx.ai160.com/images/reader/v3/win.png') no-repeat;
+  background-size: 100% 100%;
+}
+.pkResult .body-lose {
+  background: url('https://reader-wx.ai160.com/images/reader/v3/lose.png') no-repeat;
+  background-size: 100% 100%;
+}
+.pkResult .body-equal {
+  background: url('https://reader-wx.ai160.com/images/reader/v3/equal.png') no-repeat;
+  background-size: 100% 100%;
+}
 .pkResult .footer {
   width: 600rpx;
   margin-top: 96rpx;
@@ -107,3 +117,7 @@
   color: #FFFFFF;
   letter-spacing: 2rpx;
 }
+/* #share {
+    left: 0;
+    top: 0;
+} */