Commit 191d5bfa749915550b25edab1d87414e144b9570
1 parent
14a23714
学生管理、基站管理下载名称设置,上传成功信息展示
Showing
4 changed files
with
26 additions
and
15 deletions
src/components/upload.vue
@@ -78,7 +78,7 @@ export default { | @@ -78,7 +78,7 @@ export default { | ||
78 | upSuccess(res) { | 78 | upSuccess(res) { |
79 | if (res && res.status == 0 ) { | 79 | if (res && res.status == 0 ) { |
80 | this.$message.success("上传成功"); | 80 | this.$message.success("上传成功"); |
81 | - this.$emit("upSuccess"); | 81 | + this.$emit("upSuccess",res); |
82 | } else { | 82 | } else { |
83 | this.$message.error(res.info); | 83 | this.$message.error(res.info); |
84 | } | 84 | } |
src/utils/index.js
1 | // import CryptoJS from "crypto-js" | 1 | // import CryptoJS from "crypto-js" |
2 | import { JSEncrypt } from "jsencrypt"; | 2 | import { JSEncrypt } from "jsencrypt"; |
3 | +import service from "@/api/axios"; | ||
3 | 4 | ||
4 | const encryptKey = "WfJTKO9S4eLkrPz2JKrAnzdb"; | 5 | const encryptKey = "WfJTKO9S4eLkrPz2JKrAnzdb"; |
5 | const encryptIV = "D076D35C"; | 6 | const encryptIV = "D076D35C"; |
src/views/device/index.vue
@@ -493,7 +493,7 @@ | @@ -493,7 +493,7 @@ | ||
493 | import pieChart from "@/components/charts/pieChart"; | 493 | import pieChart from "@/components/charts/pieChart"; |
494 | import scatterChart from "@/components/charts/scatterChart"; | 494 | import scatterChart from "@/components/charts/scatterChart"; |
495 | import _ from "lodash"; | 495 | import _ from "lodash"; |
496 | -import { downloadFile, formatClass, formatGradeNameClass } from "@/utils"; | 496 | +import { downloadFile, getBlob, formatGradeNameClass } from "@/utils"; |
497 | import api from "@/api/apis/apis"; | 497 | import api from "@/api/apis/apis"; |
498 | import BusEvent from "@/utils/busEvent"; | 498 | import BusEvent from "@/utils/busEvent"; |
499 | export default { | 499 | export default { |
@@ -642,8 +642,15 @@ export default { | @@ -642,8 +642,15 @@ export default { | ||
642 | }); | 642 | }); |
643 | }, | 643 | }, |
644 | methods: { | 644 | methods: { |
645 | - upSuccess() { | 645 | + upSuccess(res) { |
646 | //导入成功 | 646 | //导入成功 |
647 | + this.$message.closeAll(); | ||
648 | + this.$message({ | ||
649 | + showClose: true, | ||
650 | + message: `成功(${res.data.success}) 失败(${res.data.error})`, | ||
651 | + type: "success", | ||
652 | + duration:5000 | ||
653 | + }); | ||
647 | this.diaUp = false; | 654 | this.diaUp = false; |
648 | this.page = 1; | 655 | this.page = 1; |
649 | this._QueryData(); | 656 | this._QueryData(); |
@@ -788,11 +795,9 @@ export default { | @@ -788,11 +795,9 @@ export default { | ||
788 | id: this.id, | 795 | id: this.id, |
789 | }); | 796 | }); |
790 | if (status == 0) { | 797 | if (status == 0) { |
791 | - const a = document.createElement("a"); | ||
792 | - a.href = data.downloadUrl; | ||
793 | - document.body.appendChild(a); | ||
794 | - a.click(); | ||
795 | - a.remove(); | 798 | + getBlob(data.downloadUrl).then((res) => { |
799 | + downloadFile("基站模版", res); | ||
800 | + }); | ||
796 | } else { | 801 | } else { |
797 | this.$message.error(info); | 802 | this.$message.error(info); |
798 | } | 803 | } |
src/views/setUp/student.vue
@@ -229,7 +229,7 @@ | @@ -229,7 +229,7 @@ | ||
229 | </template> | 229 | </template> |
230 | 230 | ||
231 | <script> | 231 | <script> |
232 | -import { downloadFile } from "@/utils"; | 232 | +import { downloadFile, getBlob } from "@/utils"; |
233 | export default { | 233 | export default { |
234 | data() { | 234 | data() { |
235 | return { | 235 | return { |
@@ -341,7 +341,14 @@ export default { | @@ -341,7 +341,14 @@ export default { | ||
341 | } | 341 | } |
342 | }); | 342 | }); |
343 | }, | 343 | }, |
344 | - upSuccess() { | 344 | + upSuccess(res) { |
345 | + this.$message.closeAll(); | ||
346 | + this.$message({ | ||
347 | + showClose: true, | ||
348 | + message: `成功(${res.data.success}) 失败(${res.data.error})`, | ||
349 | + type: "success", | ||
350 | + duration:5000 | ||
351 | + }); | ||
345 | //导入成功 | 352 | //导入成功 |
346 | this.diaUp = false; | 353 | this.diaUp = false; |
347 | this._QueryData(3); | 354 | this._QueryData(3); |
@@ -352,11 +359,9 @@ export default { | @@ -352,11 +359,9 @@ export default { | ||
352 | await this.$request.studentClickerTemplateUrl(); | 359 | await this.$request.studentClickerTemplateUrl(); |
353 | this.loadingDown = false; | 360 | this.loadingDown = false; |
354 | if (status == 0) { | 361 | if (status == 0) { |
355 | - const a = document.createElement("a"); | ||
356 | - a.href = data.downloadUrl; | ||
357 | - document.body.appendChild(a); | ||
358 | - a.click(); | ||
359 | - a.remove(); | 362 | + getBlob(data.downloadUrl).then((res) => { |
363 | + downloadFile("学生答题器绑定模板", res); | ||
364 | + }); | ||
360 | } else { | 365 | } else { |
361 | this.$message.error(info); | 366 | this.$message.error(info); |
362 | } | 367 | } |