|
@@ -23,8 +23,8 @@ import {
|
|
|
import {
|
|
|
setDuration
|
|
|
} from '~/utils/util'
|
|
|
-const aiengine = require('~/utils/ChivoxAiEngine')
|
|
|
-const sha1 = require('~/utils/sha1');
|
|
|
+let aiengine = require('~/utils/ChivoxAiEngine')
|
|
|
+let sha1 = require('~/utils/sha1');
|
|
|
// 文章行高
|
|
|
let rowH = 0
|
|
|
let videoContext = null
|
|
@@ -72,7 +72,8 @@ Page({
|
|
|
activityId: '',
|
|
|
// 0免费1收费
|
|
|
free: 1,
|
|
|
- isVip: false
|
|
|
+ isVip: false,
|
|
|
+ tempFilePath: ""
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
console.log(options);
|
|
@@ -302,7 +303,7 @@ Page({
|
|
|
attachAudioUrl: 1,
|
|
|
result: {
|
|
|
details: {
|
|
|
- gop_adjust: -0.1 //评测系数
|
|
|
+ gop_adjust: 0.5 //评测系数
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -315,7 +316,7 @@ Page({
|
|
|
},
|
|
|
success: (res) => {
|
|
|
/*引擎启动成功,可以启动录音机开始录音,并将音频片传给引擎*/
|
|
|
- const options = {
|
|
|
+ let options = {
|
|
|
duration: 600000,
|
|
|
sampleRate: 44100, //采样率
|
|
|
numberOfChannels: 1, //录音通道数
|
|
@@ -353,7 +354,7 @@ Page({
|
|
|
});
|
|
|
//监听已录制完指定帧大小的文件事件。如果设置了 frameSize,则会回调此事件。
|
|
|
recorderManager.onFrameRecorded((res) => {
|
|
|
- const {
|
|
|
+ let {
|
|
|
frameBuffer
|
|
|
} = res
|
|
|
//TODO 调用feed接口传递音频片给驰声评测引擎
|
|
@@ -386,12 +387,19 @@ Page({
|
|
|
// },
|
|
|
// 获取测评结果
|
|
|
async getRecordScore(res) {
|
|
|
- const result = res.result;
|
|
|
- const integrity = Math.floor(result.integrity); //完成度
|
|
|
- const tone = Math.floor(result.tone); // 语调声调
|
|
|
- const accuracy = Math.floor(result.accuracy); // 准确度 发音分
|
|
|
- const fluency = Math.floor(result.fluency.overall); //流利度
|
|
|
- let myOverall = Math.floor(integrity * 0.45 + accuracy * 0.35 + fluency * 0.1 + tone * 0.1);
|
|
|
+ let result = res.result;
|
|
|
+ let businessType = this.data.videoInfo.userReadExtend.businessType
|
|
|
+ let integrity = Math.floor(result.integrity); //完成度
|
|
|
+ let accuracy = Math.floor(result.accuracy); // 准确度 发音分
|
|
|
+ let fluency = Math.floor(result.fluency.overall); //流利度
|
|
|
+ let tone = 0 // 语调声调
|
|
|
+ let myOverall = 0;
|
|
|
+ if (businessType == 0) {
|
|
|
+ tone = Math.floor(result.tone);
|
|
|
+ myOverall = Math.floor(integrity * 0.45 + accuracy * 0.35 + fluency * 0.1 + tone * 0.1);
|
|
|
+ } else if (businessType == 1) {
|
|
|
+ myOverall = Math.floor(integrity * 0.45 + accuracy * 0.45 + fluency * 0.1);
|
|
|
+ }
|
|
|
let detail = {
|
|
|
integrity,
|
|
|
tone,
|
|
@@ -406,7 +414,7 @@ Page({
|
|
|
aBg: this.data.videoInfo.userReadExtend.resourcesType == 1 ? this.data.videoInfo.userReadExtend.backgroundVirtualImg : '',
|
|
|
originVideo: this.data.videoInfo.userRead.originVideo
|
|
|
}
|
|
|
- console.log('评测结果', detail);
|
|
|
+ console.log('评测结果2', detail);
|
|
|
this.setReadDetail(detail)
|
|
|
await userEvent({
|
|
|
action: 'WXSCORE',
|
|
@@ -434,7 +442,7 @@ Page({
|
|
|
this.setData({
|
|
|
uploadState: true
|
|
|
})
|
|
|
- const uploadTask = wx.uploadFile({
|
|
|
+ let uploadTask = wx.uploadFile({
|
|
|
url: 'https://reader-api.ai160.com//file/upload',
|
|
|
filePath: this.data.tempFilePath,
|
|
|
name: '朗读录音',
|
|
@@ -442,7 +450,7 @@ Page({
|
|
|
uid: wx.getStorageSync('uid')
|
|
|
},
|
|
|
success: async (res) => {
|
|
|
- const formateRes = JSON.parse(res.data);
|
|
|
+ let formateRes = JSON.parse(res.data);
|
|
|
let audioPath = formateRes.data;
|
|
|
let uploadRes = await publishWorks({
|
|
|
exampleId: this.data.pkData.exampleId,
|
|
@@ -721,9 +729,9 @@ Page({
|
|
|
node: true,
|
|
|
size: true
|
|
|
}).exec((res) => {
|
|
|
- const canvas = res[0].node;
|
|
|
- const ctx = canvas.getContext('2d');
|
|
|
- const dpr = wx.getSystemInfoSync().pixelRatio;
|
|
|
+ let canvas = res[0].node;
|
|
|
+ let ctx = canvas.getContext('2d');
|
|
|
+ let dpr = wx.getSystemInfoSync().pixelRatio;
|
|
|
canvas.width = res[0].width * dpr;
|
|
|
canvas.height = res[0].height * dpr;
|
|
|
ctx.scale(dpr, dpr);
|
|
@@ -816,7 +824,7 @@ Page({
|
|
|
target
|
|
|
}) {
|
|
|
if (from == 'button') {
|
|
|
- const promise = new Promise(resolve => {
|
|
|
+ let promise = new Promise(resolve => {
|
|
|
this.creatShare().then(res => {
|
|
|
resolve(res)
|
|
|
})
|