mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 12:18:43 +08:00 
			
		
		
		
	perf: 优化.env配置
This commit is contained in:
		
							
								
								
									
										3
									
								
								.env
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								.env
									
									
									
									
									
								
							@@ -13,5 +13,8 @@ VITE_APP_TENANT_ENABLE=true
 | 
			
		||||
# 验证码的开关
 | 
			
		||||
VITE_APP_CAPTCHA_ENABLE=true
 | 
			
		||||
 | 
			
		||||
# 文档地址的开关
 | 
			
		||||
VITE_APP_DOCALERT_ENABLE=false
 | 
			
		||||
 | 
			
		||||
# 百度统计
 | 
			
		||||
VITE_APP_BAIDU_CODE = a1ff8825baa73c3a78eb96aa40325abc
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ const goToUrl = () => {
 | 
			
		||||
 | 
			
		||||
/** 是否开启 */
 | 
			
		||||
const getEnable = () => {
 | 
			
		||||
  return import.meta.env.VITE_APP_TENANT_ENABLE === 'true'
 | 
			
		||||
  return import.meta.env.VITE_APP_DOCALERT_ENABLE !== 'false'
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
<style scoped>
 | 
			
		||||
 
 | 
			
		||||
@@ -193,8 +193,8 @@ const LoginRules = {
 | 
			
		||||
}
 | 
			
		||||
const loginData = reactive({
 | 
			
		||||
  isShowPassword: false,
 | 
			
		||||
  captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE,
 | 
			
		||||
  tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE,
 | 
			
		||||
  captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE !== 'false',
 | 
			
		||||
  tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE !== 'false',
 | 
			
		||||
  loginForm: {
 | 
			
		||||
    tenantName: '芋道源码',
 | 
			
		||||
    username: 'admin',
 | 
			
		||||
@@ -207,7 +207,7 @@ const loginData = reactive({
 | 
			
		||||
// 获取验证码
 | 
			
		||||
const getCode = async () => {
 | 
			
		||||
  // 情况一,未开启:则直接登录
 | 
			
		||||
  if (loginData.captchaEnable === 'false') {
 | 
			
		||||
  if (loginData.captchaEnable) {
 | 
			
		||||
    await handleLogin({})
 | 
			
		||||
  } else {
 | 
			
		||||
    // 情况二,已开启:则展示验证码;只有完成验证码的情况,才进行登录
 | 
			
		||||
@@ -217,7 +217,7 @@ const getCode = async () => {
 | 
			
		||||
}
 | 
			
		||||
//获取租户ID
 | 
			
		||||
const getTenantId = async () => {
 | 
			
		||||
  if (loginData.tenantEnable === 'true') {
 | 
			
		||||
  if (loginData.tenantEnable) {
 | 
			
		||||
    const res = await LoginApi.getTenantIdByName(loginData.loginForm.tenantName)
 | 
			
		||||
    authUtil.setTenantId(res)
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								types/env.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								types/env.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -14,6 +14,7 @@ interface ImportMetaEnv {
 | 
			
		||||
  readonly VITE_DEV: string
 | 
			
		||||
  readonly VITE_APP_CAPTCHA_ENABLE: string
 | 
			
		||||
  readonly VITE_APP_TENANT_ENABLE: string
 | 
			
		||||
  readonly VITE_APP_DOCALERT_ENABLE: string
 | 
			
		||||
  readonly VITE_BASE_URL: string
 | 
			
		||||
  readonly VITE_UPLOAD_URL: string
 | 
			
		||||
  readonly VITE_API_BASEPATH: string
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user