add tobecontinue

This commit is contained in:
2023-10-22 20:47:51 +08:00
parent 2c91a052e4
commit 7e679b9789
6 changed files with 51 additions and 18 deletions

View File

@@ -11,18 +11,16 @@ const { width } = useWindowSize()
const weekdays = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] const weekdays = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
function getDateFromWeek(year: number, week: number, dayOfWeek: number): Date { function getDateFromWeek(year: number, week: number, dayOfWeek: number): Date {
// week starts from 1-52, dayOfWeek starts from 0-6 where 0 is Monday // week starts from 1-52, dayOfWeek starts from 0-6 where 0 is Monday
var simple = new Date(year, 0, 1 + (week - 1) * 7); var simple = new Date(year, 0, 1 + (week - 1) * 7)
var dow = simple.getDay(); var dow = simple.getDay()
var ISOweekStart = simple; var ISOweekStart = simple
if (dow <= 4) if (dow <= 4) ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1)
ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1); else ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay())
else return new Date(ISOweekStart.getFullYear(), ISOweekStart.getMonth(), ISOweekStart.getDate() + dayOfWeek)
ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay());
return new Date(ISOweekStart.getFullYear(), ISOweekStart.getMonth(), ISOweekStart.getDate() + dayOfWeek);
} }
defineProps<{ defineProps<{
schedules: ScheduleWeekInfo[], schedules: ScheduleWeekInfo[]
isSelf: boolean isSelf: boolean
}>() }>()
const emit = defineEmits<{ const emit = defineEmits<{
@@ -34,7 +32,7 @@ const emit = defineEmits<{
<template> <template>
<NEmpty v-if="(schedules?.length ?? 0) == 0" /> <NEmpty v-if="(schedules?.length ?? 0) == 0" />
<NList style="padding: 0;" bordered > <NList v-else style="padding: 0" bordered>
<NListItem v-for="item in schedules" v-bind:key="item.year + ' ' + item.week" style="padding: 0"> <NListItem v-for="item in schedules" v-bind:key="item.year + ' ' + item.week" style="padding: 0">
<NCard size="small" :bordered="false"> <NCard size="small" :bordered="false">
<template #header> <template #header>
@@ -64,7 +62,7 @@ const emit = defineEmits<{
<template #header-extra> <template #header-extra>
<template v-if="day.tag"> <template v-if="day.tag">
<NSpace :size="5"> <NSpace :size="5">
<NBadge v-if="day.tagColor" dot :color="day.tagColor"/> <NBadge v-if="day.tagColor" dot :color="day.tagColor" />
<NEllipsis> <NEllipsis>
<NText :style="{ color: day.tagColor }"> <NText :style="{ color: day.tagColor }">
{{ day.tag }} {{ day.tag }}

View File

@@ -98,6 +98,11 @@ const routes: Array<RouteRecordRaw> = [
name: 'manage-schedule', name: 'manage-schedule',
component: () => import('@/views/manage/ScheduleManageView.vue'), component: () => import('@/views/manage/ScheduleManageView.vue'),
}, },
{
path: 'event',
name: 'manage-event',
component: () => import('@/views/manage/EventView.vue'),
},
], ],
}, },
] ]

View File

@@ -23,7 +23,7 @@ import {
} from 'naive-ui' } from 'naive-ui'
import { h, onMounted, ref } from 'vue' import { h, onMounted, ref } from 'vue'
import { BrowsersOutline, Chatbox, Moon, MusicalNote, Sunny, AnalyticsSharp } from '@vicons/ionicons5' import { BrowsersOutline, Chatbox, Moon, MusicalNote, Sunny, AnalyticsSharp } from '@vicons/ionicons5'
import { CalendarClock24Filled, Lottery24Filled } from '@vicons/fluent' import { CalendarClock24Filled, Lottery24Filled, VehicleShip24Filled } from '@vicons/fluent'
import { isLoadingAccount, useAccount } from '@/api/account' import { isLoadingAccount, useAccount } from '@/api/account'
import RegisterAndLogin from '@/components/RegisterAndLogin.vue' import RegisterAndLogin from '@/components/RegisterAndLogin.vue'
import { RouterLink } from 'vue-router' import { RouterLink } from 'vue-router'
@@ -63,6 +63,21 @@ const menuOptions = [
key: 'manage-history', key: 'manage-history',
icon: renderIcon(AnalyticsSharp), icon: renderIcon(AnalyticsSharp),
}, },
{
label: () =>
h(
RouterLink,
{
to: {
name: 'manage-event',
},
disabled: accountInfo.value?.isBiliVerified != true,
},
{ default: () => '舰长和SC' }
),
key: 'manage-event',
icon: renderIcon(VehicleShip24Filled),
},
{ {
label: () => label: () =>
h( h(

View File

@@ -1,6 +1,6 @@
<!-- eslint-disable vue/component-name-in-template-casing --> <!-- eslint-disable vue/component-name-in-template-casing -->
<script setup lang="ts"> <script setup lang="ts">
import { NAvatar, NIcon, NLayout, NLayoutHeader, NLayoutSider, NMenu, NSpace, NText, NButton, NResult, NPageHeader, NSwitch, NModal, NEllipsis, MenuOption, NSpin } from 'naive-ui' import { NAvatar, NIcon, NLayout, NLayoutHeader, NLayoutSider, NMenu, NSpace, NText, NButton, NResult, NPageHeader, NSwitch, NModal, NEllipsis, MenuOption, NSpin, NLayoutContent } from 'naive-ui'
import { computed, h, onMounted, ref } from 'vue' import { computed, h, onMounted, ref } from 'vue'
import { BookOutline as BookIcon, Chatbox, Home, Moon, MusicalNote, PersonOutline as PersonIcon, Sunny, WineOutline as WineIcon } from '@vicons/ionicons5' import { BookOutline as BookIcon, Chatbox, Home, Moon, MusicalNote, PersonOutline as PersonIcon, Sunny, WineOutline as WineIcon } from '@vicons/ionicons5'
import { GetInfo, useUser, useUserWithUId } from '@/api/user' import { GetInfo, useUser, useUserWithUId } from '@/api/user'
@@ -23,6 +23,8 @@ const userInfo = ref<UserInfo>()
const biliUserInfo = ref() const biliUserInfo = ref()
const accountInfo = useAccount() const accountInfo = useAccount()
const notfount = ref(false)
const registerAndLoginModalVisiable = ref(false) const registerAndLoginModalVisiable = ref(false)
const sider = ref() const sider = ref()
const { width } = useElementSize(sider) const { width } = useElementSize(sider)
@@ -47,7 +49,13 @@ async function RequestBiliUserData() {
} }
onMounted(async () => { onMounted(async () => {
userInfo.value = await useUser() const result = await GetInfo(id.value?.toString())
if (result.code == 200) {
userInfo.value = result.data
} else {
notfount.value = true
}
menuOptions.value = [ menuOptions.value = [
{ {
label: () => label: () =>
@@ -114,8 +122,12 @@ onMounted(async () => {
</script> </script>
<template> <template>
<NResult v-if="!id" status="error" title="输入的uId无效" description="再检查检查" /> <NLayoutContent v-if="!id" style="height: 100vh;">
<NResult v-else-if="false" status="error" title="未找到指定 uId 的用户" description="或者是没有进行认证" /> <NResult status="error" title="输入的uId无效" description="再检查检查" />
</NLayoutContent>
<NLayoutContent v-else-if="notfount" style="height: 100vh;">
<NResult status="error" title="未找到指定 uId 的用户" description="或者是没有进行认证" />
</NLayoutContent>
<NLayout v-else style="height: 100vh"> <NLayout v-else style="height: 100vh">
<NLayoutHeader style="height: 50px; padding: 5px 15px 5px 15px"> <NLayoutHeader style="height: 50px; padding: 5px 15px 5px 15px">
<NPageHeader :subtitle="($route.meta.title as string) ?? ''"> <NPageHeader :subtitle="($route.meta.title as string) ?? ''">

View File

@@ -0,0 +1,3 @@
<template>
编写中...
</template>

View File

@@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { UserInfo } from '@/api/api-models' import { UserInfo } from '@/api/api-models'
import { NAvatar, NButton, NDivider, NSpace, NText } from 'naive-ui' import { NAvatar, NButton, NDivider, NImage, NSpace, NText } from 'naive-ui'
const width = window.innerWidth const width = window.innerWidth