|
@@ -1,5 +1,5 @@
|
|
|
import request from '@/helpers/request';
|
|
|
-import { state } from '@/state';
|
|
|
+import { handleShowVip, state } from '@/state';
|
|
|
import {
|
|
|
Button,
|
|
|
Cell,
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
onMounted,
|
|
|
reactive,
|
|
|
onUnmounted,
|
|
|
- TransitionGroup
|
|
|
+ TransitionGroup,
|
|
|
+ computed
|
|
|
} from 'vue';
|
|
|
import styles from './index.module.less';
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
@@ -25,13 +26,11 @@ import {
|
|
|
// import iconLook from './image/look.svg'
|
|
|
import iconCourse from './image/icon-course.png';
|
|
|
import iconCachePoint from './image/icon-cache-point.png';
|
|
|
-// import iconCourseLock from './image/icon-course-lock.png';
|
|
|
+import iconCourseLock from './image/icon-course-lock.png';
|
|
|
// import iconTip from './image/iconTip.png';
|
|
|
import { browser } from '@/helpers/utils';
|
|
|
import OEmpty from '@/components/o-empty';
|
|
|
-import { handleCheckVip, gotoMemberCenter, hasVip } from '../hook/useFee';
|
|
|
import iconList from './image/icon-list.png';
|
|
|
-// import OSticky from '@/components/o-sticky';
|
|
|
import OHeader from '@/components/o-header';
|
|
|
import { useEventListener } from '@vant/use';
|
|
|
import OLoading from '@/components/o-loading';
|
|
@@ -48,23 +47,32 @@ export default defineComponent({
|
|
|
catchItem: {} as any,
|
|
|
loading: true,
|
|
|
detail: {
|
|
|
+ id: '',
|
|
|
cover: '',
|
|
|
name: '',
|
|
|
- des: ''
|
|
|
+ des: '',
|
|
|
+ useStatus: '',
|
|
|
},
|
|
|
list: [] as any,
|
|
|
isDownloading: false // 是否在下载资源
|
|
|
});
|
|
|
|
|
|
+ /** 是否锁定 */
|
|
|
+ const isLock = computed(() => {
|
|
|
+ return data.detail.useStatus === 'LOCK' && state.platformType === 'STUDENT' ? true : false;
|
|
|
+ })
|
|
|
+
|
|
|
/** 获取课件详情 */
|
|
|
const getDetail = async () => {
|
|
|
const res: any = await request.get(
|
|
|
`${state.platformApi}/lessonCourseware/getLessonCoursewareDetail/${route.query.id}`
|
|
|
);
|
|
|
if (res?.data) {
|
|
|
+ data.detail.id = res.data.id;
|
|
|
data.detail.cover = res.data.coverImg;
|
|
|
data.detail.name = res.data.name;
|
|
|
data.detail.des = res.data.lessonTargetDesc;
|
|
|
+ data.detail.useStatus = res.data.useStatus;
|
|
|
}
|
|
|
};
|
|
|
const getList = async () => {
|
|
@@ -78,7 +86,7 @@ export default defineComponent({
|
|
|
if (Array.isArray(res?.data)) {
|
|
|
data.list = res.data;
|
|
|
res.data.forEach((item: any) => {
|
|
|
- const { knowledgePointList, ...res } = item;
|
|
|
+ const { knowledgePointList } = item;
|
|
|
const tempK = knowledgePointList || [];
|
|
|
tempK.forEach((child: any) => {
|
|
|
child.materialList = [
|
|
@@ -148,9 +156,10 @@ export default defineComponent({
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- const isVip = handleCheckVip();
|
|
|
- if (!isVip) return;
|
|
|
+ if(isLock.value) {
|
|
|
+ handleShowVip(route.query.id as string, "COURSE")
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
if (!item.hasCache) {
|
|
|
// const hasFree = String(item.accessScope) === '0';
|
|
@@ -316,12 +325,6 @@ export default defineComponent({
|
|
|
<div key="list" class={styles.periodList}>
|
|
|
<CellGroup inset>
|
|
|
{data.list.map((item: any) => {
|
|
|
- // const isLock =
|
|
|
- // item.lockFlag ||
|
|
|
- // ((route.query.code == 'select' ||
|
|
|
- // state.platformType == 'STUDENT') &&
|
|
|
- // !item.unlock);
|
|
|
- // const isSelect = route.query.code === 'select';
|
|
|
return (
|
|
|
<Cell
|
|
|
border
|
|
@@ -337,7 +340,7 @@ export default defineComponent({
|
|
|
icon: () => (
|
|
|
<div class={styles.periodItem}>
|
|
|
<div class={styles.periodItemModel}>
|
|
|
- <img src={iconCourse} />
|
|
|
+ <img src={isLock.value ? iconCourseLock : iconCourse} />
|
|
|
{item.hasCache ? (
|
|
|
<img
|
|
|
class={styles.iconCachePoint}
|
|
@@ -358,15 +361,18 @@ export default defineComponent({
|
|
|
<>
|
|
|
{item.knowledgePointList ? (
|
|
|
<>
|
|
|
- {item.hasCache ? (
|
|
|
- <Button
|
|
|
+ { isLock.value ? <Button
|
|
|
class={[
|
|
|
styles.baseBtn,
|
|
|
styles.look,
|
|
|
- state.platformType === 'STUDENT' &&
|
|
|
- !hasVip()
|
|
|
- ? styles.disabled
|
|
|
- : ''
|
|
|
+ styles.disable
|
|
|
+ ]}>
|
|
|
+ 未解锁
|
|
|
+ </Button> : item.hasCache ? (
|
|
|
+ <Button
|
|
|
+ class={[
|
|
|
+ styles.baseBtn,
|
|
|
+ styles.look
|
|
|
]}>
|
|
|
查看
|
|
|
</Button>
|
|
@@ -375,10 +381,6 @@ export default defineComponent({
|
|
|
class={[
|
|
|
styles.baseBtn,
|
|
|
styles.down,
|
|
|
- state.platformType === 'STUDENT' &&
|
|
|
- !hasVip()
|
|
|
- ? styles.disabled
|
|
|
- : '',
|
|
|
item.downloadStatus == 1
|
|
|
? styles.downing
|
|
|
: ''
|
|
@@ -406,10 +408,12 @@ export default defineComponent({
|
|
|
{data.loading && <OLoading />}
|
|
|
{!data.loading && !data.list.length && <OEmpty tips="暂无内容" />}
|
|
|
|
|
|
- {state.platformType === 'STUDENT' && !hasVip() && (
|
|
|
+ {isLock.value && (
|
|
|
<OSticky position="bottom">
|
|
|
<div class={styles.btnGroup}>
|
|
|
- <Button round block type="primary" onClick={gotoMemberCenter}>
|
|
|
+ <Button round block type="primary" onClick={() => {
|
|
|
+ handleShowVip(route.query.id as string, "COURSE")
|
|
|
+ }}>
|
|
|
开通会员即可查看所有课件
|
|
|
</Button>
|
|
|
</div>
|