@longhongguo/form-create-ant-design-vue 3.3.82 → 3.3.83

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/crawler.js ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * 爬虫/竞对相关接口(基于 frame/fetch.js)
3
+ * 每个方法返回供 api.fetch(config) 使用的 config,调用方:api.fetch(crawlerApi.xxx(params))
4
+ */
5
+ import { buildAction } from '../device/request'
6
+
7
+ /**
8
+ * 根据智鲜本地门店 ID 查询竞对门店列表
9
+ * 使用:api.fetch(crawlerApi.getCompetitionStore({ zxLocalStoreId }))
10
+ */
11
+ export function getCompetitionStore(params = {}) {
12
+ const { zxLocalStoreId, ...rest } = params
13
+ return {
14
+ action: buildAction('crawlerApi', `/competition-store/by-zx-store/${zxLocalStoreId}`),
15
+ method: 'get',
16
+ query: rest,
17
+ dataType: 'json'
18
+ }
19
+ }
20
+
21
+ /**
22
+ * 根据 ID 查询竞对门店(单条,含更新时间等)
23
+ * 使用:api.fetch(crawlerApi.getCompetitionStoreById({ zxLocalStoreId }))
24
+ */
25
+ export function getCompetitionStoreById(params = {}) {
26
+ const { zxLocalStoreId, ...rest } = params
27
+ return {
28
+ action: buildAction('crawlerApi', `/competition-store/${zxLocalStoreId}`),
29
+ method: 'get',
30
+ query: rest,
31
+ dataType: 'json'
32
+ }
33
+ }
34
+
35
+ /**
36
+ * 根据门店 ID 获取爬虫任务列表(拉取记录)
37
+ * 使用:api.fetch(crawlerApi.getCrawlerTaskByStore({ storeId }))
38
+ */
39
+ export function getCrawlerTaskByStore(params = {}) {
40
+ const { storeId, ...rest } = params
41
+ return {
42
+ action: buildAction('crawlerApi', `/crawler-task/main/by-store/${storeId}`),
43
+ method: 'get',
44
+ query: rest,
45
+ dataType: 'json'
46
+ }
47
+ }
48
+
49
+ /**
50
+ * 创建主任务(拉取竞对数据等)
51
+ * 使用:api.fetch(crawlerApi.createCrawlerTask(data))
52
+ */
53
+ export function createCrawlerTask(data = {}) {
54
+ return {
55
+ action: buildAction('crawlerApi', '/crawler-task/main'),
56
+ method: 'post',
57
+ data,
58
+ dataType: 'json'
59
+ }
60
+ }
package/api/example.js ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * 示例接口模块 - 统一接口管理(基于 frame/fetch.js)
3
+ * 每个方法返回供 api.fetch(config) 使用的 config,调用方:api.fetch(exampleApi.xxx(params))
4
+ */
5
+ import { buildAction } from '../device/request'
6
+
7
+ /**
8
+ * 示例:基础域 - 健康检查
9
+ * 使用:api.fetch(exampleApi.healthCheck(params))
10
+ */
11
+ export function healthCheck(params = {}) {
12
+ return {
13
+ action: buildAction('basicApi', '/health'),
14
+ method: 'get',
15
+ query: params,
16
+ dataType: 'json'
17
+ }
18
+ }
19
+
20
+ /**
21
+ * 示例:商家中心 - 建店申请数量(与 zxgj store 接口路径一致)
22
+ * 使用:api.fetch(exampleApi.getGroupByStatusCount(params))
23
+ */
24
+ export function getGroupByStatusCount(params = {}) {
25
+ return {
26
+ action: buildAction('merchantApi', '/store/getGroupByStatusCount'),
27
+ method: 'get',
28
+ query: params,
29
+ dataType: 'json'
30
+ }
31
+ }
32
+
33
+ /**
34
+ * 示例:商家中心 - 分页查询
35
+ * 使用:api.fetch(exampleApi.pageBuildApply(data))
36
+ */
37
+ export function pageBuildApply(data = {}) {
38
+ return {
39
+ action: buildAction('merchantApi', '/store/pageBuildApply'),
40
+ method: 'post',
41
+ data,
42
+ dataType: 'json'
43
+ }
44
+ }
45
+
46
+ /**
47
+ * 示例:商家中心 - 申请建店
48
+ * 使用:api.fetch(exampleApi.applyBuild(data))
49
+ */
50
+ export function applyBuild(data = {}) {
51
+ return {
52
+ action: buildAction('merchantApi', '/store/applyBuild'),
53
+ method: 'post',
54
+ data,
55
+ dataType: 'json'
56
+ }
57
+ }
package/api/index.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 统一接口管理入口(基于 frame/fetch.js)
3
+ * 使用方式:api.fetch(exampleApi.xxx(params)) 或 api.fetch(storeApi.getGroupByStatusCount(params))
4
+ */
5
+ export * from './example'
6
+ export * from './crawler'
@@ -0,0 +1,7 @@
1
+ /**
2
+ * device 统一导出(基于 frame/fetch.js,不使用 axios)
3
+ * api 层用 buildAction(device, path) 拼 action,调用方用 api.fetch(config) 发请求
4
+ * GET 请求可用 params,调用 api.fetch(normalizeFetchConfig(config)) 会映射为 query
5
+ */
6
+ export { getDevice, buildAction, normalizeFetchConfig }
7
+ export { default as urls } from './request'
@@ -0,0 +1,72 @@
1
+ /**
2
+ * 统一 API 服务 - device 入口(基于 frame/fetch.js,不使用 axios)
3
+ * 按业务域提供 baseURL,供 api 层拼出完整 action,由 api.fetch(config) 发请求(token 等已封装)
4
+ */
5
+ const protocol = typeof location !== 'undefined' ? location.protocol : 'https:'
6
+ const isDev = typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'development'
7
+ const isSandbox =
8
+ typeof location !== 'undefined' && location.host && location.host.lastIndexOf('sandbox') > -1
9
+
10
+ const prefix = isSandbox || isDev ? 'sandbox-' : ''
11
+
12
+ const urls = {
13
+ basicApi: `${protocol}//${prefix}zxgj.zhixianai.com/api/`,
14
+ goodsApi: `${protocol}//${prefix}goods-api.zhixianai.com`,
15
+ manageApi: `${protocol}//${prefix}manage-api.zhixianai.com`,
16
+ billApi: `${protocol}//${prefix}finance.zhixianai.com`,
17
+ orderApi: `${protocol}//${prefix}order-api.zhixianai.com`,
18
+ payApi: `${protocol}//${prefix}pay.zhixianai.com`,
19
+ operationApi: `${protocol}//${prefix}operation-api.zhixianai.com/api`,
20
+ merchantApi: `${protocol}//${prefix}merchant-api.zhixianai.com/api`,
21
+ ossApi: `${protocol}//${prefix}upload.zhixianai.com`,
22
+ marketingApi: `${protocol}//${prefix}marketing-api.zhixianai.com/api`,
23
+ customApi: `${protocol}//${prefix}custom-service.zhixianai.com/api`,
24
+ engineApi: `${protocol}//${prefix}flow.zhixianai.com/api`,
25
+ messageApi: `${protocol}//${prefix}message.zhixianai.com/api`,
26
+ warehouseApi: `${protocol}//${prefix}data-warehouse.zhixianai.com/api`,
27
+ materielApi: `${protocol}//${prefix}materiel-api.zhixianai.com/api`,
28
+ crawlerApi: `${protocol}//${prefix}crawler.zhixianai.com/api`
29
+ }
30
+
31
+ /**
32
+ * 取某域的 baseURL
33
+ * @param {string} device - 如 'basicApi' | 'merchantApi' | 'orderApi'
34
+ * @returns {string}
35
+ */
36
+ export function getDevice(device) {
37
+ return urls[device] || ''
38
+ }
39
+
40
+ /**
41
+ * 拼出完整请求地址,供 api.fetch(config) 的 config.action 使用
42
+ * @param {string} device - 如 'merchantApi'
43
+ * @param {string} path - 路径,如 '/store/getGroupByStatusCount'
44
+ * @returns {string}
45
+ */
46
+ export function buildAction(device, path) {
47
+ const base = urls[device] || ''
48
+ if (!base) return path
49
+ const p = path.startsWith('/') ? path : `/${path}`
50
+ return base.replace(/\/$/, '') + p
51
+ }
52
+
53
+ /**
54
+ * 规范化 api.fetch 的 config:GET 请求时把 params 映射到 query(frame/fetch 只认 query)
55
+ * 调用方可用:api.fetch(normalizeFetchConfig(config))
56
+ * @param {object} config - api.fetch 的 config,可含 params(GET 时)或 query
57
+ * @returns {object} 规范化后的 config,GET 且存在 params 时会有 query
58
+ */
59
+ export function normalizeFetchConfig(config) {
60
+ if (!config || typeof config !== 'object') return config
61
+ const method = (config.method || 'get').toLowerCase()
62
+ const isGet = method === 'get'
63
+ if (isGet && config.params != null && typeof config.params === 'object') {
64
+ const next = { ...config }
65
+ next.query = next.query != null ? { ...next.query, ...next.params } : next.params
66
+ delete next.params
67
+ return next
68
+ }
69
+ return config
70
+ }
71
+
72
+ export default urls