|
@@ -18,6 +18,8 @@
|
|
|
'分' }})</span>
|
|
|
<!-- </div><div v-html="checkJson.title"></div> -->
|
|
|
</div>
|
|
|
+ <div class="detail" v-if="checkJson.detail" v-html="checkJson.detail" style="color: #00000099;margin-top: 5px;">
|
|
|
+ </div>
|
|
|
<div class="choices">
|
|
|
<div class="binfo_input">
|
|
|
<div class="fileBox" v-if="checkJson.file && checkJson.file.length">
|
|
@@ -43,20 +45,20 @@
|
|
|
<!-- @click.stop="addImg($event)" -->
|
|
|
<div class="btn" @click.stop="openFileBox()">
|
|
|
<span>点击添加文件</span>
|
|
|
- <input type="file" accept="*" style="display: none" @change="beforeUpload($event)" />
|
|
|
+ <input type="file" accept="*" style="display: none" multiple="multiple" @change="beforeUpload($event)" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- @click.stop="addImg($event)" -->
|
|
|
<div class="uploadQ" @click.stop="openFileBox()" v-else>
|
|
|
<span>点击添加文件</span>
|
|
|
- <input type="file" accept="*" style="display: none" @change="beforeUpload($event)" />
|
|
|
+ <input type="file" accept="*" style="display: none" multiple="multiple" @change="beforeUpload($event)" />
|
|
|
</div>
|
|
|
<div v-if="proVisible" class="mask">
|
|
|
<div class="progressBox">
|
|
|
<div class="lbox">
|
|
|
<img src="../../../../../../assets/loading.gif" />上传中,请稍后
|
|
|
</div>
|
|
|
- <div style="margin-bottom: 10px">
|
|
|
+ <!-- <div style="margin-bottom: 10px">
|
|
|
<span>{{
|
|
|
isFinishSize
|
|
|
}}M</span>
|
|
@@ -64,11 +66,11 @@
|
|
|
<span>{{
|
|
|
isAllSize
|
|
|
}}M</span>
|
|
|
- </div>
|
|
|
- <el-progress :text-inside="true" :stroke-width="20" :percentage="progress
|
|
|
+ </div> -->
|
|
|
+ <!-- <el-progress :text-inside="true" :stroke-width="20" :percentage="progress
|
|
|
? progress
|
|
|
: 0
|
|
|
- " style="width: 80%"></el-progress>
|
|
|
+ " style="width: 80%"></el-progress> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -159,177 +161,192 @@ export default {
|
|
|
},
|
|
|
beforeUpload(event, type) {
|
|
|
// const loading = this.openLoading();
|
|
|
- var file = event.target.files[0];
|
|
|
- var credentials = {
|
|
|
- accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
|
- secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR",
|
|
|
- }; //秘钥形式的登录上传
|
|
|
- window.AWS.config.update(credentials);
|
|
|
- window.AWS.config.region = "cn-northwest-1"; //设置区域
|
|
|
-
|
|
|
- var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
|
|
|
- var _this = this;
|
|
|
-
|
|
|
- _this.progress = 0;
|
|
|
- _this.proVisible = true;
|
|
|
- _this.isFinishSize = 0;
|
|
|
- _this.isAllSize = (file.size / 1024 / 1024).toFixed(2);
|
|
|
- _this.$forceUpdate();
|
|
|
- if (file) {
|
|
|
- var params = {
|
|
|
- Key:
|
|
|
- file.name.split(".")[0] +
|
|
|
- new Date().getTime() +
|
|
|
- "." +
|
|
|
- file.name.split(".")[file.name.split(".").length - 1],
|
|
|
- ContentType: file.type,
|
|
|
- Body: file,
|
|
|
- "Access-Control-Allow-Credentials": "*",
|
|
|
- ACL: "public-read",
|
|
|
- }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
|
|
|
- var options = {
|
|
|
- partSize: 2048 * 1024 * 1024,
|
|
|
- queueSize: 2,
|
|
|
- leavePartsOnError: true,
|
|
|
- };
|
|
|
- bucket
|
|
|
- .upload(params, options)
|
|
|
- .on("httpUploadProgress", function (evt) {
|
|
|
- //这里可以写进度条
|
|
|
- // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
|
|
|
- _this.progress = parseInt((evt.loaded / evt.total) * 100);
|
|
|
- _this.isFinishSize = (evt.loaded / 1024 / 1024).toFixed(2);
|
|
|
- _this.$forceUpdate();
|
|
|
- })
|
|
|
- .send(function (err, data) {
|
|
|
- _this.progress = 100;
|
|
|
- _this.isFinishSize = _this.isAllSize;
|
|
|
- _this.$forceUpdate();
|
|
|
- setTimeout(() => {
|
|
|
- _this.proVisible = false;
|
|
|
- _this.$forceUpdate();
|
|
|
- }, 1000);
|
|
|
- // loading.close();
|
|
|
- if (err) {
|
|
|
- _this.$message.error("上传失败");
|
|
|
- } else {
|
|
|
- let _type = 2;
|
|
|
- var imgA = [
|
|
|
- "png",
|
|
|
- "jpg",
|
|
|
- "jpeg",
|
|
|
- "bmp",
|
|
|
- "gif",
|
|
|
- "webp",
|
|
|
- "psd",
|
|
|
- "svg",
|
|
|
- "tiff",
|
|
|
- ];
|
|
|
- var fileA = [
|
|
|
- "DOC",
|
|
|
- "DOCX",
|
|
|
- "DOCM",
|
|
|
- "DOTM",
|
|
|
- "DOTX",
|
|
|
- "PPTX",
|
|
|
- "PPSX",
|
|
|
- "PPT",
|
|
|
- "PPS",
|
|
|
- "PPTM",
|
|
|
- "POTM",
|
|
|
- "PPAM",
|
|
|
- "POTX",
|
|
|
- "PPSM",
|
|
|
- "XLSX",
|
|
|
- "XLS",
|
|
|
- ];
|
|
|
- var videoA = [
|
|
|
- "AVI",
|
|
|
- "NAVI",
|
|
|
- "MPEG",
|
|
|
- "ASF",
|
|
|
- "MOV",
|
|
|
- "WMV",
|
|
|
- "3GP",
|
|
|
- "RM",
|
|
|
- "RMVB",
|
|
|
- "FLV",
|
|
|
- "F4V",
|
|
|
- "H.264",
|
|
|
- "H.265",
|
|
|
- "REAL VIDEO",
|
|
|
- "MKV",
|
|
|
- "WebM",
|
|
|
- "HDDVD",
|
|
|
- "MP4",
|
|
|
- "MPG",
|
|
|
- "M4V",
|
|
|
- "MGV",
|
|
|
- "OGV",
|
|
|
- "QTM",
|
|
|
- "STR",
|
|
|
- "AMC",
|
|
|
- "DVX",
|
|
|
- "EVO",
|
|
|
- "DAT",
|
|
|
- "OGG",
|
|
|
- "OGM",
|
|
|
- ];
|
|
|
- if (
|
|
|
- fileA.indexOf(
|
|
|
- data.Location.split(".")[
|
|
|
- data.Location.split(".").length - 1
|
|
|
- ].toLocaleUpperCase()
|
|
|
- ) != -1
|
|
|
- ) {
|
|
|
- _type = 1; //word 文件
|
|
|
- } else if (
|
|
|
- videoA.indexOf(
|
|
|
- data.Location.split(".")[
|
|
|
- data.Location.split(".").length - 1
|
|
|
- ].toLocaleUpperCase()
|
|
|
- ) != -1
|
|
|
- ) {
|
|
|
- _type = 2; //视频
|
|
|
- } else if (
|
|
|
- imgA.indexOf(
|
|
|
- data.Location.split(".")[
|
|
|
- data.Location.split(".").length - 1
|
|
|
- ].toLocaleLowerCase()
|
|
|
- ) != -1
|
|
|
- ) {
|
|
|
- _type = 3; //图片
|
|
|
- } else if (
|
|
|
- 'pdf'.indexOf(
|
|
|
- data.Location.split(".")[
|
|
|
- data.Location.split(".").length - 1
|
|
|
- ].toLocaleLowerCase()
|
|
|
- ) != -1
|
|
|
- ) {
|
|
|
- _type = 4; //pdf
|
|
|
+ let file = "";
|
|
|
+ let cfindex2 = 0;
|
|
|
+ for (var cfindex = 0; cfindex < event.target.files.length; cfindex++) {
|
|
|
+ file = event.target.files[cfindex];
|
|
|
+
|
|
|
+ var credentials = {
|
|
|
+ accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
|
+ secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR",
|
|
|
+ }; //秘钥形式的登录上传
|
|
|
+ window.AWS.config.update(credentials);
|
|
|
+ window.AWS.config.region = "cn-northwest-1"; //设置区域
|
|
|
+
|
|
|
+ var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
|
|
|
+ var _this = this;
|
|
|
+
|
|
|
+ // _this.progress = 0;
|
|
|
+ _this.proVisible = true;
|
|
|
+ // _this.isFinishSize = 0;
|
|
|
+ // _this.isAllSize = (file.size / 1024 / 1024).toFixed(2);
|
|
|
+ _this.$forceUpdate();
|
|
|
+ if (file) {
|
|
|
+ var params = {
|
|
|
+ Key:
|
|
|
+ file.name.split(".")[0] +
|
|
|
+ new Date().getTime() +
|
|
|
+ "." +
|
|
|
+ file.name.split(".")[file.name.split(".").length - 1],
|
|
|
+ ContentType: file.type,
|
|
|
+ Body: file,
|
|
|
+ "Access-Control-Allow-Credentials": "*",
|
|
|
+ ACL: "public-read",
|
|
|
+ }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
|
|
|
+ var options = {
|
|
|
+ partSize: 2048 * 1024 * 1024,
|
|
|
+ queueSize: 2,
|
|
|
+ leavePartsOnError: true,
|
|
|
+ };
|
|
|
+ bucket
|
|
|
+ .upload(params, options)
|
|
|
+ .on("httpUploadProgress", function (evt) {
|
|
|
+ //这里可以写进度条
|
|
|
+ // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
|
|
|
+ // _this.progress = parseInt((evt.loaded / evt.total) * 100);
|
|
|
+ // _this.isFinishSize = (evt.loaded / 1024 / 1024).toFixed(2);
|
|
|
+ // _this.$forceUpdate();
|
|
|
+ })
|
|
|
+ .send(function (err, data) {
|
|
|
+ cfindex2++;
|
|
|
+
|
|
|
+ // _this.progress = 100;
|
|
|
+ // _this.isFinishSize = _this.isAllSize;
|
|
|
+ // _this.$forceUpdate();
|
|
|
+ // setTimeout(() => {
|
|
|
+ // _this.proVisible = false;
|
|
|
+ // _this.$forceUpdate();
|
|
|
+ // }, 1000);
|
|
|
+ setTimeout(() => {
|
|
|
+ if (
|
|
|
+ cfindex2 == event.target.files.length - 1 ||
|
|
|
+ cfindex2 > event.target.files.length - 1
|
|
|
+ ) {
|
|
|
+ _this.proVisible = false;
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ // loading.close();
|
|
|
+ if (err) {
|
|
|
+ _this.$message.error("上传失败");
|
|
|
} else {
|
|
|
- _type = 5; //文件
|
|
|
+ let _type = 2;
|
|
|
+ var imgA = [
|
|
|
+ "png",
|
|
|
+ "jpg",
|
|
|
+ "jpeg",
|
|
|
+ "bmp",
|
|
|
+ "gif",
|
|
|
+ "webp",
|
|
|
+ "psd",
|
|
|
+ "svg",
|
|
|
+ "tiff",
|
|
|
+ ];
|
|
|
+ var fileA = [
|
|
|
+ "DOC",
|
|
|
+ "DOCX",
|
|
|
+ "DOCM",
|
|
|
+ "DOTM",
|
|
|
+ "DOTX",
|
|
|
+ "PPTX",
|
|
|
+ "PPSX",
|
|
|
+ "PPT",
|
|
|
+ "PPS",
|
|
|
+ "PPTM",
|
|
|
+ "POTM",
|
|
|
+ "PPAM",
|
|
|
+ "POTX",
|
|
|
+ "PPSM",
|
|
|
+ "XLSX",
|
|
|
+ "XLS",
|
|
|
+ ];
|
|
|
+ var videoA = [
|
|
|
+ "AVI",
|
|
|
+ "NAVI",
|
|
|
+ "MPEG",
|
|
|
+ "ASF",
|
|
|
+ "MOV",
|
|
|
+ "WMV",
|
|
|
+ "3GP",
|
|
|
+ "RM",
|
|
|
+ "RMVB",
|
|
|
+ "FLV",
|
|
|
+ "F4V",
|
|
|
+ "H.264",
|
|
|
+ "H.265",
|
|
|
+ "REAL VIDEO",
|
|
|
+ "MKV",
|
|
|
+ "WebM",
|
|
|
+ "HDDVD",
|
|
|
+ "MP4",
|
|
|
+ "MPG",
|
|
|
+ "M4V",
|
|
|
+ "MGV",
|
|
|
+ "OGV",
|
|
|
+ "QTM",
|
|
|
+ "STR",
|
|
|
+ "AMC",
|
|
|
+ "DVX",
|
|
|
+ "EVO",
|
|
|
+ "DAT",
|
|
|
+ "OGG",
|
|
|
+ "OGM",
|
|
|
+ ];
|
|
|
+ if (
|
|
|
+ fileA.indexOf(
|
|
|
+ data.Location.split(".")[
|
|
|
+ data.Location.split(".").length - 1
|
|
|
+ ].toLocaleUpperCase()
|
|
|
+ ) != -1
|
|
|
+ ) {
|
|
|
+ _type = 1; //word 文件
|
|
|
+ } else if (
|
|
|
+ videoA.indexOf(
|
|
|
+ data.Location.split(".")[
|
|
|
+ data.Location.split(".").length - 1
|
|
|
+ ].toLocaleUpperCase()
|
|
|
+ ) != -1
|
|
|
+ ) {
|
|
|
+ _type = 2; //视频
|
|
|
+ } else if (
|
|
|
+ imgA.indexOf(
|
|
|
+ data.Location.split(".")[
|
|
|
+ data.Location.split(".").length - 1
|
|
|
+ ].toLocaleLowerCase()
|
|
|
+ ) != -1
|
|
|
+ ) {
|
|
|
+ _type = 3; //图片
|
|
|
+ } else if (
|
|
|
+ 'pdf'.indexOf(
|
|
|
+ data.Location.split(".")[
|
|
|
+ data.Location.split(".").length - 1
|
|
|
+ ].toLocaleLowerCase()
|
|
|
+ ) != -1
|
|
|
+ ) {
|
|
|
+ _type = 4; //pdf
|
|
|
+ } else {
|
|
|
+ _type = 5; //文件
|
|
|
+ }
|
|
|
+ if (_this.checkJson.file) {
|
|
|
+ _this.checkJson.file.push({
|
|
|
+ name: file.name,
|
|
|
+ url: data.Location,
|
|
|
+ type: _type,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ _this.checkJson.file = []
|
|
|
+ _this.checkJson.file.push({
|
|
|
+ name: file.name,
|
|
|
+ url: data.Location,
|
|
|
+ type: _type,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ _this.$forceUpdate();
|
|
|
+
|
|
|
+ console.log(_this.checkJson);
|
|
|
+ console.log(data.Location);
|
|
|
}
|
|
|
- if (_this.checkJson.file) {
|
|
|
- _this.checkJson.file.push({
|
|
|
- name: file.name,
|
|
|
- url: data.Location,
|
|
|
- type: _type,
|
|
|
- });
|
|
|
- } else {
|
|
|
- _this.checkJson.file = []
|
|
|
- _this.checkJson.file.push({
|
|
|
- name: file.name,
|
|
|
- url: data.Location,
|
|
|
- type: _type,
|
|
|
- });
|
|
|
- }
|
|
|
- _this.$forceUpdate();
|
|
|
-
|
|
|
- console.log(_this.checkJson);
|
|
|
- console.log(data.Location);
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
setCheckJson(name, url, type) {
|