agilebuilder-ui 1.0.71-tmp1 → 1.0.71-tmp3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/permission.js +18 -4
- package/src/utils/common-util.js +29 -12
package/package.json
CHANGED
package/src/permission.js
CHANGED
|
@@ -77,10 +77,15 @@ router.beforeEach((to, from, next) => {
|
|
|
77
77
|
setToken(token)
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
if (to.query
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
80
|
+
// if (to.query) {
|
|
81
|
+
// if (to.query._systemName_) {
|
|
82
|
+
// window.top.document.title = to.query._systemName_
|
|
83
|
+
// }
|
|
84
|
+
// if (to.query.customSystem) {
|
|
85
|
+
// window.$vueApp.config.globalProperties.currentSystem = to.query.customSystem
|
|
86
|
+
// }
|
|
87
|
+
// // 表示需要设置浏览器页签名
|
|
88
|
+
// }
|
|
84
89
|
// console.log('router.beforeEach-getToken()=', token)
|
|
85
90
|
// 表示需要显示菜单。为了控制是否需要走获得有权限的菜单集合的接口。单点登录跳转到表单页面时不需要请求菜单,提高页面显示速度。
|
|
86
91
|
let isNeedMenu
|
|
@@ -104,6 +109,15 @@ router.beforeEach((to, from, next) => {
|
|
|
104
109
|
} else {
|
|
105
110
|
console.log('router.beforeEach-to.path!=login')
|
|
106
111
|
if (store.getters.name === '') {
|
|
112
|
+
if (to.query) {
|
|
113
|
+
if (to.query._systemName_) {
|
|
114
|
+
window.top.document.title = to.query._systemName_
|
|
115
|
+
}
|
|
116
|
+
if (to.query.customSystem) {
|
|
117
|
+
window.$vueApp.config.globalProperties.currentSystem = to.query.customSystem
|
|
118
|
+
}
|
|
119
|
+
// 表示需要设置浏览器页签名
|
|
120
|
+
}
|
|
107
121
|
// 表示刷新了页面(例如点击了一级菜单)后,会重新走该方法
|
|
108
122
|
console.log('router.beforeEach-store.getters.name === ""')
|
|
109
123
|
store
|
package/src/utils/common-util.js
CHANGED
|
@@ -3,7 +3,7 @@ import authApi from './auth-api'
|
|
|
3
3
|
import { getToken, getLanguage, getAllLanguages, setAllLanguages } from './auth'
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid'
|
|
5
5
|
import { getCookieCache } from './auth'
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
/**
|
|
8
8
|
* 获得相对地址
|
|
9
9
|
*/
|
|
@@ -362,11 +362,8 @@ export function cacheAllLanguagesUtil(http) {
|
|
|
362
362
|
setAllLanguages(cookieCacheLangs)
|
|
363
363
|
resolve()
|
|
364
364
|
} else {
|
|
365
|
-
|
|
366
|
-
http.get(window.$vueApp.config.globalProperties.baseAPI + '/component/i18n/languages').then((langInfo) => {
|
|
367
|
-
debugger
|
|
365
|
+
http.get(window.$vueApp.config.globalProperties.baseAPI + '/component/all-languages').then((langList) => {
|
|
368
366
|
const langResult = {}
|
|
369
|
-
const langList = langInfo.languages
|
|
370
367
|
if (langList) {
|
|
371
368
|
langList.forEach((item) => {
|
|
372
369
|
// 例如:zh_CN、en_US
|
|
@@ -385,9 +382,6 @@ export function cacheAllLanguagesUtil(http) {
|
|
|
385
382
|
})
|
|
386
383
|
}
|
|
387
384
|
cacheLangs(langResult)
|
|
388
|
-
if (langInfo.i18nFileUrls && langInfo.i18nFileUrls[window.$locale]) {
|
|
389
|
-
LoadScript(langInfo.i18nFileUrls[window.$locale])
|
|
390
|
-
}
|
|
391
385
|
resolve()
|
|
392
386
|
})
|
|
393
387
|
}
|
|
@@ -445,12 +439,28 @@ export function cacheCurrentLanguageUtil(http) {
|
|
|
445
439
|
const token = getToken()
|
|
446
440
|
if (token) {
|
|
447
441
|
const currentLanguage = getLanguage()
|
|
448
|
-
|
|
442
|
+
debugger
|
|
443
|
+
if (
|
|
444
|
+
currentLanguage &&
|
|
445
|
+
currentLanguage !== 'undefined' &&
|
|
446
|
+
getLangFileUrl(window.$vueApp.config.globalProperties.currentSystem, currentLanguage)
|
|
447
|
+
) {
|
|
449
448
|
resolve(currentLanguage)
|
|
450
449
|
} else {
|
|
451
|
-
http.get(window.$vueApp.config.globalProperties.baseAPI + '/acs/user-languages').then((currentLanguage) => {
|
|
452
|
-
|
|
453
|
-
|
|
450
|
+
// http.get(window.$vueApp.config.globalProperties.baseAPI + '/acs/user-languages').then((currentLanguage) => {
|
|
451
|
+
http
|
|
452
|
+
.get(
|
|
453
|
+
window.$vueApp.config.globalProperties.baseAPI +
|
|
454
|
+
'/acs/user/i18n-languages?systemCode=' +
|
|
455
|
+
window.$vueApp.config.globalProperties.currentSystem
|
|
456
|
+
)
|
|
457
|
+
.then((langInfo) => {
|
|
458
|
+
debugger
|
|
459
|
+
if (langInfo.i18nFileUrls && langInfo.i18nFileUrls[langInfo.language]) {
|
|
460
|
+
window.$vueApp.config.globalProperties.$loadScript(langInfo.i18nFileUrls[langInfo.language])
|
|
461
|
+
}
|
|
462
|
+
resolve(langInfo.language)
|
|
463
|
+
})
|
|
454
464
|
}
|
|
455
465
|
} else {
|
|
456
466
|
// 默认是中文
|
|
@@ -573,3 +583,10 @@ export function formatFileName(fileName) {
|
|
|
573
583
|
}
|
|
574
584
|
return fileName
|
|
575
585
|
}
|
|
586
|
+
export function setLangFileUrl(systemCode, lang, url) {
|
|
587
|
+
window.sessionStorage.setItem('langFileUrl_' + systemCode + '_' + lang, url)
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
export function getLangFileUrl(systemCode, lang) {
|
|
591
|
+
return window.sessionStorage.getItem('langFileUrl_' + systemCode + '_' + lang)
|
|
592
|
+
}
|