Skip to content

Commit 777bb4d

Browse files
committed
feat: 页面布局改版
1 parent cf55547 commit 777bb4d

File tree

19 files changed

+112
-55
lines changed

19 files changed

+112
-55
lines changed

miniprogram/app.wxss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@ page {
88
display: flex;
99
flex-direction: column;
1010
box-sizing: border-box;
11+
background-image: linear-gradient(to bottom, #f3f4f6, white);
12+
@apply text-gray-900 dark:text-white;
1113
}
1214

1315
@media (prefers-color-scheme: dark) {
16+
page {
17+
background-image: linear-gradient(to bottom, #111827, black);
18+
}
1419
.invert-icon {
1520
filter: invert(1);
1621
}
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<view class="flex items-center">
2-
<input class="flex-1 h-8 leading-8 px-2 bg-[#f3f3f3] dark:bg-[#2c2c2c] rounded-2xl text-sm" value="{{value}}" placeholder="{{placeholder}}" placeholder-style="font-size: 14px;" bind:focus="handleFocus" bind:blur="handleBlur" bind:confirm="handleConfirm" bind:input="handleInput"></input>
3-
<button wx:if="{{focus && value}}" size="mini" class="ml-2" bind:tap="handleSearch">{{btnText}}</button>
2+
<input class="flex-1 h-8 leading-8 px-2 bg-white dark:bg-gray-800/20 rounded-lg border border-solid border-gray-200 dark:border-gray-700 text-sm" value="{{value}}" placeholder="{{placeholder}}" placeholder-style="font-size: 14px;" bind:focus="handleFocus" bind:blur="handleBlur" bind:confirm="handleConfirm" bind:input="handleInput"></input>
3+
<button wx:if="{{focus && value}}" size="mini" class="ml-2 bg-white dark:bg-gray-800/40" bind:tap="handleSearch">{{btnText}}</button>
44
<slot></slot>
55
</view>

miniprogram/components/xiao-cell/xiao-cell.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,5 @@ Component({
77
type: String,
88
value: '',
99
},
10-
borderless: {
11-
type: Boolean,
12-
value: false,
13-
},
1410
},
1511
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<view class="flex items-center py-4 {{extClass}} {{borderless ? '' : 'border-0 border-t border-solid border-gray-100 dark:border-neutral-800 border-opacity-80'}}">
1+
<view class="flex items-center px-2.5 py-3 rounded-md bg-white dark:bg-gray-800/20 mt-2 {{extClass}}">
22
<slot></slot>
33
</view>

miniprogram/pages/index/index.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,23 @@ import { ComponentWithStore } from 'mobx-miniprogram-bindings';
1010
interface Item {
1111
name: string;
1212
count: number;
13+
icon?: string;
1314
}
1415

1516
let list: Item[] = [];
1617
const pageSize = 40;
1718

19+
const playlistIconMap: Record<string, string> = {
20+
所有歌曲: 'suoyougequ',
21+
最近新增: 'zuijinxinzeng',
22+
收藏: 'shoucanggedan',
23+
};
24+
1825
ComponentWithStore({
1926
data: {
2027
connected: true,
2128
list: [] as Item[],
29+
playlists: [] as Item[],
2230
error: null as null | string,
2331
filterValue: '',
2432
},
@@ -57,26 +65,31 @@ ComponentWithStore({
5765
if (res.statusCode !== 200) {
5866
return;
5967
}
68+
const playlists: Item[] = [];
6069
list = Object.entries(res.data)
6170
.map(([name, items]) => ({
6271
name,
6372
count: items.length,
6473
}))
6574
.filter(({ name, count }) => {
75+
if (['所有歌曲', '收藏', '最近新增'].includes(name)) {
76+
if (count) {
77+
const icon = playlistIconMap[name] || 'zhuanji';
78+
playlists.push({ name, count, icon });
79+
}
80+
return false;
81+
}
6682
return (
6783
count && !['全部', '临时搜索列表', '所有电台'].includes(name)
6884
);
69-
})
70-
.sort((a, b) => {
71-
if (a.name === '所有歌曲') return -1;
72-
return a.name === '收藏' && b.name !== '所有歌曲' ? -1 : 1;
7385
});
7486
const { filterValue } = this.data;
7587
const filteredList = filterValue
7688
? list.filter((item) => item.name.includes(filterValue))
7789
: list;
7890
this.setData({
7991
connected: true,
92+
playlists,
8093
list: filteredList.slice(0, pageSize),
8194
});
8295
store.favorite.setMusics(res.data['收藏']);
@@ -241,5 +254,11 @@ ComponentWithStore({
241254
store.player.playMusic(e.detail.value, '');
242255
this.handleFilter({ detail: { value: '' } });
243256
},
257+
handleCreateList() {
258+
wx.showToast({
259+
title: '即将支持',
260+
icon: 'none',
261+
});
262+
},
244263
},
245264
});

0 commit comments

Comments
 (0)