feat: 支持配置音乐播放器开关 #209

This commit is contained in:
imsyy 2023-11-03 09:23:06 +08:00
parent 6c58920f77
commit be94711dc8
5 changed files with 14 additions and 9 deletions

4
.env
View File

@ -47,5 +47,5 @@ VITE_SONG_API = "https://api-meting.imsyy.top/api"
VITE_SONG_SERVER = "netease" VITE_SONG_SERVER = "netease"
# 播放类型 ( song-歌曲, playlist-播放列表, album-专辑, search-搜索, artist-艺术家 ) # 播放类型 ( song-歌曲, playlist-播放列表, album-专辑, search-搜索, artist-艺术家 )
VITE_SONG_TYPE = "playlist" VITE_SONG_TYPE = "playlist"
# 播放 ID # 播放 ID ( 若无需播放器,请设为空即可 )
VITE_SONG_ID = "7452421335" VITE_SONG_ID = ""

View File

@ -207,7 +207,7 @@ if (type == 0) {
* [高德开放平台](https://lbs.amap.com/) * [高德开放平台](https://lbs.amap.com/)
* [Hitokoto 一言](https://hitokoto.cn/) * [Hitokoto 一言](https://hitokoto.cn/)
* [MetingAPI By 武恩赐](https://api.wuenci.com/meting/api/) * [MetingAPI By 武恩赐](https://api.wuenci.com/meting/api/)
*
## Star History ## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=imsyy/home&type=Date)](https://star-history.com/#imsyy/home&Date) [![Star History Chart](https://api.star-history.com/svg?repos=imsyy/home&type=Date)](https://star-history.com/#imsyy/home&Date)

View File

@ -4,7 +4,7 @@
"github": "https://github.com/imsyy/home", "github": "https://github.com/imsyy/home",
"home": "https://imsyy.top", "home": "https://imsyy.top",
"private": true, "private": true,
"version": "4.1.2", "version": "4.1.3",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --host", "dev": "vite --host",

View File

@ -18,10 +18,12 @@
</div> </div>
</Transition> </Transition>
<!-- 一言内容 --> <!-- 一言内容 -->
<div class="content" @click="updateHitokoto"> <Transition name="el-fade-in-linear" mode="out-in">
<span class="text">{{ hitokotoData.text }}</span> <div :key="hitokotoData.text" class="content" @click="updateHitokoto">
<span class="from">-&nbsp;{{ hitokotoData.from }}&nbsp;</span> <span class="text">{{ hitokotoData.text }}</span>
</div> <span class="from">-&nbsp;{{ hitokotoData.from }}&nbsp;</span>
</div>
</Transition>
</div> </div>
</template> </template>

View File

@ -5,7 +5,7 @@
<el-col :span="12"> <el-col :span="12">
<div class="left"> <div class="left">
<Hitokoto /> <Hitokoto />
<Music /> <Music v-if="playerHasId" />
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -41,6 +41,9 @@ const store = mainStore();
const currentTime = ref({}); const currentTime = ref({});
const timeInterval = ref(null); const timeInterval = ref(null);
// id
const playerHasId = import.meta.env.VITE_SONG_ID;
// //
const updateTimeData = () => { const updateTimeData = () => {
currentTime.value = getCurrentTime(); currentTime.value = getCurrentTime();