Skip to content

Commit 5d21709

Browse files
committed
🌈 style: 简介改为弹窗 & 优化简介换行
1 parent 54d77d0 commit 5d21709

5 files changed

Lines changed: 50 additions & 41 deletions

File tree

src/utils/modal.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import ExcludeLyrics from "@/components/Modal/ExcludeLyrics.vue";
2020
import ChangeRate from "@/components/Modal/ChangeRate.vue";
2121
import AutoClose from "@/components/Modal/AutoClose.vue";
2222
import Equalizer from "@/components/Modal/Equalizer.vue";
23+
import { NScrollbar } from "naive-ui";
2324

2425
// 用户协议
2526
export const openUserAgreement = () => {
@@ -294,3 +295,27 @@ export const openEqualizer = () => {
294295
},
295296
});
296297
};
298+
299+
/**
300+
* 打开简介弹窗
301+
* @param content 简介内容
302+
*/
303+
export const openDescModal = (content: string, title: string = "歌单简介") => {
304+
window.$modal.create({
305+
preset: "card",
306+
transformOrigin: "center",
307+
autoFocus: false,
308+
style: { width: "600px" },
309+
title,
310+
content: () => {
311+
return h(
312+
NScrollbar,
313+
{ style: { maxHeight: "400px" } },
314+
{
315+
default: () =>
316+
h("div", { style: { whiteSpace: "pre-wrap" } }, { default: () => content }),
317+
},
318+
);
319+
},
320+
});
321+
};

src/views/List/album.vue

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,13 @@
3434
</n-h2>
3535
<n-collapse-transition :show="!listScrolling" class="collapse">
3636
<!-- 简介 -->
37-
<n-ellipsis
37+
<n-text
3838
v-if="albumDetailData.description"
39-
:line-clamp="1"
40-
:tooltip="{
41-
trigger: 'click',
42-
placement: 'bottom',
43-
width: 'trigger',
44-
}"
39+
class="description text-hidden"
40+
@click="openDescModal(albumDetailData.description, '专辑简介')"
4541
>
4642
{{ albumDetailData.description }}
47-
</n-ellipsis>
43+
</n-text>
4844
<!-- 信息 -->
4945
<n-flex class="meta">
5046
<div class="item">
@@ -184,7 +180,7 @@ import { renderToolbar } from "@/utils/meta";
184180
import { useDataStore, useStatusStore } from "@/stores";
185181
import { debounce } from "lodash-es";
186182
import { formatTimestamp } from "@/utils/time";
187-
import { openJumpArtist } from "@/utils/modal";
183+
import { openDescModal, openJumpArtist } from "@/utils/modal";
188184
import player from "@/utils/player";
189185
import { toLikeAlbum } from "@/utils/auth";
190186
@@ -379,7 +375,7 @@ onMounted(() => {
379375
border-radius: 8px;
380376
height: 32px;
381377
}
382-
:deep(.n-ellipsis) {
378+
.description {
383379
margin-bottom: 8px;
384380
cursor: pointer;
385381
}

src/views/List/liked.vue

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,13 @@
3737
<n-h2 class="name text-hidden"> 我喜欢的音乐 </n-h2>
3838
<n-collapse-transition :show="!listScrolling" class="collapse">
3939
<!-- 简介 -->
40-
<n-ellipsis
40+
<n-text
4141
v-if="playlistDetailData.description"
42-
:line-clamp="1"
43-
:tooltip="{
44-
trigger: 'click',
45-
placement: 'bottom',
46-
width: 'trigger',
47-
}"
42+
class="description text-hidden"
43+
@click="openDescModal(playlistDetailData.description)"
4844
>
4945
{{ playlistDetailData.description }}
50-
</n-ellipsis>
46+
</n-text>
5147
<!-- 信息 -->
5248
<n-flex class="meta">
5349
<div class="item">
@@ -177,7 +173,7 @@ import { coverLoaded, formatNumber, fuzzySearch, renderIcon } from "@/utils/help
177173
import { renderToolbar } from "@/utils/meta";
178174
import { debounce, isObject, uniqBy } from "lodash-es";
179175
import { useDataStore, useStatusStore } from "@/stores";
180-
import { openBatchList, openUpdatePlaylist } from "@/utils/modal";
176+
import { openBatchList, openDescModal, openUpdatePlaylist } from "@/utils/modal";
181177
import { formatTimestamp } from "@/utils/time";
182178
import { isLogin, updateUserLikePlaylist } from "@/utils/auth";
183179
import player from "@/utils/player";
@@ -541,7 +537,7 @@ onMounted(async () => {
541537
border-radius: 8px;
542538
height: 32px;
543539
}
544-
:deep(.n-ellipsis) {
540+
.description {
545541
margin-bottom: 8px;
546542
cursor: pointer;
547543
}

src/views/List/playlist.vue

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,13 @@
5050
</n-h2>
5151
<n-collapse-transition :show="!listScrolling" class="collapse">
5252
<!-- 简介 -->
53-
<n-ellipsis
53+
<n-text
5454
v-if="playlistDetailData.description"
55-
:line-clamp="1"
56-
:tooltip="{
57-
trigger: 'click',
58-
placement: 'bottom',
59-
}"
55+
class="description text-hidden"
56+
@click.stop="openDescModal(playlistDetailData.description)"
6057
>
61-
<span style="white-space: pre;">
62-
{{ playlistDetailData.description }}
63-
</span>
64-
</n-ellipsis>
58+
{{ playlistDetailData.description }}
59+
</n-text>
6560
<!-- 信息 -->
6661
<n-flex class="meta">
6762
<div class="item">
@@ -229,7 +224,7 @@ import { renderToolbar } from "@/utils/meta";
229224
import { isLogin, toLikePlaylist, updateUserLikePlaylist } from "@/utils/auth";
230225
import { debounce } from "lodash-es";
231226
import { useDataStore, useStatusStore } from "@/stores";
232-
import { openBatchList, openUpdatePlaylist } from "@/utils/modal";
227+
import { openBatchList, openDescModal, openUpdatePlaylist } from "@/utils/modal";
233228
import { formatTimestamp } from "@/utils/time";
234229
import player from "@/utils/player";
235230
@@ -633,7 +628,7 @@ onMounted(() => getPlaylistDetail(playlistId.value));
633628
border-radius: 8px;
634629
height: 32px;
635630
}
636-
:deep(.n-ellipsis) {
631+
.description {
637632
margin-bottom: 8px;
638633
cursor: pointer;
639634
}

src/views/List/radio.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,13 @@
3232
</n-h2>
3333
<n-collapse-transition :show="!listScrolling" class="collapse">
3434
<!-- 简介 -->
35-
<n-ellipsis
35+
<n-text
3636
v-if="radioDetailData.description"
37-
:line-clamp="1"
38-
:tooltip="{
39-
trigger: 'click',
40-
placement: 'bottom',
41-
width: 'trigger',
42-
}"
37+
class="description text-hidden"
38+
@click="openDescModal(radioDetailData.description, '节目简介')"
4339
>
4440
{{ radioDetailData.description }}
45-
</n-ellipsis>
41+
</n-text>
4642
<!-- 信息 -->
4743
<n-flex class="meta">
4844
<div class="item">
@@ -186,6 +182,7 @@ import { radioAllProgram, radioDetail } from "@/api/radio";
186182
import player from "@/utils/player";
187183
import { formatTimestamp } from "@/utils/time";
188184
import { toSubRadio } from "@/utils/auth";
185+
import { openDescModal } from "@/utils/modal";
189186
190187
const router = useRouter();
191188
const dataStore = useDataStore();
@@ -457,7 +454,7 @@ onMounted(() => getRadioDetail(radioId.value));
457454
border-radius: 8px;
458455
height: 32px;
459456
}
460-
:deep(.n-ellipsis) {
457+
.description {
461458
margin-bottom: 8px;
462459
cursor: pointer;
463460
}

0 commit comments

Comments
 (0)