|
@@ -7,9 +7,10 @@
|
|
|
<div class="c_title">
|
|
|
<div class="title" style="display: flex;">
|
|
|
<!-- + `(${option[checkJson.type].name})` -->
|
|
|
- <span style="min-width: fit-content;">{{ tindex + 1 + "、" }}</span>
|
|
|
+ <span style="min-width: fit-content;">{{ tindex + 1 + "、" }}</span>
|
|
|
<span>{{ checkJson.title }}</span>
|
|
|
- <span style="color: #efa030;min-width: fit-content;" v-if="checkJson.score">({{ '分值:' + checkJson.score + '分' }})</span>
|
|
|
+ <span style="color: #efa030;min-width: fit-content;" v-if="checkJson.score">({{ '分值:' + checkJson.score
|
|
|
+ + '分' }})</span>
|
|
|
</div>
|
|
|
|
|
|
<!-- </div><div v-html="checkJson.title"></div> -->
|
|
@@ -30,9 +31,12 @@
|
|
|
<div class="binfo_input">
|
|
|
<div class="fileBox" v-if="checkJson.file && checkJson.file.length">
|
|
|
<div class="fileC">
|
|
|
- <div class="file" v-for="(item, index) in checkJson.file" :key="index" v-loading="downLoading == item.url" @click.stop="checkFile(item)">
|
|
|
- <img class="del" src="../../../../../assets/icon/fileIcon/deleteworks.png" @click.stop="delFile(index)" v-if="checktype == 1" />
|
|
|
- <img class="download" src="../../../../../assets/icon/fileIcon/download.png" @click.stop="downloadFile(item)" :style="{right: checktype != 1 ? '10px' : '45px'}" />
|
|
|
+ <div class="file" v-for="(item, index) in checkJson.file" :key="index"
|
|
|
+ v-loading="downLoading == item.url" @click.stop="checkFile(item)">
|
|
|
+ <img class="del" src="../../../../../assets/icon/fileIcon/deleteworks.png"
|
|
|
+ @click.stop="delFile(index)" v-if="checktype == 1" />
|
|
|
+ <img class="download" src="../../../../../assets/icon/fileIcon/download.png"
|
|
|
+ @click.stop="downloadFile(item)" :style="{ right: checktype != 1 ? '10px' : '45px' }" />
|
|
|
<img class="img" :src="wordIcon" alt="" v-if="item.type == 1" />
|
|
|
<img class="img" :src="videoIcon" alt="" v-if="item.type == 2" />
|
|
|
<img class="img" :src="item.url" alt="" v-if="item.type == 3" />
|
|
@@ -103,42 +107,42 @@ import JSZip from "jszip";
|
|
|
import FileSaver from "file-saver";
|
|
|
|
|
|
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
|
|
|
-
|
|
|
- });
|
|
|
- // axios({
|
|
|
- });
|
|
|
+ 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
|
|
|
+
|
|
|
+ });
|
|
|
+ // axios({
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
export default {
|
|
@@ -149,7 +153,7 @@ export default {
|
|
|
checkfile
|
|
|
},
|
|
|
props: {
|
|
|
- tindex:{
|
|
|
+ tindex: {
|
|
|
type: Number
|
|
|
},
|
|
|
cJson: {
|
|
@@ -182,9 +186,9 @@ export default {
|
|
|
wordIcon: wordIcon,
|
|
|
fileIcon: fileIcon,
|
|
|
downLoading: '',
|
|
|
- dialogVisiblePdf:false,
|
|
|
- dialogVisibleVideo:false,
|
|
|
- dialogVisibleOffice:false,
|
|
|
+ dialogVisiblePdf: false,
|
|
|
+ dialogVisibleVideo: false,
|
|
|
+ dialogVisibleOffice: false,
|
|
|
dialogVisiblefile: false,
|
|
|
wurl: "",
|
|
|
isloading: false,
|
|
@@ -215,7 +219,7 @@ export default {
|
|
|
this.$message.error('请输入大于0的数字')
|
|
|
this.checkJson.score2 = ''
|
|
|
}
|
|
|
- if(parseInt(this.checkJson.score2) > parseInt(this.checkJson.score)){
|
|
|
+ if (parseInt(this.checkJson.score2) > parseInt(this.checkJson.score)) {
|
|
|
this.$message.error('不能输入大于得分的数字')
|
|
|
this.checkJson.score2 = this.checkJson.score
|
|
|
}
|
|
@@ -454,18 +458,18 @@ export default {
|
|
|
}
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
- checkFile(item){
|
|
|
- if(item.type == 3){
|
|
|
+ checkFile(item) {
|
|
|
+ if (item.type == 3) {
|
|
|
this.$hevueImgPreview(item.url);
|
|
|
- }else if(item.type == 5){
|
|
|
+ } else if (item.type == 5) {
|
|
|
this.downloadFile(item);
|
|
|
- }else if(item.type == 1){
|
|
|
+ } else if (item.type == 1) {
|
|
|
this.dialogVisibleOffice = true
|
|
|
this.wurl = item.url
|
|
|
- }else if(item.type == 2){
|
|
|
+ } else if (item.type == 2) {
|
|
|
this.dialogVisibleVideo = true
|
|
|
this.wurl = item.url
|
|
|
- }else if(item.type == 4){
|
|
|
+ } else if (item.type == 4) {
|
|
|
this.dialogVisiblePdf = true
|
|
|
this.wurl = item.url
|
|
|
}
|
|
@@ -475,44 +479,44 @@ export default {
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
uploadCourse() {
|
|
|
- this.isloading = true;
|
|
|
- const _chapInfo = this.checkJson.file;
|
|
|
- let url = [];
|
|
|
- for (let i = 0; i < _chapInfo.length; i++) {
|
|
|
- url.push({
|
|
|
- name: _chapInfo[i].name,
|
|
|
- url: _chapInfo[i].url,
|
|
|
+ this.isloading = true;
|
|
|
+ const _chapInfo = this.checkJson.file;
|
|
|
+ let url = [];
|
|
|
+ for (let i = 0; i < _chapInfo.length; i++) {
|
|
|
+ url.push({
|
|
|
+ name: _chapInfo[i].name,
|
|
|
+ url: _chapInfo[i].url,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(url);
|
|
|
+ this.downLoadAll(url);
|
|
|
+ },
|
|
|
+ downLoadAll(url) {
|
|
|
+ const data = url; // 需要下载打包的路径, 可以是本地相对路径, 也可以是跨域的全路径
|
|
|
+ const zip = new JSZip();
|
|
|
+ const cache = {};
|
|
|
+ const promises = [];
|
|
|
+ data.forEach((item) => {
|
|
|
+ const promise = getFile(item.url).then((data) => {
|
|
|
+ if (data.data != 1) {
|
|
|
+ // 下载文件, 并存成ArrayBuffer对象
|
|
|
+ const file_name = item.name; // 获取文件名
|
|
|
+ zip.file(file_name, data.data, { binary: true }); // 逐个添加文件
|
|
|
+ cache[file_name] = data.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ promises.push(promise);
|
|
|
});
|
|
|
- }
|
|
|
- console.log(url);
|
|
|
- this.downLoadAll(url);
|
|
|
- },
|
|
|
- downLoadAll(url) {
|
|
|
- const data = url; // 需要下载打包的路径, 可以是本地相对路径, 也可以是跨域的全路径
|
|
|
- const zip = new JSZip();
|
|
|
- const cache = {};
|
|
|
- const promises = [];
|
|
|
- data.forEach((item) => {
|
|
|
- const promise = getFile(item.url).then((data) => {
|
|
|
- if (data.data != 1) {
|
|
|
- // 下载文件, 并存成ArrayBuffer对象
|
|
|
- const file_name = item.name; // 获取文件名
|
|
|
- zip.file(file_name, data.data, { binary: true }); // 逐个添加文件
|
|
|
- cache[file_name] = data.data;
|
|
|
- }
|
|
|
- });
|
|
|
- promises.push(promise);
|
|
|
- });
|
|
|
- Promise.all(promises).then(() => {
|
|
|
- zip.generateAsync({ type: "blob" }).then((content) => {
|
|
|
- // 生成二进制流
|
|
|
- FileSaver.saveAs(content, "附件.zip"); // 利用file-saver保存文件 自定义文件名
|
|
|
- setTimeout(() => {
|
|
|
- this.isloading = false;
|
|
|
- }, 2000);
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
+ Promise.all(promises).then(() => {
|
|
|
+ zip.generateAsync({ type: "blob" }).then((content) => {
|
|
|
+ // 生成二进制流
|
|
|
+ FileSaver.saveAs(content, "附件.zip"); // 利用file-saver保存文件 自定义文件名
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isloading = false;
|
|
|
+ }, 2000);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.checkJson = this.cJson ? this.depthCopy(this.cJson) : undefined
|
|
@@ -577,7 +581,7 @@ export default {
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
background: rgb(249, 250, 251);
|
|
|
- color:rgb(124, 124, 124);
|
|
|
+ color: rgb(124, 124, 124);
|
|
|
border-radius: 5px;
|
|
|
cursor: pointer;
|
|
|
}
|
|
@@ -716,48 +720,49 @@ export default {
|
|
|
justify-content: center;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
-.choice_box> .c_title {
|
|
|
+
|
|
|
+.choice_box>.c_title {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
}
|
|
|
-.choice_box> .c_title .title {
|
|
|
+
|
|
|
+.choice_box>.c_title .title {
|
|
|
font-weight: bold;
|
|
|
width: 100%;
|
|
|
word-break: break-all;
|
|
|
}
|
|
|
|
|
|
-.choice_box> .c_title .p_box{
|
|
|
+.choice_box>.c_title .p_box {
|
|
|
margin-left: 5px;
|
|
|
min-width: fit-content;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
}
|
|
|
|
|
|
-.p_box > .btnU{
|
|
|
-color: #fff;
|
|
|
- background-color: #0061FF;
|
|
|
- padding: 0 24px;
|
|
|
- font-size: 14px;
|
|
|
- min-width: 64px;
|
|
|
- font-weight: 500;
|
|
|
- border-radius: 4px;
|
|
|
- box-sizing: border-box;
|
|
|
- border: none;
|
|
|
- cursor: pointer;
|
|
|
- transition: all 0.2s ease-in-out;
|
|
|
- height: 36px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- line-height: 1;
|
|
|
+.p_box>.btnU {
|
|
|
+ color: #fff;
|
|
|
+ background-color: #0061FF;
|
|
|
+ padding: 0 24px;
|
|
|
+ font-size: 14px;
|
|
|
+ min-width: 64px;
|
|
|
+ font-weight: 500;
|
|
|
+ border-radius: 4px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border: none;
|
|
|
+ cursor: pointer;
|
|
|
+ transition: all 0.2s ease-in-out;
|
|
|
+ height: 36px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ line-height: 1;
|
|
|
}
|
|
|
|
|
|
.c_input {
|
|
|
width: 90px;
|
|
|
}
|
|
|
|
|
|
-.c_input >>> .el-input__inner{
|
|
|
+.c_input>>>.el-input__inner {
|
|
|
padding: 0 5px;
|
|
|
text-align: right;
|
|
|
-}
|
|
|
-</style>
|
|
|
+}</style>
|