seamwang hace 2 años
padre
commit
40ee1e58cb
Se han modificado 2 ficheros con 9 adiciones y 9 borrados
  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 149
         leave_num: {
150 150
           title: '请假', times: 2, color: '#9bde78'
151 151
         },
152
-        late_num: {
152
+        normal_num: {
153 153
           title: '正常', times: 3, color: '#e0be60'
154 154
         },
155
-        normal_num: {
155
+        late_num: {
156 156
           title: '迟到', times: 1, color: '#61d4e2'
157 157
         },
158 158
         absenteeism_num: {
@@ -161,11 +161,11 @@ export default {
161 161
       }
162 162
     }
163 163
   },
164
-  onReady() {
164
+  onShow() {
165 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 169
     this.init()
170 170
   },
171 171
   methods: {

+ 3 - 3
src/store/user.js

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