中秋节快乐

This commit is contained in:
Alone
2024-09-14 17:00:49 +08:00
parent 610dee88cd
commit dff1b038b1
4286 changed files with 807503 additions and 6 deletions
+9
View File
@@ -0,0 +1,9 @@
<div class="footerBox">
<div class="box">
<p>{$config.footer_dec|raw}</p>
<p>
{$config.footer_copyright|raw}
<a href="/sitemap.xml" target="_blank">网站地图</a>
</p>
</div>
</div>
+175
View File
@@ -0,0 +1,175 @@
<script src="/static/index/js/vue.global.min.js"></script>
<script src="/static/index/js/index.full.min.js"></script>
<script src="/static/index/js/axios.min.js"></script>
<script>
const { createApp, ref, onMounted, onUnmounted } = Vue;
const { ElButton, ElMessage } = ElementPlus;
const app = createApp({
setup() {
// 定义响应式数据
const elementOpacity = ref(0);
const scrollThreshold = ref(150); // 动态设置的滚动阈值
const keyword = ref('{$keyword??''}');
const qcodeVisible = ref(false);
const layerVisible = ref(false);
const content = ref('');
const load = ref(false)
const drawer = ref(false)
const rankList = ref([]);
const rankDj = ref([]);
const is_m = ref(0);
const newList = ref([]);
// 公共消息方法
const showMessage = (message, type = 'info') => {
ElMessage({
message,
type,
plain: true,
});
};
// 滚动监听方法
const handleScroll = () => {
const scrollTop = window.scrollY || document.documentElement.scrollTop;
elementOpacity.value = scrollTop >= scrollThreshold.value
? Math.min((scrollTop - scrollThreshold.value) / 100, 1)
: Math.max(1 - (scrollThreshold.value - scrollTop) / 100, 0);
const boxElement = document.querySelector('.listBox .screen .fixed .box');
if (boxElement.style.display === 'block' && is_m.value) {
boxElement.style.display = 'none'; // 隐藏元素
}
};
// 搜索按钮点击事件
const searchBtn = () => {
if (!keyword.value) {
return showMessage('请输入你要搜索的内容~', 'error');
}
const currentUrl = window.location.href;
const targetUrl = `/s/${keyword.value}.html`;
if (currentUrl.includes('/s/') || currentUrl.includes('/d/')) {
window.location.href = targetUrl;
} else {
window.open(targetUrl, '_blank');
}
};
// 保存按钮点击事件
const saveBtn = async () => {
if (!content.value) {
return showMessage('请输入你想看的资源信息~', 'error');
}
if (load.value) return;
load.value = true;
try {
const response = await axios.post('/api/tool/feedback', { content: content.value });
showMessage(response.data.message, response.data.code === 200 ? 'success' : 'error');
if (response.data.code === 200) {
layerVisible.value = false;
content.value = '';
}
} finally {
load.value = false;
}
};
const setnum = (num) => (num / 10000).toFixed(2) + 'W';
const goLink = (event,id) => {
event.preventDefault();
window.location.href = `/d/${id}.html`;
}
const changeBtn = (e) => {
const category_id = `{$category_id}`;
if(category_id){
window.location.href = `/s/${keyword.value}-${e}-${category_id}.html`;
}else{
window.location.href = `/s/${keyword.value}-${e}.html`;
}
};
const copyText = async(event,title,url,code) => {
event.preventDefault();
var text = '标题:'+title+'\n链接:'+url
if (code) text += `\n提取码:${code}`;
text += `\n由【${'{$config.app_name}'}${window.location.hostname}】供网盘分享链接`;
try {
// 优先使用 navigator.clipboard
await navigator.clipboard.writeText(text);
showMessage('复制成功', 'success');
} catch (err) {
// 如果 navigator.clipboard 失败,使用 document.execCommand 作为回退
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed'; // 避免滚动
textArea.style.opacity = 0;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
const successful = document.execCommand('copy');
if (successful) {
showMessage('复制成功', 'success');
} else {
throw new Error('复制失败');
}
} catch (err) {
showMessage('复制失败,请手动复制', 'error');
}
document.body.removeChild(textArea);
}
}
const selectBtn = () => {
const boxElement = document.querySelector('.listBox .screen .fixed .box');
// 切换 display 属性,显示或隐藏
if (boxElement.style.display === 'none' || boxElement.style.display === '') {
boxElement.style.display = 'block'; // 显示
} else {
boxElement.style.display = 'none'; // 隐藏
}
}
const handleDeviceType = () => {
const isMobile = window.matchMedia('(max-width: 768px)').matches;
if (isMobile) {
// 手机端的逻辑
is_m.value = 1
} else {
// 电脑端的逻辑
is_m.value = 0
}
};
// 组件挂载时添加滚动监听
onMounted(() => {
handleDeviceType();
window.addEventListener('scroll', handleScroll);
window.addEventListener('resize', handleDeviceType);
});
// 组件卸载时移除滚动监听
onUnmounted(() => {
window.removeEventListener('scroll', handleScroll);
window.removeEventListener('resize', handleDeviceType);
});
// 返回数据和方法
return { elementOpacity, scrollThreshold, keyword, searchBtn, rankList,newList, setnum, qcodeVisible, layerVisible, content, saveBtn, rankDj,goLink,changeBtn,copyText,drawer,selectBtn,is_m };
}
})
.use(ElementPlus) // 使用 Element Plus
.mount('#app'); // 挂载 Vue 实例
</script>
+71
View File
@@ -0,0 +1,71 @@
<div class="headerBox">
<div class="bg" {notempty name="fixed"}:style="{ opacity: elementOpacity }"{/notempty}></div>
<div class="box">
<a href="/" class="logoBox" {notempty name="fixed"}:style="{ opacity: elementOpacity }"{/notempty}>
{notempty name="config.logo"}
<img class="logo" src="{$config.logo}"></img>
{/notempty}
{if condition="$config.app_name && $config.app_name_hide!=1"}
<div class="title">{$config.app_name}</div>
{/if}
</a>
<div class="search" {notempty name="fixed"}:style="{ opacity: elementOpacity }"{/notempty}>
<input type="text" v-model="keyword" placeholder="输入关键字进行搜索" @keyup.enter="searchBtn" confirm-type="search" @confirm="searchBtn">
<div class="btn" @click="searchBtn">
<i class="iconfont icon-sousuo"></i>
</div>
</div>
<div class="navs">
{notempty name="config.qcode"}
<div class="item" @click="qcodeVisible = true">加入群聊</div>
{/notempty}
{empty name="config.app_demand"}
<div class="item" @click="layerVisible = true">提交需求</div>
{/empty}
<div class="btns" v-html="`{$config.app_links}`"></div>
<div class="iconfont icon-caidan" @click="drawer = true"></div>
</div>
</div>
</div>
<div class="headerKox"></div>
<el-dialog
v-model="qcodeVisible"
width="300"
>
<img src="{$config.qcode}" style="width: 100%" />
</el-dialog>
<el-dialog
v-model="layerVisible"
width="300"
>
<div class="layerBox">
<div class="vname">提交需求</div>
<el-input
v-model="content"
placeholder="请输入你想看的资源信息~"
type="textarea"
resize='none'
></el-input>
<div class="vbtn" @click="saveBtn">提交</div>
</div>
</el-dialog>
<el-dialog
v-model="drawer"
width="300"
center
>
<div class="drawer">
{notempty name="config.qcode"}
<div class="item" @click="qcodeVisible = true">加入群聊</div>
{/notempty}
{empty name="config.app_demand"}
<div class="item" @click="layerVisible = true">提交需求</div>
{/empty}
<div class="btns" v-html="`{$config.app_links}`"></div>
</div>
</el-dialog>
+27
View File
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
{notempty name="config.app_icon"}
<link rel="icon" href="{$config.app_icon}" />
{/notempty}
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width,user-scalable=no,maximum-scale=1.0">
<title>{if condition="isset($detail) && $detail.title"}{$detail.title} - {$config.app_name}{else /}{$config.app_name}{notempty name="$config.app_title"} - {$config.app_title}{/notempty}{/if}</title>
<meta name="keywords" content="{notempty name="detail"}{$detail.title},{/notempty}{$config.app_keywords}" />
<meta name="description" content="{notempty name="detail"}{$detail.title} - {/notempty}{$config.app_description}" />
<link rel="stylesheet" href="/static/index/css/index.min.css">
<link rel="stylesheet" href="/static/index/css/app.css">
<link rel="stylesheet" href="/static/index/css/m.css">
{$config.seo_statistics|raw}
<style>
:root {
--theme-color: {$config.home_color|default='#3e3e3e'};
--theme-theme: {$config.home_theme|default='#133ab3'};
--theme-background: {$config.home_background|default='#fafafa'};
--theme-other_background: {$config.other_background|default='#ffffff'};
}
{$config.home_css}
</style>