月日历完成
This commit is contained in:
@@ -28,11 +28,11 @@
|
||||
<div class="row" v-for="(item,index) in month.date" :key="index">
|
||||
<div v-for="(i,j) in item" :key="j">
|
||||
<div class="day">
|
||||
<div :class="{ing: yue == 0 && month.day == i.day}">
|
||||
<div :class="{ing: yue == 0 && month.day == i.day,old: (yue < 0 || (yue == 0 && month.day > i.day)) && i.list.length != 0 ,next: (yue > 0 || (yue == 0 && month.day < i.day)) && i.list.length != 0 }">
|
||||
{{i.day}}
|
||||
<!-- <div class="item">
|
||||
<div></div><p>asdsadas</p>
|
||||
</div> -->
|
||||
<div class="item" v-for="(i,j) in i.list" :key="j">
|
||||
<div></div><p>{{i}}</p>
|
||||
</div>
|
||||
<!-- <span class="ing"></span> -->
|
||||
<!-- <span class="next"></span> -->
|
||||
</div>
|
||||
@@ -186,8 +186,8 @@
|
||||
}
|
||||
</style>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from 'vue';
|
||||
import { getdate } from "@/utils/date"
|
||||
import { computed, defineComponent, ref, watch } from 'vue';
|
||||
import { getdate, getDay } from "@/utils/date"
|
||||
import { getdatelist } from '@/api';
|
||||
import store from '@/store';
|
||||
|
||||
@@ -199,24 +199,46 @@ export default defineComponent({
|
||||
console.log(1)
|
||||
const date = getdate();
|
||||
console.log(date)
|
||||
const month = ref(date);
|
||||
const month: any = ref(date);
|
||||
const yue = ref(0);
|
||||
function xia(){
|
||||
yue.value = yue.value + 1;
|
||||
month.value = getdate(yue.value)
|
||||
getdates()
|
||||
getdates(userid.value)
|
||||
}
|
||||
const userid = computed(() => {
|
||||
return store.state.userinfo.memberid;
|
||||
|
||||
})
|
||||
watch(userid, ()=> {
|
||||
getdates(userid.value);
|
||||
})
|
||||
function shang(){
|
||||
yue.value = yue.value - 1;
|
||||
month.value = getdate(yue.value)
|
||||
getdates()
|
||||
getdates(userid.value)
|
||||
}
|
||||
async function getdates(){
|
||||
getdatelist(month.value.start, month.value.end, store.state.userinfo.memberid).then((res)=>{
|
||||
async function getdates(userid: number){
|
||||
getdatelist(month.value.start, month.value.end, userid).then((res: any)=>{
|
||||
console.log(res)
|
||||
for(let i in res){
|
||||
const day = getDay(res[i].dateline)
|
||||
for(let j in month.value.date){
|
||||
for(let k in month.value.date[j]){
|
||||
if(month.value.date[j][k].day == day){
|
||||
if(month.value.date[j][k].list == undefined){
|
||||
month.value.date[j][k].list = [];
|
||||
}
|
||||
month.value.date[j][k].list.push(res[i].title);
|
||||
console.log(day)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(month.value.date)
|
||||
})
|
||||
}
|
||||
getdates()
|
||||
getdates(userid.value);
|
||||
return {
|
||||
month,
|
||||
xia,
|
||||
|
||||
Reference in New Issue
Block a user