|
@@ -1,6 +1,10 @@
|
|
|
import httpRequestApi from '../../utils/APIClient';
|
|
|
const aiengine = require('../../utils/ChivoxAiEngine')
|
|
|
const sha1 = require('../../utils/sha1');
|
|
|
+import {
|
|
|
+ getUserInfo,
|
|
|
+ getVipInfo
|
|
|
+} from '~/api/user'
|
|
|
const app = getApp()
|
|
|
|
|
|
import {
|
|
@@ -8,6 +12,8 @@ import {
|
|
|
} from '../../utils/util';
|
|
|
Page({
|
|
|
data: {
|
|
|
+ userInfo: {},
|
|
|
+ isVip: false,
|
|
|
title: '',
|
|
|
id: '',
|
|
|
img: '',
|
|
@@ -64,26 +70,19 @@ Page({
|
|
|
console.log('课程信息', res)
|
|
|
let reg = /\\n/g
|
|
|
this.setData({
|
|
|
- title: res.data.data.userRead.title,
|
|
|
- videoUrl: res.data.data.userRead.videoPath,
|
|
|
- videoPathTemp: res.data.data.userRead.videoPath,
|
|
|
- originVideo: res.data.data.userRead.originVideo,
|
|
|
- img: res.data.data.userRead.iconImg,
|
|
|
- id: res.data.data.userRead.id,
|
|
|
- readingText: res.data.data.userRead.lessonText,
|
|
|
- grade: res.data.data.userRead.grade,
|
|
|
- exampleId: res.data.data.userRead.exampleId,
|
|
|
- summary: res.data.data.userRead.summary,
|
|
|
- coverImg: res.data.data.userRead.coverImg,
|
|
|
- shareImg: res.data.data.userRead.shareImg,
|
|
|
- isActivityRead: res.data.data.isActivityRead,
|
|
|
- })
|
|
|
- // 参赛作品,增加数据
|
|
|
- if (res.data.data.isActivityRead) {
|
|
|
- httpRequestApi.postActEvent('LESSON').success(res => {
|
|
|
- console.log('示范朗读页', res)
|
|
|
- })
|
|
|
- }
|
|
|
+ title: res.data.data.userRead.title,
|
|
|
+ videoUrl: res.data.data.userRead.videoPath,
|
|
|
+ videoPathTemp: res.data.data.userRead.videoPath,
|
|
|
+ originVideo: res.data.data.userRead.originVideo,
|
|
|
+ img: res.data.data.userRead.iconImg,
|
|
|
+ id: res.data.data.userRead.id,
|
|
|
+ readingText: res.data.data.userRead.lessonText,
|
|
|
+ grade: res.data.data.userRead.grade,
|
|
|
+ exampleId: res.data.data.userRead.exampleId,
|
|
|
+ summary: res.data.data.userRead.summary,
|
|
|
+ coverImg: res.data.data.userRead.coverImg,
|
|
|
+ shareImg: res.data.data.userRead.shareImg,
|
|
|
+ })
|
|
|
this.getReadInfo(id)
|
|
|
httpRequestApi.userIntoPage('pages/reading/reading', '朗读页面').success((res) => {
|
|
|
|
|
@@ -114,6 +113,7 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
onShow: function() {
|
|
|
+ this.getUserInfo()
|
|
|
this.videoCtx = wx.createVideoContext('myVideo', this);
|
|
|
let data = requirePlugin("myPlugin");
|
|
|
const obj = {
|
|
@@ -200,6 +200,15 @@ Page({
|
|
|
});
|
|
|
|
|
|
},
|
|
|
+ async getUserInfo() {
|
|
|
+ let userInfo = await getUserInfo()
|
|
|
+ let vip = await getVipInfo()
|
|
|
+ console.log(userInfo);
|
|
|
+ this.setData({
|
|
|
+ userInfo,
|
|
|
+ isVip: vip ? true : false
|
|
|
+ })
|
|
|
+ },
|
|
|
ssRecorderCallback: function(type, data) {
|
|
|
console.log('录音测评监控回调', type)
|
|
|
console.log('录音测评监控回调', data)
|
|
@@ -251,21 +260,10 @@ Page({
|
|
|
* 2 录音结束
|
|
|
***/
|
|
|
audioRecord: function() {
|
|
|
- // 判断是否有权限朗读 不是vip 并且 不是活动作品
|
|
|
- const isVip = wx.getStorageSync('vip');
|
|
|
- console.log('判断', !isVip && !this.data.isActivityRead)
|
|
|
- if (!isVip && !this.data.isActivityRead) {
|
|
|
+ // 判断是否有权限朗读 不是vip并且没有朗读机会
|
|
|
+ const isVip = this.data.isVip
|
|
|
+ if (!isVip && this.data.userInfo.experienceAmount <= 0) {
|
|
|
this.selectComponent('#readingTips').showModal();
|
|
|
- /* const imgName = this.data.isIOS ? 'ios_read' : 'android_read';
|
|
|
- if (!this.data.isIOS) {
|
|
|
- this.setData({
|
|
|
- payPrice: wx.getStorageSync('price')
|
|
|
- })
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- authHide: !this.data.authHide,
|
|
|
- authImg: `http://reader-wx.ai160.com/images/reader/pay/${imgName}.png`
|
|
|
- }) */
|
|
|
} else {
|
|
|
if (this.recorderManager) {
|
|
|
this.recorderManager.stop();
|
|
@@ -504,40 +502,6 @@ Page({
|
|
|
this.videoCtx.play();
|
|
|
this.innerAudioContext.play();
|
|
|
|
|
|
- /* if (this.data.audioPath) {
|
|
|
- if (this.data.audioPlaying) {
|
|
|
- // this.ss.stopPlay();
|
|
|
- }
|
|
|
- // this.ss.startPlay(this.data.audioPath);
|
|
|
- this.videoCtx.stop();
|
|
|
- this.videoCtx.play();
|
|
|
-
|
|
|
- } else {
|
|
|
- const recordSource = this.data.recordSource
|
|
|
- wx.uploadFile({
|
|
|
- url: 'https://reader-api.efunbox.cn/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.seek(0);
|
|
|
- this.videoCtx.stop();
|
|
|
- console.log('播放器归0')
|
|
|
- this.videoCtx.play();
|
|
|
- console.log('播放器播放')
|
|
|
- }
|
|
|
- })
|
|
|
- } */
|
|
|
},
|
|
|
|
|
|
exampleVideoPlay: function() {
|
|
@@ -588,7 +552,6 @@ Page({
|
|
|
})
|
|
|
const recordSource = this.data.recordSource;
|
|
|
wx.uploadFile({
|
|
|
- // url: 'https://reader-api.efunbox.cn/file/upload',
|
|
|
url: 'https://reader-api.efunbox.cn//file/upload',
|
|
|
filePath: recordSource,
|
|
|
name: '朗读录音',
|
|
@@ -630,7 +593,6 @@ Page({
|
|
|
this.setData({
|
|
|
flowerNum: res.data.count
|
|
|
})
|
|
|
- this.flowerAnimationHandler();
|
|
|
}
|
|
|
const _data = this.data;
|
|
|
const scoreData = {
|
|
@@ -651,8 +613,8 @@ Page({
|
|
|
// workId: res.data.data.id, // 有id就塞到第一位
|
|
|
fromReading: true
|
|
|
}, () => {
|
|
|
- wx.navigateBack({
|
|
|
- delta: 1
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/userWorks/index'
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -839,11 +801,6 @@ Page({
|
|
|
[likeNumStr]: this.data.videoList[index].likes + 1
|
|
|
})
|
|
|
},
|
|
|
- flowerAnimationHandler: function() {
|
|
|
- this.flowerBox = this.selectComponent("#flower-toast");
|
|
|
- console.log('this.flower', this.flowerBox)
|
|
|
- this.flowerBox.comeOut();
|
|
|
- },
|
|
|
// 获取焦点事件
|
|
|
inputFocus(e) {
|
|
|
this.setData({
|