@uxda/appkit 4.3.6 → 4.3.8

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 (135) hide show
  1. package/.eslintrc.mjs +7 -7
  2. package/COMPONENT_USAGE.md +1523 -1523
  3. package/PROJECT_DOCS.md +142 -142
  4. package/README.md +187 -187
  5. package/babel.config.js +12 -12
  6. package/dist/appkit.css +15 -63
  7. package/dist/assets/asset-DcH8Kg-2 +1 -0
  8. package/dist/index.js +259 -806
  9. package/package.json +79 -79
  10. package/project.config.json +15 -15
  11. package/project.tt.json +13 -13
  12. package/rollup.config.mjs +78 -78
  13. package/src/Appkit.ts +72 -72
  14. package/src/balance/api/endpoints.ts +133 -133
  15. package/src/balance/api/index.ts +118 -118
  16. package/src/balance/components/AccountView.vue +770 -770
  17. package/src/balance/components/BalanceCard.vue +210 -210
  18. package/src/balance/components/BalanceReminder.vue +84 -84
  19. package/src/balance/components/ConsumptionFilter.vue +218 -218
  20. package/src/balance/components/ConsumptionRules.vue +68 -68
  21. package/src/balance/components/DateFilter.vue +259 -259
  22. package/src/balance/components/DateRange.vue +111 -111
  23. package/src/balance/components/ListFilter.vue +62 -62
  24. package/src/balance/components/ListFilterPicker.vue +191 -191
  25. package/src/balance/components/PromoterCard.vue +307 -308
  26. package/src/balance/components/SecondBalance.vue +77 -77
  27. package/src/balance/components/Tip.vue +45 -45
  28. package/src/balance/components/index.ts +8 -8
  29. package/src/balance/types.ts +99 -99
  30. package/src/components/bt-cropper/index.vue +730 -730
  31. package/src/components/bt-cropper/utils/calcCropper.js +42 -42
  32. package/src/components/bt-cropper/utils/calcImagePosition.js +23 -23
  33. package/src/components/bt-cropper/utils/calcImageSize.js +37 -37
  34. package/src/components/bt-cropper/utils/calcPointDistance.js +12 -12
  35. package/src/components/bt-cropper/utils/calcRightAndBottom.js +7 -7
  36. package/src/components/bt-cropper/utils/ratio.js +3 -3
  37. package/src/components/bt-cropper/utils/tools.js +25 -25
  38. package/src/components/dd-area/index.vue +225 -225
  39. package/src/components/dd-icon/doc.md +21 -21
  40. package/src/components/dd-icon/index.vue +23 -23
  41. package/src/components/dd-notice-bar/index.vue +78 -78
  42. package/src/components/dd-search/doc.md +34 -34
  43. package/src/components/dd-search/index.vue +168 -168
  44. package/src/components/dd-selector/index.vue +124 -124
  45. package/src/components/dd-skeleton/doc.md +19 -19
  46. package/src/components/dd-skeleton/index.vue +36 -36
  47. package/src/global.ts +6 -6
  48. package/src/index.ts +101 -101
  49. package/src/main.scss +1 -1
  50. package/src/notice/api/endpoints.ts +54 -54
  51. package/src/notice/api/index.ts +121 -121
  52. package/src/notice/components/NoticeBanner.vue +247 -247
  53. package/src/notice/components/NoticeEntry.vue +99 -99
  54. package/src/notice/components/NoticeList.vue +311 -311
  55. package/src/notice/components/NoticeList2.vue +400 -399
  56. package/src/notice/components/NoticePopup.vue +163 -163
  57. package/src/notice/components/index.ts +6 -6
  58. package/src/notice/components/useCommonList.ts +86 -87
  59. package/src/notice/components/useNotice.ts +35 -35
  60. package/src/notice/index.ts +1 -1
  61. package/src/notice/types.ts +25 -25
  62. package/src/payment/api/config.ts +7 -7
  63. package/src/payment/api/endpoints.ts +96 -98
  64. package/src/payment/api/index.ts +107 -108
  65. package/src/payment/components/AmountPicker.vue +90 -90
  66. package/src/payment/components/RechargeResult.vue +69 -68
  67. package/src/payment/components/RechargeView.vue +191 -191
  68. package/src/payment/components/RightsPicker.vue +105 -105
  69. package/src/payment/components/TradeView.vue +363 -571
  70. package/src/payment/components/UserAgreement.vue +234 -234
  71. package/src/payment/components/index.ts +22 -22
  72. package/src/payment/index.ts +5 -5
  73. package/src/payment/services/index.ts +16 -16
  74. package/src/payment/services/invoke-recharge.ts +25 -25
  75. package/src/payment/services/request-payment.ts +130 -132
  76. package/src/payment/types.ts +33 -34
  77. package/src/register/components/SelfRegistration.vue +233 -233
  78. package/src/register/components/index.ts +2 -2
  79. package/src/scenarios/components/SharePoster.vue +364 -364
  80. package/src/scenarios/components/index.ts +2 -2
  81. package/src/scenarios/components/poster-paste.vue +93 -93
  82. package/src/scenarios/components/share-poster.md +273 -273
  83. package/src/shared/components/AppDrawer.vue +53 -53
  84. package/src/shared/components/AppVerify.vue +128 -137
  85. package/src/shared/components/DeviceVersion.vue +78 -78
  86. package/src/shared/components/EmptyView.vue +33 -33
  87. package/src/shared/components/OcrBusinessLicense.vue +137 -120
  88. package/src/shared/components/OcrIcon.vue +229 -267
  89. package/src/shared/components/PageHeader.vue +84 -84
  90. package/src/shared/components/index.ts +8 -10
  91. package/src/shared/composables/index.ts +9 -10
  92. package/src/shared/composables/useAmount.ts +46 -46
  93. package/src/shared/composables/useCountdown.ts +46 -46
  94. package/src/shared/composables/useCrypto.ts +76 -76
  95. package/src/shared/composables/useDeviceEnv.ts +26 -26
  96. package/src/shared/composables/useDragBox.ts +97 -97
  97. package/src/shared/composables/useEncode.ts +43 -43
  98. package/src/shared/composables/useLogger.ts +144 -144
  99. package/src/shared/composables/useSafeArea.ts +46 -46
  100. package/src/shared/composables/useTabbar.ts +24 -24
  101. package/src/shared/composables/useUpload.ts +61 -106
  102. package/src/shared/composables/useValidator.ts +32 -32
  103. package/src/shared/composables/useWxAuth.ts +48 -48
  104. package/src/shared/http/Http.ts +148 -149
  105. package/src/shared/http/index.ts +1 -1
  106. package/src/shared/http/types.ts +163 -163
  107. package/src/shared/index.ts +9 -9
  108. package/src/shared/tracking/directives/index.ts +40 -40
  109. package/src/shared/tracking/examples/page-tracking-template.vue +27 -27
  110. package/src/shared/tracking/tracking-sdk.ts +1 -0
  111. package/src/shared/weixin/index.ts +9 -9
  112. package/src/shared/weixin/jssdk.ts +103 -104
  113. package/src/shared/weixin/payment.ts +38 -38
  114. package/src/styles/vars.scss +3 -3
  115. package/src/user/api/endpoints.ts +17 -17
  116. package/src/user/api/index.ts +123 -123
  117. package/src/user/components/LoginSetting.vue +114 -114
  118. package/src/user/components/UserAuth.vue +218 -218
  119. package/src/user/components/UserBinding.vue +277 -277
  120. package/src/user/components/UserBindingSuccess.vue +80 -80
  121. package/src/user/components/UserEntry.vue +139 -139
  122. package/src/user/components/UserFeedback.vue +427 -428
  123. package/src/user/components/UserFeedbackEntry.vue +175 -175
  124. package/src/user/components/UserHeadCrop.vue +65 -65
  125. package/src/user/components/UserInfo.vue +709 -711
  126. package/src/user/components/UserResourceEmpty.vue +75 -75
  127. package/src/user/components/index.ts +23 -23
  128. package/src/user/index.ts +1 -1
  129. package/src/utils/utils.ts +33 -33
  130. package/tsconfig.json +30 -30
  131. package/types/global.d.ts +22 -24
  132. package/types/vue.d.ts +10 -10
  133. package/src/shared/components/OcrBank.vue +0 -202
  134. package/src/shared/components/OcrInvoice.vue +0 -218
  135. package/src/shared/composables/useCompress.ts +0 -64
@@ -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="!已认证" @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>