|
@@ -409,6 +409,7 @@
|
|
import { getWord } from "@/components/tool/getWord";
|
|
import { getWord } from "@/components/tool/getWord";
|
|
import vpdf from "@/components/vpdf.vue";
|
|
import vpdf from "@/components/vpdf.vue";
|
|
import vword from "@/components/vword.vue";
|
|
import vword from "@/components/vword.vue";
|
|
|
|
+import '../../../components/common/aws-sdk-2.235.1.min.js'
|
|
export default {
|
|
export default {
|
|
components:{vpdf,vword},
|
|
components:{vpdf,vword},
|
|
data() {
|
|
data() {
|
|
@@ -611,6 +612,48 @@ export default {
|
|
return console.log(this.Wordss);
|
|
return console.log(this.Wordss);
|
|
} else return (this.Wordss = { type: type, name: type });
|
|
} else return (this.Wordss = { type: type, name: type });
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ //下载文件
|
|
|
|
+ downFile(f) {
|
|
|
|
+ var credentials = {
|
|
|
|
+ accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
|
|
+ secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR",
|
|
|
|
+ }; //秘钥形式的登录上传
|
|
|
|
+ window.AWS.config.update(credentials);
|
|
|
|
+ window.AWS.config.region = "cn-northwest-1"; //设置区域
|
|
|
|
+ let url2 = f;
|
|
|
|
+ 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); // an error occurred
|
|
|
|
+ else {
|
|
|
|
+ let url = window.URL.createObjectURL(new Blob([data.Body]));
|
|
|
|
+ let a = document.createElement("a");
|
|
|
|
+ a.name = name;
|
|
|
|
+ a.href = url;
|
|
|
|
+ a.download = name;
|
|
|
|
+ a.click();
|
|
|
|
+ console.log(data);
|
|
|
|
+ } // sxuccessful response
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return;
|
|
},
|
|
},
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|