Commit 5be3bb709e91bf297b3ae3e49f0588b89b11251d

Authored by 梁保满
1 parent addb60e3

切换账号,缓存组件接口报错问题

src/router/index.js
... ... @@ -282,9 +282,9 @@ let addrouters = [ //测试用,后续后端获取
282 282 iconCls: "fa fa-dashboard", // 图标样式class
283 283 name: "",
284 284 component: Device,
285   - // meta: {
286   - // keepAlive: true,
287   - // },
  285 + meta: {
  286 + keepAlive: true,
  287 + },
288 288 children: []
289 289 },
290 290 {
... ...
src/views/card/index.vue
... ... @@ -100,6 +100,7 @@
100 100 export default {
101 101 data() {
102 102 return {
  103 + loading:false,
103 104 props: { multiple: true, checkStrictly: false },
104 105 query: {
105 106 classId: [],
... ...
src/views/device/index.vue
... ... @@ -60,12 +60,13 @@
60 60 <div class="sel-box">
61 61 <el-cascader
62 62 size="small"
63   - class="sel"
  63 + class="sel sel2"
64 64 clearable
65 65 placeholder="选择班级"
66 66 v-model="query.classId"
67 67 :options="gradeList"
68 68 :props="props"
  69 + collapse-tags
69 70 :show-all-levels="false"
70 71 ></el-cascader>
71 72 <el-select
... ... @@ -196,12 +197,13 @@
196 197 <div class="sel-box">
197 198 <el-cascader
198 199 size="small"
199   - class="sel"
  200 + class="sel sel2"
200 201 clearable
201 202 placeholder="选择班级"
202 203 v-model="query.classId"
203 204 :options="gradeList"
204 205 :props="props"
  206 + collapse-tags
205 207 :show-all-levels="false"
206 208 ></el-cascader>
207 209 <el-select
... ... @@ -299,12 +301,13 @@
299 301 <div class="sel-box">
300 302 <el-cascader
301 303 size="small"
302   - class="sel"
  304 + class="sel sel2"
303 305 clearable
304 306 placeholder="选择班级"
305 307 v-model="query.classId"
306 308 :options="gradeList"
307 309 :props="props"
  310 + collapse-tags
308 311 :show-all-levels="false"
309 312 @change="_QueryData(false)"
310 313 ></el-cascader>
... ... @@ -497,6 +500,7 @@ import scatterChart from &quot;@/components/charts/scatterChart&quot;;
497 500 import _ from "lodash";
498 501 import { downloadFile, formatClass, formatGradeNameClass } from "@/utils";
499 502 import api from "@/api/apis/apis";
  503 +import BusEvent from "@/utils/busEvent";
500 504 export default {
501 505 components: { pieChart, scatterChart },
502 506 watch: {
... ... @@ -627,6 +631,21 @@ export default {
627 631 this.showSchool();
628 632 }
629 633 },
  634 + activated() {
  635 + const that = this;
  636 + BusEvent.$on("keepAlive", async function () {
  637 + that.type = 1;
  638 + that.page = 1;
  639 + that.total = 0;
  640 + that.count = 0;
  641 + that.query.classId = [];
  642 + that.query.onlineStatus = "";
  643 + that.query.sn = "";
  644 + that.query.type = "";
  645 + that.stationReport();
  646 + that._QueryData();
  647 + });
  648 + },
630 649 methods: {
631 650 upSuccess() {
632 651 //导入成功
... ... @@ -1073,9 +1092,6 @@ export default {
1073 1092 .tab-box {
1074 1093 padding: 20px 0 12px;
1075 1094 }
1076   -.sel {
1077   - width: 100%;
1078   -}
1079 1095 .content {
1080 1096 background: #f8f8f8;
1081 1097 border: 1px solid #e2e2e2;
... ...
src/views/layout/header/header.vue
... ... @@ -139,6 +139,7 @@ export default {
139 139 this.$router.push({
140 140 path: "/login",
141 141 });
  142 + window.location.reload()
142 143 }
143 144 } else {
144 145 this.$message.error(message);
... ...
src/views/setUp/account.vue
... ... @@ -26,6 +26,16 @@
26 26 @click="openAddDia"
27 27 ></el-button>
28 28 </el-tooltip>
  29 + <el-tooltip effect="dark" content="账号同步" placement="bottom" v-else>
  30 + <el-button
  31 + type="primary"
  32 + icon="el-icon-refresh"
  33 + size="mini"
  34 + plain
  35 + circle
  36 + @click="refreshAcc"
  37 + ></el-button>
  38 + </el-tooltip>
29 39 </template>
30 40 </back-box>
31 41 <div class="answer-header">
... ... @@ -429,6 +439,14 @@ export default {
429 439 this._QueryData(4);
430 440 },
431 441 methods: {
  442 + async refreshAcc(){//长水账号同步
  443 + const { data, status, info } = await this.$request.roleList();
  444 + if (status === 0) {
  445 + this._QueryData(4);
  446 + } else {
  447 + this.$message.error(info);
  448 + }
  449 + },
432 450 upSuccess() {
433 451 //导入成功
434 452 this.diaUp = false;
... ...
src/views/setUp/student.vue
... ... @@ -96,12 +96,7 @@
96 96 <i class="el-icon-delete" slot="reference"></i>
97 97 </el-popconfirm>
98 98 <p class="name">{{ item.studentName }}</p>
99   - <p class="p1">
100   - 答题器:{{
101   - (item.clickerList.length && item.clickerList[0].clickerSn) ||
102   - "--"
103   - }}
104   - </p>
  99 + <p class="p1">答题器:{{ item.clickerSn || "--" }}</p>
105 100 <p class="p1">长学号:{{ item.studentCode }}</p>
106 101 <p class="p1">短学号:{{ item.shortNumber || "--" }}</p>
107 102 </li>
... ...