@uxda/appkit 1.2.60 → 1.2.62
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/index.js +25 -24
- package/package.json +1 -1
- package/src/balance/components/AccountView.vue +2 -2
- package/src/components/dd-area/index.vue +52 -49
- package/src/components/dd-selector/index.vue +13 -13
- package/src/components/ocr-id/index.vue +15 -12
- package/src/notice/components/NoticeBanner.vue +4 -2
- package/src/shared/http/Http.ts +70 -61
package/dist/index.js
CHANGED
|
@@ -554,9 +554,9 @@ const request = (config) => {
|
|
|
554
554
|
...config
|
|
555
555
|
};
|
|
556
556
|
return new Promise((resolve, reject) => {
|
|
557
|
-
const data = config.data && clientConfig.translates && clientConfig.translates[c.url] ? clientConfig.translates[c.url]
|
|
557
|
+
const data = config.data && clientConfig.translates && clientConfig.translates[c.url] ? clientConfig.translates[c.url](c.data || {}) : c.data;
|
|
558
558
|
console.log(`[][][][][]HTTP.${c.method}, ${c.baseUrl}${c.url}`, data);
|
|
559
|
-
clientConfig.vendor
|
|
559
|
+
clientConfig.vendor && clientConfig.vendor.request({
|
|
560
560
|
url: `${c.baseUrl}${c.url}`,
|
|
561
561
|
data,
|
|
562
562
|
headers: c.headers,
|
|
@@ -570,8 +570,8 @@ const request = (config) => {
|
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
if (raw.data) {
|
|
573
|
-
const response = clientConfig.transforms && clientConfig.transforms[c.url] ? clientConfig.transforms[c.url]
|
|
574
|
-
const paging = config.data
|
|
573
|
+
const response = clientConfig.transforms && clientConfig.transforms[c.url] ? clientConfig.transforms[c.url](raw.data) : raw.data;
|
|
574
|
+
const paging = config.data.page ? clientConfig.paging.transform(raw.data) : void 0;
|
|
575
575
|
resolve(
|
|
576
576
|
paging ? {
|
|
577
577
|
...paging,
|
|
@@ -602,9 +602,7 @@ const post = (url, data) => {
|
|
|
602
602
|
};
|
|
603
603
|
const defaultClientConfig = {
|
|
604
604
|
baseUrl: "/",
|
|
605
|
-
interceptors: [
|
|
606
|
-
(raw) => raw.status == 401
|
|
607
|
-
]
|
|
605
|
+
interceptors: [(raw) => raw.status == 401]
|
|
608
606
|
};
|
|
609
607
|
let clientConfig = {
|
|
610
608
|
...defaultClientConfig
|
|
@@ -2140,8 +2138,8 @@ var script$9 = /* @__PURE__ */ defineComponent({
|
|
|
2140
2138
|
datePickerOpen.value = true;
|
|
2141
2139
|
}
|
|
2142
2140
|
const dateRangeDisplay = computed(() => {
|
|
2143
|
-
let startTime = filtering.dateFrom
|
|
2144
|
-
let endTime = filtering.dateTo
|
|
2141
|
+
let startTime = (filtering.dateFrom || "").replace(/-/g, ".").substring(2);
|
|
2142
|
+
let endTime = (filtering.dateTo || "").replace(/-/g, ".").substring(2);
|
|
2145
2143
|
return startTime + " - " + endTime;
|
|
2146
2144
|
});
|
|
2147
2145
|
const consumptionGroups = ref([]);
|
|
@@ -2738,8 +2736,8 @@ var script$7 = /* @__PURE__ */ defineComponent({
|
|
|
2738
2736
|
count: 1
|
|
2739
2737
|
});
|
|
2740
2738
|
let { path, size } = csRes.tempFiles[0];
|
|
2741
|
-
const compressImg = await taroImgCompress(path, getCompressQuality(size));
|
|
2742
|
-
const filePath = compressImg
|
|
2739
|
+
const compressImg = await taroImgCompress(path, getCompressQuality(size)) || {};
|
|
2740
|
+
const filePath = compressImg.tempFilePath ?? path;
|
|
2743
2741
|
Taro.showLoading({ title: "\u8EAB\u4EFD\u8BC1\u8BC6\u522B\u4E2D.." });
|
|
2744
2742
|
const session = appKitOptions.token();
|
|
2745
2743
|
const baseUrl = appKitOptions.baseUrl();
|
|
@@ -2759,13 +2757,14 @@ var script$7 = /* @__PURE__ */ defineComponent({
|
|
|
2759
2757
|
Taro.hideLoading();
|
|
2760
2758
|
const res = JSON.parse(upRes.data);
|
|
2761
2759
|
if (res.code === "200") {
|
|
2760
|
+
const faceInfo = res.result.faceInfo || {};
|
|
2762
2761
|
ocrResult = {
|
|
2763
2762
|
faceInfo: {
|
|
2764
|
-
name: allTrim(
|
|
2765
|
-
certNo: allTrim(
|
|
2766
|
-
address: allTrim(
|
|
2763
|
+
name: allTrim(faceInfo.name || ""),
|
|
2764
|
+
certNo: allTrim(faceInfo.num || ""),
|
|
2765
|
+
address: allTrim(faceInfo.address || "")
|
|
2767
2766
|
},
|
|
2768
|
-
fileUploadVO: res.result
|
|
2767
|
+
fileUploadVO: res.result.fileUploadVO || {}
|
|
2769
2768
|
};
|
|
2770
2769
|
if (!ocrResult.faceInfo.name && !ocrResult.faceInfo.certNo) {
|
|
2771
2770
|
Taro.showToast({ title: "\u8BC6\u522B\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5", icon: "none" });
|
|
@@ -2871,11 +2870,11 @@ var script$5 = /* @__PURE__ */ defineComponent({
|
|
|
2871
2870
|
value: province.id,
|
|
2872
2871
|
shortId: provinceShortId,
|
|
2873
2872
|
label: province.name,
|
|
2874
|
-
children: map.get(provinceShortId)
|
|
2873
|
+
children: (map.get(provinceShortId) || []).map((city) => ({
|
|
2875
2874
|
value: city.id,
|
|
2876
2875
|
shortId: city.shortId,
|
|
2877
2876
|
label: city.name,
|
|
2878
|
-
children: map.get(city.shortId)
|
|
2877
|
+
children: (map.get(city.shortId) || []).map((region) => ({
|
|
2879
2878
|
value: region.id,
|
|
2880
2879
|
shortId: region.shortId,
|
|
2881
2880
|
label: region.name,
|
|
@@ -2893,11 +2892,11 @@ var script$5 = /* @__PURE__ */ defineComponent({
|
|
|
2893
2892
|
if (props.type === "province") {
|
|
2894
2893
|
return [provinceOption];
|
|
2895
2894
|
}
|
|
2896
|
-
const cityOption = provinceOption[tmpSelectedIndex.value[0]]
|
|
2895
|
+
const cityOption = (provinceOption[tmpSelectedIndex.value[0]] || {}).children ?? [];
|
|
2897
2896
|
if (props.type === "city") {
|
|
2898
2897
|
return [provinceOption, cityOption];
|
|
2899
2898
|
}
|
|
2900
|
-
const regionOption = cityOption[tmpSelectedIndex.value[1]]
|
|
2899
|
+
const regionOption = (cityOption[tmpSelectedIndex.value[1]] || {}).children ?? [];
|
|
2901
2900
|
return [provinceOption, cityOption, regionOption];
|
|
2902
2901
|
});
|
|
2903
2902
|
function init() {
|
|
@@ -2906,7 +2905,7 @@ var script$5 = /* @__PURE__ */ defineComponent({
|
|
|
2906
2905
|
if (props.value) {
|
|
2907
2906
|
const items = [];
|
|
2908
2907
|
for (let index = 0; index < options.value.length; index++) {
|
|
2909
|
-
const item = options.value[index]
|
|
2908
|
+
const item = (options.value[index] || {})[selectedIndex.value[index]];
|
|
2910
2909
|
if (item) {
|
|
2911
2910
|
items.push(item);
|
|
2912
2911
|
}
|
|
@@ -2947,7 +2946,7 @@ var script$5 = /* @__PURE__ */ defineComponent({
|
|
|
2947
2946
|
labels: []
|
|
2948
2947
|
};
|
|
2949
2948
|
for (let index = 0; index <= lastSelectedIndex; index++) {
|
|
2950
|
-
const item = options.value[index]
|
|
2949
|
+
const item = (options.value[index] || {})[tmpSelectedIndex.value[index]];
|
|
2951
2950
|
if (item) {
|
|
2952
2951
|
result.values.push(item.value);
|
|
2953
2952
|
result.labels.push(item.label);
|
|
@@ -3065,7 +3064,7 @@ var script$4 = /* @__PURE__ */ defineComponent({
|
|
|
3065
3064
|
);
|
|
3066
3065
|
function init() {
|
|
3067
3066
|
currentIndex.value = findIndexByValue(props.value);
|
|
3068
|
-
currentLabel.value = currentIndex.value >= 0 ? props.options[currentIndex.value]
|
|
3067
|
+
currentLabel.value = currentIndex.value >= 0 ? (props.options[currentIndex.value] || {}).label : "";
|
|
3069
3068
|
}
|
|
3070
3069
|
return (_ctx, _cache) => {
|
|
3071
3070
|
const _component_picker = resolveComponent("picker");
|
|
@@ -3681,8 +3680,10 @@ var script$1 = /* @__PURE__ */ defineComponent({
|
|
|
3681
3680
|
appCode: props.app || appkitOptions.app(),
|
|
3682
3681
|
tenantId: appkitOptions.tenant()
|
|
3683
3682
|
}).then((result) => {
|
|
3684
|
-
|
|
3685
|
-
|
|
3683
|
+
if (!Array.isArray(result))
|
|
3684
|
+
return;
|
|
3685
|
+
bannerMessages.value = result.filter((item) => item.noticeType !== void 0);
|
|
3686
|
+
popMessages.value = result.filter((item) => item.isPop);
|
|
3686
3687
|
startMessageCarousel();
|
|
3687
3688
|
});
|
|
3688
3689
|
}
|
package/package.json
CHANGED
|
@@ -228,8 +228,8 @@ function openDateFilter() {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
const dateRangeDisplay = computed(() => {
|
|
231
|
-
let startTime = filtering.dateFrom
|
|
232
|
-
let endTime = filtering.dateTo
|
|
231
|
+
let startTime = (filtering.dateFrom || '').replace(/-/g, '.').substring(2)
|
|
232
|
+
let endTime = (filtering.dateTo || '').replace(/-/g, '.').substring(2)
|
|
233
233
|
return startTime + ' - ' + endTime
|
|
234
234
|
})
|
|
235
235
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<!--* UPDATE: 2022-02-21 17:43-->
|
|
4
4
|
<!--* TIP: 微信原生实现多列选择器-->
|
|
5
5
|
<script setup lang="ts">
|
|
6
|
-
import {computed, ref, watch} from 'vue'
|
|
6
|
+
import { computed, ref, watch } from 'vue'
|
|
7
7
|
import Taro from '@tarojs/taro'
|
|
8
8
|
import DdIcon from '../dd-icon/index.vue'
|
|
9
9
|
|
|
@@ -31,12 +31,12 @@ const props = withDefaults(defineProps<PropsType>(), {
|
|
|
31
31
|
placeholder: '请选择',
|
|
32
32
|
disabled: false,
|
|
33
33
|
type: 'region',
|
|
34
|
-
formatter: (values: AreaItem[]) => values.map((item:AreaItem) => item.label).join('')
|
|
34
|
+
formatter: (values: AreaItem[]) => values.map((item: AreaItem) => item.label).join(''),
|
|
35
35
|
})
|
|
36
36
|
const emit = defineEmits(['update:value', 'change', 'cancel'])
|
|
37
37
|
|
|
38
38
|
const areaFormatOptions = computed<AreaItem[]>(() => {
|
|
39
|
-
const {province_list, city_list, county_list} = JSON.parse(Taro.getStorageSync('wechat_area'))
|
|
39
|
+
const { province_list, city_list, county_list } = JSON.parse(Taro.getStorageSync('wechat_area'))
|
|
40
40
|
const map = new Map()
|
|
41
41
|
city_list.forEach((item: any) => {
|
|
42
42
|
const provinceShortId = item.id.slice(0, 2)
|
|
@@ -45,7 +45,7 @@ const areaFormatOptions = computed<AreaItem[]>(() => {
|
|
|
45
45
|
}
|
|
46
46
|
map.get(provinceShortId).push({
|
|
47
47
|
...item,
|
|
48
|
-
shortId: item.id.slice(0, 4)
|
|
48
|
+
shortId: item.id.slice(0, 4),
|
|
49
49
|
})
|
|
50
50
|
})
|
|
51
51
|
county_list.forEach((item: any) => {
|
|
@@ -55,7 +55,7 @@ const areaFormatOptions = computed<AreaItem[]>(() => {
|
|
|
55
55
|
}
|
|
56
56
|
map.get(cityShortId).push({
|
|
57
57
|
...item,
|
|
58
|
-
shortId: item.id
|
|
58
|
+
shortId: item.id,
|
|
59
59
|
})
|
|
60
60
|
})
|
|
61
61
|
return province_list.map((province: any) => {
|
|
@@ -64,17 +64,19 @@ const areaFormatOptions = computed<AreaItem[]>(() => {
|
|
|
64
64
|
value: province.id,
|
|
65
65
|
shortId: provinceShortId,
|
|
66
66
|
label: province.name,
|
|
67
|
-
children:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
children:
|
|
68
|
+
(map.get(provinceShortId) || []).map((city: any) => ({
|
|
69
|
+
value: city.id,
|
|
70
|
+
shortId: city.shortId,
|
|
71
|
+
label: city.name,
|
|
72
|
+
children:
|
|
73
|
+
(map.get(city.shortId) || []).map((region: any) => ({
|
|
74
|
+
value: region.id,
|
|
75
|
+
shortId: region.shortId,
|
|
76
|
+
label: region.name,
|
|
77
|
+
children: [],
|
|
78
|
+
})) ?? [],
|
|
76
79
|
})) ?? [],
|
|
77
|
-
})) ?? [],
|
|
78
80
|
}
|
|
79
81
|
})
|
|
80
82
|
})
|
|
@@ -88,11 +90,11 @@ const options = computed<AreaItem[][]>(() => {
|
|
|
88
90
|
if (props.type === 'province') {
|
|
89
91
|
return [provinceOption]
|
|
90
92
|
}
|
|
91
|
-
const cityOption = provinceOption[tmpSelectedIndex.value[0]]
|
|
93
|
+
const cityOption = (provinceOption[tmpSelectedIndex.value[0]] || {}).children ?? []
|
|
92
94
|
if (props.type === 'city') {
|
|
93
95
|
return [provinceOption, cityOption]
|
|
94
96
|
}
|
|
95
|
-
const regionOption = cityOption[tmpSelectedIndex.value[1]]
|
|
97
|
+
const regionOption = (cityOption[tmpSelectedIndex.value[1]] || {}).children ?? []
|
|
96
98
|
return [provinceOption, cityOption, regionOption]
|
|
97
99
|
})
|
|
98
100
|
|
|
@@ -100,10 +102,10 @@ function init() {
|
|
|
100
102
|
selectedIndex.value = findIndexByValue()
|
|
101
103
|
tmpSelectedIndex.value = [...selectedIndex.value]
|
|
102
104
|
if (props.value) {
|
|
103
|
-
const items = []
|
|
105
|
+
const items: any = []
|
|
104
106
|
for (let index = 0; index < options.value.length; index++) {
|
|
105
|
-
const item = options.value[index]
|
|
106
|
-
if (item){
|
|
107
|
+
const item = (options.value[index] || {})[selectedIndex.value[index]]
|
|
108
|
+
if (item) {
|
|
107
109
|
items.push(item)
|
|
108
110
|
}
|
|
109
111
|
}
|
|
@@ -140,18 +142,18 @@ function findIndexByValue() {
|
|
|
140
142
|
|
|
141
143
|
function onChange() {
|
|
142
144
|
const lastSelectedIndex = options.value.length - 1
|
|
143
|
-
const result = {
|
|
145
|
+
const result: any = {
|
|
144
146
|
values: [],
|
|
145
|
-
labels: []
|
|
147
|
+
labels: [],
|
|
146
148
|
}
|
|
147
149
|
for (let index = 0; index <= lastSelectedIndex; index++) {
|
|
148
|
-
|
|
149
|
-
if (item){
|
|
150
|
+
const item = (options.value[index] || {})[tmpSelectedIndex.value[index]]
|
|
151
|
+
if (item) {
|
|
150
152
|
result.values.push(item.value)
|
|
151
153
|
result.labels.push(item.label)
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
|
-
emit('update:value', result.values[result.values.length-1])
|
|
156
|
+
emit('update:value', result.values[result.values.length - 1])
|
|
155
157
|
emit('change', result)
|
|
156
158
|
console.log(result)
|
|
157
159
|
}
|
|
@@ -161,44 +163,45 @@ function onCancel(e: any) {
|
|
|
161
163
|
emit('cancel', e)
|
|
162
164
|
}
|
|
163
165
|
|
|
164
|
-
function onColumnChange({detail: {column, value}}) {
|
|
165
|
-
const resetIndex = Array.from({length: tmpSelectedIndex.value.length - column - 1
|
|
166
|
-
tmpSelectedIndex.value = [...tmpSelectedIndex.value.slice(0,column), value, ...resetIndex
|
|
166
|
+
function onColumnChange({ detail: { column, value } }) {
|
|
167
|
+
const resetIndex = Array.from({ length: tmpSelectedIndex.value.length - column - 1 }).fill(0)
|
|
168
|
+
tmpSelectedIndex.value = [...tmpSelectedIndex.value.slice(0, column), value, ...resetIndex]
|
|
167
169
|
console.log(tmpSelectedIndex.value)
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
watch(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
() => props.value,
|
|
174
|
+
() => {
|
|
175
|
+
init()
|
|
176
|
+
},
|
|
177
|
+
{ deep: true, immediate: true }
|
|
174
178
|
)
|
|
175
179
|
</script>
|
|
176
180
|
|
|
177
181
|
<template>
|
|
178
182
|
<picker
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
:range="options"
|
|
184
|
+
range-key="label"
|
|
185
|
+
:value="tmpSelectedIndex"
|
|
186
|
+
mode="multiSelector"
|
|
187
|
+
@columnchange="onColumnChange"
|
|
188
|
+
@change="onChange"
|
|
189
|
+
@cancel="onCancel"
|
|
190
|
+
style="flex: 1"
|
|
191
|
+
:disabled="props.disabled"
|
|
192
|
+
>
|
|
188
193
|
<div class="dd-area">
|
|
189
|
-
<div
|
|
190
|
-
:class="props.value && !props.disabled ? 'dd-area-value' : 'dd-area-label'">
|
|
194
|
+
<div :class="props.value && !props.disabled ? 'dd-area-value' : 'dd-area-label'">
|
|
191
195
|
{{ props.value ? props.formatter(selectedItem) : props.placeholder }}
|
|
192
196
|
</div>
|
|
193
197
|
<slot name="icon">
|
|
194
198
|
<DdIcon
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
class="icon-arrow"/>
|
|
199
|
+
v-if="props.rightIcon"
|
|
200
|
+
name="icon-arrow"
|
|
201
|
+
size="11px"
|
|
202
|
+
:color="props.value !== '' && !props.disabled ? '#353535' : '#DFDFDF'"
|
|
203
|
+
class="icon-arrow"
|
|
204
|
+
/>
|
|
202
205
|
</slot>
|
|
203
206
|
</div>
|
|
204
207
|
</picker>
|
|
@@ -29,7 +29,7 @@ const props = withDefaults(defineProps<PropsType>(), {
|
|
|
29
29
|
const currentIndex = ref<number>()
|
|
30
30
|
const currentLabel = ref<string>()
|
|
31
31
|
|
|
32
|
-
const emit = defineEmits(['update:value','change', 'cancel'])
|
|
32
|
+
const emit = defineEmits(['update:value', 'change', 'cancel'])
|
|
33
33
|
function onChange(e) {
|
|
34
34
|
const index = e.detail.value as number
|
|
35
35
|
const item = props.options[index]
|
|
@@ -43,7 +43,7 @@ function onChange(e) {
|
|
|
43
43
|
// 通过value查询item index
|
|
44
44
|
function findIndexByValue(value: string) {
|
|
45
45
|
if (value == undefined) return undefined
|
|
46
|
-
const index = props.options.findIndex((item: Option)=> item.value == value)
|
|
46
|
+
const index = props.options.findIndex((item: Option) => item.value == value)
|
|
47
47
|
return index >= 0 ? index : undefined
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -64,7 +64,8 @@ watch(
|
|
|
64
64
|
|
|
65
65
|
function init() {
|
|
66
66
|
currentIndex.value = findIndexByValue(props.value)
|
|
67
|
-
currentLabel.value =
|
|
67
|
+
currentLabel.value =
|
|
68
|
+
currentIndex.value >= 0 ? (props.options[currentIndex.value] || {}).label : ''
|
|
68
69
|
}
|
|
69
70
|
</script>
|
|
70
71
|
|
|
@@ -77,17 +78,17 @@ function init() {
|
|
|
77
78
|
@cancel="onCancel"
|
|
78
79
|
@change="onChange"
|
|
79
80
|
style="flex: 1"
|
|
80
|
-
:disabled="props.disabled"
|
|
81
|
+
:disabled="props.disabled"
|
|
82
|
+
>
|
|
81
83
|
<slot name="content">
|
|
82
84
|
<div class="dd-selector">
|
|
83
85
|
<div class="dd-selector-value">
|
|
84
86
|
<div
|
|
85
87
|
:class="
|
|
86
|
-
currentIndex >= 0 && !props.disabled
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{{ currentLabel || props.placeholder }}
|
|
88
|
+
currentIndex >= 0 && !props.disabled ? 'dd-selector-value' : 'dd-selector-label'
|
|
89
|
+
"
|
|
90
|
+
>
|
|
91
|
+
{{ currentLabel || props.placeholder }}
|
|
91
92
|
</div>
|
|
92
93
|
<div>
|
|
93
94
|
<slot name="tips"></slot>
|
|
@@ -98,10 +99,9 @@ function init() {
|
|
|
98
99
|
v-if="props.rightIcon"
|
|
99
100
|
name="icon-arrow"
|
|
100
101
|
size="11px"
|
|
101
|
-
:color="
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
class="icon-arrow" />
|
|
102
|
+
:color="currentIndex >= 0 && !props.disabled ? '#353535' : '#DFDFDF'"
|
|
103
|
+
class="icon-arrow"
|
|
104
|
+
/>
|
|
105
105
|
</slot>
|
|
106
106
|
</div>
|
|
107
107
|
</slot>
|
|
@@ -45,10 +45,10 @@ async function ocrIDCard() {
|
|
|
45
45
|
const csRes = await Taro.chooseImage({
|
|
46
46
|
count: 1,
|
|
47
47
|
})
|
|
48
|
-
let {path, size} = csRes.tempFiles[0]
|
|
49
|
-
const compressImg: any = (await taroImgCompress(path, getCompressQuality(size)))
|
|
50
|
-
const filePath = compressImg
|
|
51
|
-
Taro.showLoading({title: '身份证识别中..'
|
|
48
|
+
let { path, size } = csRes.tempFiles[0]
|
|
49
|
+
const compressImg: any = (await taroImgCompress(path, getCompressQuality(size))) || {}
|
|
50
|
+
const filePath = compressImg.tempFilePath ?? path
|
|
51
|
+
Taro.showLoading({ title: '身份证识别中..' })
|
|
52
52
|
const session = appKitOptions.token()
|
|
53
53
|
const baseUrl = appKitOptions.baseUrl()
|
|
54
54
|
const upRes: any = await Taro.uploadFile({
|
|
@@ -67,16 +67,17 @@ async function ocrIDCard() {
|
|
|
67
67
|
Taro.hideLoading()
|
|
68
68
|
const res = JSON.parse(upRes.data)
|
|
69
69
|
if (res.code === '200') {
|
|
70
|
+
const faceInfo = res.result.faceInfo || {}
|
|
70
71
|
ocrResult = {
|
|
71
72
|
faceInfo: {
|
|
72
|
-
name: allTrim(
|
|
73
|
-
certNo: allTrim(
|
|
74
|
-
address: allTrim(
|
|
73
|
+
name: allTrim(faceInfo.name || ''),
|
|
74
|
+
certNo: allTrim(faceInfo.num || ''),
|
|
75
|
+
address: allTrim(faceInfo.address || ''),
|
|
75
76
|
},
|
|
76
|
-
fileUploadVO: res.result
|
|
77
|
+
fileUploadVO: res.result.fileUploadVO || {},
|
|
77
78
|
}
|
|
78
79
|
if (!ocrResult.faceInfo.name && !ocrResult.faceInfo.certNo) {
|
|
79
|
-
Taro.showToast({title: '识别失败,请重试', icon: 'none'})
|
|
80
|
+
Taro.showToast({ title: '识别失败,请重试', icon: 'none' })
|
|
80
81
|
}
|
|
81
82
|
} else {
|
|
82
83
|
Taro.showToast({
|
|
@@ -95,17 +96,19 @@ async function ocrIDCard() {
|
|
|
95
96
|
<template>
|
|
96
97
|
<div class="ocr-id" @click="ocrIDCard">
|
|
97
98
|
<slot name="icon">
|
|
98
|
-
<img
|
|
99
|
+
<img
|
|
100
|
+
class="ocr-id__img"
|
|
101
|
+
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgZmlsbD0ibm9uZSI+PHBhdGggb3BhY2l0eT0iLjAxIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTQwIDB2NDBIMFYwaDQweiIgZmlsbD0iI0M0QzRDNCIvPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMzMuMDQ0IDE3LjM2M2MuOTYgMCAxLjczOS0uNzkgMS43MzktMS43NjYgMC0uOTc1LS43NzktMS43NjYtMS43NC0xLjc2Ni0uOTYgMC0xLjczOC43OS0xLjczOCAxLjc2NnMuNzc4IDEuNzY2IDEuNzM5IDEuNzY2eiIgZmlsbD0iIzRCQ0I5MyIvPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMCAzMS44MTJWMTQuNzg4YzAtMi4yNTggMi4wNDktNC4wOTcgNC41NjQtNC4wOTdoMy44NDRsMS4xMzYtMy42NThDOS44ODggNS45MTMgMTEuMjM3IDUgMTIuNTQ4IDVIMjcuNDVjMS4zOSAwIDIuNjguODc2IDMuMDEgMi4wNDRsMS4xMzMgMy42NDdoMy44NDRjMi41MTUgMCA0LjU2NCAxLjgzOSA0LjU2NCA0LjA5N3YxLjczOWMwIC41MDMtLjQ1NC45MS0xLjAxNC45MXMtMS4wMTQtLjQwNy0xLjAxNC0uOTF2LTEuNzRjMC0xLjI1My0xLjEzOS0yLjI3NS0yLjUzNi0yLjI3NWgtMy44NDRjLS45MDcgMC0xLjcxMS0uNTQ5LTEuOTU1LTEuMzMybC0xLjEzNi0zLjY2YS4zNDIuMzQyIDAgMCAwLS4wMDctLjAyNWMtLjExLS4zOTYtLjYzOS0uNjc0LTEuMDQ1LS42NzRoLTE0LjljLS4zOTkgMC0uOTUuMzY2LTEuMDUzLjY5OWwtMS4xMzYgMy42NmMtLjI0Ny43ODYtMS4wNDUgMS4zMy0xLjk1NSAxLjMzMkg0LjU2NGMtMS4zOTcgMC0yLjUzNiAxLjAyMi0yLjUzNiAyLjI3NnYxNy4wMjRjMCAxLjI1NCAxLjEzOSAyLjI3NiAyLjUzNiAyLjI3NmgzMC44N2MxLjM5NyAwIDIuNTM1LTEuMDIyIDIuNTM1LTIuMjc2VjIxLjU5NmMwLS41MDMuNDU0LS45MSAxLjAxNC0uOTFzMS4wMTUuNDA3IDEuMDE1LjkxVjMxLjgxYy0uMDAzIDIuMjYtMi4wNSA0LjEtNC41NjcgNC4xSDQuNTY0QzIuMDQ5IDM1LjkxIDAgMzQuMDcgMCAzMS44MTF6IiBmaWxsPSIjNEJDQjkzIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMi4xNzQgMjEuNzc4YzAtNC44NyAzLjcwNS04LjgzIDguMjYtOC44MyA0LjU1NiAwIDguMjYyIDMuOTYgOC4yNjIgOC44M3MtMy43MDYgOC44MzItOC4yNjEgOC44MzJjLTQuNTU2IDAtOC4yNjEtMy45NjItOC4yNjEtOC44MzJ6bTEuNzc5LjEzYzAgMy43OTYgMi45MDcgNi44ODMgNi40ODIgNi44ODMgMy41NzQgMCA2LjQ4MS0zLjA4NyA2LjQ4MS02Ljg4M3MtMi45MDctNi44ODMtNi40ODItNi44ODNjLTMuNTc0IDAtNi40ODEgMy4wODctNi40ODEgNi44ODN6IiBmaWxsPSIjNEJDQjkzIi8+PC9zdmc+"
|
|
102
|
+
/>
|
|
99
103
|
</slot>
|
|
100
104
|
</div>
|
|
101
105
|
</template>
|
|
102
106
|
|
|
103
107
|
<style lang="scss">
|
|
104
108
|
.ocr-id {
|
|
105
|
-
|
|
106
109
|
&__img {
|
|
107
110
|
width: 20px;
|
|
108
111
|
height: 20px;
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
|
-
</style>
|
|
114
|
+
</style>
|
|
@@ -95,8 +95,10 @@ async function queryNoticeMsg() {
|
|
|
95
95
|
tenantId: appkitOptions.tenant(),
|
|
96
96
|
})
|
|
97
97
|
.then((result) => {
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
if (!Array.isArray(result)) return
|
|
99
|
+
|
|
100
|
+
bannerMessages.value = result.filter((item: any) => item.noticeType !== undefined)
|
|
101
|
+
popMessages.value = result.filter((item: any) => item.isPop)
|
|
100
102
|
|
|
101
103
|
startMessageCarousel()
|
|
102
104
|
})
|
package/src/shared/http/Http.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
HttpInstance,
|
|
3
|
+
HttpClientConfig,
|
|
4
|
+
HttpMethod,
|
|
5
|
+
HttpRequestConfig,
|
|
6
|
+
RequestData,
|
|
7
|
+
ResponseData,
|
|
8
|
+
ResponseRaw,
|
|
9
|
+
Paging,
|
|
10
|
+
HttpTranslate,
|
|
11
|
+
} from './types'
|
|
5
12
|
/**
|
|
6
13
|
* Useage:
|
|
7
14
|
* const $http = createHttp({
|
|
@@ -23,56 +30,60 @@ const request: HttpInstance['request'] = <T>(config: HttpRequestConfig) => {
|
|
|
23
30
|
...config,
|
|
24
31
|
}
|
|
25
32
|
return new Promise<T>((resolve, reject) => {
|
|
26
|
-
const data =
|
|
27
|
-
&& clientConfig.translates
|
|
28
|
-
|
|
29
|
-
? clientConfig.translates[c.url]?.(c.data || {})
|
|
33
|
+
const data =
|
|
34
|
+
config.data && clientConfig.translates && clientConfig.translates[c.url]
|
|
35
|
+
? (clientConfig.translates[c.url] as HttpTranslate)(c.data || {})
|
|
30
36
|
: c.data
|
|
31
37
|
console.log(`[][][][][]HTTP.${c.method}, ${c.baseUrl}${c.url}`, data)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
38
|
+
|
|
39
|
+
clientConfig.vendor &&
|
|
40
|
+
clientConfig.vendor
|
|
41
|
+
.request({
|
|
42
|
+
url: `${c.baseUrl}${c.url}`,
|
|
43
|
+
data,
|
|
44
|
+
headers: c.headers,
|
|
45
|
+
method: c.method,
|
|
46
|
+
})
|
|
47
|
+
.then((raw: ResponseRaw) => {
|
|
48
|
+
// 按顺序执行拦截器
|
|
49
|
+
for (const interc of c.interceptors || []) {
|
|
50
|
+
const r = interc(raw)
|
|
51
|
+
if (r) {
|
|
52
|
+
// 某拦截器命中时
|
|
53
|
+
// 按拦截结果 决定是否继续执行
|
|
54
|
+
reject('===INTERCEPTED===' + raw.status)
|
|
55
|
+
return false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (raw.data) {
|
|
59
|
+
// 当用户配置含有 transforms 时, 使用用户提供的 transform
|
|
60
|
+
// 先 endpoints transform
|
|
61
|
+
// 再组装分页数据
|
|
62
|
+
const response =
|
|
63
|
+
clientConfig.transforms && clientConfig.transforms[c.url]
|
|
64
|
+
? ((clientConfig.transforms[c.url] as HttpTranslate)(raw.data) as T)
|
|
65
|
+
: (raw.data as T)
|
|
66
|
+
// 前端要求分页
|
|
67
|
+
// 在 endpoints transform 之前格式化分页数据
|
|
68
|
+
// 并拼装回原 raw 数据
|
|
69
|
+
const paging = (config.data as RequestData).page
|
|
70
|
+
? (clientConfig.paging as Paging).transform(raw.data)
|
|
71
|
+
: void 0
|
|
72
|
+
resolve(
|
|
73
|
+
paging
|
|
74
|
+
? ({
|
|
75
|
+
...paging,
|
|
76
|
+
data: response,
|
|
77
|
+
} as T)
|
|
78
|
+
: response
|
|
79
|
+
)
|
|
80
|
+
} else {
|
|
81
|
+
resolve(raw as any)
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
.catch((e: any) => {
|
|
85
|
+
console.log('request.catch===', e)
|
|
86
|
+
})
|
|
76
87
|
})
|
|
77
88
|
}
|
|
78
89
|
|
|
@@ -80,7 +91,7 @@ const get: HttpInstance['get'] = <T = ResponseData>(url: string, data?: RequestD
|
|
|
80
91
|
return request<T>({
|
|
81
92
|
url,
|
|
82
93
|
data,
|
|
83
|
-
method: HttpMethod.get
|
|
94
|
+
method: HttpMethod.get,
|
|
84
95
|
})
|
|
85
96
|
}
|
|
86
97
|
|
|
@@ -88,7 +99,7 @@ const post: HttpInstance['post'] = <T = ResponseData>(url: string, data: Request
|
|
|
88
99
|
return request<T>({
|
|
89
100
|
url,
|
|
90
101
|
data,
|
|
91
|
-
method: HttpMethod.post
|
|
102
|
+
method: HttpMethod.post,
|
|
92
103
|
})
|
|
93
104
|
}
|
|
94
105
|
|
|
@@ -98,13 +109,11 @@ const post: HttpInstance['post'] = <T = ResponseData>(url: string, data: Request
|
|
|
98
109
|
*/
|
|
99
110
|
const defaultClientConfig: HttpClientConfig = {
|
|
100
111
|
baseUrl: '/',
|
|
101
|
-
interceptors: [
|
|
102
|
-
(raw) => raw.status == 401
|
|
103
|
-
]
|
|
112
|
+
interceptors: [(raw) => raw.status == 401],
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
let clientConfig = {
|
|
107
|
-
...defaultClientConfig
|
|
116
|
+
...defaultClientConfig,
|
|
108
117
|
}
|
|
109
118
|
|
|
110
119
|
/**
|
|
@@ -112,15 +121,15 @@ let clientConfig = {
|
|
|
112
121
|
* @param config
|
|
113
122
|
* @returns
|
|
114
123
|
*/
|
|
115
|
-
export function createHttp
|
|
124
|
+
export function createHttp(config: HttpClientConfig): HttpInstance {
|
|
116
125
|
clientConfig = {
|
|
117
126
|
...defaultClientConfig,
|
|
118
|
-
...config
|
|
127
|
+
...config,
|
|
119
128
|
}
|
|
120
129
|
|
|
121
130
|
return {
|
|
122
131
|
request,
|
|
123
132
|
get,
|
|
124
|
-
post
|
|
133
|
+
post,
|
|
125
134
|
}
|
|
126
135
|
}
|