-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb514f0
commit b1e1db3
Showing
8 changed files
with
243 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<script lang="ts" setup> | ||
import { ElImageViewer } from 'element-plus' | ||
import { ref } from 'vue' | ||
import { useAds } from '../composables/adsData' | ||
const {data} = useAds() | ||
const showViewer = ref(false) | ||
const previewUrl = ref('') | ||
const handleClick = (ad: any) => { | ||
if (ad.link) { | ||
window.open(ad.link, '_blank') | ||
} else if (ad.image) { | ||
previewUrl.value = ad.image | ||
showViewer.value = true | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="sidebar-ad-container" v-if="data"> | ||
<slot name="sidebar-ad-content"> | ||
<!-- 默认广告内容 --> | ||
<div class="sidebar-ad-list"> | ||
|
||
<div v-for="(ad, index) in data" :key="index" class="sidebar-ad-item"> | ||
<div class="sidebar-ad-link" @click="handleClick(ad)"> | ||
<img :src="ad.image" :alt="ad.title" class="sidebar-ad-img"> | ||
</div> | ||
</div> | ||
</div> | ||
</slot> | ||
<el-image-viewer v-if="showViewer" :url-list="[previewUrl]" @close="showViewer = false" hide-on-click-modal | ||
teleported /> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.sidebar-ad-container { | ||
margin: 6px 0; | ||
padding: 6px; | ||
border-radius: 6px; | ||
background-color: var(--vp-c-bg-soft); | ||
box-sizing: border-box; | ||
width: calc(100% - 6px); | ||
margin-left: 3px; | ||
margin-right: 3px; | ||
} | ||
.sidebar-ad-list { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 6px; | ||
} | ||
.sidebar-ad-item { | ||
width: 100%; | ||
} | ||
.sidebar-ad-link { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
text-decoration: none; | ||
color: var(--vp-c-text-1); | ||
cursor: pointer; | ||
} | ||
.sidebar-ad-img { | ||
width: 100%; | ||
height: auto; | ||
max-height: 120px; | ||
border-radius: 8px; | ||
object-fit: cover; | ||
transition: transform 0.3s ease; | ||
} | ||
.sidebar-ad-img:hover { | ||
transform: translateY(-2px); | ||
} | ||
.sidebar-ad-title { | ||
margin-top: 4px; | ||
font-size: 14px; | ||
text-align: center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ref, onMounted } from 'vue' | ||
|
||
export type AdData = { | ||
image: string | ||
link?: string | ||
} | ||
|
||
const data = ref<AdData[]>([{ | ||
image: '/tiaojiads.png', | ||
link: '/ads/tiaojibao.html' | ||
}]) | ||
|
||
export function useAds() { | ||
onMounted(async () => { | ||
try { | ||
const result = await fetch('https://wot-sponsors.pages.dev/ads.json') | ||
const json = await result.json() | ||
data.value = json && json.ads ? json.ads : [] | ||
} catch (error) { | ||
|
||
} | ||
}) | ||
|
||
return { | ||
data | ||
} | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
footer: false | ||
--- | ||
# 调剂宝 | ||
<div class="qrcode-container"> | ||
<div class="qrcode-item"> | ||
<h3>小程序二维码</h3> | ||
<img src="/tiaojibao.png" alt="调剂宝小程序二维码" class="qrcode-image"> | ||
</div> | ||
|
||
<div class="qrcode-item"> | ||
<h3>福利码</h3> | ||
<div class="welfare-code">uh3p</div> | ||
<div class="welfare-desc">注册VIP会员时填写此福利码,立享20元优惠</div> | ||
</div> | ||
</div> | ||
|
||
::: tip 2025考研调剂助手 | ||
调剂宝整合320万+拟录取数据、90万+调剂案例,提供实时调剂提醒和智能方案推荐,助你把握每一个调剂机会! | ||
|
||
[👉 了解详情](https://mp.weixin.qq.com/s/QtPNcoj7Pu_RztBvzTyWLQ) | ||
::: | ||
|
||
::: warning 注意 | ||
调剂系统开放时间以教育部官方通知为准,请提前做好准备 | ||
::: | ||
|
||
<style> | ||
.qrcode-container { | ||
display: flex; | ||
gap: 2rem; | ||
justify-content: center; | ||
margin: 1rem 0 2rem; | ||
flex-wrap: wrap; | ||
} | ||
|
||
.qrcode-item { | ||
text-align: center; | ||
} | ||
|
||
.qrcode-image { | ||
width: 200px; | ||
height: 200px; | ||
border-radius: 8px; | ||
margin: 1rem 0; | ||
} | ||
|
||
.welfare-code { | ||
font-size: 2rem; | ||
font-weight: bold; | ||
color: var(--vp-c-brand); | ||
margin: 1rem 0; | ||
} | ||
|
||
.welfare-desc { | ||
color: var(--vp-c-text-2); | ||
font-size: 0.9rem; | ||
} | ||
</style> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters