2023-04-10 23:14:07 +08:00
|
|
|
import { defHttp } from '/@/utils/http/axios';
|
2023-04-18 21:17:10 +08:00
|
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 项目名称
|
|
|
|
*/
|
|
|
|
export const projectName = import.meta.env.VITE_GLOB_APP_TITLE;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 是否开启单点登录
|
|
|
|
*/
|
2023-04-19 20:51:55 +08:00
|
|
|
export const isOpenSSO = import.meta.env.VITE_GLOB_APP_OPEN_SSO == 'true'?true:false;
|
2023-04-10 23:14:07 +08:00
|
|
|
|
2023-04-06 00:45:01 +08:00
|
|
|
export const getUserId = () => {
|
2023-04-19 20:51:55 +08:00
|
|
|
console.log(`🚀 ~ file: index.ts:17 ~ getUserId ~ isOpenSSO:`, isOpenSSO)
|
2023-04-18 21:17:10 +08:00
|
|
|
if(isOpenSSO){
|
2023-04-19 20:51:55 +08:00
|
|
|
console.log(`🚀 ~ file: index.ts:17 ~ getUserId ~ isOpenSSO1:`, isOpenSSO)
|
2023-04-18 21:17:10 +08:00
|
|
|
const { userInfo } = useUserStore();
|
|
|
|
//正常取用户
|
|
|
|
return userInfo?.username;
|
|
|
|
}else{
|
2023-04-19 20:51:55 +08:00
|
|
|
console.log(`🚀 ~ file: index.ts:17 ~ getUserId ~ isOpenSSO2:`, isOpenSSO)
|
2023-04-18 21:17:10 +08:00
|
|
|
//固定某值
|
2023-04-19 20:51:55 +08:00
|
|
|
// return '2016900057';//教师
|
|
|
|
return '2022010920';//学生
|
2023-04-18 21:17:10 +08:00
|
|
|
}
|
2023-04-18 23:54:12 +08:00
|
|
|
}
|
|
|
|
|
2023-04-18 21:17:10 +08:00
|
|
|
//S:学生 T:教师
|
2023-04-18 23:54:12 +08:00
|
|
|
export const getUserSf = () => {
|
2023-04-18 21:17:10 +08:00
|
|
|
const { userInfo } = useUserStore();
|
|
|
|
if(userInfo?.userIdentity == 1){
|
|
|
|
return 'S';
|
|
|
|
}else if(userInfo?.userIdentity == 2){
|
|
|
|
return 'T';
|
|
|
|
}
|
2023-04-10 23:14:07 +08:00
|
|
|
}
|
2023-04-19 22:03:20 +08:00
|
|
|
/**
|
|
|
|
* 获取当前登录用户信息
|
|
|
|
*/
|
|
|
|
export const getUserInfo = () => {
|
|
|
|
const { userInfo } = useUserStore();
|
|
|
|
return userInfo;
|
|
|
|
}
|
2023-04-10 23:14:07 +08:00
|
|
|
|
|
|
|
// export const getSysConfig = () => defHttp.get({ url: '/kcSysConfig/kcSysConfig/queryById', params:{id:'1'} })
|
2023-04-18 21:17:10 +08:00
|
|
|
export const getSysConfig = () => {
|
|
|
|
const { sysConfigInfo } = useUserStore();
|
|
|
|
return sysConfigInfo;
|
|
|
|
}
|