xbx #40

Merged
theluyuan merged 4 commits from xbx into master 2020-10-14 07:30:31 +00:00
5 changed files with 12 additions and 7 deletions
Showing only changes of commit 5e4db83a24 - Show all commits

View File

@ -13,7 +13,7 @@ import { getValue } from './utils/common';
export default defineComponent({
setup(){
if(getValue('token')){
store.commit("login")
store.commit("login", true)
store.dispatch("setUserInfo");
}
}

View File

@ -10,9 +10,9 @@ export interface Get {
}
axios.interceptors.response.use((response)=>{
return response;
},(error)=>{
message.error(error.response.data.message)
return Promise.reject(error)
})

View File

@ -23,7 +23,7 @@ export async function loginpass(phone: string, password: string){
message.error("存储错误, 请允许网页使用本地存储!")
}else{
setToken();
store.commit("login");
store.commit("login", true);
store.dispatch("setUserInfo");
router.push("/mine/archives")
}

View File

@ -21,7 +21,7 @@
<div class="item" :class="{'selbottom': selnum == list.length - 1}"></div>
</div>
<div class="item loginout">
<div class="route">
<div class="route" @click="logout">
<img src="../static/images/tuichu.png" alt="" class="icon">
<div class="title">
帐号退出
@ -190,12 +190,17 @@ export default defineComponent({
}
function logout(): void{
store.commit("login", false)
router.replace("/");
}
return{
list,
routeto,
selnum,
userinfo
userinfo,
logout
}
}
})

View File

@ -13,8 +13,8 @@ export default createStore({
setUserInfo(state, userinfo){
state.userinfo = userinfo
},
login(state){
state.islogin = true;
login(state, islogin: boolean){
state.islogin = islogin;
}
},
actions: {