Compare commits
2 Commits
1f0f1547f7
...
b0dc56db1c
| Author | SHA1 | Date | |
|---|---|---|---|
| b0dc56db1c | |||
| 36cc0a095a |
@@ -13,7 +13,11 @@ export interface BannerItem {
|
|||||||
translation?: { title?: string; body?: string; imageUrl?: string };
|
translation?: { title?: string; body?: string; imageUrl?: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{ banners: BannerItem[] }>();
|
const props = defineProps<{
|
||||||
|
banners: BannerItem[];
|
||||||
|
/** 未配置跳转链接时的默认路由 */
|
||||||
|
fallbackTo?: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const active = ref(0);
|
const active = ref(0);
|
||||||
@@ -51,14 +55,12 @@ function prev() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onBannerClick(banner: BannerItem) {
|
function onBannerClick(banner: BannerItem) {
|
||||||
if (banner.linkType === 'ROUTE' && banner.linkTarget) {
|
if (banner.id) {
|
||||||
router.push(banner.linkTarget);
|
void router.push(`/announcements/${banner.id}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (banner.linkType === 'URL' && banner.linkTarget) {
|
if (props.fallbackTo) {
|
||||||
let url = banner.linkTarget.trim();
|
void router.push(props.fallbackTo);
|
||||||
if (!/^https?:\/\//i.test(url)) url = `https://${url}`;
|
|
||||||
window.open(url, '_blank');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ const FALLBACK_BANNER_URL = '/uploads/banners/welcome.svg';
|
|||||||
|
|
||||||
export const DEFAULT_BANNER: BannerItem = {
|
export const DEFAULT_BANNER: BannerItem = {
|
||||||
id: 'default',
|
id: 'default',
|
||||||
linkType: 'ROUTE',
|
|
||||||
linkTarget: '/bet',
|
|
||||||
translation: {
|
translation: {
|
||||||
title: '',
|
title: '',
|
||||||
imageUrl: defaultBannerImg,
|
imageUrl: defaultBannerImg,
|
||||||
|
|||||||
@@ -403,13 +403,6 @@ watch(
|
|||||||
<circle cx="12" cy="11" r="1" fill="currentColor" />
|
<circle cx="12" cy="11" r="1" fill="currentColor" />
|
||||||
<circle cx="15" cy="11" r="1" fill="currentColor" />
|
<circle cx="15" cy="11" r="1" fill="currentColor" />
|
||||||
</svg>
|
</svg>
|
||||||
<span
|
|
||||||
v-if="auth.user && inboxEnabled && unreadCount > 0"
|
|
||||||
class="cs-badge"
|
|
||||||
:class="{ 'badge-left': dockSide === 'right', 'badge-right': dockSide === 'left' }"
|
|
||||||
>
|
|
||||||
{{ unreadCount > 99 ? '99+' : unreadCount }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user