Commit abfb1f5d authored by 袁玲利's avatar 袁玲利

校园报告

parent 6eaace67
......@@ -5,7 +5,8 @@
</div>
<div class="calendar-inner">
<div class="calendar-item" v-for="(item, index) of calendarList" :key="index"
:class="[item.disable ? 'disabled' : '',item.value=='2023-08-23'||item.value=='2023-08-18'||item.value=='2023-08-28'?'signdate':'',item.value===currentDay?'today':'']">
:class="[item.disable ? 'disabled' : '',item.signdate ? 'signdate':'',item.value===currentDay?'today':'']"
@click="changeToday_(item)">
<!-- <div v-if="item.value=='2023-08-23'||item.value=='2023-08-18'||item.value=='2023-08-28'" class="icons">
<span v-if="item.value=='2023-08-23'">早中</span>
<span v-else-if="item.value=='2023-08-18'">早中晚</span>
......@@ -33,13 +34,26 @@
type: String,
default: ""
},
cateringAbnormalTypeGroupList: {
type: Array,
default: function() {
return [];
}
},
changeToday: {
type: Function,
default: function() {
}
}
},
data() {
return {
current: {}, // 当前时间
weekList: ['', '', '', '', '', '', ''],
calendarList: [], // 用于遍历显示
shareDate: new Date()
shareDate: new Date(),
groupList: [],
}
},
computed: {
......@@ -63,15 +77,19 @@
},
methods: {
init() {
console.log(this.shareDate_,)
console.log(this.shareDate_, )
this.shareDate = new Date(this.shareDate_);
this.current = this.currentDate;
this.groupList = this.cateringAbnormalTypeGroupList
// this.shareDate = new Date('2023-05-01')
console.log(this.shareDate, 'shareDate11111')
// 初始化当前时间
// this.setCurrent();
this.calendarCreator();
},
changeToday_(item) {
this.$emit('changeToday', item)
},
// 判断当前月有多少天
getDaysByMonth(year, month) {
return new Date(year, month + 1, 0).getDate();
......@@ -138,6 +156,7 @@
calendarCreator() {
// 一天有多少毫秒
const oneDayMS = 24 * 60 * 60 * 1000;
console.log(this.groupList, 'groupList')
let list = [];
let {
......@@ -158,32 +177,62 @@
let suffixDaysLen = lastDay === 0 ? 0 : 7 - lastDay;
// 毫秒数
let end = new Date(year, month + 1, 0).getTime() + oneDayMS * suffixDaysLen;
// 默认每月第一天
let currentToday = {
month: this.current.month,
unrecordedZao: false,
unrecordedWu: false,
unrecordedWan: false
}
while (begin <= end) {
this.shareDate.setTime(begin);
let year = this.shareDate.getFullYear();
let curMonth = this.shareDate.getMonth();
let date = this.shareDate.getDate();
list.push({
let obj = {
year: year,
month: curMonth,
date: date,
disable: curMonth !== month,
value: this.stringify(year, curMonth, date)
});
value: this.stringify(year, curMonth, date),
signdate: false
}
if (curMonth == month) {
let f = this.groupList.filter(y => y.date == date)
if (f.length) {
obj.signdate = true
if(f[0].date == 1){
currentToday = Object.assign(currentToday, f[0])
}
}
}
list.push(obj);
begin += oneDayMS;
}
console.log(currentToday, 'currentToday')
this.changeToday_(currentToday)
this.calendarList = list;
console.log(list, 'calendarList')
}
},
watch: {
currentDate(val) {
this.current = val
currentDate(val, oldVal) {
if (val !== oldVal) {
this.current = val;
this.calendarCreator();
}
},
shareDate_(val) {
shareDate_(val, oldVal) {
if (val !== oldVal) {
this.shareDate = new Date(val)
this.calendarCreator();
}
},
cateringAbnormalTypeGroupList(val, oldVal) {
if (val !== oldVal) {
this.groupList = val
this.calendarCreator();
}
}
},
......@@ -232,7 +281,7 @@
width: 88rpx;
height: 88rpx;
box-sizing: border-box;
padding-top: 28rpx;
/* padding-top: 28rpx; */
border-radius: 22rpx;
margin: 5rpx;
justify-content: center;
......@@ -241,7 +290,7 @@
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: rgba(0, 0, 0, 0.75);
line-height: 45rpx;
line-height: 88rpx;
flex-direction: column;
}
......
......@@ -238,7 +238,7 @@
return
}
this.userInfo = {
schoolId: data.data['schoolId'],
schoolId: data.data['schoolId'] || '',
userId: data.data['userId'],
userType: data.data['userType'] || ''
}
......@@ -267,6 +267,7 @@
}
data.data['schoolConsumption'] = schoolConsumption
this.HomeDataInfo = data.data
sessionStorage.setItem('HomeDataInfo', JSON.stringify(this.HomeDataInfo))
sessionStorage.setItem('accountId', this.HomeDataInfo['accountId'])
// 查询消费会员权益项
this.QueryProductContractItem()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment