@uxda/appkit 4.3.27 → 4.3.30

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 (140) hide show
  1. package/.cursor/skills/appkit-build-update-component-rules/SKILL.md +54 -49
  2. package/.cursor/skills/appkit-sync-component-rules/SKILL.md +60 -0
  3. package/.eslintrc.mjs +7 -7
  4. package/Appkit/347/273/204/344/273/266/344/275/277/347/224/250/350/247/204/345/210/231.md +2002 -1724
  5. package/PROJECT_DOCS.md +142 -142
  6. package/README.md +194 -194
  7. package/babel.config.js +12 -12
  8. package/dist/appkit.css +121 -3
  9. package/dist/index.js +265 -70
  10. package/package.json +82 -79
  11. package/project.config.json +15 -15
  12. package/project.tt.json +13 -13
  13. package/rollup.config.mjs +81 -78
  14. package/src/Appkit.ts +72 -72
  15. package/src/balance/api/endpoints.ts +133 -133
  16. package/src/balance/api/index.ts +118 -118
  17. package/src/balance/components/AccountView.vue +770 -770
  18. package/src/balance/components/BalanceCard.vue +210 -210
  19. package/src/balance/components/BalanceReminder.vue +84 -84
  20. package/src/balance/components/ConsumptionFilter.vue +218 -218
  21. package/src/balance/components/ConsumptionRules.vue +68 -68
  22. package/src/balance/components/DateFilter.vue +259 -259
  23. package/src/balance/components/DateRange.vue +111 -111
  24. package/src/balance/components/ListFilter.vue +62 -62
  25. package/src/balance/components/ListFilterPicker.vue +191 -191
  26. package/src/balance/components/PromoterCard.vue +308 -308
  27. package/src/balance/components/SecondBalance.vue +77 -77
  28. package/src/balance/components/Tip.vue +45 -45
  29. package/src/balance/components/index.ts +8 -8
  30. package/src/balance/types.ts +99 -99
  31. package/src/components/bt-cropper/index.vue +730 -730
  32. package/src/components/bt-cropper/utils/calcCropper.js +42 -42
  33. package/src/components/bt-cropper/utils/calcImagePosition.js +23 -23
  34. package/src/components/bt-cropper/utils/calcImageSize.js +37 -37
  35. package/src/components/bt-cropper/utils/calcPointDistance.js +12 -12
  36. package/src/components/bt-cropper/utils/calcRightAndBottom.js +7 -7
  37. package/src/components/bt-cropper/utils/ratio.js +3 -3
  38. package/src/components/bt-cropper/utils/tools.js +25 -25
  39. package/src/components/dd-area/index.vue +225 -225
  40. package/src/components/dd-icon/doc.md +21 -21
  41. package/src/components/dd-icon/index.vue +23 -23
  42. package/src/components/dd-notice-bar/index.vue +78 -78
  43. package/src/components/dd-search/doc.md +34 -34
  44. package/src/components/dd-search/index.vue +168 -168
  45. package/src/components/dd-selector/index.vue +124 -124
  46. package/src/components/dd-skeleton/doc.md +19 -19
  47. package/src/components/dd-skeleton/index.vue +36 -36
  48. package/src/global.ts +6 -6
  49. package/src/index.ts +101 -101
  50. package/src/main.scss +1 -1
  51. package/src/notice/api/endpoints.ts +54 -54
  52. package/src/notice/api/index.ts +121 -121
  53. package/src/notice/components/NoticeBanner.vue +247 -247
  54. package/src/notice/components/NoticeEntry.vue +99 -99
  55. package/src/notice/components/NoticeList.vue +311 -311
  56. package/src/notice/components/NoticeList2.vue +401 -401
  57. package/src/notice/components/NoticePopup.vue +163 -163
  58. package/src/notice/components/index.ts +6 -6
  59. package/src/notice/components/useCommonList.ts +87 -87
  60. package/src/notice/components/useNotice.ts +35 -35
  61. package/src/notice/index.ts +1 -1
  62. package/src/notice/types.ts +25 -25
  63. package/src/payment/api/config.ts +7 -7
  64. package/src/payment/api/endpoints.ts +112 -112
  65. package/src/payment/api/index.ts +108 -108
  66. package/src/payment/components/AmountPicker.vue +77 -68
  67. package/src/payment/components/RechargeResult.vue +68 -68
  68. package/src/payment/components/RechargeView.vue +414 -227
  69. package/src/payment/components/RightsPicker.vue +105 -105
  70. package/src/payment/components/TradeView.vue +616 -616
  71. package/src/payment/components/UserAgreement.vue +234 -234
  72. package/src/payment/components/index.ts +22 -22
  73. package/src/payment/components/recharge-amount.spec.ts +51 -0
  74. package/src/payment/components/recharge-amount.ts +63 -0
  75. package/src/payment/index.ts +5 -5
  76. package/src/payment/services/index.ts +16 -16
  77. package/src/payment/services/invoke-recharge.ts +25 -25
  78. package/src/payment/services/request-payment.ts +136 -136
  79. package/src/payment/types.ts +34 -34
  80. package/src/register/components/SelfRegistration.vue +233 -233
  81. package/src/register/components/index.ts +2 -2
  82. package/src/scenarios/components/SharePoster.vue +364 -364
  83. package/src/scenarios/components/index.ts +2 -2
  84. package/src/scenarios/components/poster-paste.vue +93 -93
  85. package/src/scenarios/components/share-poster.md +273 -273
  86. package/src/shared/components/AppDrawer.vue +53 -53
  87. package/src/shared/components/AppVerify.vue +137 -137
  88. package/src/shared/components/DeviceVersion.vue +78 -78
  89. package/src/shared/components/EmptyView.vue +33 -33
  90. package/src/shared/components/OcrBank.vue +202 -202
  91. package/src/shared/components/OcrBusinessLicense.vue +120 -120
  92. package/src/shared/components/OcrIcon.vue +267 -267
  93. package/src/shared/components/OcrInvoice.vue +323 -323
  94. package/src/shared/components/OfficeDocx.vue +33 -0
  95. package/src/shared/components/OfficePdf.vue +35 -0
  96. package/src/shared/components/PageHeader.vue +84 -84
  97. package/src/shared/components/index.ts +12 -10
  98. package/src/shared/composables/index.ts +10 -10
  99. package/src/shared/composables/useAmount.ts +46 -46
  100. package/src/shared/composables/useCompress.ts +64 -64
  101. package/src/shared/composables/useCountdown.ts +46 -46
  102. package/src/shared/composables/useCrypto.ts +76 -76
  103. package/src/shared/composables/useDeviceEnv.ts +61 -61
  104. package/src/shared/composables/useDragBox.ts +97 -97
  105. package/src/shared/composables/useEncode.ts +43 -43
  106. package/src/shared/composables/useLogger.ts +149 -149
  107. package/src/shared/composables/useSafeArea.ts +46 -46
  108. package/src/shared/composables/useTabbar.ts +24 -24
  109. package/src/shared/composables/useUpload.ts +106 -106
  110. package/src/shared/composables/useValidator.ts +32 -32
  111. package/src/shared/composables/useWxAuth.ts +49 -49
  112. package/src/shared/http/Http.ts +149 -149
  113. package/src/shared/http/index.ts +1 -1
  114. package/src/shared/http/types.ts +163 -163
  115. package/src/shared/index.ts +9 -9
  116. package/src/shared/tracking/directives/index.ts +40 -40
  117. package/src/shared/tracking/examples/page-tracking-template.vue +27 -27
  118. package/src/shared/weixin/index.ts +9 -9
  119. package/src/shared/weixin/jssdk.ts +104 -104
  120. package/src/shared/weixin/payment.ts +38 -38
  121. package/src/styles/vars.scss +3 -3
  122. package/src/user/api/endpoints.ts +17 -17
  123. package/src/user/api/index.ts +123 -123
  124. package/src/user/components/LoginSetting.vue +114 -114
  125. package/src/user/components/UserAuth.vue +218 -218
  126. package/src/user/components/UserBinding.vue +277 -277
  127. package/src/user/components/UserBindingSuccess.vue +80 -80
  128. package/src/user/components/UserEntry.vue +139 -139
  129. package/src/user/components/UserFeedback.vue +428 -428
  130. package/src/user/components/UserFeedbackEntry.vue +175 -175
  131. package/src/user/components/UserHeadCrop.vue +65 -65
  132. package/src/user/components/UserInfo.vue +711 -711
  133. package/src/user/components/UserResourceEmpty.vue +75 -75
  134. package/src/user/components/index.ts +23 -23
  135. package/src/user/index.ts +1 -1
  136. package/src/utils/utils.ts +33 -33
  137. package/tsconfig.json +30 -30
  138. package/types/global.d.ts +23 -23
  139. package/types/vue.d.ts +10 -10
  140. /package/dist/assets/{asset-3B_CoPto → index-DcH8Kg-2.css} +0 -0
@@ -1,114 +1,114 @@
1
- <template>
2
- <div class="login-setting" :style="style" v-if="show && showLoginRule">
3
- <img
4
- class="login-setting-img"
5
- src="https://cdn.ddjf.com/static/images/nutshell/empty-permission.png"
6
- />
7
- <div class="login-setting-text">
8
- {{ loginRuleTip }}
9
- </div>
10
- </div>
11
- </template>
12
-
13
- <script lang="ts" setup>
14
- import { computed, ref, onMounted } from 'vue'
15
- import { useHttp } from '../api'
16
- import { useAppKitOptions } from '../../Appkit'
17
- import { useSafeArea } from '../../shared/composables'
18
- import { useDidShow } from '@tarojs/taro'
19
- import debounce from 'lodash-es/debounce'
20
-
21
- const props = withDefaults(
22
- defineProps<{
23
- app: string
24
- withTabbar?: boolean
25
- withNavbar?: boolean
26
- show?: boolean
27
- }>(),
28
- {
29
- app: '',
30
- withTabbar: false,
31
- withNavbar: false,
32
- show: true,
33
- }
34
- )
35
-
36
- const safeArea = useSafeArea()
37
- const showLoginRule = ref<boolean>(false)
38
- const loginRuleTip = ref('')
39
-
40
- const style = computed(() => {
41
- let str = ''
42
- if (props.withTabbar) {
43
- str += `bottom: ${safeArea.menuRect.bottom + 5}px;`
44
- }
45
- if (props.withNavbar) {
46
- str += `top: ${safeArea.nav + safeArea.status + 5}px;`
47
- }
48
- return str
49
- })
50
-
51
- onMounted(() => {
52
- checkLoginTimeRule()
53
- })
54
- useDidShow(() => {
55
- checkLoginTimeRule()
56
- })
57
-
58
- // 检验登录时间
59
- const checkLoginTimeRule = debounce(() => {
60
- const appkitOptions = useAppKitOptions()
61
-
62
- const $http = useHttp()
63
- $http
64
- .post('/cas/sysUser/checkLoginTimeRule', {
65
- appCode: props.app || appkitOptions.app(),
66
- tenantId: appkitOptions.tenant(),
67
- device: 'mini',
68
- })
69
- .then((result: any) => {
70
- if (result === true) {
71
- showLoginRule.value = false
72
- loginRuleTip.value = ''
73
- emits('show', loginRuleTip.value)
74
- return
75
- } else if (result.status) {
76
- showLoginRule.value = true
77
- loginRuleTip.value = result.message
78
- emits('show', loginRuleTip.value)
79
- }
80
- })
81
- }, 100)
82
-
83
- // 父组件事件
84
- const emits = defineEmits(['show'])
85
- </script>
86
-
87
- <style lang="scss">
88
- .login-setting {
89
- position: fixed;
90
- z-index: 4;
91
- left: 12px;
92
- top: 10px;
93
- bottom: 10px;
94
- align-items: center;
95
- width: calc(100% - 24px);
96
- background: #ffffff;
97
- border-radius: 5px;
98
- display: flex;
99
- flex-direction: column;
100
- &-img {
101
- margin-top: 50%;
102
- height: 111px;
103
- width: 198px;
104
- }
105
- &-text {
106
- margin-top: 10px;
107
- color: #353535;
108
- opacity: 0.4;
109
- font-size: 12px;
110
- padding: 0 30px;
111
- text-align: center;
112
- }
113
- }
114
- </style>
1
+ <template>
2
+ <div class="login-setting" :style="style" v-if="show && showLoginRule">
3
+ <img
4
+ class="login-setting-img"
5
+ src="https://cdn.ddjf.com/static/images/nutshell/empty-permission.png"
6
+ />
7
+ <div class="login-setting-text">
8
+ {{ loginRuleTip }}
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script lang="ts" setup>
14
+ import { computed, ref, onMounted } from 'vue'
15
+ import { useHttp } from '../api'
16
+ import { useAppKitOptions } from '../../Appkit'
17
+ import { useSafeArea } from '../../shared/composables'
18
+ import { useDidShow } from '@tarojs/taro'
19
+ import debounce from 'lodash-es/debounce'
20
+
21
+ const props = withDefaults(
22
+ defineProps<{
23
+ app: string
24
+ withTabbar?: boolean
25
+ withNavbar?: boolean
26
+ show?: boolean
27
+ }>(),
28
+ {
29
+ app: '',
30
+ withTabbar: false,
31
+ withNavbar: false,
32
+ show: true,
33
+ }
34
+ )
35
+
36
+ const safeArea = useSafeArea()
37
+ const showLoginRule = ref<boolean>(false)
38
+ const loginRuleTip = ref('')
39
+
40
+ const style = computed(() => {
41
+ let str = ''
42
+ if (props.withTabbar) {
43
+ str += `bottom: ${safeArea.menuRect.bottom + 5}px;`
44
+ }
45
+ if (props.withNavbar) {
46
+ str += `top: ${safeArea.nav + safeArea.status + 5}px;`
47
+ }
48
+ return str
49
+ })
50
+
51
+ onMounted(() => {
52
+ checkLoginTimeRule()
53
+ })
54
+ useDidShow(() => {
55
+ checkLoginTimeRule()
56
+ })
57
+
58
+ // 检验登录时间
59
+ const checkLoginTimeRule = debounce(() => {
60
+ const appkitOptions = useAppKitOptions()
61
+
62
+ const $http = useHttp()
63
+ $http
64
+ .post('/cas/sysUser/checkLoginTimeRule', {
65
+ appCode: props.app || appkitOptions.app(),
66
+ tenantId: appkitOptions.tenant(),
67
+ device: 'mini',
68
+ })
69
+ .then((result: any) => {
70
+ if (result === true) {
71
+ showLoginRule.value = false
72
+ loginRuleTip.value = ''
73
+ emits('show', loginRuleTip.value)
74
+ return
75
+ } else if (result.status) {
76
+ showLoginRule.value = true
77
+ loginRuleTip.value = result.message
78
+ emits('show', loginRuleTip.value)
79
+ }
80
+ })
81
+ }, 100)
82
+
83
+ // 父组件事件
84
+ const emits = defineEmits(['show'])
85
+ </script>
86
+
87
+ <style lang="scss">
88
+ .login-setting {
89
+ position: fixed;
90
+ z-index: 4;
91
+ left: 12px;
92
+ top: 10px;
93
+ bottom: 10px;
94
+ align-items: center;
95
+ width: calc(100% - 24px);
96
+ background: #ffffff;
97
+ border-radius: 5px;
98
+ display: flex;
99
+ flex-direction: column;
100
+ &-img {
101
+ margin-top: 50%;
102
+ height: 111px;
103
+ width: 198px;
104
+ }
105
+ &-text {
106
+ margin-top: 10px;
107
+ color: #353535;
108
+ opacity: 0.4;
109
+ font-size: 12px;
110
+ padding: 0 30px;
111
+ text-align: center;
112
+ }
113
+ }
114
+ </style>
@@ -1,218 +1,218 @@
1
- <template>
2
- <ns-page class="user-auth">
3
- <ns-page-content>
4
- <ns-card fill="#fff">
5
- <ns-form ref="formRef" v-model="formData">
6
- <ns-input label="你的姓名" name="姓名" v-model="formData.姓名" placeholder="请输入或拍照识别" :maxlength="30" :disabled="已认证"
7
- :rules="['required']">
8
- <template #append>
9
- <ocr-icon v-if="!已认证" :has-upload-vo="false" @complete="onOcrComplete" />
10
- </template>
11
- </ns-input>
12
- <ns-input label="身份证号码" name="身份证号码" placeholder="请输入身份证号码" :maxlength="30" v-model="formData.身份证号码"
13
- :disabled="已认证" :rules="[
14
- 'required',
15
- {
16
- name: 'function',
17
- message: '请输入正确格式的证件号码',
18
- method: (value: string) => isIdentityCard(value, 'zh-CN')
19
- }
20
- ]" />
21
- <ns-input label="电话号码" name="电话号码" placeholder="请输入电话号码" :maxlength="11" v-model="formData.电话号码"
22
- :disabled="true" :rules="[
23
- {
24
- name: 'function',
25
- message: '请输入正确格式的电话号码',
26
- method: (value: string) => isMobilePhone(value, 'zh-CN')
27
- }
28
- ]" />
29
- </ns-form>
30
- </ns-card>
31
-
32
- <div class="user-auth-footer">
33
- <div v-if="!已认证" class="checkbox-row">
34
- <ns-checkbox style="font-size: 11px" v-model="formData.同意">我已阅读并同意</ns-checkbox>
35
- <span v-track-click="'用户认证-个人信息授权协议'" @click="showAgreement" class="book">《个人信息授权协议》</span>
36
- </div>
37
- <ns-button v-if="!已认证" class="btn" v-track-click="'用户认证-立即认证'" color="#163391" type="primary" @click="toSubmit">立即认证</ns-button>
38
- <ns-button v-else class="btn" v-track-click="'用户认证-返回'" color="#163391" type="primary" @click="toBack">返回</ns-button>
39
- </div>
40
- </ns-page-content>
41
- </ns-page>
42
- </template>
43
-
44
- <script lang="ts" setup>
45
- import { reactive, ref, watch } from "vue";
46
- import {
47
- NsForm,
48
- NsInput,
49
- NsCard,
50
- NsPage,
51
- NsPageContent,
52
- NsButton,
53
- NsCheckbox,
54
- } from "@uxda/nutshell/taro";
55
- import { OcrIcon } from "../../shared/components";
56
- import Taro, { showToast } from "@tarojs/taro";
57
- import { useNutshell } from "@uxda/nutshell/taro";
58
- import isMobilePhone from "validator/es/lib/isMobilePhone";
59
- import isIdentityCard from "validator/es/lib/isIdentityCard";
60
- import { useHttp } from "../api";
61
-
62
- const props = withDefaults(
63
- defineProps<{
64
- userId: string;
65
- verifyResult: number;
66
- mobile: string;
67
- }>(),
68
- {
69
- verifyResult: -1,
70
- userId: "",
71
- mobile: "",
72
- }
73
- );
74
-
75
- const formRef = ref(),
76
- $n = useNutshell();
77
-
78
- let formData = reactive({
79
- 姓名: "",
80
- 身份证号码: "",
81
- 电话号码: "",
82
- 同意: false,
83
- });
84
-
85
- const 已认证 = ref(false);
86
-
87
- const onOcrComplete = (result) => {
88
- formData.姓名 = result?.faceInfo.name;
89
- formData.身份证号码 = result?.faceInfo.certNo;
90
- };
91
-
92
- // 查看协议
93
- function showAgreement() {
94
- emits("toAgreement");
95
- }
96
-
97
- // 返回
98
- function toBack() {
99
- Taro.navigateBack();
100
- }
101
-
102
- // 认证
103
- async function toSubmit() {
104
- const res = await formRef.value.validate();
105
- if (!res.valid) {
106
- return $n.toast(res.errors[0].message, {});
107
- }
108
-
109
- if (!formData.同意) {
110
- return $n.toast("请先阅读并同意协议", {});
111
- }
112
- const $http = useHttp();
113
-
114
- $http
115
- .post("/cas/sysAccount/verifyId3", {
116
- // appCode:
117
- idCard: formData.身份证号码.toUpperCase(),
118
- mobile: formData.电话号码,
119
- name: formData.姓名,
120
- // tenantId: props.userId,
121
- })
122
- .then((res: any) => {
123
- if (res?.status) {
124
- showToast({ title: "已提交认证信息", icon: "none" });
125
- // 提交认证信息,成功后返回
126
- setTimeout(() => {
127
- toBack();
128
- }, 500);
129
- } else {
130
- showToast({ title: "认证失败", icon: "none" });
131
- }
132
- })
133
- .catch((err) => {
134
- showToast({ title: err?.errMsg || "认证失败", icon: "none" });
135
- });
136
- }
137
- watch(
138
- () => props.verifyResult,
139
- () => {
140
- if (String(props.verifyResult) == "1") {
141
- 已认证.value = true;
142
- const $http = useHttp();
143
-
144
- $http.get(`/cas/sysAccount/userVerifyIdLast`).then((res: any) => {
145
- if (res) {
146
- formData.身份证号码 = res?.idCard;
147
- formData.姓名 = res?.name;
148
- formData.电话号码 = res.mobile;
149
- }
150
- });
151
- }
152
- },
153
- { deep: true, immediate: true }
154
- );
155
- watch(
156
- () => props.mobile,
157
- () => {
158
- if (String(props?.verifyResult) != "1") {
159
- formData.电话号码 = props.mobile;
160
- }
161
- },
162
- { deep: true, immediate: true }
163
- );
164
-
165
- const emits = defineEmits(["toAgreement"]);
166
- </script>
167
-
168
- <style lang="scss">
169
- .user-auth {
170
- height: 100vh;
171
-
172
- &-footer {
173
- position: fixed;
174
- z-index: 10;
175
- bottom: 0;
176
- left: 0;
177
- width: 100%;
178
- min-height: 63px;
179
- background: #ffffff;
180
- box-shadow: 0 -3px 11px 0 rgba(224, 224, 224, 0.5);
181
- padding: 10px 12px calc(8px + var(--safe-bottom-height));
182
- display: flex;
183
- justify-content: space-between;
184
- box-sizing: border-box;
185
-
186
- .btn {
187
- width: 100%;
188
- }
189
-
190
- .checkbox-row {
191
- --nut-primary-color: #017fff;
192
- position: absolute;
193
- top: -36px;
194
- white-space: nowrap;
195
- display: flex;
196
- align-items: center;
197
-
198
- .nut-checkbox__label {
199
- margin-left: 2px;
200
- font-size: 11px;
201
- }
202
-
203
- .nut-icon-check-normal {
204
- margin-top: 0 !important;
205
- }
206
-
207
- .nut-icon-checked {
208
- font-size: 11px;
209
- }
210
-
211
- .book {
212
- font-size: 11px;
213
- color: #007aff;
214
- }
215
- }
216
- }
217
- }
218
- </style>
1
+ <template>
2
+ <ns-page class="user-auth">
3
+ <ns-page-content>
4
+ <ns-card fill="#fff">
5
+ <ns-form ref="formRef" v-model="formData">
6
+ <ns-input label="你的姓名" name="姓名" v-model="formData.姓名" placeholder="请输入或拍照识别" :maxlength="30" :disabled="已认证"
7
+ :rules="['required']">
8
+ <template #append>
9
+ <ocr-icon v-if="!已认证" :has-upload-vo="false" @complete="onOcrComplete" />
10
+ </template>
11
+ </ns-input>
12
+ <ns-input label="身份证号码" name="身份证号码" placeholder="请输入身份证号码" :maxlength="30" v-model="formData.身份证号码"
13
+ :disabled="已认证" :rules="[
14
+ 'required',
15
+ {
16
+ name: 'function',
17
+ message: '请输入正确格式的证件号码',
18
+ method: (value: string) => isIdentityCard(value, 'zh-CN')
19
+ }
20
+ ]" />
21
+ <ns-input label="电话号码" name="电话号码" placeholder="请输入电话号码" :maxlength="11" v-model="formData.电话号码"
22
+ :disabled="true" :rules="[
23
+ {
24
+ name: 'function',
25
+ message: '请输入正确格式的电话号码',
26
+ method: (value: string) => isMobilePhone(value, 'zh-CN')
27
+ }
28
+ ]" />
29
+ </ns-form>
30
+ </ns-card>
31
+
32
+ <div class="user-auth-footer">
33
+ <div v-if="!已认证" class="checkbox-row">
34
+ <ns-checkbox style="font-size: 11px" v-model="formData.同意">我已阅读并同意</ns-checkbox>
35
+ <span v-track-click="'用户认证-个人信息授权协议'" @click="showAgreement" class="book">《个人信息授权协议》</span>
36
+ </div>
37
+ <ns-button v-if="!已认证" class="btn" v-track-click="'用户认证-立即认证'" color="#163391" type="primary" @click="toSubmit">立即认证</ns-button>
38
+ <ns-button v-else class="btn" v-track-click="'用户认证-返回'" color="#163391" type="primary" @click="toBack">返回</ns-button>
39
+ </div>
40
+ </ns-page-content>
41
+ </ns-page>
42
+ </template>
43
+
44
+ <script lang="ts" setup>
45
+ import { reactive, ref, watch } from "vue";
46
+ import {
47
+ NsForm,
48
+ NsInput,
49
+ NsCard,
50
+ NsPage,
51
+ NsPageContent,
52
+ NsButton,
53
+ NsCheckbox,
54
+ } from "@uxda/nutshell/taro";
55
+ import { OcrIcon } from "../../shared/components";
56
+ import Taro, { showToast } from "@tarojs/taro";
57
+ import { useNutshell } from "@uxda/nutshell/taro";
58
+ import isMobilePhone from "validator/es/lib/isMobilePhone";
59
+ import isIdentityCard from "validator/es/lib/isIdentityCard";
60
+ import { useHttp } from "../api";
61
+
62
+ const props = withDefaults(
63
+ defineProps<{
64
+ userId: string;
65
+ verifyResult: number;
66
+ mobile: string;
67
+ }>(),
68
+ {
69
+ verifyResult: -1,
70
+ userId: "",
71
+ mobile: "",
72
+ }
73
+ );
74
+
75
+ const formRef = ref(),
76
+ $n = useNutshell();
77
+
78
+ let formData = reactive({
79
+ 姓名: "",
80
+ 身份证号码: "",
81
+ 电话号码: "",
82
+ 同意: false,
83
+ });
84
+
85
+ const 已认证 = ref(false);
86
+
87
+ const onOcrComplete = (result) => {
88
+ formData.姓名 = result?.faceInfo.name;
89
+ formData.身份证号码 = result?.faceInfo.certNo;
90
+ };
91
+
92
+ // 查看协议
93
+ function showAgreement() {
94
+ emits("toAgreement");
95
+ }
96
+
97
+ // 返回
98
+ function toBack() {
99
+ Taro.navigateBack();
100
+ }
101
+
102
+ // 认证
103
+ async function toSubmit() {
104
+ const res = await formRef.value.validate();
105
+ if (!res.valid) {
106
+ return $n.toast(res.errors[0].message, {});
107
+ }
108
+
109
+ if (!formData.同意) {
110
+ return $n.toast("请先阅读并同意协议", {});
111
+ }
112
+ const $http = useHttp();
113
+
114
+ $http
115
+ .post("/cas/sysAccount/verifyId3", {
116
+ // appCode:
117
+ idCard: formData.身份证号码.toUpperCase(),
118
+ mobile: formData.电话号码,
119
+ name: formData.姓名,
120
+ // tenantId: props.userId,
121
+ })
122
+ .then((res: any) => {
123
+ if (res?.status) {
124
+ showToast({ title: "已提交认证信息", icon: "none" });
125
+ // 提交认证信息,成功后返回
126
+ setTimeout(() => {
127
+ toBack();
128
+ }, 500);
129
+ } else {
130
+ showToast({ title: "认证失败", icon: "none" });
131
+ }
132
+ })
133
+ .catch((err) => {
134
+ showToast({ title: err?.errMsg || "认证失败", icon: "none" });
135
+ });
136
+ }
137
+ watch(
138
+ () => props.verifyResult,
139
+ () => {
140
+ if (String(props.verifyResult) == "1") {
141
+ 已认证.value = true;
142
+ const $http = useHttp();
143
+
144
+ $http.get(`/cas/sysAccount/userVerifyIdLast`).then((res: any) => {
145
+ if (res) {
146
+ formData.身份证号码 = res?.idCard;
147
+ formData.姓名 = res?.name;
148
+ formData.电话号码 = res.mobile;
149
+ }
150
+ });
151
+ }
152
+ },
153
+ { deep: true, immediate: true }
154
+ );
155
+ watch(
156
+ () => props.mobile,
157
+ () => {
158
+ if (String(props?.verifyResult) != "1") {
159
+ formData.电话号码 = props.mobile;
160
+ }
161
+ },
162
+ { deep: true, immediate: true }
163
+ );
164
+
165
+ const emits = defineEmits(["toAgreement"]);
166
+ </script>
167
+
168
+ <style lang="scss">
169
+ .user-auth {
170
+ height: 100vh;
171
+
172
+ &-footer {
173
+ position: fixed;
174
+ z-index: 10;
175
+ bottom: 0;
176
+ left: 0;
177
+ width: 100%;
178
+ min-height: 63px;
179
+ background: #ffffff;
180
+ box-shadow: 0 -3px 11px 0 rgba(224, 224, 224, 0.5);
181
+ padding: 10px 12px calc(8px + var(--safe-bottom-height));
182
+ display: flex;
183
+ justify-content: space-between;
184
+ box-sizing: border-box;
185
+
186
+ .btn {
187
+ width: 100%;
188
+ }
189
+
190
+ .checkbox-row {
191
+ --nut-primary-color: #017fff;
192
+ position: absolute;
193
+ top: -36px;
194
+ white-space: nowrap;
195
+ display: flex;
196
+ align-items: center;
197
+
198
+ .nut-checkbox__label {
199
+ margin-left: 2px;
200
+ font-size: 11px;
201
+ }
202
+
203
+ .nut-icon-check-normal {
204
+ margin-top: 0 !important;
205
+ }
206
+
207
+ .nut-icon-checked {
208
+ font-size: 11px;
209
+ }
210
+
211
+ .book {
212
+ font-size: 11px;
213
+ color: #007aff;
214
+ }
215
+ }
216
+ }
217
+ }
218
+ </style>