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

校园报告

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