From acc8f54ef951df49d8bef389f5a71f298afe4ae1 Mon Sep 17 00:00:00 2001 From: imsyy Date: Fri, 21 Apr 2023 16:37:08 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=8F=98=E9=87=8F=20&=20feat:=20=E6=96=B0=E5=A2=9E=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E8=AE=BE=E7=BD=AE=E9=A1=B9=20#124?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- src/App.vue | 2 +- src/components/Background/index.vue | 2 +- src/components/Footer/index.vue | 2 +- src/components/Hitokoto/index.vue | 7 +- src/components/Links/index.vue | 22 +++-- src/components/Message/index.vue | 6 +- src/components/Music/index.vue | 24 +++-- src/components/Player/index.vue | 9 +- src/components/Set/index.vue | 17 +++- src/components/SocialLinks/index.vue | 4 +- src/components/TimeCapsule/index.vue | 12 +-- src/components/Weather/index.vue | 4 +- src/store/index.js | 136 +++++++++++++-------------- src/views/Box/index.vue | 2 +- src/views/Func/index.vue | 10 +- src/views/Main/Right.vue | 3 +- src/views/MoreSet/index.vue | 6 +- 18 files changed, 145 insertions(+), 125 deletions(-) diff --git a/.env b/.env index a1241ca..d568bf7 100644 --- a/.env +++ b/.env @@ -24,7 +24,7 @@ VITE_DESC_TEXT_OTHER = "哎呀,这都被你发现了( 再点击一次可关 # 天气 Key ## 请前往高德开放平台注册 Web服务 Key(免费的) ## 请各位大佬行行好,别再让我超量了 -VITE_WEATHER_KEY = "57eaea5833ff1616cfd1ff2c4cf9b58a" +VITE_WEATHER_KEY = "6c13af6fc30868bee488faf2cc652ab4" # 建站日期 ## 请按照 YYYY-MM-DD 格式填写 diff --git a/src/App.vue b/src/App.vue index 329d99b..d037d76 100644 --- a/src/App.vue +++ b/src/App.vue @@ -65,7 +65,7 @@ onMounted(() => { // 去除加载标记 document.getElementsByTagName("body")[0].className = ""; // 给加载动画添加结束标记 - let loadingBox = document.getElementById("loading-box"); + const loadingBox = document.getElementById("loading-box"); loadingBox.classList.add("loaded"); }); diff --git a/src/components/Background/index.vue b/src/components/Background/index.vue index cd31874..6bd044a 100644 --- a/src/components/Background/index.vue +++ b/src/components/Background/index.vue @@ -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) { diff --git a/src/components/Footer/index.vue b/src/components/Footer/index.vue index d594d25..c3b10bc 100644 --- a/src/components/Footer/index.vue +++ b/src/components/Footer/index.vue @@ -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(); \ No newline at end of file + diff --git a/src/components/Message/index.vue b/src/components/Message/index.vue index ee2f847..8f1f9a1 100644 --- a/src/components/Message/index.vue +++ b/src/components/Message/index.vue @@ -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, }); diff --git a/src/components/Music/index.vue b/src/components/Music/index.vue index 9c1b185..1debdd4 100644 --- a/src/components/Music/index.vue +++ b/src/components/Music/index.vue @@ -7,7 +7,7 @@ v-show="store.musicOpenState" >
- 音乐列表 + 音乐列表 回到一言
@@ -103,7 +103,7 @@ diff --git a/src/components/Weather/index.vue b/src/components/Weather/index.vue index 9e1e244..c895c76 100644 --- a/src/components/Weather/index.vue +++ b/src/components/Weather/index.vue @@ -20,10 +20,10 @@ import { getAdcode, getWeather } from "@/api"; import { Error } from "@icon-park/vue-next"; // 高德开发者 Key -let mainKey = import.meta.env.VITE_WEATHER_KEY; +const mainKey = import.meta.env.VITE_WEATHER_KEY; // 天气数据 -let weatherData = reactive({ +const weatherData = reactive({ adCode: { city: null, // 城市 adcode: null, // 城市编码 diff --git a/src/store/index.js b/src/store/index.js index 2ea7a8a..52dae51 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,75 +1,73 @@ -import { - defineStore -} from "pinia"; +import { defineStore } from "pinia"; export const mainStore = defineStore("main", { - state: () => { - return { - innerWidth: null, // 当前窗口宽度 - coverType: "0", // 壁纸种类 - siteStartShow: true, // 建站日期显示 - musicIsOk: false, // 音乐是否加载完成 - musicVolume: 0, // 音乐音量; - musicOpenState: false, // 音乐面板开启状态 - backgroundShow: false, // 壁纸展示状态 - boxOpenState: false, // 盒子开启状态 - mobileOpenState: false, // 移动端开启状态 - mobileFuncState: false, // 移动端功能区开启状态 - setOpenState: false, // 设置页面开启状态 - playerState: false, // 当前播放状态 - playerTitle: null, // 当前播放歌曲名 - playerArtist: null, // 当前播放歌手名 - playerLrc: "歌词加载中", // 当前播放歌词 - } + state: () => { + return { + innerWidth: null, // 当前窗口宽度 + coverType: "0", // 壁纸种类 + siteStartShow: true, // 建站日期显示 + musicIsOk: false, // 音乐是否加载完成 + musicVolume: 0, // 音乐音量; + musicOpenState: false, // 音乐面板开启状态 + backgroundShow: false, // 壁纸展示状态 + boxOpenState: false, // 盒子开启状态 + mobileOpenState: false, // 移动端开启状态 + mobileFuncState: false, // 移动端功能区开启状态 + setOpenState: false, // 设置页面开启状态 + playerState: false, // 当前播放状态 + playerTitle: null, // 当前播放歌曲名 + playerArtist: null, // 当前播放歌手名 + playerLrc: "歌词加载中", // 当前播放歌词 + musicClick: false, // 音乐链接是否跳转 + }; + }, + getters: { + // 获取歌词 + getPlayerLrc(state) { + return state.playerLrc; }, - getters: { - // 获取歌词 - getPlayerLrc(state) { - return state.playerLrc; - }, - // 获取歌曲信息 - getPlayerData(state) { - return { - name: state.playerTitle, - artist: state.playerArtist, - } - }, - // 获取页面宽度 - getInnerWidth(state) { - return state.innerWidth; - } + // 获取歌曲信息 + getPlayerData(state) { + return { + name: state.playerTitle, + artist: state.playerArtist, + }; }, - actions: { - // 更改当前页面宽度 - setInnerWidth(value) { - this.innerWidth = value; - if (value >= 720) { - this.mobileOpenState = false; - this.mobileFuncState = false; - } - }, - // 更改播放状态 - setPlayerState(value) { - if (value) { - this.playerState = false; - } else { - this.playerState = true; - } - - }, - // 更改歌词 - setPlayerLrc(value) { - this.playerLrc = value; - }, - // 更改歌曲数据 - setPlayerData(title, artist) { - this.playerTitle = title; - this.playerArtist = artist; - } + // 获取页面宽度 + getInnerWidth(state) { + return state.innerWidth; }, - persist: { - key: 'data', - storage: window.localStorage, - paths: ['coverType', 'musicVolume', 'siteStartShow'], + }, + actions: { + // 更改当前页面宽度 + setInnerWidth(value) { + this.innerWidth = value; + if (value >= 720) { + this.mobileOpenState = false; + this.mobileFuncState = false; + } }, -}) \ No newline at end of file + // 更改播放状态 + setPlayerState(value) { + if (value) { + this.playerState = false; + } else { + this.playerState = true; + } + }, + // 更改歌词 + setPlayerLrc(value) { + this.playerLrc = value; + }, + // 更改歌曲数据 + setPlayerData(title, artist) { + this.playerTitle = title; + this.playerArtist = artist; + }, + }, + persist: { + key: "data", + storage: window.localStorage, + paths: ["coverType", "musicVolume", "siteStartShow", "musicClick"], + }, +}); diff --git a/src/views/Box/index.vue b/src/views/Box/index.vue index 5f5f00a..43c73ce 100644 --- a/src/views/Box/index.vue +++ b/src/views/Box/index.vue @@ -37,7 +37,7 @@ import TimeCapsule from "@/components/TimeCapsule/index.vue"; import { mainStore } from "@/store"; const store = mainStore(); -let closeShow = ref(false); +const closeShow = ref(false); \ No newline at end of file + diff --git a/src/views/Main/Right.vue b/src/views/Main/Right.vue index 347d6b4..d10857e 100644 --- a/src/views/Main/Right.vue +++ b/src/views/Main/Right.vue @@ -13,14 +13,13 @@ diff --git a/src/views/MoreSet/index.vue b/src/views/MoreSet/index.vue index 0f14dcf..7f6043f 100644 --- a/src/views/MoreSet/index.vue +++ b/src/views/MoreSet/index.vue @@ -79,13 +79,13 @@ import Set from "@/components/Set/index.vue"; import config from "@/../package.json"; const store = mainStore(); -let closeShow = ref(false); +const closeShow = ref(false); // 站点链接 -let siteUrl = import.meta.env.VITE_SITE_URL.split("."); +const siteUrl = import.meta.env.VITE_SITE_URL.split("."); // 更新日志 -let upData = reactive({ +const upData = reactive({ new: [ "采用 Vue 进行重构", "音乐歌单支持快速自定义",