@uxda/appkit 4.1.19 → 4.1.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.1.19",
3
+ "version": "4.1.21",
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.25.6",
23
+ "@babel/runtime": "^7.7.7",
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,6 +34,7 @@
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",
37
38
  "dayjs": "^1.11.10",
38
39
  "validator": "^13.12.0",
39
40
  "vue": "^3.5.0"
@@ -70,8 +71,5 @@
70
71
  "unplugin-auto-import": "^0.18.2",
71
72
  "unplugin-vue-components": "^0.27.3",
72
73
  "webpack": "^5.78.0"
73
- },
74
- "peerDependencies": {
75
- "@uxda/nutshell": "^1.0.0"
76
74
  }
77
75
  }
package/src/Appkit.ts CHANGED
@@ -27,10 +27,6 @@ export type AppKitOptions = {
27
27
  * 临时 appcode 获取方法
28
28
  * 由使用场景提供
29
29
  */
30
- tempAppcode: () => string
31
- /**
32
- * 调用 API 时使用的 base url
33
- */
34
30
  baseUrl(): string
35
31
 
36
32
  401(): void
@@ -43,7 +39,6 @@ export type AppKitOptions = {
43
39
  export type DollarApp = {
44
40
  setToken: (token: () => string) => void
45
41
  setTempToken: (token: () => string) => void
46
- setTempAppcode: (appcode: () => string) => void
47
42
  requestPayment: (options: PaymentParams) => void
48
43
  invokeRecharge: (options: RechargeParams) => void
49
44
  }
@@ -56,7 +51,6 @@ const appKitOptions: AppKitOptions = {
56
51
  tenant: () => '',
57
52
  token: () => '',
58
53
  tempToken: () => '',
59
- tempAppcode: () => '',
60
54
  baseUrl: () => '',
61
55
  401() {},
62
56
  gray: () => '',
@@ -1,14 +1,10 @@
1
1
  <template>
2
- <div class="appkit-date-filter">
2
+ <div class="consumption-date-filter">
3
3
  <div class="date-filter-header">日期选择</div>
4
4
  <div class="content">
5
5
  <div class="title">自定义</div>
6
6
  <div class="time">
7
- <div
8
- class="item"
9
- :class="focused === 'from' ? 'current' : ''"
10
- @click="switchDateInput('from')"
11
- >
7
+ <div class="item" :class="focused === 'from' ? 'current' : ''" @click="switchDateInput('from')">
12
8
  {{ formatDate(result.from) }}
13
9
  </div>
14
10
  <div class="line">-</div>
@@ -22,25 +18,15 @@
22
18
  <div class="btn confirm" @click="onOkClick">确定</div>
23
19
  </div>
24
20
  <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" />
21
+ <nut-popup v-model:visible="datePickerOpen" position="bottom">
22
+ <nut-date-picker v-model="focusedDate" :min-date="minDate" :max-date="maxDate" :is-show-chinese="false"
23
+ :three-dimensional="false" @cancel="datePickerOpen = false" @confirm="onDatePickerComplete"></nut-date-picker>
37
24
  </nut-popup>
38
25
  </div>
39
26
  </template>
40
27
 
41
28
  <script lang="ts" setup>
42
29
  import { reactive, ref, watch } from 'vue'
43
- import { usePopup } from '@uxda/nutshell/taro'
44
30
 
45
31
  type DateFilterProps = {
46
32
  from: string
@@ -49,8 +35,7 @@ type DateFilterProps = {
49
35
 
50
36
  const props = defineProps<DateFilterProps>()
51
37
 
52
- const emit = defineEmits(['complete', 'reset']),
53
- state = usePopup()
38
+ const emit = defineEmits(['complete', 'reset'])
54
39
 
55
40
  watch(
56
41
  () => `${props.from}${props.to}`,
@@ -75,10 +60,7 @@ const minDate = ref<any>()
75
60
  const maxDate = ref<Date>(new Date())
76
61
  const datePickerOpen = ref<boolean>(false)
77
62
 
78
- state.beforeClose = () => {
79
- datePickerOpen.value = false
80
- return true
81
- }
63
+
82
64
 
83
65
  /**
84
66
  * 日期重置
@@ -108,20 +90,16 @@ function onDatePickerComplete({ selectedValue, selectedOptions }) {
108
90
  result.to = time
109
91
  }
110
92
  datePickerOpen.value = false
111
- state.couldClose = true
112
93
  }
113
94
 
114
- function onDatePickerCancel () {
115
- datePickerOpen.value = false
116
- state.couldClose = true
117
- }
95
+
118
96
 
119
97
  /**
120
98
  * 切换时间逻辑:初始化时有时间,默认聚焦开始时间
121
99
  * 当选择开始时间大于结束时间,结束时间改为开始时间
122
100
  * 时间选择器都要小于当前时间,结束时间的时间选择器要以开始时间为最小值,
123
101
  */
124
- function switchDateInput (shift: string) {
102
+ function switchDateInput(shift: string) {
125
103
  // 要设置一下结束时间的起始值 开始时间往前倒5年
126
104
  if (shift === 'from') {
127
105
  let time = result.from.split('-').map(Number)
@@ -133,17 +111,16 @@ function switchDateInput (shift: string) {
133
111
  focusedDate.value = new Date(result[shift])
134
112
  focused.value = shift
135
113
  datePickerOpen.value = true
136
- // 不允许浮窗关闭
137
- state.couldClose = false
138
114
  }
139
115
  </script>
140
116
  <style lang="scss">
141
- .appkit-date-filter {
117
+ .consumption-date-filter {
142
118
  height: 100%;
143
119
  display: flex;
144
120
  flex-direction: column;
145
121
  width: 100%;
146
122
  position: relative;
123
+
147
124
  .date-filter-header {
148
125
  text-align: center;
149
126
  height: 44px;
@@ -152,21 +129,25 @@ function switchDateInput (shift: string) {
152
129
  font-size: 17px;
153
130
  background-color: #f5f5f5;
154
131
  }
132
+
155
133
  .content {
156
134
  flex: 1;
157
135
  margin: 15px;
158
136
  overflow-y: scroll;
159
137
  color: #353535;
160
138
  font-size: 13px;
139
+
161
140
  .title {
162
141
  opacity: 0.6;
163
142
  line-height: 18px;
164
143
  }
144
+
165
145
  .info {
166
146
  display: grid;
167
147
  grid-template-columns: 1fr 1fr 1fr;
168
148
  grid-gap: 10px;
169
149
  margin: 10px 0;
150
+
170
151
  .item {
171
152
  height: 30px;
172
153
  line-height: 30px;
@@ -174,27 +155,26 @@ function switchDateInput (shift: string) {
174
155
  border-radius: 6px;
175
156
  text-align: center;
176
157
  }
158
+
177
159
  .current {
178
160
  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,
161
+ border-image-source: linear-gradient(180deg,
186
162
  rgba(239, 208, 130, 0.8) 0%,
187
- rgba(255, 185, 120, 0.8) 100%
188
- ),
163
+ rgba(255, 185, 120, 0.8) 100%);
164
+ background: linear-gradient(180deg,
165
+ rgba(239, 208, 130, 0.8) 0%,
166
+ rgba(255, 185, 120, 0.8) 100%),
189
167
  linear-gradient(180deg, #fff7e3 0%, #fefde6 100%);
190
168
  }
191
169
  }
192
170
  }
171
+
193
172
  .buttons {
194
- margin: 32px 15px 0 15px;
173
+ margin: 0 15px;
195
174
  display: flex;
196
175
  justify-content: space-between;
197
176
  align-items: center;
177
+
198
178
  .btn {
199
179
  flex: 1;
200
180
  height: 40px;
@@ -206,6 +186,7 @@ function switchDateInput (shift: string) {
206
186
  font-size: 16px;
207
187
  border-radius: 6px;
208
188
  }
189
+
209
190
  .confirm {
210
191
  margin-left: 11px;
211
192
  color: #000;
@@ -213,14 +194,17 @@ function switchDateInput (shift: string) {
213
194
  background: linear-gradient(90deg, #ffebc1 0%, #ffd7a7 52.29%, #ffb875 100%);
214
195
  }
215
196
  }
197
+
216
198
  .time {
217
199
  display: flex;
218
200
  justify-content: flex-start;
219
201
  align-items: center;
220
202
  margin: 10px 0 30px 0;
203
+
221
204
  .line {
222
205
  margin: 0 8px;
223
206
  }
207
+
224
208
  .item {
225
209
  height: 30px;
226
210
  line-height: 30px;
@@ -232,18 +216,15 @@ function switchDateInput (shift: string) {
232
216
  background: rgba(#f5f5f5, 0.8);
233
217
  border-radius: 6px;
234
218
  }
219
+
235
220
  .current {
236
221
  border: 1px solid #353535;
237
222
  }
238
223
  }
224
+
239
225
  .bottom {
240
226
  height: 32px;
241
227
  background: #fff;
242
228
  }
243
229
  }
244
- .nut-overlay {
245
- &.date-filter-picker-overlay {
246
- height: 100vh;
247
- }
248
- }
249
230
  </style>
@@ -1,16 +1,13 @@
1
1
  <template>
2
2
  <div class="date-range" @click="openDateRangePicker">
3
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
- />
4
+ <img style="margin-top: -2px" class="time-icon"
5
+ src="https://cdn.ddjf.com/static/images/bpms-workBench/clound-bean-down.png" />
9
6
  </div>
10
7
  </template>
11
8
 
12
9
  <script lang="ts" setup>
13
- import { computed, PropType, ref } from 'vue'
10
+ import { computed, PropType, reactive } from 'vue'
14
11
  import { useNutshell } from '@uxda/nutshell/taro'
15
12
  import DateFilter from './DateFilter.vue'
16
13
  import dayjs from 'dayjs'
@@ -32,17 +29,13 @@ const model = defineModel({
32
29
  })
33
30
 
34
31
  const openDateRangePicker = () => {
35
- const child = ref()
36
32
  $n.sheet({
37
33
  component: DateFilter,
38
- ref: child,
39
34
  props: {
40
35
  from: model.value.from,
41
36
  to: model.value.to,
42
37
  },
43
- modal: true, // 不允许点击 overlay 关闭弹窗
44
- mask: true,
45
- onComplete (result: any) {
38
+ onComplete(result: any) {
46
39
  model.value = {
47
40
  from: result.from,
48
41
  to: result.to
@@ -66,10 +59,12 @@ const dateRangeDisplay = computed(() => {
66
59
  flex: 1;
67
60
  display: flex;
68
61
  align-items: center;
62
+
69
63
  .text {
70
64
  width: fit-content;
71
65
  white-space: nowrap;
72
66
  }
67
+
73
68
  .time-icon {
74
69
  display: block;
75
70
  font-size: 0;
package/src/index.ts CHANGED
@@ -48,10 +48,6 @@ const $app: DollarApp = {
48
48
  const appKitOptions = useAppKitOptions()
49
49
  appKitOptions.tempToken = token
50
50
  },
51
- setTempAppcode: (appcode: () => string) => {
52
- const appKitOptions = useAppKitOptions()
53
- appKitOptions.tempAppcode = appcode
54
- },
55
51
  requestPayment: (options: PaymentParams) => {},
56
52
  invokeRecharge: (options: RechargeParams) => {},
57
53
  }