Rorschach 4 years ago
parent
commit
5853d0d47a

+ 7 - 1
app.json

@@ -35,5 +35,11 @@
     "enablePullDownRefresh": true
   },
   "debug": false,
-  "sitemapLocation": "sitemap.json"
+  "sitemapLocation": "sitemap.json",
+  "plugins": {
+    "myPlugin": {
+      "version": "1.2.1",
+      "provider": "wx7279a29ef86a3002"
+    }
+  }
 }

+ 2 - 1
component/my/my.js

@@ -18,7 +18,8 @@ export const myInit = (that) => {
       schoolName: '',
       user: {},
       isIOS: app.globalData.isIOS,
-      isVIP: true
+      isVIP: true,
+      grade:''
     },
     followData: []
   });

+ 4 - 4
component/my/my.wxml

@@ -4,17 +4,17 @@
     <view class='follow-details'>
       <view class='follow-info'>
         <view class="info-placerholder"></view>
-        <view class='set-msg' wx:if="{{myData.user.user.wechatName || myData.user.wechatName }}">
+        <view class='set-msg' wx:if="{{myData.userInfo.wechatName }}">
           <view class='avatar-box'>
-            <image class='avatar-image' src='{{ myData.user.user.avatar  || myData.user.avatar  }}'></image>
+            <image class='avatar-image' src='{{ myData.userInfo.avatar  }}'></image>
             <!-- <view class='occupation-title' wx:if="{{myData.user.user.profession}}">{{ myData.user.user.profession }}</view> -->
           </view>
           <view class='avatar-msg' bindtap="toMyEdit">
             <view class='avatar-nickname'>
-              微信昵称:{{ myData.user.user.wechatName || myData.user.wechatName  }}
+              微信昵称:{{ myData.userInfo.wechatName  }}
             </view>
             <view class='avatar-nickname'>
-              年级:{{ myData.user.user.grade || myData.user.grade  }}年级
+              年级:{{myData.userInfo.gradeText  }}
             </view>
             <image class="edit-img" src="../../static/image/edit_new.png" />
             <view class='mine-category'>

+ 4 - 1
component/video-swiper/index.js

@@ -95,7 +95,10 @@ Component({
             this.data._last = current;
             this.playCurrent(current);
             this.triggerEvent('change', {
-                activeId: curQueue[current].id
+                activeId: curQueue[current].id,
+                index:current,
+                _last,
+                nextQueue,
             });
             var direction = diff === 1 || diff === -2 ? 'up' : 'down';
             if (direction === 'up') {

+ 2 - 0
component/video-swiper/index.less

@@ -75,6 +75,7 @@
             color: #373737;
             display: flex;
             align-items: center;
+            padding-left: 20rpx;
         }
 
         .foot_box {
@@ -120,6 +121,7 @@
                     width: 49rpx;
                     height: 47rpx;
                     margin-right: 14rpx;
+                    border-radius: 0;
                 }
             }
         }

+ 2 - 0
component/video-swiper/index.wxss

@@ -60,6 +60,7 @@
   color: #373737;
   display: flex;
   align-items: center;
+  padding-left: 20rpx;
 }
 .swiper_container .swiper_item .foot_box {
   width: 100%;
@@ -100,6 +101,7 @@
   width: 49rpx;
   height: 47rpx;
   margin-right: 14rpx;
+  border-radius: 0;
 }
 .swiper_container .swiper_item .btn_wrapper {
   width: 100%;

+ 58 - 29
pages/index/index.js

@@ -53,8 +53,6 @@ Page({
     followData: [],
     recommendPageNo: 0,
     recommendTotalNo: 1,
-    followPageNo: 1,
-    followPageTotalNo: 1,
     myData: {},
     templates: '',
     title: 'index中的title',
@@ -122,7 +120,8 @@ Page({
     if (myIndex == 1) {
       this.setData({
         videoList: [],
-        isSwiper: true
+        isSwiper: true,
+        followPageNo: 1
       }, () => {
         this.getFollowData()
       })
@@ -235,7 +234,9 @@ Page({
     });
 
   },
-  onShow: function () {
+  onShow: function (e) {
+    console.log('页面显示', e)
+    this.getUserWorksInfo(1)
     wx.setNavigationBarTitle({
       title: '小学语文朗读配音'
     })
@@ -327,39 +328,34 @@ Page({
       this.setData({
         videoList: this.data.videoList
       })
-      console.log('dangqian', this.data.videoList)
     })
   },
   // 获取用户信息
   getUserWorksInfo: function (flag) {
-    console.log(flag)
     if (flag) {
       httpRequestApi.getUserWorksInfo().success(res => {
-        // const str = 'myData.user.user.nickName';
-        // const avatarStr = 'myData.user.user.avatar';
-        // this.setData({
-        //   [str]: res.data.data.user.nickName,
-        //   [avatarStr]: res.data.data.user.avatar
-        // })
+        const userInfo = this.formatGrade(res.data.data.user);
+        const str = 'myData.userInfo.nickName';
+        const avatarStr = 'myData.userInfo.avatar';
+        const gradeTextStr = 'myData.userInfo.gradeText';
+        this.setData({
+          [str]: userInfo.nickName,
+          [avatarStr]: userInfo.avatar,
+          [gradeTextStr]: userInfo.gradeText
+        })
       })
       return;
     }
-    const userLocal = wx.getStorageSync('user')
-    console.log(userLocal)
-    const str = 'myData.user';
-    this.setData({
-      [str]: userLocal
-    })
     httpRequestApi.getUserWorksInfo().success(res => {
-      console.log('getUserWorksInfo', res)
       this.data.myData.user = res.data.data;
       httpRequestApi.userIntoPage('pages/index/index', '首页我的').success((res) => {})
-      if (this.data.myData.user.myRead) {
-        this.data.myData.user.myRead.gmtCreated = formatDate(this.data.myData.user.myRead.gmtCreated, 4)
+      if (res.data.data.myRead) {
+        res.data.data.myRead.gmtCreated = formatDate(this.data.myData.user.myRead.gmtCreated, 4)
       }
+      res.data.data.user = this.formatGrade(res.data.data.user);
       this.setData({
-        myData: this.data.myData,
-        userInfo: res.data.data.user
+        myData: res.data.data,
+        ['myData.userInfo']: res.data.data.user
       }, () => {
         this.getMyRead()
       });
@@ -367,9 +363,41 @@ Page({
       console.log(error)
     })
   },
+  formatGrade(userInfo) {
+    switch (userInfo.grade) {
+      case 'PRESCHOOL':
+        userInfo.gradeText = '学前班'
+        break;
+      case 'PRIMARY_FIRST_GRADE':
+        userInfo.gradeText = '小学一年级'
+        break;
+      case 'PRIMARY_SECOND_GRADE':
+        userInfo.gradeText = '小学二年级'
+        break;
+      case 'PRIMARY_THREE_GRADE':
+        userInfo.gradeText = '小学三年级'
+        break;
+    }
+    return userInfo;
+  },
+  videoChange: function (e) {
+    console.log('到了底部到了底部', e.detail.index)
+    console.log('到了底部到了底部', e.detail._last)
+    console.log('到了底部到了底部', e.detail.nextQueue)
+    if (e.detail.nextQueue.length === 1) {
+      if (this.data.myIndex === 1) {
+        this.setData({
+          followPageNo: this.data.followPageNo + 1
+        }, () => {
+          this.getFollowData()
+        })
+      }
+    }
+
+  },
   // 触底加载
   onReachBottom: function () {
-    // console.log(this.data.myIndex)
+    console.log('到了底部到了底部', this.data.myIndex)
     // if (this.data.myIndex === 0) {
     //   this.setData({
     //     followPageNo: this.data.followPageNo + 1
@@ -485,7 +513,7 @@ Page({
       // const recommendWorks = [];
       myList.forEach(item => {
         console.log('mydata', this.data.myData)
-        console.log('mydata', this.data.userInfo.user)
+        console.log('mydata', this.data.myData.userInfo.user)
 
         const temp = {};
         temp.title = item.title;
@@ -495,12 +523,12 @@ Page({
         temp.likes = item.likeAmount;
         temp.classId = item.exampleId ? item.exampleId : 1605097720036046;
         temp.time = formatDate(item.gmtCreated, 3);
-        temp.avatar = this.data.userInfo.avatar;
+        temp.avatar = this.data.myData.userInfo.avatar;
         temp.uid = this.uid;
         temp.url = item.videoPath;
         temp.id = item.id;
         // temp.avatar = item.user.avatar;
-        temp.nickName = this.data.userInfo.wechatName;
+        temp.nickName = this.data.myData.userInfo.wechatName;
         // recommendWorks.push(temp);
         this.data.videoList.push(temp);
       });
@@ -616,6 +644,7 @@ Page({
       }
       console.log('关注列表', res)
       const followData = res.data.data.list;
+      const videoList = [];
       followData.forEach(item => {
         const temp = {};
         temp.title = item.userRead ? item.userRead.title : '';
@@ -629,10 +658,10 @@ Page({
         temp.url = item.userRead.videoPath ? item.userRead.videoPath : item.userRead.originVideo;
         temp.nickName = item.user ? item.user.wechatName : '';
         temp.id = item.userRead.id;
-        this.data.videoList.push(temp);
+        videoList.push(temp);
       });
       this.setData({
-        videoList: this.data.videoList
+        videoList: videoList
       })
     });
   },

+ 1 - 1
pages/index/index.wxml

@@ -30,7 +30,7 @@
   </view>
   <!-- 调用组件 -->
   <template is="{{templates}}" wx:if="{{myIndex === 3 || myIndex === 2}}" data="{{myData: myData,coursesData:coursesData}}"></template>
-  <VideoSwiper wx:if="{{videoList.length > 0}}" class="video-swiper" video-list="{{videoList}}" nextMargin="{{nextMargin}}" isSwiper="{{isSwiper}}" ifHeadTap="{{true}}" bindopenComment="openComment" bindheadTap="headTapHandler" bindgoToReading="goToReading">
+  <VideoSwiper wx:if="{{videoList.length > 0}}" class="video-swiper" video-list="{{videoList}}" nextMargin="{{nextMargin}}" isSwiper="{{isSwiper}}" ifHeadTap="{{true}}" bindopenComment="openComment" bindheadTap="headTapHandler" bindgoToReading="goToReading" bindchange="videoChange">
     <!-- bindplay="onPlay"
   bindpause="onPause"
   bindtimeupdate="onTimeUpdate"

+ 198 - 172
pages/main/reading/reading.js

@@ -26,7 +26,16 @@ Page({
         pageNo: 1,
         nextMargin: getApp().globalData.nextMargin,
         lowerThresHold: 100,
-        isVideoListShow: true
+        isVideoListShow: true,
+        overall: '', // 评测总分
+        integrity: '', //完成度
+        tone: '', //语调声调
+        fluency: '', //流利度
+        accuracy: '', // 正确分,发音分
+        star: [0, 0, 0, 0, 0],
+        ifTextShow: true,
+        ifScoreDialogShow: false,
+        ifScoreShow: false
     },
     onLoad: function (option) {
         console.log(option);
@@ -56,97 +65,13 @@ Page({
 
             })
         })
-        this.recorderManager = wx.getRecorderManager();
-
-
-        // 监听录音部分
-        // 录音开始
-        this.recorderManager.onStart(() => {
-            // this.saveVideo();
-            this.setData({
-                btnImgFlag: true,
-                btnFlag: false
-            })
-            console.log('recorder start')
-        })
-        // this.recorderManager.onPause(() => {
-        //     wx.showToast({
-        //         title: '录音被暂停',
-        //         icon: 'fail',
-        //         duration: 500
-        //     })
-        // })
-        // this.recorderManager.onInterruptionBegin(() => {
-        //     wx.showToast({
-        //         title: '录音被应用中断开始',
-        //         icon: 'fail',
-        //         duration: 500
-        //     })
-        // })
-        // this.recorderManager.onInterruptionEnd(() => {
-        //     wx.showToast({
-        //         title: '录音中断结束',
-        //         icon: 'fail',
-        //         duration: 500
-        //     })
-        // })
-        let dialogFlag = true;
-        this.recorderManager.onError(() => {
-            wx.getSetting({
-                success(res) {
-                    if (!res.authSetting['scope.record'] && dialogFlag) {
-                        wx.showModal({
-                            title: '录音前请打开麦克风权限',
-                            content: '点击右上角浮点...,选择:设置-麦克风,点击/打开。',
-                            confirmText: '我知道了',
-                            showCancel: false,
-                            success(res) {
-                                console.log('用户点击确定')
-                                // dialogFlag = false;
-                            }
-                        })
-                        dialogFlag = false;
-                        setTimeout(() => {
-                            dialogFlag = true;
-                        }, 1000)
-                    }
-                    // else {
-                    //     wx.showToast({
-                    //         title: 'onError',
-                    //         icon: 'fail',
-                    //         duration: 500
-                    //     })
-                    // }
-                }
-            })
-        })
-        // 录音结束
-        this.recorderManager.onStop((res) => {
-            // wx.showToast({
-            //     title: 'onStop',
-            //     icon: 'fail',
-            //     duration: 500
-            // })
-            this.videoCtx.stop();
-            console.log('recorder stop', res)
-            const recordFile = res.tempFilePath;
-            this.setData({
-                recordFlag: 0,
-                recordSource: recordFile,
-                btnFlag: true,
-                btnImgFlag: false
-            })
-        })
     },
     onHide: function () {
         console.log('onhide')
         if (this.data.btnImgFlag) {
-            this.recorderManager.stop();
-        }
-
-        if (this.innerAudioContext) {
-            this.innerAudioContext.stop();
+            this.ss.stopRecord();
         }
+        this.ss.destroyEngine();
         this.setData({
             recordFlag: 0
         })
@@ -154,12 +79,10 @@ Page({
     },
     onUnload: function () {
         console.log('onUnload')
-        if (this.recorderManager) {
-            this.recorderManager.stop();
-        }
-        if (this.innerAudioContext) {
-            this.innerAudioContext.stop();
+        if (this.data.btnImgFlag) {
+            this.ss.stopRecord();
         }
+        this.ss.destroyEngine();
     },
     onShow: function () {
         this.setData({
@@ -169,16 +92,45 @@ Page({
             },
         })
         this.videoCtx = wx.createVideoContext('myVideo', this);
+        let data = requirePlugin("myPlugin");
+        const obj = {
+            appid: 'a415',
+            userid: wx.getStorageSync('uid'),
+            getEvalMessage: (res) => {
+                this.getRecordScore(res)
+                // console.log('评测结果',res)
+            },
+            recorderCallback: (type, data) => {
+                // 录音测评监控回调
+                this.ssRecorderCallback(type, data)
+            }
+
+        }
+        this.ss = new data.ssEngine(obj);
 
     },
-    // 视频缓冲
-    // videoWaiting: function () {
-    //     this.recorderManager.pause();
-    // },
-    // //视频播放
-    // videoPlay: function () {
-    //     this.recorderManager.resume();
-    // },
+    ssRecorderCallback: function (type, data) {
+        console.log('录音测评监控回调', type)
+        console.log('录音测评监控回调', data)
+        /* 录音开始 */
+        if (type === 'onStart') {
+            this.setData({
+                btnImgFlag: true,
+                btnFlag: false
+            })
+            console.log('recorder start')
+        }
+        if (type === 'onStop') {
+            this.videoCtx.stop();
+            this.setData({
+                recordFlag: 0,
+                recordSource: data.tempFilePath,
+                btnFlag: true,
+                btnImgFlag: false
+            })
+            console.log('recorder start')
+        }
+    },
     // 录音中视频播放结束 (控制录音同时结束)
     recordingVideoEnd: function () {
         console.log(this.data.videoCtr)
@@ -198,7 +150,8 @@ Page({
     // 播放中视频播放结束 (控制录音同时结束)
     playingVideoEnd: function () {
         console.log('playingVideoEnd')
-        this.innerAudioContext.stop();
+
+        this.ss.stopPlay();;
     },
     /***
      *  recordFlag: 
@@ -216,12 +169,12 @@ Page({
                 this.videoCtx.stop();
                 this.videoCtx.seek(0);
             }
-            if (this.recorderManager) {
-                this.recorderManager.stop();
-            }
-            if (this.innerAudioContext) {
-                this.innerAudioContext.stop();
-            }
+            // if (this.recorderManager) {
+            //     this.recorderManager.stop();
+            // }
+            // if (this.innerAudioContext) {
+            //     this.innerAudioContext.stop();
+            // }
             const that = this;
             wx.getSetting({
                 success(res) {
@@ -267,30 +220,88 @@ Page({
             format: 'mp3',
             frameSize: 50
         }
-        this.recorderManager.start(options);
+        this.ss.startRecord({
+            coreType: 'cn.sent.score', //测评题型    
+            evalTime: 240000, //测评的录音时间,时间到自动停止测评    
+            refText: this.data.readingText, //测评文本  
+            warrantId: 'c11163aa6c834a028da4a4b30955be96', //鉴权id
+        })
     },
     // 录音结束
     recordStop: function () {
+        this.ss.stopRecord();
         console.log('录音结束')
-        this.recorderManager.stop();
         wx.hideLoading()
     },
+    // 获取测评结果
+    getRecordScore(res) {
+        console.log('测评结果', res)
+        const result = res.result;
+        const overall = result.overall; // 总分
+        const integrity = result.integrity; //完成度
+        const tone = result.tone; // 语调声调
+        const accuracy = result.accuracy; // 发音分
+        const fluency = result.fluency.overall; //流利度 
+        let starArray = [];
+        let score = overall / 20;
+        if (score <= 0) {
+            starArray = [0, 0, 0, 0, 0]
+        } else {
+            for (let i = 1; i < 5; i += 0.9) {
+                if (i < score) {
+                    starArray.push(1);
+                } else {
+                    starArray.push(0)
+                }
+            }
+        }
+
+        this.setData({
+            overall,
+            integrity,
+            tone,
+            accuracy,
+            fluency,
+            ifScoreDialogShow: true,
+            star: starArray
+        })
+    },
+    closeScoreDialog() {
+        this.setData({
+            ifScoreDialogShow: false,
+            ifScoreShow: true,
+            ifTextShow: false
+        })
+    },
     // 播放录音
     audioPlay: function () {
+        /* 用了先声智能以后录音播放由先声只能接管 */
         this.setData({
             videoUrl: this.data.videoUrl
         })
-        console.log('音频播放');
-        if (this.innerAudioContext) {
-            this.innerAudioContext.stop();
-            this.videoCtx.stop();
-        }
+
         this.videoCtx.seek(0)
-        this.innerAudioContext = wx.createInnerAudioContext();
-        this.innerAudioContext.src = this.data.recordSource; // 这里可以是录音的临时路径
-        console.log(this.innerAudioContext.src);
-        this.videoCtx.play();
-        this.innerAudioContext.play();
+        const recordSource = this.data.recordSource
+        wx.uploadFile({
+            url: 'https://reader.lingjiao.cn/readerBase/file/upload',
+            filePath: recordSource,
+            name: '朗读录音',
+            header: {
+                uid: wx.getStorageSync('uid')
+            },
+            success: (res) => {
+                const formateRes = JSON.parse(res.data);
+
+                let audioPath = formateRes.data;
+                this.setData({
+                    audioPath,
+                    audioPlaying: true
+                })
+                this.ss.startPlay(audioPath);
+                this.videoCtx.play();
+            }
+
+        })
     },
 
     videoComplete: function () {
@@ -312,76 +323,91 @@ Page({
         if (this.videoCtx) {
             this.videoCtx.stop();
         }
-        if (this.recorderManager) {
-            this.recorderManager.stop();
-        }
-        if (this.innerAudioContext) {
-            this.innerAudioContext.stop();
+        if (this.data.audioPlaying) {
+            this.ss.stopPlay();
+            this.setData({
+                audioPlaying: false
+            })
         }
         wx.showLoading({
             title: '作品分享中',
             mask: true
         })
-        const recordSource = this.data.recordSource;
-        wx.uploadFile({
-            url: 'https://reader.lingjiao.cn/readerBase/file/upload',
-            filePath: recordSource,
-            name: '朗读录音',
-            header: {
-                uid: wx.getStorageSync('uid')
-            },
-            success: (res) => {
-                const formateRes = JSON.parse(res.data);
-                let audioPath = formateRes.data;
-                let uid = wx.getStorageSync('uid');
-                shareWorks(uid, audioPath);
-            }
 
-        })
-        let shareWorks = (uid, audio) => {
-            if (this.innerAudioContext) {
-                this.innerAudioContext.stop();
-            }
-            const data = {
-                "lessonId": this.data.id,
-                "originVideo": this.data.videoUrl,
-                "audioPath": audio,
-                "title": this.data.title,
-                "iconImg": this.data.img,
-                "summary": this.data.summary,
-                "productId": this.data.productId,
-                "grade":this.data.grade,
-                "exampleId": this.data.exampleId
-            };
-            httpRequestApi.postWork(uid, data).success(res => {
-                wx.hideLoading({
-                    success: () => {
-                        wx.showToast({
-                            title: '上传成功',
-                            icon: 'success',
-                            duration: 1000,
-                            success: () => {
-                                console.log(res);
-                                wx.redirectTo({
-                                    url: `../../social/works/works?id=${res.data.data.id}&flowerCount=${res.data.count}`
-                                })
-                            }
-                        })
-                    }
-                });
+        if (this.data.audioPath) {
+            this.shareWorks(uid, this.data.audioPath)
+        } else {
+            const recordSource = this.data.recordSource;
+            wx.uploadFile({
+                url: 'https://reader.lingjiao.cn/readerBase/file/upload',
+                filePath: recordSource,
+                name: '朗读录音',
+                header: {
+                    uid: wx.getStorageSync('uid')
+                },
+                success: (res) => {
+                    const formateRes = JSON.parse(res.data);
+                    let audioPath = formateRes.data;
+                    this.shareWorks(audioPath);
+                }
 
             })
+        }
+
+    },
+    shareWorks: function (audio) {
+
+        const data = {
+            "lessonId": this.data.id,
+            "originVideo": this.data.videoUrl,
+            "audioPath": audio,
+            "title": this.data.title,
+            "iconImg": this.data.img,
+            "summary": this.data.summary,
+            "productId": this.data.productId,
+            "grade": this.data.grade,
+            "exampleId": this.data.exampleId
         };
+        httpRequestApi.postWork(data).success(res => {
+            wx.hideLoading({
+                success: () => {
+                    wx.showToast({
+                        title: '上传成功',
+                        icon: 'success',
+                        duration: 1000,
+                        success: () => {
+                            console.log(res);
+                            const _data = this.data;
+                            const scoreData = {
+                                "userReadId": res.data.data.id,
+                                "complete": _data.integrity,
+                                "accuracy": _data.accuracy,
+                                "speed": _data.fluency,
+                                "intonation": _data.tone,
+                                "score": _data.overall
+                            }
+                            httpRequestApi.postWorksScore(scoreData).success(res => {
+                                console.log(res)
+                            })
+                            wx.redirectTo({
+                                url: `../../social/works/works?id=${res.data.data.id}&flowerCount=${res.data.count}`
+                            })
+                        }
+                    })
+                }
+            });
+        });
+
     },
 
     // 获取本课朗读内容
-    getReadInfo: function (id,pageNo, pageSize) {
+    getReadInfo: function (id, pageNo, pageSize) {
         // const uid =  wx.getStorageSync('uid');
         const data = {
             exampleId: this.data.id || id,
             pageNo: this.data.pageNo,
             pageSize: 3,
-            type:'READ'
+            type: 'READ'
         };
         httpRequestApi.getClassRead(this.uid, data).success(res => {
             const readInfo = res.data.data.list;

+ 51 - 2
pages/main/reading/reading.wxml

@@ -27,7 +27,7 @@
             <text>上传</text>
         </view>
     </view>
-    <scroll-view class="textSection" scroll-y="true">
+    <scroll-view class="textSection" wx:if="{{ifTextShow}}" scroll-y="true">
         <!-- <view class="btn_wrapper" bindtap="audioRecord">
             <view class="reading_btn">
                 <image src="../../../static/index/star.png" />
@@ -36,8 +36,57 @@
         </view> -->
         <text class="textContent">{{readingText}}</text>
     </scroll-view>
-    <VideoSwiper wx:if="{{videoList.length > 0 && isVideoListShow}}" class="video-swiper" video-list="{{videoList}}" nextMargin="{{nextMargin}}" isSwiper="{{false}}" bindopenComment="openComment" bindheadTap="headTapHandler" bindgoToReading="goToReading" bindplay="onPlay"></VideoSwiper>
+    <view class="score_section" wx:if="{{ifScoreShow}}">
+        <view class="title">测评报告</view>
+        <view class="star_row">
+            <image class="star" wx:for="{{star}}" src="{{item? '../../../static/index/star_colored.png': '../../../static/index/star.png'}}" />
+        </view>
+        <view class="score_item">
+            <text class="score_square"></text>
+            <text >完成度:{{integrity}}/100</text>
+        </view>
+        <view class="score_item">
+            <text class="score_square"></text>
+            <text >正确率:{{accuracy}}/100</text>
+        </view>
+        <view class="score_item">
+            <text class="score_square"></text>
+            <text >语速:{{fluency}}/100</text>
+        </view>
+        <view class="score_item">
+            <text class="score_square"></text>
+            <text >语音语调:{{tone}}/100</text>
+        </view>
+    </view>
+    <VideoSwiper wx:if="{{videoList && videoList.length > 0 && isVideoListShow}}" class="video-swiper" video-list="{{videoList}}" nextMargin="{{nextMargin}}" isSwiper="{{false}}" bindopenComment="openComment" bindheadTap="headTapHandler" bindgoToReading="goToReading" bindplay="onPlay"></VideoSwiper>
 </scroll-view>
 <view class="comment_section" catchtap="commentTap" data-type="blank" wx:if="{{commentShow}}">
     <Comment data-type="list" commentId="{{commentId}}" />
+</view>
+<view class="score_dialog" wx:if="{{ifScoreDialogShow}}">
+    <view class="score_section">
+        <view class="title">测评报告</view>
+        <view class="star_row">
+            <image class="star" wx:for="{{star}}" src="{{item? '../../../static/index/star_colored.png': '../../../static/index/star.png'}}" />
+        </view>
+        <view class="score_item">
+            <text class="score_square"></text>
+            <text >完成度:{{integrity}}/100</text>
+        </view>
+        <view class="score_item">
+            <text class="score_square"></text>
+            <text >正确率:{{accuracy}}/100</text>
+        </view>
+        <view class="score_item">
+            <text class="score_square"></text>
+            <text >语速:{{fluency}}/100</text>
+        </view>
+        <view class="score_item">
+            <text class="score_square"></text>
+            <text >语音语调:{{tone}}/100</text>
+        </view>
+    </view>
+    <view class="close" bindtap="closeScoreDialog">
+        <image class="close_icon" src="../../../static/index/close.png" />
+    </view>
 </view>

+ 86 - 0
pages/main/reading/reading.wxss

@@ -138,4 +138,90 @@ audio {
 
 .footSection .readingBtn text {
     margin-top: -10rpx;
+}
+
+.score_dialog {
+    width: 100%;
+    height: 100%;
+    background: rgba(0, 0, 0, .3);
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    position: fixed;
+    top: 0;
+    left: 0;
+}
+
+.score_dialog .close {
+    margin-top: 55rpx;
+    width: 76rpx;
+    height: 76rpx;
+
+}
+
+.score_dialog .close .close_icon {
+    width: 100%;
+    height: 100%;
+}
+
+
+
+.score_dialog .score_section {
+    width: 552rpx;
+    height: 611rpx;
+    background: #fffdf7;
+    border-radius: 30rpx;
+}
+.readingPage .score_section {
+    margin: 28rpx auto 0;
+    width: 627rpx;
+    height: 524rpx;
+    background: #fffbf7;
+    border-radius: 30rpx;
+}
+
+.score_section .title {
+    width: 100%;
+    text-align: center;
+    margin-top: 60rpx;
+    margin-bottom: 30rpx;
+    color: #e76634;
+    font-size: 44rpx;
+
+}
+
+.score_section .star_row {
+    width: 100%;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    justify-content: space-between;
+    padding: 0 55rpx;
+    box-sizing: border-box;
+    margin-bottom: 42rpx;
+}
+
+.score_section .star_row .star {
+    width: 75.8rpx;
+    height: 86.7rpx;
+}
+
+.score_section .score_item {
+    width: 100%;
+    display: flex;
+    align-items: center;
+    text-align: center;
+    font-size: 38rpx;
+    color: #ab722d;
+    padding-left: 110rpx;
+    box-sizing: border-box;
+    margin-bottom: 10rpx;
+}
+
+.score_section .score_item .score_square {
+    width: 17.6rpx;
+    height: 17.6rpx;
+    background: #cda069;
+    margin-right: 34.4rpx;
 }

+ 13 - 4
pages/user/myEdit/myEdit.js

@@ -14,7 +14,7 @@ Page({
     msg: '',
     nickname: '',
     gradeIndex:0,
-    gradeArray:['小学一年级','小学二年级','小学三年级','学前'],
+    gradeArray:['小学一年级','小学二年级','小学三年级','学前'],
     gradeCode:'',
     gradeObject: [{
         code: 'PRIMARY_FIRST_GRADE',
@@ -30,7 +30,7 @@ Page({
       },
       {
         code: 'PRESCHOOL',
-        name: '学前'
+        name: '学前'
       }
     ],
   },
@@ -136,7 +136,15 @@ Page({
   },
   onLoad: function (option) {
     httpRequestApi.getUserInfo().success(res => {
-      const user = res.data.data
+      const user = res.data.data;
+      let gradeIndex = 0;
+      this.data.gradeObject.forEach((item,index)=>{
+        console.log('年级index',item)
+        console.log('年级index',item)
+        if(item.code === user.grade){
+          console.log('年级index',index)
+          gradeIndex = index
+        }
       console.log(user)
       const birthday = user.birthday ? formatDate(user.birthday, 2) : '2018-01-01';
       console.log(birthday)
@@ -167,7 +175,8 @@ Page({
             checked: user.profession === '学生' ? true : false
           }
         ],
-
+        gradeIndex
+        })
       })
       console.log(this.data.date)
       if (option.title) {

+ 1 - 1
pages/user/myEdit/myEdit.wxml

@@ -41,7 +41,7 @@
         <picker name='gradePicker'  value="{{gradeIndex}}" range="{{gradeArray}}" bindchange="bindGradeChange">
           <view class="picker">
             <text class='setting-title'>年级</text>
-            <text>{{ gradeArray[gradeIndex]}}</text>
+            <text>{{ gradeObject[gradeIndex].name}}</text>
           </view>
         </picker>
         <view class='edit-img'>

BIN
static/index/close.png


+ 9 - 2
utils/APIClient.js

@@ -93,11 +93,18 @@ module.exports = {
   //   }).url(url).send();
   // },
   // 发布作品
-  postWork(uid, data) {
+  postWork(data) {
     console.log(data);
     let url = getBaseUrl(`wx/userRead`);
     return request.getInstance().header({
-      uid
+      uid: wx.getStorageSync('uid')
+    }).url(url).data(data).method('POST').send();
+  },
+  // 视频评测数据
+  postWorksScore(data){
+    let url = getBaseUrl(`wx/assessment`);
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
     }).url(url).data(data).method('POST').send();
   },
   // 点赞作品