|
@@ -2413,6 +2413,7 @@
|
|
|
</button>
|
|
|
<button class="c_pub_button_confirm3" style="margin: 0 0 0 10px;" @click="openAiDialog2(2, 'aiTask3','all'), addCourseBehavior('courseBehavior', `点击学历案-重新生成所有任务按钮`)">重新生成所有任务</button>
|
|
|
<button class="c_pub_button_confirm3" style="margin: 0 0 0 10px;" @click="allEvaCan(), addCourseBehavior('courseBehavior', `点击学历案-一键生成所有评价按钮`)" v-if="panTaskElist() == 0 && panEvaCont() == 0">一键生成所有评价</button>
|
|
|
+ <button class="c_pub_button_confirm3" style="margin: 0 0 0 10px;" @click="exportTaskEA(), addCourseBehavior('courseBehavior', `点击学历案-导出评价和学历案按钮`)">导出评价和学历案</button>
|
|
|
<button class="c_pub_button_confirm" style="margin: 0 0 0 10px;" v-if="steps < 4 && istemplate != 1" @click="nextSteps">
|
|
|
{{ steps == 3 ? "确认上传" : "下一步" }}
|
|
|
</button>
|
|
@@ -7153,6 +7154,44 @@ let converter2 = OpenCC.Converter({
|
|
|
to:'hk'
|
|
|
})
|
|
|
|
|
|
+const getFile = (url) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ var credentials = {
|
|
|
+ accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
|
+ secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR",
|
|
|
+ }; //秘钥形式的登录上传
|
|
|
+ window.AWS.config.update(credentials);
|
|
|
+ window.AWS.config.region = "cn-northwest-1"; //设置区域
|
|
|
+ let url2 = url;
|
|
|
+ let _url2 = "";
|
|
|
+ if (
|
|
|
+ url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
|
|
|
+ ) {
|
|
|
+ _url2 = url2.split(
|
|
|
+ "https://view.officeapps.live.com/op/view.aspx?src="
|
|
|
+ )[1];
|
|
|
+ } else {
|
|
|
+ _url2 = url2;
|
|
|
+ }
|
|
|
+ var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
|
|
|
+ let name = decodeURIComponent(_url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1])
|
|
|
+ var params = {
|
|
|
+ Bucket: "ccrb",
|
|
|
+ Key: name
|
|
|
+ };
|
|
|
+ s3.getObject(params, function (err, data) {
|
|
|
+ if (err) {
|
|
|
+ console.log(err, err.stack)
|
|
|
+ resolve({ data: 1 });
|
|
|
+ }else {
|
|
|
+ resolve({ data: data.Body });
|
|
|
+ console.log(data);
|
|
|
+ } // sxuccessful response
|
|
|
+
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
EditorBar,
|
|
@@ -17061,6 +17100,68 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
|
|
|
// });
|
|
|
|
|
|
},
|
|
|
+ async exportTaskEA(){
|
|
|
+ this.loading = true
|
|
|
+ const zip = new JSZip();
|
|
|
+ let md = new MarkdownIt();
|
|
|
+
|
|
|
+ for(var i = 0; i < this.unitJson[0].chapterInfo[0].taskJson.length; i++){
|
|
|
+ let _task = this.unitJson[0].chapterInfo[0].taskJson[i]
|
|
|
+ for(var j = 0; j < _task.chapterData.length; j++){
|
|
|
+
|
|
|
+ if(_task.chapterData[j].type == 3 && _task.chapterData[j].name.includes('学历案')){
|
|
|
+ let file = await getFile(_task.chapterData[j].url)
|
|
|
+ if (file.data != 1) {
|
|
|
+ // 下载文件, 并存成ArrayBuffer对象
|
|
|
+ const file_name = _task.chapterData[j].name; // 获取文件名
|
|
|
+ const fileExt = file_name.split('.').pop(); // 获取文件后缀
|
|
|
+ const fileNameWithoutExt = file_name.substring(0, file_name.length - fileExt.length - 1); // 获取文件名不包括后缀的部分
|
|
|
+ // 判断是否有重复的文件名字
|
|
|
+ if (!zip.file(file_name)) {
|
|
|
+ zip.file(file_name, file.data, { binary: true }); // 逐个添加文件
|
|
|
+ } else {
|
|
|
+ // 如果有重复的文件名,则在文件名后添加序号
|
|
|
+ let count = 1;
|
|
|
+ let newFileName = fileNameWithoutExt;
|
|
|
+ while (zip.file(`${newFileName}.${fileExt}`)) {
|
|
|
+ newFileName = `${fileNameWithoutExt}(${count})`;
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ zip.file(`${newFileName}.${fileExt}`, file.data, { binary: true });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(var j = 0; j < _task.toolChoose.length; j++){
|
|
|
+ let tool = _task.toolChoose[j]
|
|
|
+ if(tool.eList && tool.eList.length){
|
|
|
+ let tableContent = '| 素养 | 评价标准 | 评价细则 |\n| --- | --- | --- |\n';
|
|
|
+ tool.eList.forEach(item => {
|
|
|
+ tableContent += `| ${item.target} | ${item.detail} | ${item.rule.replaceAll('\n', ' ')} |\n`;
|
|
|
+ });
|
|
|
+ let html = md.render(tableContent);
|
|
|
+ let name = `任务${i+1}工具${j+1}的评价`
|
|
|
+ let file = await this.generateExport2(name, html, i)
|
|
|
+
|
|
|
+ zip.file(`${name}.docx`, file, { binary: true })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // let file = await this.generateExport(name, _html, i)
|
|
|
+
|
|
|
+ // zip.file(`${name}.docx`, file, { binary: true })
|
|
|
+ }
|
|
|
+ zip.generateAsync({ type: "blob" }).then((content) => {
|
|
|
+ // 生成二进制流
|
|
|
+ saveAs(
|
|
|
+ content,
|
|
|
+ this.courseName + "-" + "评价和学历案.zip"
|
|
|
+ ); // 利用file-saver保存文件 自定义文件名
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false
|
|
|
+ }, 2000);
|
|
|
+ });
|
|
|
+ },
|
|
|
clickGenTT2(){
|
|
|
if (this.courseName == "") {
|
|
|
this.$message.error("请补充填写课程名称");
|