fghrsh
3 years ago
commit
386ce0b3de
55 changed files with 27107 additions and 0 deletions
File diff suppressed because it is too large
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.8 KiB |
File diff suppressed because one or more lines are too long
@ -0,0 +1,13 @@ |
|||
<?php |
|||
$GLOBALS['config'] = [ |
|||
'name' => '白云图书馆', |
|||
'database' => [ |
|||
'host' => 'mysql', |
|||
'database' => 'books', |
|||
'username' => 'books_user', |
|||
'password' => 'JVjZ*34%C#FdH!Tz' |
|||
], |
|||
'salt' => 'Baiyun Library Management System: ', |
|||
'timezone' => 'Asia/Shanghai', |
|||
'environment' => 'development' |
|||
]; |
@ -0,0 +1,15 @@ |
|||
<?php |
|||
date_default_timezone_set($GLOBALS['config']['timezone']); |
|||
session_set_cookie_params(24 * 3600); |
|||
session_start(); |
|||
require('src/autoload.php'); |
|||
define('APP_ROOT', dirname(__FILE__)); |
|||
|
|||
//if ($GLOBALS['config']['environment'] == 'development') { |
|||
ini_set('display_errors', 1); |
|||
ini_set('display_startup_errors', 1); |
|||
error_reporting(-1); |
|||
//} |
|||
|
|||
new autoload(); |
|||
new router(); |
@ -0,0 +1,26 @@ |
|||
<?php |
|||
class autoload { |
|||
|
|||
public function __construct() { |
|||
require(APP_ROOT.'/config.php'); |
|||
require(APP_ROOT.'/src/router.php'); |
|||
$this->auto_require_files(APP_ROOT.'/src/model'); |
|||
$this->auto_require_files(APP_ROOT.'/src/controller'); |
|||
} |
|||
|
|||
private function auto_require_files($dir) { |
|||
foreach ($this->scan_dir_files($dir) as $file) require($file); |
|||
} |
|||
|
|||
private function scan_dir_files($dir) { |
|||
foreach (scandir($dir) as $item) { |
|||
if ($item != '..' && $item != '.') { |
|||
if (is_dir($dir.'/'.$item)) { |
|||
$files = array_merge($files, $this->scan_dir_files($dir.'/'.$item)); |
|||
} else $files[] = $dir.'/'.$item; |
|||
} |
|||
} |
|||
return $files; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,204 @@ |
|||
<?php |
|||
use model\books; |
|||
use model\users; |
|||
use model\stock; |
|||
use model\records; |
|||
use model\template; |
|||
use model\categories; |
|||
|
|||
class admin_controller { |
|||
|
|||
public function books() { |
|||
$page = $_GET['page'] ?? 1; |
|||
foreach ($books = books::list_books($page) as $k => $v) |
|||
$books[$k]['stock'] = stock::count_in_stock_by_bid($v['bid']).'/'.stock::count_stock_by_bid($v['bid']); |
|||
$this->template('书籍管理', 'books', ['books' => $books, 'page' => $page, 'count' => books::count_books(), 'stock' => stock::count_stock()]); |
|||
} |
|||
|
|||
public function users() { |
|||
$page = $_GET['page'] ?? 1; |
|||
$users = users::list_users($page); |
|||
$this->template('用户管理', 'users', ['users' => $users, 'page' => $page, 'count' => users::count_users(), 'stock' => stock::count_out_stock()]); |
|||
} |
|||
|
|||
public function stock() { |
|||
$page = $_GET['page'] ?? 1; |
|||
if (isset($_GET['bid']) && is_numeric($_GET['bid'])) { |
|||
$books = stock::list_stock_by_bid($_GET['bid'], $page); |
|||
$count = stock::count_stock_by_bid($_GET['bid']); |
|||
$stock = stock::count_in_stock_by_bid($_GET['bid']); |
|||
} else { |
|||
$books = stock::list_stock($page); |
|||
$count = stock::count_stock(); |
|||
$stock = stock::count_in_stock(); |
|||
} $this->template('库存管理', 'stock', ['books' => $books, 'page' => $page, 'count' => $count, 'stock' => $stock]); |
|||
} |
|||
|
|||
public function categories() { |
|||
$page = $_GET['page'] ?? 1; |
|||
$categories = categories::list_categories($page); |
|||
$this->template('分类管理', 'categories', ['categories' => $categories, 'page' => $page, 'count' => categories::count_categories(), 'stock' => stock::count_stock()]); |
|||
} |
|||
|
|||
public function add_user() { |
|||
$this->template('添加用户', 'add_user'); |
|||
} |
|||
|
|||
public function update_user() { |
|||
if (isset($_GET['uid']) && is_numeric($_GET['uid'])) { |
|||
$this->template('更新用户', 'update_user', ['user' => users::get_user_by_id($_GET['uid'])]); |
|||
} else header('Location: /admin/users'); |
|||
} |
|||
|
|||
public function delete_user() { |
|||
if (isset($_GET['uid']) && is_numeric($_GET['uid'])) { |
|||
$this->template('删除用户', 'delete_user', ['user' => users::get_user_by_id($_GET['uid'])]); |
|||
} else header('Location: /admin/users'); |
|||
} |
|||
|
|||
public function add_book() { |
|||
$categories = categories::get_categories(); |
|||
$this->template('添加书籍', 'add_book', ['categories' => $categories]); |
|||
} |
|||
|
|||
public function update_book() { |
|||
if (isset($_GET['bid']) && is_numeric($_GET['bid'])) { |
|||
$this->template('更新书籍', 'update_book', ['book' => books::get_book_by_id($_GET['bid']), 'categories' => categories::get_categories()]); |
|||
} else header('Location: /admin/books'); |
|||
} |
|||
|
|||
public function delete_book() { |
|||
if (isset($_GET['bid']) && is_numeric($_GET['bid'])) { |
|||
$this->template('删除书籍', 'delete_book', ['book' => books::get_book_by_id($_GET['bid']), 'categories' => categories::get_categories()]); |
|||
} else header('Location: /admin/books'); |
|||
} |
|||
|
|||
public function add_stock() { |
|||
if (isset($_GET['bid']) && is_numeric($_GET['bid'])) { |
|||
$this->template('添加库存', 'add_stock', ['book' => books::get_book_by_id($_GET['bid']), 'categories' => categories::get_categories()]); |
|||
} else header('Location: /admin/stock'); |
|||
} |
|||
|
|||
public function update_stock() { |
|||
if (isset($_GET['sid']) && is_numeric($_GET['sid'])) { |
|||
$this->template('更新库存', 'update_stock', ['book' => stock::get_stock_by_id($_GET['sid']), 'categories' => categories::get_categories()]); |
|||
} else header('Location: /admin/stock'); |
|||
} |
|||
|
|||
public function delete_stock() { |
|||
if (isset($_GET['sid']) && is_numeric($_GET['sid'])) { |
|||
$this->template('删除库存', 'delete_stock', ['book' => stock::get_stock_by_id($_GET['sid']), 'categories' => categories::get_categories()]); |
|||
} else header('Location: /admin/stock'); |
|||
} |
|||
|
|||
public function add_category() { |
|||
$this->template('添加分类', 'add_category'); |
|||
} |
|||
|
|||
public function update_category() { |
|||
if (isset($_GET['cid']) && is_numeric($_GET['cid'])) { |
|||
$this->template('更新分类', 'update_category', ['category' => categories::get_category_by_id($_GET['cid'])]); |
|||
} else header('Location: /admin/categories'); |
|||
} |
|||
|
|||
public function delete_category() { |
|||
if (isset($_GET['cid']) && is_numeric($_GET['cid'])) { |
|||
$this->template('删除分类', 'delete_category', ['category' => categories::get_category_by_id($_GET['cid']), 'categories' => categories::get_categories()]); |
|||
} else header('Location: /admin/categories'); |
|||
} |
|||
|
|||
public function do_add_user() { |
|||
$username = $_POST['username']; |
|||
if (!(strlen($username) <= 30 && preg_match('/^[a-zA-Z_][a-zA-Z0-9_]+$/u', $username))) |
|||
exit(header('Location: /admin/add-user?page='.$_GET['page'].'&error=用户名不合规')); |
|||
$password = $_POST['password']; |
|||
if ($password != $_POST['confirm']) |
|||
exit(header('Location: /admin/add-user?page='.$_GET['page'].'&error=两次输入密码不一致')); |
|||
|
|||
header('Location: ' . (users::add_user($username, $password, $_POST['sex'], $_POST['birthday'], $_POST['id_card'], $_POST['borrow_num'], $_POST['type']) ? |
|||
'/admin/users?page='.$_GET['page'] : '/admin/add-user?page='.$_GET['page'].'&error=数据库错误')); |
|||
} |
|||
|
|||
public function do_update_user() { |
|||
if (isset($_GET['uid']) && is_numeric($_GET['uid'])) { |
|||
if (empty($password = $_POST['password'])) |
|||
$password = null; |
|||
elseif ($password != $_POST['confirm']) |
|||
exit(header('Location: /admin/update-user?page='.$_GET['page'].'&uid='.$_GET['uid'].'&error=两次输入密码不一致')); |
|||
|
|||
header('Location: ' . (users::update_user($_GET['uid'], $password, $_POST['sex'], $_POST['birthday'], $_POST['id_card'], $_POST['borrow_num'], $_POST['type']) ? |
|||
'/admin/users?page='.$_GET['page'] : '/admin/update-user?page='.$_GET['page'].'&uid='.$_GET['uid'].'&error=数据库错误')); |
|||
} else header('Location: /admin/users?page='.$_GET['page']); |
|||
} |
|||
|
|||
public function do_delete_user() { |
|||
if (isset($_GET['uid']) && is_numeric($_GET['uid'])) { |
|||
header('Location: ' . (users::del_user_by_id($_GET['uid']) ? |
|||
'/admin/users?page='.$_GET['page'] : '/admin/delete-user?page='.$_GET['page'].'&uid='.$_GET['uid'].'&error=数据库错误')); |
|||
} else header('Location: /admin/users?page='.$_GET['page']); |
|||
} |
|||
|
|||
public function do_add_book() { |
|||
header('Location: ' . (books::add_book($_POST['name'], $_POST['author'], $_POST['publish'], $_POST['isbn'], $_POST['cover'], $_POST['type'], $_POST['lang']) ? |
|||
'/admin/books?page='.$_GET['page'] : '/admin/add-book?page='.$_GET['page'].'&error=数据库错误')); |
|||
} |
|||
|
|||
public function do_update_book() { |
|||
if (isset($_GET['bid']) && is_numeric($_GET['bid'])) { |
|||
header('Location: ' . (books::update_book($_GET['bid'], $_POST['name'], $_POST['author'], $_POST['publish'], $_POST['isbn'], $_POST['cover'], $_POST['type'], $_POST['lang']) ? |
|||
'/admin/books?page='.$_GET['page'] : '/admin/update-book?page='.$_GET['page'].'&bid='.$_GET['bid'].'&error=数据库错误')); |
|||
} else header('Location: /admin/books?page='.$_GET['page']); |
|||
} |
|||
|
|||
public function do_delete_book() { |
|||
if (isset($_GET['bid']) && is_numeric($_GET['bid'])) { |
|||
header('Location: ' . (books::del_book_by_id($_GET['bid']) ? |
|||
'/admin/books?page='.$_GET['page'] : '/admin/delete-book?page='.$_GET['page'].'&bid='.$_GET['bid'].'&error=数据库错误')); |
|||
} else header('Location: /admin/books?page='.$_GET['page']); |
|||
} |
|||
|
|||
public function do_add_stock() { |
|||
if (isset($_GET['bid']) && is_numeric($_GET['bid'])) { |
|||
header('Location: ' . (stock::add_stock($_GET['bid'], $_POST['place'], $_POST['health'], $_POST['state']) ? |
|||
'/admin/stock?bid='.$_GET['bid'] : '/admin/add-stock?page='.$_GET['page'].'%bid='.$_GET['bid'].'&error=数据库错误')); |
|||
} else header('Location: /admin/stock?bid='.$_GET['bid'].'&page='.$_GET['page']); |
|||
} |
|||
|
|||
public function do_update_stock() { |
|||
if (isset($_GET['sid']) && isset($_GET['bid']) && is_numeric($_GET['sid']) && is_numeric($_GET['bid'])) { |
|||
header('Location: ' . (stock::update_stock($_GET['sid'], $_GET['bid'], $_POST['place'], $_POST['health'], $_POST['state']) ? |
|||
'/admin/stock?page='.$_GET['page'] : '/admin/update-stock?page='.$_GET['page'].'&sid='.$_GET['sid'].'&bid='.$_GET['bid'].'&error=数据库错误')); |
|||
} else header('Location: /admin/stock?page='.$_GET['page']); |
|||
} |
|||
|
|||
public function do_delete_stock() { |
|||
if (isset($_GET['sid']) && is_numeric($_GET['sid'])) { |
|||
header('Location: ' . (stock::del_stock_by_id($_GET['sid']) ? |
|||
'/admin/stock?page='.$_GET['page'] : '/admin/delete-stock?page='.$_GET['page'].'&sid='.$_GET['sid'].'&error=数据库错误')); |
|||
} else header('Location: /admin/stock?page='.$_GET['page']); |
|||
} |
|||
|
|||
public function do_add_category() { |
|||
header('Location: ' . (categories::add_category($_POST['name']) ? |
|||
'/admin/categories?page='.$_GET['page'] : '/admin/add-categories?page='.$_GET['page'].'&error=数据库错误')); |
|||
} |
|||
|
|||
public function do_update_category() { |
|||
if (isset($_GET['cid']) && is_numeric($_GET['cid'])) { |
|||
header('Location: ' . (categories::update_category($_GET['cid'], $_POST['name']) ? |
|||
'/admin/categories?page='.$_GET['page'] : '/admin/update-category?page='.$_GET['page'].'&cid='.$_GET['cid'].'&error=数据库错误')); |
|||
} else header('Location: /admin/categories?page='.$_GET['page']); |
|||
} |
|||
|
|||
public function do_delete_category() { |
|||
if (isset($_GET['cid']) && is_numeric($_GET['cid'])) { |
|||
header('Location: ' . (books::update_book_category($_GET['cid'], $_POST['category']) && categories::del_category_by_id($_GET['cid']) ? |
|||
'/admin/categories?page='.$_GET['page'] : '/admin/delete-category?page='.$_GET['page'].'&cid='.$_GET['cid'].'&error=数据库错误')); |
|||
} else header('Location: /admin/categories?page='.$_GET['page']); |
|||
} |
|||
|
|||
private function template($title, $name, $parameters = []) { |
|||
template::render('admins', $name, array_merge(['title' => $title], $parameters)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,55 @@ |
|||
<?php |
|||
use model\books; |
|||
use model\stock; |
|||
use model\records; |
|||
use model\template; |
|||
use model\categories; |
|||
|
|||
class default_controller { |
|||
|
|||
public function index() { |
|||
$page = $_GET['page'] ?? 1; |
|||
$count = records::count_hot_records(); |
|||
$books = records::list_hot_records($page); |
|||
$categories = categories::get_categories(); |
|||
$records = isset($_SESSION['user']) ? records::get_in_records_by_uid($_SESSION['user']['uid']) : null; |
|||
$records_count = isset($_SESSION['user']) ? records::count_in_records_by_uid($_SESSION['user']['uid']) : 0; |
|||
$this->template('首页', 'index', ['books' => $books, 'page' => $page, 'count' => $count, 'categories' => $categories, 'records' => $records, 'records_count' => $records_count]); |
|||
} |
|||
|
|||
public function lists() { |
|||
$page = $_GET['page'] ?? 1; |
|||
$count = books::count_books(); |
|||
$books = books::list_books($page); |
|||
$categories = categories::get_categories(); |
|||
$records = isset($_SESSION['user']) ? records::get_in_records_by_uid($_SESSION['user']['uid']) : null; |
|||
$records_count = isset($_SESSION['user']) ? records::count_in_records_by_uid($_SESSION['user']['uid']) : 0; |
|||
$this->template('书籍列表', 'lists', ['books' => $books, 'page' => $page, 'count' => $count, 'categories' => $categories, 'records' => $records, 'records_count' => $records_count]); |
|||
} |
|||
|
|||
public function search() { |
|||
$page = $_GET['page'] ?? 1; |
|||
if (isset($_GET['s']) && !empty($_GET['s'])) { |
|||
$word = $_GET['s'] ?? ''; |
|||
$books = books::find_books($word, $page); |
|||
$count = books::count_find_books($word); |
|||
$categories = categories::get_categories(); |
|||
} else $word = $books = $count = $categories = null; |
|||
$records = isset($_SESSION['user']) ? records::get_in_records_by_uid($_SESSION['user']['uid']) : null; |
|||
$records_count = isset($_SESSION['user']) ? records::count_in_records_by_uid($_SESSION['user']['uid']) : 0; |
|||
$this->template('馆存查询', 'search', ['books' => $books, 'page' => $page, 'count' => $count, 'categories' => $categories, 'records' => $records, 'records_count' => $records_count]); |
|||
} |
|||
|
|||
public function book($bid) { |
|||
$page = $_GET['page'] ?? 1; |
|||
$count = stock::count_stock_by_bid($bid); |
|||
$stock = stock::count_in_stock_by_bid($bid); |
|||
$books = stock::list_stock_by_bid($bid, $page); |
|||
$this->template('库存查询', 'book', ['books' => $books, 'page' => $page, 'count' => $count, 'stock' => $stock]); |
|||
} |
|||
|
|||
private function template($title, $name, $parameters = []) { |
|||
template::render('defaults', $name, array_merge(['title' => $title], $parameters)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,99 @@ |
|||
<?php |
|||
use model\users; |
|||
use model\stock; |
|||
use model\records; |
|||
use model\template; |
|||
|
|||
class user_controller { |
|||
|
|||
public function info() { |
|||
$page = $_GET['page'] ?? 1; |
|||
$this->template('个人资料', 'info'); |
|||
} |
|||
|
|||
public function record() { |
|||
$page = $_GET['page'] ?? 1; |
|||
$books = records::list_records_by_uid($_SESSION['user']['uid'], $page); |
|||
$count = records::count_records_by_uid($_SESSION['user']['uid']); |
|||
$stock = records::count_in_records_by_uid($_SESSION['user']['uid']); |
|||
$this->template('借书记录', 'record', ['books' => $books, 'page' => $page, 'count' => $count, 'stock' => $stock]); |
|||
} |
|||
|
|||
public function update() { |
|||
$this->template('更新信息', 'update'); |
|||
} |
|||
|
|||
public function login() { |
|||
$this->template('用户登录', 'login'); |
|||
} |
|||
|
|||
public function register() { |
|||
$this->template('用户注册', 'register'); |
|||
} |
|||
|
|||
public function update_stock() { |
|||
if (isset($_GET['sid']) && is_numeric($_GET['sid']) && isset($_GET['bid']) && is_numeric($_GET['bid'])) { |
|||
if (stock::update_stock_state($_GET['sid'], 1)) |
|||
records::add_record($_GET['bid'], $_SESSION['user']['uid'], $_GET['sid'], time()); |
|||
} header('Location: /book/'.$_GET['bid'].'?page='.$_GET['page']); |
|||
} |
|||
|
|||
public function update_record() { |
|||
if (isset($_GET['rid']) && is_numeric($_GET['rid']) && isset($_GET['sid']) && is_numeric($_GET['sid'])) { |
|||
if (records::update_record($_GET['rid'], time())) stock::update_stock_state($_GET['sid'], 0); |
|||
} header('Location: /user/record?page='.$_GET['page']); |
|||
} |
|||
|
|||
public function do_login() { |
|||
$username = $_POST['username']; |
|||
$password = $_POST['password']; |
|||
if (!(strlen($username) <= 30 && preg_match('/^[a-zA-Z_][a-zA-Z0-9_]+$/u', $username))) |
|||
exit(header('Location: /user/login?error=用户名不合规')); |
|||
if ($user = users::get_user($username)) { |
|||
if ($user['password'] == hash('sha256', $GLOBALS['config']['salt'].$password)) { |
|||
$_SESSION['user'] = $user; |
|||
header('Location: /user/info'); |
|||
} else header('Location: /user/login?error=密码错误'); |
|||
} else header('Location: /user/login?error=用户不存在'); |
|||
} |
|||
|
|||
public function do_logout() { |
|||
session_destroy(); |
|||
header('Location: /user/login?error=注销成功'); |
|||
} |
|||
|
|||
public function do_update() { |
|||
$sex = $_POST['sex']; |
|||
$birthday = $_POST['birthday']; |
|||
if (empty($password = $_POST['password'])) |
|||
$password = null; |
|||
elseif ($password != $_POST['confirm']) |
|||
exit(header('Location: /user/update?error=两次输入密码不一致')); |
|||
|
|||
if (users::update_user($_SESSION['user']['uid'], $password, $sex, $birthday, $_SESSION['user']['id_card'], $_SESSION['user']['borrow_num'], $_SESSION['user']['type'])) { |
|||
session_destroy(); |
|||
header('Location: /user/login?error=更新成功,请重新登录'); |
|||
} else header('Location: /user/update?error=数据库错误'); |
|||
} |
|||
|
|||
public function do_register() { |
|||
$username = $_POST['username']; |
|||
if (!(strlen($username) <= 30 && preg_match('/^[a-zA-Z_][a-zA-Z0-9_]+$/u', $username))) |
|||
exit(header('Location: /user/register?error=用户名不合规')); |
|||
$id_card = $_POST['id_card']; |
|||
if (strlen($id_card) < 10 || !is_numeric($id_card)) |
|||
exit(header('Location: /user/register?error=身份证不合规')); |
|||
$password = $_POST['password']; |
|||
if ($password != $_POST['confirm']) |
|||
exit(header('Location: /user/register?error=两次输入密码不一致')); |
|||
|
|||
if (users::add_user($username, $password, 0, '1900-01-01', $id_card, 15, 0)) |
|||
header('Location: /user/login?error=注册成功,请登录'); |
|||
else header('Location: /user/register?error=数据库错误'); |
|||
} |
|||
|
|||
private function template($title, $name, $parameters = []) { |
|||
template::render('users', $name, array_merge(['title' => $title], $parameters)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,63 @@ |
|||
<?php |
|||
namespace model; |
|||
|
|||
use model\database; |
|||
|
|||
|
|||
class books { |
|||
|
|||
public static function get_book_by_id(int $bid) { |
|||
return (new database())->table('books')->where(['bid' => $bid])->select(); |
|||
} |
|||
|
|||
public static function del_book_by_id(int $bid) { |
|||
return (new database())->table('books')->where(['bid' => $bid])->delete(); |
|||
} |
|||
|
|||
public static function add_book($name, $author, $publish, $isbn, $cover, $cid, $lang) { |
|||
return (new database())->table('books')->insert([ |
|||
'name' => $name, |
|||
'author' => $author, |
|||
'publish' => $publish, |
|||
'isbn' => $isbn, |
|||
'cover' => $cover, |
|||
'cid' => (int)$cid, |
|||
'lang' => $lang |
|||
]); |
|||
} |
|||
|
|||
public static function update_book(int $bid, $name, $author, $publish, $isbn, $cover, $cid, $lang) { |
|||
return (new database())->table('books')->where(['bid' => $bid])->update([ |
|||
'name' => $name, |
|||
'author' => $author, |
|||
'publish' => $publish, |
|||
'isbn' => $isbn, |
|||
'cover' => $cover, |
|||
'cid' => (int)$cid, |
|||
'lang' => $lang |
|||
]); |
|||
} |
|||
|
|||
public static function update_book_category(int $cid, $category) { |
|||
return (new database())->table('books')->where(['cid' => $cid])->update(['cid' => (int)$category]); |
|||
} |
|||
|
|||
public static function list_books(int $page = 1) { |
|||
$books = (new database())->table('books')->page(20, $page); |
|||
return isset($books[0]['bid']) ? $books : [$books]; |
|||
} |
|||
|
|||
public static function find_books($word, int $page = 1) { |
|||
$books = (new database())->table('books')->like('name', $word)->page(20, $page); |
|||
return isset($books[0]['bid']) ? $books : [$books]; |
|||
} |
|||
|
|||
public static function count_books() { |
|||
return (new database())->table('books')->count(); |
|||
} |
|||
|
|||
public static function count_find_books($word) { |
|||
return (new database())->table('books')->like('name', $word)->count(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
<?php |
|||
namespace model; |
|||
|
|||
use model\database; |
|||
|
|||
|
|||
class categories { |
|||
|
|||
public static function get_category_by_id(int $cid) { |
|||
return (new database())->table('categories')->where(['cid' => $cid])->select(); |
|||
} |
|||
|
|||
public static function del_category_by_id(int $cid) { |
|||
return (new database())->table('categories')->where(['cid' => $cid])->delete(); |
|||
} |
|||
|
|||
public static function add_category($name) { |
|||
return (new database())->table('categories')->insert(['name' => $name]); |
|||
} |
|||
|
|||
public static function update_category(int $cid, $name) { |
|||
return (new database())->table('categories')->where(['cid' => $cid])->update(['name' => $name]); |
|||
} |
|||
|
|||
public static function get_categories() { |
|||
$categories = (new database())->table('categories')->select(); |
|||
return isset($categories[0]['cid']) ? $categories : [$categories]; |
|||
} |
|||
|
|||
public static function list_categories(int $page = 1) { |
|||
$categories = (new database())->table('categories')->page(20, $page); |
|||
return isset($categories[0]['cid']) ? $categories : [$categories]; |
|||
} |
|||
|
|||
public static function count_categories() { |
|||
return (new database())->table('categories')->count(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,146 @@ |
|||
<?php |
|||
namespace model; |
|||
|
|||
class database { |
|||
|
|||
private $pdo = null, $table, $where, $order, $limit, $prepare; |
|||
|
|||
public function __construct() { |
|||
if ($this->pdo == null) { |
|||
try { |
|||
$this->pdo = new \PDO('mysql:host='.$GLOBALS['config']['database']['host'].';dbname='.$GLOBALS['config']['database']['database'], |
|||
$GLOBALS['config']['database']['username'], $GLOBALS['config']['database']['password'], [\PDO::ATTR_PERSISTENT => true]); |
|||
} catch (PDOException $e) { |
|||
exit('Error: ' . $e->getMessage()); |
|||
} |
|||
} |
|||
|
|||
$this->table = null; |
|||
$this->where = []; |
|||
$this->order = ''; |
|||
$this->limit = ''; |
|||
$this->prepare = ''; |
|||
} |
|||
|
|||
public function table(string $table) { |
|||
$this->table = $table; |
|||
return $this; |
|||
} |
|||
|
|||
public function where(array $where) { |
|||
$this->where = array_merge($this->where, $where); |
|||
return $this; |
|||
} |
|||
|
|||
public function like($name, $word) { |
|||
$this->order = ' where `'.$name.'` like "%'.$word.'%"'; |
|||
return $this; |
|||
} |
|||
|
|||
public function group_by($name) { |
|||
$this->order = ' group by `'.$name.'`'; |
|||
return $this; |
|||
} |
|||
|
|||
public function select($select = null) { |
|||
$this->prepare_where(); |
|||
|
|||
if (is_array($select)) { |
|||
$select = '`'.implode('`, `', $select).'`'; |
|||
} elseif ($select == 'count(*)') { |
|||
$select = 'count(*)'; |
|||
} elseif (!empty($select)) { |
|||
$select = '`'.$select.'`'; |
|||
} else { |
|||
$select = '*'; |
|||
} |
|||
|
|||
$db = $this->pdo->prepare("select $select from `$this->table`$this->where$this->order$this->limit"); |
|||
$db->execute($this->prepare); |
|||
if ($db = $db->fetchAll(\PDO::FETCH_ASSOC)) |
|||
return count($db) > 1 ? $db : $db[0]; |
|||
else return false; |
|||
} |
|||
|
|||
public function insert(array $data) { |
|||
if (count($data) > 1) { |
|||
$keys = '`'.implode('`, `', array_keys($data)).'`'; |
|||
foreach ($data as $v) $values[] = '?'; |
|||
$values = implode(', ', $values); |
|||
} else { |
|||
$keys = '`'.array_keys($data)[0].'`'; |
|||
$values = '?'; |
|||
} |
|||
|
|||
$db = $this->pdo->prepare("insert into `$this->table`($keys) values($values)"); |
|||
return $db->execute(array_values($data)); |
|||
} |
|||
|
|||
public function update(array $data) { |
|||
$this->prepare_where(); |
|||
|
|||
if (count($data) > 1) { |
|||
$update = '`'.implode('` = ?, `', array_keys($data)).'` = ?'; |
|||
} else { |
|||
$update = '`'.array_keys($data)[0].'` = ?'; |
|||
} |
|||
|
|||
$db = $this->pdo->prepare("update `$this->table` set $update$this->where"); |
|||
return $db->execute(array_merge(array_values($data), $this->prepare)); |
|||
} |
|||
|
|||
public function delete() { |
|||
$this->prepare_where(); |
|||
|
|||
$db = $this->pdo->prepare("delete from `$this->table`$this->where"); |
|||
return $db->execute($this->prepare); |
|||
} |
|||
|
|||
public function count() { |
|||
return $this->select('count(*)')['count(*)']; |
|||
} |
|||
|
|||
public function last($last) { |
|||
$this->order = ' order by `'.$last.'` desc'; |
|||
$this->limit = ' limit 1'; |
|||
return $this->select(); |
|||
} |
|||
|
|||
public function page(int $limit, int $page) { |
|||
$this->limit = ' limit '.($page-1)*$limit.', '.$limit; |
|||
return $this->select(); |
|||
} |
|||
|
|||
public function pdo_query($sql) { |
|||
$db = $this->pdo->query($sql); |
|||
if ($db = $db->fetchAll(\PDO::FETCH_ASSOC)) |
|||
return count($db) > 1 ? $db : $db[0]; |
|||
else return false; |
|||
} |
|||
|
|||
public function pdo_prepare($sql) { |
|||
$this->prepare = $sql; |
|||
return $this; |
|||
} |
|||
|
|||
public function execute($arr) { |
|||
$db = $this->pdo->prepare($this->prepare); |
|||
$db->execute($arr); |
|||
if ($db = $db->fetchAll(\PDO::FETCH_ASSOC)) |
|||
return count($db) > 1 ? $db : $db[0]; |
|||
else return false; |
|||
} |
|||
|
|||
private function prepare_where() { |
|||
$where = ''; |
|||
$this->prepare = []; |
|||
if (!empty($this->where) && is_array($this->where)) { |
|||
$where = ' where '; |
|||
if (count($this->where) > 1) { |
|||
$where .= '`'.implode('` = ? and `', array_keys($this->where)).'` = ?'; |
|||
} else $where .= '`'.array_keys($this->where)[0].'` = ?'; |
|||
$this->prepare = array_values($this->where); |
|||
} |
|||
$this->where = $where; |
|||
} |
|||
} |
@ -0,0 +1,71 @@ |
|||
<?php |
|||
namespace model; |
|||
|
|||
use model\database; |
|||
|
|||
|
|||
class records { |
|||
|
|||
public static function get_records_by_uid(int $uid) { |
|||
$records = ((new database())->pdo_prepare( |
|||
'select r.rid, b.bid, b.cover'. |
|||
' from records r left join books b on r.bid = b.bid where r.uid = :uid')->execute([':uid' => $uid])) ?? false; |
|||
return isset($records[0]['rid']) ? $records : [$records]; |
|||
} |
|||
|
|||
public static function get_in_records_by_uid(int $uid) { |
|||
$records = ((new database())->pdo_prepare( |
|||
'select r.rid, b.bid, b.cover'. |
|||
' from records r left join books b on r.bid = b.bid where r.uid = :uid and r.state = 0')->execute([':uid' => $uid])) ?? false; |
|||
return isset($records[0]['rid']) ? $records : [$records]; |
|||
} |
|||
|
|||
public static function add_record($bid, $uid, $sid, $borrow_time) { |
|||
return (new database())->table('records')->insert([ |
|||
'bid' => $bid, |
|||
'uid' => $uid, |
|||
'sid' => $sid, |
|||
'borrow_time' => $borrow_time, |
|||
'state' => 0 |
|||
]); |
|||
} |
|||
|
|||
public static function update_record($rid, $return_time) { |
|||
return (new database())->table('records')->where(['rid' => $rid])->update(['return_time' => $return_time, 'state' => 1]); |
|||
} |
|||
|
|||
public static function list_hot_records(int $page = 1) { |
|||
$records = ((new database())->pdo_query( |
|||
'select b.bid, b.cid, b.name, b.author, b.publish, b.isbn, b.cover, b.lang, any_value(r.borrow_time) as borrow_time'. |
|||
' from records r left join books b on r.bid = b.bid group by b.bid order by borrow_time desc limit '.(($page-1)*20).', 20')) ?? false; |
|||
return isset($records[0]['bid']) ? $records : [$records]; |
|||
} |
|||
|
|||
public static function list_records_by_uid(int $uid, int $page = 1) { |
|||
$records = ((new database())->pdo_prepare( |
|||
'select r.rid, r.sid, b.name, b.author, b.publish, b.isbn, r.borrow_time, r.return_time, r.state'. |
|||
' from records r left join books b on r.bid = b.bid where r.uid = :uid limit '.(($page-1)*20).', 20')->execute([':uid' => $uid])) ?? false; |
|||
return isset($records[0]['rid']) ? $records : [$records]; |
|||
} |
|||
|
|||
public static function count_records() { |
|||
return (new database())->table('records')->count(); |
|||
} |
|||
|
|||
public static function count_hot_records() { |
|||
return (new database())->pdo_query('select count(*) from (select `bid` as `count` from `records` group by `bid`) as c')['count(*)'] ?? 0; |
|||
} |
|||
|
|||
public static function count_records_by_uid(int $uid) { |
|||
return (new database())->table('records')->where(['uid' => $uid])->count(); |
|||
} |
|||
|
|||
public static function count_in_records() { |
|||
return (new database())->table('records')->where(['state' => 0])->count(); |
|||
} |
|||
|
|||
public static function count_in_records_by_uid(int $uid) { |
|||
return (new database())->table('records')->where(['uid' => $uid, 'state' => 0])->count(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,75 @@ |
|||
<?php |
|||
namespace model; |
|||
|
|||
use model\database; |
|||
|
|||
|
|||
class stock { |
|||
|
|||
public static function get_stock_by_id(int $sid) { |
|||
return ((new database())->pdo_prepare( |
|||
'select s.sid, b.bid, b.cid, b.name, b.isbn, b.author, b.publish, b.cover, b.lang, s.place, s.health, s.state'. |
|||
' from stock s left join books b on s.bid = b.bid where s.sid = :sid')->execute([':sid' => $sid])) ?? false; |
|||
} |
|||
|
|||
public static function del_stock_by_id(int $sid) { |
|||
return (new database())->table('stock')->where(['sid' => $sid])->delete(); |
|||
} |
|||
|
|||
public static function add_stock($bid, $place, $health, $state) { |
|||
return (new database())->table('stock')->insert([ |
|||
'bid' => $bid, |
|||
'place' => $place, |
|||
'health' => $health, |
|||
'state' => $state |
|||
]); |
|||
} |
|||
|
|||
public static function update_stock(int $sid, $bid, $place, $health, $state) { |
|||
return (new database())->table('stock')->where(['sid' => $sid])->update([ |
|||
'bid' => $bid, |
|||
'place' => $place, |
|||
'health' => $health, |
|||
'state' => $state |
|||
]); |
|||
} |
|||
|
|||
public static function update_stock_state(int $sid, $state) { |
|||
return (new database())->table('stock')->where(['sid' => $sid])->update(['state' => $state]); |
|||
} |
|||
|
|||
public static function count_stock() { |
|||
return (new database())->table('stock')->count(); |
|||
} |
|||
|
|||
public static function count_in_stock() { |
|||
return (new database())->table('stock')->where(['state' => 0])->count(); |
|||
} |
|||
|
|||
public static function count_out_stock() { |
|||
return (new database())->table('stock')->where(['state' => 1])->count(); |
|||
} |
|||
|
|||
public static function count_stock_by_bid(int $bid) { |
|||
return (new database())->table('stock')->where(['bid' => $bid])->count(); |
|||
} |
|||
|
|||
public static function count_in_stock_by_bid(int $bid) { |
|||
return (new database())->table('stock')->where(['bid' => $bid, 'state' => 0])->count(); |
|||
} |
|||
|
|||
public static function list_stock(int $page = 1) { |
|||
$stock = (new database())->pdo_query( |
|||
'select s.sid, b.bid, b.cid, b.name, b.isbn, b.author, b.publish, b.cover, b.lang, s.place, s.health, s.state'. |
|||
' from stock s left join books b on s.bid = b.bid limit '.(($page-1)*20).', 20'); |
|||
return isset($stock[0]['sid']) ? $stock : [$stock]; |
|||
} |
|||
|
|||
public static function list_stock_by_bid(int $bid, int $page = 1) { |
|||
$stock = (new database())->pdo_query( |
|||
'select s.sid, b.bid, b.cid, b.name, b.isbn, b.author, b.publish, b.cover, b.lang, s.place, s.health, s.state'. |
|||
' from stock s left join books b on s.bid = b.bid where s.bid = '.$bid.' limit '.(($page-1)*20).', 20'); |
|||
return isset($stock[0]['sid']) ? $stock : [$stock]; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
<?php |
|||
namespace model; |
|||
|
|||
class template { |
|||
|
|||
public static function render($cont, $name, $parameters = []) { |
|||
foreach ($parameters as $k => $v) $$k = $v; |
|||
require(APP_ROOT.'/src/template/header.php'); |
|||
require(APP_ROOT.'/src/template/side_nav.php'); |
|||
require(APP_ROOT.'/src/template/'.$cont.'/'.$name.'.php'); |
|||
require(APP_ROOT.'/src/template/footer.php'); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,54 @@ |
|||
<?php |
|||
namespace model; |
|||
|
|||
use model\database; |
|||
|
|||
|
|||
class users { |
|||
|
|||
public static function get_user(string $username) { |
|||
return (new database())->table('users')->where(['username' => $username])->select(); |
|||
} |
|||
|
|||
public static function get_user_by_id(int $uid) { |
|||
return (new database())->table('users')->where(['uid' => $uid])->select(); |
|||
} |
|||
|
|||
public static function del_user_by_id(int $uid) { |
|||
return (new database())->table('users')->where(['uid' => $uid])->delete(); |
|||
} |
|||
|
|||
public static function add_user($username, $password, $sex, $birthday, $id_card, $borrow_num = 15, $type = 0) { |
|||
return (new database())->table('users')->insert([ |
|||
'username' => $username, |
|||
'password' => hash('sha256', $GLOBALS['config']['salt'].$password), |
|||
'birthday' => $birthday, |
|||
'sex' => (int)$sex, |
|||
'id_card' => $id_card, |
|||
'borrow_num' => (int)$borrow_num, |
|||
'type' => (int)$type |
|||
]); |
|||
} |
|||
|
|||
public static function update_user(int $uid, $password, $sex, $birthday, $id_card, $borrow_num, $type) { |
|||
$update = [ |
|||
'sex' => (int)$sex, |
|||
'birthday' => $birthday, |
|||
'id_card' => $id_card, |
|||
'borrow_num' => $borrow_num, |
|||
'type' => $type, |
|||
]; |
|||
if (!empty($password)) $update['password'] = hash('sha256', $GLOBALS['config']['salt'].$password); |
|||
return (new database())->table('users')->where(['uid' => $uid])->update($update); |
|||
} |
|||
|
|||
public static function list_users(int $page = 1) { |
|||
$users = (new database())->table('users')->page(20, $page); |
|||
return isset($users[0]['uid']) ? $users : [$users]; |
|||
} |
|||
|
|||
public static function count_users() { |
|||
return (new database())->table('users')->count(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,109 @@ |
|||
<?php |
|||
class router { |
|||
public function __construct() { |
|||
$router = [ |
|||
'/' => ['index', 1], |
|||
'/book' => ['book', 0], |
|||
'/user' => ['user', 0], |
|||
'/admin' => ['admin', 0], |
|||
'/lists' => ['lists', 1], |
|||
'/search' => ['search', 1] |
|||
]; |
|||
|
|||
$to = ''; $uri = explode('?', $_SERVER['REQUEST_URI'])[0]; |
|||
foreach ($router as $k => $v) |
|||
if ($k == ($v[1] ? $uri : substr($uri, 0, strlen($k)))) $to = $v[0]; |
|||
|
|||
switch ($to) { |
|||
case 'user': |
|||
$controller = new user_controller(); |
|||
switch (explode('/', $uri)[2] ?? null) { |
|||
case 'login': $controller->login(); break; |
|||
case 'register': $controller->register(); break; |
|||
case 'info': $this->check_login(); $controller->info(); break; |
|||
case 'record': $this->check_login(); $controller->record(); break; |
|||
case 'update': $this->check_login(); $controller->update(); break; |
|||
case 'update-stock': $this->check_login(); $controller->update_stock(); break; |
|||
case 'update-record': $this->check_login(); $controller->update_record(); break; |
|||
case 'do': switch (explode('/', $uri)[3] ?? null) { |
|||
case 'login': $controller->do_login(); break; |
|||
case 'register': $controller->do_register(); break; |
|||
case 'logout': $this->check_login(); $controller->do_logout(); break; |
|||
case 'update': $this->check_login(); $controller->do_update(); break; |
|||
default: break; |
|||
} break; |
|||
default: |
|||
header('Location: /user/'.($this->check_login(0)?'info':'login')); break; |
|||
} break; |
|||
|
|||
case 'admin': |
|||
if (isset($_SESSION['user']) && $_SESSION['user']['type'] == 1) { |
|||
$controller = new admin_controller(); |
|||
switch (explode('/', $uri)[2] ?? null) { |
|||
|
|||
case 'users': $controller->users(); break; |
|||
case 'books': $controller->books(); break; |
|||
case 'stock': $controller->stock(); break; |
|||
case 'categories': $controller->categories(); break; |
|||
|
|||
case 'add-user': $controller->add_user(); break; |
|||
case 'update-user': $controller->update_user(); break; |
|||
case 'delete-user': $controller->delete_user(); break; |
|||
|
|||
case 'add-book': $controller->add_book(); break; |
|||
case 'update-book': $controller->update_book(); break; |
|||
case 'delete-book': $controller->delete_book(); break; |
|||
|
|||
case 'add-stock': $controller->add_stock(); break; |
|||
case 'update-stock': $controller->update_stock(); break; |
|||
case 'delete-stock': $controller->delete_stock(); break; |
|||
|
|||
case 'add-category': $controller->add_category(); break; |
|||
case 'update-category': $controller->update_category(); break; |
|||
case 'delete-category': $controller->delete_category(); break; |
|||
|
|||
case 'do': switch (explode('/', $uri)[3] ?? null) { |
|||
|
|||
case 'add-user': $controller->do_add_user(); break; |
|||
case 'update-user': $controller->do_update_user(); break; |
|||
case 'delete-user': $controller->do_delete_user(); break; |
|||
|
|||
case 'add-book': $controller->do_add_book(); break; |
|||
case 'update-book': $controller->do_update_book(); break; |
|||
case 'delete-book': $controller->do_delete_book(); break; |
|||
|
|||
case 'add-stock': $controller->do_add_stock(); break; |
|||
case 'update-stock': $controller->do_update_stock(); break; |
|||
case 'delete-stock': $controller->do_delete_stock(); break; |
|||
|
|||
case 'add-category': $controller->do_add_category(); break; |
|||
case 'update-category': $controller->do_update_category(); break; |
|||
case 'delete-category': $controller->do_delete_category(); break; |
|||
|
|||
default: break; |
|||
} break; |
|||
|
|||
default: header('Location: '.($this->check_login(0)?'/admin/users':'/user/login')); break; |
|||
} |
|||
} else header('Location: /user'); break; |
|||
|
|||
default: |
|||
$controller = new default_controller(); |
|||
switch ($to) { |
|||
|
|||
case 'index': $controller->index(); break; |
|||
case 'lists': $controller->lists(); break; |
|||
case 'search': $controller->search(); break; |
|||
|
|||
case 'book': $controller->book((int)(explode('/', $uri)[2] ?? 0)); break; |
|||
|
|||
default: http_response_code(404); break; |
|||
} break; |
|||
} |
|||
} |
|||
|
|||
private function check_login($jump = true) { |
|||
return ($login = !isset($_SESSION['user'])) && $jump ? exit(header('Location: /user/login')) : !$login; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,49 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">添加书籍</h2> |
|||
<form action="/admin/do/add-book?page=<?=$_GET['page']?>" method="post"> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书 名:<input type="text" name="name" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
作 者:<input type="text" name="author" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
出版社:<input type="text" name="publish" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
ISBN:<input type="text" name="isbn" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
封面图片:<input type="text" name="cover" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍类型:<select name="type"> |
|||
<?php foreach ($categories as $category) { ?> |
|||
<option value="<?=$category['cid']?>"><?=$category['name']?></option> |
|||
<?php } ?> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍语言:<select name="lang"> |
|||
<option value="zh-cn">简体中文</option> |
|||
<option value="en-us">英文</option> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<a class="no-underline" href="/admin/books?page=<?=$_GET['page']?>"> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value=" 返 回 " /> |
|||
</a> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 添 加 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,24 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">添加分类</h2> |
|||
<form action="/admin/do/add-category?page=<?=$_GET['page']?>" method="post"> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
分类名:<input type="text" name="name" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<a class="no-underline" href="/admin/categories?page=<?=$_GET['page']?>"> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value=" 返 回 " /> |
|||
</a> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 添 加 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,59 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">添加库存</h2> |
|||
<form action="/admin/do/add-stock?page=<?=$_GET['page']?>&bid=<?=$_GET['bid']?>" method="post"> |
|||
<p class="mt-2"> |
|||
|
|||
</p> |
|||
<img src="<?=$book['cover']?>" /> |
|||
<p class="text-grey-dark mt-2"> |
|||
书 名:<?=$book['name']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
作 者:<?=$book['author']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
出版社:<?=$book['publish']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
ISBN:<?=$book['isbn']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍类型:<?php foreach ($categories as $category) if ($category['cid'] == $book['cid']) echo $category['name']; ?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍语言:<?=$book['lang']=='zh-cn'?'简体中文':'英文'?> |
|||
</p> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书架号:<input type="text" name="place" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
受损程度:<select name="health"> |
|||
<option value="0">正常</option> |
|||
<option value="1">中等</option> |
|||
<option value="2">受损</option> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
借阅状态:<select name="state"> |
|||
<option value="0">在馆</option> |
|||
<option value="1">借出</option> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<a class="no-underline" href="/admin/stock?bid=<?=$_GET['bid']?>&page=<?=$_GET['page']?>"> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value=" 返 回 " /> |
|||
</a> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 添 加 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,51 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">添加用户</h2> |
|||
<form action="/admin/do/add-user?page=<?=$_GET['page']?>" method="post"> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
用户名:<input type="text" name="username" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
密 码:<input type="password" name="password" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
重复密码:<input type="password" name="confirm" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
性 别:<select name="sex"> |
|||
<option value="1" selected>男</option> |
|||
<option value="0">女</option> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
生 日:<input type="text" name="birthday" value="1900-01-01" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
身份证:<input type="text" name="id_card" value="440105190001019999" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
借书配额:<input type="text" name="borrow_num" value="15"/> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
用户类型:<select name="type"> |
|||
<option value="1">管理员</option> |
|||
<option value="0" selected>普通用户</option> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<a class="no-underline" href="/admin/users?page=<?=$_GET['page']?>"> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value=" 返 回 " /> |
|||
</a> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 添 加 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,63 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">书籍管理</h2> |
|||
</div> |
|||
<a href="/admin/add-book?page=<?=$page?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">添加书籍</a> |
|||
</div> |
|||
<div class="px-6 md:px-0 mt-4 md:flex flex-wrap order-1 md:-order-1 md:shadow-md"> |
|||
<div class="p-4 px-6 w-full md:w-1/2 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<h4>书籍列表</h4> |
|||
<table class="mt-4 w-full"> |
|||
<thead class="p-2 text-sm leading-loose border-b text-indigo"> |
|||
<tr> |
|||
<td>书名</td> |
|||
<td class="hidden js-mobile-hidden">作者</td> |
|||
<td class="hidden js-mobile-hidden">出版社</td> |
|||
<td class="text-center hidden js-mobile-hidden">ISBN</td> |
|||
<td class="text-right">库存</td> |
|||
<td class="text-right">操作</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody class="p-2 leading-loose text-sm"> |
|||
<?php if (isset($books[0]['bid'])) { |
|||
foreach ($books as $book) { ?><tr class="border-b"> |
|||
<td class="py-2"><?=$book['name']?></td> |
|||
<td class="py-2 hidden js-mobile-hidden"><?=$book['author']?></td> |
|||
<td class="py-2 hidden js-mobile-hidden"><?=$book['publish']?></td> |
|||
<td class="py-2 text-center hidden js-mobile-hidden"><?=$book['isbn']?></td> |
|||
<td class="py-2 text-right"><?=$book['stock']?></td> |
|||
<td class="py-2 text-right"> |
|||
<a href="/admin/update-book?page=<?=$page?>&bid=<?=$book['bid']?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none hidden js-mobile-hidden">更新</a> |
|||
<a href="/admin/stock?bid=<?=$book['bid']?>&books=<?=$page?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">库存</a> |
|||
<a href="/admin/delete-book?page=<?=$page?>&bid=<?=$book['bid']?>" class="no-underline bg-magenta-dark hover:bg-magenta-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">删除</a> |
|||
</td> |
|||
</tr> |
|||
<?php } |
|||
} else { ?> |
|||
<tr class="border-b"> |
|||
<td class="py-2">没有库存</td> |
|||
</td> |
|||
<?php } ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div class="w-full md:w-1/2 p-4 md:pt-12 md:pl-1 mt-4 md:mt-0 lg:pt-12 lg:pl-8 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<div class="flex"> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">书籍条目</p> |
|||
<p class="font-medium text-sm pl-2"><?=$count?></p> |
|||
</div> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">书籍总量</p> |
|||
<p class="font-medium text-sm pl-2"><?=$stock?></p> |
|||
</div> |
|||
</div> |
|||
<div class="pt-6"> |
|||
<?php $path = '/admin/books'; require(APP_ROOT.'/src/template/admins/page_switch.php'); ?> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,56 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">分类管理</h2> |
|||
</div> |
|||
<a href="/admin/add-category?page=<?=$page?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">添加分类</a> |
|||
</div> |
|||
<div class="px-6 md:px-0 mt-4 md:flex flex-wrap order-1 md:-order-1 md:shadow-md"> |
|||
<div class="p-4 px-6 w-full md:w-1/2 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<h4>分类列表</h4> |
|||
<table class="mt-4 w-full"> |
|||
<thead class="p-2 text-sm leading-loose border-b text-indigo"> |
|||
<tr> |
|||
<td>ID</td> |
|||
<td>分类名</td> |
|||
<td class="text-right">操作</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody class="p-2 leading-loose text-sm"> |
|||
<?php if (isset($categories[0]['cid'])) { |
|||
foreach ($categories as $category) { ?><tr class="border-b"> |
|||
<td class="py-2"><?=$category['cid']?></td> |
|||
<td class="py-2"><?=$category['name']?></td> |
|||
<td class="py-2 text-right"> |
|||
<a href="/admin/update-category?page=<?=$page?>&cid=<?=$category['cid']?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">更新</a> |
|||
<a href="/admin/delete-category?page=<?=$page?>&cid=<?=$category['cid']?>" class="no-underline bg-magenta-dark hover:bg-magenta-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">删除</a> |
|||
</td> |
|||
</tr> |
|||
<?php } |
|||
} else { ?> |
|||
<tr class="border-b"> |
|||
<td class="py-2">没有分类</td> |
|||
</td> |
|||
<?php } ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div class="w-full md:w-1/2 p-4 md:pt-12 md:pl-1 mt-4 md:mt-0 lg:pt-12 lg:pl-8 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<div class="flex"> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">分类数量</p> |
|||
<p class="font-medium text-sm pl-2"><?=$count?></p> |
|||
</div> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">书籍总量</p> |
|||
<p class="font-medium text-sm pl-2"><?=$stock?></p> |
|||
</div> |
|||
</div> |
|||
<div class="pt-6"> |
|||
<?php $path = '/admin/books'; require(APP_ROOT.'/src/template/admins/page_switch.php'); ?> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,41 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">删除书籍</h2> |
|||
<p class="text-grey-dark mt-2">修改不可逆,请谨慎操作!</p> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<img src="<?=$book['cover']?>" /> |
|||
<p class="text-grey-dark mt-2"> |
|||
书 名:<?=$book['name']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
作 者:<?=$book['author']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
出版社:<?=$book['publish']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
ISBN:<?=$book['isbn']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍类型:<?php foreach ($categories as $category) if ($category['cid'] == $book['cid']) echo $category['name']; ?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍语言:<?=$book['lang']=='zh-cn'?'简体中文':'英文'?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<a class="no-underline" href="/admin/books?page=<?=$_GET['page']?>"> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value="返回列表" /> |
|||
</a> |
|||
<a class="no-underline" href="/admin/do/delete-book?page=<?=$_GET['page']?>&bid=<?=$book['bid']?>"> |
|||
<input class="bg-magenta-dark hover:bg-magenta-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value="确认删除" /> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,35 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">删除分类</h2> |
|||
<p class="text-grey-dark mt-2">修改不可逆,请谨慎操作!</p> |
|||
<form action="/admin/do/delete-category?page=<?=$_GET['page']?>&cid=<?=$_GET['cid']?>" method="post"> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
分类名:<?=$category['name']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
合并至:<select name="category"> |
|||
<?php $cid = $category['cid']; |
|||
foreach ($categories as $category) { |
|||
if ($category['cid'] != $cid) { ?> |
|||
<option value="<?=$category['cid']?>"><?=$category['name']?></option> |
|||
<?php } |
|||
} ?> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<a class="no-underline" href="/admin/categories?page=<?=$_GET['page']?>"> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value="返回列表" /> |
|||
</a> |
|||
<input class="bg-magenta-dark hover:bg-magenta-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value="确认删除" /> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,54 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">删除库存</h2> |
|||
<p class="text-grey-dark mt-2">修改不可逆,请谨慎操作!</p> |
|||
<p class="mt-2"> |
|||
|
|||
</p> |
|||
<img src="<?=$book['cover']?>" /> |
|||
<p class="text-grey-dark mt-2"> |
|||
书 名:<?=$book['name']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
作 者:<?=$book['author']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
出版社:<?=$book['publish']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
ISBN:<?=$book['isbn']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍类型:<?php foreach ($categories as $category) if ($category['cid'] == $book['cid']) echo $category['name']; ?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍语言:<?=$book['lang']=='zh-cn'?'简体中文':'英文'?> |
|||
</p> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书架号:<?=$book['place']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
受损程度:<?=$book['health']?($book['health']==2?'破损':'中等'):'正常'?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
借阅状态:<?=$book['state']?'借出':'在馆'?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<a class="no-underline" href="/admin/stock?page=<?=$_GET['page']?>"> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value="返回列表" /> |
|||
</a> |
|||
<a class="no-underline" href="/admin/do/delete-stock?page=<?=$_GET['page']?>&sid=<?=$book['sid']?>"> |
|||
<input class="bg-magenta-dark hover:bg-magenta-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value="确认删除" /> |
|||
</a> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,40 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">删除用户</h2> |
|||
<p class="text-grey-dark mt-2">修改不可逆,请谨慎操作!</p> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
用户名:<?=$user['username']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
性 别:<?=$user['sex']?'男':'女'?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
生 日:<?=$user['birthday']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
身份证:<?=$user['id_card']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
借书配额:<?=$user['borrow_num']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
用户类型:<?=$user['type']?'管理员':'普通用户'?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<a class="no-underline" href="/admin/users?page=<?=$_GET['page']?>"> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value="返回列表" /> |
|||
</a> |
|||
<a class="no-underline" href="/admin/do/delete-user?page=<?=$_GET['page']?>&uid=<?=$user['uid']?>"> |
|||
<input class="bg-magenta-dark hover:bg-magenta-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="button" value="确认删除" /> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,15 @@ |
|||
<?php $total = (int)(1+$count/20); ?> |
|||
<p class="text-indigo text-sm p-2">第 <?=$page?> / <?=$total?> 页</p> |
|||
<?php if ($page > 2) { ?> |
|||
<a href="<?=$path?>?page=1" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-3 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">首页</a> |
|||
<?php } if ($page == 1) { ?> |
|||
<a class="no-underline bg-grey text-white text-sm px-3 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">上一页</a> |
|||
<?php } else { ?> |
|||
<a href="<?=$path?>?page=<?=$page-1?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-3 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">上一页</a> |
|||
<?php } if ($page == $total) { ?> |
|||
<a class="no-underline bg-grey text-white text-sm px-3 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">下一页</a> |
|||
<?php } else { ?> |
|||
<a href="<?=$path?>?page=<?=$page+1?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-3 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">下一页</a> |
|||
<?php } if ($total > 2 && $page < $total - 1) { ?> |
|||
<a href="<?=$path?>?page=<?=$total?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-3 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">尾页</a> |
|||
<?php } ?> |
@ -0,0 +1,68 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">库存管理</h2> |
|||
</div> |
|||
<?php if (isset($_GET['bid']) && is_numeric($_GET['bid'])) { ?> |
|||
<a href="/admin/add-stock?page=<?=$page?>&bid=<?=$_GET['bid']?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">添加库存</a> |
|||
<?php } ?> |
|||
</div> |
|||
<div class="px-6 md:px-0 mt-4 md:flex flex-wrap order-1 md:-order-1 md:shadow-md"> |
|||
<div class="p-4 px-6 w-full md:w-1/2 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<h4>库存列表</h4> |
|||
<table class="mt-4 w-full"> |
|||
<thead class="p-2 text-sm leading-loose border-b text-indigo"> |
|||
<tr> |
|||
<td>书名</td> |
|||
<td class="hidden js-mobile-hidden">书架号</td> |
|||
<td class="hidden js-mobile-hidden">ISBN</td> |
|||
<td class="text-center hidden js-mobile-hidden">受损程度</td> |
|||
<td class="text-center">借阅状态</td> |
|||
<td class="text-right">操作</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody class="p-2 leading-loose text-sm"> |
|||
<?php if (isset($books[0]['bid'])) { |
|||
foreach ($books as $book) { ?><tr class="border-b"> |
|||
<td class="py-2"><?=$book['name']?></td> |
|||
<td class="py-2 hidden js-mobile-hidden"><?=$book['place']?></td> |
|||
<td class="py-2 hidden js-mobile-hidden"><?=$book['isbn']?></td> |
|||
<td class="py-2 text-center hidden js-mobile-hidden"><?=$book['health']?($book['health']==2?'破损':'中等'):'正常'?></td> |
|||
<td class="py-2 text-center"><?=$book['state']?'借出':'在馆'?></td> |
|||
<td class="py-2 text-right"> |
|||
<a href="/admin/update-stock?page=<?=$page?>&sid=<?=$book['sid']?>&bid=<?=$book['bid']?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">更新</a> |
|||
<a href="/admin/delete-stock?page=<?=$page?>&sid=<?=$book['sid']?>&bid=<?=$book['bid']?>" class="no-underline bg-magenta-dark hover:bg-magenta-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">删除</a> |
|||
</td> |
|||
</tr> |
|||
<?php } |
|||
} else { ?> |
|||
<tr class="border-b"> |
|||
<td class="py-2">没有库存</td> |
|||
</td> |
|||
<?php } ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div class="w-full md:w-1/2 p-4 md:pt-12 md:pl-1 mt-4 md:mt-0 lg:pt-12 lg:pl-8 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<div class="flex"> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">剩余库存</p> |
|||
<p class="font-medium text-sm pl-2"><?=$stock?></p> |
|||
</div> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">库存总量</p> |
|||
<p class="font-medium text-sm pl-2"><?=$count?></p> |
|||
</div> |
|||
</div> |
|||
<div class="pt-6"> |
|||
<?php $path = '/admin/books'; require(APP_ROOT.'/src/template/admins/page_switch.php'); ?> |
|||
<?php if (isset($_GET['bid']) && is_numeric($_GET['bid'])) { ?> |
|||
<a href="/admin/books?page=<?=$_GET['books']?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">返回列表</a> |
|||
<a href="/admin/stock" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">所有库存</a> |
|||
<?php } ?> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,47 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">更新书籍</h2> |
|||
<p class="text-grey-dark mt-2">留空则不作修改</p> |
|||
<form action="/admin/do/update-book?page=<?=$_GET['page']?>&bid=<?=$book['bid']?>" method="post"> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书 名:<input type="text" name="name" value="<?=$book['name']?>" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
作 者:<input type="text" name="author" value="<?=$book['author']?>" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
出版社:<input type="text" name="publish" value="<?=$book['publish']?>" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
ISBN:<input type="text" name="isbn" value="<?=$book['isbn']?>" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
封面图片:<input type="text" name="cover" value="<?=$book['cover']?>" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍类型:<select name="type"> |
|||
<?php foreach ($categories as $category) { ?> |
|||
<option value="<?=$category['cid']?>"<?=$category['cid']==$book['cid']?' selected':''?>><?=$category['name']?></option> |
|||
<?php } ?> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍语言:<select name="lang"> |
|||
<option value="zh-cn"<?=$book['lang']=='zh-cn'?' selected':''?>>简体中文</option> |
|||
<option value="en-us"<?=$book['lang']=='en-us'?' selected':''?>>英文</option> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 更 新 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,22 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">更新分类</h2> |
|||
<p class="text-grey-dark mt-2">留空则不作修改</p> |
|||
<form action="/admin/do/update-category?page=<?=$_GET['page']?>&cid=<?=$_GET['cid']?>" method="post"> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
出版社:<input type="text" name="name" value="<?=$category['name']?>"/> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 更 新 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,56 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">更新库存</h2> |
|||
<form action="/admin/do/update-stock?page=<?=$_GET['page']?>&sid=<?=$_GET['sid']?>&bid=<?=$_GET['bid']?>" method="post"> |
|||
<p class="mt-2"> |
|||
|
|||
</p> |
|||
<img src="<?=$book['cover']?>" /> |
|||
<p class="text-grey-dark mt-2"> |
|||
书 名:<?=$book['name']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
作 者:<?=$book['author']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
出版社:<?=$book['publish']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
ISBN:<?=$book['isbn']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍类型:<?php foreach ($categories as $category) if ($category['cid'] == $book['cid']) echo $category['name']; ?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书籍语言:<?=$book['lang']=='zh-cn'?'简体中文':'英文'?> |
|||
</p> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
书架号:<input type="text" name="place" value="<?=$book['place']?>" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
受损程度:<select name="health"> |
|||
<option value="0"<?=$book['health']==0?' selected':''?>>正常</option> |
|||
<option value="1"<?=$book['health']==1?' selected':''?>>中等</option> |
|||
<option value="2"<?=$book['health']==2?' selected':''?>>受损</option> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
借阅状态:<select name="state"> |
|||
<option value="0"<?=$book['state']==0?' selected':''?>>在馆</option> |
|||
<option value="1"<?=$book['state']==1?' selected':''?>>借出</option> |
|||
</select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 更 新 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,45 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">更新用户</h2> |
|||
<p class="text-grey-dark mt-2">留空则不作修改</p> |
|||
<form action="/admin/do/update-user?page=<?=$_GET['page']?>&uid=<?=$user['uid']?>" method="post"> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
用户名:<?=$user['username']?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
性 别:<select name="sex"> |
|||
<option value="1" <?=$user['sex']?'selected':''?>>男</option><option value="0" <?=$user['sex']?'':'selected'?>>女</option></select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
生 日:<input type="text" name="birthday" value="<?=$user['birthday']?>"/> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
身份证:<input type="text" name="id_card" value="<?=$user['id_card']?>"/> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
借书配额:<input type="text" name="borrow_num" value="<?=$user['borrow_num']?>"/> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
用户类型:<select name="type"> |
|||
<option value="1" <?=$user['type']?'selected':''?>>管理员</option><option value="0" <?=$user['type']?'':'selected'?>>普通用户</option></select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
密 码:<input type="password" name="password" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
重复密码:<input type="password" name="confirm" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 更 新 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,64 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">用户管理</h2> |
|||
</div> |
|||
<a href="/admin/add-user?page=<?=$page?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">添加用户</a> |
|||
</div> |
|||
<div class="px-6 md:px-0 mt-4 md:flex flex-wrap order-1 md:-order-1 md:shadow-md"> |
|||
<div class="p-4 px-6 w-full md:w-1/2 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<h4>用户列表</h4> |
|||
<table class="mt-4 w-full"> |
|||
<thead class="p-2 text-sm leading-loose border-b text-indigo"> |
|||
<tr> |
|||
<td>用户名</td> |
|||
<td class="hidden js-mobile-hidden">性别</td> |
|||
<td class="text-center hidden js-mobile-hidden">生日</td> |
|||
<td class="text-center hidden js-mobile-hidden">身份证</td> |
|||
<td class="text-right hidden js-mobile-hidden">借书配额</td> |
|||
<td class="text-right">用户类型</td> |
|||
<td class="text-right">操作</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody class="p-2 leading-loose text-sm"> |
|||
<?php if (isset($users[0]['uid'])) { |
|||
foreach ($users as $user) { ?><tr class="border-b"> |
|||
<td class="py-2"><?=$user['username']?></td> |
|||
<td class="py-2 hidden js-mobile-hidden"><?=$user['sex']?'男':'女'?></td> |
|||
<td class="py-2 text-center hidden js-mobile-hidden"><?=$user['birthday']?></td> |
|||
<td class="py-2 text-center hidden js-mobile-hidden"><?=$user['id_card']?></td> |
|||
<td class="py-2 text-right hidden js-mobile-hidden"><?=$user['borrow_num']?></td> |
|||
<td class="py-2 text-right"><?=$user['type']?'管理员':'普通用户'?></td> |
|||
<td class="py-2 text-right"> |
|||
<a href="/admin/update-user?page=<?=$page?>&uid=<?=$user['uid']?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">更新</a> |
|||
<a href="/admin/delete-user?page=<?=$page?>&uid=<?=$user['uid']?>" class="no-underline bg-magenta-dark hover:bg-magenta-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">删除</a> |
|||
</td> |
|||
</tr> |
|||
<?php } |
|||
} else { ?> |
|||
<tr class="border-b"> |
|||
<td class="py-2">没有用户</td> |
|||
</td> |
|||
<?php } ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div class="w-full md:w-1/2 p-4 md:pt-12 md:pl-1 mt-4 md:mt-0 lg:pt-12 lg:pl-8 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<div class="flex"> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">用户数量</p> |
|||
<p class="font-medium text-sm pl-2"><?=$count?></p> |
|||
</div> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">借出书籍</p> |
|||
<p class="font-medium text-sm pl-2"><?=$stock?></p> |
|||
</div> |
|||
</div> |
|||
<div class="pt-6"> |
|||
<?php $path = '/admin/users'; require(APP_ROOT.'/src/template/admins/page_switch.php'); ?> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,65 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">库存查询</h2> |
|||
</div> |
|||
<a onClick="javascript:history.back(-1);" class="no-underline cursor-pointer bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">返回上页</a> |
|||
</div> |
|||
<div class="px-6 md:px-0 mt-4 md:flex flex-wrap order-1 md:-order-1 md:shadow-md"> |
|||
<div class="p-4 px-6 w-full md:w-1/2 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<h4>库存列表</h4> |
|||
<table class="mt-4 w-full"> |
|||
<thead class="p-2 text-sm leading-loose border-b text-indigo"> |
|||
<tr> |
|||
<td>书名</td> |
|||
<td class="hidden js-mobile-hidden">书架号</td> |
|||
<td class="hidden js-mobile-hidden">ISBN</td> |
|||
<td class="text-center hidden js-mobile-hidden">受损程度</td> |
|||
<td class="text-center">借阅状态</td> |
|||
<td class="text-right">操作</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody class="p-2 leading-loose text-sm"> |
|||
<?php if (isset($books[0]['bid'])) { |
|||
foreach ($books as $book) { ?><tr class="border-b"> |
|||
<td class="py-2"><?=$book['name']?></td> |
|||
<td class="py-2 hidden js-mobile-hidden"><?=$book['place']?></td> |
|||
<td class="py-2 hidden js-mobile-hidden"><?=$book['isbn']?></td> |
|||
<td class="py-2 text-center hidden js-mobile-hidden"><?=$book['health']?($book['health']==2?'破损':'中等'):'正常'?></td> |
|||
<td class="py-2 text-center"><?=$book['state']?'借出':'在馆'?></td> |
|||
<td class="py-2 text-right"> |
|||
<?php if ($book['state']) { ?> |
|||
<a class="no-underline bg-grey text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">借阅</a> |
|||
<?php } else { ?> |
|||
<a href="/user/update-stock?page=<?=$page?>&sid=<?=$book['sid']?>&bid=<?=$book['bid']?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">借阅</a> |
|||
<?php } ?> |
|||
</td> |
|||
</tr> |
|||
<?php } |
|||
} else { ?> |
|||
<tr class="border-b"> |
|||
<td class="py-2">没有可用库存</td> |
|||
</td> |
|||
<?php } ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div class="w-full md:w-1/2 p-4 md:pt-12 md:pl-1 mt-4 md:mt-0 lg:pt-12 lg:pl-8 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<div class="flex"> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">剩余库存</p> |
|||
<p class="font-medium text-sm pl-2"><?=$stock?></p> |
|||
</div> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">库存总量</p> |
|||
<p class="font-medium text-sm pl-2"><?=$count?></p> |
|||
</div> |
|||
</div> |
|||
<div class="pt-6"> |
|||
<?php $path = '/admin/books'; require(APP_ROOT.'/src/template/admins/page_switch.php'); ?> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,42 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">热门书籍</h2> |
|||
</div> |
|||
</div> |
|||
<!-- Filter --> |
|||
<div class="px-6 md:px-0 flex items-baseline justify-between border-b-2 border-grey-light mt-6 order-0 lg:order-1"></div> |
|||
<!-- Library --> |
|||
<div class="hidden px-2 pt-2 md:px-0 flex-wrap order-2 pb-8 js-tab-pane active" id="section-library"> |
|||
<?php if (isset($books[0]['bid'])) { |
|||
foreach ($books as $book) { ?> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4 js-book" data-href="/book/<?=$book['bid']?>"> |
|||
<img src="<?=$book['cover']?>" class="w-1/3 sm:w-full shadow-md transition-normal hover:brighter hover:translate-y-1 hover:shadow-lg hover:border-indigo"> |
|||
<div class="ml-3 sm:ml-0 w-2/3 sm:w-full"> |
|||
<p class="text-sm my-2 font-medium sm:font-normal">《<?=$book['name']?>》</p> |
|||
<p class="block text-grey-dark sm:hidden mt-2 mb-3 text-sm leading-medium"> |
|||
<?php foreach ($categories as $category) if ($category['cid'] == $book['cid']) echo $category['name']; ?> (<?=$book['author']?>-<?=$book['publish']?>) |
|||
</p> |
|||
<p class="block text-grey sm:hidden mt-2 mb-3 text-sm leading-medium"> |
|||
<?=$book['lang']=='zh-cn'?'简体中文':'英文'?> (ISBN: <?=$book['isbn']?>) |
|||
</p> |
|||
<label class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs"><?=$book['author']?></label> |
|||
<label class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs"><?=$book['publish']?></label> |
|||
<label class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs"><?php foreach ($categories as $category) if ($category['cid'] == $book['cid']) echo $category['name']; ?></label> |
|||
<label class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs"><?=$book['lang']=='zh-cn'?'简体中文':'英文'?></label> |
|||
<label class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs">ISBN: <?=$book['isbn']?></label> |
|||
</div> |
|||
</div> |
|||
<?php } ?> |
|||
<?php $path = '/'; require(APP_ROOT.'/src/template/defaults/page_switch.php'); ?> |
|||
<?php } else { ?> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4"> |
|||
<p class="text-2xl my-2 font-bold sm:font-bold">暂无热门数据</p> |
|||
</div> |
|||
<?php } ?> |
|||
</div> |
|||
</div> |
|||
<?php |
|||
if (isset($_SESSION['user'])) require(APP_ROOT.'/src/template/defaults/user_profile.php'); |
@ -0,0 +1,42 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">书籍列表</h2> |
|||
</div> |
|||
</div> |
|||
<!-- Filter --> |
|||
<div class="px-6 md:px-0 flex items-baseline justify-between border-b-2 border-grey-light mt-6 order-0 lg:order-1"></div> |
|||
<!-- Library --> |
|||
<div class="hidden px-2 pt-2 md:px-0 flex-wrap order-2 pb-8 js-tab-pane active" id="section-library"> |
|||
<?php if (isset($books[0]['bid'])) { |
|||
foreach ($books as $book) { ?> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4 js-book" data-href="/book/<?=$book['bid']?>"> |
|||
<img src="<?=$book['cover']?>" class="w-1/3 sm:w-full shadow-md transition-normal hover:brighter hover:translate-y-1 hover:shadow-lg hover:border-indigo"> |
|||
<div class="ml-3 sm:ml-0 w-2/3 sm:w-full"> |
|||
<p class="text-sm my-2 font-medium sm:font-normal">《<?=$book['name']?>》</p> |
|||
<p class="block text-grey-dark sm:hidden mt-2 mb-3 text-sm leading-medium"> |
|||
<?php foreach ($categories as $category) if ($category['cid'] == $book['cid']) echo $category['name']; ?> (<?=$book['author']?>-<?=$book['publish']?>) |
|||
</p> |
|||
<p class="block text-grey sm:hidden mt-2 mb-3 text-sm leading-medium"> |
|||
<?=$book['lang']=='zh-cn'?'简体中文':'英文'?> (ISBN: <?=$book['isbn']?>) |
|||
</p> |
|||
<label class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs"><?=$book['author']?></label> |
|||
<label class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs"><?=$book['publish']?></label> |
|||
<label class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs"><?php foreach ($categories as $category) if ($category['cid'] == $book['cid']) echo $category['name']; ?></label> |
|||
<label class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs"><?=$book['lang']=='zh-cn'?'简体中文':'英文'?></label> |
|||
<label class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs">ISBN: <?=$book['isbn']?></label> |
|||
</div> |
|||
</div> |
|||
<?php } ?> |
|||
<?php $path = '/lists'; require(APP_ROOT.'/src/template/defaults/page_switch.php'); ?> |
|||
<?php } else { ?> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4"> |
|||
<p class="text-2xl my-2 font-bold sm:font-bold">暂无书籍</p> |
|||
</div> |
|||
<?php } ?> |
|||
</div> |
|||
</div> |
|||
<?php |
|||
if (isset($_SESSION['user'])) require(APP_ROOT.'/src/template/defaults/user_profile.php'); |
@ -0,0 +1,17 @@ |
|||
<div class="m-auto text-center w-full"> |
|||
<?php $total = (int)(1+$count/20); ?> |
|||
<p class="text-indigo text-sm p-2 leading-medium">第 <?=$page?> / <?=$total?> 页<br> </p> |
|||
<?php if ($page > 2) { ?> |
|||
<a href="<?=$path?>?page=1" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm m-1 py-2 px-5 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">首页</a> |
|||
<?php } if ($page == 1) { ?> |
|||
<a class="no-underline bg-grey text-white text-sm m-1 py-2 px-5 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">上一页</a> |
|||
<?php } else { ?> |
|||
<a href="<?=$path?>?page=<?=$page-1?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm m-1 py-2 px-5 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">上一页</a> |
|||
<?php } if ($page == $total) { ?> |
|||
<a class="no-underline bg-grey text-white text-sm m-1 py-2 px-5 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">下一页</a> |
|||
<?php } else { ?> |
|||
<a href="<?=$path?>?page=<?=$page+1?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm m-1 py-2 px-5 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">下一页</a> |
|||
<?php } if ($total > 2 && $page < $total - 1) { ?> |
|||
<a href="<?=$path?>?page=<?=$total?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm m-1 py-2 px-5 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">尾页</a> |
|||
<?php } ?> |
|||
</div> |
@ -0,0 +1,44 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">搜索结果</h2> |
|||
</div> |
|||
</div> |
|||
<!-- Filter --> |
|||
<div class="px-6 md:px-0 flex items-baseline justify-between border-b-2 border-grey-light mt-6 order-0 lg:order-1"></div> |
|||
<!-- Picks --> |
|||
<div class="flex-wrap order-2 pt-0 md:pt-6 md:pb-8 js-tab-pane active"> |
|||
<?php if (empty($_GET['s'])) { ?> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full"> |
|||
<p class="text-2xl my-2 font-bold sm:font-bold">请在上方搜索框输入书名关键字 ~</p> |
|||
</div> |
|||
<?php } elseif (isset($books[0]['bid'])) { |
|||
foreach ($books as $book) { ?> |
|||
<div class="flex justify-start items-center p-5 px-6 w-full sm:w-1/2"> |
|||
<img src="<?=$book['cover']?>" alt="pick" class="shadow-md w-1/3"> |
|||
<div class="ml-4 mt-1 w-2/3"> |
|||
<p class="font-medium"><strong>《<?=$book['name']?>》</strong></p> |
|||
<p class="mt-3 text-sm"> |
|||
<?php foreach ($categories as $category) if ($category['cid'] == $book['cid']) echo $category['name']; ?> (<?=$book['author']?>-<?=$book['publish']?>) |
|||
</p> |
|||
<p class="mt-3 text-sm"> |
|||
<?=$book['lang']=='zh-cn'?'简体中文':'英文'?> (ISBN: <?=$book['isbn']?>) |
|||
</p> |
|||
<a href="/book/<?=$book['bid']?>" class="no-underline"> |
|||
<button class="shadow-md mt-3 bg-grey-lightest hover:bg-white text-indigo-darker text-xs py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">查询库存</button> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
<?php } ?> |
|||
<?php $path = '/search'; require(APP_ROOT.'/src/template/defaults/page_switch.php'); ?> |
|||
<?php } else { ?> |
|||
<div class="flex justify-start items-center p-5 px-6 w-full sm:w-1/2"> |
|||
<p class="text-2xl my-2 font-bold sm:font-bold">没有找到搜索结果呢 ...</p> |
|||
</div> |
|||
<?php } ?> |
|||
</div> |
|||
</div> |
|||
<?php |
|||
if (isset($_SESSION['user'])) require(APP_ROOT.'/src/template/defaults/user_profile.php'); |
@ -0,0 +1,41 @@ |
|||
<!-- Profile --> |
|||
<div class="hidden absolute pin-b z-10 lg:relative lg:block w-full lg:w-1/5 bg-grey-lighter-2 px-6 pt-10" id="profile"> |
|||
<div class="flex items-center mb-6"> |
|||
<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="avatar"> |
|||
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> |
|||
<g transform="translate(-1178.000000, -87.000000)"> |
|||
<g transform="translate(1159.000000, 0.000000)"> |
|||
<g transform="translate(0.000000, 87.000000)"> |
|||
<g transform="translate(19.000000, 0.000000)"> |
|||
<circle id="small-circle" fill="#005CAF" cx="30" cy="30" r="30"></circle> |
|||
<path id="moon" d="M30.5,49.7304688 C40.7172679,49.7304688 30.5,43.266096 30.5,33.0488281 C30.5,22.8315603 40.7172679,12 30.5,12 C20.2827321,12 11.0390625,20.6479665 11.0390625,30.8652344 C11.0390625,41.0825022 20.2827321,49.7304688 30.5,49.7304688 Z" fill="#A5DEE4"></path> |
|||
<circle id="big-circle" fill="#0B346E" cx="31" cy="31" r="11"></circle> |
|||
</g> |
|||
</g> |
|||
</g> |
|||
</g> |
|||
</g> |
|||
</svg> |
|||
<div class="ml-3"> |
|||
<?php if (isset($_SESSION['user'])) { ?> |
|||
<p>您好,<?=$_SESSION['user']['username']?> !</p> |
|||
<p class="text-grey-dark mt-1 text-sm">剩余借书配额:<?=$_SESSION['user']['borrow_num']-$records_count?>/<?=$_SESSION['user']['borrow_num']?></p> |
|||
<?php } else { ?> |
|||
<p>您好,访客用户 !</p> |
|||
<p class="text-grey-dark mt-1 text-sm">...</p> |
|||
<?php } ?> |
|||
</div> |
|||
</div> |
|||
<div class="my-4 border-t pt-4"> |
|||
<h3 class="text-indigo-dark font-normal"><strong>当前已借出书籍</strong>(共 <?=$records_count?> 本)</h3> |
|||
<div class="flex flex-wrap -ml-2 justify-start items-center"> |
|||
<?php if (isset($records[0]['rid'])) { |
|||
foreach ($records as $record) { ?> |
|||
<img src="<?=$record['cover']?>" data-href="/book/<?=$record['bid']?>" class="js-book w-1/6 lg:w-1/5 max-w-tiny shadow-md block m-2 transition-normal hover:brighter"> |
|||
<?php } |
|||
} else { ?> |
|||
<p class="block m-2 transition-normal">暂未借阅书籍</p> |
|||
<?php } ?> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,16 @@ |
|||
<div class="hidden p-4" id="popup"> |
|||
<h3 class="font-medium">Popeye Aug 2019</h3> |
|||
<p class="text-sm mt-2 mb-3">Curabitur quis ut pharetra odio id, vitae eros eget tristique maecenas, ullamcorper vitae.</p> |
|||
<div class="relative"> |
|||
<select class="block appearance-none w-full text-sm bg-white border border-grey-light hover:border-grey pl-3 py-1 pr-8 rounded shadow leading-normal focus:outline-none focus:shadow-outline" id="tippy-select"> |
|||
<option>Start</option> |
|||
<option>Loaned</option> |
|||
<option selected>Finished</option> |
|||
</select> |
|||
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-grey-darker"> |
|||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> |
|||
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" /> |
|||
</svg> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,43 @@ |
|||
<!-- Profile --> |
|||
<div class="hidden absolute pin-b z-10 lg:relative lg:block w-full lg:w-1/5 bg-grey-lighter-2 px-6 pt-10" id="profile"> |
|||
<div class="flex items-center mb-6"> |
|||
<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="avatar"> |
|||
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> |
|||
<g transform="translate(-1178.000000, -87.000000)"> |
|||
<g transform="translate(1159.000000, 0.000000)"> |
|||
<g transform="translate(0.000000, 87.000000)"> |
|||
<g transform="translate(19.000000, 0.000000)"> |
|||
<circle id="small-circle" fill="#005CAF" cx="30" cy="30" r="30"></circle> |
|||
<path id="moon" d="M30.5,49.7304688 C40.7172679,49.7304688 30.5,43.266096 30.5,33.0488281 C30.5,22.8315603 40.7172679,12 30.5,12 C20.2827321,12 11.0390625,20.6479665 11.0390625,30.8652344 C11.0390625,41.0825022 20.2827321,49.7304688 30.5,49.7304688 Z" fill="#A5DEE4"></path> |
|||
<circle id="big-circle" fill="#0B346E" cx="31" cy="31" r="11"></circle> |
|||
</g> |
|||
</g> |
|||
</g> |
|||
</g> |
|||
</g> |
|||
</svg> |
|||
<div class="ml-3"> |
|||
<p>Amie Chen</p> |
|||
<p class="text-grey-dark mt-1 text-sm">Joined since 2017</p> |
|||
</div> |
|||
</div> |
|||
<div class="my-4 border-t pt-4"> |
|||
<h3 class="text-indigo-dark font-normal">You have read <strong>4 of 30 books</strong> in 2019</h3> |
|||
<div class="flex flex-wrap -ml-2 justify-start items-center"> |
|||
<img src="./images/read-01.jpg" alt="read" class="w-1/6 lg:w-1/5 max-w-tiny shadow-md block m-2 transition-normal hover:brighter"> |
|||
<img src="./images/read-02.jpg" alt="read" class="w-1/6 lg:w-1/5 max-w-tiny shadow-md block m-2 transition-normal hover:brighter"> |
|||
<img src="./images/read-03.jpg" alt="read" class="w-1/6 lg:w-1/5 max-w-tiny shadow-md block m-2 transition-normal hover:brighter"> |
|||
<img src="./images/read-04.jpg" alt="read" class="w-1/6 lg:w-1/5 max-w-tiny shadow-md block m-2 transition-normal hover:brighter"> |
|||
</div> |
|||
</div> |
|||
<div class="mt-6"> |
|||
<p class="text-grey-dark mt-1 text-sm">Currently Reading</p> |
|||
<div class="flex items-start mt-2"> |
|||
<img src="./images/read-04.jpg" alt="read" class="w-1/6 lg:w-1/5 max-w-tiny shadow-md block transition-normal hover:brighter"> |
|||
<div class="ml-3"> |
|||
<p class="mt-1 leading-normal">Popular Lies* About Graphic Design</p> |
|||
<p class="text-indigo text-sm mt-1">15/250 pages</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,251 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">Art & Design</h2> |
|||
<p class="text-grey-dark mt-2">Interesting Stats</p> |
|||
</div> |
|||
<button class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">Add New Book</button> |
|||
</div> |
|||
<!-- Desktop Stats --> |
|||
<div class="hidden px-6 md:px-0 mt-4 md:flex flex-wrap order-1 md:-order-1 md:shadow-md js-tab-pane" id="section-stats"> |
|||
<div class="p-4 px-6 w-full md:w-1/2 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<h4>Your favourite authors in this category</h4> |
|||
<table class="mt-4 w-full"> |
|||
<thead class="p-2 text-sm leading-loose border-b text-indigo"> |
|||
<tr> |
|||
<td>Name</td> |
|||
<td class="text-center">Owned/Wishlist</td> |
|||
<td class="text-right">Nationality</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody class="p-2 leading-loose text-sm"> |
|||
<tr class="border-b"> |
|||
<td class="py-2">Yohji Yamamoto</td> |
|||
<td class="py-2 text-center">5/4</td> |
|||
<td class="py-2 text-right">Japan</td> |
|||
</tr> |
|||
<tr class="border-b"> |
|||
<td class="py-2">Sato Oki</td> |
|||
<td class="py-2 text-center">1/3</td> |
|||
<td class="py-2 text-right">Japan</td> |
|||
</tr> |
|||
<tr> |
|||
<td class="py-2">Amaya Arzuaga</td> |
|||
<td class="py-2 text-center">1/1</td> |
|||
<td class="py-2 text-right">Spain</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div class="w-full md:w-1/2 p-4 md:pt-12 md:pl-1 mt-4 md:mt-0 lg:pt-12 lg:pl-8 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<div class="flex"> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">Most read format</p> |
|||
<p class="font-medium text-sm pl-2">Print</p> |
|||
</div> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">Total read/own</p> |
|||
<p class="font-medium text-sm pl-2">4/7</p> |
|||
</div> |
|||
</div> |
|||
<div class="pt-6"> |
|||
<p class="text-indigo text-sm p-2">Most re-read book</p> |
|||
<p class="font-medium text-sm pl-2 leading-normal">Just My Type: A Book About Fonts |
|||
<br><span class="font-normal">by Simon Garfield</span></p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- Filter --> |
|||
<div class="px-6 md:px-0 flex items-baseline justify-between border-b-2 border-grey-light mt-6 order-0 lg:order-1"> |
|||
<h4 class="hidden md:inline-block text-grey-dark font-normal">Books</h4> |
|||
<div> |
|||
<div class="inline-block md:hidden no-underline border-indigo pb-2 px-2 text-sm mr-2 text-indigo-darkest hover:cursor-pointer js-tab relative" data-tab="section-stats">Stats</div> |
|||
<div class="no-underline inline-block border-indigo pb-2 px-2 text-sm mr-2 text-indigo-darkest hover:cursor-pointer js-tab active relative" data-tab="section-library">Library <span class="text-indigo text-xs">(7)</span></div> |
|||
<div class="no-underline inline-block border-indigo pb-2 px-2 text-sm text-indigo-darkest hover:cursor-pointer js-tab relative" data-tab="section-picks">Picks for you</div> |
|||
</div> |
|||
</div> |
|||
<!-- Library --> |
|||
<div class="hidden px-2 pt-2 md:px-0 flex-wrap order-2 pb-8 js-tab-pane active" id="section-library"> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4 js-book"> |
|||
<img src="/assets/img/book-01.jpg" alt="book-01" class="w-1/3 sm:w-full shadow-md transition-normal hover:brighter hover:translate-y-1 hover:shadow-lg hover:border-indigo"> |
|||
<div class="ml-3 sm:ml-0 w-2/3 sm:w-full"> |
|||
<p class="text-sm my-2 font-medium sm:font-normal">apartmento Aug 2019</p> |
|||
<p class="block sm:hidden mt-2 mb-3 text-sm leading-medium">Eu quo donec pellentesque, urna velit. Ultrices ante iaculis ligula praesent.</p> |
|||
<label for="" class="hidden sm:inline-block rounded-full libre-bg-grey text-white px-2 py-1/2 text-xs">Loaned</label> |
|||
<div class="block sm:hidden relative"> |
|||
<select class="block appearance-none w-full text-sm bg-white border border-grey-light hover:border-grey pl-3 py-1 pr-8 rounded shadow leading-normal focus:outline-none focus:shadow-outline"> |
|||
<option>Start</option> |
|||
<option>Loaned</option> |
|||
<option selected>Finished</option> |
|||
</select> |
|||
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-grey-darker"> |
|||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> |
|||
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" /> |
|||
</svg> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4"> |
|||
<img src="/assets/img/book-02.jpg" alt="book-02" class="w-1/3 sm:w-full shadow-md transition-normal hover:brighter hover:translate-y-1 hover:shadow-lg hover:border-indigo js-book"> |
|||
<div class="ml-3 sm:ml-0 w-2/3 sm:w-full"> |
|||
<p class="text-sm my-2 font-medium sm:font-normal">Popeye Aug 2019</p> |
|||
<p class="block sm:hidden mt-2 mb-3 text-sm leading-medium">Eu quo donec pellentesque, urna velit. Ultrices ante iaculis ligula praesent.</p> |
|||
<label for="" class="hidden sm:inline-block rounded-full libre-bg-yellow text-white px-2 py-1/2 text-xs">Started</label> |
|||
<div class="block sm:hidden relative"> |
|||
<select class="block appearance-none w-full text-sm bg-white border border-grey-light hover:border-grey pl-3 py-1 pr-8 rounded shadow leading-normal focus:outline-none focus:shadow-outline"> |
|||
<option>Start</option> |
|||
<option>Loaned</option> |
|||
<option>Reading</option> |
|||
<option selected>Finished</option> |
|||
</select> |
|||
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-grey-darker"> |
|||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> |
|||
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" /> |
|||
</svg> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4"> |
|||
<img src="/assets/img/book-03.jpg" alt="book-03" class="w-1/3 sm:w-full shadow-md transition-normal hover:brighter hover:translate-y-1 hover:shadow-lg hover:border-indigo js-book"> |
|||
<div class="ml-3 sm:ml-0 w-2/3 sm:w-full"> |
|||
<p class="text-sm my-2 font-medium sm:font-normal">Brutus Aug 2019</p> |
|||
<p class="block sm:hidden mt-2 mb-3 text-sm leading-medium">Eu quo donec pellentesque, urna velit. Ultrices ante iaculis ligula praesent.</p> |
|||
<label for="" class="hidden sm:inline-block rounded-full libre-bg-pink text-white px-2 py-1/2 text-xs">Reading</label> |
|||
<div class="block sm:hidden relative"> |
|||
<select class="block appearance-none w-full text-sm bg-white border border-grey-light hover:border-grey pl-3 py-1 pr-8 rounded shadow leading-normal focus:outline-none focus:shadow-outline"> |
|||
<option>Start</option> |
|||
<option>Loaned</option> |
|||
<option selected>Finished</option> |
|||
</select> |
|||
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-grey-darker"> |
|||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> |
|||
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" /> |
|||
</svg> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4"> |
|||
<img src="/assets/img/book-04.jpg" alt="book-04" class="w-1/3 sm:w-full shadow-md transition-normal hover:brighter hover:translate-y-1 hover:shadow-lg hover:border-indigo js-book"> |
|||
<div class="ml-3 sm:ml-0 w-2/3 sm:w-full"> |
|||
<p class="text-sm my-2 font-medium sm:font-normal">Harnako Aug 2019</p> |
|||
<p class="block sm:hidden mt-2 mb-3 text-sm leading-medium">Eu quo donec pellentesque, urna velit. Ultrices ante iaculis ligula praesent.</p> |
|||
<label for="" class="hidden sm:inline-block rounded-full bg-indigo text-white px-2 py-1/2 text-xs">Finished</label> |
|||
<div class="block sm:hidden relative"> |
|||
<select class="block appearance-none w-full text-sm bg-white border border-grey-light hover:border-grey pl-3 py-1 pr-8 rounded shadow leading-normal focus:outline-none focus:shadow-outline"> |
|||
<option>Start</option> |
|||
<option>Loaned</option> |
|||
<option selected>Finished</option> |
|||
</select> |
|||
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-grey-darker"> |
|||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> |
|||
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" /> |
|||
</svg> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4"> |
|||
<img src="/assets/img/book-05.jpg" alt="book-05" class="w-1/3 sm:w-full shadow-md transition-normal hover:brighter hover:translate-y-1 hover:shadow-lg hover:border-indigo js-book"> |
|||
<div class="ml-3 sm:ml-0 w-2/3 sm:w-full"> |
|||
<p class="text-sm my-2 font-medium sm:font-normal">Premium 2 2019</p> |
|||
<p class="block sm:hidden mt-2 mb-3 text-sm leading-medium">Eu quo donec pellentesque, urna velit. Ultrices ante iaculis ligula praesent.</p> |
|||
<label for="" class="hidden sm:inline-block rounded-full bg-indigo text-white px-2 py-1/2 text-xs">Finished</label> |
|||
<div class="block sm:hidden relative"> |
|||
<select class="block appearance-none w-full text-sm bg-white border border-grey-light hover:border-grey pl-3 py-1 pr-8 rounded shadow leading-normal focus:outline-none focus:shadow-outline"> |
|||
<option>Start</option> |
|||
<option>Loaned</option> |
|||
<option selected>Finished</option> |
|||
</select> |
|||
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-grey-darker"> |
|||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> |
|||
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" /> |
|||
</svg> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4"> |
|||
<img src="/assets/img/book-06.jpg" alt="book-06" class="w-1/3 sm:w-full shadow-md transition-normal hover:brighter hover:translate-y-1 hover:shadow-lg hover:border-indigo js-book"> |
|||
<div class="ml-3 sm:ml-0 w-2/3 sm:w-full"> |
|||
<p class="text-sm my-2 font-medium sm:font-normal">Premium 4 2019</p> |
|||
<p class="block sm:hidden mt-2 mb-3 text-sm leading-medium">Eu quo donec pellentesque, urna velit. Ultrices ante iaculis ligula praesent.</p> |
|||
<label for="" class="hidden sm:inline-block rounded-full bg-indigo text-white px-2 py-1/2 text-xs">Finished</label> |
|||
<div class="block sm:hidden relative"> |
|||
<select class="block appearance-none w-full text-sm bg-white border border-grey-light hover:border-grey pl-3 py-1 pr-8 rounded shadow leading-normal focus:outline-none focus:shadow-outline"> |
|||
<option>Start</option> |
|||
<option>Loaned</option> |
|||
<option selected>Finished</option> |
|||
</select> |
|||
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-grey-darker"> |
|||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> |
|||
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" /> |
|||
</svg> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex flex-row sm:flex-col items-center sm:items-start w-full xs:w-1/2 sm:w-1/3 md:w-1/5 p-4"> |
|||
<img src="/assets/img/book-07.jpg" alt="book-07" class="w-1/3 sm:w-full shadow-md transition-normal hover:brighter hover:translate-y-1 hover:shadow-lg hover:border-indigo js-book"> |
|||
<div class="ml-3 sm:ml-0 w-2/3 sm:w-full"> |
|||
<p class="text-sm my-2 font-medium sm:font-normal">Brutus Aug 2019</p> |
|||
<p class="block sm:hidden mt-2 mb-3 text-sm leading-medium">Eu quo donec pellentesque, urna velit. Ultrices ante iaculis ligula praesent.</p> |
|||
<label for="" class="hidden sm:inline-block rounded-full libre-bg-pink text-white px-2 py-1/2 text-xs">Reading</label> |
|||
<div class="block sm:hidden relative"> |
|||
<select class="block appearance-none w-full text-sm bg-white border border-grey-light hover:border-grey pl-3 py-1 pr-8 rounded shadow leading-normal focus:outline-none focus:shadow-outline"> |
|||
<option>Start</option> |
|||
<option>Loaned</option> |
|||
<option selected>Finished</option> |
|||
</select> |
|||
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-grey-darker"> |
|||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> |
|||
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" /> |
|||
</svg> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- Picks --> |
|||
<div class="hidden flex-wrap order-2 pt-0 md:pt-6 md:pb-8 js-tab-pane" id="section-picks"> |
|||
<div class="flex justify-start items-center p-5 px-6 w-full sm:w-1/2" style="background-color:#FBC164;"> |
|||
<img src="/assets/img/pick-1.jpg" alt="pick" class="shadow-md w-1/3"> |
|||
<div class="ml-4 mt-1 w-2/3"> |
|||
<p class="font-medium">Popeye Jul 2019</p> |
|||
<p class="mt-3 text-sm">Eu quo donec pellentesque, urna velit. Ultrices ante iaculis ligula praesent</p> |
|||
<button class="shadow-md mt-3 bg-grey-lightest hover:bg-white text-indigo-darker text-xs py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">Add to Wishlist</button> |
|||
</div> |
|||
</div> |
|||
<div class="flex justify-start items-center p-5 px-6 w-full sm:w-1/2" style="background-color:#F1CECD;"> |
|||
<img src="/assets/img/pick-2.jpg" alt="pick" class="shadow-md w-1/3"> |
|||
<div class="ml-4 mt-1 w-2/3"> |
|||
<p class="font-medium">Brutus Aug 2019</p> |
|||
<p class="mt-3 text-sm">Sapien eget, fermentum curabitur quis ut pharetra odio id, vitae eros eget maecenas, ullamcorper vitae.</p> |
|||
<button class="shadow-md mt-3 bg-grey-lightest hover:bg-white text-indigo-darker text-xs py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">Add to Wishlist</button> |
|||
</div> |
|||
</div> |
|||
<div class="flex justify-start items-center p-5 px-6 w-full sm:w-1/2" style="background-color:#ECE7E9;"> |
|||
<img src="/assets/img/pick-3.jpg" alt="pick" class="shadow-md w-1/3"> |
|||
<div class="ml-4 mt-1 w-2/3"> |
|||
<p class="font-medium">Casa Aug 2019</p> |
|||
<p class="mt-3 text-sm">Curabitur quis ut pharetra odio id, vitae eros eget tristique maecenas, ullamcorper vitae.</p> |
|||
<button class="shadow-md mt-3 bg-grey-lightest hover:bg-white text-indigo-darker text-xs py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">Add to Wishlist</button> |
|||
</div> |
|||
</div> |
|||
<div class="flex justify-start items-center p-5 px-6 w-full sm:w-1/2" style="background-color:#D0E3E8;"> |
|||
<img src="/assets/img/pick-4.jpg" alt="pick" class="shadow-md w-1/3"> |
|||
<div class="ml-4 mt-1 w-2/3"> |
|||
<p class="font-medium">SUPER: Jul 2019</p> |
|||
<p class="mt-3 text-sm">Eu quo donec pellentesque, urna velit. Ultrices ante iaculis ligula praesent</p> |
|||
<button class="shadow-md mt-3 bg-grey-lightest hover:bg-white text-indigo-darker text-xs py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">Add to Wishlist</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<?php |
|||
require(APP_ROOT.'/src/template/user_profile.php'); |
|||
require(APP_ROOT.'/src/template/defaults/example-popup.php'); |
@ -0,0 +1,5 @@ |
|||
</div> |
|||
|
|||
<script src="/assets/js/bundle.js" async defer></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,71 @@ |
|||
<!DOCTYPE html> |
|||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> |
|||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> |
|||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> |
|||
<!--[if gt IE 8]><!--> |
|||
<html class="no-js"> |
|||
<!--<![endif]--> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|||
<title><?=$title?> - <?=$GLOBALS['config']['name']?></title> |
|||
<meta name="description" content="A responsive web app template with common components like profile, list, tabs, menu views. Made for Codrops exclusively."> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<link rel="stylesheet" href="/assets/css/default.css"> |
|||
</head> |
|||
<body class="bg-grey-lighter font-sans antialiased"> |
|||
<!--[if lt IE 7]> |
|||
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p> |
|||
<![endif]--> |
|||
<div class="fixed bg-grey-lighter pin z-50 flex justify-center items-center" id="loading"> |
|||
<svg width="60px" height="60px" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="morphing"> |
|||
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> |
|||
<g transform="translate(-1178.000000, -87.000000)"> |
|||
<g transform="translate(1159.000000, 0.000000)"> |
|||
<g transform="translate(0.000000, 87.000000)"> |
|||
<g transform="translate(19.000000, 0.000000)"> |
|||
<circle id="small-circle" fill="#005CAF" cx="30" cy="30" r="30"></circle> |
|||
<path id="moon" d="M30.5,49.7304688 C40.7172679,49.7304688 30.5,43.266096 30.5,33.0488281 C30.5,22.8315603 40.7172679,12 30.5,12 C20.2827321,12 11.0390625,20.6479665 11.0390625,30.8652344 C11.0390625,41.0825022 20.2827321,49.7304688 30.5,49.7304688 Z" fill="#A5DEE4"></path> |
|||
<circle id="big-circle" fill="#0B346E" cx="31" cy="31" r="11"></circle> |
|||
</g> |
|||
</g> |
|||
</g> |
|||
</g> |
|||
</g> |
|||
</svg> |
|||
</div> |
|||
<div class="bg-indigo-darker text-center p-4 px-6 flex items-center"> |
|||
<div class="hidden lg:block lg:w-1/4 xl:w-1/5 pr-8"> |
|||
<a href="/" class="flex justify-start pl-6"> |
|||
<img src="/assets/img/logo.svg" class="" alt="logo"> |
|||
</a> |
|||
</div> |
|||
<div class="lg:hidden pr-3" id="mobile-nav-trigger"> |
|||
<div class="toggle p-2 block"><span></span></div> |
|||
</div> |
|||
<div class="flex flex-grow items-center lg:w-3/4 xl:w-4/5"> |
|||
<span class="relative w-full"> |
|||
<form action="/search"> |
|||
<input type="search" name="s" value="<?=$_GET['s'] ?? ''?>" placeholder="搜索书名" class="w-full text-sm text-white transition border border-transparent focus:outline-none focus:border-indigo placeholder-white rounded bg-indigo-medium py-1 px-2 pl-10 appearance-none leading-normal ds-input"> |
|||
</form> |
|||
<div class="absolute search-icon" style="top: .5rem; left: .8rem;"> |
|||
<svg class="fill-current pointer-events-none text-white w-4 h-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> |
|||
<path d="M12.9 14.32a8 8 0 1 1 1.41-1.41l5.35 5.33-1.42 1.42-5.33-5.34zM8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12z"></path> |
|||
</svg> |
|||
</div> |
|||
</span> |
|||
<?php if (isset($_SESSION['user'])) { ?> |
|||
<p class="text-sm text-right text-white py-2 px-3 hidden lg:block lg:w-1/3 px-6"> |
|||
您好,<?=$_SESSION['user']['username']?> ! [<a class="no-underline text-white hover:text-grey-dark" href="/user/do/logout" >注销</a>] |
|||
</p> |
|||
<?php } else { ?> |
|||
<p class="text-sm text-right text-white py-2 px-3 hidden lg:block lg:w-1/3 px-6"> |
|||
您尚未 |
|||
<a class="no-underline text-white hover:text-grey-dark" href="/user/login" >登录</a> | |
|||
<a class="no-underline text-white hover:text-grey-dark" href="/user/register" >注册</a> |
|||
</p> |
|||
<?php } ?> |
|||
</div> |
|||
</div> |
|||
<!-- Main --> |
|||
<div class="flex"> |
@ -0,0 +1,67 @@ |
|||
<!-- Side Nav --> |
|||
<?php |
|||
$nav = [ |
|||
['name' => '首页', 'id' => 'index', 'svg' => 'home', 'href' => '/'], |
|||
['name' => '快捷功能', 'id' => 'categories', 'svg' => 'category', 'sidenav' => [ |
|||
['name' => '书籍列表', 'href' => '/lists'], |
|||
['name' => '书籍检索', 'href' => '/search'] |
|||
]], |
|||
['name' => '用户中心', 'id' => 'users', 'svg' => 'profile', 'sidenav' => [ |
|||
['name' => '个人资料', 'href' => '/user/info'], |
|||
['name' => '借书记录', 'href' => '/user/record'] |
|||
]], |
|||
['name' => '管理中心', 'id' => 'admins', 'svg' => 'wishlist', 'sidenav' => [ |
|||
['name' => '用户管理', 'href' => '/admin/users'], |
|||
['name' => '书籍管理', 'href' => '/admin/books'], |
|||
['name' => '库存管理', 'href' => '/admin/stock'], |
|||
['name' => '分类管理', 'href' => '/admin/categories'], |
|||
]] |
|||
]; |
|||
?> |
|||
<nav class="absolute lg:relative lg:flex lg:text-sm bg-indigo-darker lg:bg-transparent pin-l pin-r py-4 px-6 lg:pt-10 lg:pl-12 lg:pr-6 -mt-1 lg:mt-0 overflow-y-auto lg:w-1/5 lg:border-r z-40 hidden"> |
|||
<ul class="list-reset mb-8 w-full"> |
|||
<?php |
|||
foreach ($nav as $item) { |
|||
if (isset($item['sidenav'])) { |
|||
if ($item['id'] == 'admins' && !(isset($_SESSION['user']) && $_SESSION['user']['type'] == 1)) continue; ?> |
|||
<li class="ml-2 mb-4"> |
|||
<div class="flex" id="sidenav-<?=$item['id']?>-trigger"> |
|||
<img src="/assets/img/<?=$item['svg']?>-default.svg" alt="<?=$item['svg']?>-icon" class="w-4 h-4 mr-2"> |
|||
<div class="hover:cursor-pointer text-white lg:text-indigo-darkest no-underline font-medium w-full relative"> |
|||
<?=$item['name']."\n"?> |
|||
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-1 text-grey-darker" id="sidenav-<?=$item['id']?>-icon"> |
|||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> |
|||
<path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" /> |
|||
</svg> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<ul class="text-grey lg:text-grey-dark list-reset leading-loose mt-2" id="sidenav-<?=$item['id']?>"> |
|||
<?php foreach ($item['sidenav'] as $sidenav) { ?> |
|||
<?=gen_li_tag($sidenav['name'], $sidenav['href'])?> |
|||
<?php } ?> |
|||
</ul> |
|||
</li> |
|||
<?php } else { ?> |
|||
<li class="ml-2 mb-4 flex"> |
|||
<img src="/assets/img/<?=$item['svg']?>-default.svg" alt="<?=$item['svg']?>-icon" class="w-4 h-4 mr-2"> |
|||
<div class="font-medium mobile-home-trigger"> |
|||
<a class="hover:cursor-pointer text-white lg:text-indigo-darkest no-underline" href="<?=$item['href']?>"><?=$item['name']?></a> |
|||
</div> |
|||
</li> |
|||
<?php } |
|||
} |
|||
|
|||
function gen_li_tag($name, $href) { |
|||
return $href == explode('?', $_SERVER['REQUEST_URI'])[0] ? |
|||
'<li class="flex justify-between items-center transition-normal ml-1 border-l border-grey-dark pl-4 mobile-home-trigger">'. |
|||
'<a class="no-underline text-indigo-lighter lg:text-indigo-darker font-medium hover:cursor-pointer" href="'.$href.'">'. |
|||
'<span>'.$name.'</span>'. |
|||
'</a>'. |
|||
'</li>'."\n": |
|||
'<li class="transition-normal ml-1 border-l border-grey-dark pl-4">'. |
|||
'<a class="no-underline text-white lg:text-grey-dark hover:text-indigo-dark hover:cursor-pointer" href="'.$href.'">'.$name.'</a>'. |
|||
'</li>'."\n"; |
|||
} |
|||
?> |
|||
</nav> |
@ -0,0 +1,47 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">个人资料</h2> |
|||
</div> |
|||
<a href="/user/update" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">更新信息</a> |
|||
</div> |
|||
<div class="px-6 md:px-0 mt-4 md:flex flex-wrap order-1 md:-order-1 md:shadow-md" id="section-stats"> |
|||
<div class="p-4 px-6 w-full md:w-1/2 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<h4>基本信息</h4> |
|||
<div class="mt-4 w-full flex"> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">用户名</p> |
|||
<p class="font-medium text-sm pl-2"><?=$_SESSION['user']['username']?></p> |
|||
</div> |
|||
</div> |
|||
<div class="mt-4 w-full flex"> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">性别</p> |
|||
<p class="font-medium text-sm pl-2"><?=$_SESSION['user']['sex']?'男':'女'?></p> |
|||
</div> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">生日</p> |
|||
<p class="font-medium text-sm pl-2"><?=$_SESSION['user']['birthday']?></p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="w-full md:w-1/2 p-4 md:pt-12 md:pl-1 mt-4 md:mt-0 lg:pt-12 lg:pl-8 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<div class="pt-6"> |
|||
<p class="text-indigo text-sm p-2">身份证</p> |
|||
<p class="font-medium text-sm pl-2 leading-normal"><?=$_SESSION['user']['id_card']?></p> |
|||
</div> |
|||
<div class="flex"> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">借书配额</p> |
|||
<p class="font-medium text-sm pl-2"><?=$_SESSION['user']['borrow_num']?></p> |
|||
</div> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">访问级别</p> |
|||
<p class="font-medium text-sm pl-2"><?=$_SESSION['user']['type']?'管理员':'普通用户'?></p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,27 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">用户登录</h2> |
|||
<p class="mt-2"> |
|||
<a class="no-underline text-grey-dark" href="/user/register">没有账号?点我注册</a> |
|||
</p> |
|||
<form action="/user/do/login" method="post"> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
用户名:<input type="text" name="username" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
密 码:<input type="password" name="password" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 登 录 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,65 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">借书记录</h2> |
|||
</div> |
|||
<a href="/lists" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">借阅更多</a> |
|||
</div> |
|||
<div class="px-6 md:px-0 mt-4 md:flex flex-wrap order-1 md:-order-1 md:shadow-md"> |
|||
<div class="p-4 px-6 w-full md:w-1/2 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<h4>借阅列表</h4> |
|||
<table class="mt-4 w-full"> |
|||
<thead class="p-2 text-sm leading-loose border-b text-indigo"> |
|||
<tr> |
|||
<td>书名</td> |
|||
<td class="hidden js-mobile-hidden">作者</td> |
|||
<td class="hidden js-mobile-hidden">出版社</td> |
|||
<td class="text-center hidden js-mobile-hidden">ISBN</td> |
|||
<td class="text-right">借书日期</td> |
|||
<td class="text-right">还书日期</td> |
|||
</tr> |
|||
</thead> |
|||
<tbody class="p-2 leading-loose text-sm"> |
|||
<?php if (isset($books[0]['rid'])) { |
|||
foreach ($books as $book) { ?><tr class="border-b"> |
|||
<td class="py-2"><?=$book['name']?></td> |
|||
<td class="py-2 hidden js-mobile-hidden"><?=$book['author']?></td> |
|||
<td class="py-2 hidden js-mobile-hidden"><?=$book['publish']?></td> |
|||
<td class="py-2 text-center hidden js-mobile-hidden"><?=$book['isbn']?></td> |
|||
<td class="py-2 text-right"><?=date('Y-m-d', $book['borrow_time'])?></td> |
|||
<?php if ($book['state']) { ?> |
|||
<td class="py-2 text-right"><?=date('Y-m-d', $book['return_time'])?></td> |
|||
<?php } else { ?> |
|||
<td class="py-2 text-right"> |
|||
<a href="/user/update-record?page=<?=$page?>&rid=<?=$book['rid']?>&sid=<?=$book['sid']?>" class="no-underline bg-indigo-dark hover:bg-indigo-darker text-white text-sm px-1 transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none">归还</a> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php } |
|||
} else { ?> |
|||
<tr class="border-b"> |
|||
<td class="py-2">没有记录</td> |
|||
</td> |
|||
<?php } ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div class="w-full md:w-1/2 p-4 md:pt-12 md:pl-1 mt-4 md:mt-0 lg:pt-12 lg:pl-8 rounded md:rounded-r-none bg-white shadow-md md:shadow-none"> |
|||
<div class="flex"> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">借书配额</p> |
|||
<p class="font-medium text-sm pl-2"><?=$stock?>/<?=$_SESSION['user']['borrow_num']?></p> |
|||
</div> |
|||
<div class="w-1/2"> |
|||
<p class="text-indigo text-sm p-2">访问级别</p> |
|||
<p class="font-medium text-sm pl-2"><?=$_SESSION['user']['type']?'管理员':'普通用户'?></p> |
|||
</div> |
|||
</div> |
|||
<div class="pt-6"> |
|||
<?php $path = '/admin/books'; require(APP_ROOT.'/src/template/admins/page_switch.php'); ?> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,33 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">用户注册</h2> |
|||
<p class="mt-2"> |
|||
<a class="no-underline text-grey-dark" href="/user/login">已有账号?点我登录</a> |
|||
</p> |
|||
<form action="/user/do/register" method="post"> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
用户名:<input type="text" name="username" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
身份证:<input type="text" name="id_card" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
密 码:<input type="password" name="password" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
重复密码:<input type="password" name="confirm" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 注 册 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,32 @@ |
|||
<!-- Content --> |
|||
<div class="flex flex-1 flex-col md:px-6 pt-10" id="content"> |
|||
<!-- Title --> |
|||
<div class="px-6 md:px-0 flex justify-between items-center -order-1"> |
|||
<div> |
|||
<h2 class="font-normal">更新信息</h2> |
|||
<p class="text-grey-dark mt-2">留空则不作修改</p> |
|||
<form action="/user/do/update" method="post"> |
|||
<p class="mt-2" style="color:red"> |
|||
<?=strip_tags($_GET['error']??' ')?> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
性 别:<select name="sex"> |
|||
<option value="1" <?=$_SESSION['user']['sex']?'selected':''?>>男</option><option value="0" <?=$_SESSION['user']['sex']?'':'selected'?>>女</option></select> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
生 日:<input type="text" name="birthday" value="<?=$_SESSION['user']['birthday']?>"/> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
密 码:<input type="password" name="password" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
重复密码:<input type="password" name="confirm" /> |
|||
</p> |
|||
<p class="text-grey-dark mt-2"> |
|||
|
|||
</p> |
|||
<input class="bg-indigo-dark hover:bg-indigo-darker text-white text-sm py-2 px-4 rounded-full transition-normal hover:shadow hover:translate-y-1 active:translate-y-1 focus:outline-none" type="submit" value=" 更 新 " /> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
Loading…
Reference in new issue