Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
educationStu
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
向伟
educationStu
Commits
7a0232ca
Commit
7a0232ca
authored
Jul 05, 2022
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
01018a2c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
791 additions
and
99 deletions
+791
-99
classList.vue
src/components/bookAclass/classList.vue
+32
-3
addPlan.vue
src/pages/bookAclass/addPlan.vue
+7
-7
index.vue
src/pages/bookAclass/index.vue
+44
-89
lx-calendar.md
src/pages/bookAclass/lx-calendar/lx-calendar.md
+0
-0
lx-calendar.vue
src/pages/bookAclass/lx-calendar/lx-calendar.vue
+708
-0
No files found.
src/components/bookAclass/classList.vue
View file @
7a0232ca
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<view>
{{
i
.
DateStr
.
slice
(
8
,
10
)
}}
日
</view>
<view>
{{
i
.
DateStr
.
slice
(
8
,
10
)
}}
日
</view>
</view>
</view>
<view
class=
"time-text"
>
<view
class=
"time-text"
>
{{
i
.
Week
}}
{{
getDateData
(
i
.
DateStr
)
}}
</view>
</view>
</view>
</view>
</view>
</view>
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
:disabled="true">
:disabled="true">
<view
class=
"content-text-box"
>
<view
class=
"content-text-box"
>
<view
class=
"right-box"
>
<view
class=
"right-box"
>
<view
v-for=
"(item,index) in i.SubList"
<view
v-for=
"(item,index) in i.SubList
.sort((a,b)=>
{a-b})
"
:key="index"
:key="index"
class="Festival-box activeOne"
class="Festival-box activeOne"
:class="{'activeOne':item.StartTime=='09:30','activeTwo':item.StartTime=='11:10',
:class="{'activeOne':item.StartTime=='09:30','activeTwo':item.StartTime=='11:10',
...
@@ -77,7 +77,36 @@
...
@@ -77,7 +77,36 @@
})
})
const
methods
=
{
const
methods
=
{
// 获取日期
getDateData
(
d
)
{
let
date
=
new
Date
(
d
)
let
week
=
date
.
getDay
()
let
weekStr
=
""
switch
(
week
)
{
case
0
:
weekStr
=
'星期日'
;
break
;
case
1
:
weekStr
=
'星期一'
;
break
;
case
2
:
weekStr
=
'星期二'
;
break
;
case
3
:
weekStr
=
'星期三'
;
break
;
case
4
:
weekStr
=
'星期四'
;
break
;
case
5
:
weekStr
=
'星期五'
;
break
;
case
6
:
weekStr
=
'星期六'
;
break
;
}
return
weekStr
},
}
}
onMounted
(()
=>
{
onMounted
(()
=>
{
...
...
src/pages/bookAclass/addPlan.vue
View file @
7a0232ca
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<view>
节
</view>
<view>
节
</view>
</view>
</view>
</view>
</view>
<view
v-for=
"(item,index) in titleList"
<view
v-for=
"(item,index) in titleList"
:key=
"index"
class=
"header-week"
>
class=
"header-week"
>
<view>
{{
item
.
num
}}
</view>
<view>
{{
item
.
num
}}
</view>
<view>
{{
item
.
name
}}
</view>
<view>
{{
item
.
name
}}
</view>
...
@@ -28,14 +28,14 @@
...
@@ -28,14 +28,14 @@
</view>
</view>
<view
class=
"text-right"
>
<view
class=
"text-right"
>
<view
class=
"status-box border0"
>
<view
class=
"status-box border0"
>
<view
v-for=
"
i in 7
"
<view
v-for=
"
(i,index) in 7"
:key=
"index
"
class=
"text-img"
>
class=
"text-img"
>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view
class=
"content-text"
v-for=
"
item in classList
"
>
<view
class=
"content-text"
v-for=
"
(item,index) in classList"
:key=
"index
"
>
<view
class=
"text-left"
>
<view
class=
"text-left"
>
<view
class=
"left-num"
>
<view
class=
"left-num"
>
<view>
{{
item
.
name
}}
</view>
<view>
{{
item
.
name
}}
</view>
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
<view
class=
"text-right"
<view
class=
"text-right"
:class=
"
{'border0':item.id==6}">
:class=
"
{'border0':item.id==6}">
<view
class=
"status-box"
>
<view
class=
"status-box"
>
<view
v-for=
"(i,indexs) in item.list"
<view
v-for=
"(i,indexs) in item.list"
:key=
"indexs"
class=
"text-img"
class=
"text-img"
:class=
"
{'activeOne':item.id==1
&&
i.DetailsId,
:class=
"
{'activeOne':item.id==1
&&
i.DetailsId,
'activeTwo':item.id==2
&&
i.DetailsId,
'activeTwo':item.id==2
&&
i.DetailsId,
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
<view
v-if=
"item.id!=6"
class=
"height30"
>
</view>
<view
v-if=
"item.id!=6"
class=
"height30"
>
</view>
</view>
</view>
</view>
</view>
<view
class=
"content-text"
v-for=
"(i,index) in 2"
>
<view
class=
"content-text"
v-for=
"(i,index) in 2"
:key=
"index"
>
<view
class=
"text-left"
>
<view
class=
"text-left"
>
<view
class=
"left-num"
>
<view
class=
"left-num"
>
<view></view>
<view></view>
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
</view>
</view>
<view
class=
"text-right"
>
<view
class=
"text-right"
>
<view
class=
"status-box border0"
>
<view
class=
"status-box border0"
>
<view
v-for=
"
i in 7
"
<view
v-for=
"
(i,keys) in 7"
:key=
"keys
"
class=
"text-img"
>
class=
"text-img"
>
</view>
</view>
...
@@ -371,7 +371,7 @@
...
@@ -371,7 +371,7 @@
margin-left
:
2
rpx
;
margin-left
:
2
rpx
;
}
}
.header-week
{
.header-week
{
width
:
90
rpx
;
width
:
89
rpx
;
flex-shrink
:
0
;
flex-shrink
:
0
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
...
...
src/pages/bookAclass/index.vue
View file @
7a0232ca
...
@@ -3,60 +3,12 @@
...
@@ -3,60 +3,12 @@
<view
class=
"titleHeader"
>
<view
class=
"titleHeader"
>
<view
class=
"titleHeader-year"
>
<view
class=
"titleHeader-year"
>
<view>
{{
year
}}
年
{{
month
}}
月
</view>
<view>
{{
year
}}
年
{{
month
}}
月
</view>
<!--
<view>
本周
</view>
-->
<view>
计划
{{
total
}}
节课
</view>
<view>
计划
{{
total
}}
节课
</view>
</view>
</view>
<!-- 滑动查看上周本周 -->
<lxCalendar
@
chang=
"getData"
:titleList=
"titleList"
></lxCalendar>
<!--
<swiper
:style=
"
{height:!isShowAllDay?'220rpx':'620rpx'}" circular :current="1"
@change="changeSwiper($event,preSwiperId)">
<swiper-item
:key=
"Sindex"
v-for=
"i in 2"
>
<view
class=
"titleHeader-dateStr"
>
<view
v-for=
"item in titleList"
class=
"titleHeader-content"
>
<view
class=
"titleHeader-name"
>
{{
item
.
name
}}
</view>
<view
class=
"titleHeader-num"
>
{{
item
.
num
}}
</view>
<view
class=
"titleHeader-mark"
v-if=
"dataList.length>0"
>
<view
v-for=
"(items,index) in item.listNum"
:key=
"index"
:class=
"
{'activeOne':items.StartTime=='09:30','activeTwo':items.StartTime=='11:10',
'activeThree':items.StartTime=='13:30','activeFour':items.StartTime=='15:10',
'activeFive':items.StartTime=='16:50','activeSix':item.StartTime=='19:00'}">
</view>
</view>
</view>
</view>
<view
class=
"content-box"
v-if=
"dataList.length>0&&total>0"
>
</view>
</swiper-item>
</swiper>
-->
<!-- 按钮切换上周下周本周 -->
<view
class=
"titleHeader-dateStr"
>
<view
v-if=
"weekShow"
class=
"week"
@
click=
"getMonday(0)"
>
本周
</view>
<view
class=
"position clickLeft"
@
click=
"getMonday(-1)"
>
<van-icon
name=
"arrow-left"
size=
"28rpx"
color=
"#333333"
></van-icon>
</view>
<view
v-for=
"item in titleList"
class=
"titleHeader-content"
>
<view
class=
"titleHeader-name"
>
{{
item
.
name
}}
</view>
<view
class=
"titleHeader-num"
>
{{
item
.
num
.
slice
(
8
,
10
)
}}
</view>
<view
class=
"titleHeader-mark"
v-if=
"item.listNum.length>0"
>
<view
v-for=
"(items,index) in item.listNum"
:key=
"index"
:class=
"
{'activeOne':items.StartTime=='09:30','activeTwo':items.StartTime=='11:10',
'activeThree':items.StartTime=='13:30','activeFour':items.StartTime=='15:10',
'activeFive':items.StartTime=='16:50','activeSix':items.StartTime=='19:00'}">
</view>
</view>
</view>
<view
class=
"position clickRight"
@
click=
"getMonday(1)"
>
<van-icon
name=
"arrow"
size=
"28rpx"
color=
"#333333"
></van-icon>
</view>
</view>
</view>
<view
class=
"content-box"
v-if=
"dataList.length>0"
>
<scroll-view
scroll-y=
"true"
style=
"width:100%;height: 100%;"
>
<scroll-view
scroll-y=
"true"
style=
"width:100%;height: 100%;"
>
<classList
:classList=
"dataList"
></classList>
<classList
:classList=
"dataList"
></classList>
</scroll-view>
</scroll-view>
...
@@ -93,10 +45,12 @@
...
@@ -93,10 +45,12 @@
}
from
'../../utils/date.js'
}
from
'../../utils/date.js'
import
Navbar
from
'../../components/navbar.vue'
import
Navbar
from
'../../components/navbar.vue'
import
classList
from
'../../components/bookAclass/classList.vue'
import
classList
from
'../../components/bookAclass/classList.vue'
import
lxCalendar
from
'./lx-calendar/lx-calendar.vue'
export
default
{
export
default
{
components
:
{
components
:
{
Navbar
,
Navbar
,
classList
classList
,
lxCalendar
},
},
props
:
[
'day'
],
props
:
[
'day'
],
setup
(
props
)
{
setup
(
props
)
{
...
@@ -119,32 +73,19 @@
...
@@ -119,32 +73,19 @@
total
:
0
,
total
:
0
,
dataList
:[],
dataList
:[],
titleList
:[
titleList
:[
{
name
:
'星期一'
,
num
:
''
,
listNum
:[]},
{
date
:
''
,
list
:[]},
{
name
:
'星期二'
,
num
:
''
,
listNum
:[]},
{
date
:
''
,
list
:[]},
{
name
:
'星期三'
,
num
:
''
,
listNum
:[]},
{
date
:
''
,
list
:[]},
{
name
:
'星期四'
,
num
:
''
,
listNum
:[]},
{
date
:
''
,
list
:[]},
{
name
:
'星期五'
,
num
:
''
,
listNum
:[]},
{
date
:
''
,
list
:[]},
{
name
:
'星期六'
,
num
:
''
,
listNum
:[]},
{
date
:
''
,
list
:[]},
{
name
:
'星期日'
,
num
:
''
,
listNum
:[]},
{
date
:
''
,
list
:[]},
],
],
currentSwiper
:
1
,
preSwiperId
:
1
,
weekType
:
0
,
weekType
:
0
,
weekShow
:
false
,
weekShow
:
false
,
weekList
:[]
weekList
:[]
})
})
const
methods
=
{
const
methods
=
{
changeSwiper
(
val
,
PreId
)
{
let
CurId
=
val
.
detail
.
current
// 上周
if
(
CurId
==
0
){
methods
.
getMonday
(
-
1
)
}
// 本周
if
(
CurId
==
1
){
methods
.
getMonday
(
0
)
}
},
addPlan
(){
addPlan
(){
uni
.
navigateTo
({
uni
.
navigateTo
({
url
:
'/pages/bookAclass/addPlan'
,
url
:
'/pages/bookAclass/addPlan'
,
...
@@ -192,6 +133,7 @@
...
@@ -192,6 +133,7 @@
},
},
// 实现方法
// 实现方法
getMonday
(
dates
)
{
getMonday
(
dates
)
{
return
data
.
weekType
=
dates
data
.
weekType
=
dates
let
arr
=
[],
weekOne
=
''
;
let
arr
=
[],
weekOne
=
''
;
let
todayTimeStr
=
new
Date
(
new
Date
().
toLocaleDateString
()).
getTime
();
let
todayTimeStr
=
new
Date
(
new
Date
().
toLocaleDateString
()).
getTime
();
...
@@ -244,7 +186,15 @@
...
@@ -244,7 +186,15 @@
methods
.
getList
()
methods
.
getList
()
return
arr
;
return
arr
;
},
},
getData
(
arr
){
data
.
year
=
arr
[
0
].
date
.
slice
(
0
,
4
)
data
.
month
=
arr
[
0
].
date
.
slice
(
5
,
6
)
<
10
?
arr
[
0
].
date
.
slice
(
5
,
6
):
arr
[
0
].
date
.
slice
(
5
,
7
)
data
.
msg
.
StartDate
=
arr
[
0
].
date
data
.
msg
.
EndDate
=
arr
[
6
].
date
methods
.
getList
()
},
getList
(){
getList
(){
data
.
dataList
=
[]
if
(
data
.
msg
.
StartDate
){
if
(
data
.
msg
.
StartDate
){
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'加载中...'
title
:
'加载中...'
...
@@ -252,35 +202,40 @@
...
@@ -252,35 +202,40 @@
proxy
.
$request
(
"/LeaveStudent/GetStuPlanAppointment"
,
data
.
msg
).
then
(
res
=>
{
proxy
.
$request
(
"/LeaveStudent/GetStuPlanAppointment"
,
data
.
msg
).
then
(
res
=>
{
if
(
res
.
Code
==
1
){
if
(
res
.
Code
==
1
){
data
.
titleList
.
forEach
((
i
,
indexs
)
=>
{
data
.
titleList
.
forEach
((
i
,
indexs
)
=>
{
i
.
list
Num
=
[]
i
.
list
=
[]
})
})
let
arr
=
[]
let
arr
=
[]
data
.
dataList
=
res
.
Data
data
.
dataList
=
res
.
Data
if
(
res
.
Data
.
length
>
0
){
data
.
dataList
.
forEach
((
item
,
index
)
=>
{
data
.
dataList
.
forEach
((
item
,
index
)
=>
{
item
.
SubList
.
sort
((
a
,
b
)
=>
a
.
Sort
-
b
.
Sort
)
item
.
SubList
.
sort
((
a
,
b
)
=>
a
.
Sort
-
b
.
Sort
)
item
.
SubList
.
forEach
(
i
=>
{
item
.
SubList
.
forEach
(
i
=>
{
arr
.
push
(
i
)
arr
.
push
(
i
)
})
})
data
.
titleList
.
forEach
((
i
,
indexs
)
=>
{
data
.
titleList
.
forEach
((
i
,
indexs
)
=>
{
if
(
item
.
DateStr
===
i
.
num
){
if
(
index
==
indexs
){
item
.
Week
=
i
.
name
i
.
date
=
item
.
DateStr
.
slice
(
8
,
10
)
i
.
listNum
=
item
.
SubList
if
(
item
.
SubList
.
length
>
0
){
i
.
list
=
item
.
SubList
}
else
{
i
.
list
=
[]
}
}
}
})
})
})
})
}
data
.
total
=
arr
.
length
data
.
total
=
arr
.
length
uni
.
hideLoading
()
uni
.
hideLoading
()
}
}
})
})
}
}
}
},
}
}
onMounted
(()
=>
{
onMounted
(()
=>
{
methods
.
getMonday
(
0
);
methods
.
getMonday
(
0
);
methods
.
getDateData
()
methods
.
getDateData
()
methods
.
getList
()
})
})
return
{
return
{
...
toRefs
(
data
),
...
toRefs
(
data
),
...
@@ -335,7 +290,7 @@
...
@@ -335,7 +290,7 @@
top
:
0
;
top
:
0
;
left
:
0
;
left
:
0
;
right
:
0
;
right
:
0
;
padding
:
0
36
rpx
;
/* padding: 0 36rpx; */
}
}
.titleHeader-year
{
.titleHeader-year
{
display
:
flex
;
display
:
flex
;
...
...
src/pages/bookAclass/lx-calendar/lx-calendar.md
0 → 100644
View file @
7a0232ca
src/pages/bookAclass/lx-calendar/lx-calendar.vue
0 → 100644
View file @
7a0232ca
<
template
>
<view
class=
"date"
>
<!--
<view
class=
"head"
>
<view
class=
"icon"
@
click=
"switch_month_week('prev',true)"
><text
class=
"iconfont icon-fanhui"
/></view>
<view
class=
"title"
>
{{
nowYear
+
'年'
+
nowMonth
+
'月'
}}
</view>
<view
class=
"icon"
@
click=
"switch_month_week('next',true)"
><text
class=
"iconfont next icon-fanhui"
/></view>
</view>
-->
<view
class=
"date_dl"
>
<view
class=
"dd"
v-for=
"(item,index) in week"
:key=
"index"
>
{{
item
}}
</view>
</view>
<swiper
:style=
"
{height:(retract ? 2 * 80 : (week_list.length + 1) * 80 ) + 'rpx'}" :current="current" circular @change="change_date">
<swiper-item>
<view
class=
"date_dl"
v-show=
"!retract || index == to_prev_week_index"
v-for=
"(item,index) in week_list_prev_co"
:key=
"index"
>
<view
class=
"dd"
@
click=
"item_click(vo,index,key)"
v-for=
"(vo,key) in item"
:key=
"key"
>
<view
class=
"num"
:class=
"[vo.today ? 'today' : '',vo.type == 'month' ? 'month' : (retract ? '' : 'disabled')]"
>
{{
vo
.
day
}}
</view>
<view
v-show=
"vo.dot && (vo.type == 'month' || retract)"
class=
"dot"
></view>
<view
v-for=
"(item,keys) in dataList"
:key=
"keys"
>
<view
class=
"titleHeader-mark"
v-if=
"item.date==vo.day&&item.list.length>0"
>
<view
v-for=
"(items,ks) in item.list"
:key=
"ks"
:class=
"
{'activeOne':items.StartTime=='09:30','activeTwo':items.StartTime=='11:10',
'activeThree':items.StartTime=='13:30','activeFour':items.StartTime=='15:10',
'activeFive':items.StartTime=='16:50','activeSix':items.StartTime=='19:00'}">
</view>
</view>
</view>
</view>
</view>
<view
@
click=
"open"
class=
"retract icon"
><text
class=
"iconfont next icon-fanhui"
:class=
"[retract ? '' : 'retract_icon']"
/></view>
</swiper-item>
<swiper-item>
<view
class=
"date_dl"
v-show=
"!retract || index == to_week_index"
v-for=
"(item,index) in week_list"
:key=
"index"
>
<view
class=
"dd"
@
click=
"item_click(vo,index,key)"
v-for=
"(vo,key) in item"
:key=
"key"
>
<view
class=
"num"
:class=
"[vo.today ? 'today' : '',vo.type == 'month' ? 'month' : (retract ? '' : 'disabled')]"
>
{{
vo
.
day
}}
</view>
<view
v-show=
"vo.dot && (vo.type == 'month' || retract)"
class=
"dot"
></view>
<view
v-for=
"(item,keys) in dataList"
:key=
"keys"
>
<view
class=
"titleHeader-mark"
v-if=
"item.date==vo.day&&item.list.length>0"
>
<view
v-for=
"(items,ks) in item.list"
:key=
"ks"
:class=
"
{'activeOne':items.StartTime=='09:30','activeTwo':items.StartTime=='11:10',
'activeThree':items.StartTime=='13:30','activeFour':items.StartTime=='15:10',
'activeFive':items.StartTime=='16:50','activeSix':items.StartTime=='19:00'}">
</view>
</view>
</view>
</view>
</view>
<view
@
click=
"open"
class=
"retract icon"
><text
class=
"iconfont next icon-fanhui"
:class=
"[retract ? '' : 'retract_icon']"
/></view>
</swiper-item>
<swiper-item>
<view
class=
"date_dl"
v-show=
"!retract || index == to_next_week_index"
v-for=
"(item,index) in week_list_next_co"
:key=
"index"
>
<view
class=
"dd"
@
click=
"item_click(vo,index,key)"
v-for=
"(vo,key) in item"
:key=
"key"
>
<view
class=
"num"
:class=
"[vo.today ? 'today' : '',vo.type == 'month' ? 'month' : (retract ? '' : 'disabled')]"
>
{{
vo
.
day
}}
</view>
<view
v-show=
"vo.dot && (vo.type == 'month' || retract)"
class=
"dot"
></view>
<view
v-for=
"(item,keys) in dataList"
:key=
"keys"
>
<view
class=
"titleHeader-mark"
v-if=
"item.date==vo.day&&item.list.length>0"
>
<view
v-for=
"(items,ks) in item.list"
:key=
"ks"
:class=
"
{'activeOne':items.StartTime=='09:30','activeTwo':items.StartTime=='11:10',
'activeThree':items.StartTime=='13:30','activeFour':items.StartTime=='15:10',
'activeFive':items.StartTime=='16:50','activeSix':items.StartTime=='19:00'}">
</view>
</view>
</view>
</view>
</view>
<view
@
click=
"open"
class=
"retract icon"
><text
class=
"iconfont next icon-fanhui"
:class=
"[retract ? '' : 'retract_icon']"
/></view>
</swiper-item>
</swiper>
</view>
</
template
>
<
script
>
export
default
{
props
:{
value
:{
type
:[
String
,
Number
],
default
:
''
},
dot_lists
:{
type
:
Array
,
default
:()
=>
{
return
[];
}
},
titleList
:{
type
:
Array
,
default
:()
=>
{
return
[];
}
}
},
data
(){
return
{
debug
:
false
,
week
:[
'星期日'
,
'星期一'
,
'星期二'
,
'星期三'
,
'星期四'
,
'星期五'
,
'星期六'
],
week_list
:[],
week_list_prev
:[],
week_list_prev_week
:[],
week_list_next
:[],
week_list_next_week
:[],
now_date
:
''
,
start_date
:
''
,
end_date
:
''
,
prev_date
:
''
,
next_date
:
''
,
nowYear
:
''
,
nowMonth
:
''
,
nowDay
:
''
,
retract
:
true
,
to_week_index
:
0
,
to_prev_week_index
:
0
,
to_next_week_index
:
0
,
nowTime
:
0
,
dot_list
:[],
current
:
1
,
date
:
''
,
dataList
:[]
}
},
watch
:{
value
(
value
){
this
.
get_date
(
this
.
date_parse
(
value
));
},
dot_lists
:{
immediate
:
true
,
handler
(
value
){
this
.
dot_list
=
value
;
this
.
set_doc_lists_update
()
}
},
titleList
:{
immediate
:
true
,
handler
(
value
){
this
.
dataList
=
value
}
}
},
computed
:{
week_list_prev_co
(){
return
this
.
retract
?
this
.
week_list_prev_week
:
this
.
week_list_prev
},
week_list_next_co
(){
return
this
.
retract
?
this
.
week_list_next_week
:
this
.
week_list_next
}
},
created
(){
this
.
init
();
this
.
$emit
(
'chang'
,
this
.
week_list
[
this
.
to_week_index
])
},
methods
:{
change
(){
let
value
=
{
fulldate
:
this
.
date
.
replace
(
/-
(\d)(?!\d)
/g
,
'-0$1'
)
};
this
.
$emit
(
'change'
,
value
)
},
init
(){
console
.
log
(
this
.
value
)
if
(
this
.
value
){
this
.
get_date
(
this
.
date_parse
(
this
.
value
));
}
else
{
this
.
get_date
();
}
this
.
doc_list_update
();
this
.
update_month
();
},
open
(){
this
.
retract
=
!
this
.
retract
;
this
.
get_date
(
this
.
nowTime
);
this
.
set_to_day
(
'week_list_prev'
)
this
.
set_to_day
(
'week_list_next'
)
this
.
change_week
();
if
(
this
.
retract
){
this
.
update_swiper_item
(
'week'
)
}
else
{
this
.
update_swiper_item
(
'month'
)
}
this
.
set_doc_lists_update
();
},
change_week
(){
if
(
this
.
to_week_index
<
this
.
week_list
.
length
-
1
){
this
.
to_next_week_index
=
this
.
to_week_index
+
1
;
this
.
week_list_next_week
=
this
.
week_list
;
}
else
{
this
.
to_next_week_index
=
0
;
this
.
week_list_next_week
=
this
.
week_list_next
;
}
if
(
this
.
to_week_index
==
0
){
this
.
update_month
();
// if(){
let
next_day
=
this
.
week_list_prev
[
this
.
week_list_prev
.
length
-
1
][
6
].
day
;
// }
this
.
to_prev_week_index
=
this
.
week_list_prev
.
length
-
1
-
Math
.
ceil
(
next_day
/
7
);
this
.
week_list_prev_week
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
week_list_prev
));
}
else
{
this
.
to_prev_week_index
=
this
.
to_week_index
-
1
;
this
.
week_list_prev_week
=
this
.
week_list
;
}
// console.log(this.week_list[this.to_week_index],'当前周')
this
.
$emit
(
'chang'
,
this
.
week_list
[
this
.
to_week_index
])
// if(this.current == 1){
// }
// let to_week_index = this.to_week_index;
// if(this.current == 2){
// this.to_next_week_index = this.to_week_index;
// this.to_week_index = this.to_week_index - 1;
// this.to_prev_week_index = this.to_next_week_index + 1;
// }else if(this.current == 0){
// this.to_next_week_index = this.to_week_index;
// this.to_week_index = this.to_week_index - 1;
// this.to_prev_week_index = this.to_next_week_index + 1;
// }
},
change_date_week
(
type
){
let
week_list
=
this
.
week_list
;
let
to_week_index
=
this
.
to_week_index
;
if
(
type
==
'prev'
){
this
.
to_week_index
=
this
.
to_prev_week_index
;
this
.
to_prev_week_index
=
this
.
to_next_week_index
this
.
to_next_week_index
=
to_week_index
;
this
.
week_list
=
this
.
week_list_prev_week
this
.
week_list_prev_week
=
this
.
week_list_next_week
;
this
.
week_list_next_week
=
week_list
;
// console.log(this.week_list_next_week[this.to_next_week_index],'下周--')
}
else
if
(
type
==
'next'
){
this
.
to_week_index
=
this
.
to_next_week_index
;
this
.
to_next_week_index
=
this
.
to_prev_week_index
this
.
to_prev_week_index
=
to_week_index
;
this
.
week_list
=
this
.
week_list_next_week
this
.
week_list_next_week
=
this
.
week_list_prev_week
;
this
.
week_list_prev_week
=
week_list
;
// console.log(this.week_list_prev_week[this.to_prev_week_index],'上周--')
}
this
.
set_to_day_all
();
},
change_date_month
(
type
){
let
week_list
=
this
.
week_list
;
if
(
type
==
'prev'
){
this
.
week_list
=
this
.
week_list_prev
this
.
week_list_prev
=
this
.
week_list_next
;
this
.
week_list_next
=
week_list
;
}
else
if
(
type
==
'next'
){
this
.
week_list
=
this
.
week_list_next
this
.
week_list_next
=
this
.
week_list_prev
;
this
.
week_list_prev
=
week_list
;
}
},
change_date
(
e
){
let
primary_current
=
this
.
current
let
current
=
e
.
detail
.
current
;
this
.
current
=
current
;
if
(
primary_current
-
current
==
-
1
||
primary_current
-
current
==
2
){
if
(
this
.
retract
){
this
.
switch_month_week
(
'next'
)
this
.
change_week
()
if
(
primary_current
-
current
==
-
1
&&
current
!=
1
){
this
.
change_date_week
(
'prev'
)
}
else
if
(
primary_current
-
current
==
2
){
this
.
change_date_week
(
'next'
)
}
}
else
{
this
.
get_date
(
this
.
get_month
(
'next'
));
this
.
update_month
();
if
(
primary_current
-
current
==
-
1
&&
current
!=
1
){
this
.
change_date_month
(
'prev'
)
}
else
if
(
primary_current
-
current
==
2
){
this
.
change_date_month
(
'next'
)
}
}
}
else
{
if
(
this
.
retract
){
this
.
switch_month_week
(
'prev'
)
this
.
change_week
()
if
(
primary_current
-
current
==
1
&&
current
!=
1
){
this
.
change_date_week
(
'next'
)
}
else
if
(
primary_current
-
current
==
-
2
){
this
.
change_date_week
(
'prev'
)
}
}
else
{
this
.
get_date
(
this
.
get_month
(
'prev'
));
this
.
update_month
();
if
(
primary_current
-
current
==
1
&&
current
!=
1
){
this
.
change_date_month
(
'next'
)
}
else
if
(
primary_current
-
current
==
-
2
){
this
.
change_date_month
(
'prev'
)
}
}
}
this
.
set_to_day_all
();
this
.
set_doc_lists_update
();
this
.
change
()
},
update_month
(){
this
.
get_date
(
this
.
get_month
(
'prev'
),
'prev'
);
this
.
get_date
(
this
.
get_month
(
'next'
),
'next'
);
},
set_doc_lists_update
(){
this
.
doc_list_update
(
'week_list'
);
this
.
doc_list_update
(
'week_list_prev'
);
this
.
doc_list_update
(
'week_list_next'
);
this
.
doc_list_update
(
'week_list_prev_week'
)
this
.
doc_list_update
(
'week_list_next_week'
)
},
doc_list_update
(
week_list
=
'week_list'
){
let
list
=
[];
this
[
week_list
].
map
((
item
,
index
)
=>
{
list
.
push
(
item
.
map
((
vo
,
key
)
=>
{
if
(
this
.
dot_list
.
indexOf
(
vo
.
date
)
>
-
1
||
this
.
dot_list
.
indexOf
(
vo
.
date
.
replace
(
/-
(\d)(?!\d)
/g
,
'-0$1'
))
>
-
1
){
vo
.
dot
=
true
;
}
else
{
vo
.
dot
=
false
;
}
return
{...
vo
}
}))
})
this
[
week_list
]
=
list
;
},
set_to_day
(
type
){
let
list
=
[];
this
[
type
].
map
((
item
,
index
)
=>
{
list
.
push
(
item
.
map
((
vo
,
key
)
=>
{
if
(
vo
.
date
==
`
${
this
.
date
}
`
){
vo
.
today
=
true
;
}
else
{
vo
.
today
=
false
;
}
return
{...
vo
};
}))
})
this
[
type
]
=
list
;
},
item_click
(
item
,
item_index
=
-
1
){
if
(
!
this
.
retract
&&
item
.
type
!==
'month'
){
return
false
;
}
this
.
date
=
item
.
date
;;
if
(
item
.
type
==
'month'
){
this
.
nowDay
=
item
.
day
;
if
(
item_index
>=
0
)
this
.
to_week_index
=
item_index
;
}
else
if
(
this
.
retract
){
this
.
nowDay
=
item
.
day
;
}
let
now_arr
=
item
.
date
.
split
(
'-'
)
this
.
nowYear
=
now_arr
[
0
];
this
.
nowMonth
=
now_arr
[
1
];
this
.
nowDay
=
now_arr
[
2
];
this
.
set_to_day_all
(
item_index
);
this
.
nowTime
=
this
.
date_parse
(
`
${
item
.
date
}
`
);
this
.
change
()
this
.
set_doc_lists_update
();
},
set_to_day_all
(
item_index
){
this
.
set_to_day
(
'week_list'
)
this
.
set_to_day
(
'week_list_prev'
)
this
.
set_to_day
(
'week_list_next'
)
this
.
set_to_day
(
'week_list_prev_week'
)
this
.
set_to_day
(
'week_list_next_week'
)
},
get_month
(
type
){
let
nowMonth
=
this
.
nowMonth
;
let
nowYear
=
this
.
nowYear
;
let
nowDay
=
this
.
nowDay
;
if
(
type
==
'prev'
){
if
(
nowMonth
==
1
){
nowMonth
=
12
;
nowYear
=
nowYear
-
1
;
}
else
{
nowMonth
--
;
}
}
else
if
(
type
==
'next'
){
if
(
nowMonth
==
12
){
nowMonth
=
1
;
nowYear
=
nowYear
+
1
;
}
else
{
nowMonth
++
;
}
}
let
days
=
this
.
get_month_days
(
nowMonth
,
nowYear
);
if
(
nowDay
>
days
){
nowDay
=
days
;
}
return
this
.
date_parse
(
`
${
nowYear
}
-
${
nowMonth
}
-
${
nowDay
}
`
);
},
date_parse
(
str
){
return
Date
.
parse
(
str
.
replace
(
/-
(\d)(?!\d)
/g
,
'-0$1'
));
},
switch_month_week
(
type
=
'next'
,
update_week
=
false
){
if
(
this
.
retract
){
if
(
type
==
'prev'
){
this
.
get_date
(
this
.
nowTime
-
86400
*
7
*
1000
);
}
else
if
(
type
==
'next'
){
this
.
get_date
(
this
.
nowTime
+
86401
*
7
*
1000
);
}
if
(
update_week
){
this
.
update_swiper_item
(
'week'
);
this
.
set_doc_lists_update
();
}
}
else
{
this
.
get_date
(
this
.
get_month
(
type
))
this
.
update_swiper_item
(
'month'
);
}
this
.
set_doc_lists_update
();
this
.
set_to_day_all
();
if
(
update_week
){
this
.
change
()
}
},
update_swiper_item
(
type
=
'month'
){
if
(
type
==
'month'
){
if
(
this
.
current
==
0
){
this
.
change_date_month
(
'next'
)
}
else
if
(
this
.
current
==
2
){
this
.
change_date_month
(
'prev'
)
}
}
else
if
(
type
==
'week'
){
if
(
this
.
current
==
0
){
this
.
change_date_week
(
'next'
)
}
else
if
(
this
.
current
==
2
){
this
.
change_date_week
(
'prev'
)
}
}
},
next
(){
this
.
get_date
(
this
.
next_date
)
},
get_date
(
value
=
''
,
type
=
'same'
){
let
date
=
new
Date
();
if
(
value
){
date
=
new
Date
(
value
);
}
let
nowMonth
=
date
.
getMonth
()
+
1
,
nowYear
=
date
.
getFullYear
(),
nowDay
=
date
.
getDate
(),
nowTime
=
date
.
getTime
(),
nowWeek
=
date
.
getDay
();
let
days
=
this
.
get_month_days
(
nowMonth
,
nowYear
);
let
start_date
=
new
Date
(
nowYear
,
nowMonth
-
1
,
1
);
let
end_date
=
new
Date
(
nowYear
,
nowMonth
-
1
,
days
);
let
prev_date
=
new
Date
(
start_date
.
getTime
()
-
1
);
let
prev_date_days
=
prev_date
.
getDate
();
let
next_date
=
new
Date
(
end_date
.
getTime
()
+
86401
*
1000
);
let
next_date_days
=
next_date
.
getDate
();
let
start_week
=
start_date
.
getDay
();
let
date_arrs
=
[];
let
week_list
=
[];
let
count_days
=
35
;
for
(
let
i
=
prev_date_days
-
start_week
+
1
;
i
<=
prev_date_days
;
i
++
){
date_arrs
.
push
({
day
:
i
,
type
:
'prev'
,
date
:
`
${
prev_date
.
getFullYear
()}
-
${
prev_date
.
getMonth
()
+
1
}
-
${
i
}
`
})
}
for
(
let
i
=
1
;
i
<=
days
;
i
++
){
date_arrs
.
push
({
day
:
i
,
type
:
'month'
,
today
:
i
==
nowDay
?
true
:
false
,
date
:
`
${
nowYear
}
-
${
nowMonth
}
-
${
i
}
`
})
if
(
i
==
nowDay
&&
type
==
'same'
){
this
.
date
=
`
${
nowYear
}
-
${
nowMonth
}
-
${
i
}
`
;
}
}
if
(
this
.
debug
)
console
.
log
(
value
,
date
,
this
.
date
,
`
${
next_date
.
getFullYear
()}
-
${
next_date
.
getMonth
()
+
1
}
-
${
next_date
.
getDate
()}
`
)
let
date_arrs_length
=
date_arrs
.
length
;
// if(date_arrs_length > 35){
count_days
=
42
;
// }
for
(
let
i
=
1
;
i
<=
count_days
-
date_arrs_length
;
i
++
){
date_arrs
.
push
({
day
:
i
,
type
:
'next'
,
date
:
`
${
next_date
.
getFullYear
()}
-
${
next_date
.
getMonth
()
+
1
}
-
${
i
}
`
})
}
for
(
let
i
=
0
;
i
<
date_arrs
.
length
/
7
;
i
++
){
let
arr
=
[];
for
(
let
j
=
0
;
j
<
7
;
j
++
){
if
(
date_arrs
[
i
*
7
+
j
].
today
){
if
(
type
==
'same'
){
this
.
to_week_index
=
i
}
}
arr
.
push
(
date_arrs
[
i
*
7
+
j
]);
}
week_list
.
push
(
arr
);
}
if
(
type
==
'same'
){
this
.
week_list
=
week_list
;
this
.
nowYear
=
nowYear
;
this
.
nowMonth
=
nowMonth
;
this
.
nowDay
=
nowDay
;
this
.
nowTime
=
nowTime
;
this
.
start_date
=
start_date
;
this
.
end_date
=
end_date
;
this
.
prev_date
=
prev_date
;
this
.
next_date
=
next_date
;
}
else
if
(
type
==
'prev'
){
this
.
week_list_prev
=
week_list
;
}
else
if
(
type
==
'next'
){
this
.
week_list_next
=
week_list
;
}
},
get_month_days
(
nowMonth
,
nowYear
){
let
month_arr
=
[
1
,
3
,
5
,
7
,
8
,
10
,
12
];
let
days
=
0
;
if
(
nowMonth
==
2
){
if
(
nowYear
%
4
==
0
){
days
=
29
;
}
else
{
days
=
28
;
}
}
else
if
(
month_arr
.
indexOf
(
nowMonth
)
>=
0
){
days
=
31
;
}
else
{
days
=
30
;
}
return
days
;
}
}
}
</
script
>
<
style
>
.titleHeader-mark
{
width
:
32
rpx
;
display
:
flex
;
justify-content
:
center
;
flex-wrap
:
wrap
;
}
.titleHeader-mark
view
{
float
:
left
;
width
:
8
rpx
;
height
:
8
rpx
;
border-radius
:
50%
;
margin-right
:
5
rpx
;
margin-bottom
:
5
rpx
;
}
.titleHeader-mark
view
:nth-child
(
3n
)
{
margin-right
:
0
;
}
.titleHeader-mark
view
.activeOne
{
background
:
#FC952A
;
}
.titleHeader-mark
view
.activeTwo
{
background
:
#B966FF
;
}
.titleHeader-mark
view
.activeThree
{
background
:
#35B881
;
}
.titleHeader-mark
view
.activeFour
{
background
:
#FE606A
;
}
.titleHeader-mark
view
.activeFive
{
background
:
#0588F8
;
}
.titleHeader-mark
view
.activeSix
{
background
:
#33BED9
;
}
.date
{
width
:
750
rpx
;
}
.head
{
display
:
flex
;
align-items
:
center
;
height
:
100
rpx
;
justify-content
:
center
;
border-bottom
:
1
rpx
solid
#f5f5f5
;
color
:
#333
;
z-index
:
999
;
}
.title
{
width
:
200
rpx
;
font-size
:
30
rpx
;
text-align
:
center
;
}
.icon
{
display
:
block
;
}
.next
{
transform
:
rotate
(
180deg
);
display
:
block
;
}
.retract
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
height
:
80
rpx
;
;
}
.iconfont
{
transform
:
rotate
(
270deg
);
}
.retract_icon
{
transform
:
rotate
(
90deg
);
}
.date_dl
{
display
:
flex
;
width
:
100%
;
}
.dd
{
flex
:
1
;
text-align
:
center
;
height
:
80
rpx
;
font-size
:
26
rpx
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
position
:
relative
;
font-family
:
Source
Han
Sans
CN
;
}
.num
{
width
:
60
rpx
;
height
:
85
rpx
;
border-radius
:
50%
;
font-size
:
30
rpx
;
font-weight
:
500
;
font-family
:
Source
Han
Sans
CN
;
/* line-height: 60rpx; */
}
.num.disabled
{
color
:
#f1f1f1
;
}
.num.month
{
color
:
#333
;
}
.num.today
{
/* background: #007aff; color:#fff; */
}
.dot
{
width
:
8
rpx
;
height
:
8
rpx
;
border-radius
:
50%
;
background
:
#007aff
;
position
:
absolute
;
bottom
:
0
;
left
:
50%
;
transform
:
translateX
(
-50%
);
}
</
style
>
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