DESKTOP-D85FA51\111
2021-01-20 17160d0cacec834a737f6736a49447d94ec72a73
commit | author | age
11827a 1 <template>
9091b4 2     <div id="app">
D 3         <keep-alive>
4             <router-view v-if="$route.meta.keepAlive && isRouterAlive" />
5         </keep-alive>
6         <router-view v-if="!$route.meta.keepAlive && isRouterAlive" />
7         <el-dialog title="提示" :visible.sync="netTimeOut" :close-on-click-modal="false" :show-close="false" width="30%">
8             <span>当前网络开小差了,请刷新重试~</span>
9             <span slot="footer" class="dialog-footer">
10                 <el-button @click="close">取 消</el-button>
11                 <el-button type="primary" @click="fresh">刷新</el-button>
12             </span>
13         </el-dialog>
14     </div>
11827a 15 </template>
C 16 <script>
9091b4 17     import {
D 18         mapActions,
19         mapState
20     } from "vuex";
21     import {
22         Utils
23     } from "./assets/js/utils";
24     let utils = new Utils();
25     import cookie from "js-cookie";
26     import {
27         axios
28     } from "./assets/js/axios";
29     import {
30         classPayorderDelayList
31     } from '@/apis/teachCenter/grade'
32     export default {
33         name: "App",
34         data() {
35             return {
36                 isLoading: true,
37                 isRouterAlive: true,
38                 noifdata: ''
39             };
40         },
41         computed: {
42             ...mapState("common", {
43                 netTimeOut: (state) => state.netTimeOut,
44                 menus: (state) => state.menus,
45                 user: state => JSON.parse(state.user)
46             }),
47         },
48         watch: {
49             isLoading: {
50                 handler(val, oldVal) {
feecaf 51
9091b4 52                     if (!val) {
D 53                         // 获取缓存课程
54                         if (localStorage.getItem("annieUser")) {
55                             let decodeData = utils.decrypt(localStorage.getItem("annieUser"));
579157 56
9091b4 57                             localStorage.getItem("systemId") ?
D 58                                 this.setSystemId(localStorage.getItem("systemId")) :
59                                 this.setSystemId(JSON.parse(decodeData).orgMap[0].orgId);
60                             let obj = JSON.parse(decodeData);
61                             obj.orgId = this.$store.state.common.systemId;
62                             decodeData = JSON.stringify(obj);
cfa9df 63
9091b4 64                             this.setUser(decodeData);
D 65                             this.setMenus(JSON.parse(decodeData).orgMap);
66                         }
67                         // 通用错误页面文字
68                         if (sessionStorage.getItem("errorText")) {
69                             this.setError(sessionStorage.getItem("errorText"));
70                         }
71                     }
72                 },
73                 deep: true,
74             },
75             $route: {
76                 handler: function(val, old) {
77                     var that = this;
78                     if (localStorage.getItem("annieUser")) {
79                         let decodeData = utils.decrypt(localStorage.getItem("annieUser"));
80                         let selected = utils.getCurrentTab(
81                             this.menus,
82                             val.path,
83                             this.$store.state.common.systemId
84                         );
85                         this.setTab(JSON.stringify(selected));
86                         if (val.path != "/login") {
87                             var mmst = null;
88                             this.menus.forEach(item => {
89                                 if (this.user.orgId == item.orgId) {
90                                     mmst = item;
91                                 }
92                             })
93                             if (this.user.orgId == '43') {
94                                 if (cookie.get("janniekids") != 'ok') {
95                                     this.classPayorderDelayList();
96                                 }
97                             } else {
98                                 if (mmst.roleMap[0].RoleId == 2026) {
99                                     if (cookie.get("janniekids") != 'ok') {
100                                         this.classPayorderDelayList();
101                                     }
102                                 }
103                             }
104                             let hasCookie = cookie.get("ANNIEKIDSUSS");
105                             if (!localStorage.getItem("annieUser") && hasCookie) {
106                                 axios
107                                     .post("/api/checkPermissions", {
108                                         SystemType: 2,
109                                     })
110                                     .then((res) => {
111                                         let {
112                                             code,
113                                             data
114                                         } = res;
115                                         if (code == 1) {
116                                             localStorage.setItem("annieUser", data);
117                                         } else {
118                                             if (cookie.get("ANNIEKIDSUSS")) {
119                                                 cookie.remove("ANNIEKIDSUSS");
120                                             }
121                                             this.$router.push("/login");
122                                         }
123                                     })
124                                     .catch((err) => {});
125                             }
126                         }
127                     }
128                 },
129                 deep: true,
130             },
131         },
132         methods: {
133             ...mapActions("common", {
134                 setNetTimeOut: "setNetTimeOut",
135                 setUser: "setUser",
136                 setMenus: "setMenus",
137                 setTab: "setTab",
138                 setError: "setError",
139                 setSystemId: "setSystemId",
140             }),
141             close() {
142                 this.setNetTimeOut(false);
143             },
144             fresh() {
145                 this.setNetTimeOut(false);
146                 this.isRouterAlive = false;
147                 this.$nextTick(() => {
148                     this.isRouterAlive = true;
149                 });
150             },
151             async classPayorderDelayList() {
152                 let params = {
153                     orgId: this.user.orgId
154                 };
155                 var newifno = 0;
156                 var newifno1 = 0;
157                 let res = await classPayorderDelayList(params);
158                 if (res.code == 1) {
159                     this.noifdata = res.data;
160                     res.data.forEach(item => {
161                         if (item.delaystatus == 1) {
162                             newifno++
163                         }
164                         if (item.delaystatus == 2) {
165                             newifno1++
0604e9 166                         }
J 167                     })
9091b4 168                     if (newifno == 1 && newifno1 >= 1) {
D 169                         this.zopen(newifno, newifno1);
170
171                     } else {
172                         if (newifno == 1) {
173                             res.data.forEach(item => {
174                                 if (item.delaystatus == 1) {
0604e9 175                                     this.zzopenr(item)
9091b4 176                                     console.log('111')
D 177                                 }
178                             })
179                         } else if (newifno > 1) {
180                             this.zzzopen();
181                         }
182                         if (newifno1 > 1) {
183                             this.zopen();
184                         }
185                     }
186                 }
187             },
188             zopen(newifno22, newifno33) {
189                 this.$alert('温馨提示:您有延迟结算班级,延迟即将到期', '', {
190                     confirmButtonText: '查看详情',
191                     callback: action => {
192                         console.log(action)
193                         if (action != 'cancel') {
194                             this.$router.push({
195                                 path: '/teachCenter/grade/delayList'
196                             })
197                             if (newifno22 == 1) {
198                                 this.noifdata.forEach(item => {
199                                     if (item.delaystatus == 1) {
200                                         this.zzopenr(item)
201                                     }
202                                 })
203                             }
204                         }
205                         var x = new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1);
206                         cookie.set('janniekids', 'ok', {
207                             expires: x
208                         });
209                     }
210                 });
211             },
212             zzopenr(a) {
213                 this.$alert('您申请的延迟结算已到期(申请' + a.delayHour + '课时以后,进行结算),请您及时结算', '', {
214                     confirmButtonText: '去结算',
215                     callback: action => {
216                         if (action != 'cancel') {
217                             this.$router.push({
218                                 path: '/teachCenter/grade/gradeCheck',
219                                 query: {
220                                     id: a.id,
221                                     classMode: a.classCode,
222                                     classCode: a.classCode,
223                                     coursestageId: a.coursestageId
0604e9 224                                 }
J 225                             })
226                         }
9091b4 227                         var x = new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1);
D 228                         cookie.set('janniekids', 'ok', {
229                             expires: x
230                         });
231                     }
232                 });
233             },
234             zzzopen() {
235                 this.$alert('您有延迟结算班级待结算,请及时处理', '', {
236                     confirmButtonText: '查看详情',
237                     callback: action => {
238                         if (action != 'cancel') {
239                             this.$router.push({
240                                 path: '/teachCenter/grade/delayList'
241                             })
242                         }
243                         var x = new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1);
244                         cookie.set('janniekids', 'ok', {
245                             expires: x
246                         });
247                     }
248                 });
249             }
250         },
251         mounted() {
252             this.isLoading = false;
253         },
254     };
11827a 255 </script>
C 256 <style lang="less">
9091b4 257     #app {
D 258         width: 100%;
259         height: 100%;
260         box-sizing: border-box;
261     }
11827a 262 </style>