agilebuilder-ui 1.0.71-tmp7 → 1.0.72
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 +29640 -27931
- package/lib/super-ui.umd.cjs +95 -87
- package/package.json +4 -5
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-app.vue +249 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-browser.vue +484 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-component.vue +127 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload-input.vue +220 -0
- package/packages/fs-upload-new/src/file-upload-mobile/file-upload.vue +255 -0
- package/packages/fs-upload-new/src/fs-button-upload.vue +3 -2
- package/packages/fs-upload-new/src/fs-drag-upload.vue +2 -6
- package/packages/fs-upload-new/src/fs-preview-new.vue +30 -13
- package/packages/fs-upload-new/src/fs-upload-new.vue +88 -8
- package/src/i18n/langs/cn.js +2 -0
- package/src/i18n/langs/en.js +2 -0
- package/src/permission.js +122 -108
- package/src/utils/common-util.js +24 -86
- package/src/utils/i18n-util.js +0 -127
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FsUploadList
|
|
3
|
-
v-if="displayType === 'input'"
|
|
3
|
+
v-if="!isMobile && displayType === 'input'"
|
|
4
4
|
:value="props.fileInfo.showName"
|
|
5
5
|
:row="entity"
|
|
6
6
|
:disabled="disabled"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
@delete-success="onInputDeleteSuccess"
|
|
12
12
|
/>
|
|
13
13
|
<fs-button-upload
|
|
14
|
-
v-else-if="displayType === 'button'"
|
|
14
|
+
v-else-if="!isMobile && displayType === 'button'"
|
|
15
15
|
:disabled="disabled"
|
|
16
16
|
:fileInfo="fileInfo"
|
|
17
17
|
:systemCode="systemCode"
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
:action="action"
|
|
24
24
|
:headers="headers"
|
|
25
25
|
:file-list="fileList"
|
|
26
|
-
:
|
|
26
|
+
:beforeUpload="beforeUpload"
|
|
27
27
|
:onSuccess="onSuccess"
|
|
28
28
|
:beforeRemove="beforeRemove"
|
|
29
29
|
:onRemove="onRemove"
|
|
30
30
|
:beforeDownload="beforeDownload"
|
|
31
31
|
:pageContext="pageContext"
|
|
32
32
|
:configure="configure"
|
|
33
|
-
|
|
33
|
+
:openFsUpload="openFsUpload"
|
|
34
34
|
/>
|
|
35
35
|
<fs-drag-upload
|
|
36
|
-
v-else-if="displayType === 'drag'"
|
|
36
|
+
v-else-if="!isMobile && displayType === 'drag'"
|
|
37
37
|
:disabled="disabled"
|
|
38
38
|
:fileInfo="fileInfo"
|
|
39
39
|
:systemCode="systemCode"
|
|
@@ -45,20 +45,68 @@
|
|
|
45
45
|
:action="action"
|
|
46
46
|
:headers="headers"
|
|
47
47
|
:file-list="fileList"
|
|
48
|
-
:
|
|
48
|
+
:beforeUpload="beforeUpload"
|
|
49
49
|
:onSuccess="onSuccess"
|
|
50
50
|
:beforeRemove="beforeRemove"
|
|
51
51
|
:onRemove="onRemove"
|
|
52
52
|
:beforeDownload="beforeDownload"
|
|
53
53
|
:pageContext="pageContext"
|
|
54
54
|
:configure="configure"
|
|
55
|
-
|
|
55
|
+
:openFsUpload="openFsUpload"
|
|
56
|
+
/>
|
|
57
|
+
<FileUploadInputMobile
|
|
58
|
+
v-else-if="isMobile && displayType === 'input'"
|
|
59
|
+
:disabled="disabled"
|
|
60
|
+
:fileInfo="fileInfo"
|
|
61
|
+
:systemCode="systemCode"
|
|
62
|
+
:accept="accept"
|
|
63
|
+
:multiple="multiple"
|
|
64
|
+
:limit="limit"
|
|
65
|
+
:limitFileSize="limitFileSize"
|
|
66
|
+
:placeholder="placeholder"
|
|
67
|
+
:action="action"
|
|
68
|
+
:headers="headers"
|
|
69
|
+
:file-list="fileList"
|
|
70
|
+
:beforeUpload="beforeUpload"
|
|
71
|
+
:onSuccess="onSuccess"
|
|
72
|
+
:beforeRemove="beforeRemove"
|
|
73
|
+
:onRemove="onRemove"
|
|
74
|
+
:beforeDownload="beforeDownload"
|
|
75
|
+
:pageContext="pageContext"
|
|
76
|
+
:configure="configure"
|
|
77
|
+
:openFsUpload="openFsUpload"
|
|
78
|
+
/>
|
|
79
|
+
<FileUploadMobile v-else-if="isMobile"
|
|
80
|
+
:disabled="disabled"
|
|
81
|
+
:fileInfo="fileInfo"
|
|
82
|
+
:systemCode="systemCode"
|
|
83
|
+
:accept="accept"
|
|
84
|
+
:multiple="multiple"
|
|
85
|
+
:limit="limit"
|
|
86
|
+
:limitFileSize="limitFileSize"
|
|
87
|
+
:placeholder="placeholder"
|
|
88
|
+
:action="action"
|
|
89
|
+
:headers="headers"
|
|
90
|
+
:file-list="fileList"
|
|
91
|
+
:beforeUpload="beforeUpload"
|
|
92
|
+
:onSuccess="onSuccess"
|
|
93
|
+
:beforeRemove="beforeRemove"
|
|
94
|
+
:onRemove="onRemove"
|
|
95
|
+
:beforeDownload="beforeDownload"
|
|
96
|
+
:pageContext="pageContext"
|
|
97
|
+
:configure="configure"
|
|
98
|
+
:openFsUpload="openFsUpload"
|
|
99
|
+
@uploadend="uploadendMobile"
|
|
100
|
+
@remove="removeMobileFile"
|
|
56
101
|
/>
|
|
57
102
|
</template>
|
|
58
103
|
<script setup lang="ts">
|
|
59
104
|
import FsDragUpload from './fs-drag-upload.vue'
|
|
60
105
|
import FsButtonUpload from './fs-button-upload.vue'
|
|
106
|
+
import FileUploadMobile from './file-upload-mobile/file-upload.vue'
|
|
107
|
+
import FileUploadInputMobile from './file-upload-mobile/file-upload-input.vue'
|
|
61
108
|
import { ref, defineProps } from 'vue'
|
|
109
|
+
import { getReplaceUrlDomain, isMobileBrowser, isPlateSys } from '../../../src/utils/common-util'
|
|
62
110
|
const props = defineProps({
|
|
63
111
|
openFsUpload:{
|
|
64
112
|
type: Object,
|
|
@@ -118,7 +166,7 @@ const props = defineProps({
|
|
|
118
166
|
type: Array<{ showName: string; serverPath: string }>,
|
|
119
167
|
default: () => []
|
|
120
168
|
},
|
|
121
|
-
|
|
169
|
+
beforeUpload: {
|
|
122
170
|
type: Function,
|
|
123
171
|
default: () => {}
|
|
124
172
|
},
|
|
@@ -147,6 +195,9 @@ const props = defineProps({
|
|
|
147
195
|
default: () => ({})
|
|
148
196
|
}
|
|
149
197
|
})
|
|
198
|
+
const isMobile = ref(isMobileBrowser())
|
|
199
|
+
const pageType = ref(props.pageContext.pageType)
|
|
200
|
+
console.log('附件上传控件---fs-upload-new---isMobile=', isMobile.value, 'pageType=', pageType.value , 'systemCode=', props.systemCode ,'configure=', props.configure, 'props.pageContext=', props.pageContext)
|
|
150
201
|
const listFileLabel = ref<string>('')
|
|
151
202
|
if (props.displayType === 'input') {
|
|
152
203
|
listFileLabel.value = props.fileInfo.showName || ''
|
|
@@ -179,4 +230,33 @@ const onInputDeleteSuccess = (res: any) => {
|
|
|
179
230
|
listFileLabel.value = props.fileList.map((item: any) => item.showName).join(',')
|
|
180
231
|
props.onRemove()
|
|
181
232
|
}
|
|
233
|
+
|
|
234
|
+
function uploadendMobile(fileList) {
|
|
235
|
+
const fileServerPaths = Array.from(props.fileList,({serverPath})=>serverPath)
|
|
236
|
+
// console.log('uploadendMobile---props.fileList=', props.fileList,'fileServerPaths=',fileServerPaths, 'fileList=', fileList)
|
|
237
|
+
fileList.forEach(file=>{
|
|
238
|
+
// 如果已经存在就不要重复添加到fileList中了
|
|
239
|
+
if(fileServerPaths.indexOf(file.serverPath) < 0){
|
|
240
|
+
props.fileList.push({
|
|
241
|
+
showName: file.name,
|
|
242
|
+
serverPath: file.serverPath
|
|
243
|
+
})
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
props.onSuccess()
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
function removeMobileFile(param) {
|
|
251
|
+
// console.log('removeMobileFile---props.fileList=', props.fileList, 'param=', param)
|
|
252
|
+
const deleteFile = param.rmFiles && param.rmFiles.length > 0 ? param.rmFiles[0] : null
|
|
253
|
+
if(deleteFile){
|
|
254
|
+
let index = props.fileList.findIndex((item: any) => item.serverPath === deleteFile.serverPath)
|
|
255
|
+
if (index > -1) {
|
|
256
|
+
// eslint-disable-next-line vue/no-mutating-props
|
|
257
|
+
props.fileList.splice(index, 1)
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
props.onRemove()
|
|
261
|
+
}
|
|
182
262
|
</script>
|
package/src/i18n/langs/cn.js
CHANGED
package/src/i18n/langs/en.js
CHANGED
|
@@ -269,6 +269,8 @@ const en = {
|
|
|
269
269
|
uploadSucceeded: 'Upload succeeded',
|
|
270
270
|
theNumberOfUploadsExceedsTheLimitTheLimitIs:
|
|
271
271
|
'The number of uploads exceeds the limit. The limit is',
|
|
272
|
+
image: 'Image',
|
|
273
|
+
video: 'Video'
|
|
272
274
|
},
|
|
273
275
|
messageVideo: {
|
|
274
276
|
attemptingToIdentify: 'Attempting to identify',
|
package/src/permission.js
CHANGED
|
@@ -8,17 +8,17 @@ import { ElMessage as Message } from 'element-plus'
|
|
|
8
8
|
import * as Vue from 'vue'
|
|
9
9
|
import authApi from './utils/auth-api'
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import {cacheAllLanguagesUtil, getLocaleByLang, cacheCurrentLanguageUtil} from './utils/common-util'
|
|
12
12
|
|
|
13
13
|
// 首次加载业务系统时,获得用户的语言
|
|
14
14
|
function initUserLanguage() {
|
|
15
15
|
return new Promise((resolve, reject) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
cacheCurrentLanguageUtil(window.$http).then((lang) => {
|
|
17
|
+
const locale = getLocaleByLang(lang)
|
|
18
|
+
// i18n.locale = locale // 关键语句
|
|
19
|
+
window.$locale = locale
|
|
20
|
+
resolve()
|
|
21
|
+
})
|
|
22
22
|
})
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -27,7 +27,13 @@ function cacheAllLanguages() {
|
|
|
27
27
|
return cacheAllLanguagesUtil(window.$http)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const whiteList = [
|
|
30
|
+
const whiteList = [
|
|
31
|
+
'/login',
|
|
32
|
+
'/update-password',
|
|
33
|
+
'/forget-password',
|
|
34
|
+
'/reset-password',
|
|
35
|
+
'/redirect',
|
|
36
|
+
] // 不重定向白名单
|
|
31
37
|
|
|
32
38
|
let devpJWTKey = '_devpJWT'
|
|
33
39
|
let runDevpJWTKey = '_runDevpJWT'
|
|
@@ -53,12 +59,12 @@ router.beforeEach((to, from, next) => {
|
|
|
53
59
|
let token
|
|
54
60
|
// 是否是开发环境功能
|
|
55
61
|
let isDevp = isDevpSystem()
|
|
56
|
-
if
|
|
62
|
+
if(authApi.getSessionCache(runDevpJWTKey)) {
|
|
57
63
|
// setToken(authApi.getSessionCache(runDevpJWTKey))
|
|
58
64
|
token = authApi.getSessionCache(runDevpJWTKey)
|
|
59
65
|
console.log('router.beforeEach-authApi.getSessionCache(_runDevpJWT)=', authApi.getSessionCache(runDevpJWTKey))
|
|
60
66
|
}
|
|
61
|
-
if
|
|
67
|
+
if(!token) {
|
|
62
68
|
token = getToken()
|
|
63
69
|
}
|
|
64
70
|
console.log('router.beforeEach-token=', token)
|
|
@@ -77,15 +83,10 @@ router.beforeEach((to, from, next) => {
|
|
|
77
83
|
setToken(token)
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// if (to.query.customSystem) {
|
|
85
|
-
// window.$vueApp.config.globalProperties.currentSystem = to.query.customSystem
|
|
86
|
-
// }
|
|
87
|
-
// // 表示需要设置浏览器页签名
|
|
88
|
-
// }
|
|
86
|
+
if (to.query && to.query._systemName_) {
|
|
87
|
+
// 表示需要设置浏览器页签名
|
|
88
|
+
window.top.document.title = to.query._systemName_
|
|
89
|
+
}
|
|
89
90
|
// console.log('router.beforeEach-getToken()=', token)
|
|
90
91
|
// 表示需要显示菜单。为了控制是否需要走获得有权限的菜单集合的接口。单点登录跳转到表单页面时不需要请求菜单,提高页面显示速度。
|
|
91
92
|
let isNeedMenu
|
|
@@ -99,9 +100,14 @@ router.beforeEach((to, from, next) => {
|
|
|
99
100
|
}
|
|
100
101
|
console.log('iMatrix-router.beforeEach2-isNeedMenu==', isNeedMenu)
|
|
101
102
|
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
([
|
|
104
|
+
'/update-password',
|
|
105
|
+
'/forget-password',
|
|
106
|
+
'/reset-password',
|
|
107
|
+
'/redirect',
|
|
108
|
+
].indexOf(to.path) === -1 ||
|
|
109
|
+
store.getters.whiteList.indexOf(to.path) !== -1) &&
|
|
110
|
+
token
|
|
105
111
|
) {
|
|
106
112
|
if (to.path === '/login') {
|
|
107
113
|
next({ path: '/', query: to.query })
|
|
@@ -109,99 +115,104 @@ router.beforeEach((to, from, next) => {
|
|
|
109
115
|
} else {
|
|
110
116
|
console.log('router.beforeEach-to.path!=login')
|
|
111
117
|
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 && to.query.customSystem !== 'undefined' && to.query.customSystem !== 'null') {
|
|
117
|
-
window.$vueApp.config.globalProperties.currentSystem = to.query.customSystem
|
|
118
|
-
}
|
|
119
|
-
// 表示需要设置浏览器页签名
|
|
120
|
-
}
|
|
121
118
|
// 表示刷新了页面(例如点击了一级菜单)后,会重新走该方法
|
|
122
119
|
console.log('router.beforeEach-store.getters.name === ""')
|
|
123
120
|
store
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
})
|
|
131
|
-
} else {
|
|
132
|
-
store
|
|
133
|
-
.dispatch('getCurrentUser')
|
|
134
|
-
.then((user) => {
|
|
135
|
-
return new Promise((resolve, reject) => {
|
|
136
|
-
initUserLanguage().then(() => {
|
|
137
|
-
resolve(user)
|
|
138
|
-
})
|
|
139
|
-
})
|
|
121
|
+
.dispatch('isLoginTimeOut')
|
|
122
|
+
.then((result) => {
|
|
123
|
+
if (result === true) {
|
|
124
|
+
store.dispatch('clearToken').then(() => {
|
|
125
|
+
next({ path: '/', replace: true })
|
|
126
|
+
NProgress.done()
|
|
140
127
|
})
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
128
|
+
} else {
|
|
129
|
+
store
|
|
130
|
+
.dispatch('getCurrentUser')
|
|
131
|
+
.then((user) => {
|
|
132
|
+
return new Promise((resolve, reject) => {
|
|
133
|
+
initUserLanguage().then(()=>{
|
|
134
|
+
resolve(user)
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
}).then((user)=>{
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
cacheAllLanguages().then(()=>{
|
|
140
|
+
resolve(user)
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
}).then((user)=>{
|
|
144
|
+
console.log('router.beforeEach-getCurrentUser')
|
|
145
|
+
const devpRoleCodes = authApi.getSessionCache(runCurrentRoleKey)
|
|
146
|
+
if(!isDevp && devpRoleCodes){
|
|
147
|
+
// 表示是开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码,对应运行平台的岗位编码
|
|
148
|
+
// console.log('开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码时,!isDevp && devpRoleCodes')
|
|
149
|
+
return store.dispatch(
|
|
150
|
+
'getDevPlatformPermissions',
|
|
151
|
+
devpRoleCodes
|
|
152
|
+
)
|
|
153
|
+
} else {
|
|
154
|
+
// 开发平台本身的功能或直接平台功能时
|
|
155
|
+
// console.log('开发平台本身的功能或直接平台功能时')
|
|
156
|
+
return store.dispatch(
|
|
157
|
+
'getCurrentUserPermissions',
|
|
158
|
+
user.loginName
|
|
159
|
+
)
|
|
160
|
+
}
|
|
145
161
|
})
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
.then((user) => {
|
|
149
|
-
console.log('router.beforeEach-getCurrentUser')
|
|
150
|
-
const devpRoleCodes = authApi.getSessionCache(runCurrentRoleKey)
|
|
151
|
-
if (!isDevp && devpRoleCodes) {
|
|
152
|
-
// 表示是开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码,对应运行平台的岗位编码
|
|
153
|
-
// console.log('开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码时,!isDevp && devpRoleCodes')
|
|
154
|
-
return store.dispatch('getDevPlatformPermissions', devpRoleCodes)
|
|
155
|
-
} else {
|
|
156
|
-
// 开发平台本身的功能或直接平台功能时
|
|
157
|
-
// console.log('开发平台本身的功能或直接平台功能时')
|
|
158
|
-
return store.dispatch('getCurrentUserPermissions', user.loginName)
|
|
159
|
-
}
|
|
160
|
-
})
|
|
161
|
-
.then((permissions) => {
|
|
162
|
-
return store.dispatch('generateRoutes', permissions)
|
|
163
|
-
})
|
|
164
|
-
.then(() => {
|
|
165
|
-
if (isNeedMenu) {
|
|
166
|
-
// 需要显示左侧菜单 并 不是开发平台时,开发平台的菜单需要在设计项目时获得
|
|
167
|
-
console.log('iMatrix-router.beforeEach2-getPermissionMenus')
|
|
168
|
-
return store.dispatch('getPermissionMenus', window.$vueApp.config.globalProperties.currentSystem)
|
|
169
|
-
} else {
|
|
170
|
-
return new Promise((resolve, reject) => {
|
|
171
|
-
resolve()
|
|
162
|
+
.then((permissions) => {
|
|
163
|
+
return store.dispatch('generateRoutes', permissions)
|
|
172
164
|
})
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
165
|
+
.then(() => {
|
|
166
|
+
if (isNeedMenu) {
|
|
167
|
+
// 需要显示左侧菜单 并 不是开发平台时,开发平台的菜单需要在设计项目时获得
|
|
168
|
+
console.log('iMatrix-router.beforeEach2-getPermissionMenus')
|
|
169
|
+
return store.dispatch('getPermissionMenus', window.$vueApp.config.globalProperties.currentSystem)
|
|
170
|
+
} else {
|
|
171
|
+
return new Promise((resolve, reject) => {
|
|
172
|
+
resolve()
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
.then(() => {
|
|
177
|
+
// 根据roles权限生成可访问的路由表
|
|
178
|
+
console.log(
|
|
179
|
+
'router.beforeEach-generateRoutes==to=',
|
|
180
|
+
to,
|
|
181
|
+
',from=',
|
|
182
|
+
from
|
|
183
|
+
)
|
|
184
|
+
store.getters.protectedRouters.forEach(item =>{
|
|
185
|
+
router.addRoute(item)
|
|
186
|
+
})
|
|
187
|
+
// 404等错误路由一定要放到受权限保护的路由之后
|
|
188
|
+
// router.addRoutes(errorRouterMap)
|
|
189
|
+
window.sessionStorage.setItem(
|
|
190
|
+
new Date().getTime() + '-name=null-from~~toPath',
|
|
191
|
+
from.path + '~~' + to.path
|
|
192
|
+
)
|
|
193
|
+
next({ ...to, replace: true })
|
|
194
|
+
})
|
|
195
|
+
.catch((err) => {
|
|
196
|
+
store.dispatch('clearToken').then(() => {
|
|
197
|
+
Message.error(
|
|
198
|
+
err || 'Verification failed, please login again'
|
|
199
|
+
)
|
|
200
|
+
next({ path: '/' })
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
.catch((err) => {
|
|
206
|
+
store.dispatch('clearToken').then(() => {
|
|
207
|
+
Message.error(err || 'Verification failed, please login again')
|
|
208
|
+
next({ path: '/' })
|
|
209
|
+
})
|
|
201
210
|
})
|
|
202
|
-
})
|
|
203
211
|
} else {
|
|
204
|
-
console.log(
|
|
212
|
+
console.log(
|
|
213
|
+
'router.beforeEach-store.getters.name ==',
|
|
214
|
+
store.getters.name
|
|
215
|
+
)
|
|
205
216
|
if (isNeedMenu) {
|
|
206
217
|
// 需要显示左侧菜单
|
|
207
218
|
let systemCode = window.$vueApp.config.globalProperties.currentSystem
|
|
@@ -217,7 +228,10 @@ router.beforeEach((to, from, next) => {
|
|
|
217
228
|
}
|
|
218
229
|
}
|
|
219
230
|
} else {
|
|
220
|
-
if (
|
|
231
|
+
if (
|
|
232
|
+
whiteList.indexOf(to.path) !== -1 ||
|
|
233
|
+
store.getters.whiteList.indexOf(to.path) !== -1
|
|
234
|
+
) {
|
|
221
235
|
next()
|
|
222
236
|
} else {
|
|
223
237
|
// 必须使用to.fullPath,fullPath是带有参数的,to.path没有参数,会导致跳转到的页面参数丢失
|
package/src/utils/common-util.js
CHANGED
|
@@ -2,8 +2,7 @@ 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 {
|
|
6
|
-
import i18nUtil from './i18n-util'
|
|
5
|
+
import {getCookieCache} from './auth'
|
|
7
6
|
/**
|
|
8
7
|
* 获得相对地址
|
|
9
8
|
*/
|
|
@@ -312,7 +311,15 @@ export function isMobileBrowser() {
|
|
|
312
311
|
}
|
|
313
312
|
|
|
314
313
|
export function getLocaleByLang(lang) {
|
|
315
|
-
|
|
314
|
+
let locale = 'cn'
|
|
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
|
|
316
323
|
}
|
|
317
324
|
|
|
318
325
|
export function cacheLangs(langs) {
|
|
@@ -431,74 +438,12 @@ export function cacheCurrentLanguageUtil(http) {
|
|
|
431
438
|
const token = getToken()
|
|
432
439
|
if (token) {
|
|
433
440
|
const currentLanguage = getLanguage()
|
|
434
|
-
|
|
435
|
-
|
|
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
|
-
}
|
|
441
|
+
if (currentLanguage && currentLanguage !== 'undefined') {
|
|
442
|
+
resolve(currentLanguage)
|
|
451
443
|
} else {
|
|
452
|
-
|
|
453
|
-
const enableI18n = i18nUtil.getEnableI18nState(systemCode)
|
|
454
|
-
if (enableI18n === false && currentLanguage && currentLanguage !== 'undefined') {
|
|
455
|
-
// 如果没有开启国际化, 并且已经缓存了当前用户的语言,则直接返回
|
|
444
|
+
http.get(window.$vueApp.config.globalProperties.baseAPI + '/acs/user-languages').then((currentLanguage) => {
|
|
456
445
|
resolve(currentLanguage)
|
|
457
|
-
}
|
|
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
|
-
}
|
|
465
|
-
http
|
|
466
|
-
.post(window.$vueApp.config.globalProperties.baseAPI + '/acs/user/i18n-languages', params)
|
|
467
|
-
.then((langInfo) => {
|
|
468
|
-
if (langInfo.isLastestI18nFile) {
|
|
469
|
-
// 表示是最新的国际化文件,可以直接加载使用
|
|
470
|
-
i18nUtil
|
|
471
|
-
.loadLangFile(systemCode, url, currentLanguage)
|
|
472
|
-
.then(() => {
|
|
473
|
-
resolve(currentLanguage)
|
|
474
|
-
})
|
|
475
|
-
.catch(() => {
|
|
476
|
-
resolve(currentLanguage)
|
|
477
|
-
})
|
|
478
|
-
} else {
|
|
479
|
-
// 不是最新的国际化文件或者没有加载过国际化文件,则后端会返回最新的国际化文件路径和用户当前语言
|
|
480
|
-
i18nUtil.setEnableI18nState(systemCode, langInfo.enableI18n ? true : false)
|
|
481
|
-
if (langInfo.enableI18n && langInfo.i18nFileUrls[langInfo.language]) {
|
|
482
|
-
const url = langInfo.i18nFileUrls[langInfo.language] + '?_t_=' + new Date().getTime()
|
|
483
|
-
i18nUtil.setLangFileUrl(systemCode, langInfo.language, url)
|
|
484
|
-
i18nUtil
|
|
485
|
-
.loadLangFile(systemCode, url, langInfo.language)
|
|
486
|
-
.then(() => {
|
|
487
|
-
resolve(langInfo.language)
|
|
488
|
-
})
|
|
489
|
-
.catch(() => {
|
|
490
|
-
resolve(langInfo.language ? langInfo.language : 'zh_CN')
|
|
491
|
-
})
|
|
492
|
-
} else {
|
|
493
|
-
// 如果没有开启国际化
|
|
494
|
-
resolve(langInfo.language)
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
})
|
|
498
|
-
.catch(() => {
|
|
499
|
-
resolve('zh_CN')
|
|
500
|
-
})
|
|
501
|
-
}
|
|
446
|
+
})
|
|
502
447
|
}
|
|
503
448
|
} else {
|
|
504
449
|
// 默认是中文
|
|
@@ -573,7 +518,8 @@ export function replacePlaceholders(template, ...args) {
|
|
|
573
518
|
})
|
|
574
519
|
}
|
|
575
520
|
|
|
576
|
-
|
|
521
|
+
|
|
522
|
+
function isOpenMobileGateway () {
|
|
577
523
|
// 系统参数设置中配置的是否开启移动网关,没有配置默认是开启的
|
|
578
524
|
let isOpenMobileGatewayCache = getCookieCache('IS_OPEN_MOBILE_GATEWAY')
|
|
579
525
|
if (isOpenMobileGatewayCache === undefined || isOpenMobileGatewayCache === null) {
|
|
@@ -586,15 +532,15 @@ function isOpenMobileGateway() {
|
|
|
586
532
|
* @param {*} url
|
|
587
533
|
* @returns
|
|
588
534
|
*/
|
|
589
|
-
export function getReplaceUrlDomain(url) {
|
|
535
|
+
export function getReplaceUrlDomain (url) {
|
|
590
536
|
const isOpenMobileGatewayCache = isOpenMobileGateway()
|
|
591
537
|
console.log('===getReplaceUrlDomain==isOpenMobileGatewayCache=', isOpenMobileGatewayCache)
|
|
592
|
-
if (isOpenMobileGatewayCache === 'true' && url !== undefined &&
|
|
538
|
+
if (isOpenMobileGatewayCache === 'true' && url !== undefined && window.$vueApp.config.globalProperties.replaceUrl) {
|
|
593
539
|
// 表示需要替换url中的"https://域名"
|
|
594
|
-
const baseApi =
|
|
595
|
-
if ((url + '').indexOf(
|
|
540
|
+
const baseApi = uswindow.$vueApp.config.globalProperties.baseAPI
|
|
541
|
+
if ((url + '').indexOf(uswindow.$vueApp.config.globalProperties.replaceUrl + '/') < 0 && (url + '').indexOf('://') > 0) {
|
|
596
542
|
// 表示路径还未替换
|
|
597
|
-
console.log('===getReplaceUrlDomain==url.indexOf(
|
|
543
|
+
console.log('===getReplaceUrlDomain==url.indexOf(uswindow.$vueApp.config.globalProperties.replaceUrl) !== 0')
|
|
598
544
|
const prefixUrl1 = baseApi.substring(0, baseApi.indexOf('://'))
|
|
599
545
|
const urlSuffix1 = baseApi.substring(baseApi.indexOf('://') + 3)
|
|
600
546
|
const domainUrl1 = urlSuffix1.substring(0, urlSuffix1.indexOf('/'))
|
|
@@ -605,7 +551,7 @@ export function getReplaceUrlDomain(url) {
|
|
|
605
551
|
const prefixUrl = prefixUrl2 + '://' + domainUrl2
|
|
606
552
|
if (prefixUrl === prefixUrlBase) {
|
|
607
553
|
urlSuffix = urlSuffix.substring(urlSuffix.indexOf('/'))
|
|
608
|
-
url =
|
|
554
|
+
url = uswindow.$vueApp.config.globalProperties.replaceUrl + urlSuffix
|
|
609
555
|
console.log('===getReplaceUrlDomain==url=', url)
|
|
610
556
|
}
|
|
611
557
|
} else {
|
|
@@ -615,17 +561,9 @@ export function getReplaceUrlDomain(url) {
|
|
|
615
561
|
return url
|
|
616
562
|
}
|
|
617
563
|
|
|
618
|
-
export function formatFileName(fileName) {
|
|
564
|
+
export function formatFileName (fileName) {
|
|
619
565
|
if (fileName) {
|
|
620
566
|
fileName = fileName.replace('#', '~~').replace('?', '~$').replace('&', '$')
|
|
621
567
|
}
|
|
622
568
|
return fileName
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
export function getCurrentSystemCode() {
|
|
626
|
-
if (window.$vueApp.config.globalProperties.currentSystem) {
|
|
627
|
-
return window.$vueApp.config.globalProperties.currentSystem
|
|
628
|
-
} else {
|
|
629
|
-
return window.$vueApp.config.globalProperties.systemCode
|
|
630
|
-
}
|
|
631
|
-
}
|
|
569
|
+
}
|