Commit 5b2fd269 authored by leiqingsong's avatar leiqingsong

修改

parent 272c425e
export function getUserId() { export function getUserId() {
return JSON.parse(localStorage.getItem('user')).userId; if (localStorage.getItem("user")) {
return JSON.parse(localStorage.getItem('user')).userId;
} else {
return "";
}
} }
\ No newline at end of file
<template> <template>
<div class="settings"> <div class="settings">
<van-cell-group class="group-1"> <van-cell-group class="group-1">
<van-cell title="用户名" value="135****1234" /> <van-cell title="用户名" :value="$userId" />
<van-cell is-link center title="头像" @click="onModefy"> <van-cell is-link center title="头像" @click="onModefy">
<img <img
class="avatar-img" class="avatar-img"
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
</template> </template>
<script> <script>
import { getUserInfo } from "@/api/user";
import { logoutToApp } from "@/utils/bridgeToAppFun"; import { logoutToApp } from "@/utils/bridgeToAppFun";
import { logout } from "@/api/user"; import { logout } from "@/api/user";
import { fillInviteCode } from "@/api/user"; import { fillInviteCode } from "@/api/user";
...@@ -61,7 +62,17 @@ export default { ...@@ -61,7 +62,17 @@ export default {
inviteeCodeDialog: false inviteeCodeDialog: false
}; };
}, },
created() {
this.getUser()
},
methods: { methods: {
getUser() {
getUserInfo().then(res => {
if (res.code === 0) {
localStorage.setItem("user", JSON.stringify(res.data));
}
})
},
logout() { logout() {
const params = { const params = {
token: "qwedskdljlkjlklkjlkjlkjl" token: "qwedskdljlkjlklkjlkjlkjl"
......
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