dbsd_kczx/src/views/site/utils/index.ts

42 lines
925 B
TypeScript

import { defHttp } from '/@/utils/http/axios';
import { useUserStore } from '/@/store/modules/user';
/**
* 项目名称
*/
export const projectName = import.meta.env.VITE_GLOB_APP_TITLE;
/**
* 是否开启单点登录
*/
export const isOpenSSO = import.meta.env.VITE_GLOB_APP_OPEN_SSO;
export const getUserId = () => {
if(isOpenSSO){
const { userInfo } = useUserStore();
//正常取用户
return userInfo?.username;
}else{
//固定某值
return '2016900057';
}
}
//S:学生 T:教师
export const getUserSf = () => {
const { userInfo } = useUserStore();
if(userInfo?.userIdentity == 1){
return 'S';
}else if(userInfo?.userIdentity == 2){
return 'T';
}
}
// export const getSysConfig = () => defHttp.get({ url: '/kcSysConfig/kcSysConfig/queryById', params:{id:'1'} })
export const getSysConfig = () => {
const { sysConfigInfo } = useUserStore();
return sysConfigInfo;
}