Skip to content

Commit f4d086f

Browse files
SkyBird233HouLiXieBuRou
authored andcommitted
feat: add AOSCC pages
1 parent e56923e commit f4d086f

File tree

15 files changed

+104
-35
lines changed

15 files changed

+104
-35
lines changed

assets/index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ $common-margin: 24px;
5353
margin-bottom: 0;
5454
}
5555
}
56+
57+
table {
58+
max-width: calc(100% - 2*$common-margin);
59+
}
5660
}
5761

5862
.category-second,

components/CommonContent.vue

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<script lang="ts" setup>
2+
const props = defineProps<{ category: string }>();
3+
4+
const route = useRoute();
5+
const { locale } = useI18n();
6+
7+
const { data: page } = await useAsyncData(
8+
computed(() => `${locale.value}:${props.category}:${route.params.slug}`),
9+
() => {
10+
return queryCollection(locale.value)
11+
.path(`/${props.category}/${route.params.slug}`)
12+
.first();
13+
}
14+
);
15+
useHead({ title: page.value?.title });
16+
</script>
17+
18+
<template>
19+
<article v-if="page">
20+
<category-second
21+
v-if="page?.body.value[0][0]!=='h2'"
22+
:title="page?.title"
23+
:right-text="page?.date.substring(0, 10)"
24+
class="sticky top-0 z-1" />
25+
<ContentRenderer :value="page" class="heti" />
26+
</article>
27+
</template>

components/aoscc/AosccLinkButton.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script setup>
2+
import AppLink from '../app/AppLink.vue';
3+
const props = defineProps({ ...AppLink.props });
4+
</script>
5+
6+
<template>
7+
<AppLink
8+
v-bind="props"
9+
class="theme-bg-color-secondary-primary cursor-pointer overflow-hidden px-4 py-2 text-white hover:no-underline">
10+
<slot />
11+
</AppLink>
12+
</template>

components/app/AppLink.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script setup>
2-
import { RouterLink } from 'vue-router';
2+
import { NuxtLink } from '#components';
33
44
const props = defineProps({
5-
...RouterLink.props,
5+
...NuxtLink.props,
66
class: {
77
type: String,
88
default: 'text-link'

components/content/Info.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<blockquote class="border-l-4 border-(--secondary)">
3+
<slot />
4+
</blockquote>
5+
</template>

components/content/ProsePre.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const pre = useTemplateRef('prose-pre');
3232
<template>
3333
<pre ref="prose-pre" :class="`${$props.class} relative`"><slot /><CopyIcon
3434
class="absolute top-3 right-3"
35-
:content-target="pre?.textContent??undefined" /></pre>
35+
:content-target="pre?.textContent??'undefined'" /></pre>
3636
</template>
3737

3838
<style>

components/copy/CopyIcon.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const props = defineProps({
99

1010
<template>
1111
<Icon
12+
v-if="contentTarget !== 'undefined'"
1213
class="cursor-pointer !bg-(--primary)"
1314
v-bind="props"
1415
name="ep-document-copy"

pages/aoscc/2025.vue

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<script setup lang="ts">
2+
const { locale } = useI18n();
3+
4+
const { data, status } = await useAsyncData(
5+
computed(() => `${locale.value}:aoscc-index`),
6+
() => queryCollection(locale.value).path('/aoscc/2025-index').first()
7+
);
8+
</script>
9+
10+
<template>
11+
<div>
12+
<category-second id="aoscc" title="AOSCC:社区年度聚会" />
13+
<div class="aoscc-banner-bg relative h-[280px] px-10 py-6 text-white">
14+
<div class="absolute bottom-0 mb-10 ml-1 flex gap-4">
15+
<AosccLinkButton to="https://aoscc.aosc.io" target="_blank">
16+
报名与签到
17+
</AosccLinkButton>
18+
<AosccLinkButton to="/aoscc/2025-schedule">会议日程</AosccLinkButton>
19+
<AosccLinkButton to="/aoscc/2025-guide">交通和住宿</AosccLinkButton>
20+
</div>
21+
</div>
22+
<div class="heti">
23+
<h2>AOSCC 简介</h2>
24+
<p>
25+
AOSCC
26+
是我社每年一度的线下聚会,公开邀请社区好友参与。活动期间,社区邀请社区贡献者、高校社团成员和行业代表等分享、交流工作,并组织抽奖、代号投票等趣味活动。近年来,AOSCC
27+
均由中国高校社团协办,每年吸引超过 100 名与会者参与。
28+
</p>
29+
</div>
30+
<ContentRenderer
31+
v-if="status === 'success' && data"
32+
:value="data"
33+
class="heti" />
34+
</div>
35+
</template>
36+
37+
<style scoped>
38+
.aoscc-banner-bg {
39+
background-image: url(/aoscc/aoscc-2025-portal-banner.png);
40+
background-size: 1088px;
41+
}
42+
</style>

pages/aoscc/[slug].vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<common-content category="aoscc" />
3+
</template>

pages/news/[slug].vue

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,3 @@
1-
<script lang="ts" setup>
2-
const route = useRoute();
3-
const { locale } = useI18n();
4-
5-
const { data: page } = await useAsyncData(
6-
computed(() => `${locale.value}:news:${route.params.slug}`),
7-
() => {
8-
return queryCollection(locale.value)
9-
.path(`/news/${route.params.slug}`)
10-
.first();
11-
}
12-
);
13-
useHead({ title: page.value?.title });
14-
</script>
15-
161
<template>
17-
<div>
18-
<article>
19-
<category-second
20-
:title="page?.title"
21-
:right-text="page?.date.substring(0, 10)"
22-
class="sticky top-0 z-1" />
23-
<div v-if="page">
24-
<ContentRenderer :value="page" class="heti" />
25-
</div>
26-
</article>
27-
</div>
2+
<common-content category="news" />
283
</template>
29-
30-
<style lang="css" scoped></style>

0 commit comments

Comments
 (0)