70 lines
1.4 KiB
TypeScript
70 lines
1.4 KiB
TypeScript
import { userinfo } from '@/api';
|
|
import { createStore } from 'vuex'
|
|
|
|
export default createStore({
|
|
state: {
|
|
userinfo:{
|
|
accesstoken: "",
|
|
api_token: "",
|
|
birthday: "",
|
|
country: "",
|
|
countryValue: "",
|
|
cover: "",
|
|
created_at: "",
|
|
currency: "",
|
|
currencyValue: "",
|
|
deleted_at: null,
|
|
desc: "",
|
|
email: "",
|
|
img: "",
|
|
interest: "",
|
|
language: "中文",
|
|
languageValue: "zh",
|
|
live: "",
|
|
livetime: "",
|
|
login_type: 0,
|
|
memberid: 0,
|
|
mobile: "",
|
|
money: "",
|
|
moneyValue: 0,
|
|
msg: "",
|
|
mtongue: "",
|
|
name: "",
|
|
password: "",
|
|
position: 0,
|
|
publish: 0,
|
|
score: "",
|
|
status: false,
|
|
tlanguage: "中文",
|
|
tlanguageValue: 1,
|
|
type: 1,
|
|
uid: "",
|
|
updated_at: "",
|
|
video: "",
|
|
willsay: [{name: "请选择", level: 0}],
|
|
willsayValue: [{name: "0", level: 0}],
|
|
zoneStr: "中途岛GMT-11:00",
|
|
zoneid: 1,
|
|
},
|
|
islogin: false
|
|
},
|
|
mutations: {
|
|
setUserInfo(state, userinfo){
|
|
state.userinfo = userinfo
|
|
},
|
|
login(state, islogin: boolean){
|
|
state.islogin = islogin;
|
|
}
|
|
},
|
|
actions: {
|
|
async setUserInfo({ commit }){
|
|
const user = await userinfo();
|
|
if(user != '未登录'){
|
|
commit('setUserInfo', user);
|
|
}
|
|
}
|
|
},
|
|
modules: {
|
|
}
|
|
})
|