|
@@ -1,6 +1,12 @@
|
|
|
import {
|
|
|
getreadInfo
|
|
|
} from '~/api/video'
|
|
|
+import {
|
|
|
+ createStoreBindings
|
|
|
+} from 'mobx-miniprogram-bindings'
|
|
|
+import {
|
|
|
+ store
|
|
|
+} from '~/store/index'
|
|
|
const aiengine = require('~/utils/ChivoxAiEngine')
|
|
|
const sha1 = require('~/utils/sha1');
|
|
|
let rowH = 0
|
|
@@ -22,6 +28,8 @@ Page({
|
|
|
},
|
|
|
contentH: 0,
|
|
|
scrollTop: 0,
|
|
|
+ //如果readingReset为true就是重读
|
|
|
+ readingReset: false,
|
|
|
article: [{
|
|
|
id: 1,
|
|
|
text: '传说在很久很久以前,',
|
|
@@ -58,23 +66,7 @@ Page({
|
|
|
id: 9,
|
|
|
text: '什么也看不见。',
|
|
|
time: '27300'
|
|
|
- }, {
|
|
|
- id: 10,
|
|
|
- text: '他一使劲翻身坐了起来,',
|
|
|
- time: '29210'
|
|
|
- }, {
|
|
|
- id: 11,
|
|
|
- text: '只听“咔嚓”一声,',
|
|
|
- time: '32700'
|
|
|
- }, {
|
|
|
- id: 12,
|
|
|
- text: '“大鸡蛋”裂开了一条缝,',
|
|
|
- time: '35320'
|
|
|
- }, {
|
|
|
- id: 13,
|
|
|
- text: '一丝微光透了进来。',
|
|
|
- time: '38270'
|
|
|
- }, ]
|
|
|
+ }]
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
let videoId = options.videoId
|
|
@@ -85,17 +77,30 @@ Page({
|
|
|
return item
|
|
|
})
|
|
|
this.setData({
|
|
|
- article: data
|
|
|
+ article: data,
|
|
|
+ readingReset: options.reset || false
|
|
|
})
|
|
|
- var query = wx.createSelectorQuery();
|
|
|
- query.select('.content').boundingClientRect((rect) => {
|
|
|
- this.setData({
|
|
|
- contentH: rect.height
|
|
|
- })
|
|
|
- }).exec()
|
|
|
- query.select('.row').boundingClientRect((rect) => {
|
|
|
- this.rowH = rect.height
|
|
|
- }).exec()
|
|
|
+ // 手工绑定
|
|
|
+ this.storeBindings = createStoreBindings(this, {
|
|
|
+ store,
|
|
|
+ fields: {
|
|
|
+ readDetail: 'readDetail'
|
|
|
+ },
|
|
|
+ actions: {
|
|
|
+ setReadDetail: 'setReadDetail'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (!options.reset) {
|
|
|
+ var query = wx.createSelectorQuery();
|
|
|
+ query.select('.content').boundingClientRect((rect) => {
|
|
|
+ this.setData({
|
|
|
+ contentH: rect.height
|
|
|
+ })
|
|
|
+ }).exec()
|
|
|
+ query.select('.row').boundingClientRect((rect) => {
|
|
|
+ this.rowH = rect.height
|
|
|
+ }).exec()
|
|
|
+ }
|
|
|
this.videoContext = wx.createVideoContext('myVideo')
|
|
|
// 录音授权
|
|
|
wx.getSetting({
|
|
@@ -213,8 +218,6 @@ Page({
|
|
|
this.setData({
|
|
|
tempFilePath: res.tempFilePath,
|
|
|
});
|
|
|
- // 长度过长,不用url传输
|
|
|
- wx.setStorageSync('tempFilePath', res.tempFilePath)
|
|
|
//录音机结束后,驰声引擎执行结束操作,等待评测返回结果
|
|
|
wsEngine.stop({
|
|
|
success: () => {
|
|
@@ -305,16 +308,19 @@ Page({
|
|
|
const accuracy = Math.floor(result.overall); // 准确度 发音分
|
|
|
const fluency = Math.floor(result.fluency.overall); //流利度
|
|
|
let myOverall = Math.floor(integrity * 0.3 + accuracy * 0.5 + fluency * 0.1 + tone * 0.1);
|
|
|
- let detail = JSON.stringify({
|
|
|
+ let detail = {
|
|
|
integrity,
|
|
|
tone,
|
|
|
accuracy,
|
|
|
fluency,
|
|
|
myOverall,
|
|
|
+ tempFilePath: this.data.tempFilePath,
|
|
|
title: this.data.videoInfo.userRead.title,
|
|
|
- })
|
|
|
+ id: this.data.videoInfo.userRead.exampleId,
|
|
|
+ }
|
|
|
+ this.setReadDetail(detail)
|
|
|
wx.redirectTo({
|
|
|
- url: `/pages/score/index?detail=${detail}`,
|
|
|
+ url: `/pages/score/index`,
|
|
|
})
|
|
|
},
|
|
|
/**
|