Prechádzať zdrojové kódy

fix: 修改 按钮,列表,上传方式的获取形式,修复租户新建时图片没有清空的问题

yanglzh 8 mesiacov pred
rodič
commit
fbdbdc2882

+ 1 - 1
src/api/system/index.ts

@@ -8,7 +8,7 @@ export default {
     // // sso授权登录回调
     callback: (params: object) => get(`/oauth/callback`, params),
     // // 系统用户登录绑定授权用户
-    // binding: (data: any) => post(`/oauth/binding`, data),
+    binding: (data: any) => post(`/oauth/binding`, data),
     list: (params?: object) => get('/system/oauthProvider/list', params),
     getAll: () => get('/system/oauthProvider/getAll'),
     detail: (id: number) => get('/system/oauthProvider/getInfoById', { id }),

+ 9 - 3
src/utils/auth.ts

@@ -18,14 +18,20 @@ export function setSystemInfo(data: any) {
   localStorage.setItem('sysinfo', JSON.stringify(data));
   // 使用的事base64加密的,解决之后的值  sysPasswordChangePeriod + "|" + isSecurityControlEnabled + "|" + isRsaEnabled+ "|" + _tag+ "|" + isSSOEnabled
   // 顺序是,密码变更周期,是否启动安全控制,是否启用rsa,中间你需要根据 | 切割一下
-  const [sysPasswordChangePeriod, isSecurityControlEnabled, isRsaEnabled, _tag, isSSOEnabled, isEnterprise] = window.atob(data.target).split('|')
+  // console.log(window.atob(data.target).split('|'))
+  const [sysPasswordChangePeriod, isSecurityControlEnabled, isRsaEnabled, _tag, isSSOEnabled, isEnterprise, btnEnabled, colEnabled, uploadFileWay] = window.atob(data.target).split('|')
   // isEnterprise 是否为企业版,0代表专业版  1代表企业版
   // 安全开关是否开启 按钮权限,列表权限,rsa权限在开启安全权限下才使用
-  sessionStorage.setItem('isSecurityControlEnabled', Number(isSecurityControlEnabled) ? '1' : '');
-  sessionStorage.setItem('isRsaEnabled', (Number(isSecurityControlEnabled) && Number(isRsaEnabled)) ? '1' : '');
+  const enabled = Number(isSecurityControlEnabled)
+  sessionStorage.setItem('isSecurityControlEnabled', enabled ? '1' : '');
+  sessionStorage.setItem('isRsaEnabled', (enabled && Number(isRsaEnabled)) ? '1' : '');
   sessionStorage.setItem('sysPasswordChangePeriod', sysPasswordChangePeriod);
   sessionStorage.setItem('isSSOEnabled', Number(isSSOEnabled) ? '1' : '');
   sessionStorage.setItem('isEnterprise', Number(isEnterprise) ? '1' : '');
+
+  localStorage.setItem('btnNoAuth', (enabled && Number(btnEnabled)) ? '' : '1');
+  localStorage.setItem('colNoAuth', (enabled && Number(colEnabled)) ? '' : '1');
+  localStorage.setItem('uploadFileWay', uploadFileWay || '0');
 }
 
 export function getSystemInfo() {

+ 0 - 8
src/views/login/component/account-tenant.vue

@@ -195,14 +195,6 @@ 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 || 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);
 
 								currentUser();

+ 0 - 8
src/views/login/component/account.vue

@@ -194,14 +194,6 @@ 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 || 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);
 
 								currentUser();

+ 3 - 0
src/views/modules/tenant/edit.vue

@@ -54,6 +54,9 @@ const baseForm: any = {
 	systemName: '',
 	systemCopyright: '',
 	description: '',
+	logoMini: '',
+	logoPic: '',
+	logo: '',
 };
 
 const formData = reactive<any>(JSON.parse(JSON.stringify(baseForm)));

+ 0 - 9
src/views/sso/component/account.vue

@@ -146,15 +146,6 @@ export default defineComponent({
 								// 存储用户信息到浏览器缓存
 								Session.set('userInfo', userInfos);
 
-
-								// 获取权限配置,上传文件类型等
-								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 || 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);
 
 								currentUser();

+ 0 - 8
src/views/sso/index.vue

@@ -77,14 +77,6 @@ export default defineComponent({
 			// 存储用户信息到浏览器缓存
 			Session.set('userInfo', userInfos);
 
-			// 获取权限配置,上传文件类型等
-			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 || 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);
 
 			currentUser();