添加登录功能
This commit is contained in:
1 parent
20e9f4940e
commit
530e54a596
17 files changed
+632
-160
No files matched your search
+22
-1
@@ -1,6 +1,11 @@
|
||||
import { defineStore } from "pinia";
|
||||
import config from "../../miaoShareConfig.json"
|
||||
|
||||
const userID = localStorage.getItem('userID');
|
||||
const userGroup = localStorage.getItem('userGroup');
|
||||
|
||||
const token = localStorage.getItem('token');
|
||||
// console.log(token)
|
||||
|
||||
var activeFuctionLocal = localStorage.getItem('activeFuction')
|
||||
if (activeFuctionLocal == null){
|
||||
@@ -18,12 +23,28 @@ export const useSettingStore = defineStore("setting", {
|
||||
state: () => ({
|
||||
activeFuction: activeFuctionLocal,
|
||||
activeKeyMap:JSON.parse(activeKeyMap),
|
||||
serverPort:config.PORT
|
||||
serverPort:config.PORT,
|
||||
token,userID,userGroup
|
||||
}),
|
||||
getters: {
|
||||
// double: state => state.count * 2
|
||||
},
|
||||
actions: {
|
||||
setJWT( token,keepTokenLocal ){
|
||||
this.token = token
|
||||
if(keepTokenLocal)
|
||||
localStorage.setItem('token',token)
|
||||
},
|
||||
setUserID( id,keepTokenLocal ){
|
||||
this.userID = id
|
||||
if(keepTokenLocal)
|
||||
localStorage.setItem('userID',id)
|
||||
},
|
||||
setUserGroup( g,keepTokenLocal ){
|
||||
this.userGroup = g
|
||||
if(keepTokenLocal)
|
||||
localStorage.setItem('userGroup',g)
|
||||
}
|
||||
// increment() {
|
||||
// this.count++;
|
||||
// }
|
||||
|
||||
Reference in new issue
Block a user