Skip to content

Commit

Permalink
Merge pull request #145 from imsyy/dev
Browse files Browse the repository at this point in the history
feat: 网站链接多页支持 #129 #20 #47
  • Loading branch information
imsyy authored Jun 12, 2023
2 parents e5947eb + 177b539 commit 8bbf410
Show file tree
Hide file tree
Showing 30 changed files with 416 additions and 533 deletions.
8 changes: 4 additions & 4 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ VITE_DESC_HELLO_OTHER = "Oops !"
VITE_DESC_TEXT_OTHER = "哎呀,这都被你发现了( 再点击一次可关闭 )"

# 社交链接
## 请在 public 目录下的 socialLinks.json 文件中配置
## 请在 src/assets/socialLinks.json 文件中配置

# 网站链接
## 请在 src/components/Links/index.vue 文件中配置
## 请在 src/assets/siteLinks.json 文件中配置

# 天气 Key
## 请前往高德开放平台注册 Web服务 Key(免费的)
## 请前往高德开放平台注册 **Web服务** Key(免费的)
## 请各位大佬行行好,别再让我超量了
VITE_WEATHER_KEY = "57eaea5833ff1616cfd1ff2c4cf9b58a"
VITE_WEATHER_KEY = "6c13af6fc30868bee488faf2cc652ab4"

# 建站日期
## 请按照 YYYY-MM-DD 格式填写
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
- [x] 音乐播放器
- [x] 移动端适配

* [ ] 播放器取消使用 Aplayer

### 部署

* **安装** [node.js](https://nodejs.org/zh-cn/) **环境**
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"fetch-jsonp": "^1.2.3",
"pinia": "^2.0.23",
"pinia-plugin-persistedstate": "^3.0.0",
"swiper": "^9.3.2",
"terser": "^5.16.1",
"vue": "^3.2.37",
"vue3-aplayer": "^1.7.3"
Expand Down
12 changes: 6 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ const getWidth = () => {
onMounted(() => {
// 自定义鼠标
cursorInit();
// 欢迎提示
helloInit();
// 默哀模式
checkDays();
// 加载完成事件
window.addEventListener("load", () => {
console.log("加载完成");
// 去除加载标记
document.getElementsByTagName("body")[0].className = "";
// 给加载动画添加结束标记
let loadingBox = document.getElementById("loading-box");
const loadingBox = document.getElementById("loading-box");
loadingBox.classList.add("loaded");
// 欢迎提示
helloInit();
// 默哀模式
checkDays();
});
// 屏蔽右键
Expand Down Expand Up @@ -207,4 +207,4 @@ main {
filter: blur(10px);
}
}
</style>
</style>
10 changes: 0 additions & 10 deletions src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,3 @@ export const getWeather = async (key, city) => {
);
return await res.json();
};

/**
* 获取配置
*/

// 获取社交链接
export const getSocialLinks = async () => {
const res = await fetch("/socialLinks.json");
return await res.json();
};
41 changes: 41 additions & 0 deletions src/assets/siteLinks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[
[
{
"icon": "Blog",
"name": "博客",
"link": "https://blog.imsyy.top/"
},
{
"icon": "Cloud",
"name": "网盘",
"link": "https://pan.imsyy.top/"
},
{
"icon": "CompactDisc",
"name": "音乐",
"link": "https://music.imsyy.top/"
},
{
"icon": "Compass",
"name": "起始页",
"link": "https://nav.imsyy.top/"
},
{
"icon": "Book",
"name": "网址集",
"link": "https://web.imsyy.top/"
},
{
"icon": "Fire",
"name": "今日热榜",
"link": "https://hot.imsyy.top/"
}
],
[
{
"icon": "LaptopCode",
"name": "站点监测",
"link": "https://status.imsyy.top/"
}
]
]
File renamed without changes.
1 change: 0 additions & 1 deletion src/assets/vue.svg

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/Background/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { SuccessPicture } from "@icon-park/vue-next";
import { mainStore } from "@/store";
const store = mainStore();
let bgUrl = ref(null); // 壁纸链接
const bgUrl = ref(null); // 壁纸链接
const changeBg = (type) => {
if (type == 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { mainStore } from "@/store";
import config from "@/../package.json";
const store = mainStore();
let fullYear = new Date().getFullYear();
const fullYear = new Date().getFullYear();
</script>

<style lang="scss" scoped>
Expand Down
9 changes: 3 additions & 6 deletions src/components/Hitokoto/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@click.stop
>
<!-- 打开音乐面板 -->
<Transition name="fade">
<Transition name="el-fade-in-linear">
<div
class="open-music"
v-show="openMusicShow && store.musicIsOk"
Expand All @@ -34,17 +34,14 @@ import { mainStore } from "@/store";
const store = mainStore();
// 开启音乐面板按钮显隐
let openMusicShow = ref(false);
const openMusicShow = ref(false);
// 一言数据
let hitokotoData = reactive({
const hitokotoData = reactive({
text: "这里应该显示一句话",
from: "無名",
});
// 打开音乐面板
const openMusic = () => {};
// 获取一言数据
const getHitokotoData = () => {
getHitokoto()
Expand Down
120 changes: 96 additions & 24 deletions src/components/Links/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,46 @@
</Icon>
<span class="title">网站列表</span>
</div>
<el-row class="link-all" :gutter="20">
<el-col
:span="8"
v-for="(item, index) in linksData"
:key="item"
@click="jumpLink(item.link)"
>
<div
class="item cards"
:style="index < 3 ? 'margin-bottom: 20px' : null"
>
<Icon size="26">
<component :is="item.icon" />
</Icon>
<span class="name">{{ item.name }}</span>
</div>
</el-col>
</el-row>
<!-- 网站列表 -->
<Swiper
v-if="siteLinks[0]"
:modules="[Pagination, Mousewheel]"
:slides-per-view="1"
:space-between="40"
:pagination="{
el: '.swiper-pagination',
clickable: true,
bulletElement: 'div',
}"
:mousewheel="true"
>
<SwiperSlide v-for="site in siteLinks" :key="site">
<el-row class="link-all" :gutter="20">
<el-col
:span="8"
v-for="(item, index) in site"
:key="item"
@click="jumpLink(item)"
>
<div
class="item cards"
:style="index < 3 ? 'margin-bottom: 20px' : null"
>
<Icon size="26">
<component :is="siteIcon[item.icon]" />
</Icon>
<span class="name">{{ item.name }}</span>
</div>
</el-col>
</el-row>
</SwiperSlide>
<div class="swiper-pagination" />
</Swiper>
</div>
</template>

<script setup>
import { ref } from "vue";
import { onMounted } from "vue";
import { Icon } from "@vicons/utils";
import {
Link,
Expand All @@ -38,11 +55,30 @@ import {
Compass,
Book,
Fire,
LaptopCode,
} from "@vicons/fa";
import { mainStore } from "@/store";
import { Swiper, SwiperSlide } from "swiper/vue";
import { Pagination, Mousewheel } from "swiper";
import siteLinks from "@/assets/siteLinks.json";
import "swiper/scss";
import "swiper/scss/pagination";
const store = mainStore();
// 网站链接图标
const siteIcon = {
Blog,
Cloud,
CompactDisc,
Compass,
Book,
Fire,
LaptopCode,
};
// 网站链接数据
// 建议不要超出6个,若需要超出请自行调整样式
let linksData = [
const linksData = [
{
icon: Blog,
name: "博客",
Expand Down Expand Up @@ -76,9 +112,17 @@ let linksData = [
];
// 链接跳转
const jumpLink = (url) => {
window.open(url, "_blank");
const jumpLink = (data) => {
if (data.name === "音乐" && store.musicClick) {
if (typeof $openList === "function") $openList();
} else {
window.open(data.link, "_blank");
}
};
onMounted(() => {
console.log(siteLinks);
});
</script>

<style lang="scss" scoped>
Expand All @@ -96,6 +140,29 @@ const jumpLink = (url) => {
text-shadow: 0 0 5px #00000050;
}
}
.swiper {
left: -10px;
width: calc(100% + 20px);
padding: 5px 10px 0;
z-index: 0;
.swiper-slide {
height: 100%;
}
.swiper-pagination {
position: static;
margin-top: 4px;
:deep(.swiper-pagination-bullet) {
background-color: #fff;
width: 18px;
height: 4px;
border-radius: 4px;
transition: opacity 0.3s;
&:hover {
opacity: 1;
}
}
}
}
.link-all {
.item {
height: 100px;
Expand All @@ -112,6 +179,11 @@ const jumpLink = (url) => {
background: rgb(0 0 0 / 40%);
transition: 0.3s;
}
&:active {
transform: scale(1);
}
.name {
font-size: 1.1rem;
margin-left: 8px;
Expand All @@ -135,4 +207,4 @@ const jumpLink = (url) => {
}
}
}
</style>
</style>
6 changes: 3 additions & 3 deletions src/components/Message/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ import { mainStore } from "@/store";
const store = mainStore();
// 主页站点logo
let siteLogo = import.meta.env.VITE_SITE_LOGO;
const siteLogo = import.meta.env.VITE_SITE_LOGO;
// 站点链接
let siteUrl = import.meta.env.VITE_SITE_URL.split(".");
const siteUrl = import.meta.env.VITE_SITE_URL.split(".");
// 简介区域文字
let descriptionText = reactive({
const descriptionText = reactive({
hello: import.meta.env.VITE_DESC_HELLO,
text: import.meta.env.VITE_DESC_TEXT,
});
Expand Down
Loading

1 comment on commit 8bbf410

@vercel
Copy link

@vercel vercel bot commented on 8bbf410 Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.