添加了加载中 日历完成一般
This commit is contained in:
parent
8d93aa04d3
commit
d6a2569255
@ -4,14 +4,22 @@ import { AxiosRequestConfig, CustomSuccessData } from 'axios';
|
||||
import { getValue } from '@/utils/common';
|
||||
import { message } from 'ant-design-vue';
|
||||
import router from '@/router';
|
||||
import { MessageType } from 'ant-design-vue/types/message';
|
||||
|
||||
// 泛型接口
|
||||
export interface Get {
|
||||
<T>(url: string, params?: unknown, config?: AxiosRequestConfig): Promise<CustomSuccessData<T>>;
|
||||
}
|
||||
const login:MessageType[] = []
|
||||
axios.interceptors.request.use((config)=>{
|
||||
login.push(message.loading('加载中..', 0))
|
||||
return config;
|
||||
})
|
||||
|
||||
axios.interceptors.response.use((response)=>{
|
||||
// console.log(response)
|
||||
login[0]();
|
||||
login.splice(0,1);
|
||||
if(response.data.code == 1001){
|
||||
router.push("/")
|
||||
}
|
||||
|
@ -89,7 +89,9 @@ export function getweek(zhou?: number){
|
||||
for(let j = 0;j < 24; j++){
|
||||
date[i].list?.push({
|
||||
start:"",
|
||||
num:""
|
||||
num:"",
|
||||
title: "",
|
||||
time:""
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -104,3 +106,23 @@ export function getDay(date: string){
|
||||
console.log(now.date())
|
||||
return now.date();
|
||||
}
|
||||
|
||||
export function gethour(date: string){
|
||||
const now = dayjs(date)
|
||||
console.log(now.hour(), now.date(), now.minute())
|
||||
return now.hour();
|
||||
}
|
||||
|
||||
export function getminute(date: string){
|
||||
const now = dayjs(date)
|
||||
// console.log(now.hour(), now.date(), now.minute())
|
||||
return now.minute();
|
||||
}
|
||||
|
||||
export function gettime(date: string, num: number){
|
||||
let now = dayjs(date)
|
||||
const start = `${now.hour() > 9 ? now.hour() : '0' + now.hour()}:${now.minute() > 9 ? now.minute() : '0' + now.minute()}`
|
||||
now = now.minute(now.minute() + num);
|
||||
const end = `${now.hour() > 9 ? now.hour() : '0' + now.hour()}:${now.minute() > 9 ? now.minute() : '0' + now.minute()}`
|
||||
return start + "-" + end;
|
||||
}
|
@ -46,11 +46,11 @@
|
||||
</div>
|
||||
<div v-for="i in 7" :key="i">
|
||||
<div class="day">
|
||||
<div class="">
|
||||
<div class="one-line-hide">
|
||||
one-line-hideon
|
||||
<div class="next" v-if="week.date[i -1].list[item - 1].title != ''">
|
||||
<div class="one-line-hide" style="max-width: 1.5rem">
|
||||
{{week.date[i -1].list[item - 1].title}}
|
||||
</div>
|
||||
<div>11:00-11:00</div>
|
||||
<div>{{week.date[i -1].list[item - 1].time}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -176,7 +176,8 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 11px;
|
||||
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
> div:last-child {
|
||||
font-size: 11px;
|
||||
margin-top: 8px;
|
||||
@ -185,6 +186,7 @@
|
||||
.old {
|
||||
background-color: #f7f7f7;
|
||||
color: #111;
|
||||
|
||||
}
|
||||
.ing {
|
||||
background-color: #0dbba4;
|
||||
@ -206,17 +208,42 @@
|
||||
</style>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, watch } from "vue";
|
||||
import { getweek } from "@/utils/date";
|
||||
import { getDay, gethour, getminute, gettime, getweek } from "@/utils/date";
|
||||
import store from '@/store';
|
||||
import { getdatelist, userinfo } from '@/api';
|
||||
|
||||
export default defineComponent({
|
||||
props: {},
|
||||
setup() {
|
||||
const zhou = ref(0);
|
||||
const week = ref(getweek());
|
||||
const week = ref<any>(getweek());
|
||||
const userid = store.state.userinfo.memberid;
|
||||
console.log(week.value);
|
||||
getdates(userid);
|
||||
function getdates(userid: number){
|
||||
getdatelist(week.value.start, week.value.end, userid).then((res: any)=>{
|
||||
console.log(res)
|
||||
for(let i in res){
|
||||
const day = getDay(res[i].dateline)
|
||||
console.log(day)
|
||||
for(let j in week.value.date){
|
||||
console.log(getDay(week.value.date[j].day))
|
||||
if(day == getDay(week.value.date[j].day)){
|
||||
console.log("fuzhi")
|
||||
week.value.date[j].list[gethour(res[i].dateline)].start = getminute(res[i].dateline);
|
||||
week.value.date[j].list[gethour(res[i].dateline)].num = res[i].livetime
|
||||
week.value.date[j].list[gethour(res[i].dateline)].title = res[i].title
|
||||
week.value.date[j].list[gethour(res[i].dateline)].time = gettime(res[i].dateline, res[i].livetime)
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(week.value)
|
||||
})
|
||||
}
|
||||
watch(zhou, (value) => {
|
||||
week.value = getweek(value);
|
||||
console.log(week.value);
|
||||
getdates(userid)
|
||||
});
|
||||
return {
|
||||
zhou,
|
||||
|
Loading…
Reference in New Issue
Block a user