wui-components-v2 1.1.69 → 1.1.71
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/api/core/index.ts +74 -74
- package/api/feishu.ts +20 -20
- package/api/index.ts +4 -4
- package/api/login.ts +51 -51
- package/api/menu.ts +45 -45
- package/api/page.ts +114 -114
- package/api/sys.ts +12 -12
- package/api/tree.ts +28 -28
- package/components/action-popup/action-popup.vue +116 -116
- package/components/add-address-list/add-address-list.vue +187 -187
- package/components/add-address-page/add-address-page.vue +77 -77
- package/components/add-address-page/config.ts +297 -297
- package/components/audio-play/audio-play.vue +220 -220
- package/components/batch-upload-file/batch-upload-file.vue +75 -75
- package/components/card-botom-buttons/card-botom-buttons.vue +279 -279
- package/components/custom-date-picker/custom-date-picker.vue +106 -106
- package/components/custom-select-picker/custom-select-picker.vue +95 -95
- package/components/demo-block/demo-block.vue +63 -63
- package/components/demo-card/demo-card.vue +44 -44
- package/components/detail-popup/detail-popup.vue +99 -99
- package/components/evaluation-page/evaluation-page.vue +196 -196
- package/components/fold-card/fold-card.vue +171 -171
- package/components/form-control/form-control.vue +661 -661
- package/components/global-loading/GlobalLoading.md +366 -366
- package/components/global-loading/global-loading.vue +55 -55
- package/components/global-message/GlobalMessage.md +570 -570
- package/components/global-message/global-message.vue +68 -68
- package/components/global-toast/GlobalToast.md +261 -261
- package/components/global-toast/global-toast.vue +56 -56
- package/components/label-value/label-value.vue +144 -144
- package/components/label-value/open-value-more.vue +56 -56
- package/components/list-top-buttons/list-top-buttons.vue +19 -19
- package/components/loading/loading.vue +5 -5
- package/components/login-form/login-form.vue +126 -126
- package/components/login-form-box/login-form-box.vue +65 -65
- package/components/mulselect-picker/mulselect-picker.vue +86 -86
- package/components/phone-login-form/phone-login-form.vue +204 -204
- package/components/privacy-popup/privacy-popup.vue +191 -191
- package/components/product-card/product-card.vue +201 -201
- package/components/scan-input/scan-input.vue +406 -406
- package/components/search/search.vue +128 -128
- package/components/select-col-picker/select-col-picker.vue +168 -168
- package/components/tab-search/tab-search.vue +73 -73
- package/components/tree-select/components/TreeNode.vue +200 -200
- package/components/tree-select/components/index.vue +471 -471
- package/components/tree-select/components/tree-select.vue +56 -56
- package/components/tree-select/index.vue +93 -93
- package/components/user-choose/user-choose.vue +169 -151
- package/components/video-play/video-play.vue +56 -56
- package/components/wui-auto-update-component/wui-auto-update-component.vue +132 -132
- package/components/wui-default/wui-default.vue +49 -49
- package/components/wui-details-page/wui-details-page.vue +147 -147
- package/components/wui-edit-page/wui-edit-page-copy.vue +757 -757
- package/components/wui-edit-page/wui-edit-page.vue +793 -793
- package/components/wui-enume-select-control/wui-enume-select-control.vue +92 -92
- package/components/wui-list/wui-list.vue +235 -235
- package/components/wui-login/wui-login.vue +43 -43
- package/components/wui-login1/wui-login.vue +41 -41
- package/components/wui-menus/wui-menus-top.vue +137 -137
- package/components/wui-menus/wui-menus-top1.vue +8 -8
- package/components/wui-menus/wui-menus.vue +247 -247
- package/components/wui-menus1/components/banner-carousel.vue +320 -320
- package/components/wui-menus1/components/navbar.vue +43 -43
- package/components/wui-menus1/components/quick-panel.vue +55 -55
- package/components/wui-menus1/components/search-bar.vue +49 -49
- package/components/wui-menus1/components/section-menus.vue +208 -208
- package/components/wui-menus1/wui-menus-top.vue +718 -718
- package/components/wui-menus1/wui-menus-top1.vue +398 -398
- package/components/wui-menus1/wui-menus.vue +564 -564
- package/components/wui-notify-info/notify-handle.vue +53 -53
- package/components/wui-notify-info/wui-notify-info.vue +280 -280
- package/components/wui-scan-binding-sensor/wui-scan-binding-sensor.vue +75 -75
- package/components/wui-search-history-babbar/components/SearchBar.vue +70 -70
- package/components/wui-search-history-babbar/wui-search-history-babbar.vue +204 -204
- package/components/wui-select-list/wui-select-list.vue +310 -310
- package/components/wui-select-popup/wui-select-popup.vue +613 -612
- package/components/wui-system-settings/wui-system-settings.vue +144 -144
- package/components/wui-tabbar/wui-tabbar.vue +106 -106
- package/components/wui-tree-page/components/tree-item.vue +238 -238
- package/components/wui-tree-page/wui-tree-page.vue +297 -297
- package/components/wui-update-component/wui-update-component.vue +221 -221
- package/components/wui-user/wui-user.vue +202 -202
- package/composables/types/theme.ts +65 -65
- package/composables/types/user.ts +5 -5
- package/composables/useColorGenerator.ts +221 -221
- package/composables/useCompanyFieldFilter.ts +91 -91
- package/composables/useEnumes.ts +43 -43
- package/composables/useEventBus.ts +37 -37
- package/composables/useGlobalLoading.ts +47 -47
- package/composables/useGlobalMessage.ts +53 -53
- package/composables/useGlobalToast.ts +63 -63
- package/composables/useLocale.ts +54 -54
- package/composables/useManualTheme.ts +179 -179
- package/composables/useMenus.ts +193 -193
- package/composables/useSectionMenus.ts +120 -120
- package/composables/useTabbar.ts +50 -50
- package/composables/useTheme.ts +74 -74
- package/composables/useUser.ts +24 -24
- package/index.d.ts +90 -90
- package/index.ts +83 -83
- package/package.json +24 -24
- package/static/iconfont/iconfont.css +63 -63
- package/store/language.ts +151 -151
- package/store/manualThemeStore.ts +143 -143
- package/store/persist.ts +41 -41
- package/store/themeStore.ts +74 -74
- package/store/userStore.ts +22 -22
- package/styles/dark-mode.css +523 -523
- package/styles/dark-mode.min.css +1 -1
- package/styles/dark-mode.scss +498 -498
- package/type.ts +154 -154
- package/utils/control-tree.ts +353 -353
- package/utils/control-type-supportor.ts +148 -148
- package/utils/eventBus.ts +36 -36
- package/utils/idata-scan.ts +99 -99
- package/utils/index.ts +979 -979
- package/utils/rsaEncrypt.ts +10 -10
package/api/core/index.ts
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 封装uni.request为Promise形式
|
|
3
|
-
* @param {object} options 请求配置
|
|
4
|
-
* @param {string} options.url 请求地址
|
|
5
|
-
* @param {string} [options.method] 请求方法
|
|
6
|
-
* @param {object} [options.data] 请求数据
|
|
7
|
-
* @param {object} [options.header] 请求头
|
|
8
|
-
* @param {number} [options.timeout] 超时时间(毫秒)
|
|
9
|
-
* @returns {Promise} 返回Promise对象
|
|
10
|
-
*/
|
|
11
|
-
interface RequestOptions {
|
|
12
|
-
url: string
|
|
13
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'CONNECT'
|
|
14
|
-
data?: any
|
|
15
|
-
header?: any
|
|
16
|
-
timeout?: number
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function request(options: RequestOptions): Promise<any> {
|
|
20
|
-
const baseUrl = uni.getStorageSync('BASE_URL') || '/'
|
|
21
|
-
const hydrocarbonProgramToken = uni.getStorageSync('HYDROCARBON_PROGRAM_TOKEN') || ''
|
|
22
|
-
const token = uni.getStorageSync('TOKEN') || uni.getStorageSync('token') || ''
|
|
23
|
-
const hydrocarbonClient = uni.getStorageSync('HYDROCARBON_CLIENT') || ''
|
|
24
|
-
const applicationToken = uni.getStorageSync('HYDROCARBON_APPLICATION_TOKEN') || ''
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
// 设置默认值
|
|
27
|
-
const defaultOptions = {
|
|
28
|
-
method: 'GET' as const,
|
|
29
|
-
data: {},
|
|
30
|
-
header: {
|
|
31
|
-
'content-type': 'application/x-www-form-urlencoded',
|
|
32
|
-
'hydrocarbon-program-token': hydrocarbonProgramToken, // 项目code
|
|
33
|
-
'hydrocarbon-token': token, // 登录token
|
|
34
|
-
'hydrocarbon-client': hydrocarbonClient, // 端类型
|
|
35
|
-
'hydrocarbon-application-token': applicationToken,
|
|
36
|
-
// #ifdef APP-PLUS
|
|
37
|
-
'hydrocarbon-app-version': '1.0.0',
|
|
38
|
-
// #endif
|
|
39
|
-
...options.header,
|
|
40
|
-
},
|
|
41
|
-
timeout: options.timeout || 60000,
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 合并配置
|
|
45
|
-
const requestOptions = {
|
|
46
|
-
...defaultOptions,
|
|
47
|
-
...options,
|
|
48
|
-
url: baseUrl + options.url,
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
uni.request({
|
|
52
|
-
...requestOptions,
|
|
53
|
-
success: (res: any) => {
|
|
54
|
-
// 可以根据实际业务需求调整这里的判断条件
|
|
55
|
-
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
56
|
-
if (res.data.status === 'error') {
|
|
57
|
-
uni.showToast({ title: res.data.message, icon: 'none' })
|
|
58
|
-
uni.removeStorageSync('token')
|
|
59
|
-
reject(res)
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
resolve(res.data)
|
|
63
|
-
} else {
|
|
64
|
-
reject(res)
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
fail: (err: any) => {
|
|
68
|
-
reject(err)
|
|
69
|
-
},
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export default request
|
|
1
|
+
/**
|
|
2
|
+
* 封装uni.request为Promise形式
|
|
3
|
+
* @param {object} options 请求配置
|
|
4
|
+
* @param {string} options.url 请求地址
|
|
5
|
+
* @param {string} [options.method] 请求方法
|
|
6
|
+
* @param {object} [options.data] 请求数据
|
|
7
|
+
* @param {object} [options.header] 请求头
|
|
8
|
+
* @param {number} [options.timeout] 超时时间(毫秒)
|
|
9
|
+
* @returns {Promise} 返回Promise对象
|
|
10
|
+
*/
|
|
11
|
+
interface RequestOptions {
|
|
12
|
+
url: string
|
|
13
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'CONNECT'
|
|
14
|
+
data?: any
|
|
15
|
+
header?: any
|
|
16
|
+
timeout?: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function request(options: RequestOptions): Promise<any> {
|
|
20
|
+
const baseUrl = uni.getStorageSync('BASE_URL') || '/'
|
|
21
|
+
const hydrocarbonProgramToken = uni.getStorageSync('HYDROCARBON_PROGRAM_TOKEN') || ''
|
|
22
|
+
const token = uni.getStorageSync('TOKEN') || uni.getStorageSync('token') || ''
|
|
23
|
+
const hydrocarbonClient = uni.getStorageSync('HYDROCARBON_CLIENT') || ''
|
|
24
|
+
const applicationToken = uni.getStorageSync('HYDROCARBON_APPLICATION_TOKEN') || ''
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
// 设置默认值
|
|
27
|
+
const defaultOptions = {
|
|
28
|
+
method: 'GET' as const,
|
|
29
|
+
data: {},
|
|
30
|
+
header: {
|
|
31
|
+
'content-type': 'application/x-www-form-urlencoded',
|
|
32
|
+
'hydrocarbon-program-token': hydrocarbonProgramToken, // 项目code
|
|
33
|
+
'hydrocarbon-token': token, // 登录token
|
|
34
|
+
'hydrocarbon-client': hydrocarbonClient, // 端类型
|
|
35
|
+
'hydrocarbon-application-token': applicationToken,
|
|
36
|
+
// #ifdef APP-PLUS
|
|
37
|
+
'hydrocarbon-app-version': '1.0.0',
|
|
38
|
+
// #endif
|
|
39
|
+
...options.header,
|
|
40
|
+
},
|
|
41
|
+
timeout: options.timeout || 60000,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 合并配置
|
|
45
|
+
const requestOptions = {
|
|
46
|
+
...defaultOptions,
|
|
47
|
+
...options,
|
|
48
|
+
url: baseUrl + options.url,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
uni.request({
|
|
52
|
+
...requestOptions,
|
|
53
|
+
success: (res: any) => {
|
|
54
|
+
// 可以根据实际业务需求调整这里的判断条件
|
|
55
|
+
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
56
|
+
if (res.data.status === 'error') {
|
|
57
|
+
uni.showToast({ title: res.data.message, icon: 'none' })
|
|
58
|
+
uni.removeStorageSync('token')
|
|
59
|
+
reject(res)
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
resolve(res.data)
|
|
63
|
+
} else {
|
|
64
|
+
reject(res)
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
fail: (err: any) => {
|
|
68
|
+
reject(err)
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default request
|
package/api/feishu.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import req from './core/index'
|
|
2
|
-
|
|
3
|
-
export type FeishuHcTokenResponse = {
|
|
4
|
-
token?: string
|
|
5
|
-
message?: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function feishuHcToken(code: string): Promise<FeishuHcTokenResponse> {
|
|
9
|
-
// 将前端拿到的免登 code 交给业务后端:
|
|
10
|
-
// 1) 后端用 app_id/app_secret 调用飞书接口把 code 换成 user_access_token + user_id/open_id
|
|
11
|
-
// 2) 后端用 user_id/open_id 在你系统内创建/更新用户,并签发你系统自己的 TOKEN(本项目存到 TOKEN)
|
|
12
|
-
return req({
|
|
13
|
-
url: '/v3/auth/feishu/hctoken',
|
|
14
|
-
method: 'POST',
|
|
15
|
-
data: {
|
|
16
|
-
code,
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
|
|
1
|
+
import req from './core/index'
|
|
2
|
+
|
|
3
|
+
export type FeishuHcTokenResponse = {
|
|
4
|
+
token?: string
|
|
5
|
+
message?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function feishuHcToken(code: string): Promise<FeishuHcTokenResponse> {
|
|
9
|
+
// 将前端拿到的免登 code 交给业务后端:
|
|
10
|
+
// 1) 后端用 app_id/app_secret 调用飞书接口把 code 换成 user_access_token + user_id/open_id
|
|
11
|
+
// 2) 后端用 user_id/open_id 在你系统内创建/更新用户,并签发你系统自己的 TOKEN(本项目存到 TOKEN)
|
|
12
|
+
return req({
|
|
13
|
+
url: '/v3/auth/feishu/hctoken',
|
|
14
|
+
method: 'POST',
|
|
15
|
+
data: {
|
|
16
|
+
code,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
package/api/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// 导入请求核心实例
|
|
2
|
-
import req from './core/index'
|
|
3
|
-
|
|
4
|
-
export { req }
|
|
1
|
+
// 导入请求核心实例
|
|
2
|
+
import req from './core/index'
|
|
3
|
+
|
|
4
|
+
export { req }
|
package/api/login.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
// 导入核心alova实例
|
|
2
|
-
import dayjs from 'dayjs/esm/index'
|
|
3
|
-
import timezone from 'dayjs/esm/plugin/timezone'
|
|
4
|
-
import utc from 'dayjs/esm/plugin/utc'
|
|
5
|
-
import rsaEncrypt from '../utils/rsaEncrypt'
|
|
6
|
-
import req from './core/index'
|
|
7
|
-
// 获取公钥
|
|
8
|
-
export function pubKey(): Promise<any> {
|
|
9
|
-
return req({
|
|
10
|
-
url: `/v3/auth/ras-pubkey`,
|
|
11
|
-
})
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// 登录
|
|
15
|
-
export async function login(username: string, password: string, kaptchaToken: string = '', kaptchaText: string = ''): Promise<any> {
|
|
16
|
-
dayjs.extend(utc)
|
|
17
|
-
dayjs.extend(timezone)
|
|
18
|
-
const datetime = dayjs(new Date())
|
|
19
|
-
.tz('Europe/London')
|
|
20
|
-
.format('YYYY-MM-DD HH:mm:ss')
|
|
21
|
-
const json = {
|
|
22
|
-
username,
|
|
23
|
-
password,
|
|
24
|
-
datetime,
|
|
25
|
-
}
|
|
26
|
-
const res = await pubKey()
|
|
27
|
-
const pubkeystr = res.rasPubkey
|
|
28
|
-
const userInfo = rsaEncrypt(JSON.stringify(json), pubkeystr)
|
|
29
|
-
return req({
|
|
30
|
-
url: `/v3/auth/hctoken`,
|
|
31
|
-
data: {
|
|
32
|
-
userInfo,
|
|
33
|
-
kaptchaToken,
|
|
34
|
-
kaptchaText,
|
|
35
|
-
},
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
// 获取验证码
|
|
39
|
-
export function getKaptchaToken(): Promise<any> {
|
|
40
|
-
return req({
|
|
41
|
-
url: `/v3/auth/kaptcha`,
|
|
42
|
-
method: 'POST',
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// 获取登录用户权限配置信息
|
|
47
|
-
export function getUserConfig(): Promise<any> {
|
|
48
|
-
return req({
|
|
49
|
-
url: `/v3/current-user`,
|
|
50
|
-
})
|
|
51
|
-
}
|
|
1
|
+
// 导入核心alova实例
|
|
2
|
+
import dayjs from 'dayjs/esm/index'
|
|
3
|
+
import timezone from 'dayjs/esm/plugin/timezone'
|
|
4
|
+
import utc from 'dayjs/esm/plugin/utc'
|
|
5
|
+
import rsaEncrypt from '../utils/rsaEncrypt'
|
|
6
|
+
import req from './core/index'
|
|
7
|
+
// 获取公钥
|
|
8
|
+
export function pubKey(): Promise<any> {
|
|
9
|
+
return req({
|
|
10
|
+
url: `/v3/auth/ras-pubkey`,
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 登录
|
|
15
|
+
export async function login(username: string, password: string, kaptchaToken: string = '', kaptchaText: string = ''): Promise<any> {
|
|
16
|
+
dayjs.extend(utc)
|
|
17
|
+
dayjs.extend(timezone)
|
|
18
|
+
const datetime = dayjs(new Date())
|
|
19
|
+
.tz('Europe/London')
|
|
20
|
+
.format('YYYY-MM-DD HH:mm:ss')
|
|
21
|
+
const json = {
|
|
22
|
+
username,
|
|
23
|
+
password,
|
|
24
|
+
datetime,
|
|
25
|
+
}
|
|
26
|
+
const res = await pubKey()
|
|
27
|
+
const pubkeystr = res.rasPubkey
|
|
28
|
+
const userInfo = rsaEncrypt(JSON.stringify(json), pubkeystr)
|
|
29
|
+
return req({
|
|
30
|
+
url: `/v3/auth/hctoken`,
|
|
31
|
+
data: {
|
|
32
|
+
userInfo,
|
|
33
|
+
kaptchaToken,
|
|
34
|
+
kaptchaText,
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
// 获取验证码
|
|
39
|
+
export function getKaptchaToken(): Promise<any> {
|
|
40
|
+
return req({
|
|
41
|
+
url: `/v3/auth/kaptcha`,
|
|
42
|
+
method: 'POST',
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 获取登录用户权限配置信息
|
|
47
|
+
export function getUserConfig(): Promise<any> {
|
|
48
|
+
return req({
|
|
49
|
+
url: `/v3/current-user`,
|
|
50
|
+
})
|
|
51
|
+
}
|
package/api/menu.ts
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import req from './core/index'
|
|
2
|
-
// 获取菜单
|
|
3
|
-
export function menu() {
|
|
4
|
-
return req({
|
|
5
|
-
url: `/v3/menu/blocks?l2MenuId=&blockId=`,
|
|
6
|
-
})
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// fastmenu 请求缓存
|
|
10
|
-
let fastmenuPromise: Promise<any> | null = null
|
|
11
|
-
let fastmenuCacheTime = 0
|
|
12
|
-
const CACHE_DURATION = 3000 // 缓存有效期 5 秒
|
|
13
|
-
|
|
14
|
-
// 获取配置菜单(带请求防抖和缓存)
|
|
15
|
-
export function fastmenu() {
|
|
16
|
-
const now = Date.now()
|
|
17
|
-
|
|
18
|
-
// 如果请求正在进行中,返回同一个 Promise
|
|
19
|
-
if (fastmenuPromise) {
|
|
20
|
-
return fastmenuPromise
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// 如果缓存还在有效期内,重新发起请求但仍然共享 Promise
|
|
24
|
-
// (如果需要真正的缓存数据,可以在这里添加数据缓存逻辑)
|
|
25
|
-
|
|
26
|
-
fastmenuPromise = req({
|
|
27
|
-
url: `/v3/menu/fast-menu`,
|
|
28
|
-
}).finally(() => {
|
|
29
|
-
// 请求完成后,清除 Promise 引用(保持缓存时间窗口)
|
|
30
|
-
setTimeout(() => {
|
|
31
|
-
fastmenuPromise = null
|
|
32
|
-
fastmenuCacheTime = 0
|
|
33
|
-
}, CACHE_DURATION)
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
fastmenuCacheTime = now
|
|
37
|
-
return fastmenuPromise
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// 菜单内容统计
|
|
41
|
-
export function menuCount(sourceId: string) {
|
|
42
|
-
return req({
|
|
43
|
-
url: `/v3/ltmpl/data/count?sourceId=${sourceId}`,
|
|
44
|
-
})
|
|
45
|
-
}
|
|
1
|
+
import req from './core/index'
|
|
2
|
+
// 获取菜单
|
|
3
|
+
export function menu() {
|
|
4
|
+
return req({
|
|
5
|
+
url: `/v3/menu/blocks?l2MenuId=&blockId=`,
|
|
6
|
+
})
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// fastmenu 请求缓存
|
|
10
|
+
let fastmenuPromise: Promise<any> | null = null
|
|
11
|
+
let fastmenuCacheTime = 0
|
|
12
|
+
const CACHE_DURATION = 3000 // 缓存有效期 5 秒
|
|
13
|
+
|
|
14
|
+
// 获取配置菜单(带请求防抖和缓存)
|
|
15
|
+
export function fastmenu() {
|
|
16
|
+
const now = Date.now()
|
|
17
|
+
|
|
18
|
+
// 如果请求正在进行中,返回同一个 Promise
|
|
19
|
+
if (fastmenuPromise) {
|
|
20
|
+
return fastmenuPromise
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 如果缓存还在有效期内,重新发起请求但仍然共享 Promise
|
|
24
|
+
// (如果需要真正的缓存数据,可以在这里添加数据缓存逻辑)
|
|
25
|
+
|
|
26
|
+
fastmenuPromise = req({
|
|
27
|
+
url: `/v3/menu/fast-menu`,
|
|
28
|
+
}).finally(() => {
|
|
29
|
+
// 请求完成后,清除 Promise 引用(保持缓存时间窗口)
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
fastmenuPromise = null
|
|
32
|
+
fastmenuCacheTime = 0
|
|
33
|
+
}, CACHE_DURATION)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
fastmenuCacheTime = now
|
|
37
|
+
return fastmenuPromise
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 菜单内容统计
|
|
41
|
+
export function menuCount(sourceId: string) {
|
|
42
|
+
return req({
|
|
43
|
+
url: `/v3/ltmpl/data/count?sourceId=${sourceId}`,
|
|
44
|
+
})
|
|
45
|
+
}
|
package/api/page.ts
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import type { PageData } from '../type'
|
|
2
|
-
import req from './core/index'
|
|
3
|
-
|
|
4
|
-
interface PageConfig {
|
|
5
|
-
configName: string
|
|
6
|
-
ltmplConfig: any
|
|
7
|
-
sourceId: string
|
|
8
|
-
sourceName: string
|
|
9
|
-
}
|
|
10
|
-
// 列表页面配置
|
|
11
|
-
export async function pageConfig(sourceId: string): Promise<PageConfig> {
|
|
12
|
-
const res = await req({url: `/v3/ltmpl/config?sourceId=${sourceId}`})||{}
|
|
13
|
-
const {ltmplConfig={}}=res
|
|
14
|
-
const {extDisplayConfig={}}=ltmplConfig
|
|
15
|
-
return { //配置结构调整
|
|
16
|
-
...res,
|
|
17
|
-
ltmplConfig:{
|
|
18
|
-
...ltmplConfig,
|
|
19
|
-
...extDisplayConfig
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// 获取列表页面数据key
|
|
25
|
-
export function pageKey(sourceId: string, mainCode: string = '', query: string = '') {
|
|
26
|
-
return req({
|
|
27
|
-
url: `/v3/ltmpl/query/key?sourceId=${sourceId}&mainCode=${mainCode}&menuId=${sourceId}&${query}`,
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// 获取列表页面数据
|
|
32
|
-
export function listData(queryKey: string, pageNo: number, pageSize: number): Promise<PageData> {
|
|
33
|
-
return req({
|
|
34
|
-
url: `/v3/ltmpl/query/data?queryKey=${queryKey}&pageNo=${pageNo}&pageSize=${pageSize}`,
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 获取新增面配置
|
|
39
|
-
export function addPageConfig(sourceId: string) {
|
|
40
|
-
return req({
|
|
41
|
-
url: `/v3/add-dtmpl/config?sourceId=${sourceId}`,
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
// 获取编辑页面配置
|
|
45
|
-
export function editPageConfig(sourceId: string, mianCode: string) {
|
|
46
|
-
return req({
|
|
47
|
-
url: `/v3/dtmpl/config?sourceId=${sourceId}&code=${mianCode}`,
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
//
|
|
52
|
-
// 新增/编辑页面提交保存
|
|
53
|
-
export function editPageDataSave(sourceId: string, id: string = '', data: any, mainCode: string = '', actionId: string = '') {
|
|
54
|
-
return req({
|
|
55
|
-
url: `/v3/dtmpl/data`,
|
|
56
|
-
method: 'POST',
|
|
57
|
-
data: {
|
|
58
|
-
sourceId,
|
|
59
|
-
mainCode,
|
|
60
|
-
actionId,
|
|
61
|
-
唯一编码: id,
|
|
62
|
-
...data,
|
|
63
|
-
},
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
// 获取枚举
|
|
67
|
-
export function enums(mstrucIds: string) {
|
|
68
|
-
return req({
|
|
69
|
-
url: `/v3/enum`,
|
|
70
|
-
method: 'POST',
|
|
71
|
-
data: mstrucIds,
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
// 获取勾选数据
|
|
75
|
-
export function selectDatas(sourceId: string, codes: string) {
|
|
76
|
-
return req({
|
|
77
|
-
url: `/v3/field-group/data/selected?sourceId=${sourceId}&${codes}`,
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// 详情页面详细配置
|
|
82
|
-
export function detailPageConfig(sourceId: string) {
|
|
83
|
-
return req({
|
|
84
|
-
url: `/v3/view-dtmpl/config?sourceId=${sourceId}`,
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// 详情页面数据
|
|
89
|
-
export function detailPageData(sourceId: string, code: string) {
|
|
90
|
-
return req({
|
|
91
|
-
url: `/v3/view-dtmpl/data?sourceId=${sourceId}&code=${code}`,
|
|
92
|
-
})
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// action 按钮提交数据
|
|
96
|
-
export function actionDataSave(sourceId: string, codes: string = '', data: any) {
|
|
97
|
-
return req({
|
|
98
|
-
url: `/v3/action`,
|
|
99
|
-
method: 'POST',
|
|
100
|
-
data: {
|
|
101
|
-
sourceId,
|
|
102
|
-
codes,
|
|
103
|
-
...data,
|
|
104
|
-
},
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// 删除
|
|
109
|
-
export function deleteData(sourceId: string, code: string) {
|
|
110
|
-
return req({
|
|
111
|
-
url: `/v3/ltmpl/data?sourceId=${sourceId}&codes=${code}`,
|
|
112
|
-
method: 'DELETE',
|
|
113
|
-
})
|
|
114
|
-
}
|
|
1
|
+
import type { PageData } from '../type'
|
|
2
|
+
import req from './core/index'
|
|
3
|
+
|
|
4
|
+
interface PageConfig {
|
|
5
|
+
configName: string
|
|
6
|
+
ltmplConfig: any
|
|
7
|
+
sourceId: string
|
|
8
|
+
sourceName: string
|
|
9
|
+
}
|
|
10
|
+
// 列表页面配置
|
|
11
|
+
export async function pageConfig(sourceId: string): Promise<PageConfig> {
|
|
12
|
+
const res = await req({url: `/v3/ltmpl/config?sourceId=${sourceId}`})||{}
|
|
13
|
+
const {ltmplConfig={}}=res
|
|
14
|
+
const {extDisplayConfig={}}=ltmplConfig
|
|
15
|
+
return { //配置结构调整
|
|
16
|
+
...res,
|
|
17
|
+
ltmplConfig:{
|
|
18
|
+
...ltmplConfig,
|
|
19
|
+
...extDisplayConfig
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 获取列表页面数据key
|
|
25
|
+
export function pageKey(sourceId: string, mainCode: string = '', query: string = '') {
|
|
26
|
+
return req({
|
|
27
|
+
url: `/v3/ltmpl/query/key?sourceId=${sourceId}&mainCode=${mainCode}&menuId=${sourceId}&${query}`,
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// 获取列表页面数据
|
|
32
|
+
export function listData(queryKey: string, pageNo: number, pageSize: number): Promise<PageData> {
|
|
33
|
+
return req({
|
|
34
|
+
url: `/v3/ltmpl/query/data?queryKey=${queryKey}&pageNo=${pageNo}&pageSize=${pageSize}`,
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 获取新增面配置
|
|
39
|
+
export function addPageConfig(sourceId: string) {
|
|
40
|
+
return req({
|
|
41
|
+
url: `/v3/add-dtmpl/config?sourceId=${sourceId}`,
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
// 获取编辑页面配置
|
|
45
|
+
export function editPageConfig(sourceId: string, mianCode: string) {
|
|
46
|
+
return req({
|
|
47
|
+
url: `/v3/dtmpl/config?sourceId=${sourceId}&code=${mianCode}`,
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//
|
|
52
|
+
// 新增/编辑页面提交保存
|
|
53
|
+
export function editPageDataSave(sourceId: string, id: string = '', data: any, mainCode: string = '', actionId: string = '') {
|
|
54
|
+
return req({
|
|
55
|
+
url: `/v3/dtmpl/data`,
|
|
56
|
+
method: 'POST',
|
|
57
|
+
data: {
|
|
58
|
+
sourceId,
|
|
59
|
+
mainCode,
|
|
60
|
+
actionId,
|
|
61
|
+
唯一编码: id,
|
|
62
|
+
...data,
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
// 获取枚举
|
|
67
|
+
export function enums(mstrucIds: string) {
|
|
68
|
+
return req({
|
|
69
|
+
url: `/v3/enum`,
|
|
70
|
+
method: 'POST',
|
|
71
|
+
data: mstrucIds,
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
// 获取勾选数据
|
|
75
|
+
export function selectDatas(sourceId: string, codes: string) {
|
|
76
|
+
return req({
|
|
77
|
+
url: `/v3/field-group/data/selected?sourceId=${sourceId}&${codes}`,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 详情页面详细配置
|
|
82
|
+
export function detailPageConfig(sourceId: string) {
|
|
83
|
+
return req({
|
|
84
|
+
url: `/v3/view-dtmpl/config?sourceId=${sourceId}`,
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 详情页面数据
|
|
89
|
+
export function detailPageData(sourceId: string, code: string) {
|
|
90
|
+
return req({
|
|
91
|
+
url: `/v3/view-dtmpl/data?sourceId=${sourceId}&code=${code}`,
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// action 按钮提交数据
|
|
96
|
+
export function actionDataSave(sourceId: string, codes: string = '', data: any) {
|
|
97
|
+
return req({
|
|
98
|
+
url: `/v3/action`,
|
|
99
|
+
method: 'POST',
|
|
100
|
+
data: {
|
|
101
|
+
sourceId,
|
|
102
|
+
codes,
|
|
103
|
+
...data,
|
|
104
|
+
},
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 删除
|
|
109
|
+
export function deleteData(sourceId: string, code: string) {
|
|
110
|
+
return req({
|
|
111
|
+
url: `/v3/ltmpl/data?sourceId=${sourceId}&codes=${code}`,
|
|
112
|
+
method: 'DELETE',
|
|
113
|
+
})
|
|
114
|
+
}
|
package/api/sys.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import req from './core/index'
|
|
2
|
-
// 获取语言包
|
|
3
|
-
export function language(language: string): Promise<any> {
|
|
4
|
-
return req({
|
|
5
|
-
url: `/v3/multilingual?language=${language}`,
|
|
6
|
-
})
|
|
7
|
-
}
|
|
8
|
-
export function getThemeConfig(): Promise<any> {
|
|
9
|
-
return req({
|
|
10
|
-
url: `/v3/theme-config`,
|
|
11
|
-
})
|
|
12
|
-
}
|
|
1
|
+
import req from './core/index'
|
|
2
|
+
// 获取语言包
|
|
3
|
+
export function language(language: string): Promise<any> {
|
|
4
|
+
return req({
|
|
5
|
+
url: `/v3/multilingual?language=${language}`,
|
|
6
|
+
})
|
|
7
|
+
}
|
|
8
|
+
export function getThemeConfig(): Promise<any> {
|
|
9
|
+
return req({
|
|
10
|
+
url: `/v3/theme-config`,
|
|
11
|
+
})
|
|
12
|
+
}
|