|
@@ -51,8 +51,9 @@
|
|
|
<script>
|
|
|
import pdf from 'vue-pdf';
|
|
|
import { GetCoursewareContent_View } from '@/api/course';
|
|
|
-import { GetFileStoreInfo } from '@/api/app';
|
|
|
+import { GetFileStoreInfo, getContentFile } from '@/api/app';
|
|
|
import { FinishMyMaterial } from '@/api/live';
|
|
|
+import { getToken } from '@/utils/auth';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
@@ -122,6 +123,9 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.uploadBookWriteParent();
|
|
|
+ },
|
|
|
methods: {
|
|
|
dialogMaterialClose() {
|
|
|
this.$emit('dialogMaterialClose');
|
|
@@ -178,7 +182,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
finishMyMaterial() {
|
|
|
- if (this.materialType === 'COURSEWARE' && this.exam_answer.length === 0) {
|
|
|
+ if (this.materialType === 'COURSEWARE' && !this.$refs.courseware.handleBookIsDone()) {
|
|
|
this.$message.warning('请完成课件');
|
|
|
return;
|
|
|
}
|
|
@@ -195,6 +199,53 @@ export default {
|
|
|
|
|
|
isImage(type) {
|
|
|
return ['jpeg', 'gif', 'jpg', 'png', 'bmp', 'pic', 'svg'].includes(type);
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 课件方法
|
|
|
+ */
|
|
|
+ // 上传文件
|
|
|
+ uploadBookWriteParent() {
|
|
|
+ const { token, isHas } = getToken();
|
|
|
+ let UserCode = isHas ? token.user_code : '';
|
|
|
+ let UserType = isHas ? token.user_type : '';
|
|
|
+ let SessionID = isHas ? token.session_id : '';
|
|
|
+ this.bookuploadUrl = `${process.env.VUE_APP_BASE_API}/GCLSFileServer/WebFileUpload?UserCode=${UserCode}&UserType=${UserType}&SessionID=${SessionID}&SecurityLevel=Mid`;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 下载文件zip
|
|
|
+ downloadBookWriteParent(idList) {
|
|
|
+ let MethodName = 'file_store_manager-StartCreateFileCompressPack';
|
|
|
+ let data = {
|
|
|
+ file_id_list: JSON.parse(idList)
|
|
|
+ };
|
|
|
+ getContentFile(MethodName, data).then(res => {
|
|
|
+ let id = res.file_compress_task_id;
|
|
|
+ this.bookDownTimer = setInterval(() => {
|
|
|
+ this.checkTaskProgress(id);
|
|
|
+ }, 2000);
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 成功后调用打包进度
|
|
|
+ checkTaskProgress(taskId) {
|
|
|
+ const { token, isHas } = getToken();
|
|
|
+ let UserCode = isHas ? token.user_code : '';
|
|
|
+ let UserType = isHas ? token.user_type : '';
|
|
|
+ let SessionID = isHas ? token.session_id : '';
|
|
|
+
|
|
|
+ let MethodName = 'file_store_manager-GetFileCompressTaskProgress';
|
|
|
+ let data = {
|
|
|
+ file_compress_task_id: taskId
|
|
|
+ };
|
|
|
+ getContentFile(MethodName, data).then(res => {
|
|
|
+ if (res.is_finish === 'true') {
|
|
|
+ clearInterval(this.bookDownTimer);
|
|
|
+ window.open(
|
|
|
+ `${process.env.VUE_APP_BASE_API}/GCLSFileServer/WebFileDownload?UserCode=${UserCode}&UserType=${UserType}&SessionID=${SessionID}&FileID=${res.compress_pack_file_id}`
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|