@uxda/appkit 4.1.40 → 4.1.44

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 (117) hide show
  1. package/.eslintrc.mjs +7 -7
  2. package/README.md +187 -187
  3. package/babel.config.js +12 -12
  4. package/dist/appkit.css +121 -43
  5. package/dist/assets/asset-3B_CoPto +1 -0
  6. package/dist/index.js +406 -246
  7. package/package.json +77 -77
  8. package/project.config.json +15 -15
  9. package/project.tt.json +13 -13
  10. package/rollup.config.mjs +56 -56
  11. package/src/Appkit.ts +66 -66
  12. package/src/balance/api/endpoints.ts +133 -126
  13. package/src/balance/api/index.ts +106 -106
  14. package/src/balance/components/AccountView.vue +747 -749
  15. package/src/balance/components/BalanceCard.vue +213 -205
  16. package/src/balance/components/BalanceReminder.vue +85 -85
  17. package/src/balance/components/ConsumptionFilter.vue +218 -218
  18. package/src/balance/components/ConsumptionRules.vue +68 -68
  19. package/src/balance/components/DateFilter.vue +250 -251
  20. package/src/balance/components/DateRange.vue +80 -80
  21. package/src/balance/components/ListFilter.vue +63 -63
  22. package/src/balance/components/ListFilterPicker.vue +188 -186
  23. package/src/balance/components/PromoterCard.vue +186 -0
  24. package/src/balance/components/SecondBalance.vue +71 -71
  25. package/src/balance/components/Tip.vue +45 -45
  26. package/src/balance/components/index.ts +8 -13
  27. package/src/balance/types.ts +97 -91
  28. package/src/components/bt-cropper/index.vue +774 -774
  29. package/src/components/bt-cropper/utils/calcCropper.js +42 -42
  30. package/src/components/bt-cropper/utils/calcImagePosition.js +23 -23
  31. package/src/components/bt-cropper/utils/calcImageSize.js +37 -37
  32. package/src/components/bt-cropper/utils/calcPointDistance.js +12 -12
  33. package/src/components/bt-cropper/utils/calcRightAndBottom.js +7 -7
  34. package/src/components/bt-cropper/utils/ratio.js +3 -3
  35. package/src/components/bt-cropper/utils/tools.js +25 -25
  36. package/src/components/dd-area/index.vue +225 -225
  37. package/src/components/dd-icon/doc.md +21 -21
  38. package/src/components/dd-icon/index.vue +23 -23
  39. package/src/components/dd-notice-bar/index.vue +78 -78
  40. package/src/components/dd-search/doc.md +34 -34
  41. package/src/components/dd-search/index.vue +168 -168
  42. package/src/components/dd-selector/index.vue +124 -124
  43. package/src/components/dd-skeleton/doc.md +19 -19
  44. package/src/components/dd-skeleton/index.vue +36 -36
  45. package/src/components/ocr-id/index.vue +114 -114
  46. package/src/components/ocr-id/types.d.ts +12 -12
  47. package/src/global.ts +6 -6
  48. package/src/index.ts +89 -89
  49. package/src/main.scss +1 -1
  50. package/src/notice/api/endpoints.ts +17 -17
  51. package/src/notice/api/index.ts +106 -106
  52. package/src/notice/components/NoticeBanner.vue +243 -243
  53. package/src/notice/components/NoticeEntry.vue +99 -99
  54. package/src/notice/components/NoticeList.vue +315 -315
  55. package/src/notice/components/NoticePopup.vue +162 -162
  56. package/src/notice/components/index.ts +5 -5
  57. package/src/notice/components/useCommonList.ts +86 -86
  58. package/src/notice/components/useNotice.ts +35 -35
  59. package/src/notice/index.ts +1 -1
  60. package/src/notice/types.ts +25 -25
  61. package/src/payment/api/config.ts +7 -7
  62. package/src/payment/api/endpoints.ts +103 -103
  63. package/src/payment/api/index.ts +100 -100
  64. package/src/payment/components/AmountPicker.vue +90 -93
  65. package/src/payment/components/RechargeResult.vue +69 -69
  66. package/src/payment/components/RechargeView.vue +154 -154
  67. package/src/payment/components/RightsPicker.vue +105 -105
  68. package/src/payment/components/TradeView.vue +294 -294
  69. package/src/payment/components/UserAgreement.vue +234 -234
  70. package/src/payment/components/index.ts +22 -22
  71. package/src/payment/index.ts +5 -5
  72. package/src/payment/services/index.ts +16 -16
  73. package/src/payment/services/invoke-recharge.ts +25 -25
  74. package/src/payment/services/request-payment.ts +58 -58
  75. package/src/payment/types.ts +28 -28
  76. package/src/register/components/SelfRegistration.vue +254 -254
  77. package/src/register/components/index.ts +2 -2
  78. package/src/shared/components/AppDrawer.vue +58 -54
  79. package/src/shared/components/AppVerify.vue +129 -126
  80. package/src/shared/components/DeviceVersion.vue +68 -68
  81. package/src/shared/components/EmptyView.vue +33 -33
  82. package/src/shared/components/OcrBusinessLicense.vue +133 -133
  83. package/src/shared/components/OcrIcon.vue +133 -133
  84. package/src/shared/components/PageHeader.vue +79 -79
  85. package/src/shared/components/index.ts +8 -8
  86. package/src/shared/composables/index.ts +8 -8
  87. package/src/shared/composables/useCountdown.ts +46 -46
  88. package/src/shared/composables/useCrypto.ts +76 -76
  89. package/src/shared/composables/useDragBox.ts +97 -97
  90. package/src/shared/composables/useEncode.ts +43 -43
  91. package/src/shared/composables/useLogger.ts +123 -123
  92. package/src/shared/composables/useSafeArea.ts +46 -46
  93. package/src/shared/composables/useTabbar.ts +24 -24
  94. package/src/shared/composables/useUpload.ts +54 -54
  95. package/src/shared/composables/useValidator.ts +31 -31
  96. package/src/shared/http/Http.ts +136 -136
  97. package/src/shared/http/index.ts +1 -1
  98. package/src/shared/http/types.ts +157 -157
  99. package/src/shared/index.ts +3 -3
  100. package/src/shared/weixin/payment.ts +38 -38
  101. package/src/styles/vars.scss +3 -3
  102. package/src/user/api/endpoints.ts +17 -17
  103. package/src/user/api/index.ts +111 -111
  104. package/src/user/components/LoginSetting.vue +114 -114
  105. package/src/user/components/UserBinding.vue +307 -307
  106. package/src/user/components/UserBindingSuccess.vue +80 -80
  107. package/src/user/components/UserEntry.vue +137 -137
  108. package/src/user/components/UserFeedback.vue +431 -431
  109. package/src/user/components/UserFeedbackEntry.vue +192 -192
  110. package/src/user/components/UserHeadCrop.vue +65 -65
  111. package/src/user/components/UserInfo.vue +637 -637
  112. package/src/user/components/UserResourceEmpty.vue +75 -75
  113. package/src/user/components/index.ts +21 -21
  114. package/src/user/index.ts +1 -1
  115. package/tsconfig.json +30 -30
  116. package/types/global.d.ts +21 -21
  117. package/types/vue.d.ts +10 -10
@@ -1,251 +1,250 @@
1
- <template>
2
- <div class="appkit-date-filter">
3
- <div class="date-filter-header">日期选择</div>
4
- <div class="content">
5
- <div class="title">自定义</div>
6
- <div class="time">
7
- <div
8
- class="item"
9
- :class="focused === 'from' ? 'current' : ''"
10
- @click="switchDateInput('from')"
11
- >
12
- {{ formatDate(result.from) }}
13
- </div>
14
- <div class="line">-</div>
15
- <div class="item" :class="focused === 'to' ? 'current' : ''" @click="switchDateInput('to')">
16
- {{ formatDate(result.to) }}
17
- </div>
18
- </div>
19
- </div>
20
- <div class="buttons spa-between">
21
- <div class="btn" @click="reset">重置</div>
22
- <div class="btn confirm" @click="onOkClick">确定</div>
23
- </div>
24
- <div class="bottom"></div>
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">
29
- <nut-date-picker
30
- v-model="focusedDate"
31
- :min-date="minDate"
32
- :max-date="maxDate"
33
- :is-show-chinese="false"
34
- :three-dimensional="false"
35
- @cancel="onDatePickerCancel"
36
- @confirm="onDatePickerComplete" />
37
- </nut-popup>
38
- </div>
39
- </template>
40
-
41
- <script lang="ts" setup>
42
- import { reactive, ref, watch } from 'vue'
43
- import { usePopup } from '@uxda/nutshell/taro'
44
-
45
- type DateFilterProps = {
46
- from: string
47
- to: string
48
- }
49
-
50
- const props = defineProps<DateFilterProps>()
51
-
52
- const emit = defineEmits(['complete', 'reset']),
53
- state = usePopup()
54
-
55
- watch(
56
- () => `${props.from}${props.to}`,
57
- () => {
58
- result.from = props.from
59
- result.to = props.to
60
- }
61
- )
62
-
63
- /**
64
- * 日期范围结果
65
- */
66
- const result = reactive<DateFilterProps>({ ...props })
67
-
68
- /**
69
- * 目前激活的日期输入框
70
- */
71
- const focused = ref<string>('from')
72
- const focusedDate = ref<any>(props.from)
73
-
74
- const minDate = ref<any>()
75
- const maxDate = ref<Date>(new Date())
76
- const datePickerOpen = ref<boolean>(false)
77
-
78
- if (state) {
79
- state.beforeClose = () => {
80
- datePickerOpen.value = false
81
- return true
82
- }
83
- }
84
-
85
- /**
86
- * 日期重置
87
- */
88
- function reset() {
89
- emit('reset')
90
- }
91
-
92
- /**
93
- * 确认,提交新时间
94
- */
95
- function onOkClick() {
96
- emit('complete', result)
97
- }
98
-
99
- function formatDate(date: string) {
100
- const [year, month, day] = date.split('-')
101
- return year + '年' + month + '月' + day + '日'
102
- }
103
-
104
- function onDatePickerComplete({ selectedValue, selectedOptions }) {
105
- let time = selectedOptions.map((val: any) => val.text).join('-')
106
- if (focused.value === 'from') {
107
- // 如果选择的时间比结束时间大,结束时间改为开始时间
108
- result.from = new Date(time) > new Date(result.to) ? result.to : time
109
- } else {
110
- result.to = time
111
- }
112
- datePickerOpen.value = false
113
- state.couldClose = true
114
- }
115
-
116
- function onDatePickerCancel () {
117
- datePickerOpen.value = false
118
- state.couldClose = true
119
- }
120
-
121
- /**
122
- * 切换时间逻辑:初始化时有时间,默认聚焦开始时间
123
- * 当选择开始时间大于结束时间,结束时间改为开始时间
124
- * 时间选择器都要小于当前时间,结束时间的时间选择器要以开始时间为最小值,
125
- */
126
- function switchDateInput (shift: string) {
127
- // 要设置一下结束时间的起始值 开始时间往前倒5年
128
- if (shift === 'from') {
129
- let time = result.from.split('-').map(Number)
130
- minDate.value = new Date(time[0] - 5, 1, 1)
131
- } else {
132
- let time = result.from.split('-').map(Number)
133
- minDate.value = new Date(time[0], time[1] - 1, time[2])
134
- }
135
- focusedDate.value = new Date(result[shift])
136
- focused.value = shift
137
- datePickerOpen.value = true
138
- // 不允许浮窗关闭
139
- state.couldClose = false
140
- }
141
- </script>
142
- <style lang="scss">
143
- .appkit-date-filter {
144
- height: 100%;
145
- display: flex;
146
- flex-direction: column;
147
- width: 100%;
148
- position: relative;
149
- .date-filter-header {
150
- text-align: center;
151
- height: 44px;
152
- line-height: 44px;
153
- color: #353535;
154
- font-size: 17px;
155
- background-color: #f5f5f5;
156
- }
157
- .content {
158
- flex: 1;
159
- margin: 15px;
160
- overflow-y: scroll;
161
- color: #353535;
162
- font-size: 13px;
163
- .title {
164
- opacity: 0.6;
165
- line-height: 18px;
166
- }
167
- .info {
168
- display: grid;
169
- grid-template-columns: 1fr 1fr 1fr;
170
- grid-gap: 10px;
171
- margin: 10px 0;
172
- .item {
173
- height: 30px;
174
- line-height: 30px;
175
- border: 1px solid #ccc;
176
- border-radius: 6px;
177
- text-align: center;
178
- }
179
- .current {
180
- border: 1px solid;
181
- border-image-source: linear-gradient(
182
- 180deg,
183
- rgba(239, 208, 130, 0.8) 0%,
184
- rgba(255, 185, 120, 0.8) 100%
185
- );
186
- background: linear-gradient(
187
- 180deg,
188
- rgba(239, 208, 130, 0.8) 0%,
189
- rgba(255, 185, 120, 0.8) 100%
190
- ),
191
- linear-gradient(180deg, #fff7e3 0%, #fefde6 100%);
192
- }
193
- }
194
- }
195
- .buttons {
196
- margin: 32px 15px 0 15px;
197
- display: flex;
198
- justify-content: space-between;
199
- align-items: center;
200
- .btn {
201
- flex: 1;
202
- height: 40px;
203
- line-height: 40px;
204
- text-align: center;
205
- border: 1px solid #ccc;
206
- box-sizing: border-box;
207
- color: #666;
208
- font-size: 16px;
209
- border-radius: 6px;
210
- }
211
- .confirm {
212
- margin-left: 11px;
213
- color: #000;
214
- border: none;
215
- background: linear-gradient(90deg, #ffebc1 0%, #ffd7a7 52.29%, #ffb875 100%);
216
- }
217
- }
218
- .time {
219
- display: flex;
220
- justify-content: flex-start;
221
- align-items: center;
222
- margin: 10px 0 30px 0;
223
- .line {
224
- margin: 0 8px;
225
- }
226
- .item {
227
- height: 30px;
228
- line-height: 30px;
229
- padding: 0 15px;
230
- font-size: 13px;
231
- color: #353535;
232
- border: 1px solid transparent;
233
- box-sizing: border-box;
234
- background: rgba(#f5f5f5, 0.8);
235
- border-radius: 6px;
236
- }
237
- .current {
238
- border: 1px solid #353535;
239
- }
240
- }
241
- .bottom {
242
- height: 32px;
243
- background: #fff;
244
- }
245
- }
246
- .nut-overlay {
247
- &.date-filter-picker-overlay {
248
- height: 100vh;
249
- }
250
- }
251
- </style>
1
+ <template>
2
+ <div class="appkit-date-filter">
3
+ <div class="date-filter-header">日期选择</div>
4
+ <div class="content">
5
+ <div class="title">自定义</div>
6
+ <div class="time">
7
+ <div class="item" :class="focused === 'from' ? 'current' : ''" @click="switchDateInput('from')">
8
+ {{ formatDate(result.from) }}
9
+ </div>
10
+ <div class="line">-</div>
11
+ <div class="item" :class="focused === 'to' ? 'current' : ''" @click="switchDateInput('to')">
12
+ {{ formatDate(result.to) }}
13
+ </div>
14
+ </div>
15
+ </div>
16
+ <div class="buttons spa-between">
17
+ <div class="btn" @click="reset">重置</div>
18
+ <div class="btn confirm" @click="onOkClick">确定</div>
19
+ </div>
20
+ <div class="bottom"></div>
21
+ <nut-popup v-model:visible="datePickerOpen" class="appkit-date-filter-picker-popup" position="bottom"
22
+ overlay-class="appkit-date-filter-picker-overlay">
23
+ <nut-date-picker v-model="focusedDate" :min-date="minDate" :max-date="maxDate" :is-show-chinese="false"
24
+ :three-dimensional="false" @cancel="onDatePickerCancel" @confirm="onDatePickerComplete" />
25
+ </nut-popup>
26
+ </div>
27
+ </template>
28
+
29
+ <script lang="ts" setup>
30
+ import { reactive, ref, watch } from 'vue'
31
+ import { usePopup } from '@uxda/nutshell/taro'
32
+
33
+ type DateFilterProps = {
34
+ from: string
35
+ to: string
36
+ }
37
+
38
+ const props = defineProps<DateFilterProps>()
39
+
40
+ const emit = defineEmits(['complete', 'reset']),
41
+ state = usePopup()
42
+
43
+ watch(
44
+ () => `${props.from}${props.to}`,
45
+ () => {
46
+ result.from = props.from
47
+ result.to = props.to
48
+ }
49
+ )
50
+
51
+ /**
52
+ * 日期范围结果
53
+ */
54
+ const result = reactive<DateFilterProps>({ ...props })
55
+
56
+ /**
57
+ * 目前激活的日期输入框
58
+ */
59
+ const focused = ref<string>('from')
60
+ const focusedDate = ref<any>(props.from)
61
+
62
+ const minDate = ref<any>()
63
+ const maxDate = ref<Date>(new Date())
64
+ const datePickerOpen = ref<boolean>(false)
65
+
66
+ if (state) {
67
+ state.beforeClose = () => {
68
+ datePickerOpen.value = false
69
+ return true
70
+ }
71
+ }
72
+
73
+ /**
74
+ * 日期重置
75
+ */
76
+ function reset() {
77
+ emit('reset')
78
+ }
79
+
80
+ /**
81
+ * 确认,提交新时间
82
+ */
83
+ function onOkClick() {
84
+ emit('complete', result)
85
+ }
86
+
87
+ function formatDate(date: string) {
88
+ const [year, month, day] = date.split('-')
89
+ return year + '' + month + '月' + day + '日'
90
+ }
91
+
92
+ function onDatePickerComplete({ selectedValue, selectedOptions }) {
93
+ let time = selectedOptions.map((val: any) => val.text).join('-')
94
+ if (focused.value === 'from') {
95
+ // 如果选择的时间比结束时间大,结束时间改为开始时间
96
+ result.from = new Date(time) > new Date(result.to) ? result.to : time
97
+ } else {
98
+ result.to = time
99
+ }
100
+ datePickerOpen.value = false
101
+ state.couldClose = true
102
+ }
103
+
104
+ function onDatePickerCancel() {
105
+ datePickerOpen.value = false
106
+ state.couldClose = true
107
+ }
108
+
109
+ /**
110
+ * 切换时间逻辑:初始化时有时间,默认聚焦开始时间
111
+ * 当选择开始时间大于结束时间,结束时间改为开始时间
112
+ * 时间选择器都要小于当前时间,结束时间的时间选择器要以开始时间为最小值,
113
+ */
114
+ function switchDateInput(shift: string) {
115
+ // 要设置一下结束时间的起始值 开始时间往前倒5年
116
+ if (shift === 'from') {
117
+ let time = result.from.split('-').map(Number)
118
+ minDate.value = new Date(time[0] - 5, 1, 1)
119
+ } else {
120
+ let time = result.from.split('-').map(Number)
121
+ minDate.value = new Date(time[0], time[1] - 1, time[2])
122
+ }
123
+ focusedDate.value = new Date(result[shift])
124
+ focused.value = shift
125
+ datePickerOpen.value = true
126
+ // 不允许浮窗关闭
127
+ state.couldClose = false
128
+ }
129
+ </script>
130
+ <style lang="scss">
131
+ .appkit-date-filter {
132
+ height: 100%;
133
+ display: flex;
134
+ flex-direction: column;
135
+ width: 100%;
136
+ position: relative;
137
+
138
+ .date-filter-header {
139
+ text-align: center;
140
+ height: 44px;
141
+ line-height: 44px;
142
+ color: #353535;
143
+ font-size: 17px;
144
+ background-color: #f5f5f5;
145
+ }
146
+
147
+ .content {
148
+ flex: 1;
149
+ margin: 15px;
150
+ overflow-y: scroll;
151
+ color: #353535;
152
+ font-size: 13px;
153
+
154
+ .title {
155
+ opacity: 0.6;
156
+ line-height: 18px;
157
+ }
158
+
159
+ .info {
160
+ display: grid;
161
+ grid-template-columns: 1fr 1fr 1fr;
162
+ grid-gap: 10px;
163
+ margin: 10px 0;
164
+
165
+ .item {
166
+ height: 30px;
167
+ line-height: 30px;
168
+ border: 1px solid #ccc;
169
+ border-radius: 6px;
170
+ text-align: center;
171
+ }
172
+
173
+ .current {
174
+ border: 1px solid;
175
+ border-image-source: linear-gradient(180deg,
176
+ rgba(239, 208, 130, 0.8) 0%,
177
+ rgba(255, 185, 120, 0.8) 100%);
178
+ background: linear-gradient(180deg,
179
+ rgba(239, 208, 130, 0.8) 0%,
180
+ rgba(255, 185, 120, 0.8) 100%),
181
+ linear-gradient(180deg, #fff7e3 0%, #fefde6 100%);
182
+ }
183
+ }
184
+ }
185
+
186
+ .buttons {
187
+ margin: 32px 15px 0 15px;
188
+ display: flex;
189
+ justify-content: space-between;
190
+ align-items: center;
191
+
192
+ .btn {
193
+ flex: 1;
194
+ height: 40px;
195
+ line-height: 40px;
196
+ text-align: center;
197
+ border: 1px solid #ccc;
198
+ box-sizing: border-box;
199
+ color: #666;
200
+ font-size: 16px;
201
+ border-radius: 6px;
202
+ }
203
+
204
+ .confirm {
205
+ margin-left: 11px;
206
+ color: #fff;
207
+ border: none;
208
+ background: #017FFF;
209
+ }
210
+ }
211
+
212
+ .time {
213
+ display: flex;
214
+ justify-content: flex-start;
215
+ align-items: center;
216
+ margin: 10px 0 30px 0;
217
+
218
+ .line {
219
+ margin: 0 8px;
220
+ }
221
+
222
+ .item {
223
+ height: 30px;
224
+ line-height: 30px;
225
+ padding: 0 15px;
226
+ font-size: 13px;
227
+ color: #353535;
228
+ border: 1px solid transparent;
229
+ box-sizing: border-box;
230
+ background: rgba(#f5f5f5, 0.8);
231
+ border-radius: 6px;
232
+ }
233
+
234
+ .current {
235
+ border: 1px solid #353535;
236
+ }
237
+ }
238
+
239
+ .bottom {
240
+ height: 32px;
241
+ background: #fff;
242
+ }
243
+ }
244
+
245
+ .nut-overlay {
246
+ &.date-filter-picker-overlay {
247
+ height: 100vh;
248
+ }
249
+ }
250
+ </style>
@@ -1,81 +1,81 @@
1
- <template>
2
- <div class="date-range" @click="openDateRangePicker">
3
- <div class="text">{{ dateRangeDisplay }}</div>
4
- <img
5
- style="margin-top: -2px"
6
- class="time-icon"
7
- src="https://cdn.ddjf.com/static/images/bpms-workBench/clound-bean-down.png"
8
- />
9
- </div>
10
- </template>
11
-
12
- <script lang="ts" setup>
13
- import { computed, PropType, ref } from 'vue'
14
- import { useNutshell } from '@uxda/nutshell/taro'
15
- import DateFilter from './DateFilter.vue'
16
- import dayjs from 'dayjs'
17
-
18
- const $n = useNutshell()
19
-
20
- export type DateRangeModel = {
21
- from: string,
22
- to: string
23
- }
24
-
25
- const model = defineModel({
26
- type: Object as PropType<DateRangeModel>,
27
- required: false,
28
- default: {
29
- from: dayjs().add(-1, 'M').format('YYYY-MM-DD'),
30
- to: dayjs().format('YYYY-MM-DD')
31
- }
32
- })
33
-
34
- const openDateRangePicker = () => {
35
- const child = ref()
36
- $n.sheet({
37
- component: DateFilter,
38
- ref: child,
39
- props: {
40
- from: model.value.from,
41
- to: model.value.to,
42
- },
43
- modal: true, // 不允许点击 overlay 关闭弹窗
44
- mask: true,
45
- onComplete (result: any) {
46
- model.value = {
47
- from: result.from,
48
- to: result.to
49
- }
50
- }
51
- })
52
- }
53
-
54
- const dateRangeDisplay = computed(() => {
55
- let startTime = (model.value.from || '').replace(/-/g, '.').substring(2)
56
- let endTime = (model.value.to || '').replace(/-/g, '.').substring(2)
57
- return startTime + '-' + endTime
58
- })
59
-
60
- </script>
61
-
62
- <style lang="scss">
63
- .date-range {
64
- height: 22px;
65
- padding-right: 5px;
66
- flex: 1;
67
- display: flex;
68
- align-items: center;
69
- .text {
70
- width: fit-content;
71
- white-space: nowrap;
72
- }
73
- .time-icon {
74
- display: block;
75
- font-size: 0;
76
- width: 12px;
77
- height: 12px;
78
- margin-left: 4px;
79
- }
80
- }
1
+ <template>
2
+ <div class="date-range" @click="openDateRangePicker">
3
+ <div class="text">{{ dateRangeDisplay }}</div>
4
+ <img
5
+ style="margin-top: -2px"
6
+ class="time-icon"
7
+ src="https://cdn.ddjf.com/static/images/bpms-workBench/clound-bean-down.png"
8
+ />
9
+ </div>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import { computed, PropType, ref } from 'vue'
14
+ import { useNutshell } from '@uxda/nutshell/taro'
15
+ import DateFilter from './DateFilter.vue'
16
+ import dayjs from 'dayjs'
17
+
18
+ const $n = useNutshell()
19
+
20
+ export type DateRangeModel = {
21
+ from: string,
22
+ to: string
23
+ }
24
+
25
+ const model = defineModel({
26
+ type: Object as PropType<DateRangeModel>,
27
+ required: false,
28
+ default: {
29
+ from: dayjs().add(-1, 'M').format('YYYY-MM-DD'),
30
+ to: dayjs().format('YYYY-MM-DD')
31
+ }
32
+ })
33
+
34
+ const openDateRangePicker = () => {
35
+ const child = ref()
36
+ $n.sheet({
37
+ component: DateFilter,
38
+ ref: child,
39
+ props: {
40
+ from: model.value.from,
41
+ to: model.value.to,
42
+ },
43
+ modal: true, // 不允许点击 overlay 关闭弹窗
44
+ mask: true,
45
+ onComplete (result: any) {
46
+ model.value = {
47
+ from: result.from,
48
+ to: result.to
49
+ }
50
+ }
51
+ })
52
+ }
53
+
54
+ const dateRangeDisplay = computed(() => {
55
+ let startTime = (model.value.from || '').replace(/-/g, '.').substring(2)
56
+ let endTime = (model.value.to || '').replace(/-/g, '.').substring(2)
57
+ return startTime + '-' + endTime
58
+ })
59
+
60
+ </script>
61
+
62
+ <style lang="scss">
63
+ .date-range {
64
+ height: 22px;
65
+ padding-right: 5px;
66
+ flex: 1;
67
+ display: flex;
68
+ align-items: center;
69
+ .text {
70
+ width: fit-content;
71
+ white-space: nowrap;
72
+ }
73
+ .time-icon {
74
+ display: block;
75
+ font-size: 0;
76
+ width: 12px;
77
+ height: 12px;
78
+ margin-left: 4px;
79
+ }
80
+ }
81
81
  </style>