|
@@ -1,6 +1,10 @@
|
|
|
<template>
|
|
|
<div style="width: 100%; height: 100%">
|
|
|
- <div class="sr_head">学生成长报告</div>
|
|
|
+ <div class="sr_head">
|
|
|
+ 学生成长报告
|
|
|
+ <el-button type="primary" size="small" @click="downloadFile('https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/student01-%E5%AD%A6%E7%94%9F%E6%88%90%E9%95%BF%E6%8A%A5%E5%91%8A1719315423787.pdf');">导出报告</el-button>
|
|
|
+
|
|
|
+ </div>
|
|
|
<div class="sr_body">
|
|
|
<div class="sr_box">
|
|
|
<div class="sr_first">
|
|
@@ -74,6 +78,50 @@ export default {
|
|
|
this.scoid = this.oid;
|
|
|
},
|
|
|
},
|
|
|
+ methods: {
|
|
|
+ downloadFile(url){
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ let _this = this;
|
|
|
+
|
|
|
+ _this.downLoading = true
|
|
|
+ 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) {
|
|
|
+ _this.downLoading = false
|
|
|
+ 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 = 'student01-学生成长报告.pdf';
|
|
|
+ a.href = url;
|
|
|
+ a.download = 'student01-学生成长报告.pdf';
|
|
|
+ a.click();
|
|
|
+ console.log(data);
|
|
|
+ } // sxuccessful response
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
created() {
|
|
|
this.userid = this.checkStudent;
|
|
|
this.courseid = this.checkCourse;
|