Merge pull request 'xbx' (#54) from xbx into master

Reviewed-on: http://git.luyuan.tk/luyuan/beelink/pulls/54
This commit is contained in:
luyuan 2020-10-19 09:00:23 +08:00
commit 1debb888c2
3 changed files with 46 additions and 15 deletions

View File

@ -2,7 +2,7 @@ import dayjs from 'dayjs'
interface Date{ interface Date{
day?: number; day?: number;
list?: Array<unknown>; list?: Array<any>;
} }
interface GetDate{ interface GetDate{
@ -46,7 +46,8 @@ export function getdate(yue?: number): GetDate{
i++; i++;
const zhou = Math.floor((i + w - 1) / 7) const zhou = Math.floor((i + w - 1) / 7)
const d = { const d = {
day: i day: i,
list: []
} }
if(date[zhou] == undefined){ if(date[zhou] == undefined){
date[zhou] = [] date[zhou] = []
@ -91,4 +92,11 @@ export function getweek(zhou?: number){
} }
console.log(date) console.log(date)
return {date, year, yue, day, zhou} return {date, year, yue, day, zhou}
}
export function getDay(date: string){
const now = dayjs(date)
console.log(now.date())
return now.date();
} }

View File

@ -83,7 +83,7 @@
></VideoItem> ></VideoItem>
</div> </div>
<div class="pages"> <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>
</div> </div>
</template> </template>
@ -232,6 +232,7 @@ export default defineComponent({
} }
async function sel(){ async function sel(){
console.log(input.value); console.log(input.value);
page.value = 1;
videolist.value = await getvideolist({title: input.value,page:page.value}); videolist.value = await getvideolist({title: input.value,page:page.value});
} }
async function pagechange() { async function pagechange() {

View File

@ -28,11 +28,11 @@
<div class="row" v-for="(item,index) in month.date" :key="index"> <div class="row" v-for="(item,index) in month.date" :key="index">
<div v-for="(i,j) in item" :key="j"> <div v-for="(i,j) in item" :key="j">
<div class="day"> <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}} {{i.day}}
<!-- <div class="item"> <div class="item" v-for="(i,j) in i.list" :key="j">
<div></div><p>asdsadas</p> <div></div><p>{{i}}</p>
</div> --> </div>
<!-- <span class="ing"></span> --> <!-- <span class="ing"></span> -->
<!-- <span class="next"></span> --> <!-- <span class="next"></span> -->
</div> </div>
@ -186,8 +186,8 @@
} }
</style> </style>
<script lang="ts"> <script lang="ts">
import { defineComponent, ref } from 'vue'; import { computed, defineComponent, ref, watch } from 'vue';
import { getdate } from "@/utils/date" import { getdate, getDay } from "@/utils/date"
import { getdatelist } from '@/api'; import { getdatelist } from '@/api';
import store from '@/store'; import store from '@/store';
@ -199,24 +199,46 @@ export default defineComponent({
console.log(1) console.log(1)
const date = getdate(); const date = getdate();
console.log(date) console.log(date)
const month = ref(date); const month: any = ref(date);
const yue = ref(0); const yue = ref(0);
function xia(){ function xia(){
yue.value = yue.value + 1; yue.value = yue.value + 1;
month.value = getdate(yue.value) month.value = getdate(yue.value)
getdates() getdates(userid.value)
} }
const userid = computed(() => {
return store.state.userinfo.memberid;
})
watch(userid, ()=> {
getdates(userid.value);
})
function shang(){ function shang(){
yue.value = yue.value - 1; yue.value = yue.value - 1;
month.value = getdate(yue.value) month.value = getdate(yue.value)
getdates() getdates(userid.value)
} }
async function getdates(){ async function getdates(userid: number){
getdatelist(month.value.start, month.value.end, store.state.userinfo.memberid).then((res)=>{ getdatelist(month.value.start, month.value.end, userid).then((res: any)=>{
console.log(res) 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 { return {
month, month,
xia, xia,