Skip to content

Commit 7721251

Browse files
committed
✨ feat: 优化播放流程
2 parents d527b07 + 320047c commit 7721251

35 files changed

Lines changed: 93 additions & 52 deletions

src/components/Card/SongCard.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ import { openJumpArtist } from "@/utils/modal";
158158
import { toLikeSong } from "@/utils/auth";
159159
import { isObject } from "lodash-es";
160160
import { formatTimestamp, msToTime } from "@/utils/time";
161-
import player from "@/utils/player";
161+
import { usePlayer } from "@/utils/player";
162162
import blob from "@/utils/blob";
163163
import { isElectron } from "@/utils/env";
164164
@@ -174,6 +174,7 @@ const props = defineProps<{
174174
}>();
175175
176176
const router = useRouter();
177+
const player = usePlayer();
177178
const dataStore = useDataStore();
178179
const musicStore = useMusicStore();
179180
const statusStore = useStatusStore();

src/components/Layout/Menu.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ import { openCreatePlaylist } from "@/utils/modal";
3434
import { debounce } from "lodash-es";
3535
import { isLogin } from "@/utils/auth";
3636
import { isElectron } from "@/utils/env";
37-
import player from "@/utils/player";
37+
import { usePlayer } from "@/utils/player";
3838
3939
const router = useRouter();
40+
const player = usePlayer();
4041
const dataStore = useDataStore();
4142
const musicStore = useMusicStore();
4243
const statusStore = useStatusStore();

src/components/List/CommentList.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ const likeComment = debounce(async (data: CommentType) => {
218218
color: var(--primary-hex);
219219
}
220220
}
221+
.text {
222+
white-space: pre-wrap;
223+
}
221224
}
222225
.reply {
223226
width: 100%;
@@ -226,6 +229,9 @@ const likeComment = debounce(async (data: CommentType) => {
226229
font-size: 13px;
227230
margin-top: 6px;
228231
background-color: rgba(var(--primary), 0.12);
232+
.text {
233+
white-space: pre-wrap;
234+
}
229235
}
230236
.meta {
231237
padding-top: 12px;

src/components/List/CoverList.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ import { formatSongsList } from "@/utils/format";
121121
import { songDetail } from "@/api/song";
122122
import { playlistAllSongs } from "@/api/playlist";
123123
import { radioAllProgram } from "@/api/radio";
124+
import { usePlayer } from "@/utils/player";
124125
import CoverMenu from "@/components/Menu/CoverMenu.vue";
125-
import player from "@/utils/player";
126126
import { formatTimestamp } from "@/utils/time";
127127
128128
interface Props {
@@ -145,6 +145,7 @@ const emit = defineEmits<{
145145
}>();
146146
147147
const router = useRouter();
148+
const player = usePlayer();
148149
const musicStore = useMusicStore();
149150
const statusStore = useStatusStore();
150151

src/components/List/SongList.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ import { VirtList } from "vue-virt-list";
129129
import { entries, isEmpty } from "lodash-es";
130130
import { sortOptions } from "@/utils/meta";
131131
import { renderIcon } from "@/utils/helper";
132+
import { usePlayer } from "@/utils/player";
132133
import SongListMenu from "@/components/Menu/SongListMenu.vue";
133-
import player from "@/utils/player";
134134
135135
const props = withDefaults(
136136
defineProps<{
@@ -177,6 +177,7 @@ const emit = defineEmits<{
177177
removeSong: [id: number[]];
178178
}>();
179179
180+
const player = usePlayer();
180181
const musicStore = useMusicStore();
181182
const statusStore = useStatusStore();
182183

src/components/Menu/SongListMenu.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ import { deleteSongs, isLogin } from "@/utils/auth";
3131
import { songUrl } from "@/api/song";
3232
import { dailyRecommendDislike } from "@/api/rec";
3333
import { formatSongsList } from "@/utils/format";
34-
import player from "@/utils/player";
34+
import { usePlayer } from "@/utils/player";
3535
3636
const emit = defineEmits<{ removeSong: [index: number[]] }>();
3737
3838
const router = useRouter();
39+
const player = usePlayer();
3940
const dataStore = useDataStore();
4041
const localStore = useLocalStore();
4142
const statusStore = useStatusStore();

src/components/Modal/AutoClose.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@
6666
<script setup lang="ts">
6767
import { useStatusStore } from "@/stores";
6868
import { convertSecondsToTime } from "@/utils/time";
69-
import player from "@/utils/player";
69+
import { usePlayer } from "@/utils/player";
7070
71+
const player = usePlayer();
7172
const statusStore = useStatusStore();
7273
7374
// 自定义时长

src/components/Modal/ChangeRate.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232

3333
<script setup lang="ts">
3434
import { useStatusStore } from "@/stores";
35-
import player from "@/utils/player";
35+
import { usePlayer } from "@/utils/player";
3636
37+
const player = usePlayer();
3738
const statusStore = useStatusStore();
3839
</script>

src/components/Modal/Equalizer.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
<script setup lang="ts">
4040
import { isElectron } from "@/utils/env";
4141
import { useStatusStore } from "@/stores";
42-
import player from "@/utils/player";
42+
import { usePlayer } from "@/utils/player";
4343
44+
const player = usePlayer();
4445
const statusStore = useStatusStore();
4546
4647
type PresetKey = keyof typeof presetList;

src/components/Player/FullPlayer.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@
7979
import { useStatusStore, useMusicStore, useSettingStore } from "@/stores";
8080
import { isElectron } from "@/utils/env";
8181
import { throttle } from "lodash-es";
82-
import player from "@/utils/player";
82+
import { usePlayer } from "@/utils/player";
8383
84+
const player = usePlayer();
8485
const musicStore = useMusicStore();
8586
const statusStore = useStatusStore();
8687
const settingStore = useSettingStore();

0 commit comments

Comments
 (0)