From 4e92033683d250c06d3e9f39caf675adc4b339f2 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 25 Mar 2022 11:03:09 +0800 Subject: +album page --- admin_modify_album.php | 2 +- album.php | 78 ++++++++++++++++++++++ albums.php | 49 ++++++++++++++ cover/1648170357_555_MrPear.png | Bin 0 -> 361252 bytes cover/1648170394_824_dachai500x500.png | Bin 0 -> 238894 bytes cover/1648174166_335_dog.png | Bin 0 -> 144620 bytes index.php | 30 ++++----- music.php | 28 ++++++++ res/styles.css | 118 ++++++++++++++++++++++++++++++++- template.php | 20 ++++++ 10 files changed, 307 insertions(+), 18 deletions(-) create mode 100644 album.php create mode 100644 albums.php create mode 100644 cover/1648170357_555_MrPear.png create mode 100644 cover/1648170394_824_dachai500x500.png create mode 100644 cover/1648174166_335_dog.png diff --git a/admin_modify_album.php b/admin_modify_album.php index c858bf5..4812438 100644 --- a/admin_modify_album.php +++ b/admin_modify_album.php @@ -50,7 +50,7 @@ form .text {
-
+
diff --git a/album.php b/album.php new file mode 100644 index 0000000..c1aae7c --- /dev/null +++ b/album.php @@ -0,0 +1,78 @@ + + + + + + + + + + + +
+ + + +
+ +
+ + + + + +
+ +
+ + +
+ uid) / Config::$music_per_page); + $musiclist = fetch_album_music_ranged($album->uid, $current_page_index * Config::$music_per_page, Config::$music_per_page); + ?> + +
+ +
+ + + +
+ +
+ +
+ +
+ + + +
+ + + diff --git a/albums.php b/albums.php new file mode 100644 index 0000000..45ed3ef --- /dev/null +++ b/albums.php @@ -0,0 +1,49 @@ + + + + + + + + + +
+ + + + + + + +
+
+
+
+ + + + +
+
+
+ + + + +
+ + + + \ No newline at end of file diff --git a/cover/1648170357_555_MrPear.png b/cover/1648170357_555_MrPear.png new file mode 100644 index 0000000..66d11dd Binary files /dev/null and b/cover/1648170357_555_MrPear.png differ diff --git a/cover/1648170394_824_dachai500x500.png b/cover/1648170394_824_dachai500x500.png new file mode 100644 index 0000000..9097383 Binary files /dev/null and b/cover/1648170394_824_dachai500x500.png differ diff --git a/cover/1648174166_335_dog.png b/cover/1648174166_335_dog.png new file mode 100644 index 0000000..6eaafb4 Binary files /dev/null and b/cover/1648174166_335_dog.png differ diff --git a/index.php b/index.php index 61cab56..204939a 100644 --- a/index.php +++ b/index.php @@ -8,22 +8,20 @@
-
- - - - - - -
+ + + + + + diff --git a/music.php b/music.php index 3d814c1..8dcf178 100644 --- a/music.php +++ b/music.php @@ -196,6 +196,34 @@ function fetch_album_by_id($uid) { } } +function fetch_album_music_ranged($album_id, $from=0, $count=100) { + $sql = "SELECT music_id FROM " . Config::$tb_album_music . " WHERE album_id=" . $album_id . " ORDER BY id DESC LIMIT " . $from . ", " . $count ;; + $result = execute_sql($sql); + if($result == NULL || $result->num_rows == 0) + { + return null; + } + $arr = array(); + while($row = mysqli_fetch_assoc($result)){ + $id = $row['music_id']; + $music = fetch_music_by_id($id); + array_push($arr, $music); + } + return $arr; +} + +function get_all_album_music_count($album_id) { + $sql = "SELECT COUNT(*) as count FROM " . Config::$tb_album_music . " WHERE album_id=" . $album_id;//. " ORDER BY id DESC LIMIT " . $from . ", " . $count ;; + $result = execute_sql($sql); + if($result == NULL || $result->num_rows == 0) + return null; + $row = mysqli_fetch_assoc($result); + if($row != null){ + return $row['count']; + } + return 0; +} + // 从第from个记录开始的count个 function fetch_range_music($from=0, $count=100) { $sql = "SELECT id FROM " . Config::$tb_music . " ORDER BY time DESC LIMIT " . $from . ", " . $count ; diff --git a/res/styles.css b/res/styles.css index ef11d4f..e12c0b0 100644 --- a/res/styles.css +++ b/res/styles.css @@ -42,6 +42,7 @@ body{ min-height: 100%; box-sizing: border-box; padding: 5px; + position: relative; } #container-uppper { @@ -223,6 +224,9 @@ body{ #paginate { width: 100%; + position:absolute; + bottom:0; + left:0; } #paginate a { @@ -249,4 +253,116 @@ body{ background-color: #000; text-decoration-line: none; display: block; -} \ No newline at end of file +} + +.album_container { + width: 200px; + height: 250px; + background-color: #e9e9e9; + margin: 10px; + float:left; + position:relative; +} + +.album_container .cover_img { + width: 100%; + left: 0px; +} + +.album_container .play_img{ + object-fit: cover; + position: absolute; + left: 0px; + width: 100%; + z-index: 10; + display: none; +} + +.album_container .album_title { + display: block; + height: 45px; + font-size:10px; + padding: 3px; + text-align: center; + overflow:hidden; + line-height: 40px; + text-decoration-line: none; + font-weight:bold; + background:#000; + color:#fff; +} + +.album_container .album_title:hover{ + background:#ffffffff; + color:#3a3a3a; +} + +.album_container .album_image_root { + width: 200px; + height: 200px; +} + + +.music_container_wide { + width: 100%; + height: 45px; + margin: 0px 10px; + float:left; + position:relative; +} + +.music_container_wide .cover_img { + width: 45px; + left: 0px; +} + +.music_container_wide .play_img{ + object-fit: cover; + position: absolute; + left: 45px; + width: 45px; + z-index: 10; + display: none; +} + +.music_container_wide .music_title { + display: block; + height: 45px; + font-size:10px; + text-align: left; + overflow:hidden; + line-height: 40px; + text-decoration-line: none; + font-weight:bold; + float:left; + width: calc(100% - 100px); + padding-left: 15px; + box-sizing: border-box; + + background:#ffffffff; + color:#3a3a3a; + +} + +.music_container_wide .music_title:hover{ + background:#000; + color:#fff; +} + +.music_container_wide .music_image_root { + width: 45px; + height: 45px; + float: left; +} + +.music_container_wide .music_index{ + display: block; + width: 45px; + height:45px; + float:left; + line-height: 45px; + text-align: center; + font-size:18px; + color:#fff; + background-color: #000; +} diff --git a/template.php b/template.php index eb38b54..55724ba 100644 --- a/template.php +++ b/template.php @@ -14,6 +14,17 @@ function html_music($music) { echo '
' ; } +function html_music_wide($music, $index=0) { + echo '
'; + echo ' ' . $index .''; + echo '
'; + echo ' '; + echo ' '; + echo '
'; + echo '' . $music->title . ''; + echo '
'; +} + function html_tag($tag) { echo '' . $tag->name . ''; } @@ -69,5 +80,14 @@ function html_paginate_link_current($url, $pagei) { echo '' . ($pagei + 1) . ''; } +function html_album($album) { + echo '
'; + echo '
'; + echo ' '; + echo '
'; + echo ' ' . $album->title . ''; + echo '
'; +} + ?> \ No newline at end of file -- cgit v1.1-26-g67d0