@uxda/appkit 4.1.16 → 4.1.22
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 +20 -17
- package/dist/index.js +29 -13
- package/package.json +5 -3
- package/src/balance/components/DateFilter.vue +31 -9
- package/src/balance/components/DateRange.vue +5 -2
- package/src/notice/components/NoticeEntry.vue +1 -1
- package/src/shared/components/OcrBusinessLicense.vue +48 -45
- package/src/shared/components/OcrIcon.vue +44 -43
package/dist/appkit.css
CHANGED
|
@@ -623,14 +623,14 @@ page {
|
|
|
623
623
|
top: 11px;
|
|
624
624
|
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDIiIGhlaWdodD0iNDIiIHZpZXdCb3g9IjAgMCA0MiA0MiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggb3BhY2l0eT0iMC4wMSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00MSA0MUgxVjFINDFWNDFaIiBmaWxsPSIjRDhEOEQ4IiBzdHJva2U9ImJsYWNrIiBzdHJva2Utb3BhY2l0eT0iMC4wMSIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTIzLjM1NjEgMjAuOTk5OUwzMy45NjM3IDMxLjYwNzJDMzQuNjE0NiAzMi4yNTgxIDM0LjYxNDYgMzMuMzEzNCAzMy45NjM3IDMzLjk2NDJDMzMuMzQyNSAzNC41ODU1IDMyLjM1MjcgMzQuNjEzOCAzMS42OTc5IDM0LjA0ODlMMjAuOTk5NCAyMy4zNTY2TDEwLjM5MzUgMzMuOTY0MkM5Ljc0MjY1IDM0LjYxNTEgOC42ODczOCAzNC42MTUxIDguMDM2NSAzMy45NjQyQzcuNDE1MTkgMzMuMzQyOSA3LjM4Njk3IDMyLjM1MzIgNy45NTE3OSAzMS42OTg0TDE4LjY0MjggMjAuOTk5OUw4LjAzNjUgMTAuMzk0QzcuMzg1NjMgOS43NDMxNCA3LjM4NTYzIDguNjg3ODcgOC4wMzY1IDguMDM2OTlDOC42NTc3OSA3LjQxNTY4IDkuNjQ3NTQgNy4zODc0NiAxMC4zMDIzIDcuOTUyMjdMMjAuOTk5NCAxOC42NDMzTDMxLjYwNjcgOC4wMzY5OUMzMi4yNTc2IDcuMzg2MTIgMzMuMzEyOSA3LjM4NjEyIDMzLjk2MzcgOC4wMzY5OUMzNC41ODUgOC42NTgyOCAzNC42MTMzIDkuNjQ4MDMgMzQuMDQ4NSAxMC4zMDI4TDIzLjM1NjEgMjAuOTk5OVoiIGZpbGw9IiMxNzFBMUQiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS1vcGFjaXR5PSIwLjAxIi8+Cjwvc3ZnPgo=");
|
|
625
625
|
}
|
|
626
|
-
.
|
|
626
|
+
.appkit-date-filter {
|
|
627
627
|
height: 100%;
|
|
628
628
|
display: flex;
|
|
629
629
|
flex-direction: column;
|
|
630
630
|
width: 100%;
|
|
631
631
|
position: relative;
|
|
632
632
|
}
|
|
633
|
-
.
|
|
633
|
+
.appkit-date-filter .date-filter-header {
|
|
634
634
|
text-align: center;
|
|
635
635
|
height: 44px;
|
|
636
636
|
line-height: 44px;
|
|
@@ -638,42 +638,42 @@ page {
|
|
|
638
638
|
font-size: 17px;
|
|
639
639
|
background-color: #f5f5f5;
|
|
640
640
|
}
|
|
641
|
-
.
|
|
641
|
+
.appkit-date-filter .content {
|
|
642
642
|
flex: 1;
|
|
643
643
|
margin: 15px;
|
|
644
644
|
overflow-y: scroll;
|
|
645
645
|
color: #353535;
|
|
646
646
|
font-size: 13px;
|
|
647
647
|
}
|
|
648
|
-
.
|
|
648
|
+
.appkit-date-filter .content .title {
|
|
649
649
|
opacity: 0.6;
|
|
650
650
|
line-height: 18px;
|
|
651
651
|
}
|
|
652
|
-
.
|
|
652
|
+
.appkit-date-filter .content .info {
|
|
653
653
|
display: grid;
|
|
654
654
|
grid-template-columns: 1fr 1fr 1fr;
|
|
655
655
|
grid-gap: 10px;
|
|
656
656
|
margin: 10px 0;
|
|
657
657
|
}
|
|
658
|
-
.
|
|
658
|
+
.appkit-date-filter .content .info .item {
|
|
659
659
|
height: 30px;
|
|
660
660
|
line-height: 30px;
|
|
661
661
|
border: 1px solid #ccc;
|
|
662
662
|
border-radius: 6px;
|
|
663
663
|
text-align: center;
|
|
664
664
|
}
|
|
665
|
-
.
|
|
665
|
+
.appkit-date-filter .content .info .current {
|
|
666
666
|
border: 1px solid;
|
|
667
667
|
border-image-source: linear-gradient(180deg, rgba(239, 208, 130, 0.8) 0%, rgba(255, 185, 120, 0.8) 100%);
|
|
668
668
|
background: linear-gradient(180deg, rgba(239, 208, 130, 0.8) 0%, rgba(255, 185, 120, 0.8) 100%), linear-gradient(180deg, #fff7e3 0%, #fefde6 100%);
|
|
669
669
|
}
|
|
670
|
-
.
|
|
671
|
-
margin: 0 15px;
|
|
670
|
+
.appkit-date-filter .buttons {
|
|
671
|
+
margin: 32px 15px 0 15px;
|
|
672
672
|
display: flex;
|
|
673
673
|
justify-content: space-between;
|
|
674
674
|
align-items: center;
|
|
675
675
|
}
|
|
676
|
-
.
|
|
676
|
+
.appkit-date-filter .buttons .btn {
|
|
677
677
|
flex: 1;
|
|
678
678
|
height: 40px;
|
|
679
679
|
line-height: 40px;
|
|
@@ -684,22 +684,22 @@ page {
|
|
|
684
684
|
font-size: 16px;
|
|
685
685
|
border-radius: 6px;
|
|
686
686
|
}
|
|
687
|
-
.
|
|
687
|
+
.appkit-date-filter .buttons .confirm {
|
|
688
688
|
margin-left: 11px;
|
|
689
689
|
color: #000;
|
|
690
690
|
border: none;
|
|
691
691
|
background: linear-gradient(90deg, #ffebc1 0%, #ffd7a7 52.29%, #ffb875 100%);
|
|
692
692
|
}
|
|
693
|
-
.
|
|
693
|
+
.appkit-date-filter .time {
|
|
694
694
|
display: flex;
|
|
695
695
|
justify-content: flex-start;
|
|
696
696
|
align-items: center;
|
|
697
697
|
margin: 10px 0 30px 0;
|
|
698
698
|
}
|
|
699
|
-
.
|
|
699
|
+
.appkit-date-filter .time .line {
|
|
700
700
|
margin: 0 8px;
|
|
701
701
|
}
|
|
702
|
-
.
|
|
702
|
+
.appkit-date-filter .time .item {
|
|
703
703
|
height: 30px;
|
|
704
704
|
line-height: 30px;
|
|
705
705
|
padding: 0 15px;
|
|
@@ -710,13 +710,16 @@ page {
|
|
|
710
710
|
background: rgba(245, 245, 245, 0.8);
|
|
711
711
|
border-radius: 6px;
|
|
712
712
|
}
|
|
713
|
-
.
|
|
713
|
+
.appkit-date-filter .time .current {
|
|
714
714
|
border: 1px solid #353535;
|
|
715
715
|
}
|
|
716
|
-
.
|
|
716
|
+
.appkit-date-filter .bottom {
|
|
717
717
|
height: 32px;
|
|
718
718
|
background: #fff;
|
|
719
719
|
}
|
|
720
|
+
.nut-overlay.date-filter-picker-overlay {
|
|
721
|
+
height: 100vh;
|
|
722
|
+
}
|
|
720
723
|
.consumption-rules .title {
|
|
721
724
|
line-height: 16px;
|
|
722
725
|
font-weight: 500;
|
|
@@ -1462,7 +1465,7 @@ page {
|
|
|
1462
1465
|
padding-left: 6px;
|
|
1463
1466
|
}
|
|
1464
1467
|
.notice-entry {
|
|
1465
|
-
position:
|
|
1468
|
+
position: absolute;
|
|
1466
1469
|
right: 0;
|
|
1467
1470
|
top: 120px;
|
|
1468
1471
|
min-width: 66px;
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import '@nutui/nutui-taro/dist/packages/griditem/style/css';
|
|
|
7
7
|
import Taro, { useDidShow, useRouter } from '@tarojs/taro';
|
|
8
8
|
import '@nutui/nutui-taro/dist/packages/popup/style/css';
|
|
9
9
|
import { isIdentityCard, isMobilePhone } from 'validator';
|
|
10
|
-
import { NsForm, NsInput, NsButton, NsIcon, useNutshell } from '@uxda/nutshell/taro';
|
|
10
|
+
import { NsForm, NsInput, NsButton, NsIcon, usePopup, useNutshell } from '@uxda/nutshell/taro';
|
|
11
11
|
import debounce from 'lodash/debounce';
|
|
12
12
|
import '@nutui/nutui-taro/dist/packages/dialog/style/css';
|
|
13
13
|
import '@nutui/nutui-taro/dist/packages/datepicker/style/css';
|
|
@@ -951,7 +951,7 @@ var script$C = /* @__PURE__ */ defineComponent({
|
|
|
951
951
|
onClick: onIconClick
|
|
952
952
|
},
|
|
953
953
|
[
|
|
954
|
-
createVNode(unref(NsIcon), { name: "https://
|
|
954
|
+
createVNode(unref(NsIcon), { name: "https://cdn.ddjf.com/static/images/beidouxing/ocr-icon.png" })
|
|
955
955
|
],
|
|
956
956
|
2
|
|
957
957
|
/* CLASS */
|
|
@@ -1061,7 +1061,7 @@ var script$B = /* @__PURE__ */ defineComponent({
|
|
|
1061
1061
|
onClick: onIconClick
|
|
1062
1062
|
},
|
|
1063
1063
|
[
|
|
1064
|
-
createVNode(unref(NsIcon), { name: "https://
|
|
1064
|
+
createVNode(unref(NsIcon), { name: "https://cdn.ddjf.com/static/images/beidouxing/ocr-icon.png" })
|
|
1065
1065
|
],
|
|
1066
1066
|
2
|
|
1067
1067
|
/* CLASS */
|
|
@@ -2217,7 +2217,7 @@ var script$u = /* @__PURE__ */ defineComponent({
|
|
|
2217
2217
|
|
|
2218
2218
|
script$u.__file = "src/balance/components/ConsumptionFilter.vue";
|
|
2219
2219
|
|
|
2220
|
-
const _hoisted_1$p = { class: "
|
|
2220
|
+
const _hoisted_1$p = { class: "appkit-date-filter" };
|
|
2221
2221
|
const _hoisted_2$g = { class: "content" };
|
|
2222
2222
|
const _hoisted_3$b = { class: "time" };
|
|
2223
2223
|
var script$t = /* @__PURE__ */ defineComponent({
|
|
@@ -2229,7 +2229,7 @@ var script$t = /* @__PURE__ */ defineComponent({
|
|
|
2229
2229
|
emits: ["complete", "reset"],
|
|
2230
2230
|
setup(__props, { emit: __emit }) {
|
|
2231
2231
|
const props = __props;
|
|
2232
|
-
const emit = __emit;
|
|
2232
|
+
const emit = __emit, state = usePopup();
|
|
2233
2233
|
watch(
|
|
2234
2234
|
() => `${props.from}${props.to}`,
|
|
2235
2235
|
() => {
|
|
@@ -2243,6 +2243,10 @@ var script$t = /* @__PURE__ */ defineComponent({
|
|
|
2243
2243
|
const minDate = ref();
|
|
2244
2244
|
const maxDate = ref(/* @__PURE__ */ new Date());
|
|
2245
2245
|
const datePickerOpen = ref(false);
|
|
2246
|
+
state.beforeClose = () => {
|
|
2247
|
+
datePickerOpen.value = false;
|
|
2248
|
+
return true;
|
|
2249
|
+
};
|
|
2246
2250
|
function reset() {
|
|
2247
2251
|
emit("reset");
|
|
2248
2252
|
}
|
|
@@ -2261,6 +2265,11 @@ var script$t = /* @__PURE__ */ defineComponent({
|
|
|
2261
2265
|
result.to = time;
|
|
2262
2266
|
}
|
|
2263
2267
|
datePickerOpen.value = false;
|
|
2268
|
+
state.couldClose = true;
|
|
2269
|
+
}
|
|
2270
|
+
function onDatePickerCancel() {
|
|
2271
|
+
datePickerOpen.value = false;
|
|
2272
|
+
state.couldClose = true;
|
|
2264
2273
|
}
|
|
2265
2274
|
function switchDateInput(shift) {
|
|
2266
2275
|
if (shift === "from") {
|
|
@@ -2273,12 +2282,13 @@ var script$t = /* @__PURE__ */ defineComponent({
|
|
|
2273
2282
|
focusedDate.value = new Date(result[shift]);
|
|
2274
2283
|
focused.value = shift;
|
|
2275
2284
|
datePickerOpen.value = true;
|
|
2285
|
+
state.couldClose = false;
|
|
2276
2286
|
}
|
|
2277
2287
|
return (_ctx, _cache) => {
|
|
2278
2288
|
const _component_nut_date_picker = DatePicker;
|
|
2279
2289
|
const _component_nut_popup = Popup;
|
|
2280
2290
|
return openBlock(), createElementBlock("div", _hoisted_1$p, [
|
|
2281
|
-
_cache[
|
|
2291
|
+
_cache[6] || (_cache[6] = createElementVNode(
|
|
2282
2292
|
"div",
|
|
2283
2293
|
{ class: "date-filter-header" },
|
|
2284
2294
|
"\u65E5\u671F\u9009\u62E9",
|
|
@@ -2286,7 +2296,7 @@ var script$t = /* @__PURE__ */ defineComponent({
|
|
|
2286
2296
|
/* HOISTED */
|
|
2287
2297
|
)),
|
|
2288
2298
|
createElementVNode("div", _hoisted_2$g, [
|
|
2289
|
-
_cache[
|
|
2299
|
+
_cache[5] || (_cache[5] = createElementVNode(
|
|
2290
2300
|
"div",
|
|
2291
2301
|
{ class: "title" },
|
|
2292
2302
|
"\u81EA\u5B9A\u4E49",
|
|
@@ -2304,7 +2314,7 @@ var script$t = /* @__PURE__ */ defineComponent({
|
|
|
2304
2314
|
3
|
|
2305
2315
|
/* TEXT, CLASS */
|
|
2306
2316
|
),
|
|
2307
|
-
_cache[
|
|
2317
|
+
_cache[4] || (_cache[4] = createElementVNode(
|
|
2308
2318
|
"div",
|
|
2309
2319
|
{ class: "line" },
|
|
2310
2320
|
"-",
|
|
@@ -2333,7 +2343,7 @@ var script$t = /* @__PURE__ */ defineComponent({
|
|
|
2333
2343
|
onClick: onOkClick
|
|
2334
2344
|
}, "\u786E\u5B9A")
|
|
2335
2345
|
]),
|
|
2336
|
-
_cache[
|
|
2346
|
+
_cache[7] || (_cache[7] = createElementVNode(
|
|
2337
2347
|
"div",
|
|
2338
2348
|
{ class: "bottom" },
|
|
2339
2349
|
null,
|
|
@@ -2342,8 +2352,10 @@ var script$t = /* @__PURE__ */ defineComponent({
|
|
|
2342
2352
|
)),
|
|
2343
2353
|
createVNode(_component_nut_popup, {
|
|
2344
2354
|
visible: datePickerOpen.value,
|
|
2345
|
-
"onUpdate:visible": _cache[
|
|
2346
|
-
|
|
2355
|
+
"onUpdate:visible": _cache[3] || (_cache[3] = ($event) => datePickerOpen.value = $event),
|
|
2356
|
+
class: "appkit-date-filter-picker-popup",
|
|
2357
|
+
position: "bottom",
|
|
2358
|
+
"overlay-class": "appkit-date-filter-picker-overlay"
|
|
2347
2359
|
}, {
|
|
2348
2360
|
default: withCtx(() => [
|
|
2349
2361
|
createVNode(_component_nut_date_picker, {
|
|
@@ -2353,7 +2365,7 @@ var script$t = /* @__PURE__ */ defineComponent({
|
|
|
2353
2365
|
"max-date": maxDate.value,
|
|
2354
2366
|
"is-show-chinese": false,
|
|
2355
2367
|
"three-dimensional": false,
|
|
2356
|
-
onCancel:
|
|
2368
|
+
onCancel: onDatePickerCancel,
|
|
2357
2369
|
onConfirm: onDatePickerComplete
|
|
2358
2370
|
}, null, 8, ["modelValue", "min-date", "max-date"])
|
|
2359
2371
|
]),
|
|
@@ -3198,14 +3210,18 @@ var script$n = /* @__PURE__ */ defineComponent({
|
|
|
3198
3210
|
const $n = useNutshell();
|
|
3199
3211
|
const model = useModel(__props, "modelValue");
|
|
3200
3212
|
const openDateRangePicker = () => {
|
|
3213
|
+
const child = ref();
|
|
3201
3214
|
$n.sheet({
|
|
3202
3215
|
component: script$t,
|
|
3216
|
+
ref: child,
|
|
3203
3217
|
props: {
|
|
3204
3218
|
from: model.value.from,
|
|
3205
3219
|
to: model.value.to
|
|
3206
3220
|
},
|
|
3221
|
+
modal: true,
|
|
3222
|
+
// 不允许点击 overlay 关闭弹窗
|
|
3223
|
+
mask: true,
|
|
3207
3224
|
onComplete(result) {
|
|
3208
|
-
console.log("===openDateFilter complete", result);
|
|
3209
3225
|
model.value = {
|
|
3210
3226
|
from: result.from,
|
|
3211
3227
|
to: result.to
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxda/appkit",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.22",
|
|
4
4
|
"description": "小程序应用开发包",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"author": "",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/runtime": "^7.
|
|
23
|
+
"@babel/runtime": "^7.25.6",
|
|
24
24
|
"@nutui/auto-import-resolver": "^1.0.0",
|
|
25
25
|
"@nutui/icons-vue-taro": "^0.0.9",
|
|
26
26
|
"@nutui/nutui-taro": "^4.3.11",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"@tarojs/shared": "^4.0.0",
|
|
35
35
|
"@tarojs/taro": "^4.0.0",
|
|
36
36
|
"@types/wechat-miniprogram": "^3.4.7",
|
|
37
|
-
"@uxda/nutshell": "^1.0.0",
|
|
38
37
|
"dayjs": "^1.11.10",
|
|
39
38
|
"validator": "^13.12.0",
|
|
40
39
|
"vue": "^3.5.0"
|
|
@@ -71,5 +70,8 @@
|
|
|
71
70
|
"unplugin-auto-import": "^0.18.2",
|
|
72
71
|
"unplugin-vue-components": "^0.27.3",
|
|
73
72
|
"webpack": "^5.78.0"
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"@uxda/nutshell": "^1.0.0"
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
2
|
+
<div class="appkit-date-filter">
|
|
3
3
|
<div class="date-filter-header">日期选择</div>
|
|
4
4
|
<div class="content">
|
|
5
5
|
<div class="title">自定义</div>
|
|
@@ -22,22 +22,25 @@
|
|
|
22
22
|
<div class="btn confirm" @click="onOkClick">确定</div>
|
|
23
23
|
</div>
|
|
24
24
|
<div class="bottom"></div>
|
|
25
|
-
<nut-popup v-model:visible="datePickerOpen"
|
|
25
|
+
<nut-popup v-model:visible="datePickerOpen"
|
|
26
|
+
class="appkit-date-filter-picker-popup"
|
|
27
|
+
position="bottom"
|
|
28
|
+
overlay-class="appkit-date-filter-picker-overlay">
|
|
26
29
|
<nut-date-picker
|
|
27
30
|
v-model="focusedDate"
|
|
28
31
|
:min-date="minDate"
|
|
29
32
|
:max-date="maxDate"
|
|
30
33
|
:is-show-chinese="false"
|
|
31
34
|
:three-dimensional="false"
|
|
32
|
-
@cancel="
|
|
33
|
-
@confirm="onDatePickerComplete"
|
|
34
|
-
></nut-date-picker>
|
|
35
|
+
@cancel="onDatePickerCancel"
|
|
36
|
+
@confirm="onDatePickerComplete" />
|
|
35
37
|
</nut-popup>
|
|
36
38
|
</div>
|
|
37
39
|
</template>
|
|
38
40
|
|
|
39
41
|
<script lang="ts" setup>
|
|
40
42
|
import { reactive, ref, watch } from 'vue'
|
|
43
|
+
import { usePopup } from '@uxda/nutshell/taro'
|
|
41
44
|
|
|
42
45
|
type DateFilterProps = {
|
|
43
46
|
from: string
|
|
@@ -46,7 +49,8 @@ type DateFilterProps = {
|
|
|
46
49
|
|
|
47
50
|
const props = defineProps<DateFilterProps>()
|
|
48
51
|
|
|
49
|
-
const emit = defineEmits(['complete', 'reset'])
|
|
52
|
+
const emit = defineEmits(['complete', 'reset']),
|
|
53
|
+
state = usePopup()
|
|
50
54
|
|
|
51
55
|
watch(
|
|
52
56
|
() => `${props.from}${props.to}`,
|
|
@@ -71,6 +75,11 @@ const minDate = ref<any>()
|
|
|
71
75
|
const maxDate = ref<Date>(new Date())
|
|
72
76
|
const datePickerOpen = ref<boolean>(false)
|
|
73
77
|
|
|
78
|
+
state.beforeClose = () => {
|
|
79
|
+
datePickerOpen.value = false
|
|
80
|
+
return true
|
|
81
|
+
}
|
|
82
|
+
|
|
74
83
|
/**
|
|
75
84
|
* 日期重置
|
|
76
85
|
*/
|
|
@@ -99,6 +108,12 @@ function onDatePickerComplete({ selectedValue, selectedOptions }) {
|
|
|
99
108
|
result.to = time
|
|
100
109
|
}
|
|
101
110
|
datePickerOpen.value = false
|
|
111
|
+
state.couldClose = true
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function onDatePickerCancel () {
|
|
115
|
+
datePickerOpen.value = false
|
|
116
|
+
state.couldClose = true
|
|
102
117
|
}
|
|
103
118
|
|
|
104
119
|
/**
|
|
@@ -106,7 +121,7 @@ function onDatePickerComplete({ selectedValue, selectedOptions }) {
|
|
|
106
121
|
* 当选择开始时间大于结束时间,结束时间改为开始时间
|
|
107
122
|
* 时间选择器都要小于当前时间,结束时间的时间选择器要以开始时间为最小值,
|
|
108
123
|
*/
|
|
109
|
-
function switchDateInput(shift: string) {
|
|
124
|
+
function switchDateInput (shift: string) {
|
|
110
125
|
// 要设置一下结束时间的起始值 开始时间往前倒5年
|
|
111
126
|
if (shift === 'from') {
|
|
112
127
|
let time = result.from.split('-').map(Number)
|
|
@@ -118,10 +133,12 @@ function switchDateInput(shift: string) {
|
|
|
118
133
|
focusedDate.value = new Date(result[shift])
|
|
119
134
|
focused.value = shift
|
|
120
135
|
datePickerOpen.value = true
|
|
136
|
+
// 不允许浮窗关闭
|
|
137
|
+
state.couldClose = false
|
|
121
138
|
}
|
|
122
139
|
</script>
|
|
123
140
|
<style lang="scss">
|
|
124
|
-
.
|
|
141
|
+
.appkit-date-filter {
|
|
125
142
|
height: 100%;
|
|
126
143
|
display: flex;
|
|
127
144
|
flex-direction: column;
|
|
@@ -174,7 +191,7 @@ function switchDateInput(shift: string) {
|
|
|
174
191
|
}
|
|
175
192
|
}
|
|
176
193
|
.buttons {
|
|
177
|
-
margin: 0 15px;
|
|
194
|
+
margin: 32px 15px 0 15px;
|
|
178
195
|
display: flex;
|
|
179
196
|
justify-content: space-between;
|
|
180
197
|
align-items: center;
|
|
@@ -224,4 +241,9 @@ function switchDateInput(shift: string) {
|
|
|
224
241
|
background: #fff;
|
|
225
242
|
}
|
|
226
243
|
}
|
|
244
|
+
.nut-overlay {
|
|
245
|
+
&.date-filter-picker-overlay {
|
|
246
|
+
height: 100vh;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
227
249
|
</style>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script lang="ts" setup>
|
|
13
|
-
import { computed, PropType,
|
|
13
|
+
import { computed, PropType, ref } from 'vue'
|
|
14
14
|
import { useNutshell } from '@uxda/nutshell/taro'
|
|
15
15
|
import DateFilter from './DateFilter.vue'
|
|
16
16
|
import dayjs from 'dayjs'
|
|
@@ -32,14 +32,17 @@ const model = defineModel({
|
|
|
32
32
|
})
|
|
33
33
|
|
|
34
34
|
const openDateRangePicker = () => {
|
|
35
|
+
const child = ref()
|
|
35
36
|
$n.sheet({
|
|
36
37
|
component: DateFilter,
|
|
38
|
+
ref: child,
|
|
37
39
|
props: {
|
|
38
40
|
from: model.value.from,
|
|
39
41
|
to: model.value.to,
|
|
40
42
|
},
|
|
43
|
+
modal: true, // 不允许点击 overlay 关闭弹窗
|
|
44
|
+
mask: true,
|
|
41
45
|
onComplete (result: any) {
|
|
42
|
-
console.log('===openDateFilter complete', result)
|
|
43
46
|
model.value = {
|
|
44
47
|
from: result.from,
|
|
45
48
|
to: result.to
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
2
|
+
<div
|
|
3
|
+
:class="['ocr-business-license', disabled ? 'disabled' : '']"
|
|
4
|
+
class="ocr-icon"
|
|
5
|
+
@click="onIconClick"
|
|
6
|
+
>
|
|
7
|
+
<ns-icon name="https://cdn.ddjf.com/static/images/beidouxing/ocr-icon.png" />
|
|
4
8
|
</div>
|
|
5
9
|
</template>
|
|
6
10
|
|
|
7
11
|
<script lang="ts" setup>
|
|
8
|
-
import Taro from '@tarojs/taro'
|
|
9
|
-
import { NsIcon } from '@uxda/nutshell/taro'
|
|
10
|
-
import { useAppKitOptions } from '../../Appkit'
|
|
12
|
+
import Taro from '@tarojs/taro';
|
|
13
|
+
import { NsIcon } from '@uxda/nutshell/taro';
|
|
14
|
+
import { useAppKitOptions } from '../../Appkit';
|
|
11
15
|
|
|
12
|
-
const appKitOptions = useAppKitOptions()
|
|
13
|
-
|
|
14
|
-
const emits = defineEmits(['complete'])
|
|
16
|
+
const appKitOptions = useAppKitOptions();
|
|
15
17
|
|
|
18
|
+
const emits = defineEmits(['complete']);
|
|
16
19
|
|
|
17
20
|
type OcrBusinessLicenseProps = {
|
|
18
|
-
disabled: boolean
|
|
19
|
-
}
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
};
|
|
20
23
|
|
|
21
|
-
const props = defineProps<OcrBusinessLicenseProps>()
|
|
24
|
+
const props = defineProps<OcrBusinessLicenseProps>();
|
|
22
25
|
|
|
23
26
|
export type OcrResult = {
|
|
24
|
-
companyName: string
|
|
25
|
-
idCardNo: string
|
|
26
|
-
legalPersonName: string
|
|
27
|
-
}
|
|
27
|
+
companyName: string;
|
|
28
|
+
idCardNo: string;
|
|
29
|
+
legalPersonName: string;
|
|
30
|
+
};
|
|
28
31
|
|
|
29
32
|
async function taroImgCompress(src: string, quality = 80) {
|
|
30
33
|
return new Promise((resolve, reject) => {
|
|
@@ -32,45 +35,45 @@ async function taroImgCompress(src: string, quality = 80) {
|
|
|
32
35
|
src: src,
|
|
33
36
|
quality: quality,
|
|
34
37
|
success: (res) => {
|
|
35
|
-
resolve(res)
|
|
38
|
+
resolve(res);
|
|
36
39
|
},
|
|
37
40
|
fail: (res) => {
|
|
38
|
-
reject(res)
|
|
41
|
+
reject(res);
|
|
39
42
|
},
|
|
40
|
-
})
|
|
41
|
-
})
|
|
43
|
+
});
|
|
44
|
+
});
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
function getCompressQuality(size: number) {
|
|
45
|
-
let quality = 100
|
|
46
|
-
const curSize = size / (1024 * 1024)
|
|
48
|
+
let quality = 100;
|
|
49
|
+
const curSize = size / (1024 * 1024);
|
|
47
50
|
if (curSize > 6) {
|
|
48
|
-
quality = quality - ((curSize - 6) / curSize) * 100
|
|
51
|
+
quality = quality - ((curSize - 6) / curSize) * 100;
|
|
49
52
|
}
|
|
50
|
-
return quality
|
|
53
|
+
return quality;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
function allTrim(str: string) {
|
|
54
|
-
return str.replace(/\s+/g, '')
|
|
57
|
+
return str.replace(/\s+/g, '');
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
async function onIconClick() {
|
|
58
61
|
if (props.disabled) {
|
|
59
|
-
return
|
|
62
|
+
return;
|
|
60
63
|
}
|
|
61
|
-
console.log('===onIconClick')
|
|
62
|
-
let result: OcrResult | null = null
|
|
64
|
+
console.log('===onIconClick');
|
|
65
|
+
let result: OcrResult | null = null;
|
|
63
66
|
try {
|
|
64
67
|
const csRes = await Taro.chooseImage({
|
|
65
68
|
count: 1,
|
|
66
|
-
})
|
|
67
|
-
let { path, size } = csRes.tempFiles[0]
|
|
69
|
+
});
|
|
70
|
+
let { path, size } = csRes.tempFiles[0];
|
|
68
71
|
const compressImg: any =
|
|
69
|
-
(await taroImgCompress(path, getCompressQuality(size))) || {}
|
|
70
|
-
const filePath = compressImg.tempFilePath || path
|
|
71
|
-
Taro.showLoading({ title: '营业执照识别中..' })
|
|
72
|
-
const session = appKitOptions.token()
|
|
73
|
-
const baseUrl = appKitOptions.baseUrl()
|
|
72
|
+
(await taroImgCompress(path, getCompressQuality(size))) || {};
|
|
73
|
+
const filePath = compressImg.tempFilePath || path;
|
|
74
|
+
Taro.showLoading({ title: '营业执照识别中..' });
|
|
75
|
+
const session = appKitOptions.token();
|
|
76
|
+
const baseUrl = appKitOptions.baseUrl();
|
|
74
77
|
const upRes: any = await Taro.uploadFile({
|
|
75
78
|
url: baseUrl + '/promoact/common/parseBusinessLicense',
|
|
76
79
|
filePath,
|
|
@@ -82,11 +85,11 @@ async function onIconClick() {
|
|
|
82
85
|
sessionKey: session || '',
|
|
83
86
|
token: session || '',
|
|
84
87
|
},
|
|
85
|
-
})
|
|
86
|
-
Taro.hideLoading()
|
|
87
|
-
const res = JSON.parse(upRes.data)
|
|
88
|
+
});
|
|
89
|
+
Taro.hideLoading();
|
|
90
|
+
const res = JSON.parse(upRes.data);
|
|
88
91
|
if (res.code === '200') {
|
|
89
|
-
const faceInfo = res.result || {}
|
|
92
|
+
const faceInfo = res.result || {};
|
|
90
93
|
result = {
|
|
91
94
|
companyName: allTrim(faceInfo.companyName || ''),
|
|
92
95
|
idCardNo: allTrim(faceInfo.idCardNo || ''),
|
|
@@ -94,22 +97,22 @@ async function onIconClick() {
|
|
|
94
97
|
fileId: faceInfo.fileId,
|
|
95
98
|
originalUrl: faceInfo.originalUrl,
|
|
96
99
|
downloadUrl: faceInfo.downloadUrl,
|
|
97
|
-
}
|
|
98
|
-
console.log('===识别', result)
|
|
100
|
+
};
|
|
101
|
+
console.log('===识别', result);
|
|
99
102
|
if (!result.companyName && !result.idCardNo) {
|
|
100
|
-
Taro.showToast({ title: '识别失败,请重试', icon: 'none' })
|
|
103
|
+
Taro.showToast({ title: '识别失败,请重试', icon: 'none' });
|
|
101
104
|
}
|
|
102
105
|
} else {
|
|
103
106
|
Taro.showToast({
|
|
104
107
|
title: res.msg,
|
|
105
108
|
icon: 'error',
|
|
106
|
-
})
|
|
109
|
+
});
|
|
107
110
|
}
|
|
108
111
|
} catch (err) {
|
|
109
|
-
Taro.hideLoading()
|
|
110
|
-
console.log(err)
|
|
112
|
+
Taro.hideLoading();
|
|
113
|
+
console.log(err);
|
|
111
114
|
}
|
|
112
|
-
emits('complete', result)
|
|
115
|
+
emits('complete', result);
|
|
113
116
|
}
|
|
114
117
|
</script>
|
|
115
118
|
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="['ocr-icon', disabled ? 'disabled' : '']" @click="onIconClick">
|
|
3
|
-
<ns-icon name="https://
|
|
3
|
+
<ns-icon name="https://cdn.ddjf.com/static/images/beidouxing/ocr-icon.png" />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts" setup>
|
|
8
|
-
import Taro from '@tarojs/taro'
|
|
9
|
-
import { NsIcon } from '@uxda/nutshell/taro'
|
|
10
|
-
import { useAppKitOptions } from '../../Appkit'
|
|
8
|
+
import Taro from '@tarojs/taro';
|
|
9
|
+
import { NsIcon } from '@uxda/nutshell/taro';
|
|
10
|
+
import { useAppKitOptions } from '../../Appkit';
|
|
11
11
|
|
|
12
|
-
const appKitOptions = useAppKitOptions()
|
|
12
|
+
const appKitOptions = useAppKitOptions();
|
|
13
13
|
|
|
14
|
-
const emits = defineEmits(['complete'])
|
|
14
|
+
const emits = defineEmits(['complete']);
|
|
15
15
|
|
|
16
16
|
type OcrIconProps = {
|
|
17
|
-
disabled: boolean
|
|
18
|
-
}
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
};
|
|
19
19
|
|
|
20
|
-
const props = defineProps<OcrIconProps>()
|
|
20
|
+
const props = defineProps<OcrIconProps>();
|
|
21
21
|
|
|
22
22
|
export type OcrResult = {
|
|
23
|
-
name: string
|
|
24
|
-
number: string
|
|
25
|
-
address: string
|
|
26
|
-
}
|
|
23
|
+
name: string;
|
|
24
|
+
number: string;
|
|
25
|
+
address: string;
|
|
26
|
+
};
|
|
27
27
|
|
|
28
28
|
async function taroImgCompress(src: string, quality = 80) {
|
|
29
29
|
return new Promise((resolve, reject) => {
|
|
@@ -31,43 +31,44 @@ 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) {
|
|
44
|
-
let quality = 100
|
|
45
|
-
const curSize = size / (1024 * 1024)
|
|
44
|
+
let quality = 100;
|
|
45
|
+
const curSize = size / (1024 * 1024);
|
|
46
46
|
if (curSize > 6) {
|
|
47
|
-
quality = quality - ((curSize - 6) / curSize) * 100
|
|
47
|
+
quality = quality - ((curSize - 6) / curSize) * 100;
|
|
48
48
|
}
|
|
49
|
-
return quality
|
|
49
|
+
return quality;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function allTrim(str: string) {
|
|
53
|
-
return str.replace(/\s+/g, '')
|
|
53
|
+
return str.replace(/\s+/g, '');
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
async function onIconClick() {
|
|
57
57
|
if (props.disabled) {
|
|
58
|
-
return
|
|
58
|
+
return;
|
|
59
59
|
}
|
|
60
|
-
let result: OcrResult | null = null
|
|
60
|
+
let result: OcrResult | null = null;
|
|
61
61
|
try {
|
|
62
62
|
const csRes = await Taro.chooseImage({
|
|
63
63
|
count: 1,
|
|
64
|
-
})
|
|
65
|
-
let { path, size } = csRes.tempFiles[0]
|
|
66
|
-
const compressImg: any =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
64
|
+
});
|
|
65
|
+
let { path, size } = csRes.tempFiles[0];
|
|
66
|
+
const compressImg: any =
|
|
67
|
+
(await taroImgCompress(path, getCompressQuality(size))) || {};
|
|
68
|
+
const filePath = compressImg.tempFilePath || path;
|
|
69
|
+
Taro.showLoading({ title: '身份证识别中..' });
|
|
70
|
+
const session = appKitOptions.token();
|
|
71
|
+
const baseUrl = appKitOptions.baseUrl();
|
|
71
72
|
const upRes: any = await Taro.uploadFile({
|
|
72
73
|
url: baseUrl + '/hkapprove/ocr/idcard',
|
|
73
74
|
filePath,
|
|
@@ -80,12 +81,12 @@ async function onIconClick() {
|
|
|
80
81
|
sessionKey: session || '',
|
|
81
82
|
token: session || '',
|
|
82
83
|
},
|
|
83
|
-
})
|
|
84
|
-
Taro.hideLoading()
|
|
85
|
-
const res = JSON.parse(upRes.data)
|
|
84
|
+
});
|
|
85
|
+
Taro.hideLoading();
|
|
86
|
+
const res = JSON.parse(upRes.data);
|
|
86
87
|
if (res.code === '200') {
|
|
87
88
|
const faceInfo = res.result.faceInfo || {},
|
|
88
|
-
file = res.result.fileUploadVO
|
|
89
|
+
file = res.result.fileUploadVO;
|
|
89
90
|
result = {
|
|
90
91
|
name: allTrim(faceInfo.name || ''),
|
|
91
92
|
number: allTrim(faceInfo.num || ''),
|
|
@@ -96,22 +97,22 @@ async function onIconClick() {
|
|
|
96
97
|
// object: file.objectNo,
|
|
97
98
|
// thumb: file.thumbnailUrl
|
|
98
99
|
// }
|
|
99
|
-
}
|
|
100
|
-
console.log('===识别', result)
|
|
100
|
+
};
|
|
101
|
+
console.log('===识别', result);
|
|
101
102
|
if (!result.name && !result.number) {
|
|
102
|
-
Taro.showToast({ title: '识别失败,请重试', icon: 'none' })
|
|
103
|
+
Taro.showToast({ title: '识别失败,请重试', icon: 'none' });
|
|
103
104
|
}
|
|
104
105
|
} else {
|
|
105
106
|
Taro.showToast({
|
|
106
107
|
title: res.msg,
|
|
107
108
|
icon: 'error',
|
|
108
|
-
})
|
|
109
|
+
});
|
|
109
110
|
}
|
|
110
111
|
} catch (err) {
|
|
111
|
-
Taro.hideLoading()
|
|
112
|
-
console.log(err)
|
|
112
|
+
Taro.hideLoading();
|
|
113
|
+
console.log(err);
|
|
113
114
|
}
|
|
114
|
-
emits('complete', result)
|
|
115
|
+
emits('complete', result);
|
|
115
116
|
}
|
|
116
117
|
</script>
|
|
117
118
|
|
|
@@ -129,4 +130,4 @@ async function onIconClick() {
|
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
</style>
|
|
133
|
+
</style>
|