mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-11 11:43:43 +08:00
feat: vue-mobile => 完善移动端聊天列表页功能
This commit is contained in:
11
web/src/store/chat.js
Normal file
11
web/src/store/chat.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import Storage from 'good-storage'
|
||||
|
||||
const CHAT_CONFIG_KEY = "chat_config"
|
||||
|
||||
export function getChatConfig() {
|
||||
return Storage.get(CHAT_CONFIG_KEY)
|
||||
}
|
||||
|
||||
export function setChatConfig(chatConfig) {
|
||||
Storage.set(CHAT_CONFIG_KEY, chatConfig)
|
||||
}
|
||||
29
web/src/store/session.js
Normal file
29
web/src/store/session.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable no-constant-condition */
|
||||
|
||||
/**
|
||||
* storage handler
|
||||
*/
|
||||
|
||||
const SessionUserKey = 'LOGIN_USER';
|
||||
|
||||
export function getSessionId() {
|
||||
const user = getLoginUser();
|
||||
return user ? user['session_id'] : '';
|
||||
}
|
||||
|
||||
export function removeLoginUser() {
|
||||
sessionStorage.removeItem(SessionUserKey)
|
||||
}
|
||||
|
||||
export function getLoginUser() {
|
||||
const value = sessionStorage.getItem(SessionUserKey);
|
||||
if (value) {
|
||||
return JSON.parse(value);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function setLoginUser(user) {
|
||||
sessionStorage.setItem(SessionUserKey, JSON.stringify(user))
|
||||
}
|
||||
Reference in New Issue
Block a user