agilebuilder-ui 1.0.73 → 1.0.74-tmp2
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/lib/super-ui.css +1 -1
- package/lib/super-ui.js +309 -505
- package/lib/super-ui.umd.cjs +8 -8
- package/package.json +2 -2
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-app.vue +393 -232
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-browser.vue +6 -6
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-component.vue +13 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload.vue +17 -23
- package/packages/fs-upload-new/src/fs-button-upload.vue +1 -2
- package/src/api/sso-service.js +1 -1
- package/src/permission.js +108 -122
- package/src/styles/theme/dark-blue/sidebar.scss +10 -0
- package/src/styles/theme/green/sidebar.scss +10 -1
- package/src/styles/theme/ocean-blue/sidebar.scss +10 -0
- package/src/utils/common-util.js +88 -20
- package/src/utils/i18n-util.js +138 -0
- package/src/views/layout/EmptyLayout.vue +0 -43
- package/src/views/layout/Layout.vue +0 -37
package/src/utils/common-util.js
CHANGED
|
@@ -2,7 +2,8 @@ import * as Vue from 'vue'
|
|
|
2
2
|
import authApi from './auth-api'
|
|
3
3
|
import { getToken, getLanguage, getAllLanguages, setAllLanguages } from './auth'
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid'
|
|
5
|
-
import {getCookieCache} from './auth'
|
|
5
|
+
import { getCookieCache } from './auth'
|
|
6
|
+
import i18nUtil from './i18n-util'
|
|
6
7
|
/**
|
|
7
8
|
* 获得相对地址
|
|
8
9
|
*/
|
|
@@ -311,15 +312,7 @@ export function isMobileBrowser() {
|
|
|
311
312
|
}
|
|
312
313
|
|
|
313
314
|
export function getLocaleByLang(lang) {
|
|
314
|
-
|
|
315
|
-
if (lang && lang.indexOf('_') > 0) {
|
|
316
|
-
const language = lang.substring(0, lang.indexOf('_'))
|
|
317
|
-
locale = language
|
|
318
|
-
}
|
|
319
|
-
if (locale === 'zh') {
|
|
320
|
-
locale = 'cn'
|
|
321
|
-
}
|
|
322
|
-
return locale
|
|
315
|
+
return i18nUtil.getLocaleByLang(lang)
|
|
323
316
|
}
|
|
324
317
|
|
|
325
318
|
export function cacheLangs(langs) {
|
|
@@ -438,12 +431,77 @@ export function cacheCurrentLanguageUtil(http) {
|
|
|
438
431
|
const token = getToken()
|
|
439
432
|
if (token) {
|
|
440
433
|
const currentLanguage = getLanguage()
|
|
441
|
-
|
|
442
|
-
|
|
434
|
+
const systemCode = getCurrentSystemCode()
|
|
435
|
+
if (isPlateSys(systemCode)) {
|
|
436
|
+
// 平台系统不需要加载国际化文件
|
|
437
|
+
if (currentLanguage && currentLanguage !== 'undefined') {
|
|
438
|
+
resolve(currentLanguage)
|
|
439
|
+
} else {
|
|
440
|
+
// 如果没有缓存当前用户的语言,则需要获取
|
|
441
|
+
const params = { systemCode: systemCode }
|
|
442
|
+
http
|
|
443
|
+
.post(window.$vueApp.config.globalProperties.baseAPI + '/acs/user/i18n-languages', params)
|
|
444
|
+
.then((langInfo) => {
|
|
445
|
+
resolve(langInfo.language ? langInfo.language : 'zh_CN')
|
|
446
|
+
})
|
|
447
|
+
.catch(() => {
|
|
448
|
+
resolve('zh_CN')
|
|
449
|
+
})
|
|
450
|
+
}
|
|
443
451
|
} else {
|
|
444
|
-
|
|
452
|
+
// 业务系统是否启用了国际化
|
|
453
|
+
const enableI18n = i18nUtil.getEnableI18nState(systemCode)
|
|
454
|
+
if (enableI18n === false && currentLanguage && currentLanguage !== 'undefined') {
|
|
455
|
+
// 如果没有开启国际化, 并且已经缓存了当前用户的语言,则直接返回
|
|
445
456
|
resolve(currentLanguage)
|
|
446
|
-
}
|
|
457
|
+
} else {
|
|
458
|
+
// 启用了国际化并且当前已经加载过了国际化json文件,则需要检查是否是最新的国际化文件
|
|
459
|
+
// 没有加载过国际化文件,则不用传递checkLastestI18nFile参数,后台会返回最新的国际化文件路径和用户当前语言
|
|
460
|
+
const url = i18nUtil.getLangFileUrl(systemCode, currentLanguage)
|
|
461
|
+
const params = { systemCode: systemCode }
|
|
462
|
+
if (url && currentLanguage && currentLanguage !== 'undefined' && enableI18n) {
|
|
463
|
+
params.checkLastestI18nFile = true
|
|
464
|
+
params.i18nFileVersion = i18nUtil.getI18nFileVersion()
|
|
465
|
+
}
|
|
466
|
+
http
|
|
467
|
+
.post(window.$vueApp.config.globalProperties.baseAPI + '/acs/user/i18n-languages', params)
|
|
468
|
+
.then((langInfo) => {
|
|
469
|
+
const i18nCurrentVersion = i18nUtil.getI18nFileVersion()
|
|
470
|
+
i18nUtil.setI18nFileVersion(langInfo.i18nFileVersion)
|
|
471
|
+
if (i18nCurrentVersion && Number(i18nCurrentVersion) === langInfo.i18nFileVersion) {
|
|
472
|
+
// 表示是最新的国际化文件,可以直接加载使用
|
|
473
|
+
i18nUtil
|
|
474
|
+
.loadLangFile(systemCode, url, currentLanguage)
|
|
475
|
+
.then(() => {
|
|
476
|
+
resolve(currentLanguage)
|
|
477
|
+
})
|
|
478
|
+
.catch(() => {
|
|
479
|
+
resolve(currentLanguage)
|
|
480
|
+
})
|
|
481
|
+
} else {
|
|
482
|
+
// 不是最新的国际化文件或者没有加载过国际化文件,则后端会返回最新的国际化文件路径和用户当前语言
|
|
483
|
+
i18nUtil.setEnableI18nState(systemCode, langInfo.enableI18n ? true : false)
|
|
484
|
+
if (langInfo.enableI18n && langInfo.i18nFileUrls[langInfo.language]) {
|
|
485
|
+
const url = langInfo.i18nFileUrls[langInfo.language] + '?_t_=' + new Date().getTime()
|
|
486
|
+
i18nUtil.setLangFileUrl(systemCode, langInfo.language, url)
|
|
487
|
+
i18nUtil
|
|
488
|
+
.loadLangFile(systemCode, url, langInfo.language)
|
|
489
|
+
.then(() => {
|
|
490
|
+
resolve(langInfo.language)
|
|
491
|
+
})
|
|
492
|
+
.catch(() => {
|
|
493
|
+
resolve(langInfo.language ? langInfo.language : 'zh_CN')
|
|
494
|
+
})
|
|
495
|
+
} else {
|
|
496
|
+
// 如果没有开启国际化
|
|
497
|
+
resolve(langInfo.language)
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
})
|
|
501
|
+
.catch(() => {
|
|
502
|
+
resolve('zh_CN')
|
|
503
|
+
})
|
|
504
|
+
}
|
|
447
505
|
}
|
|
448
506
|
} else {
|
|
449
507
|
// 默认是中文
|
|
@@ -518,8 +576,7 @@ export function replacePlaceholders(template, ...args) {
|
|
|
518
576
|
})
|
|
519
577
|
}
|
|
520
578
|
|
|
521
|
-
|
|
522
|
-
function isOpenMobileGateway () {
|
|
579
|
+
function isOpenMobileGateway() {
|
|
523
580
|
// 系统参数设置中配置的是否开启移动网关,没有配置默认是开启的
|
|
524
581
|
let isOpenMobileGatewayCache = getCookieCache('IS_OPEN_MOBILE_GATEWAY')
|
|
525
582
|
if (isOpenMobileGatewayCache === undefined || isOpenMobileGatewayCache === null) {
|
|
@@ -532,13 +589,16 @@ function isOpenMobileGateway () {
|
|
|
532
589
|
* @param {*} url
|
|
533
590
|
* @returns
|
|
534
591
|
*/
|
|
535
|
-
export function getReplaceUrlDomain
|
|
592
|
+
export function getReplaceUrlDomain(url) {
|
|
536
593
|
const isOpenMobileGatewayCache = isOpenMobileGateway()
|
|
537
594
|
console.log('===getReplaceUrlDomain==isOpenMobileGatewayCache=', isOpenMobileGatewayCache)
|
|
538
595
|
if (isOpenMobileGatewayCache === 'true' && url !== undefined && window.$vueApp.config.globalProperties.replaceUrl) {
|
|
539
596
|
// 表示需要替换url中的"https://域名"
|
|
540
597
|
const baseApi = uswindow.$vueApp.config.globalProperties.baseAPI
|
|
541
|
-
if (
|
|
598
|
+
if (
|
|
599
|
+
(url + '').indexOf(uswindow.$vueApp.config.globalProperties.replaceUrl + '/') < 0 &&
|
|
600
|
+
(url + '').indexOf('://') > 0
|
|
601
|
+
) {
|
|
542
602
|
// 表示路径还未替换
|
|
543
603
|
console.log('===getReplaceUrlDomain==url.indexOf(uswindow.$vueApp.config.globalProperties.replaceUrl) !== 0')
|
|
544
604
|
const prefixUrl1 = baseApi.substring(0, baseApi.indexOf('://'))
|
|
@@ -561,9 +621,17 @@ export function getReplaceUrlDomain (url) {
|
|
|
561
621
|
return url
|
|
562
622
|
}
|
|
563
623
|
|
|
564
|
-
export function formatFileName
|
|
624
|
+
export function formatFileName(fileName) {
|
|
565
625
|
if (fileName) {
|
|
566
626
|
fileName = fileName.replace('#', '~~').replace('?', '~$').replace('&', '$')
|
|
567
627
|
}
|
|
568
628
|
return fileName
|
|
569
|
-
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
export function getCurrentSystemCode() {
|
|
632
|
+
if (window.$vueApp.config.globalProperties.currentSystem) {
|
|
633
|
+
return window.$vueApp.config.globalProperties.currentSystem
|
|
634
|
+
} else {
|
|
635
|
+
return window.$vueApp.config.globalProperties.systemCode
|
|
636
|
+
}
|
|
637
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
export function setLangFileUrl(systemCode, lang, url) {
|
|
3
|
+
let i18nFileUrlsItem = getLocalStorageJson('i18nFileUrls')
|
|
4
|
+
if (!i18nFileUrlsItem) {
|
|
5
|
+
i18nFileUrlsItem = {}
|
|
6
|
+
}
|
|
7
|
+
i18nFileUrlsItem[systemCode + '_' + lang] = url
|
|
8
|
+
window.localStorage.setItem('i18nFileUrls', JSON.stringify(i18nFileUrlsItem))
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getLangFileUrl(systemCode, lang) {
|
|
12
|
+
const i18nFileUrlsItem = getLocalStorageJson('i18nFileUrls')
|
|
13
|
+
if (i18nFileUrlsItem) {
|
|
14
|
+
return i18nFileUrlsItem[systemCode + '_' + lang]
|
|
15
|
+
}
|
|
16
|
+
return null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function removeLangFileUrl(systemCode, lang) {
|
|
20
|
+
const i18nFileUrlsItem = getLocalStorageJson('i18nFileUrls')
|
|
21
|
+
if (i18nFileUrlsItem) {
|
|
22
|
+
delete i18nFileUrlsItem[systemCode + '_' + lang]
|
|
23
|
+
window.localStorage.setItem('i18nFileUrls', JSON.stringify(i18nFileUrlsItem))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function removeAllLangFileUrl(systemCode, lang) {
|
|
28
|
+
window.localStorage.removeItem('i18nFileUrls')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function setEnableI18nState(systemCode, enableI18n) {
|
|
32
|
+
let allStateObj = {}
|
|
33
|
+
const allState = getLocalStorageJson('enableI18nSystem')
|
|
34
|
+
if (allState) {
|
|
35
|
+
allStateObj = allState
|
|
36
|
+
}
|
|
37
|
+
allStateObj[systemCode] = enableI18n ? true : false
|
|
38
|
+
window.localStorage.setItem('enableI18nSystem', JSON.stringify(allStateObj))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function getEnableI18nState(systemCode) {
|
|
42
|
+
const allState = getLocalStorageJson('enableI18nSystem')
|
|
43
|
+
if (allState) {
|
|
44
|
+
return allState[systemCode]
|
|
45
|
+
}
|
|
46
|
+
return null
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function removeEnableI18nState() {
|
|
50
|
+
window.localStorage.removeItem('enableI18nSystem')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function removeEnableI18nWidthSystemCode() {
|
|
54
|
+
const allState = getLocalStorageJson('enableI18nSystem')
|
|
55
|
+
if (allState) {
|
|
56
|
+
delete allState[getCurrentSystemCode()]
|
|
57
|
+
window.localStorage.setItem('enableI18nSystem', JSON.stringify(allState))
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getLocalStorageJson(key) {
|
|
62
|
+
const item = window.localStorage.getItem(key)
|
|
63
|
+
if (item) {
|
|
64
|
+
return JSON.parse(item)
|
|
65
|
+
}
|
|
66
|
+
return null
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function loadLangFile(systemCode, url, language) {
|
|
70
|
+
console.log('loadLangFile', systemCode, url, language)
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
if (window.$i18n) {
|
|
73
|
+
axios
|
|
74
|
+
.get(url, {
|
|
75
|
+
withCredential: false
|
|
76
|
+
})
|
|
77
|
+
.then((response) => {
|
|
78
|
+
const lang = getLocaleByLang(language)
|
|
79
|
+
if (response && response.data) {
|
|
80
|
+
// 获取当前的国际化消息
|
|
81
|
+
const currentMessages = window.$i18n.global.getLocaleMessage(lang)
|
|
82
|
+
// 新的国际化消息
|
|
83
|
+
if (currentMessages[systemCode]) {
|
|
84
|
+
Object.assign(currentMessages[systemCode], response.data)
|
|
85
|
+
} else {
|
|
86
|
+
currentMessages[systemCode] = response.data
|
|
87
|
+
}
|
|
88
|
+
// 设置合并后的国际化消息
|
|
89
|
+
window.$i18n.global.setLocaleMessage(lang, currentMessages)
|
|
90
|
+
}
|
|
91
|
+
resolve()
|
|
92
|
+
})
|
|
93
|
+
.catch((error) => {
|
|
94
|
+
reject(error)
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
resolve()
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
export function getLocaleByLang(lang) {
|
|
101
|
+
let locale = 'cn'
|
|
102
|
+
if (lang && lang.indexOf('_') > 0) {
|
|
103
|
+
const language = lang.substring(0, lang.indexOf('_'))
|
|
104
|
+
locale = language
|
|
105
|
+
}
|
|
106
|
+
if (locale === 'zh') {
|
|
107
|
+
locale = 'cn'
|
|
108
|
+
}
|
|
109
|
+
return locale
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function clearI18nCache(lang) {
|
|
113
|
+
removeEnableI18nState()
|
|
114
|
+
removeAllLangFileUrl()
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function setI18nFileVersion(version) {
|
|
118
|
+
window.localStorage.setItem('i18nFileVersion', version)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function getI18nFileVersion() {
|
|
122
|
+
return window.localStorage.getItem('i18nFileVersion')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export default {
|
|
126
|
+
setLangFileUrl,
|
|
127
|
+
getLangFileUrl,
|
|
128
|
+
removeLangFileUrl,
|
|
129
|
+
setEnableI18nState,
|
|
130
|
+
getEnableI18nState,
|
|
131
|
+
removeEnableI18nState,
|
|
132
|
+
removeEnableI18nWidthSystemCode,
|
|
133
|
+
getLocalStorageJson,
|
|
134
|
+
loadLangFile,
|
|
135
|
+
getLocaleByLang,
|
|
136
|
+
setI18nFileVersion,
|
|
137
|
+
getI18nFileVersion
|
|
138
|
+
}
|
|
@@ -1,46 +1,3 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<router-view />
|
|
3
3
|
</template>
|
|
4
|
-
<script>
|
|
5
|
-
import eventBus from '../../../src/utils/eventBus'
|
|
6
|
-
export default {
|
|
7
|
-
created(){
|
|
8
|
-
window.addEventListener('message', this.receiveMessage, false)
|
|
9
|
-
},
|
|
10
|
-
destroyed () {
|
|
11
|
-
window.removeEventListener('message', this.receiveMessage, false)
|
|
12
|
-
},
|
|
13
|
-
methods: {
|
|
14
|
-
receiveMessage (event) {
|
|
15
|
-
const result = event.data
|
|
16
|
-
console.log('receiveMessage-----result111=', result)
|
|
17
|
-
if (result && typeof result === 'string') {
|
|
18
|
-
console.log('receiveMessage-----result2222=', result)
|
|
19
|
-
// console.log('接收手机端传过来的信息--receiveMessage===', result)
|
|
20
|
-
try {
|
|
21
|
-
const data = JSON.parse(result)
|
|
22
|
-
// console.log('接收手机端传过来的信息--data=', data)
|
|
23
|
-
const type = data.type // 'pickFileDone' 选择文件完成,'uploadFileDone' 上传文件完成
|
|
24
|
-
console.log('receiveMessage-----result3333=', type, 'data.files=', data.files)
|
|
25
|
-
// console.log('接收手机端传过来的信息--type=', type)
|
|
26
|
-
if (type && type === 'onResize') {
|
|
27
|
-
// 横竖屏切换时重新计算高度
|
|
28
|
-
eventBus.$emit('onResize')
|
|
29
|
-
} else if (type && type === 'pickFileDone') {
|
|
30
|
-
// 选择文件完成
|
|
31
|
-
console.log('receiveMessage-----result4444=', type)
|
|
32
|
-
// fileNames:[{name:'xx',base64Path:'xxx'},{name:'xxx',base64Path:'xxxxx'}]
|
|
33
|
-
eventBus.$emit('pickFileDone', data)
|
|
34
|
-
} else if (type && type === 'uploadFileDone') {
|
|
35
|
-
eventBus.$emit('uploadFileDone', data)
|
|
36
|
-
} else if (type && type === 'scan') {
|
|
37
|
-
eventBus.$emit('scan', data)
|
|
38
|
-
}
|
|
39
|
-
} catch (error) {
|
|
40
|
-
console.log(error)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
</script>
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
import { Sidebar, AppMain, Breadcrumb } from './components'
|
|
18
18
|
import ResizeMixin from './mixin/ResizeHandler'
|
|
19
19
|
import { isShowMenuRoute } from '../../../src/utils/common-util'
|
|
20
|
-
import eventBus from '../../../src/utils/eventBus'
|
|
21
20
|
|
|
22
21
|
export default {
|
|
23
22
|
name: 'Layout',
|
|
@@ -50,46 +49,10 @@ export default {
|
|
|
50
49
|
}
|
|
51
50
|
},
|
|
52
51
|
},
|
|
53
|
-
created(){
|
|
54
|
-
window.addEventListener('message', this.receiveMessage, false)
|
|
55
|
-
},
|
|
56
|
-
destroyed () {
|
|
57
|
-
window.removeEventListener('message', this.receiveMessage, false)
|
|
58
|
-
},
|
|
59
52
|
methods: {
|
|
60
53
|
handleClickOutside() {
|
|
61
54
|
this.$store.dispatch('closeSidebar', { withoutAnimation: false })
|
|
62
55
|
},
|
|
63
|
-
receiveMessage (event) {
|
|
64
|
-
const result = event.data
|
|
65
|
-
console.log('receiveMessage-----result111=', result)
|
|
66
|
-
if (result && typeof result === 'string') {
|
|
67
|
-
console.log('receiveMessage-----result2222=', result)
|
|
68
|
-
// console.log('接收手机端传过来的信息--receiveMessage===', result)
|
|
69
|
-
try {
|
|
70
|
-
const data = JSON.parse(result)
|
|
71
|
-
// console.log('接收手机端传过来的信息--data=', data)
|
|
72
|
-
const type = data.type // 'pickFileDone' 选择文件完成,'uploadFileDone' 上传文件完成
|
|
73
|
-
console.log('receiveMessage-----result3333=', type, 'data.files=', data.files)
|
|
74
|
-
// console.log('接收手机端传过来的信息--type=', type)
|
|
75
|
-
if (type && type === 'onResize') {
|
|
76
|
-
// 横竖屏切换时重新计算高度
|
|
77
|
-
eventBus.$emit('onResize')
|
|
78
|
-
} else if (type && type === 'pickFileDone') {
|
|
79
|
-
// 选择文件完成
|
|
80
|
-
console.log('receiveMessage-----result4444=', type)
|
|
81
|
-
// fileNames:[{name:'xx',base64Path:'xxx'},{name:'xxx',base64Path:'xxxxx'}]
|
|
82
|
-
eventBus.$emit('pickFileDone', data)
|
|
83
|
-
} else if (type && type === 'uploadFileDone') {
|
|
84
|
-
eventBus.$emit('uploadFileDone', data)
|
|
85
|
-
} else if (type && type === 'scan') {
|
|
86
|
-
eventBus.$emit('scan', data)
|
|
87
|
-
}
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.log(error)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
56
|
},
|
|
94
57
|
}
|
|
95
58
|
</script>
|