Commit 9702ad6e authored by yyh's avatar yyh

isPhone userIcon store

parent 0ec17fe6
......@@ -5,12 +5,24 @@ export default new Vuex.Store({
state: {
isLogin: false,
isSetPwd: 0, // 0 未设置 1 已设置
userInfo: {},
userInfo: {
phone: '',
icon: '',
},
authInfo: {}, // 个人认证信息
companyAuthInfo: {}, // 企业认证信息
proofCount: 0,
},
getters: {
isPhone( { userInfo }) {
return userInfo.phone;
},
userIcon( {userInfo} ) {
if (userInfo.icon) {
return userInfo.icon;
}
return require('@/assets/defaultusericon.png');
},
},
mutations: {
updateIsLogin(state: any, payLoad: any) {
......
......@@ -5,17 +5,24 @@
<label class="item" for="input">
<div class="title">头像</div>
<div class="right">
<van-image round :src="userInfo.icon" class="desc" fit="contain" width="44px" height="44px"></van-image>
<van-image round :src="userIcon" class="desc" fit="contain" width="44px" height="44px"></van-image>
<common-svg name="jinru" class="icon"></common-svg>
</div>
</label>
<div class="item" @click="$router.push({name:'SetPhone'})">
<div class="item" @click="$router.push({name:'SetPhone'})" v-if="isPhone">
<div class="title">手机号</div>
<div class="right">
<div class="desc">{{userInfo.phone}}</div>
<common-svg name="jinru" class="icon"></common-svg>
</div>
</div>
<div class="item" @click="$router.push({name:'SetPhone'})" v-else>
<div class="title">邮箱</div>
<div class="right">
<div class="desc">{{userInfo.email}}</div>
<common-svg name="jinru" class="icon"></common-svg>
</div>
</div>
<div class="logout" @click="logout">退出当前账号</div>
</div>
</template>
......@@ -34,6 +41,8 @@ import H5Cropper from 'vue-cropper-h5';
})
export default class AccountNum extends Vue {
@State('userInfo') private userInfo!: any;
@Getter('isPhone') private isPhone!: boolean;
@Getter('userIcon') private userIcon!: string;
@Action('getUserInfo') private getUserInfo!: () => void;
@Mutation('updateIsLogin') private updateIsLogin!: (isLogin: boolean) => void;
@Mutation('updateUserInfo') private updateUserInfo!: (userInfo: any) => void;
......
......@@ -57,6 +57,7 @@ export default class Index extends Vue {
@State('isSetPwd') private isSetPassWd!: number;
@State('isLogin') private isLogin!: boolean;
@State('authInfo') private authInfo!: any;
@Getter('userIcon') private userIcon!: string;
@Action('isSetPwd') private isSetPwd!: () => void;
@Action('getAuthInfo') private getAuthInfo!: () => void;
@Action('getCompanyAuthInfo') private getCompanyAuthInfo!: () => void;
......@@ -73,12 +74,6 @@ export default class Index extends Vue {
const { auth_suc } = this.userInfo;
return auth_suc ? 'yirenzheng' : 'weirenzheng';
}
get userIcon() {
if (this.userInfo.icon) {
return this.userInfo.icon;
}
return require('@/assets/defaultusericon.png');
}
get datas() {
const { auth_type, auth_suc } = this.userInfo;
return [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment