Files

208 lines
5.1 KiB
Vue
Raw Permalink Normal View History

2022-07-12 18:10:42 +08:00
<template>
<div class="calendarInfo">
2022-07-26 18:04:07 +08:00
<div class="calendar">
2022-07-28 08:51:57 +08:00
<uni-calendar :insert="true" :selected="selected" :lunar="false" @bindDateChange="setDate" @change="change" @monthSwitch="changeMonth"/>
2022-07-26 18:04:07 +08:00
</div>
2022-07-13 10:52:43 +08:00
<div class="dailyMatters">
2022-07-19 14:41:17 +08:00
<div v-if="list && list.length">
<div>
2022-07-19 15:50:11 +08:00
<div v-for="(item, index) in list.slice(0,3)" :key="index" :class="{'color1':index%4==0,'color2':index%4==1,'color3':index%4==2,'color4':index%4==3}" class="daily_item">
2022-07-19 14:41:17 +08:00
<div>{{ item.createTime.substring(10, 16) }}</div>
<div>{{ item.taskTitle }}</div>
</div>
2022-07-13 10:52:43 +08:00
</div>
2022-07-19 14:41:17 +08:00
<div v-show="show">
2022-07-19 15:50:11 +08:00
<div v-for="(item, index) in list.slice(3, list.length)" :key="index"
:class="{'color1': index % 4 == 3,'color2': index % 4 == 0,'color3': index % 4 == 1,'color4': index % 4 == 2 }" class="daily_item">
2022-07-19 14:41:17 +08:00
<div>{{ item.createTime.substring(10, 16) }}</div>
<div>{{ item.taskTitle }}</div>
</div>
2022-07-13 10:52:43 +08:00
</div>
2022-07-19 15:50:11 +08:00
<div class="readMore" v-show="!show && list.length > 3" @click="show = true">查看更多</div>
2022-07-13 10:52:43 +08:00
</div>
2022-07-19 14:41:17 +08:00
<AiEmpty description="暂无宣发" v-else></AiEmpty>
2022-07-13 10:52:43 +08:00
</div>
2022-07-12 18:10:42 +08:00
</div>
</template>
<script>
2022-07-28 08:51:57 +08:00
import uniCalendar from "./uni-calendar/uni-calendar.vue"
2022-07-12 18:10:42 +08:00
export default {
data() {
return {
date: '',
2022-07-21 10:03:11 +08:00
selected: [{date: ''}],
2022-07-19 14:41:17 +08:00
list: [],
show: false,
2022-07-15 10:44:31 +08:00
calendarList: {},
year: '',
month: '',
day: '',
2022-07-18 10:55:29 +08:00
yyyyMM: '',
2022-07-12 18:10:42 +08:00
}
},
components: {
uniCalendar
},
2022-07-25 11:42:11 +08:00
created() {
2022-07-15 10:44:31 +08:00
this.getNowDay()
2022-07-25 11:35:50 +08:00
this.getData()
2022-07-15 10:44:31 +08:00
},
2022-07-12 18:10:42 +08:00
methods: {
2022-07-28 08:51:57 +08:00
// 切换月
2022-07-18 10:55:29 +08:00
changeMonth(e) {
if(e.month<=9) {
2022-07-25 11:42:11 +08:00
this.yyyyMM = e.year + '0' + e.month
2022-08-01 09:10:00 +08:00
2022-07-18 10:55:29 +08:00
} else if(e.month > 9) {
2022-07-25 11:42:11 +08:00
this.yyyyMM = e.year + e.month
2022-07-18 10:55:29 +08:00
}
2022-08-01 09:10:00 +08:00
this.month = e.month
2022-07-18 10:55:29 +08:00
this.getData()
},
2022-07-28 08:51:57 +08:00
// 切换日
2022-07-12 18:10:42 +08:00
change(val) {
2022-07-19 14:41:17 +08:00
this.date = val.fulldate
this.day = val.date
this.getData()
2022-07-12 18:10:42 +08:00
},
2022-07-28 08:51:57 +08:00
setDate(v) {
this.yyyyMM = v.detail.value.replace('-', '')
this.getData()
},
2022-07-15 10:44:31 +08:00
getNowDay() {
const date = new Date()
this.year = date.getFullYear()
this.month = date.getMonth() + 1
2022-07-25 11:35:50 +08:00
this.day = date.getDate()
2022-07-15 10:44:31 +08:00
},
2022-07-28 08:51:57 +08:00
2022-07-13 14:35:20 +08:00
toGroup() {
uni.navigateTo({url: './groupSendResident'})
2022-07-15 10:44:31 +08:00
},
getData() {
this.$http.post(`/app/appmasssendingtask/statisticsCalendar`, null, {
2022-07-18 10:55:29 +08:00
params: {
yyyyMM: this.yyyyMM,
},
2022-07-15 10:44:31 +08:00
})
.then((res) => {
if (res?.data) {
this.calendarList = res.data;
2022-08-02 15:32:52 +08:00
let arr = Object.keys(res.data).map(key => (res.data[key]))
this.list = arr[this.day - 1]?.taskList
let calList = arr.filter(item=> (item.taskList && item.taskList.length > 0))
this.selected = calList.map(item=> {
if(item.day>=1 && item.day<=9) {
if(this.month>=1 && this.month <=9) {
return {
date: this.year + '-' + '0' + this.month + '-' + '0' + item.day
2022-07-18 10:55:29 +08:00
}
2022-08-02 15:32:52 +08:00
} else {
return {
date: this.year + '-' + this.month + '-' + '0' + item.day
2022-07-21 10:03:11 +08:00
}
}
2022-08-02 15:32:52 +08:00
} else if(item.day> 9) {
if(this.month > 9) {
return {
date: this.year + '-' + this.month + '-' + item.day
}
} else {
return {
date: this.year + '-' + '0' + this.month + '-' + item.day
}
}
}
})
2022-07-15 10:44:31 +08:00
}
});
},
2022-07-13 14:35:20 +08:00
},
onShow() {
document.title = '宣发日历'
2022-07-12 18:10:42 +08:00
},
}
</script>
<style lang="scss" scoped>
.calendarInfo {
::v-deep .uni-calendar-item__weeks-box-circle {
top: 77%;
right: 45%;
border-radius: 12px;
}
::v-deep .uni-calendar__header {
height: 76px;
2022-07-13 10:52:43 +08:00
justify-content: space-around;
border-bottom-style: none;
}
::v-deep .uni-calendar__weeks-day {
border-bottom-style: none;
}
::v-deep .uni-calendar__weeks-day-text,
::v-deep .uni-calendar__header-text,
::v-deep .uni-calendar-item__weeks-box-text {
font-size: 28px;
}
::v-deep .uni-calendar__header-btn {
width: 16px;
height: 16px;
border-left-color: #5297FF;
border-top-color: #5297FF;
2022-07-12 18:10:42 +08:00
}
::v-deep .uni-calendar__backtoday {
display: none
}
2022-07-13 10:52:43 +08:00
2022-08-02 15:56:21 +08:00
::v-deep .calendarInfo .calendar {
2022-08-02 16:51:06 +08:00
height: 750px !important;
2022-08-02 15:56:21 +08:00
}
2022-07-26 18:04:07 +08:00
.calendar {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 750px;
}
2022-07-13 10:52:43 +08:00
.dailyMatters {
2022-07-26 18:04:07 +08:00
padding: 750px 30px 30px 30px;
2022-07-13 10:52:43 +08:00
box-sizing: border-box;
.daily_item {
background: #FFF;
padding: 30px 20px 30px 50px;
margin-bottom: 30px;
border-radius: 0px 16px 16px 0px;
div:first-child {
color: #999999;
margin-bottom: 20px;
}
}
.color1 {
border-left: 6px solid #3AA0FF;
}
.color2 {
border-left: 6px solid #50CB74;
}
.color3 {
border-left: 6px solid #9D73D9;
}
.color4 {
border-left: 6px solid #435289;
}
.readMore {
2022-07-19 14:41:17 +08:00
height: 40px;
line-height: 40px;
2022-07-13 10:52:43 +08:00
text-align: center;
color: #3F8DF5;
}
}
2022-07-12 18:10:42 +08:00
}
</style>