|
@@ -11,13 +11,6 @@ Page({
|
|
|
*/
|
|
|
data: {
|
|
|
score: {},
|
|
|
- tempFilePath: '',
|
|
|
- uploadFlag: false,
|
|
|
- uploadSuccess: false,
|
|
|
-
|
|
|
- uploadState: false,
|
|
|
- percent: 0,
|
|
|
- audioPath: ''
|
|
|
},
|
|
|
|
|
|
|
|
@@ -40,54 +33,12 @@ Page({
|
|
|
score,
|
|
|
})
|
|
|
},
|
|
|
- upload() {
|
|
|
- if (this.data.uploadState) {
|
|
|
- return
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- uploadFlag: true,
|
|
|
- uploadState: true
|
|
|
- })
|
|
|
- const uploadTask = wx.uploadFile({
|
|
|
- url: 'https://reader-api.ai160.com//file/upload',
|
|
|
- filePath: this.data.score.tempFilePath,
|
|
|
- name: '朗读录音',
|
|
|
- header: {
|
|
|
- uid: wx.getStorageSync('uid')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- const formateRes = JSON.parse(res.data);
|
|
|
- let audioPath = formateRes.data;
|
|
|
- this.setData({
|
|
|
- uploadSuccess: true,
|
|
|
- audioPath
|
|
|
- })
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- this.setData({
|
|
|
- uploadFlag: false
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- uploadTask.onProgressUpdate((res) => {
|
|
|
- this.setData({
|
|
|
- percent: res.progress
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
backReading() {
|
|
|
wx.redirectTo({
|
|
|
url: `/pages/reading/index?videoId=${this.data.score.id}&reset=true`,
|
|
|
})
|
|
|
},
|
|
|
- cancelMask() {
|
|
|
- this.setData({
|
|
|
- uploadSuccess: false
|
|
|
- })
|
|
|
- },
|
|
|
onShareAppMessage() {
|
|
|
- this.setData({
|
|
|
- uploadSuccess: false
|
|
|
- })
|
|
|
+
|
|
|
}
|
|
|
})
|