Skip to content

Commit

Permalink
修改我的账号页面问题
Browse files Browse the repository at this point in the history
  • Loading branch information
tim760255458 committed Sep 6, 2018
1 parent bf43605 commit b82324e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const store = new Vuex.Store({
// group_id: 0,
// user_name: '二马',
// group_name: '...',
// state: 1
// state: 1,
// email: ''
},
week: {}
},
Expand Down
16 changes: 11 additions & 5 deletions src/views/account/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<div class="set-group-content">
<p>
<label>昵称: </label>
<input v-model="nickName" type="text" placeholder=""/>
<input v-model="nickName" type="text" :placeholder="user_info.user_name"/>
</p>
<p>
<label>邮箱:</label>
<!-- <span>{{ user_info.email }}</span> -->
<span>[email protected]</span>
<span>{{ user_info.email }}</span>
<!-- <span>[email protected]</span> -->
</p>
<p>
<label>分组:</label>
Expand All @@ -26,7 +26,7 @@

<script>
import { changeNickName } from '../../api'
import { mapState } from 'vuex'
import { mapState, mapMutations } from 'vuex'
export default {
name: 'account',
data () {
Expand All @@ -38,6 +38,9 @@ export default {
...mapState(['user_info'])
},
methods: {
...mapMutations({
setUserInfo: 'SET_USER_INFO'
}),
exit () {
this.$router.push({ path: '/exitGroup' })
},
Expand All @@ -49,11 +52,14 @@ export default {
userid: this.user_info.user_id,
userName: this.nickName
}).then(res => {
if (res.infoCode === '200') {
if (res.infoCode === '200' || res.infoCode === 200) {
this.$notify.success({
title: '设置成功',
message: '设置个人信息成功'
})
this.setUserInfo({
user_name: this.nickName
})
this.$router.push({ path: '/' })
} else {
this.$notify.error({
Expand Down
3 changes: 2 additions & 1 deletion src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export default {
this.setUserInfo({
user_id: res.userId,
group_id: res.groupId,
user_name: res.userName
user_name: res.userName,
email: this.formData.email
})
this.$router.push({ path: '/group' })
} else {
Expand Down
6 changes: 4 additions & 2 deletions src/views/login/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ export default {
this.setUserInfo({
user_id: res.userId,
group_id: res.groupId,
user_name: res.userName
user_name: res.userName,
email: this.formData.email
})
this.$router.push({ path: '/group' })
} else {
this.setUserInfo({
user_id: res.userId,
group_id: res.groupId,
user_name: res.userName,
group_name: res.groupName
group_name: res.groupName,
email: this.formData.email
})
this.$router.push({ path: '/' })
}
Expand Down

0 comments on commit b82324e

Please sign in to comment.