|
@@ -32,9 +32,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
-
|
|
|
-
|
|
|
+ <tip-middle-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :content="YouKeContent"></tip-middle-dialog>
|
|
|
</view>
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
@@ -47,7 +47,9 @@
|
|
|
} from '@dcloudio/uni-app';
|
|
|
import {
|
|
|
getVideoAuth,
|
|
|
+ getVideoAuthYk,
|
|
|
} from "@/api/shipin.js"
|
|
|
+ import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
|
|
|
import {
|
|
|
toast,
|
|
|
getUserIdentity
|
|
@@ -69,19 +71,31 @@
|
|
|
nianji: '',
|
|
|
zhangId: '',
|
|
|
seekTime: '',
|
|
|
- jieNumber: '',
|
|
|
+ jieId: '',
|
|
|
shipinTitle: '',
|
|
|
- cacheZhangInfo: {}
|
|
|
+ cacheZhangInfo: {},
|
|
|
+ YouKeContent: '您当前是游客身份,登录后才能浏览内容,现在去登录?'
|
|
|
}
|
|
|
},
|
|
|
+ components:{
|
|
|
+ tipMiddleDialog
|
|
|
+ },
|
|
|
onLoad(options) {
|
|
|
if (!cacheManager.get('auth')) {
|
|
|
+ console.log(
|
|
|
+ JSON.parse( options.youkePageData)
|
|
|
+
|
|
|
+ );
|
|
|
+ const youkeData = JSON.parse( options.youkePageData)
|
|
|
+
|
|
|
// 游客
|
|
|
- this.videoId = options.videoId
|
|
|
- this.nianji = options.nianji
|
|
|
- this.zhangId = options.zhangId
|
|
|
- this.cardId = options.cardId
|
|
|
- this.getLive(); //获取播放凭证
|
|
|
+ this.videoId = youkeData.jieList[0].videoId
|
|
|
+ this.nianji = youkeData.nianji
|
|
|
+ this.zhangId = youkeData.zhangId
|
|
|
+ this.cardId = youkeData.cardId
|
|
|
+ this.shipinTitle = youkeData.numberStr + ' ' + youkeData.zhangName
|
|
|
+ this.progressMarkers = youkeData.jieList[0].jiedianList
|
|
|
+ this.getLiveYk(); //获取播放凭证
|
|
|
} else {
|
|
|
this.init(options)
|
|
|
}
|
|
@@ -95,41 +109,33 @@
|
|
|
this.hideFlag = 'hide'
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
init(options) {
|
|
|
- this.jieNumber = options.jieNumber
|
|
|
- if (!(cacheManager.get('zhangInfo') && options.jieNumber)) {
|
|
|
- toast('数据错误,缓存丢失/ number丢失')
|
|
|
+ this.jieId = options.jieId
|
|
|
+ if (!(cacheManager.get('zhangInfo') && options.jieId)) {
|
|
|
+ toast('数据错误,缓存丢失/ jieId丢失')
|
|
|
return false
|
|
|
}
|
|
|
this.cacheZhangInfo = cacheManager.get('zhangInfo')
|
|
|
|
|
|
- let currentObject = this.cacheZhangInfo.jieList.find(item => item.number == options.jieNumber);
|
|
|
+ let currentObject = this.cacheZhangInfo.jieList.find(item => item.jieId == options.jieId);
|
|
|
this.shipinTitle = this.cacheZhangInfo.numberStr + ' ' + this.cacheZhangInfo.zhangName
|
|
|
- // lastFlag是否是本章最后一节,0否1是 type,1视频,2试题
|
|
|
- if (currentObject.lastFlag == 1 && currentObject.type == 2) {
|
|
|
- uni.redirectTo({
|
|
|
- url: `/pages/unitTest/index?jieNumber=` + currentObject.number
|
|
|
- })
|
|
|
- } else if (currentObject.lastFlag == 1 && currentObject.type == 1) {
|
|
|
- // 当前是本章最后一节,并且是 视频 切换下一章
|
|
|
- this.goNextZhang()
|
|
|
- } else {
|
|
|
- this.pageData = {
|
|
|
- ...currentObject
|
|
|
- }
|
|
|
- console.log(this.pageData);
|
|
|
- this.videoId = this.pageData.videoId
|
|
|
- this.jieName = this.pageData.jieName
|
|
|
- this.progressMarkers = this.pageData.jiedianList
|
|
|
- this.getLive(); //获取播放凭证
|
|
|
+
|
|
|
+ this.pageData = {
|
|
|
+ ...currentObject
|
|
|
}
|
|
|
+ console.log(this.pageData);
|
|
|
+ this.videoId = this.pageData.videoId
|
|
|
+ this.jieName = this.pageData.jieName
|
|
|
+ this.progressMarkers = this.pageData.jiedianList
|
|
|
+ this.getLive(); //获取播放凭证
|
|
|
},
|
|
|
goNextZhang() {
|
|
|
let that = this
|
|
|
let req = {
|
|
|
- nianji: that.currentObject.nianji,
|
|
|
- zhangId: that.currentObject.zhangId,
|
|
|
- cardId: that.currentObject.cardId,
|
|
|
+ nianji: that.pageData.nianji,
|
|
|
+ zhangId: that.pageData.zhangId,
|
|
|
+ cardId: that.pageData.cardId,
|
|
|
}
|
|
|
userZhangNextInfo(req).then(res => {
|
|
|
cacheManager.set('zhangInfo', res.data)
|
|
@@ -138,9 +144,16 @@
|
|
|
cardId: res.data.cardId,
|
|
|
nianji: res.data.nianji,
|
|
|
})
|
|
|
- that.init({
|
|
|
- jieNumber: 1
|
|
|
- })
|
|
|
+ if (res.data.jieList.length > 0) {
|
|
|
+ that.jieId = res.data.jieList[0].jieId
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/study/lookShipin?jieId=' + that.jieId
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ toast('切换下一章无jieList')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
playEnd(data) {
|
|
@@ -152,19 +165,33 @@
|
|
|
},
|
|
|
goNext() {
|
|
|
this.$refs.popupRef.close();
|
|
|
- this.hideFlag = "show"
|
|
|
- this.videoId = ''
|
|
|
- this.progressMarkers = []
|
|
|
- this.pageData = null
|
|
|
- this.playAuth = ''
|
|
|
- this.cacheZhangInfo = {}
|
|
|
- Number(this.jieNumber++)
|
|
|
- // this.init({
|
|
|
- // jieNumber: this.jieNumber
|
|
|
- // })
|
|
|
- uni.redirectTo({
|
|
|
- //url: '/pages/study/lookShipin?studyData=' + JSON.stringify(pageData)
|
|
|
- url: '/pages/study/lookShipin?jieNumber=' + this.jieNumber
|
|
|
+ if (!cacheManager.get('auth')) {
|
|
|
+ console.log(this);
|
|
|
+ this.$refs.youkeDialogRef.handleShow();
|
|
|
+ } else {
|
|
|
+ Number(this.jieId++)
|
|
|
+ // lastFlag是否是本章最后一节,0否1是 type,1视频,2试题
|
|
|
+ if (this.pageData.lastFlag == 1 && this.pageData.type == 2) {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: `/pages/unitTest/index?jieId=` + this.pageData.jieId
|
|
|
+ })
|
|
|
+ } else if (this.pageData.lastFlag == 1 && this.pageData.type == 1) {
|
|
|
+ // 当前是本章最后一节,并且是 视频 切换下一章
|
|
|
+ this.goNextZhang()
|
|
|
+ } else {
|
|
|
+ uni.redirectTo({
|
|
|
+ //url: '/pages/study/lookShipin?studyData=' + JSON.stringify(pageData)
|
|
|
+ url: '/pages/study/lookShipin?jieId=' + this.jieId
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getLiveYk() {
|
|
|
+ let req = {
|
|
|
+ videoId: this.videoId
|
|
|
+ }
|
|
|
+ getVideoAuthYk(req).then(res => {
|
|
|
+ this.playAuth = res.data
|
|
|
})
|
|
|
},
|
|
|
getLive() {
|
|
@@ -184,7 +211,8 @@
|
|
|
goUpPage() {
|
|
|
if (!cacheManager.get('auth')) {
|
|
|
uni.redirectTo({
|
|
|
- url: '/pages/study/index?cardId=' + this.cardId+ '&nianji=' + this.nianji+ '&zhangId=' + this.zhangId
|
|
|
+ url: '/pages/study/index?cardId=' + this.cardId + '&nianji=' + this.nianji + '&zhangId=' +
|
|
|
+ this.zhangId
|
|
|
})
|
|
|
} else {
|
|
|
uni.redirectTo({
|
|
@@ -193,8 +221,12 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ },
|
|
|
+ ykConfirm() {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/login/index'
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
created() {
|
|
|
// console.log("getLive")
|