|
@@ -1,6 +1,6 @@
|
|
|
import request from '@/helpers/request'
|
|
|
import { state } from '@/state'
|
|
|
-import { Button, Cell, CellGroup, Popup, Dialog, Toast } from 'vant'
|
|
|
+import { Button, Cell, CellGroup, Popup, Dialog, Toast, Circle } from 'vant'
|
|
|
import { Vue3Lottie } from 'vue3-lottie'
|
|
|
import AstronautJSON from '../music-detail/animate/bigLoad.json'
|
|
|
import {
|
|
@@ -13,29 +13,23 @@ import {
|
|
|
} from 'vue'
|
|
|
import styles from './index.module.less'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
+import { state as baseState } from '@/state'
|
|
|
+import { orderStatus } from '@/views/order-detail/orderStatus'
|
|
|
import {
|
|
|
listenerMessage,
|
|
|
postMessage,
|
|
|
removeListenerMessage
|
|
|
} from '@/helpers/native-message'
|
|
|
-// 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 iconTip from './image/iconTip.png';
|
|
|
+import play from './image/paly.png'
|
|
|
import { browser } from '@/helpers/utils'
|
|
|
import ColResult from '@/components/col-result'
|
|
|
-function hasVip() {
|
|
|
- return false
|
|
|
-}
|
|
|
-function handleCheckVip() {
|
|
|
- return false
|
|
|
-}
|
|
|
+import { useEventListener } from '@vant/use'
|
|
|
import TheSticky from '@/components/the-sticky'
|
|
|
import ColHeader from '@/components/col-header'
|
|
|
import iconList from './image/icon-list.png'
|
|
|
// import OSticky from '@/components/o-sticky';
|
|
|
-import { useEventListener } from '@vant/use'
|
|
|
export default defineComponent({
|
|
|
name: 'courseList',
|
|
|
setup() {
|
|
@@ -47,32 +41,35 @@ export default defineComponent({
|
|
|
catchStatus: false,
|
|
|
catchItem: {} as any,
|
|
|
loading: true,
|
|
|
- detail: {
|
|
|
- cover: '',
|
|
|
- name: '',
|
|
|
- des: ''
|
|
|
- },
|
|
|
+ detail: {} as Record<string, any>,
|
|
|
list: [] as any,
|
|
|
isDownloading: false // 是否在下载资源
|
|
|
})
|
|
|
-
|
|
|
+ const apiSuffix = ref(
|
|
|
+ baseState.platformType === 'STUDENT' ? '/api-student' : '/api-teacher'
|
|
|
+ )
|
|
|
/** 获取课件详情 */
|
|
|
const getDetail = async () => {
|
|
|
- const res: any = await request.get(
|
|
|
- `${state.platformApi}/lessonCourseware/getLessonCoursewareDetail/${route.query.id}`
|
|
|
- )
|
|
|
- if (res?.data) {
|
|
|
- data.detail.cover = res.data.coverImg
|
|
|
- data.detail.name = res.data.name
|
|
|
- data.detail.des = res.data.lessonTargetDesc
|
|
|
+ try {
|
|
|
+ const res: any = await request.post(
|
|
|
+ `/api-student/tenantAlbumMusic/getLessonCoursewareDetail`,
|
|
|
+ {
|
|
|
+ data: {
|
|
|
+ lessonCoursewareId: route.query.id,
|
|
|
+ albumId: route.query.albumId
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ data.detail = res?.data || {}
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
}
|
|
|
}
|
|
|
const getList = async () => {
|
|
|
data.loading = true
|
|
|
try {
|
|
|
const res: any = await request.get(
|
|
|
- state.platformApi +
|
|
|
- '/lessonCourseware/getLessonCoursewareCourseList/' +
|
|
|
+ '/api-student/tenantAlbumMusic/getLessonCoursewareCourseList/' +
|
|
|
route.query.id
|
|
|
)
|
|
|
if (Array.isArray(res?.data)) {
|
|
@@ -136,16 +133,20 @@ export default defineComponent({
|
|
|
})
|
|
|
|
|
|
const handleClick = async (item: any) => {
|
|
|
+ if (!data.detail?.play) {
|
|
|
+ if (!browser().isApp) {
|
|
|
+ onDownloadApp()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ onSubmit()
|
|
|
+ return
|
|
|
+ }
|
|
|
if (!item.knowledgePointList) {
|
|
|
Dialog.confirm({
|
|
|
message: '该课件暂无知识点'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- const isVip = handleCheckVip()
|
|
|
- if (!isVip) return
|
|
|
-
|
|
|
if (!item.hasCache) {
|
|
|
// const hasFree = String(item.accessScope) === '0';
|
|
|
// if (!hasFree) {
|
|
@@ -229,6 +230,7 @@ export default defineComponent({
|
|
|
}
|
|
|
// 下载缓存
|
|
|
const downCatch = async (item: any) => {
|
|
|
+ console.log(item)
|
|
|
if (browserInfo.isApp) {
|
|
|
data.catchStatus = false
|
|
|
data.isDownloading = true
|
|
@@ -274,12 +276,107 @@ export default defineComponent({
|
|
|
document.documentElement.scrollTop
|
|
|
data.titleOpacity = height > 100 ? 1 : height / 100
|
|
|
})
|
|
|
+ // 购买
|
|
|
+ const onSubmit = async () => {
|
|
|
+ const url =
|
|
|
+ apiSuffix.value +
|
|
|
+ '/tenantGroupAlbum/buyAlbumInfo?tenantGroupAlbumId=' +
|
|
|
+ (route.query.taId || '')
|
|
|
+ // if (state.albumId) {
|
|
|
+ // url = url + '?albumId=' + state.albumId
|
|
|
+ // }
|
|
|
+ const { data } = await request.get(url)
|
|
|
+ const details = data[0]
|
|
|
+ orderStatus.orderObject.orderType = 'TENANT_ALBUM'
|
|
|
+ orderStatus.orderObject.orderName = details.name
|
|
|
+ orderStatus.orderObject.orderDesc = details.name
|
|
|
+ orderStatus.orderObject.actualPrice = details.actualPrice
|
|
|
+ // orderStatus.orderObject.recomUserId = route.query.recomUserId || 0
|
|
|
+ // orderStatus.orderObject.activityId = route.query.activityId || 0
|
|
|
+ orderStatus.orderObject.orderNo = ''
|
|
|
+ orderStatus.orderObject.orderList = [
|
|
|
+ {
|
|
|
+ orderType: 'TENANT_ALBUM',
|
|
|
+ goodsName: details.name,
|
|
|
+ actualPrice: details.actualPrice,
|
|
|
+ price: details.actualPrice,
|
|
|
+ ...details
|
|
|
+ }
|
|
|
+ ]
|
|
|
+
|
|
|
+ const res = await request.post('/api-student/userOrder/getPendingOrder', {
|
|
|
+ data: {
|
|
|
+ goodType: 'TENANT_ALBUM',
|
|
|
+ bizId: details.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ const result = res.data
|
|
|
+ if (result) {
|
|
|
+ Dialog.confirm({
|
|
|
+ title: '提示',
|
|
|
+ message: '您有一个未支付的订单,是否继续支付?',
|
|
|
+ theme: 'round-button',
|
|
|
+ className: 'confirm-button-group',
|
|
|
+ cancelButtonText: '取消订单',
|
|
|
+ confirmButtonText: '继续支付'
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ orderStatus.orderObject.orderNo = result.orderNo
|
|
|
+ orderStatus.orderObject.actualPrice = result.actualPrice
|
|
|
+ orderStatus.orderObject.discountPrice = result.discountPrice
|
|
|
+ orderStatus.orderObject.paymentConfig = {
|
|
|
+ ...result.paymentConfig,
|
|
|
+ paymentVendor: result.paymentVendor,
|
|
|
+ paymentVersion: result.paymentVersion
|
|
|
+ }
|
|
|
+
|
|
|
+ routerToALBUM(details.id)
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ Dialog.close()
|
|
|
+ // 只用取消订单,不用做其它处理
|
|
|
+ cancelPaymentALBUM(result.orderNo)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ routerToALBUM(details.id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const cancelPaymentALBUM = async (orderNo: string) => {
|
|
|
+ try {
|
|
|
+ await request.post('/api-student/userOrder/orderCancel/v2', {
|
|
|
+ data: {
|
|
|
+ orderNo
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const routerToALBUM = (id: string) => {
|
|
|
+ router.push({
|
|
|
+ path: '/orderDetail',
|
|
|
+ query: {
|
|
|
+ orderType: 'ALBUM',
|
|
|
+ album: id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ const onDownloadApp = () => {
|
|
|
+ Dialog.alert({
|
|
|
+ title: '提示',
|
|
|
+ message: '请在酷乐秀APP中使用',
|
|
|
+ confirmButtonColor: '#2dc7aa'
|
|
|
+ }).then(() => {
|
|
|
+ window.location.href = location.origin + '/student/#/download'
|
|
|
+ })
|
|
|
+ }
|
|
|
return () => (
|
|
|
<div class={styles.courseList}>
|
|
|
<TheSticky position="top">
|
|
|
<ColHeader
|
|
|
hideHeader={false}
|
|
|
- background="transparent"
|
|
|
+ background={`rgba(255,255,255, ${data.titleOpacity})`}
|
|
|
isFixed={false}
|
|
|
border={false}
|
|
|
title={'教程详情'}
|
|
@@ -289,7 +386,7 @@ export default defineComponent({
|
|
|
<div class={styles.periodContent}>
|
|
|
<div class={styles.cover}>
|
|
|
<img
|
|
|
- src={data.detail.cover}
|
|
|
+ src={data.detail.coverImg}
|
|
|
onLoad={(e: Event) => {
|
|
|
if (e.target) {
|
|
|
;(e.target as any).style.opacity = 1
|
|
@@ -299,7 +396,9 @@ export default defineComponent({
|
|
|
</div>
|
|
|
<div>
|
|
|
<div class={styles.contentTitle}>{data.detail.name}</div>
|
|
|
- <div class={styles.contentLabel}>教学目标:{data.detail.des}</div>
|
|
|
+ <div class={styles.contentLabel}>
|
|
|
+ 教学目标:{data.detail.lessonTargetDesc}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<TransitionGroup name="van-fade">
|
|
@@ -345,7 +444,7 @@ export default defineComponent({
|
|
|
) : (
|
|
|
''
|
|
|
)}
|
|
|
- {item.downloadStatus === 1 && (
|
|
|
+ {item.downloadStatus == 1 && (
|
|
|
<div class={styles.downloading}>{`${
|
|
|
item.progress || 0
|
|
|
}%`}</div>
|
|
@@ -357,37 +456,20 @@ export default defineComponent({
|
|
|
<>
|
|
|
{item.knowledgePointList ? (
|
|
|
<>
|
|
|
- {item.hasCache ? (
|
|
|
- <Button
|
|
|
- class={[
|
|
|
- styles.baseBtn,
|
|
|
- styles.look,
|
|
|
- state.platformType === 'STUDENT' &&
|
|
|
- !hasVip()
|
|
|
- ? styles.disabled
|
|
|
- : ''
|
|
|
- ]}
|
|
|
- >
|
|
|
- 查看
|
|
|
- </Button>
|
|
|
+ {item.hasCache ||
|
|
|
+ item.downloadStatus !== 1 ? (
|
|
|
+ <img class={styles.basePlay} src={play} />
|
|
|
) : (
|
|
|
- <Button
|
|
|
- class={[
|
|
|
- styles.baseBtn,
|
|
|
- styles.down,
|
|
|
- state.platformType === 'STUDENT' &&
|
|
|
- !hasVip()
|
|
|
- ? styles.disabled
|
|
|
- : '',
|
|
|
- item.downloadStatus == 1
|
|
|
- ? styles.downing
|
|
|
- : ''
|
|
|
- ]}
|
|
|
- >
|
|
|
- {item.downloadStatus === 1
|
|
|
- ? `取消下载`
|
|
|
- : '查看'}
|
|
|
- </Button>
|
|
|
+ <div class={styles.circleProgress}>
|
|
|
+ <Circle
|
|
|
+ v-model:current-rate={item.progress}
|
|
|
+ rate={item.progress}
|
|
|
+ speed={10}
|
|
|
+ stroke-width={80}
|
|
|
+ layer-color={'#B3B3B3'}
|
|
|
+ color={'#FE2451'}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
)}
|
|
|
</>
|
|
|
) : (
|
|
@@ -416,6 +498,27 @@ export default defineComponent({
|
|
|
{!data.loading && !data.list.length && (
|
|
|
<ColResult tips="暂无内容" classImgSize="SMALL" btnStatus={false} />
|
|
|
)}
|
|
|
+ <TheSticky position="bottom">
|
|
|
+ {data.detail.id && !data.detail.play && (
|
|
|
+ <div class={styles.footers}>
|
|
|
+ <Button
|
|
|
+ round
|
|
|
+ block
|
|
|
+ type="primary"
|
|
|
+ color="linear-gradient(270deg, #FF3C81 0%, #FF76A6 100%)"
|
|
|
+ onClick={() => {
|
|
|
+ if (!browser().isApp) {
|
|
|
+ onDownloadApp()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ onSubmit()
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 开通训练教程
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </TheSticky>
|
|
|
<Popup
|
|
|
v-model:show={data.catchStatus}
|
|
|
round
|