Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jz_Travel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengke
jz_Travel
Commits
a59b2a3e
Commit
a59b2a3e
authored
May 09, 2025
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化日期选项
parent
18ce4140
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
8 deletions
+59
-8
u-picker.vue
node_modules/uview-ui/components/u-picker/u-picker.vue
+50
-4
busDetails.vue
pages/bus/busDetails.vue
+5
-3
utils.js
plugin/utils.js
+4
-1
No files found.
node_modules/uview-ui/components/u-picker/u-picker.vue
View file @
a59b2a3e
...
...
@@ -169,6 +169,31 @@
type
:
[
String
,
Number
],
default
:
2050
},
// 月份开始时间
startMonth
:
{
type
:
[
String
,
Number
],
default
:
1
},
// 日期开始时间
startDay
:
{
type
:
[
String
,
Number
],
default
:
1
},
// 时开始时间
startHours
:
{
type
:
[
String
,
Number
],
default
:
0
},
// 分开始时间
startMinutes
:
{
type
:
[
String
,
Number
],
default
:
0
},
// 秒开始时间
startSeconds
:
{
type
:
[
String
,
Number
],
default
:
0
},
// "取消"按钮的颜色
cancelColor
:
{
type
:
String
,
...
...
@@ -393,11 +418,21 @@
},
setMonths
()
{
this
.
months
=
this
.
generateArray
(
1
,
12
);
if
(
this
.
year
==
this
.
startYear
)
{
this
.
months
=
this
.
generateArray
(
this
.
startMonth
,
12
);
}
else
{
this
.
months
=
this
.
generateArray
(
1
,
12
);
}
this
.
valueArr
.
splice
(
this
.
valueArr
.
length
-
1
,
1
,
this
.
getIndex
(
this
.
months
,
this
.
month
));
},
setDays
()
{
let
totalDays
=
new
Date
(
this
.
year
,
this
.
month
,
0
).
getDate
();
this
.
days
=
this
.
generateArray
(
1
,
totalDays
);
// this.days = this.generateArray(1, totalDays);
if
(
this
.
month
==
this
.
startMonth
)
{
this
.
days
=
this
.
generateArray
(
this
.
startDay
,
totalDays
);
}
else
{
this
.
days
=
this
.
generateArray
(
1
,
totalDays
);
}
let
index
=
0
;
// 这里不能使用类似setMonths()中的this.valueArr.splice(this.valueArr.length - 1, xxx)做法
// 因为this.month和this.year变化时,会触发watch中的this.setDays(),导致this.valueArr.length计算有误
...
...
@@ -408,7 +443,12 @@
this
.
valueArr
.
splice
(
index
,
1
,
this
.
getIndex
(
this
.
days
,
this
.
day
));
},
setHours
()
{
this
.
hours
=
this
.
generateArray
(
0
,
23
);
// this.hours = this.generateArray(0, 23);
if
(
this
.
day
==
this
.
startDay
)
{
this
.
hours
=
this
.
generateArray
(
this
.
startHours
,
23
);
}
else
{
this
.
hours
=
this
.
generateArray
(
0
,
23
);
}
this
.
valueArr
.
splice
(
this
.
valueArr
.
length
-
1
,
1
,
this
.
getIndex
(
this
.
hours
,
this
.
hour
));
},
setMinutes
()
{
...
...
@@ -494,8 +534,14 @@
this
.
setDays
()
}
}
if
(
this
.
params
.
day
)
this
.
day
=
this
.
days
[
this
.
valueArr
[
i
++
]];
if
(
this
.
params
.
hour
)
this
.
hour
=
this
.
hours
[
this
.
valueArr
[
i
++
]];
if
(
this
.
params
.
day
)
{
this
.
day
=
this
.
days
[
this
.
valueArr
[
i
++
]];
this
.
setHours
()
}
if
(
this
.
params
.
hour
)
{
this
.
hour
=
this
.
hours
[
this
.
valueArr
[
i
++
]];
// this.setMinutes()
}
if
(
this
.
params
.
minute
)
this
.
minute
=
this
.
minutes
[
this
.
valueArr
[
i
++
]];
if
(
this
.
params
.
second
)
this
.
second
=
this
.
seconds
[
this
.
valueArr
[
i
++
]];
}
else
if
(
this
.
mode
==
'region'
)
{
...
...
pages/bus/busDetails.vue
View file @
a59b2a3e
...
...
@@ -217,7 +217,11 @@
<!--接送时间-->
<u-picker
v-model=
"dateVisible"
mode=
"time"
:startYear=
"startYear"
:startYear=
"$utils.GetDateFewFaysLater(0).year"
:startMonth=
"$utils.GetDateFewFaysLater(0).month"
:startDay=
"$utils.GetDateFewFaysLater(0).dd"
:startHours=
"$utils.GetDateFewFaysLater(0).hour"
:startMinutes=
"$utils.GetDateFewFaysLater(0).minute"
:params=
"dateParams"
@
cancel=
"setDateHandler"
@
confirm=
"setDateHandler"
...
...
@@ -358,7 +362,6 @@
hour
:
true
,
minute
:
true
,
},
startYear
:
2025
,
customer
:
{},
};
},
...
...
@@ -366,7 +369,6 @@
},
created
()
{
this
.
startYear
=
this
.
$utils
.
GetDateFewFaysLater
(
0
).
year
this
.
Up
=
uni
.
getStorageSync
(
"mall_UserInfo"
)
?
uni
.
getStorageSync
(
"mall_UserInfo"
).
UserPageType
:
0
;
...
...
plugin/utils.js
View file @
a59b2a3e
...
...
@@ -199,7 +199,10 @@ function GetDateFewFaysLater(Days){
mm
:
month
,
day
:
day
>
9
?
day
:
'0'
+
day
,
dd
:
day
,
date
:
`
${
year
}
-
${
month
>
9
?
month
:
'0'
+
month
}
-
${
day
>
9
?
day
:
'0'
+
day
}
`
date
:
`
${
year
}
-
${
month
>
9
?
month
:
'0'
+
month
}
-
${
day
>
9
?
day
:
'0'
+
day
}
`
,
hour
:
date
.
getHours
(),
minute
:
date
.
getMinutes
(),
second
:
date
.
getSeconds
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment