Jelajahi Sumber

区分朗读赛

bayi 2 tahun lalu
induk
melakukan
06b430f42a

+ 3 - 1
components/uploadFile/index.js

@@ -27,7 +27,8 @@ Component({
    * 组件的属性列表
    */
   properties: {
-    readingType: ''
+    readingType: '',
+    activityId: ''
   },
   /**
    * 组件的初始数据
@@ -92,6 +93,7 @@ Component({
         exampleId: this.data.readDetail.id,
         audioPath: audio,
         originVideo: this.data.readDetail.originVideo,
+        activityId: this.properties.activityId
       };
       let res
       if (this.properties.readingType == 'readMatch') {

+ 6 - 3
pages/reading/index.js

@@ -63,7 +63,9 @@ Page({
       currentTime: '00:00',
       endTime: '00:00',
       silderValue: 0
-    }
+    },
+    // 朗读赛的id
+    activityId: ''
   },
   onLoad(options) {
     console.log(options);
@@ -82,7 +84,8 @@ Page({
     this.setData({
       readingReset: options.reset || false,
       readingType: options.readingType || 'public',
-      uploadHide: options.uploadHide
+      uploadHide: options.uploadHide,
+      activityId: options.activityId || ''
     })
     // 手工绑定 
     this.storeBindings = createStoreBindings(this, {
@@ -368,7 +371,7 @@ Page({
     this.setReadDetail(detail)
     if (this.data.readingType == 'public' || this.data.readingType == 'readMatch') {
       wx.navigateTo({
-        url: `/pages/score/index?readingType=${this.data.readingType}`,
+        url: `/pages/score/index?readingType=${this.data.readingType}&activityId=${this.data.activityId}`,
         events: {
           // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
           goback: (data) => {

+ 3 - 2
pages/reading/index.wxml

@@ -95,12 +95,13 @@
   </view>
   <view class="controller">
     <image wx:if="{{state}}" src="/static/readingNow.gif" class="readingNow" bindtap="setCountDown" />
-    <!-- <image wx:else src="/static/work.png" class="playImg" bindtap="eeeeee" /> -->
+    <!--     <image wx:else src="/static/work.png" class="playImg" bindtap="eeeeee" /> -->
     <image wx:else src="/static/work.png" class="playImg" bindtap="setCountDown" />
     <view class="text">
       {{state?'完成录制':readingReset?'点击重录':readingType=='public'||readingType=='readMatch'?'开始朗读':'开始挑战'}}</view>
     <block wx:if="{{readingReset}}">
-      <uploadFile class="btnPosition" wx:if="{{!uploadHide}}" />
+      <uploadFile activityId='{{activityId}}' readingType='{{readingType}}' class="btnPosition"
+        wx:if="{{!uploadHide}}" />
       <view class="stBtn" bindtap="backReading">退出</view>
     </block>
   </view>

+ 55 - 51
pages/score/index.js

@@ -15,13 +15,16 @@ Page({
     score: {},
     // 目前用来处理区分上传普通作品还是朗读赛作品
     readingType: '',
-    uploadHide: ''
+    uploadHide: '',
+    // 朗读赛的id
+    activityId: ''
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   async onLoad(options) {
+    console.log(options);
     this.storeBindings = createStoreBindings(this, {
       store,
       fields: {
@@ -36,7 +39,8 @@ Page({
     })
     this.setData({
       score,
-      readingType: options.readingType ? options.readingType : ''
+      readingType: options.readingType ? options.readingType : '',
+      activityId: options.activityId
     })
     await userEvent({
       action: 'WXSCORE',
@@ -164,55 +168,55 @@ Page({
               }
             }
           }
-         /*  let peiyin = canvas.createImage();
-          peiyin.src = '/static/peiyin.jpg';
-          peiyin.onload = () => {
-            ctx.drawImage(peiyin, 0, 211, 375, 89);
-            //分享
-            let fx = canvas.createImage();
-            fx.src = '/static/share.png'
-            fx.onload = () => {
-              ctx.drawImage(fx, 12, 220, 20, 20)
-              ctx.fillText('分享', 36, 238)
-              // 收藏,一个一个渲染
-              let sc = canvas.createImage();
-              sc.src = '/static/no_collect.png'
-              sc.onload = () => {
-                ctx.drawImage(sc, 110, 220, 19, 19)
-                ctx.fillText('收藏', 134, 238)
-                //点赞
-                let dz = canvas.createImage();
-                dz.src = '/static/heart.png'
-                dz.onload = () => {
-                  ctx.drawImage(dz, 318, 222, 22, 22)
-                  ctx.fillText(0, 254, 238)
-                  // 评论
-                  let pl = canvas.createImage();
-                  pl.src = '/static/comment.png'
-                  pl.onload = () => {
-                    ctx.drawImage(pl, 228, 222, 22, 22)
-                    ctx.fillText(0, 340, 238)
-                    setTimeout(() => {
-                      wx.canvasToTempFilePath({
-                        canvas: canvas,
-                        success(res) {
-                          console.log(wx.getStorageSync('shareVideoId'), 'reading-wx.score2');
-                          resolve({
-                            title: '我的新作品发布啦,快来捧场点赞!',
-                            path: `/pages/pkPage/index?videoId=${wx.getStorageSync('shareVideoId')}&uid=${wx.getStorageSync('uid')}&isShare=true`,
-                            imageUrl: res.tempFilePath
-                          })
-                        },
-                        fail(res) {
-                          reject()
-                        }
-                      }, this)
-                    }, 500)
-                  }
-                }
-              }
-            }
-          } */
+          /*  let peiyin = canvas.createImage();
+           peiyin.src = '/static/peiyin.jpg';
+           peiyin.onload = () => {
+             ctx.drawImage(peiyin, 0, 211, 375, 89);
+             //分享
+             let fx = canvas.createImage();
+             fx.src = '/static/share.png'
+             fx.onload = () => {
+               ctx.drawImage(fx, 12, 220, 20, 20)
+               ctx.fillText('分享', 36, 238)
+               // 收藏,一个一个渲染
+               let sc = canvas.createImage();
+               sc.src = '/static/no_collect.png'
+               sc.onload = () => {
+                 ctx.drawImage(sc, 110, 220, 19, 19)
+                 ctx.fillText('收藏', 134, 238)
+                 //点赞
+                 let dz = canvas.createImage();
+                 dz.src = '/static/heart.png'
+                 dz.onload = () => {
+                   ctx.drawImage(dz, 318, 222, 22, 22)
+                   ctx.fillText(0, 254, 238)
+                   // 评论
+                   let pl = canvas.createImage();
+                   pl.src = '/static/comment.png'
+                   pl.onload = () => {
+                     ctx.drawImage(pl, 228, 222, 22, 22)
+                     ctx.fillText(0, 340, 238)
+                     setTimeout(() => {
+                       wx.canvasToTempFilePath({
+                         canvas: canvas,
+                         success(res) {
+                           console.log(wx.getStorageSync('shareVideoId'), 'reading-wx.score2');
+                           resolve({
+                             title: '我的新作品发布啦,快来捧场点赞!',
+                             path: `/pages/pkPage/index?videoId=${wx.getStorageSync('shareVideoId')}&uid=${wx.getStorageSync('uid')}&isShare=true`,
+                             imageUrl: res.tempFilePath
+                           })
+                         },
+                         fail(res) {
+                           reject()
+                         }
+                       }, this)
+                     }, 500)
+                   }
+                 }
+               }
+             }
+           } */
         })
     })
   },

+ 57 - 61
pages/score/index.wxml

@@ -1,66 +1,62 @@
 <view class="container">
-    <view class="scoreBox">
-        <!-- 星星区域 -->
-        <view class="lightBox">
-            <image src="/static/{{score.myOverall>=10?'stars-1.png':'stars-2.png'}}" class="stars stars-1" mode="" />
-            <image src="/static/{{score.myOverall>=30?'stars-1.png':'stars-2.png'}}" class="stars stars-2" mode="" />
-            <image src="/static/{{score.myOverall>=50?'stars-1.png':'stars-2.png'}}" class="stars stars-3" mode="" />
-            <image src="/static/{{score.myOverall>=70?'stars-1.png':'stars-2.png'}}" class="stars stars-4" mode="" />
-            <image src="/static/{{score.myOverall>=90?'stars-1.png':'stars-2.png'}}" class="stars stars-5" mode="" />
-            <image src="/static/light.png" class="light" mode="" />
+  <view class="scoreBox">
+    <!-- 星星区域 -->
+    <view class="lightBox">
+      <image src="/static/{{score.myOverall>=10?'stars-1.png':'stars-2.png'}}" class="stars stars-1" mode="" />
+      <image src="/static/{{score.myOverall>=30?'stars-1.png':'stars-2.png'}}" class="stars stars-2" mode="" />
+      <image src="/static/{{score.myOverall>=50?'stars-1.png':'stars-2.png'}}" class="stars stars-3" mode="" />
+      <image src="/static/{{score.myOverall>=70?'stars-1.png':'stars-2.png'}}" class="stars stars-4" mode="" />
+      <image src="/static/{{score.myOverall>=90?'stars-1.png':'stars-2.png'}}" class="stars stars-5" mode="" />
+      <image src="/static/light.png" class="light" mode="" />
+    </view>
+    <!-- 主体得分区域 -->
+    <view class="score">
+      <view class="avatarBox">
+        <image src="{{userInfo.avatar}}" class="avatar" mode="" />
+      </view>
+      <view class="nickName">
+        {{userInfo.nickName||userInfo.eid}}
+      </view>
+      <view class="totalScore">
+        <text>综合得分:</text>
+        <text class="num">{{score.myOverall}}</text>
+      </view>
+      <view class="progressBox">
+        <view class="row">
+          <view class="name">完整度</view>
+          <progress class="progress" active percent='{{score.integrity}}' stroke-width="18" activeColor="#70D9FF" />
+          <view class="scoreInfo">
+            {{score.integrity}}/100
+          </view>
         </view>
-        <!-- 主体得分区域 -->
-        <view class="score">
-            <view class="avatarBox">
-                <image src="{{userInfo.avatar}}" class="avatar" mode="" />
-            </view>
-            <view class="nickName">
-                {{userInfo.nickName||userInfo.eid}}
-            </view>
-            <view class="totalScore">
-                <text>综合得分:</text>
-                <text class="num">{{score.myOverall}}</text>
-            </view>
-            <view class="progressBox">
-                <view class="row">
-                    <view class="name">完整度</view>
-                    <progress class="progress" active percent='{{score.integrity}}' stroke-width="18"
-                        activeColor="#70D9FF" />
-                    <view class="scoreInfo">
-                        {{score.integrity}}/100
-                    </view>
-                </view>
-                <view class="row">
-                    <view class="name">正确率</view>
-                    <progress class="progress" active percent='{{score.accuracy}}' stroke-width="18"
-                        activeColor="#918EFD" />
-                    <view class="scoreInfo">
-                        {{score.accuracy}}/100
-                    </view>
-                </view>
-                <view class="row">
-                    <view class="name">流利度</view>
-                    <progress class="progress" active percent='{{score.fluency}}' stroke-width="18"
-                        activeColor="#FE9500" />
-                    <view class="scoreInfo">
-                        {{score.fluency}}/100
-                    </view>
-                </view>
-                <view class="row">
-                    <view class="name">语调</view>
-                    <progress class="progress" active percent='{{score.tone}}' stroke-width="18"
-                        activeColor="#9BE74B " />
-                    <view class="scoreInfo">
-                        {{score.tone}}/100
-                    </view>
-                </view>
-            </view>
+        <view class="row">
+          <view class="name">正确率</view>
+          <progress class="progress" active percent='{{score.accuracy}}' stroke-width="18" activeColor="#918EFD" />
+          <view class="scoreInfo">
+            {{score.accuracy}}/100
+          </view>
         </view>
+        <view class="row">
+          <view class="name">流利度</view>
+          <progress class="progress" active percent='{{score.fluency}}' stroke-width="18" activeColor="#FE9500" />
+          <view class="scoreInfo">
+            {{score.fluency}}/100
+          </view>
+        </view>
+        <view class="row">
+          <view class="name">语调</view>
+          <progress class="progress" active percent='{{score.tone}}' stroke-width="18" activeColor="#9BE74B " />
+          <view class="scoreInfo">
+            {{score.tone}}/100
+          </view>
+        </view>
+      </view>
     </view>
-    <!-- 底部 -->
-    <view class="footer">
-        <view class="stBtn" bindtap="backReading">试听</view>
-        <uploadFile readingType='{{readingType}}' bindtap="hideFooter" />
-    </view>
-    <canvas id='share' type="2d"> </canvas>
+  </view>
+  <!-- 底部 -->
+  <view class="footer">
+    <view class="stBtn" bindtap="backReading">试听</view>
+    <uploadFile readingType='{{readingType}}' activityId='{{activityId}}' bindtap="hideFooter" />
+  </view>
+  <canvas id='share' type="2d"> </canvas>
 </view>