|
@@ -53,7 +53,8 @@ export default defineComponent({
|
|
|
name: '',
|
|
|
des: ''
|
|
|
},
|
|
|
- list: [] as any
|
|
|
+ list: [] as any,
|
|
|
+ isDownloading: false // 是否在下载资源
|
|
|
});
|
|
|
|
|
|
/** 获取课件详情 */
|
|
@@ -157,11 +158,11 @@ export default defineComponent({
|
|
|
// 下载中不提示
|
|
|
if (item.downloadStatus == 1) {
|
|
|
// 取消下载
|
|
|
- removeListenerMessage('downloadCoursewareToCache', getProgress);
|
|
|
postMessage({ api: 'cancelDownloadCourseware' });
|
|
|
setTimeout(() => {
|
|
|
postMessage({ api: 'cancelDownloadCourseware' });
|
|
|
item.downloadStatus = 0;
|
|
|
+ data.isDownloading = false;
|
|
|
}, 1000);
|
|
|
showLoadingToast({
|
|
|
message: '取消中...',
|
|
@@ -234,7 +235,7 @@ export default defineComponent({
|
|
|
const downCatch = async (item: any) => {
|
|
|
if (browserInfo.isApp) {
|
|
|
data.catchStatus = false;
|
|
|
-
|
|
|
+ data.isDownloading = true;
|
|
|
const res = await postMessage({
|
|
|
api: 'downloadCoursewareToCache',
|
|
|
content: {
|
|
@@ -249,6 +250,9 @@ export default defineComponent({
|
|
|
// 下载缓存进度
|
|
|
const getProgress = (res: any) => {
|
|
|
// console.log('🚀 ~ res', res)
|
|
|
+ if (!data.isDownloading) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (res?.content?.lessonCoursewareDetailId) {
|
|
|
const { lessonCoursewareDetailId, downloadStatus, progress } =
|
|
|
res.content;
|
|
@@ -261,6 +265,8 @@ export default defineComponent({
|
|
|
if (downloadStatus == 2) {
|
|
|
course.hasCache = 1;
|
|
|
course.progress = 100;
|
|
|
+ // 下载完成
|
|
|
+ data.isDownloading = false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -352,27 +358,26 @@ export default defineComponent({
|
|
|
<>
|
|
|
{item.hasCache ? (
|
|
|
<Button
|
|
|
- disabled={!hasVip()}
|
|
|
- class={[styles.baseBtn, styles.look]}>
|
|
|
+ class={[
|
|
|
+ styles.baseBtn,
|
|
|
+ styles.look,
|
|
|
+ !hasVip() ? styles.disabled : ''
|
|
|
+ ]}>
|
|
|
查看
|
|
|
</Button>
|
|
|
) : (
|
|
|
<Button
|
|
|
- disabled={!hasVip()}
|
|
|
class={[
|
|
|
styles.baseBtn,
|
|
|
styles.down,
|
|
|
+ !hasVip() ? styles.disabled : '',
|
|
|
item.downloadStatus == 1
|
|
|
? styles.downing
|
|
|
: ''
|
|
|
]}>
|
|
|
{item.downloadStatus === 1
|
|
|
? `取消下载`
|
|
|
- : item.downloadStatus === 2
|
|
|
- ? '成功'
|
|
|
- : item.downloadStatus === 3
|
|
|
- ? '重试'
|
|
|
- : '下载'}
|
|
|
+ : '查看'}
|
|
|
</Button>
|
|
|
)}
|
|
|
</>
|
|
@@ -406,8 +411,10 @@ export default defineComponent({
|
|
|
<Popup
|
|
|
v-model:show={data.catchStatus}
|
|
|
round
|
|
|
- closeable
|
|
|
class={styles.courseDialog}>
|
|
|
+ <i
|
|
|
+ class={styles.iconClose}
|
|
|
+ onClick={() => (data.catchStatus = false)}></i>
|
|
|
<div class={styles.title}>下载提醒</div>
|
|
|
|
|
|
<div class={styles.content}>
|