Skip to content

Commit 42d0ed4

Browse files
committed
update docs
1 parent 02511e9 commit 42d0ed4

File tree

8 files changed

+43
-80
lines changed

8 files changed

+43
-80
lines changed

docs/.vuepress/components/BannerTop.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
<div class="banner">
33
<p class="vp-banner-text">
44
<span class="vp-text-primary">FBA </span>
5-
<span class="vp-tagline">· FasAPI</span>
6-
<span class="vp-place"> 最佳架构</span>
7-
<span class="vp-date"> · 插件系统已发布</span>
8-
<a class="vp-primary-action" href="/fastapi_best_architecture_docs/plugin/before.html"> 甩起来 </a>
5+
<span class="vp-tagline">企业级</span>
6+
<span class="vp-place"> 后端架构解决方案</span>
7+
<span class="vp-date"> · 架构源码全量开源</span>
8+
<a class="vp-primary-action"
9+
href="/fastapi_best_architecture_docs/backend/summary/quick-start.html"
10+
>体验反馈</a>
911
</p>
1012
<button @click="dismiss">
1113
<Icon name="mingcute:close-fill" />

docs/.vuepress/components/Planet.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<div class="qr-section">
88
<button class="qr-toggle" @click="toggleQrOpen">
9-
<span class="qr-toggle-icon" :class="{ 'open': qrOpen }"></span>
9+
<span :class="{ 'open': qrOpen }" class="qr-toggle-icon"></span>
1010
扫码订阅
1111
<span v-if="qrOpen">收起</span>
1212
<span v-else>展开</span>
@@ -15,7 +15,7 @@
1515
<p>
1616
加入 <a href="https://discord.gg/Sdg6dT5kjz" target="_blank">Discord</a> 社区,可领取免费体验资格
1717
</p>
18-
<img src="https://wu-clan.github.io/picx-images-hosting/知识星球.png" alt="知识星球" class="qr-image" />
18+
<img alt="知识星球" class="qr-image" src="https://wu-clan.github.io/picx-images-hosting/知识星球.png" />
1919
</div>
2020
</div>
2121

@@ -27,8 +27,8 @@
2727
<button
2828
v-for="tab in tabs"
2929
:key="tab.id"
30-
@click="activeTab = tab.id"
3130
:class="{ active: activeTab === tab.id }"
31+
@click="activeTab = tab.id"
3232
>
3333
{{ tab.label }}
3434
</button>
@@ -49,17 +49,17 @@
4949
<LinkCard
5050
v-for="card in tabs.find((tab) => tab.id === activeTab)!.cards"
5151
:key="card.href"
52-
:title="card.title"
53-
:icon="card.icon"
54-
:href="card.href"
5552
:description="card.description"
53+
:href="card.href"
54+
:icon="card.icon"
55+
:title="card.title"
5656
/>
5757
</CardGrid>
5858
</div>
5959
</div>
6060
</template>
6161

62-
<script setup lang="ts">
62+
<script lang="ts" setup>
6363
import { ref } from 'vue';
6464
import { Card, fastapiCards, fbaCards, pluginCards } from "../data/planet";
6565

docs/.vuepress/components/PluginMarket.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
<div class="search-container">
44
<input
55
v-model="searchQuery"
6-
type="text"
7-
placeholder="🔍 搜索插件..."
86
class="search-input"
7+
placeholder="🔍 搜索插件..."
8+
type="text"
99
/>
1010
</div>
1111
<div class="plugin-card-container">
1212
<div
1313
v-for="(item, index) in filteredItems"
1414
:key="index"
15-
class="plugin-card"
1615
:class="{ 'clickable': item.link }"
16+
class="plugin-card"
1717
@click="handleCardClick(item)"
1818
>
1919
<div class="card-image">
2020
<img
2121
v-if="item.image"
22-
:src="item.image"
2322
:alt="item.title"
23+
:src="item.image"
2424
class="image-content"
2525
/>
2626
<div v-else class="image-placeholder">
27-
<Icon :name="item.icon" size="5em" color="var(--vp-c-text-1)" />
27+
<Icon :name="item.icon" color="var(--vp-c-text-1)" size="5em" />
2828
</div>
2929
<div
3030
v-if="item.free?.valueOf() === false"
@@ -40,8 +40,8 @@
4040
<div class="card-title-link">
4141
<a
4242
:href="item.link"
43-
target="_blank"
4443
rel="noopener noreferrer"
44+
target="_blank"
4545
@click.stop
4646
/>
4747
<span class="label-inline">{{ item.label || '内置' }}</span>
@@ -52,17 +52,17 @@
5252
<Badge
5353
v-for="(tag, tagIndex) in item.tags"
5454
:key="tagIndex"
55-
:text="tag"
5655
:style="colors[tag]"
56+
:text="tag"
5757
/>
5858
</div>
5959
</div>
6060
</div>
6161
</div>
6262
</template>
6363

64-
<script setup lang="ts">
65-
import { ref, computed } from 'vue'
64+
<script lang="ts" setup>
65+
import { computed, ref } from 'vue'
6666
6767
export interface PluginItem {
6868
icon: string

docs/.vuepress/components/SponsorHome.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<section v-if="shouldShowSponsor(homeSponsor)" id="special-spsr">
2+
<section v-if="shouldShowSponsor(homeSponsor.expiryTime)" id="special-spsr">
33
<span>特别赞助商</span>
44
<a :href="homeSponsor.href" target="_blank">
55
<img :alt="homeSponsor.alt" :src="homeSponsor.link" width="208" />

docs/.vuepress/components/SponsorPanel.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="gold-sponsors">
1111
<div
1212
v-for="(brand, index) in processedGoldSponsors"
13-
v-show="!isCollapsed || (isCollapsed && shouldShowSponsor(brand))"
13+
v-show="!isCollapsed || (isCollapsed && shouldShowSponsor(brand.expiryTime))"
1414
:key="'gold-' + index"
1515
:class="{ 'collapsed-mode': isCollapsed }"
1616
class="brand-item gold"
@@ -28,7 +28,7 @@
2828
<div class="general-sponsors">
2929
<div
3030
v-for="(brand, index) in processedGeneralSponsors"
31-
v-show="!isCollapsed || (isCollapsed && shouldShowSponsor(brand))"
31+
v-show="!isCollapsed || (isCollapsed && shouldShowSponsor(brand.expiryTime))"
3232
:key="'general-' + index"
3333
:class="{ 'collapsed-mode': isCollapsed }"
3434
class="brand-item"
@@ -69,19 +69,19 @@ const isCollapsed = useStorage('fba-docs-sponsor-collapsed', false);
6969
7070
const processedGoldSponsors = computed(() => {
7171
return goldSponsors.map(brand => {
72-
return shouldShowSponsor(brand) ? brand : defaultSponsor;
72+
return shouldShowSponsor(brand.expiryTime) ? brand : defaultSponsor;
7373
});
7474
});
7575
7676
const processedGeneralSponsors = computed(() => {
7777
return generalSponsors.map(brand => {
78-
return shouldShowSponsor(brand) ? brand : defaultSponsor;
78+
return shouldShowSponsor(brand.expiryTime) ? brand : defaultSponsor;
7979
});
8080
});
8181
8282
const shouldShowExtraBecomeSponsor = computed(() => {
83-
return (goldSponsors.filter(brand => brand.link && shouldShowSponsor(brand)).length +
84-
generalSponsors.filter(brand => brand.link && shouldShowSponsor(brand)).length) < 9;
83+
return (goldSponsors.filter(brand => brand.link && shouldShowSponsor(brand.expiryTime)).length +
84+
generalSponsors.filter(brand => brand.link && shouldShowSponsor(brand.expiryTime)).length) < 9;
8585
});
8686
8787
const toggleCollapse = () => {

docs/.vuepress/components/SponsorSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@click="openSponsorLink(homeSponsor.href)"
1010
>
1111
<img
12-
v-if="shouldShowSponsor(homeSponsor)"
12+
v-if="shouldShowSponsor(homeSponsor.expiryTime)"
1313
:alt="homeSponsor.alt"
1414
:src="homeSponsor.link"
1515
class="brand-image"

docs/.vuepress/components/Swiper.vue

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,10 @@ import "swiper/css/effect-flip";
2525
import "swiper/css/effect-coverflow";
2626
import "swiper/css/effect-cards";
2727
import "swiper/css/effect-creative";
28-
import { defaultSponsor, shouldShowSponsor } from "../data/sponsors";
29-
30-
interface SlideItem {
31-
/**
32-
* 图片地址
33-
*/
34-
link?: string;
35-
/**
36-
* 跳转链接
37-
*/
38-
href?: string;
39-
alt?: string;
40-
}
28+
import { defaultSponsor, shouldShowSponsor, Sponsor } from "../data/sponsors";
4129
4230
interface Props {
43-
items?: SlideItem[];
31+
items?: Sponsor[];
4432
width?: number | string; // 轮播区域宽度,单位 px
4533
height?: number | string; // 轮播区域高度,单位 px
4634
mode?: "banner" | "carousel" | "broadcast"; // banner: 轮播图模式; carousel: 走马灯模式; broadcast: 信息展播模式
@@ -68,19 +56,10 @@ const props = withDefaults(defineProps<Props>(), {
6856
6957
const sponsors = computed(() => {
7058
return props.items.map(brand => {
71-
return shouldShowSponsor(brand) ? brand : defaultSponsor;
59+
return shouldShowSponsor(brand.expiryTime) ? brand : defaultSponsor;
7260
});
7361
});
7462
75-
const slideList = computed<SlideItem[]>(() => {
76-
return (
77-
sponsors.value?.map((link) => {
78-
if (typeof link === "string") return { link };
79-
return link;
80-
}) ?? []
81-
);
82-
});
83-
8463
function parseSize(size: number | string) {
8564
if (typeof size === "number") {
8665
return `${ size }px`;
@@ -182,7 +161,7 @@ onMounted(() => {
182161
v-bind="$attrs"
183162
@swiper="onSwiper"
184163
>
185-
<SwiperSlide v-for="(item, index) in slideList" :key="'general-' + index">
164+
<SwiperSlide v-for="(item, index) in sponsors" :key="'general-' + index">
186165
<a
187166
v-if="item.href && item.link"
188167
:href="item.href"

docs/.vuepress/data/sponsors.ts

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export const sponsorUrl: string = typeof window !== 'undefined' ? window.location.origin + '/fastapi_best_architecture_docs/sponsors.html' : 'https://fastapi-practices.github.io/fastapi_best_architecture_docs/sponsors.html';
22

3-
interface Sponsor {
3+
export interface Sponsor {
4+
link: string;
45
href?: string;
5-
link?: string;
66
alt?: string;
77
expiryTime: string; // ISO 格式日期:2099-12-31T23:59:59
88
}
@@ -11,58 +11,40 @@ export const defaultSponsor: Sponsor = {
1111
link: '',
1212
href: sponsorUrl,
1313
alt: '成为赞助商',
14-
expiryTime: '2099-12-31T23:59:59',
14+
expiryTime: '',
1515
};
1616

1717
export const homeSponsor: Sponsor = { ...defaultSponsor };
1818

1919

2020
export const goldSponsors: Sponsor[] = [
21-
{
22-
link: 'https://dscache.tencent-cloud.cn/upload//rhino-design-800x450-fea2ea55b7b63624628bf9bb22454cb8f91b7d69.png',
23-
href: 'https://curl.qcloud.com/f9VMAii8',
24-
alt: '2核2G云服务器低至 68元/年',
25-
expiryTime: '2025-12-31T23:59:59',
26-
},
2721
{
2822
link: 'https://img14.360buyimg.com/ddimg/jfs/t1/284966/5/22913/37242/68023351Faddd8304/6337ad52ea02ad10.jpg',
2923
href: 'https://share.302.ai/LJojhb',
3024
alt: '302.AI',
3125
expiryTime: '2025-06-18T16:35:00',
32-
},
33-
{ ...defaultSponsor }
26+
}
3427
]
3528

3629
export const generalSponsors: Sponsor[] = [
3730
{
38-
link: 'https://user.by.ltd/templates/lagom2/assets/img/logo/logo_big_inverse.1753622506.png',
31+
link: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQQImbvY5S8IbJ1iL6yHfExtHiAhUtLIoi7AQ&s',
3932
href: 'https://user.by.ltd/aff.php?aff=12215',
4033
alt: 'Bywave',
4134
expiryTime: '2099-12-31T23:59:59',
4235
},
43-
{ ...defaultSponsor },
44-
{ ...defaultSponsor },
45-
{ ...defaultSponsor },
46-
{ ...defaultSponsor },
4736
{ ...defaultSponsor }
4837
]
4938

5039
export const openSponsorLink = (href: string) => {
5140
window.open(href);
5241
};
5342

54-
export function shouldShowSponsor(sponsor: {
55-
href?: string;
56-
link?: string;
57-
expiryTime?: string;
58-
}): boolean {
59-
if (!sponsor.link) return false;
60-
61-
if (sponsor.expiryTime) {
43+
export function shouldShowSponsor(expiryTime?: string): boolean {
44+
if (expiryTime) {
6245
const now = new Date();
63-
const expiryDate = new Date(sponsor.expiryTime);
46+
const expiryDate = new Date(expiryTime);
6447
return now < expiryDate;
6548
}
66-
67-
return true;
49+
return false;
6850
}

0 commit comments

Comments
 (0)