Quellcode durchsuchen

fix: 兼容获取不到上传方式的报错情况

yanglzh vor 1 Jahr
Ursprung
Commit
a3688f6e5c
1 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 4 4
      src/views/login/component/account.vue

+ 4 - 4
src/views/login/component/account.vue

@@ -152,10 +152,10 @@ export default defineComponent({
 								// 获取权限配置,上传文件类型等
 								const [columnRes, buttonRes, uploadFileRes] = await Promise.all([api.getInfoByKey('sys.column.switch'), api.getInfoByKey('sys.button.switch'), api.getInfoByKey('sys.uploadFile.way')])
 
-								const isSecurityControlEnabled = sessionStorage.isSecurityControlEnabled
-								localStorage.setItem('btnNoAuth', (isSecurityControlEnabled && Number(buttonRes.data.configValue)) ? '' : '1');
-								localStorage.setItem('colNoAuth', (isSecurityControlEnabled && Number(columnRes.data.configValue)) ? '' : '1');
-								localStorage.setItem('uploadFileWay', uploadFileRes.data.configValue);
+								const isSecurityControlEnabled = sessionStorage.isSecurityControlEnabled || null
+								localStorage.setItem('btnNoAuth', (isSecurityControlEnabled && Number(buttonRes?.data?.configValue)) ? '' : '1');
+								localStorage.setItem('colNoAuth', (isSecurityControlEnabled && Number(columnRes?.data?.configValue)) ? '' : '1');
+								localStorage.setItem('uploadFileWay', uploadFileRes?.data?.configValue || '0');
 
 								await store.dispatch('userInfos/setUserInfos', userInfos);