@uxda/appkit 4.1.26 → 4.1.29

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