wl-design-mobile 0.6.8 → 0.7.0
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div @click="handleClick">
|
|
3
3
|
<table width="100%" class="title-tb" border="0">
|
|
4
4
|
<tr>
|
|
5
5
|
<td class="card-title0">{{ title }}</td>
|
|
@@ -30,12 +30,14 @@ export default {
|
|
|
30
30
|
return {
|
|
31
31
|
|
|
32
32
|
}
|
|
33
|
-
},
|
|
34
|
-
methods: {
|
|
35
|
-
|
|
36
33
|
},
|
|
37
34
|
created() {
|
|
38
35
|
console.log("head item:", this.item)
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
handleClick() {
|
|
39
|
+
this.$emit('click', this.item);
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
</script>
|
|
@@ -52,11 +52,11 @@ export default {
|
|
|
52
52
|
},
|
|
53
53
|
minDate: {
|
|
54
54
|
type: Date,
|
|
55
|
-
default: () =>
|
|
55
|
+
default: () => moment().subtract(3, 'years').toDate(),
|
|
56
56
|
},
|
|
57
57
|
maxDate: {
|
|
58
58
|
type: Date,
|
|
59
|
-
default: () =>
|
|
59
|
+
default: () => moment().add(3, 'years').toDate(),
|
|
60
60
|
},
|
|
61
61
|
allowSameDay: {
|
|
62
62
|
type: Boolean,
|
package/list/lambo-list.vue
CHANGED
|
@@ -96,16 +96,16 @@ export default {
|
|
|
96
96
|
setTimeout(() => {
|
|
97
97
|
console.log('this.searchParams',this.searchParams)
|
|
98
98
|
let arr = [
|
|
99
|
-
{title: "
|
|
100
|
-
{title: "
|
|
101
|
-
{title: "
|
|
102
|
-
{title: "
|
|
103
|
-
{title: "
|
|
104
|
-
{title: "
|
|
105
|
-
{title: "
|
|
106
|
-
{title: "
|
|
107
|
-
{title: "
|
|
108
|
-
{title: "
|
|
99
|
+
{title: "XX市XXXX酒业商行", time: "2024-01-01", person:"01", dpt: "储配部", note: "XX工作"},
|
|
100
|
+
{title: "XX市XXXX酒业商行", time: "2024-01-02", person:"02", dpt: "储配部", note: "XX工作"},
|
|
101
|
+
{title: "XX市XXXX酒业商行", time: "2024-01-01", person:"01", dpt: "储配部", note: "XX工作"},
|
|
102
|
+
{title: "XX市XXXX酒业商行", time: "2024-01-02", person:"02", dpt: "储配部", note: "XX工作"},
|
|
103
|
+
{title: "XX市XXXX酒业商行", time: "2024-01-01", person:"01", dpt: "储配部", note: "XX工作"},
|
|
104
|
+
{title: "XX市XXXX酒业商行", time: "2024-01-02", person:"02", dpt: "储配部", note: "XX工作"},
|
|
105
|
+
{title: "XX市XXXX酒业商行", time: "2024-01-01", person:"01", dpt: "储配部", note: "XX工作"},
|
|
106
|
+
{title: "XX市XXXX酒业商行", time: "2024-01-02", person:"02", dpt: "储配部", note: "XX工作"},
|
|
107
|
+
{title: "XX市XXXX酒业商行", time: "2024-01-01", person:"01", dpt: "储配部", note: "XX工作"},
|
|
108
|
+
{title: "XX市XXXX酒业商行", time: "2024-01-02", person:"02", dpt: "储配部", note: "XX工作"},
|
|
109
109
|
]
|
|
110
110
|
this.list.push(...arr)
|
|
111
111
|
this.finished = false
|
package/package.json
CHANGED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="week-date-picker"
|
|
4
|
+
@touchstart="handleTouchStart"
|
|
5
|
+
@touchmove="handleTouchMove"
|
|
6
|
+
@touchend="handleTouchEnd"
|
|
7
|
+
@mousedown="handleMouseDown"
|
|
8
|
+
@mousemove="handleMouseMove"
|
|
9
|
+
@mouseup="handleMouseUp"
|
|
10
|
+
@mouseleave="handleMouseLeave"
|
|
11
|
+
>
|
|
12
|
+
<div class="week-days">
|
|
13
|
+
<div
|
|
14
|
+
v-for="day in weekDays"
|
|
15
|
+
:key="day.date.getTime()"
|
|
16
|
+
class="day-item"
|
|
17
|
+
:class="{
|
|
18
|
+
'today': day.isToday,
|
|
19
|
+
'active': day.isSelected,
|
|
20
|
+
}"
|
|
21
|
+
@click="selectDay(day)"
|
|
22
|
+
>
|
|
23
|
+
<div class="day-week">{{ day.weekDay }}</div>
|
|
24
|
+
<div class="day-month">{{ day.month }}月</div>
|
|
25
|
+
<div class="day-date">{{ day.date.getDate() }}</div>
|
|
26
|
+
<div v-if="day.isToday" class="today-dot"></div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
const WEEK_DAYS = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
name: "LamboWeekSelect",
|
|
37
|
+
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
selectedDate: new Date(),
|
|
41
|
+
weekStart: null,
|
|
42
|
+
startX: 0,
|
|
43
|
+
endX: 0,
|
|
44
|
+
isDragging: false,
|
|
45
|
+
swipeThreshold: 50,
|
|
46
|
+
clickDisabled: false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
props: {
|
|
50
|
+
weekDate: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: null
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
created() {
|
|
57
|
+
if (this.weekDate) {
|
|
58
|
+
this.initWithWeekDate(this.weekDate);
|
|
59
|
+
} else {
|
|
60
|
+
const today = new Date();
|
|
61
|
+
const todayStr = this.formatDateToYYYYMMDD(today);
|
|
62
|
+
this.initWithWeekDate(todayStr);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
computed: {
|
|
67
|
+
weekDays() {
|
|
68
|
+
if (!this.weekStart) return [];
|
|
69
|
+
return Array.from({length: 7}, (_, i) => {
|
|
70
|
+
const date = new Date(this.weekStart);
|
|
71
|
+
date.setDate(this.weekStart.getDate() + i);
|
|
72
|
+
const today = new Date();
|
|
73
|
+
return {
|
|
74
|
+
date,
|
|
75
|
+
month: date.getMonth() + 1,
|
|
76
|
+
weekDay: WEEK_DAYS[date.getDay()],
|
|
77
|
+
isToday: this.isSameDay(date, today),
|
|
78
|
+
isSelected: this.isSameDay(date, this.selectedDate)
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
methods: {
|
|
85
|
+
/**
|
|
86
|
+
* 根据YYYYMMDD格式的字符串初始化组件
|
|
87
|
+
* @param {string} dateFormat- 格式如:"20251205"
|
|
88
|
+
*/
|
|
89
|
+
initWithWeekDate(dateFormat) {
|
|
90
|
+
// 解析YYYYMMDD格式字符串为Date对象
|
|
91
|
+
const date = this.parseYYYYMMDD(dateFormat);
|
|
92
|
+
|
|
93
|
+
if (date) {
|
|
94
|
+
console.log("根据传入日期初始化:", dateFormat);
|
|
95
|
+
this.setWeekStart(date);
|
|
96
|
+
this.selectedDate = new Date(date);
|
|
97
|
+
} else {
|
|
98
|
+
console.log("日期解析失败,使用今天");
|
|
99
|
+
const today = new Date();
|
|
100
|
+
this.setWeekStart(today);
|
|
101
|
+
this.selectedDate = new Date(today);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 解析YYYYMMDD格式字符串为Date对象
|
|
107
|
+
* @param {string} yyyymmdd - 格式如:"20251205"
|
|
108
|
+
* @returns {Date|null} Date对象或null
|
|
109
|
+
*/
|
|
110
|
+
parseYYYYMMDD(dateFormat) {
|
|
111
|
+
if (!dateFormat || typeof dateFormat !== 'string' || dateFormat.length !== 8) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
const year = parseInt(dateFormat.substring(0, 4));
|
|
117
|
+
const month = parseInt(dateFormat.substring(4, 6)) - 1;
|
|
118
|
+
const day = parseInt(dateFormat.substring(6, 8));
|
|
119
|
+
|
|
120
|
+
const date = new Date(year, month, day);
|
|
121
|
+
|
|
122
|
+
// 验证日期是否有效
|
|
123
|
+
if (isNaN(date.getTime()) ||
|
|
124
|
+
date.getFullYear() !== year ||
|
|
125
|
+
date.getMonth() !== month ||
|
|
126
|
+
date.getDate() !== day) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return date;
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.error("日期解析错误:", error);
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
setWeekStart(date) {
|
|
138
|
+
const d = new Date(date);
|
|
139
|
+
const day = d.getDay();
|
|
140
|
+
const diff = d.getDate() - (day === 0 ? 6 : day - 1);
|
|
141
|
+
d.setDate(diff);
|
|
142
|
+
d.setHours(0, 0, 0, 0);
|
|
143
|
+
this.weekStart = d;
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
isSameDay(d1, d2) {
|
|
147
|
+
if (!d1 || !d2) return false;
|
|
148
|
+
return d1.toDateString() === d2.toDateString();
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
formatDateToYYYYMMDD(date) {
|
|
152
|
+
const year = date.getFullYear();
|
|
153
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
154
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
155
|
+
return `${year}${month}${day}`;
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
selectDay(day) {
|
|
159
|
+
if (this.clickDisabled) {
|
|
160
|
+
this.clickDisabled = false;
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
this.selectedDate = new Date(day.date);
|
|
164
|
+
const clickDate = this.formatDateToYYYYMMDD(this.selectedDate);
|
|
165
|
+
console.log('选中的日期:', clickDate);
|
|
166
|
+
// 触发自定义事件,传递YYYYMMDD格式的日期
|
|
167
|
+
this.$emit('click', clickDate);
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
goPrevWeek() {
|
|
171
|
+
const newWeekStart = new Date(this.weekStart);
|
|
172
|
+
newWeekStart.setDate(this.weekStart.getDate() - 7);
|
|
173
|
+
this.setWeekStart(newWeekStart);
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
goNextWeek() {
|
|
177
|
+
const newWeekStart = new Date(this.weekStart);
|
|
178
|
+
newWeekStart.setDate(this.weekStart.getDate() + 7);
|
|
179
|
+
this.setWeekStart(newWeekStart);
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
handleTouchStart(e) {
|
|
183
|
+
this.startX = e.touches[0].clientX;
|
|
184
|
+
this.endX = this.startX;
|
|
185
|
+
this.isDragging = true;
|
|
186
|
+
this.clickDisabled = false;
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
handleTouchMove(e) {
|
|
190
|
+
if (!this.isDragging) return;
|
|
191
|
+
this.endX = e.touches[0].clientX;
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
handleTouchEnd() {
|
|
195
|
+
if (!this.isDragging) return;
|
|
196
|
+
|
|
197
|
+
const deltaX = this.endX - this.startX;
|
|
198
|
+
this.handleSwipe(deltaX);
|
|
199
|
+
|
|
200
|
+
this.isDragging = false;
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
handleMouseDown(e) {
|
|
204
|
+
this.startX = e.clientX;
|
|
205
|
+
this.endX = this.startX;
|
|
206
|
+
this.isDragging = true;
|
|
207
|
+
this.clickDisabled = false;
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
handleMouseMove(e) {
|
|
211
|
+
if (!this.isDragging) return;
|
|
212
|
+
this.endX = e.clientX;
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
handleMouseUp() {
|
|
216
|
+
if (!this.isDragging) return;
|
|
217
|
+
|
|
218
|
+
const deltaX = this.endX - this.startX;
|
|
219
|
+
this.handleSwipe(deltaX);
|
|
220
|
+
|
|
221
|
+
this.isDragging = false;
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
handleMouseLeave() {
|
|
225
|
+
this.isDragging = false;
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
handleSwipe(deltaX) {
|
|
229
|
+
if (Math.abs(deltaX) > this.swipeThreshold) {
|
|
230
|
+
this.clickDisabled = true;
|
|
231
|
+
if (deltaX > 0) {
|
|
232
|
+
this.goPrevWeek();
|
|
233
|
+
} else {
|
|
234
|
+
this.goNextWeek();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
</script>
|
|
241
|
+
|
|
242
|
+
<style scoped>
|
|
243
|
+
.week-date-picker {
|
|
244
|
+
width: 100%;
|
|
245
|
+
background: white;
|
|
246
|
+
padding: 16px 0;
|
|
247
|
+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
|
248
|
+
user-select: none;
|
|
249
|
+
border-radius: 8px;
|
|
250
|
+
overflow: hidden;
|
|
251
|
+
cursor: grab;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.week-date-picker:active {
|
|
255
|
+
cursor: grabbing;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.week-days {
|
|
259
|
+
display: flex;
|
|
260
|
+
justify-content: space-around;
|
|
261
|
+
align-items: center;
|
|
262
|
+
padding: 0 8px;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.day-item {
|
|
266
|
+
display: flex;
|
|
267
|
+
flex-direction: column;
|
|
268
|
+
align-items: center;
|
|
269
|
+
justify-content: center;
|
|
270
|
+
width: 44px;
|
|
271
|
+
height: 64px;
|
|
272
|
+
border-radius: 8px;
|
|
273
|
+
cursor: pointer;
|
|
274
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
275
|
+
position: relative;
|
|
276
|
+
flex-shrink: 0;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.day-item:hover {
|
|
280
|
+
background-color: #f5f5f5;
|
|
281
|
+
transform: translateY(-2px);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.day-item.active {
|
|
285
|
+
background-color: #1677ff;
|
|
286
|
+
box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3);
|
|
287
|
+
transform: translateY(-2px);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.day-item.active .day-week,
|
|
291
|
+
.day-item.active .day-month,
|
|
292
|
+
.day-item.active .day-date {
|
|
293
|
+
color: white;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.day-week {
|
|
297
|
+
font-size: 12px;
|
|
298
|
+
color: #666;
|
|
299
|
+
margin-bottom: 4px;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.day-month {
|
|
303
|
+
font-size: 10px;
|
|
304
|
+
color: #999;
|
|
305
|
+
margin-bottom: 2px;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.day-date {
|
|
309
|
+
font-size: 20px;
|
|
310
|
+
font-weight: 500;
|
|
311
|
+
color: #333;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.today-dot {
|
|
315
|
+
position: absolute;
|
|
316
|
+
bottom: -4px;
|
|
317
|
+
width: 4px;
|
|
318
|
+
height: 4px;
|
|
319
|
+
background-color: #1677ff;
|
|
320
|
+
border-radius: 50%;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.day-item.active .today-dot {
|
|
324
|
+
background-color: white;
|
|
325
|
+
}
|
|
326
|
+
</style>
|