|
@@ -136,6 +136,7 @@
|
|
|
<input
|
|
|
type="file"
|
|
|
accept="image/*"
|
|
|
+ multiple
|
|
|
style="display: none"
|
|
|
@change="beforeUpload($event)"
|
|
|
/>
|
|
@@ -162,9 +163,7 @@
|
|
|
|
|
|
<div v-if="proVisible" class="mask">
|
|
|
<div class="progressBox">
|
|
|
- <div class="lbox">
|
|
|
- <img src="@/assets/loading.gif" />上传中,请稍后
|
|
|
- </div>
|
|
|
+ <div class="lbox"><img src="@/assets/loading.gif" />上传中,请稍后</div>
|
|
|
<div style="margin-bottom: 10px">
|
|
|
<span>{{ isFinishSize }}M</span>
|
|
|
/
|
|
@@ -274,11 +273,12 @@ export default {
|
|
|
observeCon: this.recordData.recordTit,
|
|
|
recordCon: this.recordData.recordContent,
|
|
|
imgList: this.recordData.recordImg.join(","),
|
|
|
- term: this.recordData.term
|
|
|
+ term: this.recordData.term,
|
|
|
+ pid: 1
|
|
|
}
|
|
|
];
|
|
|
|
|
|
- // return console.log("修改记录", params);
|
|
|
+ console.log("修改记录", params);
|
|
|
|
|
|
this.ajax
|
|
|
.post(this.$store.state.api + "updateRecordData", params)
|
|
@@ -304,91 +304,98 @@ 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 file = "";
|
|
|
|
|
|
- var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
|
|
|
- var imgA = [
|
|
|
- "png",
|
|
|
- "jpg",
|
|
|
- "jpeg",
|
|
|
- "bmp",
|
|
|
- "gif",
|
|
|
- "webp",
|
|
|
- "psd",
|
|
|
- "svg",
|
|
|
- "tiff"
|
|
|
- ];
|
|
|
- if (
|
|
|
- imgA.indexOf(file.name.split(".")[file.name.split(".").length - 1]) ==
|
|
|
- -1
|
|
|
- ) {
|
|
|
- this.$message.error("图片格式错误");
|
|
|
- return;
|
|
|
- }
|
|
|
- this.imgLoading = true;
|
|
|
- var _this = this;
|
|
|
+ for (let cfindex = 0; cfindex < event.target.files.length; cfindex++) {
|
|
|
+ console.log("event.target.files", event.target.files);
|
|
|
+ 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 imgA = [
|
|
|
+ "png",
|
|
|
+ "jpg",
|
|
|
+ "jpeg",
|
|
|
+ "bmp",
|
|
|
+ "gif",
|
|
|
+ "webp",
|
|
|
+ "psd",
|
|
|
+ "svg",
|
|
|
+ "tiff"
|
|
|
+ ];
|
|
|
+ if (
|
|
|
+ imgA.indexOf(file.name.split(".")[file.name.split(".").length - 1]) ==
|
|
|
+ -1
|
|
|
+ ) {
|
|
|
+ this.$message.error("图片格式错误");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.imgLoading = true;
|
|
|
+ var _this = this;
|
|
|
|
|
|
- this.inputShow = false;
|
|
|
- this.progress = 0;
|
|
|
- this.proVisible = true;
|
|
|
- this.isFinishSize = 0;
|
|
|
- this.isAllSize = (file.size / 1024 / 1024).toFixed(2);
|
|
|
- _this.$forceUpdate();
|
|
|
+ this.inputShow = false;
|
|
|
+ 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) {
|
|
|
- //这里可以写进度条
|
|
|
- _this.progress = parseInt((evt.loaded / evt.total) * 100);
|
|
|
- _this.isFinishSize = (evt.loaded / 1024 / 1024).toFixed(2);
|
|
|
- _this.$forceUpdate();
|
|
|
- })
|
|
|
- .send(function(err, data) {
|
|
|
- _this.imgLoading = false;
|
|
|
- // loading.close();
|
|
|
- _this.progress = 100;
|
|
|
- _this.isFinishSize = _this.isAllSize;
|
|
|
- _this.$forceUpdate();
|
|
|
- setTimeout(() => {
|
|
|
- _this.proVisible = false;
|
|
|
+ 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) {
|
|
|
+ //这里可以写进度条
|
|
|
+ _this.progress = parseInt((evt.loaded / evt.total) * 100);
|
|
|
+ _this.isFinishSize = (evt.loaded / 1024 / 1024).toFixed(2);
|
|
|
_this.$forceUpdate();
|
|
|
- }, 1000);
|
|
|
- _this.inputShow = true;
|
|
|
-
|
|
|
- if (err) {
|
|
|
- _this.$message.error("上传失败");
|
|
|
- } else {
|
|
|
- _this.recordData.recordImg.push(data.Location);
|
|
|
+ })
|
|
|
+ .send(function(err, data) {
|
|
|
+ _this.imgLoading = false;
|
|
|
+ // loading.close();
|
|
|
+ _this.progress = 100;
|
|
|
+ _this.isFinishSize = _this.isAllSize;
|
|
|
_this.$forceUpdate();
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.proVisible = false;
|
|
|
+ _this.$forceUpdate();
|
|
|
+ }, 1000);
|
|
|
+ _this.inputShow = true;
|
|
|
|
|
|
- console.log(_this.checkJson);
|
|
|
- console.log(data.Location);
|
|
|
- }
|
|
|
- });
|
|
|
+ if (err) {
|
|
|
+ _this.$message.error("上传失败");
|
|
|
+ } else {
|
|
|
+ _this.recordData.recordImg.push(data.Location);
|
|
|
+ _this.$forceUpdate();
|
|
|
+
|
|
|
+ console.log(_this.checkJson);
|
|
|
+ console.log(data.Location);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ // var file = event.target.files[0];
|
|
|
}
|
|
|
},
|
|
|
watch: {
|