@uxda/appkit 1.2.8 → 1.2.12

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.
Files changed (66) hide show
  1. package/.eslintrc.mjs +7 -7
  2. package/README.md +187 -187
  3. package/babel.config.js +12 -12
  4. package/dist/appkit.css +289 -71
  5. package/dist/index.js +862 -341
  6. package/dist/styles.css +1 -0
  7. package/package.json +78 -78
  8. package/project.config.json +15 -15
  9. package/project.tt.json +13 -13
  10. package/rollup.config.mjs +54 -54
  11. package/src/Appkit.ts +65 -65
  12. package/src/balance/api/endpoints.ts +125 -122
  13. package/src/balance/api/index.ts +82 -82
  14. package/src/balance/components/AccountView.vue +754 -649
  15. package/src/balance/components/BalanceCard.vue +209 -209
  16. package/src/balance/components/BalanceReminder.vue +83 -83
  17. package/src/balance/components/ConsumptionFilter.vue +218 -218
  18. package/src/balance/components/ConsumptionRules.vue +68 -68
  19. package/src/balance/components/DateFilter.vue +235 -235
  20. package/src/balance/components/SecondBalance.vue +71 -71
  21. package/src/balance/components/Tip.vue +46 -0
  22. package/src/balance/components/index.ts +9 -9
  23. package/src/balance/types.ts +90 -88
  24. package/src/components/dd-area/index.vue +222 -222
  25. package/src/components/dd-icon/doc.md +21 -21
  26. package/src/components/dd-icon/index.vue +23 -23
  27. package/src/components/dd-selector/index.vue +124 -124
  28. package/src/components/ocr-id/index.vue +110 -110
  29. package/src/components/ocr-id/types.d.ts +12 -12
  30. package/src/global.ts +6 -6
  31. package/src/index.ts +88 -86
  32. package/src/main.scss +1 -1
  33. package/src/payment/api/config.ts +7 -7
  34. package/src/payment/api/endpoints.ts +103 -78
  35. package/src/payment/api/index.ts +71 -71
  36. package/src/payment/components/AmountPicker.vue +93 -93
  37. package/src/payment/components/RechargeResult.vue +66 -54
  38. package/src/payment/components/RechargeView.vue +154 -154
  39. package/src/payment/components/RightsPicker.vue +106 -0
  40. package/src/payment/components/TradeView.vue +298 -0
  41. package/src/payment/components/UserAgreement.vue +141 -141
  42. package/src/payment/components/index.ts +22 -19
  43. package/src/payment/index.ts +5 -5
  44. package/src/payment/services/index.ts +16 -16
  45. package/src/payment/services/invoke-recharge.ts +25 -25
  46. package/src/payment/services/request-payment.ts +58 -31
  47. package/src/payment/types.ts +28 -23
  48. package/src/register/components/SelfRegistration.vue +227 -227
  49. package/src/register/components/index.ts +2 -2
  50. package/src/shared/components/AppDrawer.vue +58 -58
  51. package/src/shared/components/EmptyView.vue +33 -33
  52. package/src/shared/components/PageHeader.vue +79 -79
  53. package/src/shared/components/index.ts +6 -6
  54. package/src/shared/composables/index.ts +2 -2
  55. package/src/shared/composables/useSafeArea.ts +43 -43
  56. package/src/shared/composables/useTabbar.ts +24 -24
  57. package/src/shared/http/Http.ts +126 -126
  58. package/src/shared/http/index.ts +1 -1
  59. package/src/shared/http/types.ts +157 -157
  60. package/src/shared/index.ts +3 -3
  61. package/src/shared/weixin/payment.ts +38 -38
  62. package/src/styles/fonts.scss +2 -2
  63. package/src/styles/vars.scss +3 -3
  64. package/tsconfig.json +30 -30
  65. package/types/global.d.ts +21 -21
  66. package/types/vue.d.ts +10 -10
package/src/index.ts CHANGED
@@ -1,86 +1,88 @@
1
- import { App } from 'vue'
2
- import { components as paymentComponents } from './payment/components'
3
- import { services as paymentServices } from './payment'
4
- import {
5
- Grid,
6
- GridItem,
7
- Button,
8
- Checkbox,
9
- Popup,
10
- OverLay,
11
- DatePicker,
12
- Form,
13
- FormItem,
14
- Cell,
15
- CellGroup,
16
- } from '@nutui/nutui-taro'
17
- import { type AppKitOptions, useAppKitOptions, DollarApp } from './Appkit'
18
- import { PaymentParams, RechargeParams } from './payment/types'
19
- import './main.scss'
20
-
21
- const nutComponents = [
22
- Grid,
23
- GridItem,
24
- Button,
25
- Checkbox,
26
- Popup,
27
- OverLay,
28
- DatePicker,
29
- Form,
30
- FormItem,
31
- Cell,
32
- CellGroup,
33
- ]
34
-
35
- const appComponents = {
36
- ...paymentComponents,
37
- }
38
-
39
- const services = [...paymentServices]
40
-
41
- const $app: DollarApp = {
42
- setToken: (token: () => string) => {
43
- const appKitOptions = useAppKitOptions()
44
- appKitOptions.token = token
45
- },
46
- setTempToken: (token: () => string) => {
47
- const appKitOptions = useAppKitOptions()
48
- appKitOptions.tempToken = token
49
- },
50
- requestPayment: (options: PaymentParams) => {},
51
- invokeRecharge: (options: RechargeParams) => {},
52
- }
53
-
54
- services.forEach((service) => {
55
- service.install($app)
56
- })
57
-
58
- export function useAppKit(): DollarApp {
59
- return $app
60
- }
61
-
62
- const AppKit = {
63
- install(app: App, options: AppKitOptions) {
64
- const appKitOptions = useAppKitOptions()
65
- appKitOptions.app = options.app
66
- appKitOptions.tenant = options.tenant
67
- appKitOptions.token = options.token
68
- appKitOptions.baseUrl = options.baseUrl
69
- appKitOptions[401] = options[401]
70
- appKitOptions.gray = options.gray
71
- nutComponents.forEach((component) => {
72
- app.use(component)
73
- })
74
- Object.entries(appComponents).forEach(([name, component]) => {
75
- app.component(name, component)
76
- })
77
- },
78
- }
79
-
80
- export default AppKit
81
-
82
- export * from './payment'
83
- export * from './balance'
84
- export * from './shared'
85
- export * from './register'
86
- export { type AppKitOptions }
1
+ import { App } from 'vue'
2
+ import { components as paymentComponents } from './payment/components'
3
+ import { services as paymentServices } from './payment'
4
+ import {
5
+ Grid,
6
+ GridItem,
7
+ Button,
8
+ Checkbox,
9
+ Popup,
10
+ OverLay,
11
+ DatePicker,
12
+ Form,
13
+ FormItem,
14
+ Cell,
15
+ CellGroup,
16
+ Dialog
17
+ } from '@nutui/nutui-taro'
18
+ import { type AppKitOptions, useAppKitOptions, DollarApp } from './Appkit'
19
+ import { PaymentParams, RechargeParams } from './payment/types'
20
+ import './main.scss'
21
+
22
+ const nutComponents = [
23
+ Grid,
24
+ GridItem,
25
+ Button,
26
+ Checkbox,
27
+ Popup,
28
+ OverLay,
29
+ DatePicker,
30
+ Form,
31
+ FormItem,
32
+ Cell,
33
+ CellGroup,
34
+ Dialog
35
+ ]
36
+
37
+ const appComponents = {
38
+ ...paymentComponents,
39
+ }
40
+
41
+ const services = [...paymentServices]
42
+
43
+ const $app: DollarApp = {
44
+ setToken: (token: () => string) => {
45
+ const appKitOptions = useAppKitOptions()
46
+ appKitOptions.token = token
47
+ },
48
+ setTempToken: (token: () => string) => {
49
+ const appKitOptions = useAppKitOptions()
50
+ appKitOptions.tempToken = token
51
+ },
52
+ requestPayment: (options: PaymentParams) => {},
53
+ invokeRecharge: (options: RechargeParams) => {},
54
+ }
55
+
56
+ services.forEach((service) => {
57
+ service.install($app)
58
+ })
59
+
60
+ export function useAppKit(): DollarApp {
61
+ return $app
62
+ }
63
+
64
+ const AppKit = {
65
+ install(app: App, options: AppKitOptions) {
66
+ const appKitOptions = useAppKitOptions()
67
+ appKitOptions.app = options.app
68
+ appKitOptions.tenant = options.tenant
69
+ appKitOptions.token = options.token
70
+ appKitOptions.baseUrl = options.baseUrl
71
+ appKitOptions[401] = options[401]
72
+ appKitOptions.gray = options.gray
73
+ nutComponents.forEach((component) => {
74
+ app.use(component)
75
+ })
76
+ Object.entries(appComponents).forEach(([name, component]) => {
77
+ app.component(name, component)
78
+ })
79
+ },
80
+ }
81
+
82
+ export default AppKit
83
+
84
+ export * from './payment'
85
+ export * from './balance'
86
+ export * from './shared'
87
+ export * from './register'
88
+ export { type AppKitOptions }
package/src/main.scss CHANGED
@@ -1,2 +1,2 @@
1
- @import url(./styles/vars.scss);
1
+ @import url(./styles/vars.scss);
2
2
  @import url(./styles/fonts.scss);
@@ -1,8 +1,8 @@
1
- import type { HttpClientConfig } from '../../shared/http'
2
-
3
- const clientConfig: HttpClientConfig = {
4
- baseUrl: 'http://ytech.dev.ddjf.info',
5
-
6
- }
7
-
1
+ import type { HttpClientConfig } from '../../shared/http'
2
+
3
+ const clientConfig: HttpClientConfig = {
4
+ baseUrl: 'http://ytech.dev.ddjf.info',
5
+
6
+ }
7
+
8
8
  export default clientConfig
@@ -1,79 +1,104 @@
1
- import { HttpEndpoints } from '../../shared/http'
2
- import { PaymentParams } from '../types'
3
-
4
- const endpointsList: HttpEndpoints = {
5
- /**
6
- * 获取充值套餐包列表
7
- * (查询某应用某场景可充值的金额列表)
8
- * http://ytech.dev.ddjf.info/payment/doc.html#/%E5%AE%A2%E6%88%B7%E5%9F%9FAPI/%E6%94%AF%E4%BB%98%E4%B8%AD%E5%BF%83-%E5%AF%B9%E5%A4%96%E6%8E%A5%E5%8F%A3/getRechargeListUsingGET
9
- */
10
- 获取充值金额列表: {
11
- path: '/payment/outer/payment/getRechargeList',
12
- translate: (data: any) => ({
13
- appCode: data.app,
14
- // caseCode: 'recharge', // 这个参数可以不要
15
- tenantId: data.tenant
16
- }),
17
- transform: (data: any) => data.amountList.map((d: any) => ({
18
- token: d.desc,
19
- amount: d.amount
20
- }))
21
- },
22
- /**
23
- * 查询支付参数包
24
- * (获取拉起微信支付用的JSON串)
25
- * http://ytech.dev.ddjf.info/payment/doc.html#/%E5%AE%A2%E6%88%B7%E5%9F%9FAPI/%E6%94%AF%E4%BB%98%E4%B8%AD%E5%BF%83-%E5%AF%B9%E5%A4%96%E6%8E%A5%E5%8F%A3/rechargePayUsingPOST
26
- */
27
- 获取微信支付参数包: {
28
- // {
29
- // "amount": 100,
30
- // "appCode": "crm",
31
- // "caseCode": "aiApproveRecharge",
32
- // "tenantId": "17454646",
33
- // "transFlowNo": "4343244",
34
- // "certificateNo": "o7k8L0QTqcwRIBKVUPzI7iPfghLM"
35
- // }
36
- path: '/payment/outer/payment/rechargePay',
37
- translate: (params: PaymentParams) => ({
38
- amount: params.amount,
39
- appCode: params.app,
40
- // caseCode: data.stage, 这个参数可以不传
41
- tenantId: params.tenant,
42
- // transFlowNo: '4343244', 这个参数可以不传
43
- certificateNo: params.user,
44
- }),
45
- transform: (data: any) => {
46
- let json = null
47
- try {
48
- json = JSON.parse(data.prePayStr)
49
- } catch (e) {
50
- }
51
- return {
52
- json, // 拉起微信支付用的JSON串
53
- paymentId: data.payId // 查询用支付ID
54
- }
55
- }
56
- }
57
- } as const
58
-
59
- const keys = Object.keys(endpointsList as any)
60
-
61
- type Keys = typeof keys[number]
62
-
63
- const endpoints: Record<Keys, string> = Object.fromEntries(
64
- Object.entries(endpointsList).map(([name, def]) => [name, def.path])
65
- )
66
-
67
- const translates = Object.fromEntries(
68
- Object.entries(endpointsList).map(([, def]) => [def.path, def.translate])
69
- )
70
-
71
- const transforms = Object.fromEntries(
72
- Object.entries(endpointsList).map(([, def]) => [def.path, def.transform])
73
- )
74
-
75
- export {
76
- endpoints,
77
- translates,
78
- transforms,
1
+ import { HttpEndpoints } from '../../shared/http'
2
+ import { PaymentParams } from '../types'
3
+
4
+ const endpointsList: HttpEndpoints = {
5
+ /**
6
+ * 获取充值套餐包列表
7
+ * (查询某应用某场景可充值的金额列表)
8
+ * http://ytech.dev.ddjf.info/payment/doc.html#/%E5%AE%A2%E6%88%B7%E5%9F%9FAPI/%E6%94%AF%E4%BB%98%E4%B8%AD%E5%BF%83-%E5%AF%B9%E5%A4%96%E6%8E%A5%E5%8F%A3/getRechargeListUsingGET
9
+ */
10
+ 获取充值金额列表: {
11
+ path: '/payment/outer/payment/getRechargeList',
12
+ translate: (data: any) => ({
13
+ appCode: data.app,
14
+ // caseCode: 'recharge', // 这个参数可以不要
15
+ tenantId: data.tenant
16
+ }),
17
+ transform: (data: any) => data.amountList.map((d: any) => ({
18
+ token: d.desc,
19
+ amount: d.amount
20
+ }))
21
+ },
22
+ /**
23
+ * 查询支付参数包
24
+ * (获取拉起微信支付用的JSON串)
25
+ * http://ytech.dev.ddjf.info/payment/doc.html#/%E5%AE%A2%E6%88%B7%E5%9F%9FAPI/%E6%94%AF%E4%BB%98%E4%B8%AD%E5%BF%83-%E5%AF%B9%E5%A4%96%E6%8E%A5%E5%8F%A3/rechargePayUsingPOST
26
+ */
27
+ 获取微信支付参数包: {
28
+ // {
29
+ // "amount": 100,
30
+ // "appCode": "crm",
31
+ // "caseCode": "aiApproveRecharge",
32
+ // "tenantId": "17454646",
33
+ // "transFlowNo": "4343244",
34
+ // "certificateNo": "o7k8L0QTqcwRIBKVUPzI7iPfghLM"
35
+ // }
36
+ path: '/payment/outer/payment/rechargePay',
37
+ translate: (params: PaymentParams) => ({
38
+ amount: params.amount,
39
+ appCode: params.app,
40
+ // caseCode: data.stage, 这个参数可以不传
41
+ tenantId: params.tenant,
42
+ // transFlowNo: '4343244', 这个参数可以不传
43
+ certificateNo: params.user,
44
+ }),
45
+ transform: (data: any) => {
46
+ let json = null
47
+ try {
48
+ json = JSON.parse(data.prePayStr)
49
+ } catch (e) {
50
+ }
51
+ return {
52
+ json, // 拉起微信支付用的JSON串
53
+ paymentId: data.payId // 查询用支付ID
54
+ }
55
+ }
56
+ },
57
+ 获取权益微信支付: {
58
+ path: '/payment/outer/payment/valueExchangePay',
59
+ translate: (params: PaymentParams) => ({
60
+ caseConfigId: params.caseConfigId,
61
+ appCode: params.app,
62
+ tenantId: params.tenant,
63
+ amount: params.amount,
64
+ certificateNo: params.user,
65
+ }),
66
+ transform: (data: any) => {
67
+ let json = null
68
+ try {
69
+ json = JSON.parse(data.prePayStr)
70
+ } catch (e) {
71
+ }
72
+ return {
73
+ json, // 拉起微信支付用的JSON串
74
+ paymentId: data.payId // 查询用支付ID
75
+ }
76
+ }
77
+ },
78
+ 获取增值权益类目: {
79
+ path: "/payment/paymentCaseConfig/getBalanceAndRiskQueryPriceConfig",
80
+ transform: (data: any) => data
81
+ },
82
+ } as const
83
+
84
+ const keys = Object.keys(endpointsList as any)
85
+
86
+ type Keys = typeof keys[number]
87
+
88
+ const endpoints: Record<Keys, string> = Object.fromEntries(
89
+ Object.entries(endpointsList).map(([name, def]) => [name, def.path])
90
+ )
91
+
92
+ const translates = Object.fromEntries(
93
+ Object.entries(endpointsList).map(([, def]) => [def.path, def.translate])
94
+ )
95
+
96
+ const transforms = Object.fromEntries(
97
+ Object.entries(endpointsList).map(([, def]) => [def.path, def.transform])
98
+ )
99
+
100
+ export {
101
+ endpoints,
102
+ translates,
103
+ transforms,
79
104
  }
@@ -1,71 +1,71 @@
1
- import Taro from '@tarojs/taro'
2
- import { HttpRequestConfig, ResponseRaw, createHttp } from '../../shared'
3
- import { translates, transforms } from './endpoints'
4
- import { useAppKitOptions } from '../../Appkit'
5
-
6
- /**
7
- * 小程序端 Http
8
- * 使用 Taro.request 实现
9
- */
10
- const vendor = {
11
- async request<T>(config: HttpRequestConfig) {
12
- return new Promise<ResponseRaw<T>>((resolve, reject) => {
13
- Taro.request({
14
- url: config.url,
15
- method: config.method,
16
- header: config.headers,
17
- data: config.data,
18
- })
19
- .then(({ data }) => {
20
- resolve({
21
- status: data.code,
22
- message: data.msg,
23
- data: data.result as T,
24
- })
25
- })
26
- .catch((e: any) => {
27
- reject(e)
28
- })
29
- })
30
- },
31
- }
32
-
33
- function useHttp() {
34
- const appkitOptions = useAppKitOptions()
35
- const headers = {
36
- Token: appkitOptions.tempToken() || appkitOptions.token(),
37
- Appcode: appkitOptions.app(),
38
- cookie: `tid=${appkitOptions.tenant()}`,
39
- gray: appkitOptions.gray ? appkitOptions.gray() : '0',
40
- }
41
- /**
42
- * 传入配置获取 Http instanse
43
- */
44
- const $http = createHttp({
45
- vendor,
46
- baseUrl: appkitOptions.baseUrl(),
47
- headers,
48
- interceptors: [
49
- (raw) => {
50
- if (raw.status == 401) {
51
- appkitOptions[401]()
52
- return true
53
- }
54
- return false
55
- },
56
- (raw) => {
57
- if (raw.status > 500) {
58
- return true
59
- }
60
- return false
61
- },
62
- ],
63
- translates,
64
- transforms,
65
- })
66
- return $http
67
- }
68
-
69
- export { useHttp }
70
-
71
- export * from './endpoints'
1
+ import Taro from '@tarojs/taro'
2
+ import { HttpRequestConfig, ResponseRaw, createHttp } from '../../shared'
3
+ import { translates, transforms } from './endpoints'
4
+ import { useAppKitOptions } from '../../Appkit'
5
+
6
+ /**
7
+ * 小程序端 Http
8
+ * 使用 Taro.request 实现
9
+ */
10
+ const vendor = {
11
+ async request<T>(config: HttpRequestConfig) {
12
+ return new Promise<ResponseRaw<T>>((resolve, reject) => {
13
+ Taro.request({
14
+ url: config.url,
15
+ method: config.method,
16
+ header: config.headers,
17
+ data: config.data,
18
+ })
19
+ .then(({ data }) => {
20
+ resolve({
21
+ status: data.code,
22
+ message: data.msg,
23
+ data: data.result as T,
24
+ })
25
+ })
26
+ .catch((e: any) => {
27
+ reject(e)
28
+ })
29
+ })
30
+ },
31
+ }
32
+
33
+ function useHttp() {
34
+ const appkitOptions = useAppKitOptions()
35
+ const headers = {
36
+ Token: appkitOptions.tempToken() || appkitOptions.token(),
37
+ Appcode: appkitOptions.app(),
38
+ cookie: `tid=${appkitOptions.tenant()}`,
39
+ gray: appkitOptions.gray ? appkitOptions.gray() : '0',
40
+ }
41
+ /**
42
+ * 传入配置获取 Http instanse
43
+ */
44
+ const $http = createHttp({
45
+ vendor,
46
+ baseUrl: appkitOptions.baseUrl(),
47
+ headers,
48
+ interceptors: [
49
+ (raw) => {
50
+ if (raw.status == 401) {
51
+ appkitOptions[401]()
52
+ return true
53
+ }
54
+ return false
55
+ },
56
+ (raw) => {
57
+ if (raw.status > 500 && raw.status != 1100028) {
58
+ return true
59
+ }
60
+ return false
61
+ },
62
+ ],
63
+ translates,
64
+ transforms,
65
+ })
66
+ return $http
67
+ }
68
+
69
+ export { useHttp }
70
+
71
+ export * from './endpoints'