Merge pull request 'xbx' (#54) from xbx into master
Reviewed-on: http://git.luyuan.tk/luyuan/beelink/pulls/54
This commit is contained in:
commit
1debb888c2
@ -2,7 +2,7 @@ import dayjs from 'dayjs'
|
||||
|
||||
interface Date{
|
||||
day?: number;
|
||||
list?: Array<unknown>;
|
||||
list?: Array<any>;
|
||||
}
|
||||
|
||||
interface GetDate{
|
||||
@ -46,7 +46,8 @@ export function getdate(yue?: number): GetDate{
|
||||
i++;
|
||||
const zhou = Math.floor((i + w - 1) / 7)
|
||||
const d = {
|
||||
day: i
|
||||
day: i,
|
||||
list: []
|
||||
}
|
||||
if(date[zhou] == undefined){
|
||||
date[zhou] = []
|
||||
@ -91,4 +92,11 @@ export function getweek(zhou?: number){
|
||||
}
|
||||
console.log(date)
|
||||
return {date, year, yue, day, zhou}
|
||||
}
|
||||
|
||||
|
||||
export function getDay(date: string){
|
||||
const now = dayjs(date)
|
||||
console.log(now.date())
|
||||
return now.date();
|
||||
}
|
@ -83,7 +83,7 @@
|
||||
></VideoItem>
|
||||
</div>
|
||||
<div class="pages">
|
||||
<a-pagination v-model:current="page" :total="50" :showLessItems="true" @change="pagechange" />
|
||||
<a-pagination v-model:current="page" :total="videolist.total" :showLessItems="true" @change="pagechange" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -232,6 +232,7 @@ export default defineComponent({
|
||||
}
|
||||
async function sel(){
|
||||
console.log(input.value);
|
||||
page.value = 1;
|
||||
videolist.value = await getvideolist({title: input.value,page:page.value});
|
||||
}
|
||||
async function pagechange() {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user