|
@@ -2678,7 +2678,7 @@
|
|
|
|
|
|
<div style="margin: 0 0 10px 0; padding: 0" v-for="(item, index) in unitJson[unitIndex].chapterInfo"
|
|
<div style="margin: 0 0 10px 0; padding: 0" v-for="(item, index) in unitJson[unitIndex].chapterInfo"
|
|
:key="index">
|
|
:key="index">
|
|
- <div v-if="courseState == 4" style="position: relative;
|
|
|
|
|
|
+ <div v-loading="anLoading[0]" v-if="courseState == 4" style="position: relative;
|
|
background: #fff;
|
|
background: #fff;
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
padding: 1px 20px 10px;
|
|
padding: 1px 20px 10px;
|
|
@@ -2703,7 +2703,7 @@
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div>
|
|
|
|
|
|
+ <div >
|
|
<div class="add_chapters_box add_c_none" v-if="
|
|
<div class="add_chapters_box add_c_none" v-if="
|
|
item.taskJson[0].chapterData &&
|
|
item.taskJson[0].chapterData &&
|
|
item.taskJson[0].chapterData.length == 0
|
|
item.taskJson[0].chapterData.length == 0
|
|
@@ -3117,6 +3117,7 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div
|
|
<div
|
|
|
|
+ v-loading="anLoading[itemTaskIndex]"
|
|
style="position: relative"
|
|
style="position: relative"
|
|
v-if="courseState == 5"
|
|
v-if="courseState == 5"
|
|
>
|
|
>
|
|
@@ -7877,6 +7878,7 @@ export default {
|
|
r_agentid: "",
|
|
r_agentid: "",
|
|
course_info: "",
|
|
course_info: "",
|
|
stepShow: true,
|
|
stepShow: true,
|
|
|
|
+ anLoading: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
directives: {
|
|
directives: {
|
|
@@ -9634,9 +9636,9 @@ export default {
|
|
},
|
|
},
|
|
async createTeacherAn(index){
|
|
async createTeacherAn(index){
|
|
// this.lineCount = index;
|
|
// this.lineCount = index;
|
|
- this.loading = true
|
|
|
|
let md = new MarkdownIt();
|
|
let md = new MarkdownIt();
|
|
if(this.courseState == 4){
|
|
if(this.courseState == 4){
|
|
|
|
+ this.anLoading[0] = true
|
|
// if(index == 0 || index){
|
|
// if(index == 0 || index){
|
|
// let _task = this.unitJson[0].chapterInfo[0].taskJson[index]
|
|
// let _task = this.unitJson[0].chapterInfo[0].taskJson[index]
|
|
// let name = _task.task+'-教案'
|
|
// let name = _task.task+'-教案'
|
|
@@ -9651,6 +9653,7 @@ export default {
|
|
}
|
|
}
|
|
// }
|
|
// }
|
|
}else if(this.courseState == 5){
|
|
}else if(this.courseState == 5){
|
|
|
|
+ this.anLoading[index] = true
|
|
if(index == 0 || index){
|
|
if(index == 0 || index){
|
|
let _task = this.unitJson[0].chapterInfo[0].taskJson[index]
|
|
let _task = this.unitJson[0].chapterInfo[0].taskJson[index]
|
|
let name = _task.task+'-教案'
|
|
let name = _task.task+'-教案'
|
|
@@ -9766,11 +9769,18 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
|
|
let file = new File([blob], dname, { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
|
|
let file = new File([blob], dname, { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
|
|
let params = convertApi.createParams()
|
|
let params = convertApi.createParams()
|
|
params.add('file', file)
|
|
params.add('file', file)
|
|
- let result = await convertApi.convert('docx', 'docx', params)
|
|
|
|
- file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
|
|
|
|
- return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
|
|
|
|
- });
|
|
|
|
- await this.beforeUploadHtml(file, index, callback)
|
|
|
|
|
|
+ try {
|
|
|
|
+ let result = await convertApi.convert('docx', 'docx', params)
|
|
|
|
+ file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
|
|
|
|
+ return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
|
|
|
|
+ });
|
|
|
|
+ await this.beforeUploadHtml(file, index, callback)
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log('=================','报错')
|
|
|
|
+ await this.beforeUploadHtml(file, index, callback)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
},
|
|
},
|
|
async generateExport(a, html, index) {
|
|
async generateExport(a, html, index) {
|
|
// <html lang="en">
|
|
// <html lang="en">
|
|
@@ -9809,13 +9819,19 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
|
|
let file = new File([blob], dname, { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
|
|
let file = new File([blob], dname, { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
|
|
let params = convertApi.createParams()
|
|
let params = convertApi.createParams()
|
|
params.add('file', file)
|
|
params.add('file', file)
|
|
- let result = await convertApi.convert('docx', 'docx', params)
|
|
|
|
- file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
|
|
|
|
- return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
|
|
|
|
- });
|
|
|
|
|
|
+ try {
|
|
|
|
+ let result = await convertApi.convert('docx', 'docx', params)
|
|
|
|
+ file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
|
|
|
|
+ return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
|
|
|
|
+ });
|
|
|
|
|
|
- // 执行下载
|
|
|
|
- saveAs(file, dname);
|
|
|
|
|
|
+ // 执行下载
|
|
|
|
+ saveAs(file, dname);
|
|
|
|
+ } catch (error) {
|
|
|
|
+ saveAs(file, dname);
|
|
|
|
+ // this.$message.error('导出失败')
|
|
|
|
+ }
|
|
|
|
+
|
|
// return file
|
|
// return file
|
|
},
|
|
},
|
|
async generateExport2(a, html, index) {
|
|
async generateExport2(a, html, index) {
|
|
@@ -9856,12 +9872,17 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
|
|
let file = new File([blob], dname, { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
|
|
let file = new File([blob], dname, { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
|
|
let params = convertApi.createParams()
|
|
let params = convertApi.createParams()
|
|
params.add('file', file)
|
|
params.add('file', file)
|
|
- let result = await convertApi.convert('docx', 'docx', params)
|
|
|
|
- file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
|
|
|
|
- return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
|
|
|
|
- });
|
|
|
|
|
|
+ try {
|
|
|
|
+ let result = await convertApi.convert('docx', 'docx', params)
|
|
|
|
+ file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
|
|
|
|
+ return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ resolve(file); // 通过 Promise 返回 File 对象
|
|
|
|
+ } catch (error) {
|
|
|
|
+ resolve(''); // 通过 Promise 返回 File 对象
|
|
|
|
+ }
|
|
|
|
|
|
- resolve(file); // 通过 Promise 返回 File 对象
|
|
|
|
});
|
|
});
|
|
},
|
|
},
|
|
beforeUploadHtml(event, index, callback) {
|
|
beforeUploadHtml(event, index, callback) {
|
|
@@ -9901,13 +9922,15 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
|
|
})
|
|
})
|
|
.send(function (err, data) {
|
|
.send(function (err, data) {
|
|
if(index == (_this.unitJson[0].chapterInfo[0].taskJson.length - 1) && _this.courseState == 4){
|
|
if(index == (_this.unitJson[0].chapterInfo[0].taskJson.length - 1) && _this.courseState == 4){
|
|
- _this.loading = false
|
|
|
|
|
|
+ _this.anLoading[0] = false
|
|
}
|
|
}
|
|
|
|
|
|
if(_this.courseState == 5){
|
|
if(_this.courseState == 5){
|
|
- _this.loading = false
|
|
|
|
|
|
+ _this.anLoading[index] = false
|
|
}
|
|
}
|
|
callback ? callback() : ''
|
|
callback ? callback() : ''
|
|
|
|
+ _this.$forceUpdate();
|
|
|
|
+
|
|
if (err) {
|
|
if (err) {
|
|
_this.$message.error("上传失败");
|
|
_this.$message.error("上传失败");
|
|
} else {
|
|
} else {
|
|
@@ -9966,11 +9989,16 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
|
|
let file = new File([blob], dname, { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
|
|
let file = new File([blob], dname, { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
|
|
let params = convertApi.createParams()
|
|
let params = convertApi.createParams()
|
|
params.add('file', file)
|
|
params.add('file', file)
|
|
- let result = await convertApi.convert('docx', 'docx', params)
|
|
|
|
- file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
|
|
|
|
- return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
|
|
|
|
- });
|
|
|
|
- await this.beforeUploadHtml2(file, index, callback)
|
|
|
|
|
|
+ try {
|
|
|
|
+ let result = await convertApi.convert('docx', 'docx', params)
|
|
|
|
+ file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
|
|
|
|
+ return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
|
|
|
|
+ });
|
|
|
|
+ await this.beforeUploadHtml2(file, index, callback)
|
|
|
|
+ } catch (error) {
|
|
|
|
+ await this.beforeUploadHtml2(file, index, callback)
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
},
|
|
},
|
|
beforeUploadHtml2(event, index, callback) {
|
|
beforeUploadHtml2(event, index, callback) {
|
|
var file = event;
|
|
var file = event;
|
|
@@ -10807,11 +10835,58 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
|
|
// this.inputShow = true;
|
|
// this.inputShow = true;
|
|
let params = convertApi.createParams()
|
|
let params = convertApi.createParams()
|
|
params.add('file', file)
|
|
params.add('file', file)
|
|
- let result = await convertApi.convert('doc', 'docx', params)
|
|
|
|
- // Get result file URL
|
|
|
|
- file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
|
|
|
|
- return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
|
|
|
|
- });
|
|
|
|
|
|
+ try {
|
|
|
|
+ let result = await convertApi.convert('doc', 'docx', params);
|
|
|
|
+ // Get result file URL
|
|
|
|
+ file = await fetch(result.files[0].Url).then(res => res.blob()).then(blob => {
|
|
|
|
+ return new File([blob], result.files[0].FileName, { type: 'application/octet-stream' });
|
|
|
|
+ });
|
|
|
|
+ } catch (error) {
|
|
|
|
+ cfindex2++;
|
|
|
|
+ if(type == 14){
|
|
|
|
+ _this.teacherinfoisFinishSize = cfindex2;
|
|
|
|
+ }else if(type == 16){
|
|
|
|
+ _this.mubiaoinfoisFinishSize = cfindex2;
|
|
|
|
+ }else if(type == 17){
|
|
|
|
+ _this.xuanzeinfoisFinishSize = cfindex2;
|
|
|
|
+ }else if(type == 18){
|
|
|
|
+ _this.pingjiainfoisFinishSize[tindex] = cfindex2;
|
|
|
|
+ }else if(type == 19){
|
|
|
|
+ _this.knowinfoisFinishSize = cfindex2;
|
|
|
|
+ }else if(type == 20){
|
|
|
|
+ _this.knowinfoisFinishSize2 = cfindex2;
|
|
|
|
+ }else {
|
|
|
|
+ _this.infoisFinishSize = cfindex2;
|
|
|
|
+ }
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ if (
|
|
|
|
+ cfindex2 == event.target.files.length ||
|
|
|
|
+ cfindex2 > event.target.files.length
|
|
|
|
+ ) {
|
|
|
|
+ if(type == 14){
|
|
|
|
+ _this.teacherinfoproVisible = false;
|
|
|
|
+ }else if(type == 16){
|
|
|
|
+ _this.mubiaoinfoproVisible = false;
|
|
|
|
+ }else if(type == 17){
|
|
|
|
+ _this.xuanzeinfoproVisible = false;
|
|
|
|
+ }else if(type == 18){
|
|
|
|
+ _this.pingjiainfoproVisible[tindex] = false;
|
|
|
|
+ }else if(type == 19){
|
|
|
|
+ _this.knowinfoproVisible = false;
|
|
|
|
+ }else if(type == 20){
|
|
|
|
+ _this.knowinfoproVisible2 = false;
|
|
|
|
+ }else{
|
|
|
|
+ _this.infoproVisible = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ _this.$forceUpdate();
|
|
|
|
+ }, 1000);
|
|
|
|
+ _this.$message.error("上传失败");
|
|
|
|
+ // 捕捉到这个convertApi.convert报错就不要往下走了
|
|
|
|
+ return; // 直接返回,不继续执行后续代码
|
|
|
|
+ }
|
|
|
|
+
|
|
console.log(result)
|
|
console.log(result)
|
|
console.log(file)
|
|
console.log(file)
|
|
// return;
|
|
// return;
|