@uxda/appkit 4.2.82 → 4.2.84

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 (127) 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 +41 -3
  5. package/dist/index.js +994 -535
  6. package/package.json +81 -81
  7. package/project.config.json +15 -15
  8. package/project.tt.json +13 -13
  9. package/rollup.config.mjs +77 -77
  10. package/src/Appkit.ts +67 -67
  11. package/src/balance/api/endpoints.ts +133 -133
  12. package/src/balance/api/index.ts +112 -106
  13. package/src/balance/components/AccountView.vue +773 -773
  14. package/src/balance/components/BalanceCard.vue +210 -210
  15. package/src/balance/components/BalanceReminder.vue +84 -84
  16. package/src/balance/components/ConsumptionFilter.vue +218 -218
  17. package/src/balance/components/ConsumptionRules.vue +68 -68
  18. package/src/balance/components/DateFilter.vue +259 -259
  19. package/src/balance/components/DateRange.vue +111 -111
  20. package/src/balance/components/ListFilter.vue +62 -62
  21. package/src/balance/components/ListFilterPicker.vue +191 -191
  22. package/src/balance/components/PromoterCard.vue +310 -310
  23. package/src/balance/components/SecondBalance.vue +77 -77
  24. package/src/balance/components/Tip.vue +45 -45
  25. package/src/balance/components/index.ts +8 -8
  26. package/src/balance/types.ts +99 -99
  27. package/src/components/bt-cropper/index.vue +730 -730
  28. package/src/components/bt-cropper/utils/calcCropper.js +42 -42
  29. package/src/components/bt-cropper/utils/calcImagePosition.js +23 -23
  30. package/src/components/bt-cropper/utils/calcImageSize.js +37 -37
  31. package/src/components/bt-cropper/utils/calcPointDistance.js +12 -12
  32. package/src/components/bt-cropper/utils/calcRightAndBottom.js +7 -7
  33. package/src/components/bt-cropper/utils/ratio.js +3 -3
  34. package/src/components/bt-cropper/utils/tools.js +25 -25
  35. package/src/components/dd-area/index.vue +225 -225
  36. package/src/components/dd-icon/doc.md +21 -21
  37. package/src/components/dd-icon/index.vue +23 -23
  38. package/src/components/dd-notice-bar/index.vue +78 -78
  39. package/src/components/dd-search/doc.md +34 -34
  40. package/src/components/dd-search/index.vue +168 -168
  41. package/src/components/dd-selector/index.vue +124 -124
  42. package/src/components/dd-skeleton/doc.md +19 -19
  43. package/src/components/dd-skeleton/index.vue +36 -36
  44. package/src/global.ts +6 -6
  45. package/src/index.ts +93 -93
  46. package/src/main.scss +1 -1
  47. package/src/notice/api/endpoints.ts +54 -17
  48. package/src/notice/api/index.ts +115 -106
  49. package/src/notice/components/NoticeBanner.vue +247 -247
  50. package/src/notice/components/NoticeEntry.vue +99 -99
  51. package/src/notice/components/NoticeList.vue +311 -311
  52. package/src/notice/components/NoticeList2.vue +243 -0
  53. package/src/notice/components/NoticePopup.vue +163 -163
  54. package/src/notice/components/index.ts +6 -5
  55. package/src/notice/components/useCommonList.ts +86 -86
  56. package/src/notice/components/useNotice.ts +35 -35
  57. package/src/notice/index.ts +1 -1
  58. package/src/notice/types.ts +25 -25
  59. package/src/payment/api/config.ts +7 -7
  60. package/src/payment/api/endpoints.ts +95 -95
  61. package/src/payment/api/index.ts +101 -101
  62. package/src/payment/components/AmountPicker.vue +90 -90
  63. package/src/payment/components/RechargeResult.vue +69 -69
  64. package/src/payment/components/RechargeView.vue +190 -190
  65. package/src/payment/components/RightsPicker.vue +105 -105
  66. package/src/payment/components/TradeView.vue +363 -363
  67. package/src/payment/components/UserAgreement.vue +234 -234
  68. package/src/payment/components/index.ts +22 -22
  69. package/src/payment/index.ts +5 -5
  70. package/src/payment/services/index.ts +16 -16
  71. package/src/payment/services/invoke-recharge.ts +25 -25
  72. package/src/payment/services/request-payment.ts +130 -130
  73. package/src/payment/types.ts +32 -32
  74. package/src/register/components/SelfRegistration.vue +233 -233
  75. package/src/register/components/index.ts +2 -2
  76. package/src/scenarios/components/SharePoster.vue +364 -364
  77. package/src/scenarios/components/index.ts +2 -2
  78. package/src/scenarios/components/poster-paste.vue +93 -93
  79. package/src/scenarios/components/share-poster.md +273 -273
  80. package/src/shared/components/AppDrawer.vue +53 -53
  81. package/src/shared/components/AppVerify.vue +128 -128
  82. package/src/shared/components/DeviceVersion.vue +78 -78
  83. package/src/shared/components/EmptyView.vue +33 -33
  84. package/src/shared/components/OcrBusinessLicense.vue +137 -137
  85. package/src/shared/components/OcrIcon.vue +229 -229
  86. package/src/shared/components/PageHeader.vue +84 -84
  87. package/src/shared/components/index.ts +8 -8
  88. package/src/shared/composables/index.ts +9 -9
  89. package/src/shared/composables/useAmount.ts +46 -46
  90. package/src/shared/composables/useCountdown.ts +46 -46
  91. package/src/shared/composables/useCrypto.ts +76 -76
  92. package/src/shared/composables/useDeviceEnv.ts +11 -11
  93. package/src/shared/composables/useDragBox.ts +97 -97
  94. package/src/shared/composables/useEncode.ts +43 -43
  95. package/src/shared/composables/useLogger.ts +131 -131
  96. package/src/shared/composables/useSafeArea.ts +46 -46
  97. package/src/shared/composables/useTabbar.ts +24 -24
  98. package/src/shared/composables/useUpload.ts +61 -61
  99. package/src/shared/composables/useValidator.ts +32 -32
  100. package/src/shared/composables/useWxAuth.ts +48 -48
  101. package/src/shared/http/Http.ts +148 -146
  102. package/src/shared/http/index.ts +1 -1
  103. package/src/shared/http/types.ts +163 -160
  104. package/src/shared/index.ts +8 -8
  105. package/src/shared/weixin/index.ts +9 -9
  106. package/src/shared/weixin/jssdk.ts +103 -103
  107. package/src/shared/weixin/payment.ts +38 -38
  108. package/src/styles/vars.scss +3 -3
  109. package/src/user/api/endpoints.ts +17 -17
  110. package/src/user/api/index.ts +117 -111
  111. package/src/user/components/LoginSetting.vue +114 -114
  112. package/src/user/components/UserAuth.vue +220 -220
  113. package/src/user/components/UserBinding.vue +277 -277
  114. package/src/user/components/UserBindingSuccess.vue +80 -80
  115. package/src/user/components/UserEntry.vue +139 -139
  116. package/src/user/components/UserFeedback.vue +427 -427
  117. package/src/user/components/UserFeedbackEntry.vue +175 -175
  118. package/src/user/components/UserHeadCrop.vue +65 -65
  119. package/src/user/components/UserInfo.vue +708 -708
  120. package/src/user/components/UserResourceEmpty.vue +75 -75
  121. package/src/user/components/index.ts +23 -23
  122. package/src/user/index.ts +1 -1
  123. package/src/utils/utils.ts +28 -28
  124. package/tsconfig.json +30 -30
  125. package/types/global.d.ts +22 -22
  126. package/types/vue.d.ts +10 -10
  127. /package/dist/assets/{asset-DcH8Kg-2 → asset-3B_CoPto} +0 -0
package/.eslintrc.mjs CHANGED
@@ -1,8 +1,8 @@
1
- module.exports = {
2
- extends: [
3
- './.eslintrc-auto-import.json'
4
- ],
5
- rules: {
6
- ident: ['error', 2]
7
- }
1
+ module.exports = {
2
+ extends: [
3
+ './.eslintrc-auto-import.json'
4
+ ],
5
+ rules: {
6
+ ident: ['error', 2]
7
+ }
8
8
  }
package/README.md CHANGED
@@ -1,188 +1,188 @@
1
- # AppKit
2
-
3
- 小程序应用开发包
4
-
5
- 向诸小程序提供供用的组件及基础设施
6
-
7
- 模块:
8
- * payment 支付
9
- * balance 账户、代币(云豆)余额
10
- * auth 登录及会话状态 (待定)
11
-
12
- ## 将 AppKit 加入应用项目
13
-
14
- ```bash
15
- git clone git@10.1.108.137:fed/appkit.git
16
- cd appkit
17
- yarn link
18
- ```
19
-
20
- 然后 cd 到(周转)小程序根目录执行:
21
- ```bash
22
- yarn link @uxda/appkit
23
- ```
24
- 完成 npm link
25
-
26
-
27
- ## 用法
28
- ```typescript
29
- import AppKit from '@uxda/appkit'
30
- import '@uxda/appkit/appkit.css'
31
- ```
32
- ## AppKit 初始化
33
-
34
- 在应用入口页调用(示例)
35
- ```typescript
36
- const App = createApp({})
37
- App.use(AppKit, {
38
- app: () => 'cloudkitPro',
39
- tenant: () => '1',
40
- token: () => localStorage.getItem('token'),
41
- baseUrl: () => process.env.TARO_APP_BASE_URL,
42
- 401: () => {
43
- // 登录态丢失时的处理
44
- }
45
- })
46
- ```
47
- 为 AppKit 的运行提供必需的 API 参数
48
- * app: 当前的 app code (嵌入接口调用的 header 参数)
49
- * tenant: 租户ID 需要提供以便调用接口
50
- * token: 用户登录态 token
51
- * baseUrl: 调用 API 的URL域名
52
- * 401: 登录态丢失异常处理 (通常要跳转登录页)
53
-
54
-
55
- ## UI组件
56
- ### 1️⃣ 充值用户界面 <recharge-view>
57
-
58
- ```typescript
59
- import { RechargeView } from '@uxda/appkit'
60
- ```
61
-
62
- ```html
63
- <template>
64
- <recharge-view
65
- app="crm"
66
- tenant="1"
67
- @complete="onRechargeComplete" />
68
- </template>
69
- ```
70
-
71
- #### 属性 props
72
-
73
- #### 事件 emits
74
-
75
- * @complete: 充值完成时发生
76
-
77
- ### 2️⃣ 账户页 &lt;account-view&gt;
78
- ```
79
- import { AccountView } from '@uxda/appkit'
80
- ```
81
- ```html
82
- <template>
83
- <account-view app="crm" @recharge=onAccountViewRecharge />
84
- <template>
85
- ```
86
-
87
- #### 事件 emits
88
- * @recharge 点击充值按钮时发生
89
-
90
- ### 3️⃣ 账户卡片 &lt;balance-card&gt;
91
-
92
- ```typescript
93
- import { BalanceCard } from '@uxda/appkit'
94
- ```
95
-
96
- ```html
97
- <template>
98
- <balance-card app="crm" @drill="onBalanceCardDrill" @recharge="onBalanceCardRecharge" />
99
- <template>
100
- ```
101
-
102
- #### 事件 emits
103
- * app 配置到组件上的 app code
104
- * @drill 点击账户详情时发生
105
- * @recharge 点击充值按钮时发生
106
-
107
- 场景端需定义以上跳转逻辑:
108
-
109
- ```typescript
110
- function onBalanceCardDrill () {
111
- //...
112
- }
113
-
114
- function onBalanceCardRecharge () {
115
- //...
116
- }
117
- ```
118
-
119
- ### 方法 methods
120
- * reload() 刷新数据
121
-
122
-
123
-
124
- ### 4️⃣ 余额不足提示框 &lt;balance-reminder&gt;
125
-
126
- ```typescript
127
- import { BalanceReminder } from '@uxda/appkit'
128
- ```
129
-
130
- ```html
131
- <balance-reminder v-model="balanceReminderOpen"
132
- @recharge="onBalanceReminderRecharge" />
133
- ```
134
-
135
- #### 事件 emits
136
- * @recharge 点击充值按钮时发生
137
-
138
-
139
- ## 公共API
140
- ### 1️⃣ 唤起充值(跳支付中心小程序) $app.invokeRecharge()
141
-
142
- ```typescript
143
- import { useAppKit } from '@uxda/appkit'
144
- const $app = useAppKit()
145
- $app.invokeRecharge({
146
- app: 'crm',
147
- tenant: '1',
148
- })
149
- ```
150
-
151
- ### 2️⃣ 唤起充值(小程序内直接支付、不跳) $app.requestPayment()
152
-
153
- ```typescript
154
- import { useAppKit } from '@uxda/appkit'
155
- const $app = useAppKit()
156
- $app.requestPayment({
157
- app: 'crm',
158
- tenant: '1',
159
- amount: 100,
160
- user: '' // wx.login 之后得到的用户临时凭证
161
- })
162
- ```
163
-
164
- ## Hooks (Vue Composables)
165
-
166
- ### useTabbar
167
- 用于获取或设置 custom tab bar
168
-
169
- ```typescript
170
- import { useTabbar } from '@uxda/appkit-next'
171
-
172
- onMounted(() => {
173
- const { setTab } = useTabbar()
174
- setTab('home')
175
- })
176
- ```
177
- 以上代码用于切换到 /pages/home/index 时, 设置 tab bar 选中项为 'home'
178
- 在 custom-tab-bar/index.vue 需要做以下设置
179
-
180
- ```typescript
181
- import { useSafeArea, useTabbar } from '@uxda/appkit-next'
182
-
183
- const { onTabChange } = useTabbar()
184
- onTabChange((value: string) => {
185
- selected.value = value
186
- })
187
- ```
1
+ # AppKit
2
+
3
+ 小程序应用开发包
4
+
5
+ 向诸小程序提供供用的组件及基础设施
6
+
7
+ 模块:
8
+ * payment 支付
9
+ * balance 账户、代币(云豆)余额
10
+ * auth 登录及会话状态 (待定)
11
+
12
+ ## 将 AppKit 加入应用项目
13
+
14
+ ```bash
15
+ git clone git@10.1.108.137:fed/appkit.git
16
+ cd appkit
17
+ yarn link
18
+ ```
19
+
20
+ 然后 cd 到(周转)小程序根目录执行:
21
+ ```bash
22
+ yarn link @uxda/appkit
23
+ ```
24
+ 完成 npm link
25
+
26
+
27
+ ## 用法
28
+ ```typescript
29
+ import AppKit from '@uxda/appkit'
30
+ import '@uxda/appkit/appkit.css'
31
+ ```
32
+ ## AppKit 初始化
33
+
34
+ 在应用入口页调用(示例)
35
+ ```typescript
36
+ const App = createApp({})
37
+ App.use(AppKit, {
38
+ app: () => 'cloudkitPro',
39
+ tenant: () => '1',
40
+ token: () => localStorage.getItem('token'),
41
+ baseUrl: () => process.env.TARO_APP_BASE_URL,
42
+ 401: () => {
43
+ // 登录态丢失时的处理
44
+ }
45
+ })
46
+ ```
47
+ 为 AppKit 的运行提供必需的 API 参数
48
+ * app: 当前的 app code (嵌入接口调用的 header 参数)
49
+ * tenant: 租户ID 需要提供以便调用接口
50
+ * token: 用户登录态 token
51
+ * baseUrl: 调用 API 的URL域名
52
+ * 401: 登录态丢失异常处理 (通常要跳转登录页)
53
+
54
+
55
+ ## UI组件
56
+ ### 1️⃣ 充值用户界面 &lt;recharge-view&gt;
57
+
58
+ ```typescript
59
+ import { RechargeView } from '@uxda/appkit'
60
+ ```
61
+
62
+ ```html
63
+ <template>
64
+ <recharge-view
65
+ app="crm"
66
+ tenant="1"
67
+ @complete="onRechargeComplete" />
68
+ </template>
69
+ ```
70
+
71
+ #### 属性 props
72
+
73
+ #### 事件 emits
74
+
75
+ * @complete: 充值完成时发生
76
+
77
+ ### 2️⃣ 账户页 &lt;account-view&gt;
78
+ ```
79
+ import { AccountView } from '@uxda/appkit'
80
+ ```
81
+ ```html
82
+ <template>
83
+ <account-view app="crm" @recharge=onAccountViewRecharge />
84
+ <template>
85
+ ```
86
+
87
+ #### 事件 emits
88
+ * @recharge 点击充值按钮时发生
89
+
90
+ ### 3️⃣ 账户卡片 &lt;balance-card&gt;
91
+
92
+ ```typescript
93
+ import { BalanceCard } from '@uxda/appkit'
94
+ ```
95
+
96
+ ```html
97
+ <template>
98
+ <balance-card app="crm" @drill="onBalanceCardDrill" @recharge="onBalanceCardRecharge" />
99
+ <template>
100
+ ```
101
+
102
+ #### 事件 emits
103
+ * app 配置到组件上的 app code
104
+ * @drill 点击账户详情时发生
105
+ * @recharge 点击充值按钮时发生
106
+
107
+ 场景端需定义以上跳转逻辑:
108
+
109
+ ```typescript
110
+ function onBalanceCardDrill () {
111
+ //...
112
+ }
113
+
114
+ function onBalanceCardRecharge () {
115
+ //...
116
+ }
117
+ ```
118
+
119
+ ### 方法 methods
120
+ * reload() 刷新数据
121
+
122
+
123
+
124
+ ### 4️⃣ 余额不足提示框 &lt;balance-reminder&gt;
125
+
126
+ ```typescript
127
+ import { BalanceReminder } from '@uxda/appkit'
128
+ ```
129
+
130
+ ```html
131
+ <balance-reminder v-model="balanceReminderOpen"
132
+ @recharge="onBalanceReminderRecharge" />
133
+ ```
134
+
135
+ #### 事件 emits
136
+ * @recharge 点击充值按钮时发生
137
+
138
+
139
+ ## 公共API
140
+ ### 1️⃣ 唤起充值(跳支付中心小程序) $app.invokeRecharge()
141
+
142
+ ```typescript
143
+ import { useAppKit } from '@uxda/appkit'
144
+ const $app = useAppKit()
145
+ $app.invokeRecharge({
146
+ app: 'crm',
147
+ tenant: '1',
148
+ })
149
+ ```
150
+
151
+ ### 2️⃣ 唤起充值(小程序内直接支付、不跳) $app.requestPayment()
152
+
153
+ ```typescript
154
+ import { useAppKit } from '@uxda/appkit'
155
+ const $app = useAppKit()
156
+ $app.requestPayment({
157
+ app: 'crm',
158
+ tenant: '1',
159
+ amount: 100,
160
+ user: '' // wx.login 之后得到的用户临时凭证
161
+ })
162
+ ```
163
+
164
+ ## Hooks (Vue Composables)
165
+
166
+ ### useTabbar
167
+ 用于获取或设置 custom tab bar
168
+
169
+ ```typescript
170
+ import { useTabbar } from '@uxda/appkit-next'
171
+
172
+ onMounted(() => {
173
+ const { setTab } = useTabbar()
174
+ setTab('home')
175
+ })
176
+ ```
177
+ 以上代码用于切换到 /pages/home/index 时, 设置 tab bar 选中项为 'home'
178
+ 在 custom-tab-bar/index.vue 需要做以下设置
179
+
180
+ ```typescript
181
+ import { useSafeArea, useTabbar } from '@uxda/appkit-next'
182
+
183
+ const { onTabChange } = useTabbar()
184
+ onTabChange((value: string) => {
185
+ selected.value = value
186
+ })
187
+ ```
188
188
  以上代码设置响应页面内的 setTab() 动作
package/babel.config.js CHANGED
@@ -1,12 +1,12 @@
1
- // babel-preset-taro 更多选项和默认值:
2
- // https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
3
- module.exports = {
4
- presets: [
5
- ['taro', {
6
- framework: 'vue3',
7
- ts: true
8
- }]
9
- ],
10
- plugins: [
11
- ],
12
- }
1
+ // babel-preset-taro 更多选项和默认值:
2
+ // https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
3
+ module.exports = {
4
+ presets: [
5
+ ['taro', {
6
+ framework: 'vue3',
7
+ ts: true
8
+ }]
9
+ ],
10
+ plugins: [
11
+ ],
12
+ }
package/dist/appkit.css CHANGED
@@ -445,9 +445,9 @@
445
445
  color: #353535;
446
446
  background: linear-gradient(90deg, #FFEBC1 0%, #FFB875 100%);
447
447
  }
448
- page {
449
- --text-color: #333;
450
- --text-color-dark-mode: #eee;
448
+ page {
449
+ --text-color: #333;
450
+ --text-color-dark-mode: #eee;
451
451
  }
452
452
  .account-card .card {
453
453
  background: linear-gradient(90deg, #EEF1FA 0%, #E4E6F3 100%);
@@ -1806,6 +1806,44 @@ page {
1806
1806
  margin-left: 4px;
1807
1807
  opacity: 0.5;
1808
1808
  }
1809
+ .news-list .safe-area-space {
1810
+ padding-bottom: calc(var(--bottom) + 60px);
1811
+ padding-bottom: calc(env(safe-area-inset-bottom) + 60px);
1812
+ }
1813
+ .news-list .tabContainer .read-all {
1814
+ width: 100%;
1815
+ text-align: end;
1816
+ height: 22px;
1817
+ line-height: 22px;
1818
+ padding: 5px 0;
1819
+ background-color: var(--fill, var(--ns-background));
1820
+ }
1821
+ .news-list .tabContainer .read-all .btn {
1822
+ color: #017fff;
1823
+ font-size: 14px;
1824
+ font-weight: 500;
1825
+ margin-right: 16px;
1826
+ }
1827
+ .news-list .news-item-title {
1828
+ font-size: 16px;
1829
+ font-weight: 500;
1830
+ display: flex;
1831
+ flex-direction: row;
1832
+ align-items: center;
1833
+ }
1834
+ .news-list .news-item-title-icon {
1835
+ width: 20px;
1836
+ height: 20px;
1837
+ margin-right: 4px;
1838
+ }
1839
+ .news-list .news-item-content {
1840
+ font-size: 14px;
1841
+ }
1842
+ .news-list .news-item-time {
1843
+ font-size: 13px;
1844
+ color: rgba(53, 53, 53, 0.4);
1845
+ text-align: end;
1846
+ }
1809
1847
  .user-entry {
1810
1848
  position: absolute;
1811
1849
  left: 0;