|
@@ -1,11 +1,8 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <view class="ezy-xuexi-page">
|
|
|
|
|
- <view class="icon-title-navBar-box">
|
|
|
|
|
- <text class="nav-bar-title">学习</text>
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
+ <view class="ezy-page-body xuexi-page-body">
|
|
|
<!-- 滚动区域 -->
|
|
<!-- 滚动区域 -->
|
|
|
- <scroll-view v-if="existData" class="ezy-page-body xuexi-page-body" :scroll-with-animation="true" scroll-y
|
|
|
|
|
- :scroll-top="scrollTop" @scroll="handleScroll">
|
|
|
|
|
|
|
+ <scroll-view v-if="existData" :scroll-with-animation="true" scroll-y :scroll-top="scrollTop"
|
|
|
|
|
+ @scroll="handleScroll">
|
|
|
<view class="xxjl-card-box-padding">
|
|
<view class="xxjl-card-box-padding">
|
|
|
<view class="xxjl-card-box">
|
|
<view class="xxjl-card-box">
|
|
|
<!-- 显示内容 -->
|
|
<!-- 显示内容 -->
|
|
@@ -36,7 +33,8 @@
|
|
|
|
|
|
|
|
<view v-for="(danyuanItem, index) in danyuanList" :key="danyuanItem.danyuanId">
|
|
<view v-for="(danyuanItem, index) in danyuanList" :key="danyuanItem.danyuanId">
|
|
|
<!-- 单元标题(带唯一ID,用于位置查询) -->
|
|
<!-- 单元标题(带唯一ID,用于位置查询) -->
|
|
|
- <ezyActiveVue class="ezy-list-item-active item-dy-box" @aclick="handleClickDanyuan(danyuanItem.danyuanId)" :id="`unit-title-${danyuanItem.danyuanId}`">
|
|
|
|
|
|
|
+ <ezyActiveVue class="ezy-list-item-active item-dy-box"
|
|
|
|
|
+ @aclick="handleClickDanyuan(danyuanItem.danyuanId)" :id="`unit-title-${danyuanItem.danyuanId}`">
|
|
|
<view class="dy-left-box">L{{banbenInfo.dengjiId}}</view>
|
|
<view class="dy-left-box">L{{banbenInfo.dengjiId}}</view>
|
|
|
<view class="dy-right-box">
|
|
<view class="dy-right-box">
|
|
|
<view class="right-content">
|
|
<view class="right-content">
|
|
@@ -55,7 +53,8 @@
|
|
|
<view>{{ jieItem.jieName }}</view>
|
|
<view>{{ jieItem.jieName }}</view>
|
|
|
<view>{{ jieItem.jieIntro }}</view>
|
|
<view>{{ jieItem.jieIntro }}</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="xx-item-btn"></view>
|
|
|
|
|
|
|
+ <view v-if="jieItem.lock" class="xx-item-lock-btn"></view>
|
|
|
|
|
+ <view v-else class="xx-item-btn"></view>
|
|
|
</ezyActiveVue>
|
|
</ezyActiveVue>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
@@ -73,12 +72,10 @@
|
|
|
<text>暂无数据</text>
|
|
<text>暂无数据</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
-
|
|
|
|
|
<!-- 弹窗组件 -->
|
|
<!-- 弹窗组件 -->
|
|
|
<danyuanInfoVue ref="dyRef" v-if="isShow" @close="isShow = false"></danyuanInfoVue>
|
|
<danyuanInfoVue ref="dyRef" v-if="isShow" @close="isShow = false"></danyuanInfoVue>
|
|
|
-
|
|
|
|
|
- <!-- 底部 tabBar -->
|
|
|
|
|
- <custom-tab-bar :show="true" :current-index="currentTabIndex" />
|
|
|
|
|
|
|
+ <!-- 购买提示窗 -->
|
|
|
|
|
+ <tipSmallDialog ref="gmtRef" content="需要购买当前课程才能学习" @confirm-btn="handleConfirmBtn" qrBtnName="前往购买"></tipSmallDialog>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -87,7 +84,7 @@
|
|
|
import CustomTabBar from '@/components/custom-tabbar/index.vue';
|
|
import CustomTabBar from '@/components/custom-tabbar/index.vue';
|
|
|
import cacheManager from "@/utils/cacheManager.js";
|
|
import cacheManager from "@/utils/cacheManager.js";
|
|
|
import {
|
|
import {
|
|
|
- shuxueChanpinBanbenInfo,
|
|
|
|
|
|
|
+ shuxueChanpinDengjiInfo,
|
|
|
shuxueSave
|
|
shuxueSave
|
|
|
} from "@/api/chanpinneirong.js"
|
|
} from "@/api/chanpinneirong.js"
|
|
|
import {
|
|
import {
|
|
@@ -101,8 +98,10 @@
|
|
|
toast
|
|
toast
|
|
|
} from '../../utils/common';
|
|
} from '../../utils/common';
|
|
|
import {
|
|
import {
|
|
|
- updateXuexiProcess
|
|
|
|
|
- } from "./useNeirongShuxue"
|
|
|
|
|
|
|
+ updateChanpin2Process
|
|
|
|
|
+ } from "./useNeirongChanpin2"
|
|
|
|
|
+ import tipSmallDialog from "@/components/dialog/tipSmallDialog.vue";
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -115,8 +114,7 @@
|
|
|
chanpinId: '',
|
|
chanpinId: '',
|
|
|
dengjiId: '',
|
|
dengjiId: '',
|
|
|
curProcess: '',
|
|
curProcess: '',
|
|
|
- currentTabIndex: 1,
|
|
|
|
|
- existData: true,
|
|
|
|
|
|
|
+ existData: false,
|
|
|
isShow: false,
|
|
isShow: false,
|
|
|
|
|
|
|
|
stickyHeight: 0, // 吸顶栏高度(px)
|
|
stickyHeight: 0, // 吸顶栏高度(px)
|
|
@@ -133,24 +131,10 @@
|
|
|
components: {
|
|
components: {
|
|
|
CustomTabBar,
|
|
CustomTabBar,
|
|
|
danyuanInfoVue,
|
|
danyuanInfoVue,
|
|
|
- ezyActiveVue
|
|
|
|
|
- },
|
|
|
|
|
- onLoad(options) {
|
|
|
|
|
- uni.hideTabBar()
|
|
|
|
|
|
|
+ ezyActiveVue,
|
|
|
|
|
+ tipSmallDialog
|
|
|
},
|
|
},
|
|
|
- onShow() {
|
|
|
|
|
- this.currentTabIndex = 1
|
|
|
|
|
- const cacheData = cacheManager.get('contentInfo');
|
|
|
|
|
|
|
|
|
|
- if (cacheData) {
|
|
|
|
|
- console.log('使用缓存数据');
|
|
|
|
|
- this.updateFromCache();
|
|
|
|
|
- } else {
|
|
|
|
|
- console.log('重新请求数据');
|
|
|
|
|
- const cacheDataAuth = cacheManager.get('auth');
|
|
|
|
|
- this.initFromOptions(cacheDataAuth);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
onHide() {
|
|
onHide() {
|
|
|
console.log('学习页面隐藏')
|
|
console.log('学习页面隐藏')
|
|
|
},
|
|
},
|
|
@@ -158,6 +142,23 @@
|
|
|
// 页面卸载无需特殊处理
|
|
// 页面卸载无需特殊处理
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ handleConfirmBtn() {
|
|
|
|
|
+ // 加锁视频需要购买
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: "/pages/chanpinShop/cp1/dingdan"
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ initData(dengjiId) {
|
|
|
|
|
+ console.log('阿斯顿发送到发送到饭撒的');
|
|
|
|
|
+ const cacheData = cacheManager.get('contentInfo');
|
|
|
|
|
+ if (cacheData) {
|
|
|
|
|
+ console.log('使用缓存数据');
|
|
|
|
|
+ this.updateFromCache();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log('重新请求数据');
|
|
|
|
|
+ this.initFromOptions(dengjiId);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
goTopBtn() {
|
|
goTopBtn() {
|
|
|
// 替换原来的 uni.pageScrollTo
|
|
// 替换原来的 uni.pageScrollTo
|
|
|
this.scrollTop = Math.random(); // 先设置一个随机值
|
|
this.scrollTop = Math.random(); // 先设置一个随机值
|
|
@@ -173,17 +174,14 @@
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- initFromOptions(options) {
|
|
|
|
|
- //console.log('options', options);
|
|
|
|
|
- this.chanpinId = options.chanpinId;
|
|
|
|
|
- this.danyuanId = options.danyuanId;
|
|
|
|
|
- this.banbenId = options.banbenId;
|
|
|
|
|
- this.dengjiId = options.dengjiId;
|
|
|
|
|
- this.loadDataFromApi();
|
|
|
|
|
|
|
+ initFromOptions(dengjiId) {
|
|
|
|
|
+
|
|
|
|
|
+ this.loadDataFromApi(dengjiId);
|
|
|
},
|
|
},
|
|
|
// 从缓存更新数据方法
|
|
// 从缓存更新数据方法
|
|
|
updateFromCache() {
|
|
updateFromCache() {
|
|
|
- updateXuexiProcess()
|
|
|
|
|
|
|
+ console.log('12311');
|
|
|
|
|
+ updateChanpin2Process()
|
|
|
const cacheData = cacheManager.get('contentInfo');
|
|
const cacheData = cacheManager.get('contentInfo');
|
|
|
console.log('cacheData 从缓存更新数据方法', cacheData);
|
|
console.log('cacheData 从缓存更新数据方法', cacheData);
|
|
|
if (cacheData) {
|
|
if (cacheData) {
|
|
@@ -193,21 +191,35 @@
|
|
|
this.curProcess = cacheData.curProcess;
|
|
this.curProcess = cacheData.curProcess;
|
|
|
this.danyuanList = [...(cacheData.danyuanList || [])];
|
|
this.danyuanList = [...(cacheData.danyuanList || [])];
|
|
|
this.banbenId = cacheData.banbenId
|
|
this.banbenId = cacheData.banbenId
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (this.danyuanList.length == 0) {
|
|
|
|
|
+ this.existData = false
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.existData = true
|
|
|
|
|
+ }
|
|
|
// this.$nextTick(() => {
|
|
// this.$nextTick(() => {
|
|
|
// this.updateTitlePositions();
|
|
// this.updateTitlePositions();
|
|
|
// });
|
|
// });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.existData = false;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- loadDataFromApi() {
|
|
|
|
|
|
|
+ loadDataFromApi(dengjiId) {
|
|
|
|
|
+ uni.showLoading({
|
|
|
|
|
+ title: '加载中'
|
|
|
|
|
+ });
|
|
|
|
|
+ this.dengjiId = dengjiId
|
|
|
this.banbenInfo = {}
|
|
this.banbenInfo = {}
|
|
|
this.curProcess = ''
|
|
this.curProcess = ''
|
|
|
this.danyuanList = []
|
|
this.danyuanList = []
|
|
|
const req = {
|
|
const req = {
|
|
|
- banbenId: this.banbenId
|
|
|
|
|
|
|
+ dengjiId: dengjiId
|
|
|
}
|
|
}
|
|
|
- shuxueChanpinBanbenInfo(req).then(res => {
|
|
|
|
|
|
|
+ shuxueChanpinDengjiInfo(req).then(res => {
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
|
|
+
|
|
|
this.banbenInfo = res.data;
|
|
this.banbenInfo = res.data;
|
|
|
this.banbenInfo.danyuanId = res.data.curDanyuanId;
|
|
this.banbenInfo.danyuanId = res.data.curDanyuanId;
|
|
|
this.curProcess = res.data.curProcess * 100;
|
|
this.curProcess = res.data.curProcess * 100;
|
|
@@ -217,34 +229,17 @@
|
|
|
} else {
|
|
} else {
|
|
|
this.existData = true
|
|
this.existData = true
|
|
|
}
|
|
}
|
|
|
- // 保存到缓存(新增了参数保存)
|
|
|
|
|
const cacheData = {
|
|
const cacheData = {
|
|
|
...res.data,
|
|
...res.data,
|
|
|
- banbenId: this.banbenId,
|
|
|
|
|
- chanpinId: this.chanpinId,
|
|
|
|
|
- danyuanId: this.danyuanId,
|
|
|
|
|
- dengjiId: this.dengjiId
|
|
|
|
|
|
|
+ banbenId: banbenId,
|
|
|
};
|
|
};
|
|
|
cacheManager.set('contentInfo', cacheData);
|
|
cacheManager.set('contentInfo', cacheData);
|
|
|
-
|
|
|
|
|
- // 更新全局auth信息
|
|
|
|
|
- cacheManager.updateObject('auth', {
|
|
|
|
|
- chanpinId: res.data.chanpinId,
|
|
|
|
|
- banbenId: this.banbenId,
|
|
|
|
|
- danyuanId: res.data.curDanyuanId,
|
|
|
|
|
- dengjiId: res.data.dengjiId
|
|
|
|
|
- });
|
|
|
|
|
- this.danyuanId = res.data.curDanyuanId
|
|
|
|
|
- this.dengjiId = res.data.dengjiId
|
|
|
|
|
- this.chanpinId = res.data.chanpinId
|
|
|
|
|
- // 数据加载完成后初始化观察器
|
|
|
|
|
- // this.$nextTick(() => {
|
|
|
|
|
- // this.updateTitlePositions();
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ uni.hideLoading();
|
|
|
}
|
|
}
|
|
|
}).catch(res => {
|
|
}).catch(res => {
|
|
|
cacheManager.remove("contentInfo");
|
|
cacheManager.remove("contentInfo");
|
|
|
toast("加载失败,请重试");
|
|
toast("加载失败,请重试");
|
|
|
|
|
+ uni.hideLoading();
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -286,42 +281,47 @@
|
|
|
"jieId": jieId
|
|
"jieId": jieId
|
|
|
}
|
|
}
|
|
|
console.log('req', req);
|
|
console.log('req', req);
|
|
|
- try {
|
|
|
|
|
- const res = await shuxueSave(req);
|
|
|
|
|
- if (res.code == 0 && res.data) {
|
|
|
|
|
- let curJieAndDanyuan = this.getJieAndDanyuan(this.banbenInfo, jieId);
|
|
|
|
|
- if (!curJieAndDanyuan) {
|
|
|
|
|
- toast("未找到课程信息");
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const res = await shuxueSave(req);
|
|
|
|
|
+ if (res.code == 0) {
|
|
|
|
|
+ let curJieAndDanyuan = this.getJieAndDanyuan(this.banbenInfo, jieId);
|
|
|
|
|
+ if (!curJieAndDanyuan) {
|
|
|
|
|
+ toast("未找到课程信息");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- const cacheData = cacheManager.get('contentInfo') || {};
|
|
|
|
|
- cacheData.curDanyuanName = curJieAndDanyuan.danyuan.danyuanName;
|
|
|
|
|
- cacheData.curKechengName = curJieAndDanyuan.jie.jieIntro;
|
|
|
|
|
- cacheData.danyuanId = curJieAndDanyuan.jie.danyuanId;
|
|
|
|
|
- cacheData.curJieId = jieId;
|
|
|
|
|
- cacheData.type = curJieAndDanyuan.jie.type;
|
|
|
|
|
- cacheManager.set('contentInfo', cacheData);
|
|
|
|
|
|
|
+ const cacheData = cacheManager.get('contentInfo') || {};
|
|
|
|
|
+ cacheData.curDanyuanName = curJieAndDanyuan.danyuan.danyuanName;
|
|
|
|
|
+ cacheData.curKechengName = curJieAndDanyuan.jie.jieIntro;
|
|
|
|
|
+ cacheData.danyuanId = curJieAndDanyuan.jie.danyuanId;
|
|
|
|
|
+ cacheData.curJieId = jieId;
|
|
|
|
|
+ cacheData.type = curJieAndDanyuan.jie.type;
|
|
|
|
|
+ cacheManager.set('contentInfo', cacheData);
|
|
|
|
|
|
|
|
- if (type == 1) {
|
|
|
|
|
- uni.navigateTo({
|
|
|
|
|
- url: `/pages/xinshuxue/lookShipin?jieId=${jieId}`
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- uni.navigateTo({
|
|
|
|
|
- url: `/pages/xinshuxue/unitTest?jieId=${jieId}`
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (type == 1) {
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: `/pages/xinshuxue/lookShipin?jieId=${jieId}`
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
- toast("保存位置出错");
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: `/pages/xinshuxue/unitTest?jieId=${jieId}`
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
- } catch (error) {
|
|
|
|
|
- toast("保存失败");
|
|
|
|
|
|
|
+ } else {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
handlePlay(da, code) {
|
|
handlePlay(da, code) {
|
|
|
|
|
+
|
|
|
|
|
+ if (da.lock && code == 'play') {
|
|
|
|
|
+
|
|
|
|
|
+ this.$refs.gmtRef.handleShow();
|
|
|
|
|
+
|
|
|
|
|
+ // 加锁视频需要购买
|
|
|
|
|
+ // uni.navigateTo({
|
|
|
|
|
+ // url: "/pages/chanpinShop/cp1/dingdan"
|
|
|
|
|
+ // })
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
let jieId = code === 'jixu' ? da.curJieId : da.jieId;
|
|
let jieId = code === 'jixu' ? da.curJieId : da.jieId;
|
|
|
if (!jieId) {
|
|
if (!jieId) {
|
|
|
toast("无课程ID");
|
|
toast("无课程ID");
|
|
@@ -354,4 +354,4 @@
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-</script>
|
|
|
|
|
|
|
+</script>
|