c6be18f0 by lxs

通过config.js配置appKey

1 parent 49419e23
system.__APP_CONFIG__ = {
appKey: '672c2c38e4b0cac8732a6106',
var system = {
appConfig: {
appKey: "672c2c38e4b0cac8732a6106",
}
}
......
......@@ -30,11 +30,12 @@ const useUserStore = defineStore(
const idassLoginUrl = import.meta.env.VITE_IDASS_BASEURL;
const timer: any = ref(null);
//获取token.
function getToken(data, state) {
async function getToken(data, state) {
const config = system.appConfig;
data.platformGuid = "7f16f697aec111ef8656fa163e60becd";
data.userType = 2;
data.appKey = '672c2c38e4b0cac8732a6106';
// data.appKey = system.__APP_CONFIG__.appKey;
// data.appKey = '672c2c38e4b0cac8732a6106';
data.appKey = config.appKey ;
data.validateUri = location.origin == 'http://localhost:9000' ? 'http://localhost:9000/' : location.origin + '/';
return getTokenPromise.value = getTokenByCode(data).then((res: any) => {
getTokenPromise.value = null;
......@@ -56,7 +57,7 @@ const useUserStore = defineStore(
currentTenantGuid.value = res.data.tenantInfoList && res.data.tenantInfoList.length ? res.data.tenantInfoList[0].guid : '';
localStorage.setItem('currentTenantGuid', currentTenantGuid.value);
let currentTenant = res.data.tenantInfoList?.[0];
return getCurrentUserInfo({tenantGuid: currentTenantGuid.value}).then((res: any) => {
return getCurrentUserInfo({ tenantGuid: currentTenantGuid.value }).then((res: any) => {
console.log(res, 'getCurrentUserInfo');
if (res.code == '00000') {
userName.value = res.data.staffName;
......
......@@ -275,12 +275,3 @@ declare namespace Menu {
children: recordRaw[]
}
}
// 配置appKey
declare global {
interface System {
__APP_CONFIG__: {
appKey: string
};
}
}
......
......@@ -61,6 +61,7 @@ export default ({ mode, command }) => {
build: {
outDir: mode === 'product' ? 'dist' : `dist-${mode}`,
sourcemap: env.VITE_BUILD_SOURCEMAP === 'true',
assetsInlineLimit: 0 // 确保config.js不会被内联
},
define: {
__SYSTEM_INFO__: JSON.stringify({
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!