diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..8504271 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/prettierrc", + "singleQuote": true, + "trailingComma": "all", + "tabWidth": 2, + "semi": true, + "printWidth": 100 +} diff --git a/index.html b/index.html index 9220b52..f2c2682 100644 --- a/index.html +++ b/index.html @@ -1,40 +1,39 @@ - + + + + + + + + + + + + + + + %VITE_SITE_NAME% + + + + + + + - - - - - - - - - - - - - - %VITE_SITE_NAME% - - - - - - - - - - -
- - - - - - \ No newline at end of file + + +
+ + + + + diff --git a/package.json b/package.json index 94c133d..dfec510 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "scripts": { "dev": "vite --host", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "format": "prettier --write src/" }, "dependencies": { "aplayer": "^1.10.1", @@ -33,6 +34,7 @@ "unplugin-vue-components": "^0.22.8", "vite": "^4.4.5", "vite-plugin-compression": "^0.5.1", - "vite-plugin-pwa": "^0.14.1" + "vite-plugin-pwa": "^0.14.1", + "prettier": "^3.0.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 451d30b..ed654e9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,6 +46,9 @@ devDependencies: '@vitejs/plugin-vue': specifier: ^4.2.3 version: 4.2.3(vite@4.4.9)(vue@3.3.4) + prettier: + specifier: ^3.0.2 + version: 3.0.2 sass: specifier: ^1.55.0 version: 1.55.0 @@ -3289,6 +3292,12 @@ packages: source-map-js: 1.0.2 dev: true + /prettier@3.0.2: + resolution: {integrity: sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==} + engines: {node: '>=14'} + hasBin: true + dev: true + /pretty-bytes@5.6.0: resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==} engines: {node: '>=6'} diff --git a/src/App.vue b/src/App.vue index 73f94b2..feb0393 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,20 +12,12 @@ -
+
- + @@ -36,19 +28,19 @@ @@ -142,8 +128,7 @@ onBeforeUnmount(() => { height: 100%; transform: scale(1.2); transition: transform 0.3s; - animation: fade-blur-main-in 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94) - forwards; + animation: fade-blur-main-in 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; animation-delay: 0.5s; .container { width: 100%; diff --git a/src/api/index.js b/src/api/index.js index 82c6c7d..ab0d6b4 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,5 +1,5 @@ // import axios from "axios"; -import fetchJsonp from "fetch-jsonp"; +import fetchJsonp from 'fetch-jsonp'; /** * 音乐播放器 @@ -8,19 +8,17 @@ import fetchJsonp from "fetch-jsonp"; // 获取音乐播放列表 export const getPlayerList = async (server, type, id) => { const res = await fetch( - `${import.meta.env.VITE_SONG_API}?server=${server}&type=${type}&id=${id}` + `${import.meta.env.VITE_SONG_API}?server=${server}&type=${type}&id=${id}`, ); const data = await res.json(); - if (data[0].url.startsWith("@")) { - const [handle, jsonpCallback, jsonpCallbackFunction, url] = data[0].url - .split("@") - .slice(1); + if (data[0].url.startsWith('@')) { + const [handle, jsonpCallback, jsonpCallbackFunction, url] = data[0].url.split('@').slice(1); const jsonpData = await fetchJsonp(url).then((res) => res.json()); const domain = ( - jsonpData.req_0.data.sip.find((i) => !i.startsWith("http://ws")) || + jsonpData.req_0.data.sip.find((i) => !i.startsWith('http://ws')) || jsonpData.req_0.data.sip[0] - ).replace("http://", "https://"); + ).replace('http://', 'https://'); return data.map((v, i) => ({ title: v.name || v.title, @@ -46,7 +44,7 @@ export const getPlayerList = async (server, type, id) => { // 获取一言数据 export const getHitokoto = async () => { - const res = await fetch("https://v1.hitokoto.cn"); + const res = await fetch('https://v1.hitokoto.cn'); return await res.json(); }; @@ -63,7 +61,7 @@ export const getAdcode = async (key) => { // 获取高德地理天气信息 export const getWeather = async (key, city) => { const res = await fetch( - `https://restapi.amap.com/v3/weather/weatherInfo?key=${key}&city=${city}` + `https://restapi.amap.com/v3/weather/weatherInfo?key=${key}&city=${city}`, ); return await res.json(); }; @@ -71,6 +69,6 @@ export const getWeather = async (key, city) => { // 获取教书先生天气 API // https://api.oioweb.cn/doc/weather/GetWeather export const getOtherWeather = async () => { - const res = await fetch("https://api.oioweb.cn/api/weather/GetWeather"); + const res = await fetch('https://api.oioweb.cn/api/weather/GetWeather'); return await res.json(); }; diff --git a/src/assets/socialLinks.json b/src/assets/socialLinks.json index 2be8bef..7865332 100644 --- a/src/assets/socialLinks.json +++ b/src/assets/socialLinks.json @@ -1,31 +1,38 @@ -[{ +[ + { "name": "Github", "icon": "/images/icon/github.png", "tip": "去 Github 看看", "url": "https://github.com/imsyy" -}, { + }, + { "name": "BiliBili", "icon": "/images/icon/bilibili.png", "tip": "(゜-゜)つロ 干杯 ~", "url": "https://space.bilibili.com/98544142" -}, { + }, + { "name": "QQ", "icon": "/images/icon/qq.png", "tip": "有什么事吗", "url": "https://res.abeim.cn/api/qq/?qq=1539250352" -}, { + }, + { "name": "Email", "icon": "/images/icon/email.png", "tip": "来封 Email ~", "url": "mailto:one@imsyy.top" -}, { + }, + { "name": "Twitter", "icon": "/images/icon/twitter.png", "tip": "你懂的 ~", "url": "https://twitter.com/iimmsyy" -}, { + }, + { "name": "Telegram", "icon": "/images/icon/telegram.png", "tip": "你懂的 ~", "url": "https://t.me/bottom_user" -}] \ No newline at end of file + } +] diff --git a/src/components/Background.vue b/src/components/Background.vue index 0383274..430ad61 100644 --- a/src/components/Background.vue +++ b/src/components/Background.vue @@ -24,13 +24,13 @@ @@ -92,7 +92,7 @@ watch( height: 142px; margin-left: 12px; transform: translateY(-8px); - font-family: "Pacifico-Regular"; + font-family: 'Pacifico-Regular'; .bg { font-size: 5rem; @@ -136,7 +136,7 @@ watch( p { &:nth-of-type(1) { - font-family: "Pacifico-Regular"; + font-family: 'Pacifico-Regular'; } } } @@ -174,4 +174,4 @@ watch( } } } - \ No newline at end of file + diff --git a/src/components/Music.vue b/src/components/Music.vue index 1b1c0d2..d71e245 100644 --- a/src/components/Music.vue +++ b/src/components/Music.vue @@ -11,49 +11,24 @@ 回到一言
- +
- - + +
- +
-
+
{ onMounted(() => { // 空格键事件 - window.addEventListener("keydown", (e) => { - if (e.code == "Space") { + window.addEventListener('keydown', (e) => { + if (e.code == 'Space') { changePlayState(); } }); @@ -162,7 +127,7 @@ watch( (value) => { store.musicVolume = value; playerRef.value.changeVolume(store.musicVolume); - } + }, ); diff --git a/src/components/Player.vue b/src/components/Player.vue index 6afcfa3..ca25511 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -20,10 +20,10 @@ \ No newline at end of file + diff --git a/src/views/Main/Right.vue b/src/views/Main/Right.vue index 757f7cc..c018ebe 100644 --- a/src/views/Main/Right.vue +++ b/src/views/Main/Right.vue @@ -13,16 +13,15 @@ - \ No newline at end of file + diff --git a/src/views/MoreSet/index.vue b/src/views/MoreSet/index.vue index 3cf6870..d700000 100644 --- a/src/views/MoreSet/index.vue +++ b/src/views/MoreSet/index.vue @@ -1,10 +1,5 @@