|
@@ -3,6 +3,9 @@ import {
|
|
|
formatDate
|
|
|
} from '../../../utils/util';
|
|
|
import {
|
|
|
+ getOpenidNoLogin
|
|
|
+} from '../../../utils/httpUtilNoLogin';
|
|
|
+import {
|
|
|
getOpenidSessionKey
|
|
|
} from '../../../utils/httpUtil';
|
|
|
const app = getApp()
|
|
@@ -74,7 +77,8 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- getOpenidSessionKey((res) => {
|
|
|
+ // getOpenidNoLogin
|
|
|
+ getOpenidNoLogin((res) => {
|
|
|
let id = option.id ? option.id : option.scene.replace('QR', '')
|
|
|
if (option.scene || option.shareCard) {
|
|
|
this.setData({
|
|
@@ -100,10 +104,10 @@ Page({
|
|
|
|
|
|
}, (error) => {
|
|
|
wx.setStorageSync('userSourseType','reading')
|
|
|
- this.setData({
|
|
|
- hide: !this.data.hide,
|
|
|
- onLoadOption: option
|
|
|
- })
|
|
|
+ // this.setData({
|
|
|
+ // hide: !this.data.hide,
|
|
|
+ // onLoadOption: option
|
|
|
+ // })
|
|
|
return;
|
|
|
});
|
|
|
},
|
|
@@ -210,6 +214,7 @@ Page({
|
|
|
videoLoad: true
|
|
|
}, () => {
|
|
|
this.videoCtx = wx.createVideoContext('worksVideo', this);
|
|
|
+ debugger
|
|
|
this.videoCtx.play();
|
|
|
})
|
|
|
},
|
|
@@ -325,49 +330,78 @@ Page({
|
|
|
},
|
|
|
goToReading: function () {
|
|
|
const classId = this.data.classId;
|
|
|
-
|
|
|
-
|
|
|
- httpRequestApi.areYouSuper(this.data.productId).success(res => {
|
|
|
- if (res.data.success) {
|
|
|
- wx.navigateTo({
|
|
|
- url: `../../main/reading/reading?id=${classId}`
|
|
|
- })
|
|
|
- } else {
|
|
|
- // ios用户 并且没有购买过此书
|
|
|
- // if (this.data.isIOS) {
|
|
|
- // wx.showModal({
|
|
|
- // title: '暂不支持',
|
|
|
- // content: '十分抱歉,由于相关规定,您暂时无法在这里朗读',
|
|
|
- // success(res) {
|
|
|
- // if (res.confirm) {
|
|
|
- // console.log('用户点击确定')
|
|
|
- // } else if (res.cancel) {
|
|
|
- // console.log('用户点击取消')
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // return;
|
|
|
- // }
|
|
|
- console.log('chulaiba')
|
|
|
- this.setData({
|
|
|
- isModalShow: true
|
|
|
- })
|
|
|
- // wx.showModal({
|
|
|
- // title: '您未购买过本书,不能朗读',
|
|
|
- // content: '超值团购进行中,快去看看',
|
|
|
- // success(res) {
|
|
|
- // if (res.confirm) {
|
|
|
- // console.log('用户点击确定')
|
|
|
- // wx.navigateTo({
|
|
|
- // url: `../../groupPage/grade-details/grade-details?productId=${productId}`
|
|
|
- // })
|
|
|
- // } else if (res.cancel) {
|
|
|
- // console.log('用户点击取消')
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
+ getOpenidSessionKey((res) => {
|
|
|
+ httpRequestApi.areYouSuper(this.data.productId).success(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ wx.authorize({
|
|
|
+ scope: 'scope.record',
|
|
|
+ success () {
|
|
|
+ // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
|
|
|
+ console.log('成功')
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `../../main/reading/reading?id=${classId}`
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail () {
|
|
|
+ wx.showModal({
|
|
|
+ title: '无法开启您的录音权限',
|
|
|
+ content: '点击右上角浮点按钮->设置,进行授权',
|
|
|
+ confirmText: '我知道了',
|
|
|
+ showCancel: false,
|
|
|
+ success(res) {
|
|
|
+ console.log('用户点击确定')
|
|
|
+ dialogFlag = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // ios用户 并且没有购买过此书
|
|
|
+ // if (this.data.isIOS) {
|
|
|
+ // wx.showModal({
|
|
|
+ // title: '暂不支持',
|
|
|
+ // content: '十分抱歉,由于相关规定,您暂时无法在这里朗读',
|
|
|
+ // success(res) {
|
|
|
+ // if (res.confirm) {
|
|
|
+ // console.log('用户点击确定')
|
|
|
+ // } else if (res.cancel) {
|
|
|
+ // console.log('用户点击取消')
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ console.log('chulaiba')
|
|
|
+ this.setData({
|
|
|
+ isModalShow: true
|
|
|
+ })
|
|
|
+ // wx.showModal({
|
|
|
+ // title: '您未购买过本书,不能朗读',
|
|
|
+ // content: '超值团购进行中,快去看看',
|
|
|
+ // success(res) {
|
|
|
+ // if (res.confirm) {
|
|
|
+ // console.log('用户点击确定')
|
|
|
+ // wx.navigateTo({
|
|
|
+ // url: `../../groupPage/grade-details/grade-details?productId=${productId}`
|
|
|
+ // })
|
|
|
+ // } else if (res.cancel) {
|
|
|
+ // console.log('用户点击取消')
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }, (error) => {
|
|
|
+ this.setData({
|
|
|
+ hide: !this.data.hide
|
|
|
+ })
|
|
|
+ if (this.innerAudioContext && this.videoCtx) {
|
|
|
+ this.videoCtx.stop();
|
|
|
+ this.innerAudioContext.pause();
|
|
|
+ console.log('关闭音频')
|
|
|
}
|
|
|
- })
|
|
|
+ return;
|
|
|
+ });
|
|
|
},
|
|
|
onShareAppMessage: function () {
|
|
|
console.log(this.data.productId);
|
|
@@ -704,7 +738,8 @@ Page({
|
|
|
hide: !this.data.hide
|
|
|
})
|
|
|
//登录页信息
|
|
|
- this.onLoad(this.data.onLoadOption);
|
|
|
+ // this.onLoad(this.data.onLoadOption);
|
|
|
+ this.goToReading();
|
|
|
},
|
|
|
goToClass: function () {
|
|
|
|