@uxda/appkit 4.2.47 → 4.2.50
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/dist/appkit.css +9 -9
- package/dist/index.js +253 -127
- package/package.json +3 -1
- package/src/Appkit.ts +1 -0
- package/src/balance/api/index.ts +2 -2
- package/src/balance/components/AccountView.vue +34 -29
- package/src/components/bt-cropper/index.vue +2 -2
- package/src/index.ts +3 -1
- package/src/notice/api/index.ts +2 -2
- package/src/notice/components/NoticeBanner.vue +14 -22
- package/src/notice/components/NoticeEntry.vue +2 -2
- package/src/notice/components/NoticeList.vue +6 -2
- package/src/notice/components/useCommonList.ts +5 -5
- package/src/payment/api/endpoints.ts +17 -22
- package/src/payment/api/index.ts +2 -2
- package/src/payment/components/RechargeView.vue +38 -20
- package/src/payment/components/TradeView.vue +3 -3
- package/src/payment/services/request-payment.ts +34 -4
- package/src/payment/types.ts +9 -7
- package/src/register/components/SelfRegistration.vue +2 -2
- package/src/shared/components/AppDrawer.vue +9 -10
- package/src/shared/components/OcrBusinessLicense.vue +23 -16
- package/src/shared/components/OcrIcon.vue +39 -23
- package/src/shared/index.ts +5 -1
- package/src/shared/weixin/index.ts +9 -1
- package/src/shared/weixin/jssdk.ts +91 -0
- package/src/user/api/index.ts +3 -3
- package/src/user/components/UserAuth.vue +26 -63
- package/src/user/components/UserBinding.vue +41 -70
- package/src/user/components/UserBindingSuccess.vue +2 -2
- package/src/user/components/UserFeedback.vue +41 -44
- package/src/user/components/UserInfo.vue +56 -181
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PaymentParams } from '../types'
|
|
2
2
|
import { DollarApp } from '../../Appkit'
|
|
3
3
|
import { useHttp, endpoints } from '../../payment/api'
|
|
4
|
-
import { requestPayment as weappRequestPayment } from '../../shared'
|
|
5
|
-
import Taro from '@tarojs/taro'
|
|
4
|
+
import { requestWxH5Pay, requestPayment as weappRequestPayment } from '../../shared'
|
|
5
|
+
import Taro, { showToast } from '@tarojs/taro'
|
|
6
6
|
|
|
7
7
|
const requestPayment = (params: PaymentParams) => {
|
|
8
8
|
return new Promise<boolean>((resolve, reject) => {
|
|
@@ -39,7 +39,7 @@ const requestPaymentByBean = (params: PaymentParams, Appcode = '') => {
|
|
|
39
39
|
})
|
|
40
40
|
.then((response: any) => {
|
|
41
41
|
if (!response.json) {
|
|
42
|
-
|
|
42
|
+
showToast({
|
|
43
43
|
title: response.message,
|
|
44
44
|
icon: 'none',
|
|
45
45
|
})
|
|
@@ -57,10 +57,40 @@ const requestPaymentByBean = (params: PaymentParams, Appcode = '') => {
|
|
|
57
57
|
})
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
const requestBrandWCPay = (params: PaymentParams, Appcode = '') => {
|
|
61
|
+
return new Promise<boolean>((resolve, reject) => {
|
|
62
|
+
const $http = useHttp({
|
|
63
|
+
Appcode: Appcode,
|
|
64
|
+
Tenant: params.tenant,
|
|
65
|
+
})
|
|
66
|
+
$http
|
|
67
|
+
.post(endpoints.获取微信支付参数包, {
|
|
68
|
+
...params,
|
|
69
|
+
})
|
|
70
|
+
.then((response: any) => {
|
|
71
|
+
if (!response.json) {
|
|
72
|
+
showToast({
|
|
73
|
+
title: response.message,
|
|
74
|
+
icon: 'none',
|
|
75
|
+
})
|
|
76
|
+
resolve(false)
|
|
77
|
+
} else {
|
|
78
|
+
requestWxH5Pay(response.json).then((result) => {
|
|
79
|
+
if (result) {
|
|
80
|
+
resolve(true)
|
|
81
|
+
} else {
|
|
82
|
+
resolve(false)
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
60
90
|
export default {
|
|
61
91
|
install($app: DollarApp) {
|
|
62
92
|
$app.requestPayment = requestPayment
|
|
63
93
|
},
|
|
64
94
|
}
|
|
65
95
|
|
|
66
|
-
export { requestPayment, requestPaymentByBean }
|
|
96
|
+
export { requestPayment, requestPaymentByBean, requestBrandWCPay }
|
package/src/payment/types.ts
CHANGED
|
@@ -2,11 +2,11 @@ export type PaymentParams = {
|
|
|
2
2
|
/**
|
|
3
3
|
* 支付金额
|
|
4
4
|
*/
|
|
5
|
-
amount?: number
|
|
5
|
+
amount?: number
|
|
6
6
|
/**
|
|
7
7
|
* 应用
|
|
8
8
|
*/
|
|
9
|
-
app: string
|
|
9
|
+
app: string
|
|
10
10
|
/**
|
|
11
11
|
* 支付场景
|
|
12
12
|
*/
|
|
@@ -14,16 +14,18 @@ export type PaymentParams = {
|
|
|
14
14
|
/**
|
|
15
15
|
* 租户
|
|
16
16
|
*/
|
|
17
|
-
tenant: string
|
|
17
|
+
tenant: string
|
|
18
18
|
/**
|
|
19
19
|
* 支付用户(微信登录的凭证 code)
|
|
20
20
|
*/
|
|
21
|
-
user
|
|
22
|
-
caseConfigId?: string,
|
|
21
|
+
user?: string
|
|
23
22
|
/**
|
|
24
23
|
* 权益ID
|
|
25
24
|
*/
|
|
26
|
-
|
|
25
|
+
caseConfigId?: string
|
|
26
|
+
accountAuthFlag?: boolean
|
|
27
|
+
channelCode?: string
|
|
28
|
+
payFinishJumpUrl?: string
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
export type RechargeParams = Pick<PaymentParams, 'app' | 'tenant'>
|
|
31
|
+
export type RechargeParams = Pick<PaymentParams, 'app' | 'tenant'>
|
|
@@ -3,7 +3,7 @@ import { reactive } from 'vue'
|
|
|
3
3
|
import OcrIcon from '../../shared/components/OcrIcon.vue'
|
|
4
4
|
import DdArea from './../../components/dd-area/index.vue'
|
|
5
5
|
import DdSelector from './../../components/dd-selector/index.vue'
|
|
6
|
-
import Taro from '@tarojs/taro'
|
|
6
|
+
import Taro, { showToast } from '@tarojs/taro'
|
|
7
7
|
|
|
8
8
|
const props = withDefaults(
|
|
9
9
|
defineProps<{
|
|
@@ -53,7 +53,7 @@ function onOCRInfo(payload: any) {
|
|
|
53
53
|
|
|
54
54
|
function showVerifyToast(tip: string, duration = 1500) {
|
|
55
55
|
if (!tip) return
|
|
56
|
-
|
|
56
|
+
showToast({
|
|
57
57
|
title: tip,
|
|
58
58
|
icon: 'none',
|
|
59
59
|
duration,
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<nut-popup
|
|
3
|
-
:pop-class="`app-drawer ${modelValue ? 'open' : ''}`"
|
|
4
|
-
position="right"
|
|
5
|
-
:visible="modelValue"
|
|
2
|
+
<nut-popup :pop-class="`app-drawer ${modelValue ? 'open' : ''}`" position="right" :visible="modelValue"
|
|
6
3
|
@update:visible="onVisibleChange">
|
|
7
|
-
<page-header
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<slot></slot>
|
|
12
|
-
</div>
|
|
4
|
+
<page-header :title="title" :style="Taro.getEnv() !== 'WEB' ? '' : '--height: 40px'" @close="onPageHeaderClose" />
|
|
5
|
+
<div class="drawer-body">
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</div>
|
|
13
8
|
</nut-popup>
|
|
14
9
|
</template>
|
|
15
10
|
|
|
16
11
|
<script lang="ts" setup>
|
|
12
|
+
import Taro from '@tarojs/taro'
|
|
13
|
+
|
|
17
14
|
// 右侧页面
|
|
18
15
|
// 模仿页面打开
|
|
19
16
|
// 假的标题栏和返回按钮
|
|
@@ -44,9 +41,11 @@ const onPageHeaderClose = () => {
|
|
|
44
41
|
position: absolute;
|
|
45
42
|
display: flex;
|
|
46
43
|
flex-direction: column;
|
|
44
|
+
|
|
47
45
|
&.open {
|
|
48
46
|
height: 100vh;
|
|
49
47
|
}
|
|
48
|
+
|
|
50
49
|
.drawer-body {
|
|
51
50
|
flex-grow: 1;
|
|
52
51
|
overflow: scroll;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts" setup>
|
|
8
|
-
import Taro from '@tarojs/taro';
|
|
8
|
+
import Taro, { showToast, showLoading, hideLoading, uploadFile } from '@tarojs/taro';
|
|
9
9
|
import { NsIcon } from '@uxda/nutshell/taro';
|
|
10
10
|
import { useAppKitOptions } from '../../Appkit';
|
|
11
11
|
|
|
@@ -31,13 +31,13 @@ async function taroImgCompress(src: string, quality = 80) {
|
|
|
31
31
|
src: src,
|
|
32
32
|
quality: quality,
|
|
33
33
|
success: (res) => {
|
|
34
|
-
resolve(res)
|
|
34
|
+
resolve(res)
|
|
35
35
|
},
|
|
36
36
|
fail: (res) => {
|
|
37
|
-
reject(res)
|
|
37
|
+
reject(res)
|
|
38
38
|
},
|
|
39
|
-
})
|
|
40
|
-
})
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function getCompressQuality(size: number) {
|
|
@@ -60,17 +60,24 @@ async function onIconClick() {
|
|
|
60
60
|
console.log('===onIconClick');
|
|
61
61
|
let result: OcrResult | null = null;
|
|
62
62
|
try {
|
|
63
|
-
const csRes = await Taro.
|
|
63
|
+
const csRes = await Taro.chooseMedia({
|
|
64
64
|
count: 1,
|
|
65
|
+
sourceType: ['album', 'camera']
|
|
65
66
|
});
|
|
66
|
-
let {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
let { size, tempFilePath } = csRes.tempFiles[0];
|
|
68
|
+
let filePath
|
|
69
|
+
if (Taro.getEnv() !== 'WEB') {
|
|
70
|
+
const compressImg: any = (await taroImgCompress(tempFilePath, getCompressQuality(size))) || {}
|
|
71
|
+
filePath = compressImg.tempFilePath
|
|
72
|
+
} else {
|
|
73
|
+
filePath = tempFilePath
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
showLoading({ title: '营业执照识别中..' });
|
|
77
|
+
|
|
71
78
|
const session = appKitOptions.token();
|
|
72
79
|
const baseUrl = appKitOptions.baseUrl();
|
|
73
|
-
const upRes: any = await
|
|
80
|
+
const upRes: any = await uploadFile({
|
|
74
81
|
url: baseUrl + '/promoact/common/parseBusinessLicense',
|
|
75
82
|
filePath,
|
|
76
83
|
name: 'file',
|
|
@@ -81,7 +88,7 @@ async function onIconClick() {
|
|
|
81
88
|
token: session || '',
|
|
82
89
|
},
|
|
83
90
|
});
|
|
84
|
-
|
|
91
|
+
hideLoading();
|
|
85
92
|
const res = JSON.parse(upRes.data);
|
|
86
93
|
if (res.code === '200') {
|
|
87
94
|
const faceInfo = res.result || {};
|
|
@@ -95,16 +102,16 @@ async function onIconClick() {
|
|
|
95
102
|
};
|
|
96
103
|
console.log('===识别', result);
|
|
97
104
|
if (!result.companyName && !result.idCardNo) {
|
|
98
|
-
|
|
105
|
+
showToast({ title: '识别失败,请重试', icon: 'none' });
|
|
99
106
|
}
|
|
100
107
|
} else {
|
|
101
|
-
|
|
108
|
+
showToast({
|
|
102
109
|
title: res.msg,
|
|
103
110
|
icon: 'error',
|
|
104
111
|
});
|
|
105
112
|
}
|
|
106
113
|
} catch (err) {
|
|
107
|
-
|
|
114
|
+
hideLoading();
|
|
108
115
|
console.log(err);
|
|
109
116
|
}
|
|
110
117
|
emits('complete', result);
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script lang="ts" setup>
|
|
13
|
-
import Taro from '@tarojs/taro'
|
|
13
|
+
import Taro, { showToast, showLoading, hideLoading, chooseMedia, chooseMessageFile, uploadFile } from '@tarojs/taro'
|
|
14
14
|
import { NsIcon } from '@uxda/nutshell/taro'
|
|
15
15
|
import { useAppKitOptions } from '../../Appkit'
|
|
16
16
|
import { ref } from 'vue';
|
|
@@ -50,18 +50,22 @@ type OcrResultType = {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
async function taroImgCompress(src: string, quality = 80) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
if (Taro.getEnv() === 'WEB') {
|
|
54
|
+
return src;
|
|
55
|
+
} else {
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
Taro.compressImage({
|
|
58
|
+
src: src,
|
|
59
|
+
quality: quality,
|
|
60
|
+
success: (res) => {
|
|
61
|
+
resolve(res)
|
|
62
|
+
},
|
|
63
|
+
fail: (res) => {
|
|
64
|
+
reject(res)
|
|
65
|
+
},
|
|
66
|
+
})
|
|
63
67
|
})
|
|
64
|
-
}
|
|
68
|
+
}
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
function getCompressQuality(size: number) {
|
|
@@ -80,14 +84,22 @@ function allTrim(str: string) {
|
|
|
80
84
|
async function onUploadFile(csRes: any) {
|
|
81
85
|
let result: OcrResultType | null = null
|
|
82
86
|
try {
|
|
87
|
+
console.log('===上传', csRes)
|
|
83
88
|
let { path, size, tempFilePath } = csRes.tempFiles[0]
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
let filePath
|
|
90
|
+
if (Taro.getEnv() !== 'WEB') {
|
|
91
|
+
const compressImg: any = (await taroImgCompress(path || tempFilePath, getCompressQuality(size))) || {}
|
|
92
|
+
filePath = compressImg.tempFilePath || path
|
|
93
|
+
} else {
|
|
94
|
+
filePath = path || tempFilePath
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
console.log(filePath, 'filePath')
|
|
98
|
+
showLoading({ title: '身份证识别中..' })
|
|
87
99
|
|
|
88
100
|
const session = appKitOptions.token()
|
|
89
101
|
const baseUrl = appKitOptions.baseUrl()
|
|
90
|
-
const upRes: any = await
|
|
102
|
+
const upRes: any = await uploadFile({
|
|
91
103
|
url: baseUrl + '/hkapprove/ocr/idcard',
|
|
92
104
|
filePath,
|
|
93
105
|
name: 'file',
|
|
@@ -99,7 +111,7 @@ async function onUploadFile(csRes: any) {
|
|
|
99
111
|
token: session || '',
|
|
100
112
|
},
|
|
101
113
|
})
|
|
102
|
-
|
|
114
|
+
hideLoading()
|
|
103
115
|
|
|
104
116
|
const res = JSON.parse(upRes.data)
|
|
105
117
|
if (res.code === '200') {
|
|
@@ -119,19 +131,19 @@ async function onUploadFile(csRes: any) {
|
|
|
119
131
|
}
|
|
120
132
|
console.log('===识别', result)
|
|
121
133
|
if (props.side === 'face' && !result.faceInfo.name && !result.faceInfo.certNo) {
|
|
122
|
-
|
|
134
|
+
showToast({ title: '识别失败,请重试', icon: 'none' })
|
|
123
135
|
}
|
|
124
136
|
if (props.side === 'back' && !result.backInfo?.startDate && !result.backInfo?.endDate) {
|
|
125
|
-
|
|
137
|
+
showToast({ title: '识别失败,请重试', icon: 'none' })
|
|
126
138
|
}
|
|
127
139
|
} else {
|
|
128
|
-
|
|
140
|
+
showToast({
|
|
129
141
|
title: res.msg,
|
|
130
142
|
icon: 'error',
|
|
131
143
|
})
|
|
132
144
|
}
|
|
133
145
|
} catch (err) {
|
|
134
|
-
|
|
146
|
+
hideLoading()
|
|
135
147
|
console.log(err)
|
|
136
148
|
}
|
|
137
149
|
emits('complete', result)
|
|
@@ -154,10 +166,14 @@ const actionSheetMenus = [
|
|
|
154
166
|
type: 'message',
|
|
155
167
|
},
|
|
156
168
|
]
|
|
169
|
+
if (Taro.getEnv() === 'WEB') {
|
|
170
|
+
actionSheetMenus.pop()
|
|
171
|
+
}
|
|
172
|
+
|
|
157
173
|
// 选择图像上传
|
|
158
174
|
async function chooseImages(item: any) {
|
|
159
175
|
if (['camera', 'album'].includes(item.type)) {
|
|
160
|
-
const csRes = await
|
|
176
|
+
const csRes = await chooseMedia({
|
|
161
177
|
count: 1,
|
|
162
178
|
sourceType: [item.type], // "camera" | "album"
|
|
163
179
|
maxDuration: 60, // 使用duration属性判断是图片还是视频,图片没有该属性
|
|
@@ -165,7 +181,7 @@ async function chooseImages(item: any) {
|
|
|
165
181
|
|
|
166
182
|
onUploadFile(csRes)
|
|
167
183
|
} else {
|
|
168
|
-
const csRes = await
|
|
184
|
+
const csRes = await chooseMessageFile({
|
|
169
185
|
count: 1,
|
|
170
186
|
type: 'image',
|
|
171
187
|
})
|
package/src/shared/index.ts
CHANGED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { DollarApp } from '../../Appkit'
|
|
2
|
+
import { useHttp } from '../../payment/api'
|
|
3
|
+
|
|
4
|
+
interface JssdkConfig {
|
|
5
|
+
appId: string
|
|
6
|
+
nonceStr: string
|
|
7
|
+
signature: string
|
|
8
|
+
timeTicket: string
|
|
9
|
+
timestamp: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface PrePayOptions {
|
|
13
|
+
appId: string
|
|
14
|
+
nonceStr: string
|
|
15
|
+
package: string
|
|
16
|
+
paySign: string
|
|
17
|
+
signType: string
|
|
18
|
+
timeStamp: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* jssdk 初始化配置
|
|
23
|
+
* @param appCode
|
|
24
|
+
*/
|
|
25
|
+
const getSdkConfig = (appCode?: string): Promise<JssdkConfig> => {
|
|
26
|
+
return new Promise<JssdkConfig>((resolve, reject) => {
|
|
27
|
+
const $http = useHttp()
|
|
28
|
+
|
|
29
|
+
$http
|
|
30
|
+
.get('/wecom/config/getConfig', {
|
|
31
|
+
appCode: appCode || 'loankitMp',
|
|
32
|
+
callbackUrl: location.href,
|
|
33
|
+
})
|
|
34
|
+
.then((response: JssdkConfig) => {
|
|
35
|
+
resolve(response)
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 唤起微信支付
|
|
42
|
+
* @param options
|
|
43
|
+
*/
|
|
44
|
+
function requestWxH5Pay(options: PrePayOptions) {
|
|
45
|
+
return new Promise<boolean>((resolve, reject) => {
|
|
46
|
+
function onBridgeReady() {
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
WeixinJSBridge.invoke(
|
|
49
|
+
'getBrandWCPayRequest',
|
|
50
|
+
{
|
|
51
|
+
appId: options.appId,
|
|
52
|
+
nonceStr: options.nonceStr,
|
|
53
|
+
package: options.package,
|
|
54
|
+
paySign: options.paySign,
|
|
55
|
+
signType: options.signType,
|
|
56
|
+
timeStamp: options.timeStamp,
|
|
57
|
+
},
|
|
58
|
+
function (res) {
|
|
59
|
+
console.log(res, 'res')
|
|
60
|
+
if (res.err_msg == 'get_brand_wcpay_request:ok') {
|
|
61
|
+
resolve(res)
|
|
62
|
+
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠,商户需进一步调用后端查单确认支付结果。
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
if (typeof WeixinJSBridge == 'undefined') {
|
|
69
|
+
if (document.addEventListener) {
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false)
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
} else if (document.attachEvent) {
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
document.attachEvent('WeixinJSBridgeReady', onBridgeReady)
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady)
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
onBridgeReady()
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default {
|
|
86
|
+
install($app: DollarApp) {
|
|
87
|
+
$app.getSdkConfig = getSdkConfig
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { getSdkConfig, requestWxH5Pay }
|
package/src/user/api/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Taro, { request as TaroRequest } from '@tarojs/taro'
|
|
1
|
+
import Taro, { request as TaroRequest, showToast } from '@tarojs/taro'
|
|
2
2
|
import { HttpRequestConfig, PagingData, PagingParams, ResponseRaw, createHttp } from '../../shared'
|
|
3
3
|
import { translates, transforms } from './endpoints'
|
|
4
4
|
import { useAppKitOptions } from '../../Appkit'
|
|
@@ -32,7 +32,7 @@ const vendor = {
|
|
|
32
32
|
data: data.result as T,
|
|
33
33
|
})
|
|
34
34
|
} else if (data.code !== '401') {
|
|
35
|
-
|
|
35
|
+
showToast({
|
|
36
36
|
title: data.msg,
|
|
37
37
|
icon: 'none',
|
|
38
38
|
})
|
|
@@ -80,7 +80,7 @@ function useHttp() {
|
|
|
80
80
|
},
|
|
81
81
|
(raw) => {
|
|
82
82
|
if (raw.status > 500 && raw.status != 51015 && raw.status != 51014) {
|
|
83
|
-
|
|
83
|
+
showToast({
|
|
84
84
|
title: raw.message,
|
|
85
85
|
icon: 'none',
|
|
86
86
|
})
|
|
@@ -3,76 +3,39 @@
|
|
|
3
3
|
<ns-page-content>
|
|
4
4
|
<ns-card fill="#fff">
|
|
5
5
|
<ns-form ref="formRef" v-model="formData">
|
|
6
|
-
<ns-input
|
|
7
|
-
|
|
8
|
-
name="姓名"
|
|
9
|
-
v-model="formData.姓名"
|
|
10
|
-
placeholder="请输入或拍照识别"
|
|
11
|
-
:maxlength="30"
|
|
12
|
-
:disabled="已认证"
|
|
13
|
-
:rules="['required']"
|
|
14
|
-
>
|
|
6
|
+
<ns-input label="你的姓名" name="姓名" v-model="formData.姓名" placeholder="请输入或拍照识别" :maxlength="30" :disabled="已认证"
|
|
7
|
+
:rules="['required']">
|
|
15
8
|
<template #append>
|
|
16
9
|
<ocr-icon v-if="!已认证" @complete="onOcrComplete" />
|
|
17
10
|
</template>
|
|
18
11
|
</ns-input>
|
|
19
|
-
<ns-input
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
label="电话号码"
|
|
37
|
-
name="电话号码"
|
|
38
|
-
placeholder="请输入电话号码"
|
|
39
|
-
:maxlength="11"
|
|
40
|
-
v-model="formData.电话号码"
|
|
41
|
-
:disabled="true"
|
|
42
|
-
:rules="[
|
|
43
|
-
{
|
|
44
|
-
name: 'function',
|
|
45
|
-
message: '请输入正确格式的电话号码',
|
|
46
|
-
method: (value: string) => isMobilePhone(value, 'zh-CN')
|
|
47
|
-
}
|
|
48
|
-
]"
|
|
49
|
-
/>
|
|
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
|
+
]" />
|
|
50
29
|
</ns-form>
|
|
51
30
|
</ns-card>
|
|
52
31
|
|
|
53
32
|
<div class="user-auth-footer">
|
|
54
33
|
<div v-if="!已认证" class="checkbox-row">
|
|
55
|
-
<ns-checkbox style="font-size: 11px" v-model="formData.同意"
|
|
56
|
-
>我已阅读并同意</ns-checkbox
|
|
57
|
-
>
|
|
34
|
+
<ns-checkbox style="font-size: 11px" v-model="formData.同意">我已阅读并同意</ns-checkbox>
|
|
58
35
|
<span @click="showAgreement" class="book">《个人信息授权协议》</span>
|
|
59
36
|
</div>
|
|
60
|
-
<ns-button
|
|
61
|
-
|
|
62
|
-
class="btn"
|
|
63
|
-
color="#163391"
|
|
64
|
-
type="primary"
|
|
65
|
-
@click="toSubmit"
|
|
66
|
-
>立即认证</ns-button
|
|
67
|
-
>
|
|
68
|
-
<ns-button
|
|
69
|
-
v-else
|
|
70
|
-
class="btn"
|
|
71
|
-
color="#163391"
|
|
72
|
-
type="primary"
|
|
73
|
-
@click="toBack"
|
|
74
|
-
>返回</ns-button
|
|
75
|
-
>
|
|
37
|
+
<ns-button v-if="!已认证" class="btn" color="#163391" type="primary" @click="toSubmit">立即认证</ns-button>
|
|
38
|
+
<ns-button v-else class="btn" color="#163391" type="primary" @click="toBack">返回</ns-button>
|
|
76
39
|
</div>
|
|
77
40
|
</ns-page-content>
|
|
78
41
|
</ns-page>
|
|
@@ -90,7 +53,7 @@ import {
|
|
|
90
53
|
NsCheckbox,
|
|
91
54
|
} from "@uxda/nutshell/taro";
|
|
92
55
|
import { OcrIcon } from "../../shared/components";
|
|
93
|
-
import Taro from "@tarojs/taro";
|
|
56
|
+
import Taro, { showToast } from "@tarojs/taro";
|
|
94
57
|
import { useNutshell } from "@uxda/nutshell/taro";
|
|
95
58
|
import isMobilePhone from "validator/es/lib/isMobilePhone";
|
|
96
59
|
import isIdentityCard from "validator/es/lib/isIdentityCard";
|
|
@@ -158,17 +121,17 @@ async function toSubmit() {
|
|
|
158
121
|
})
|
|
159
122
|
.then((res: any) => {
|
|
160
123
|
if (res?.status) {
|
|
161
|
-
|
|
124
|
+
showToast({ title: "已提交认证信息", icon: "none" });
|
|
162
125
|
// 提交认证信息,成功后返回
|
|
163
126
|
setTimeout(() => {
|
|
164
127
|
toBack();
|
|
165
128
|
}, 500);
|
|
166
129
|
} else {
|
|
167
|
-
|
|
130
|
+
showToast({ title: "认证失败", icon: "none" });
|
|
168
131
|
}
|
|
169
132
|
})
|
|
170
133
|
.catch((err) => {
|
|
171
|
-
|
|
134
|
+
showToast({ title: err?.errMsg || "认证失败", icon: "none" });
|
|
172
135
|
});
|
|
173
136
|
}
|
|
174
137
|
watch(
|