|
|
@@ -51,14 +51,13 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="creator_name" label="创建人" width="120" align="center" />
|
|
|
<el-table-column prop="create_time" label="创建时间" width="160" align="center" />
|
|
|
- <el-table-column label="操作" fixed="right" width="220" align="center">
|
|
|
+ <el-table-column label="操作" fixed="right" width="180" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
<span class="link" @click="selectDirectory(row.id)">导出离线包</span>
|
|
|
+ <el-divider direction="vertical" />
|
|
|
<span class="link" @click="handleDisable(row.id)">废弃</span>
|
|
|
<el-divider direction="vertical" />
|
|
|
<span class="link" @click="handleDel(row.id)">删除</span>
|
|
|
- <el-divider direction="vertical" />
|
|
|
- <span class="link" @click="handleActive('', row.id)">激活</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="memo" label="备注" />
|
|
|
@@ -126,7 +125,6 @@ import {
|
|
|
AddBookOfflinePackAuth,
|
|
|
DeleteBookOfflinePackAuth,
|
|
|
DisableBookOfflinePackAuth,
|
|
|
- BookOfflinePackActivate,
|
|
|
PageQueryBookOfflinePackAuthList,
|
|
|
CreateBookOfflinePackChapterStructFileList,
|
|
|
CreateOfflinePackCoursewareFileList,
|
|
|
@@ -295,11 +293,6 @@ export default {
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
},
|
|
|
- handleActive(id) {
|
|
|
- BookOfflinePackActivate({ id }).then(() => {
|
|
|
- this.queryList();
|
|
|
- });
|
|
|
- },
|
|
|
|
|
|
/**
|
|
|
* 选择保存离线包的目录
|
|
|
@@ -356,21 +349,23 @@ export default {
|
|
|
}
|
|
|
|
|
|
if (courseware_id_list && courseware_id_list.length > 0) {
|
|
|
- this.downloadWatcher = this.$watch(
|
|
|
- 'downloadProgress',
|
|
|
- (newVal) => {
|
|
|
- if (newVal >= 100) {
|
|
|
- this.downloadWatcher();
|
|
|
- this.startCompress();
|
|
|
- } else {
|
|
|
- // 显示下载进度,预留 10% 的压缩进度
|
|
|
- this.loadingInstance.text = `正在下载离线包,进度:${((this.downloadCompleted / (this.downloadTotal + this.downloadTotal * 0.1)) * 100).toFixed(2)}%`;
|
|
|
- }
|
|
|
- },
|
|
|
- { immediate: true },
|
|
|
- );
|
|
|
-
|
|
|
- Promise.all(courseware_id_list.map((courseware_id) => this.CreateOfflinePackCoursewareFileList(courseware_id)));
|
|
|
+ Promise.all(
|
|
|
+ courseware_id_list.map((courseware_id) => this.CreateOfflinePackCoursewareFileList(courseware_id)),
|
|
|
+ ).then(() => {
|
|
|
+ this.downloadWatcher = this.$watch(
|
|
|
+ 'downloadProgress',
|
|
|
+ (newVal) => {
|
|
|
+ if (newVal >= 100) {
|
|
|
+ this.downloadWatcher();
|
|
|
+ this.startCompress();
|
|
|
+ } else {
|
|
|
+ // 显示下载进度,预留 10% 的压缩进度
|
|
|
+ this.loadingInstance.text = `正在下载离线包,进度:${((this.downloadCompleted / (this.downloadTotal + this.downloadTotal * 0.1)) * 100).toFixed(2)}%`;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { immediate: true },
|
|
|
+ );
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
|