Browse Source

开发pk动画与音乐

bayi 1 year ago
parent
commit
bec1d6bc68

+ 191 - 184
pages/pkResult/index.js

@@ -45,7 +45,6 @@ Page({
             pkRecord,
             pkRecord,
             isplayback: options.playback || false
             isplayback: options.playback || false
         })
         })
-        this.compareScore(pkRecordVOS)
         this.innerAudioContext = wx.createInnerAudioContext()
         this.innerAudioContext = wx.createInnerAudioContext()
         this.innerAudioContext.onEnded(res => {
         this.innerAudioContext.onEnded(res => {
             let label = this.data.currentType == 'victory' ? 'vStart' : 'dStart'
             let label = this.data.currentType == 'victory' ? 'vStart' : 'dStart'
@@ -55,6 +54,9 @@ Page({
                 dState: false,
                 dState: false,
             })
             })
         })
         })
+        // this.compareScore()
+        this.compareScore(pkRecordVOS)
+
         await userEvent({
         await userEvent({
             action: 'WXPKSCORE',
             action: 'WXPKSCORE',
         })
         })
@@ -62,200 +64,205 @@ Page({
     compareScore(resultData) {
     compareScore(resultData) {
         let first = resultData[0]
         let first = resultData[0]
         let second = resultData[1]
         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 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": 100,
+                "shareAmount": 0,
+                "shareImg": "",
+                "sort": 0,
+                "status": "CHECK",
+                "summary": "",
+                "tag": "",
+                "title": "一剪梅\n[ 宋 ] 李清照",
+                "traceId": "396d30110403fd2d8ee5b73f9b7853bc",
+                "type": "READ",
+                "uid": "9db2bedb2b9b47c5b0358bb9bec39145",
+                "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 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
         let uid = wx.getStorageSync('uid')
         let uid = wx.getStorageSync('uid')
         let equal = first.userReadExtend.businessType != 2 ? first.userRead.score == second.userRead.score : true
         let equal = first.userReadExtend.businessType != 2 ? first.userRead.score == second.userRead.score : true
+        let win = !equal && victory.userRead.uid == uid
         this.setData({
         this.setData({
             victory,
             victory,
             defeated,
             defeated,
             equal,
             equal,
-            win: !equal && victory.userRead.uid == uid,
+            win,
             vEnd: setDuration(victory.userRead.duration),
             vEnd: setDuration(victory.userRead.duration),
             dEnd: setDuration(defeated.userRead.duration),
             dEnd: setDuration(defeated.userRead.duration),
         })
         })
+        if (!this.data.isplayback) {
+            this.innerAudioContext.src = win || equal ? '/static/music/win.mp3' : '/static/music/lose.mp3'
+            this.innerAudioContext.play();
+        }
     },
     },
     playAudio({
     playAudio({
         currentTarget
         currentTarget

+ 8 - 1
pages/pkResult/index.less

@@ -13,7 +13,6 @@
         width: 600rpx;
         width: 600rpx;
         height: 674rpx;
         height: 674rpx;
 
 
-
         .userBox {
         .userBox {
             position: absolute;
             position: absolute;
             bottom: 0;
             bottom: 0;
@@ -84,6 +83,14 @@
                 }
                 }
             }
             }
         }
         }
+
+        .celebrate {
+            position: absolute;
+            left:20rpx;
+            top: -160rpx;
+            width: 600rpx;
+            height: 600rpx;
+        }
     }
     }
 
 
     .body-win {
     .body-win {

+ 1 - 0
pages/pkResult/index.wxml

@@ -1,6 +1,7 @@
 <wxs src="../../utils/filter.wxs" module="filters" />
 <wxs src="../../utils/filter.wxs" module="filters" />
 <view class="pkResult">
 <view class="pkResult">
     <view class="body {{win?'body-win':equal?'body-equal':'body-lose'}}">
     <view class="body {{win?'body-win':equal?'body-equal':'body-lose'}}">
+        <image src="https://reader-wx.ai160.com/images/reader/v3/biu.gif" class="celebrate" wx:if="{{win||equal}}"/>
         <view class="userBox left">
         <view class="userBox left">
             <image src="{{victory.user.avatar}}" class="avatar avatarL" />
             <image src="{{victory.user.avatar}}" class="avatar avatarL" />
             <view class="bodyTitle textOver">{{victory.user.nickName||victory.user.eid}}</view>
             <view class="bodyTitle textOver">{{victory.user.nickName||victory.user.eid}}</view>

+ 7 - 0
pages/pkResult/index.wxss

@@ -72,6 +72,13 @@
 .pkResult .body .right .duration .time {
 .pkResult .body .right .duration .time {
   justify-content: flex-end;
   justify-content: flex-end;
 }
 }
+.pkResult .body .celebrate {
+  position: absolute;
+  left: 20rpx;
+  top: -160rpx;
+  width: 600rpx;
+  height: 600rpx;
+}
 .pkResult .body-win {
 .pkResult .body-win {
   background: url('https://reader-wx.ai160.com/images/reader/v3/win.png') no-repeat;
   background: url('https://reader-wx.ai160.com/images/reader/v3/win.png') no-repeat;
   background-size: 100% 100%;
   background-size: 100% 100%;

BIN
static/music/lose.mp3


BIN
static/music/win.mp3


+ 4 - 3
小咖秀公众号支付/index.html

@@ -51,15 +51,16 @@
       border-color: #ff935e;
       border-color: #ff935e;
     }
     }
     .c-1 {
     .c-1 {
-      background: url('http://reader-wx.ai160.com/images/reader/v3/299.png') no-repeat;
-      background-size: contain;
+      background-size: contain;  
+      background: url('http://reader-wx.ai160.com/images/reader/v3/15.png') no-repeat;
     }
     }
     .c-2 {
     .c-2 {
       background: url('http://reader-wx.ai160.com/images/reader/v3/99.png') no-repeat;
       background: url('http://reader-wx.ai160.com/images/reader/v3/99.png') no-repeat;
       background-size: contain;
       background-size: contain;
     }
     }
     .c-3 {
     .c-3 {
-      background: url('http://reader-wx.ai160.com/images/reader/v3/15.png') no-repeat;
+    
+      background: url('http://reader-wx.ai160.com/images/reader/v3/299.png') no-repeat;
       background-size: contain;
       background-size: contain;
     }
     }
     .payBox {
     .payBox {