Преглед изворни кода

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

yanglzh пре 1 година
родитељ
комит
a3688f6e5c
1 измењених фајлова са 4 додато и 4 уклоњено
  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);