张延森 4 lat temu
rodzic
commit
151e49707e

+ 2
- 1
src/components/MainPage/index.vue Wyświetl plik

@@ -64,7 +64,8 @@ export default {
64 64
   },
65 65
   computed: {
66 66
     ...mapUserState({
67
-      UserInfo: x => x.UserInfo // 用户信息
67
+      UserInfo: x => x.UserInfo, // 用户信息
68
+      Student: x => x.UserInfo.student, // 学生信息
68 69
     })
69 70
   },
70 71
   components: {

+ 10
- 3
src/pages/Mine/MyInfo/index.vue Wyświetl plik

@@ -122,7 +122,8 @@ export default {
122 122
   },
123 123
   computed: {
124 124
     ...mapUserState({
125
-      UserInfo: x => x.UserInfo // 用户信息
125
+      UserInfo: x => x.UserInfo, // 用户信息
126
+      Student: x => x.UserInfo.student || {}, // 学生信息
126 127
     })
127 128
   },
128 129
   components: {
@@ -141,7 +142,8 @@ export default {
141 142
       'PutUserInfo'
142 143
     ]),
143 144
     ...mapUserMutations([
144
-      'UpdateUserInfo'
145
+      'UpdateUserInfo',
146
+      'UpdateStudentInfo',
145 147
     ]),
146 148
     Init () {
147 149
       if (this.UserInfo !== null) {
@@ -149,6 +151,11 @@ export default {
149 151
           this.Form[key] = this.UserInfo[key]
150 152
         }
151 153
       }
154
+      if (this.Student !== null) {
155
+        for (let key in this.Form) {
156
+          this.Form[key] = this.Student[key]
157
+        }
158
+      }
152 159
     },
153 160
     SexChange (e) {
154 161
       this.SexIndex = e.detail.value - 0
@@ -165,7 +172,7 @@ export default {
165 172
         }
166 173
         this.PutUserInfo({ data: { data: { ...Data } } }).then((res) => {
167 174
           console.log(res.data.data)
168
-          this.UpdateUserInfo({ ...res.data.data })
175
+          // this.UpdateUserInfo({ ...res.data.data })
169 176
           wx.showToast({
170 177
             title: '保存成功',
171 178
             icon: 'none',

+ 6
- 5
src/pages/Mine/index.vue Wyświetl plik

@@ -10,7 +10,7 @@
10 10
               <image mode="aspectFill" :src="UserInfo.avatar" class="centerLabel"></image>
11 11
             </view>
12 12
             <view class="UserName">{{UserInfo.nickName || '-'}}</view>
13
-            <view class="UserNo">学号:{{UserInfo.studentId || '-'}}</view>
13
+            <view class="UserNo">学号:{{Student.studentNo || '-'}}</view>
14 14
           </view>
15 15
 
16 16
           <!-- 信息卡 -->
@@ -18,7 +18,7 @@
18 18
             <view>
19 19
               <view class="School flex-h">
20 20
                 <text>学校:</text>
21
-                <text class="flex-item">{{UserInfo.schoolName || '-'}}</text>
21
+                <text class="flex-item">{{Student.schoolName || '-'}}</text>
22 22
                 <navigator url="/pages/Mine/MyInfo/index" hover-class="none">
23 23
                   <text>完善信息</text>
24 24
                   <text class="iconfont iconjiantouright"></text>
@@ -28,7 +28,7 @@
28 28
                 <view>
29 29
                   <view class="flex-h">
30 30
                     <text>专业:</text>
31
-                    <text class="flex-item">{{UserInfo.specialtyName || '-'}}</text>
31
+                    <text class="flex-item">{{Student.specialtyName || '-'}}</text>
32 32
                   </view>
33 33
                   <view class="flex-h">
34 34
                     <text>手机号:</text>
@@ -36,7 +36,7 @@
36 36
                   </view>
37 37
                   <view class="flex-h">
38 38
                     <text>学届:</text>
39
-                    <text class="flex-item">{{UserInfo.schoolBatch}}</text>
39
+                    <text class="flex-item">{{Student.schoolBatch}}</text>
40 40
                   </view>
41 41
                 </view>
42 42
                 <view class="flex-item">
@@ -84,7 +84,8 @@ export default {
84 84
   },
85 85
   computed: {
86 86
     ...mapUserState({
87
-      UserInfo: x => x.UserInfo // 用户信息
87
+      UserInfo: x => x.UserInfo, // 用户信息
88
+      Student: x => x.UserInfo.student || {} // 学生信息
88 89
     })
89 90
   },
90 91
   components: {

+ 4
- 1
src/store/user/index.js Wyświetl plik

@@ -16,6 +16,9 @@ export default {
16 16
     },
17 17
     UpdateUserInfo (state, data) {
18 18
       state.UserInfo = { ...state.UserInfo, ...data }
19
+    },
20
+    UpdateStudentInfo (state, data) {
21
+      state.UserInfo = { ...state.UserInfo, student: data }
19 22
     }
20 23
   },
21 24
   actions: {
@@ -36,7 +39,7 @@ export default {
36 39
     },
37 40
     PutUserInfo (context, payload) { // 更新用户信息
38 41
       return new Promise((resolve, reject) => {
39
-        ToolClass.ToolRequest({ url: Api.UpdateUserInfo.url, method: Api.UpdateUserInfo.method, ...payload, success (res) { context.commit('UpdateUserInfo', res.data.data.person); resolve(res) }, error (res) { reject(res) } })
42
+        ToolClass.ToolRequest({ url: Api.UpdateUserInfo.url, method: Api.UpdateUserInfo.method, ...payload, success (res) { context.commit('UpdateStudentInfo', res.data.data.person); resolve(res) }, error (res) { reject(res) } })
40 43
       })
41 44
     },
42 45
     GetCurrentPersonInfo (context, payload) { // 获取当前人员信息

+ 1
- 1
src/util/Api/index.js Wyświetl plik

@@ -16,7 +16,7 @@ const Api = {
16 16
   },
17 17
   UpdateUserInfo: { // 更新用户信息
18 18
     method: 'put',
19
-    url: `${prefix}/ma/person`
19
+    url: `${prefix}/ma/student`
20 20
   },
21 21
   GetIndexBanner: { // 获取首页banner
22 22
     method: 'get',