Commit 191d5bfa749915550b25edab1d87414e144b9570

Authored by 梁保满
1 parent 14a23714

学生管理、基站管理下载名称设置,上传成功信息展示

src/components/upload.vue
... ... @@ -78,7 +78,7 @@ export default {
78 78 upSuccess(res) {
79 79 if (res && res.status == 0 ) {
80 80 this.$message.success("上传成功");
81   - this.$emit("upSuccess");
  81 + this.$emit("upSuccess",res);
82 82 } else {
83 83 this.$message.error(res.info);
84 84 }
... ...
src/utils/index.js
1 1 // import CryptoJS from "crypto-js"
2 2 import { JSEncrypt } from "jsencrypt";
  3 +import service from "@/api/axios";
3 4  
4 5 const encryptKey = "WfJTKO9S4eLkrPz2JKrAnzdb";
5 6 const encryptIV = "D076D35C";
... ...
src/views/device/index.vue
... ... @@ -493,7 +493,7 @@
493 493 import pieChart from "@/components/charts/pieChart";
494 494 import scatterChart from "@/components/charts/scatterChart";
495 495 import _ from "lodash";
496   -import { downloadFile, formatClass, formatGradeNameClass } from "@/utils";
  496 +import { downloadFile, getBlob, formatGradeNameClass } from "@/utils";
497 497 import api from "@/api/apis/apis";
498 498 import BusEvent from "@/utils/busEvent";
499 499 export default {
... ... @@ -642,8 +642,15 @@ export default {
642 642 });
643 643 },
644 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 654 this.diaUp = false;
648 655 this.page = 1;
649 656 this._QueryData();
... ... @@ -788,11 +795,9 @@ export default {
788 795 id: this.id,
789 796 });
790 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 801 } else {
797 802 this.$message.error(info);
798 803 }
... ...
src/views/setUp/student.vue
... ... @@ -229,7 +229,7 @@
229 229 </template>
230 230  
231 231 <script>
232   -import { downloadFile } from "@/utils";
  232 +import { downloadFile, getBlob } from "@/utils";
233 233 export default {
234 234 data() {
235 235 return {
... ... @@ -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 353 this.diaUp = false;
347 354 this._QueryData(3);
... ... @@ -352,11 +359,9 @@ export default {
352 359 await this.$request.studentClickerTemplateUrl();
353 360 this.loadingDown = false;
354 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 365 } else {
361 366 this.$message.error(info);
362 367 }
... ...