@uxda/appkit 4.2.24 → 4.2.26

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 +3 -3
  5. package/dist/index.js +8 -8
  6. package/package.json +79 -79
  7. package/project.config.json +15 -15
  8. package/project.tt.json +13 -13
  9. package/rollup.config.mjs +67 -67
  10. package/src/Appkit.ts +66 -66
  11. package/src/balance/api/endpoints.ts +133 -133
  12. package/src/balance/api/index.ts +106 -106
  13. package/src/balance/components/AccountView.vue +760 -760
  14. package/src/balance/components/BalanceCard.vue +215 -215
  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 +250 -250
  19. package/src/balance/components/DateRange.vue +80 -80
  20. package/src/balance/components/ListFilter.vue +62 -62
  21. package/src/balance/components/ListFilterPicker.vue +191 -191
  22. package/src/balance/components/PromoterCard.vue +237 -237
  23. package/src/balance/components/SecondBalance.vue +71 -71
  24. package/src/balance/components/Tip.vue +45 -45
  25. package/src/balance/components/index.ts +8 -8
  26. package/src/balance/types.ts +97 -97
  27. package/src/components/bt-cropper/index.vue +730 -774
  28. package/src/components/bt-cropper/utils/calcCropper.js +42 -42
  29. package/src/components/bt-cropper/utils/calcImagePosition.js +23 -23
  30. package/src/components/bt-cropper/utils/calcImageSize.js +37 -37
  31. package/src/components/bt-cropper/utils/calcPointDistance.js +12 -12
  32. package/src/components/bt-cropper/utils/calcRightAndBottom.js +7 -7
  33. package/src/components/bt-cropper/utils/ratio.js +3 -3
  34. package/src/components/bt-cropper/utils/tools.js +25 -25
  35. package/src/components/dd-area/index.vue +225 -225
  36. package/src/components/dd-icon/doc.md +21 -21
  37. package/src/components/dd-icon/index.vue +23 -23
  38. package/src/components/dd-notice-bar/index.vue +78 -78
  39. package/src/components/dd-search/doc.md +34 -34
  40. package/src/components/dd-search/index.vue +168 -168
  41. package/src/components/dd-selector/index.vue +124 -124
  42. package/src/components/dd-skeleton/doc.md +19 -19
  43. package/src/components/dd-skeleton/index.vue +36 -36
  44. package/src/global.ts +6 -6
  45. package/src/index.ts +89 -89
  46. package/src/main.scss +1 -1
  47. package/src/notice/api/endpoints.ts +17 -17
  48. package/src/notice/api/index.ts +106 -106
  49. package/src/notice/components/NoticeBanner.vue +243 -243
  50. package/src/notice/components/NoticeEntry.vue +99 -99
  51. package/src/notice/components/NoticeList.vue +315 -315
  52. package/src/notice/components/NoticePopup.vue +162 -162
  53. package/src/notice/components/index.ts +5 -5
  54. package/src/notice/components/useCommonList.ts +86 -86
  55. package/src/notice/components/useNotice.ts +35 -35
  56. package/src/notice/index.ts +1 -1
  57. package/src/notice/types.ts +25 -25
  58. package/src/payment/api/config.ts +7 -7
  59. package/src/payment/api/endpoints.ts +103 -103
  60. package/src/payment/api/index.ts +100 -100
  61. package/src/payment/components/AmountPicker.vue +90 -90
  62. package/src/payment/components/RechargeResult.vue +69 -69
  63. package/src/payment/components/RechargeView.vue +155 -155
  64. package/src/payment/components/RightsPicker.vue +105 -105
  65. package/src/payment/components/TradeView.vue +317 -317
  66. package/src/payment/components/UserAgreement.vue +234 -234
  67. package/src/payment/components/index.ts +22 -22
  68. package/src/payment/index.ts +5 -5
  69. package/src/payment/services/index.ts +16 -16
  70. package/src/payment/services/invoke-recharge.ts +25 -25
  71. package/src/payment/services/request-payment.ts +58 -58
  72. package/src/payment/types.ts +28 -28
  73. package/src/register/components/SelfRegistration.vue +233 -233
  74. package/src/register/components/index.ts +2 -2
  75. package/src/shared/components/AppDrawer.vue +54 -54
  76. package/src/shared/components/AppVerify.vue +128 -128
  77. package/src/shared/components/DeviceVersion.vue +63 -68
  78. package/src/shared/components/EmptyView.vue +33 -33
  79. package/src/shared/components/OcrBusinessLicense.vue +130 -130
  80. package/src/shared/components/OcrIcon.vue +202 -202
  81. package/src/shared/components/PageHeader.vue +84 -84
  82. package/src/shared/components/index.ts +8 -8
  83. package/src/shared/composables/index.ts +8 -8
  84. package/src/shared/composables/useAmount.ts +46 -46
  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 +124 -124
  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 +32 -32
  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/vars.scss +3 -3
  100. package/src/user/api/endpoints.ts +17 -17
  101. package/src/user/api/index.ts +111 -111
  102. package/src/user/components/LoginSetting.vue +114 -114
  103. package/src/user/components/UserAuth.vue +257 -257
  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 +133 -133
  107. package/src/user/components/UserFeedback.vue +431 -431
  108. package/src/user/components/UserFeedbackEntry.vue +175 -192
  109. package/src/user/components/UserHeadCrop.vue +65 -65
  110. package/src/user/components/UserInfo.vue +826 -826
  111. package/src/user/components/UserResourceEmpty.vue +75 -75
  112. package/src/user/components/index.ts +23 -23
  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,250 +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 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
+ <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 style="margin-top: -2px" class="time-icon"
5
- src="https://cdn.ddjf.com/static/images/bpms-workBench/clound-bean-down.png" />
6
- </div>
7
- </template>
8
-
9
- <script lang="ts" setup>
10
- import { computed, PropType, ref } from 'vue'
11
- import { useNutshell } from '@uxda/nutshell/taro'
12
- import DateFilter from './DateFilter.vue'
13
- import dayjs from 'dayjs'
14
-
15
- const $n = useNutshell()
16
-
17
- export type DateRangeModel = {
18
- from: string,
19
- to: string
20
- }
21
-
22
- const model = defineModel({
23
- type: Object as PropType<DateRangeModel>,
24
- required: false,
25
- default: {
26
- from: dayjs().add(-1, 'M').format('YYYY-MM-DD'),
27
- to: dayjs().format('YYYY-MM-DD')
28
- }
29
- })
30
-
31
- const openDateRangePicker = () => {
32
- const child = ref()
33
- $n.sheet({
34
- component: DateFilter,
35
- class: 'ns-sheet-reset date-filter-sheet',
36
- ref: child,
37
- props: {
38
- from: model.value.from,
39
- to: model.value.to,
40
- },
41
- modal: true, // 不允许点击 overlay 关闭弹窗
42
- mask: true,
43
- onComplete(result: any) {
44
- model.value = {
45
- from: result.from,
46
- to: result.to
47
- }
48
- }
49
- })
50
- }
51
-
52
- const dateRangeDisplay = computed(() => {
53
- let startTime = (model.value.from || '').replace(/-/g, '.').substring(2)
54
- let endTime = (model.value.to || '').replace(/-/g, '.').substring(2)
55
- return startTime + '-' + endTime
56
- })
57
-
58
- </script>
59
-
60
- <style lang="scss">
61
- .date-range {
62
- height: 22px;
63
- padding-right: 5px;
64
- flex: 1;
65
- display: flex;
66
- align-items: center;
67
-
68
- .text {
69
- width: fit-content;
70
- white-space: nowrap;
71
- }
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 style="margin-top: -2px" class="time-icon"
5
+ src="https://cdn.ddjf.com/static/images/bpms-workBench/clound-bean-down.png" />
6
+ </div>
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ import { computed, PropType, ref } from 'vue'
11
+ import { useNutshell } from '@uxda/nutshell/taro'
12
+ import DateFilter from './DateFilter.vue'
13
+ import dayjs from 'dayjs'
14
+
15
+ const $n = useNutshell()
16
+
17
+ export type DateRangeModel = {
18
+ from: string,
19
+ to: string
20
+ }
21
+
22
+ const model = defineModel({
23
+ type: Object as PropType<DateRangeModel>,
24
+ required: false,
25
+ default: {
26
+ from: dayjs().add(-1, 'M').format('YYYY-MM-DD'),
27
+ to: dayjs().format('YYYY-MM-DD')
28
+ }
29
+ })
30
+
31
+ const openDateRangePicker = () => {
32
+ const child = ref()
33
+ $n.sheet({
34
+ component: DateFilter,
35
+ class: 'ns-sheet-reset date-filter-sheet',
36
+ ref: child,
37
+ props: {
38
+ from: model.value.from,
39
+ to: model.value.to,
40
+ },
41
+ modal: true, // 不允许点击 overlay 关闭弹窗
42
+ mask: true,
43
+ onComplete(result: any) {
44
+ model.value = {
45
+ from: result.from,
46
+ to: result.to
47
+ }
48
+ }
49
+ })
50
+ }
51
+
52
+ const dateRangeDisplay = computed(() => {
53
+ let startTime = (model.value.from || '').replace(/-/g, '.').substring(2)
54
+ let endTime = (model.value.to || '').replace(/-/g, '.').substring(2)
55
+ return startTime + '-' + endTime
56
+ })
57
+
58
+ </script>
59
+
60
+ <style lang="scss">
61
+ .date-range {
62
+ height: 22px;
63
+ padding-right: 5px;
64
+ flex: 1;
65
+ display: flex;
66
+ align-items: center;
67
+
68
+ .text {
69
+ width: fit-content;
70
+ white-space: nowrap;
71
+ }
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>