Browse Source

no message

seamwang 2 years ago
parent
commit
40ee1e58cb
2 changed files with 9 additions and 9 deletions
  1. 6 6
      src/pages/studentcenter/index.vue
  2. 3 3
      src/store/user.js

+ 6 - 6
src/pages/studentcenter/index.vue

@@ -149,10 +149,10 @@ export default {
149
         leave_num: {
149
         leave_num: {
150
           title: '请假', times: 2, color: '#9bde78'
150
           title: '请假', times: 2, color: '#9bde78'
151
         },
151
         },
152
-        late_num: {
152
+        normal_num: {
153
           title: '正常', times: 3, color: '#e0be60'
153
           title: '正常', times: 3, color: '#e0be60'
154
         },
154
         },
155
-        normal_num: {
155
+        late_num: {
156
           title: '迟到', times: 1, color: '#61d4e2'
156
           title: '迟到', times: 1, color: '#61d4e2'
157
         },
157
         },
158
         absenteeism_num: {
158
         absenteeism_num: {
@@ -161,11 +161,11 @@ export default {
161
       }
161
       }
162
     }
162
     }
163
   },
163
   },
164
-  onReady() {
164
+  onShow() {
165
     const today = getDate(new Date(), 0)
165
     const today = getDate(new Date(), 0)
166
-    this.info.year = today.year
167
-    this.info.month = today.month
168
-    this.info.day = today.date
166
+    this.info.year = this.info.year || today.year
167
+    this.info.month = this.info.month || today.month
168
+    this.info.day = this.info.day || today.date
169
     this.init()
169
     this.init()
170
   },
170
   },
171
   methods: {
171
   methods: {

+ 3 - 3
src/store/user.js

@@ -5,7 +5,7 @@ export default {
5
     session: '',
5
     session: '',
6
     kid: 0,
6
     kid: 0,
7
     phone: '',
7
     phone: '',
8
-    carts: []// 购物车
8
+    carts: null// 购物车
9
   },
9
   },
10
   getters: {
10
   getters: {
11
     user(state) {
11
     user(state) {
@@ -24,7 +24,7 @@ export default {
24
       return state.session || uni.getStorageSync('session')
24
       return state.session || uni.getStorageSync('session')
25
     },
25
     },
26
     carts(state) {
26
     carts(state) {
27
-      return state.carts.length > 0 ? state.carts : JSON.parse(uni.getStorageSync('carts'))
27
+      return state.carts || JSON.parse(uni.getStorageSync('carts'))
28
     }
28
     }
29
   },
29
   },
30
   mutations: {
30
   mutations: {
@@ -34,7 +34,7 @@ export default {
34
       state.session = ''
34
       state.session = ''
35
       state.phone = ''
35
       state.phone = ''
36
       state.kid = 0
36
       state.kid = 0
37
-      state.carts = []
37
+      state.carts = null
38
       uni.clearStorageSync()
38
       uni.clearStorageSync()
39
     },
39
     },
40
     SET_USER(state, user = {}) {
40
     SET_USER(state, user = {}) {