78 lines
2.0 KiB
JavaScript
78 lines
2.0 KiB
JavaScript
|
|
import { usePythonBridge} from "@/utils/pythonBridge";
|
|
|
|
const { getStorageData, setStorageData,deleteStorageData} = usePythonBridge();
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
export async function setToken(token) {
|
|
const res = await setStorageData({key: 'token',data: token}).then(res => {
|
|
});
|
|
}
|
|
|
|
export async function getToken() {
|
|
const res = await getStorageData({ key: 'token' });
|
|
return JSON.parse(res);
|
|
}
|
|
|
|
export async function removeToken() {
|
|
const res = deleteStorageData({key: 'token'});
|
|
}
|
|
|
|
export async function setUser(user) {
|
|
const res = await setStorageData({key: 'user',data: user}).then(res => {
|
|
});
|
|
}
|
|
|
|
export async function getUser() {
|
|
const res = await getStorageData({ key: 'user' });
|
|
return JSON.parse(res);
|
|
}
|
|
|
|
export function setuserprmisson() {
|
|
return new Promise((resolve, reject) => {
|
|
const res = getStorageData({ key: 'user' });
|
|
resolve(res);
|
|
});
|
|
}
|
|
|
|
export async function setNumData(numData) {
|
|
const res = await setStorageData({key: 'num',data: numData})
|
|
}
|
|
|
|
export async function getNumData() {
|
|
const res = await getStorageData({ key: 'num' });
|
|
return JSON.parse(res);
|
|
}
|
|
|
|
|
|
// 导出一个函数,用于设置用户密码
|
|
export async function setUserPass(userdata) {
|
|
const res = await setStorageData({key: 'userPass',data:userdata})
|
|
}
|
|
// 导出一个函数,用于获取用户密码
|
|
export async function getUserPass() {
|
|
const res = await getStorageData({ key: 'userPass' });
|
|
return JSON.parse(res);
|
|
}
|
|
// 用于设置tk账户密码
|
|
export async function setTkUser(userdata) {
|
|
const res = await setStorageData({key: 'tkuser',data: userdata})
|
|
}
|
|
// 用于获取tk账户密码
|
|
|
|
export async function getTkUser() {
|
|
const res = await getStorageData({ key: 'tkuser' });
|
|
return JSON.parse(res);
|
|
}
|
|
|
|
// 用于列表筛选条件
|
|
export async function setSerch(data) {
|
|
const res = await setStorageData({key: 'Serch',data: data})
|
|
}
|
|
|
|
// 用于获取列表筛选条件
|
|
export async function getSerch() {
|
|
const res = await getStorageData({ key: 'Serch' });
|
|
return JSON.parse(res);
|
|
}
|