|
@@ -27,6 +27,16 @@
|
|
|
v-html="checkJson.detail"
|
|
|
style="color: #00000099;margin-top: 5px;"
|
|
|
></div>
|
|
|
+ <div class="choices">
|
|
|
+ <div class="file_box" v-if="checkJson.mobanFile && checkJson.mobanFile.length" v-loading="loading">
|
|
|
+ <div class="file_item" v-for="(item, index) in checkJson.mobanFile" :key="index">
|
|
|
+ <div class="file_name">{{ item.name }}</div>
|
|
|
+ <div class="file_btns">
|
|
|
+ <div class="file_btn" @click="downloadMobanFile(index)">下载</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="choices">
|
|
|
<div class="uploadBtn" v-if="checktype == 1">
|
|
|
<div class="btn" @click.stop="addImg($event)">
|
|
@@ -195,6 +205,45 @@ import checkfile from "../../../file/checkfile.vue";
|
|
|
|
|
|
import uploadFile from "./uploadFile.vue";
|
|
|
import { v4 as uuidv4 } from "uuid";
|
|
|
+
|
|
|
+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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
wpdf,
|
|
@@ -240,6 +289,7 @@ export default {
|
|
|
wurl: "",
|
|
|
isTong: false,
|
|
|
uploadList:[],
|
|
|
+ loading: false
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -692,6 +742,29 @@ export default {
|
|
|
this.wurl = item.url;
|
|
|
}
|
|
|
},
|
|
|
+ downloadMobanFile(index){
|
|
|
+ this.loading = true;
|
|
|
+ let file = this.checkJson.mobanFile[index]
|
|
|
+ getFile(file.url).then((data) => {
|
|
|
+ this.loading = false;
|
|
|
+ if (data.data != 1) {
|
|
|
+ // 下载文件, 并存成ArrayBuffer对象
|
|
|
+ const file_name =file.name; // 获取文件名
|
|
|
+ const file_data = data.data; // 获取文件数据
|
|
|
+ let url = window.URL.createObjectURL(new Blob([file_data]));
|
|
|
+ let a = document.createElement("a");
|
|
|
+ a.name = file_name;
|
|
|
+ a.href = url;
|
|
|
+ a.download = file_name;
|
|
|
+ a.click();
|
|
|
+ console.log(data);
|
|
|
+ this.$message.success("下载成功");
|
|
|
+ }else {
|
|
|
+ this.$message.error("下载失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
downloadFile(f) {
|
|
|
var credentials = {
|
|
|
accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
@@ -996,4 +1069,47 @@ export default {
|
|
|
font-weight: bold;
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+.file_box {
|
|
|
+ /* padding: 0 0 0 15px; */
|
|
|
+ width: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ margin: 10px 0;
|
|
|
+}
|
|
|
+
|
|
|
+.file_item {
|
|
|
+ display: flex;
|
|
|
+ width: 100%;
|
|
|
+ padding: 5px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-radius: 5px;
|
|
|
+}
|
|
|
+
|
|
|
+.file_item+.file_item {
|
|
|
+ margin-top: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.file_name {
|
|
|
+ color: #747474;
|
|
|
+}
|
|
|
+
|
|
|
+.file_item:hover{
|
|
|
+ background: #eee;
|
|
|
+}
|
|
|
+
|
|
|
+.file_btns {
|
|
|
+ margin-left: auto;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.file_btn+.file_btn {
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.file_btn {
|
|
|
+ color: #3681fc;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
</style>
|