批量更新
This commit is contained in:
@@ -11,7 +11,7 @@ use think\facade\Request;
|
|||||||
use app\admin\controller\Log;
|
use app\admin\controller\Log;
|
||||||
use app\admin\controller\BaseController;
|
use app\admin\controller\BaseController;
|
||||||
|
|
||||||
class Article extends BaseController
|
class ArticlesController extends BaseController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 获取控制器名称
|
* 获取控制器名称
|
||||||
@@ -428,16 +428,64 @@ class Article extends BaseController
|
|||||||
|
|
||||||
//统计文章数量
|
//统计文章数量
|
||||||
public function counts() {
|
public function counts() {
|
||||||
$total = Articles::where('delete_time', null)
|
try {
|
||||||
->where('status', '<>', 3)
|
// 获取文章总数
|
||||||
->count();
|
$total = Articles::where('delete_time', null)
|
||||||
|
->where('status', '<>', 3)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
// 获取今日新增文章数
|
||||||
|
$today = strtotime(date('Y-m-d'));
|
||||||
|
$todayNew = Articles::where('delete_time', null)
|
||||||
|
->where('status', '<>', 3)
|
||||||
|
->where('create_time', '>=', $today)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
// 获取最近7天的文章数据
|
||||||
|
$dates = [];
|
||||||
|
$counts = [];
|
||||||
|
$totalCounts = []; // 存储每天的总文章数
|
||||||
|
$totalSoFar = 0; // 用于累计总文章数
|
||||||
|
|
||||||
return json([
|
for ($i = 6; $i >= 0; $i--) {
|
||||||
'code' => 0,
|
$date = date('Y-m-d', strtotime("-$i days"));
|
||||||
'msg' => '获取成功',
|
$start = strtotime($date);
|
||||||
'data' => [
|
$end = $start + 86400;
|
||||||
'total' => $total
|
|
||||||
]
|
// 获取当天新增文章数
|
||||||
]);
|
$count = Articles::where('delete_time', null)
|
||||||
|
->where('status', '<>', 3)
|
||||||
|
->where('create_time', '>=', $start)
|
||||||
|
->where('create_time', '<', $end)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
// 获取截至当天的总文章数
|
||||||
|
$totalCount = Articles::where('delete_time', null)
|
||||||
|
->where('status', '<>', 3)
|
||||||
|
->where('create_time', '<', $end)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$dates[] = $date;
|
||||||
|
$counts[] = $count;
|
||||||
|
$totalCounts[] = $totalCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return json([
|
||||||
|
'code' => 0,
|
||||||
|
'msg' => '获取成功',
|
||||||
|
'data' => [
|
||||||
|
'total' => $total,
|
||||||
|
'todayNew' => $todayNew,
|
||||||
|
'dates' => $dates,
|
||||||
|
'counts' => $counts,
|
||||||
|
'totalCounts' => $totalCounts
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return json([
|
||||||
|
'code' => 1,
|
||||||
|
'msg' => '获取失败:' . $e->getMessage()
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,18 +4,25 @@
|
|||||||
*/
|
*/
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
use app\admin\controller\Base;
|
use app\admin\controller\Base;
|
||||||
|
use app\admin\model\DailyStats;
|
||||||
|
use app\admin\model\Log\LogsOperation;
|
||||||
|
use app\index\model\Attachments;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use think\facade\Env;
|
use think\facade\Env;
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
|
use app\admin\controller\Log;
|
||||||
|
|
||||||
class Index extends Base{
|
use app\admin\model\AdminUserGroup;
|
||||||
|
use app\admin\model\AdminSysMenu;
|
||||||
|
|
||||||
|
class IndexController extends Base{
|
||||||
# 首页
|
# 首页
|
||||||
public function index(){
|
public function index(){
|
||||||
$menus = [];
|
$menus = [];
|
||||||
$menu = [];
|
$menu = [];
|
||||||
$where = ['group_id'=>$this->aUser['group_id']];
|
$where = ['group_id'=>$this->aUser['group_id']];
|
||||||
$role = Db::name('admin_user_group')->where($where)->find();
|
$role = AdminUserGroup::where($where)->find();
|
||||||
if($role){
|
if($role){
|
||||||
$role['rights'] = (isset($role['rights']) && $role['rights']) ? json_decode($role['rights'],true) : [];
|
$role['rights'] = (isset($role['rights']) && $role['rights']) ? json_decode($role['rights'],true) : [];
|
||||||
}
|
}
|
||||||
@@ -25,7 +32,7 @@ class Index extends Base{
|
|||||||
['status','=',1]
|
['status','=',1]
|
||||||
];
|
];
|
||||||
// 获取所有菜单
|
// 获取所有菜单
|
||||||
$menus = Db::name('admin_sys_menu')->order('type,sort desc')->where($where)->select()->toArray();
|
$menus = AdminSysMenu::order('type,sort desc')->where($where)->select()->toArray();
|
||||||
|
|
||||||
// 构建树形结构菜单
|
// 构建树形结构菜单
|
||||||
$menuTree = [];
|
$menuTree = [];
|
||||||
@@ -63,21 +70,18 @@ class Index extends Base{
|
|||||||
public function welcome(){
|
public function welcome(){
|
||||||
// 获取今日统计数据
|
// 获取今日统计数据
|
||||||
$today = date('Y-m-d');
|
$today = date('Y-m-d');
|
||||||
$todayStats = Db::name('daily_stats')
|
$todayStats = DailyStats::where('date', $today)
|
||||||
->where('date', $today)
|
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
// 获取最近7天的访问趋势
|
// 获取最近7天的访问趋势
|
||||||
$last7Days = Db::name('daily_stats')
|
$last7Days = DailyStats::where('date', '>=', date('Y-m-d', strtotime('-7 days')))
|
||||||
->where('date', '>=', date('Y-m-d', strtotime('-7 days')))
|
|
||||||
->where('date', '<=', $today)
|
->where('date', '<=', $today)
|
||||||
->order('date', 'asc')
|
->order('date', 'asc')
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
// 获取用户增长趋势
|
// 获取用户增长趋势
|
||||||
$userGrowth = Db::name('daily_stats')
|
$userGrowth = DailyStats::where('date', '>=', date('Y-m-d', strtotime('-30 days')))
|
||||||
->where('date', '>=', date('Y-m-d', strtotime('-30 days')))
|
|
||||||
->where('date', '<=', $today)
|
->where('date', '<=', $today)
|
||||||
->field('date, new_users, total_users')
|
->field('date, new_users, total_users')
|
||||||
->order('date', 'asc')
|
->order('date', 'asc')
|
||||||
@@ -85,8 +89,7 @@ class Index extends Base{
|
|||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
// 获取资源下载统计
|
// 获取资源下载统计
|
||||||
$resourceStats = Db::name('daily_stats')
|
$resourceStats = DailyStats::where('date', '>=', date('Y-m-d', strtotime('-7 days')))
|
||||||
->where('date', '>=', date('Y-m-d', strtotime('-7 days')))
|
|
||||||
->where('date', '<=', $today)
|
->where('date', '<=', $today)
|
||||||
->field('date, daily_resources, resource_downloads')
|
->field('date, daily_resources, resource_downloads')
|
||||||
->order('date', 'asc')
|
->order('date', 'asc')
|
||||||
@@ -94,16 +97,26 @@ class Index extends Base{
|
|||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
// 获取文章访问统计
|
// 获取文章访问统计
|
||||||
$articleStats = Db::name('daily_stats')
|
$articleStats = DailyStats::where('date', '>=', date('Y-m-d', strtotime('-7 days')))
|
||||||
->where('date', '>=', date('Y-m-d', strtotime('-7 days')))
|
|
||||||
->where('date', '<=', $today)
|
->where('date', '<=', $today)
|
||||||
->field('date, daily_articles, article_views')
|
->field('date, daily_articles, article_views')
|
||||||
->order('date', 'asc')
|
->order('date', 'asc')
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
// 获取最近的活动记录
|
// 获取最近的操作日志
|
||||||
$recentActivities = $this->getRecentActivities();
|
$recentActivities = LogsOperation::field('operation_time, module, operation')
|
||||||
|
->order('operation_time desc')
|
||||||
|
->limit(10)
|
||||||
|
->select()
|
||||||
|
->each(function($item) {
|
||||||
|
// 格式化时间
|
||||||
|
$item['time'] = date('Y年m月d日 H:i:s', strtotime($item['operation_time']));
|
||||||
|
// 格式化操作内容
|
||||||
|
$item['content'] = date('Y年m月d日 H:i:s', strtotime($item['operation_time'])) . '在【' . $item['module'] . '】模块进行操作:' . $item['operation'];
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// 准备图表数据
|
// 准备图表数据
|
||||||
$chartData = [
|
$chartData = [
|
||||||
@@ -129,50 +142,21 @@ class Index extends Base{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取最近的活动记录
|
* 根据操作类型获取对应的图标
|
||||||
*/
|
*/
|
||||||
private function getRecentActivities()
|
private function getActivityIcon($type)
|
||||||
{
|
{
|
||||||
$today = date('Y-m-d');
|
$icons = [
|
||||||
$activities = [];
|
'用户管理' => '👥',
|
||||||
|
'文章管理' => '📝',
|
||||||
// 获取今日新用户
|
'资源管理' => '📦',
|
||||||
$newUsers = Db::name('daily_stats')
|
'系统设置' => '⚙️',
|
||||||
->where('date', $today)
|
'登录' => '🔑',
|
||||||
->value('new_users');
|
'退出' => '🚪',
|
||||||
if ($newUsers > 0) {
|
'其他' => '📌'
|
||||||
$activities[] = [
|
];
|
||||||
'icon' => '👥',
|
|
||||||
'title' => '新增用户 ' . $newUsers . ' 人',
|
return $icons[$type] ?? '📌';
|
||||||
'time' => '今日'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取今日文章
|
|
||||||
$newArticles = Db::name('daily_stats')
|
|
||||||
->where('date', $today)
|
|
||||||
->value('daily_articles');
|
|
||||||
if ($newArticles > 0) {
|
|
||||||
$activities[] = [
|
|
||||||
'icon' => '📝',
|
|
||||||
'title' => '发布文章 ' . $newArticles . ' 篇',
|
|
||||||
'time' => '今日'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取今日资源
|
|
||||||
$newResources = Db::name('daily_stats')
|
|
||||||
->where('date', $today)
|
|
||||||
->value('daily_resources');
|
|
||||||
if ($newResources > 0) {
|
|
||||||
$activities[] = [
|
|
||||||
'icon' => '📦',
|
|
||||||
'title' => '上传资源 ' . $newResources . ' 个',
|
|
||||||
'time' => '今日'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $activities;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -280,7 +264,7 @@ class Index extends Base{
|
|||||||
'create_time' => time(),
|
'create_time' => time(),
|
||||||
'update_time' => time()
|
'update_time' => time()
|
||||||
];
|
];
|
||||||
return Db::name('attachments')->insertGetId($data);
|
return Attachments::insertGetId($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
# 图片上传
|
# 图片上传
|
||||||
@@ -9,7 +9,7 @@ use think\facade\Cookie;
|
|||||||
use app\admin\model\Log\LogsLogin;
|
use app\admin\model\Log\LogsLogin;
|
||||||
use app\admin\model\Log\LogsOperation;
|
use app\admin\model\Log\LogsOperation;
|
||||||
|
|
||||||
class Log extends Base
|
class LogController extends Base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 登录日志列表
|
* 登录日志列表
|
||||||
@@ -13,10 +13,10 @@ use app\admin\model\YzAdminConfig;
|
|||||||
use app\admin\model\AdminUser;
|
use app\admin\model\AdminUser;
|
||||||
use app\admin\model\Log\LogsLogin;
|
use app\admin\model\Log\LogsLogin;
|
||||||
|
|
||||||
class Login
|
class LoginController extends Base
|
||||||
{
|
{
|
||||||
protected $app;
|
public $app;
|
||||||
protected $config;
|
public $config;
|
||||||
|
|
||||||
public function __construct(App $app)
|
public function __construct(App $app)
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@ class Login
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 记录登录日志
|
// 记录登录日志
|
||||||
protected function recordLoginLog($username, $status, $reason = '')
|
public function recordLoginLog($username, $status, $reason = '')
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
@@ -52,14 +52,14 @@ class Login
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取IP地址位置
|
// 获取IP地址位置
|
||||||
protected function getLocation($ip)
|
public function getLocation($ip)
|
||||||
{
|
{
|
||||||
// 这里可以接入IP地址库或第三方API
|
// 这里可以接入IP地址库或第三方API
|
||||||
return '未知';
|
return '未知';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取设备类型
|
// 获取设备类型
|
||||||
protected function getDeviceType()
|
public function getDeviceType()
|
||||||
{
|
{
|
||||||
$agent = Request::header('user-agent');
|
$agent = Request::header('user-agent');
|
||||||
if (preg_match('/(iPhone|iPod|Android|ios|iPad|Mobile)/i', $agent)) {
|
if (preg_match('/(iPhone|iPod|Android|ios|iPad|Mobile)/i', $agent)) {
|
||||||
@@ -12,7 +12,7 @@ use think\facade\Db;
|
|||||||
use app\admin\controller\Log;
|
use app\admin\controller\Log;
|
||||||
use think\App;
|
use think\App;
|
||||||
|
|
||||||
class Resources extends BaseController
|
class ResourcesController extends BaseController
|
||||||
{
|
{
|
||||||
// 资源列表
|
// 资源列表
|
||||||
public function lists()
|
public function lists()
|
||||||
@@ -370,16 +370,64 @@ class Resources extends BaseController
|
|||||||
//统计资源数量
|
//统计资源数量
|
||||||
public function counts()
|
public function counts()
|
||||||
{
|
{
|
||||||
$total = Resource::where('delete_time', null)
|
try {
|
||||||
->where('status', '<>', 3)
|
// 获取资源总数
|
||||||
->count();
|
$total = Resource::where('delete_time', null)
|
||||||
return json([
|
->where('status', '<>', 3)
|
||||||
'code' => 0,
|
->count();
|
||||||
'msg' => '获取成功',
|
|
||||||
'data' => [
|
// 获取今日新增资源数
|
||||||
'total' => $total
|
$today = strtotime(date('Y-m-d'));
|
||||||
]
|
$todayNew = Resource::where('delete_time', null)
|
||||||
]);
|
->where('status', '<>', 3)
|
||||||
|
->where('create_time', '>=', $today)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
// 获取最近7天的资源数据
|
||||||
|
$dates = [];
|
||||||
|
$counts = [];
|
||||||
|
$totalCounts = []; // 存储每天的总资源数
|
||||||
|
|
||||||
|
for ($i = 6; $i >= 0; $i--) {
|
||||||
|
$date = date('Y-m-d', strtotime("-$i days"));
|
||||||
|
$start = strtotime($date);
|
||||||
|
$end = $start + 86400;
|
||||||
|
|
||||||
|
// 获取当天新增资源数
|
||||||
|
$count = Resource::where('delete_time', null)
|
||||||
|
->where('status', '<>', 3)
|
||||||
|
->where('create_time', '>=', $start)
|
||||||
|
->where('create_time', '<', $end)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
// 获取截至当天的总资源数
|
||||||
|
$totalCount = Resource::where('delete_time', null)
|
||||||
|
->where('status', '<>', 3)
|
||||||
|
->where('create_time', '<', $end)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$dates[] = $date;
|
||||||
|
$counts[] = $count;
|
||||||
|
$totalCounts[] = $totalCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return json([
|
||||||
|
'code' => 0,
|
||||||
|
'msg' => '获取成功',
|
||||||
|
'data' => [
|
||||||
|
'total' => $total,
|
||||||
|
'todayNew' => $todayNew,
|
||||||
|
'dates' => $dates,
|
||||||
|
'counts' => $counts,
|
||||||
|
'totalCounts' => $totalCounts
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return json([
|
||||||
|
'code' => 1,
|
||||||
|
'msg' => '获取失败:' . $e->getMessage()
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建树形结构
|
// 构建树形结构
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* 后台管理系统-用户管理
|
||||||
|
*/
|
||||||
|
namespace app\admin\controller;
|
||||||
|
use app\admin\controller\BaseController;
|
||||||
|
use think\facade\View;
|
||||||
|
use think\facade\Request;
|
||||||
|
use think\facade\Db;
|
||||||
|
use app\admin\controller\Log;
|
||||||
|
use think\App;
|
||||||
|
use app\admin\model\User\Users;
|
||||||
|
|
||||||
|
|
||||||
|
class UsersController extends BaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 统计用户数量
|
||||||
|
*/
|
||||||
|
public function counts()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// 统计用户总数
|
||||||
|
$total = Users::where('delete_time', 0)
|
||||||
|
->where('status', 1)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
// 获取今日新增用户数
|
||||||
|
$today = strtotime(date('Y-m-d'));
|
||||||
|
$todayNew = Users::where('delete_time', 0)
|
||||||
|
->where('status', 1)
|
||||||
|
->where('create_time', '>=', $today)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
// 获取最近7天的用户数据
|
||||||
|
$dates = [];
|
||||||
|
$counts = [];
|
||||||
|
$totalCounts = []; // 存储每天的总用户数
|
||||||
|
|
||||||
|
for ($i = 6; $i >= 0; $i--) {
|
||||||
|
$date = date('Y-m-d', strtotime("-$i days"));
|
||||||
|
$start = strtotime($date);
|
||||||
|
$end = $start + 86400;
|
||||||
|
|
||||||
|
// 获取当天新增用户数
|
||||||
|
$count = Users::where('delete_time', 0)
|
||||||
|
->where('status', 1)
|
||||||
|
->where('create_time', '>=', $start)
|
||||||
|
->where('create_time', '<', $end)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
// 获取截至当天的总用户数
|
||||||
|
$totalCount = Users::where('delete_time', 0)
|
||||||
|
->where('status', 1)
|
||||||
|
->where('create_time', '<', $end)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$dates[] = $date;
|
||||||
|
$counts[] = $count;
|
||||||
|
$totalCounts[] = $totalCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return json([
|
||||||
|
'code' => 0,
|
||||||
|
'msg' => '获取成功',
|
||||||
|
'data' => [
|
||||||
|
'total' => $total,
|
||||||
|
'todayNew' => $todayNew,
|
||||||
|
'dates' => $dates,
|
||||||
|
'counts' => $counts,
|
||||||
|
'totalCounts' => $totalCounts
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return json([
|
||||||
|
'code' => 1,
|
||||||
|
'msg' => '获取失败:' . $e->getMessage()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ use app\admin\model\AdminUserGroup;
|
|||||||
use app\admin\model\AdminConfig;
|
use app\admin\model\AdminConfig;
|
||||||
use app\admin\model\ZIconfont;
|
use app\admin\model\ZIconfont;
|
||||||
|
|
||||||
class Yunzer extends Base{
|
class YunzerController extends Base{
|
||||||
# 菜单列表
|
# 菜单列表
|
||||||
public function menuinfo(){
|
public function menuinfo(){
|
||||||
$lists = AdminSysMenu::where('parent_id', 0)->order('sort DESC,smid DESC')->select();
|
$lists = AdminSysMenu::where('parent_id', 0)->order('sort DESC,smid DESC')->select();
|
||||||
+1
-1
@@ -11,7 +11,7 @@ use app\admin\model\AdminUser;
|
|||||||
use app\admin\model\Banner;
|
use app\admin\model\Banner;
|
||||||
|
|
||||||
|
|
||||||
class Yunzeradmin extends Base
|
class YunzeradminController extends Base
|
||||||
{
|
{
|
||||||
// 角色列表
|
// 角色列表
|
||||||
public function groupinfo()
|
public function groupinfo()
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\model;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
class ApiKey extends Model
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\model;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
class DailyStats extends Model
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\model\User;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
class Users extends Model
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -322,7 +322,7 @@
|
|||||||
// 初始化分类列表
|
// 初始化分类列表
|
||||||
that.initCategoryList = function () {
|
that.initCategoryList = function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/admin/article/articlecate',
|
url: '/admin/articles/articlecate',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
@@ -387,7 +387,7 @@
|
|||||||
|
|
||||||
// 加载分类信息
|
// 加载分类信息
|
||||||
that.loadCategoryInfo = function (id) {
|
that.loadCategoryInfo = function (id) {
|
||||||
$.get('/admin/article/cateedit?id=' + id, function (res) {
|
$.get('/admin/articles/cateedit?id=' + id, function (res) {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
that.showCategoryForm(0, res.data);
|
that.showCategoryForm(0, res.data);
|
||||||
}
|
}
|
||||||
@@ -413,7 +413,7 @@
|
|||||||
$select.empty().append('<option value="0">顶级分类</option>');
|
$select.empty().append('<option value="0">顶级分类</option>');
|
||||||
// 获取所有分类作为父级选项
|
// 获取所有分类作为父级选项
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/admin/article/articlecate',
|
url: '/admin/articles/articlecate',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
async: false,
|
async: false,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
@@ -472,7 +472,7 @@
|
|||||||
|
|
||||||
// 监听表单提交
|
// 监听表单提交
|
||||||
form.on('submit(saveCategory)', function (data) {
|
form.on('submit(saveCategory)', function (data) {
|
||||||
var url = data.field.id ? '/admin/article/cateedit' : '/admin/article/cateadd';
|
var url = data.field.id ? '/admin/articles/cateedit' : '/admin/articles/cateadd';
|
||||||
$.post(url, data.field, function (res) {
|
$.post(url, data.field, function (res) {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
layer.msg(res.msg, { icon: 1 });
|
layer.msg(res.msg, { icon: 1 });
|
||||||
@@ -490,7 +490,7 @@
|
|||||||
if (!id) return;
|
if (!id) return;
|
||||||
|
|
||||||
layer.confirm('确定要删除该分类吗?', function (index) {
|
layer.confirm('确定要删除该分类吗?', function (index) {
|
||||||
$.post('/admin/article/catedel', { id: id }, function (res) {
|
$.post('/admin/articles/catedel', { id: id }, function (res) {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
layer.msg(res.msg, { icon: 1 });
|
layer.msg(res.msg, { icon: 1 });
|
||||||
that.initCategoryList();
|
that.initCategoryList();
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
// 初始化表格
|
// 初始化表格
|
||||||
table.render({
|
table.render({
|
||||||
elem: '#articleTable',
|
elem: '#articleTable',
|
||||||
url: '/admin/article/articlelist',
|
url: '/admin/articles/articlelist',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
cols: [[
|
cols: [[
|
||||||
{ field: 'id', title: 'ID', align: 'center', width: 80 },
|
{ field: 'id', title: 'ID', align: 'center', width: 80 },
|
||||||
@@ -174,18 +174,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function add() {
|
function add() {
|
||||||
window.location.href = '/admin/article/add';
|
window.location.href = '/admin/articles/add';
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit(id) {
|
function edit(id) {
|
||||||
window.location.href = '/admin/article/edit?id=' + id;
|
window.location.href = '/admin/articles/edit?id=' + id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function del(id) {
|
function del(id) {
|
||||||
layer.confirm('确定要删除该文章吗?', {
|
layer.confirm('确定要删除该文章吗?', {
|
||||||
btn: ['确定', '取消']
|
btn: ['确定', '取消']
|
||||||
}, function () {
|
}, function () {
|
||||||
$.post('/admin/article/delete', { id: id }, function (res) {
|
$.post('/admin/articles/delete', { id: id }, function (res) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
layer.msg(res.msg, { icon: 1 });
|
layer.msg(res.msg, { icon: 1 });
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
@@ -161,8 +161,7 @@
|
|||||||
}
|
}
|
||||||
.activity-title {
|
.activity-title {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #1e293b;
|
color: #9b9b9b;
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
}
|
||||||
.activity-time {
|
.activity-time {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@@ -258,10 +257,9 @@
|
|||||||
<div class="activity-list">
|
<div class="activity-list">
|
||||||
{volist name="recentActivities" id="activity"}
|
{volist name="recentActivities" id="activity"}
|
||||||
<div class="activity-item">
|
<div class="activity-item">
|
||||||
<div class="activity-icon">{$activity.icon}</div>
|
<div class="activity-icon">{$activity.icon|default='📌'}</div>
|
||||||
<div class="activity-content">
|
<div class="activity-content">
|
||||||
<div class="activity-title">{$activity.title}</div>
|
<div class="activity-title">{$activity.content}</div>
|
||||||
<div class="activity-time">{$activity.time}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/volist}
|
{/volist}
|
||||||
@@ -314,6 +312,42 @@ function updateTime() {
|
|||||||
document.getElementById('current-time').innerHTML = timeString;
|
document.getElementById('current-time').innerHTML = timeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取用户统计数据
|
||||||
|
function getUserCounts() {
|
||||||
|
fetch('{:url("users/counts")}')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(res => {
|
||||||
|
console.log('用户统计接口返回数据:', res);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
// 更新用户总数
|
||||||
|
document.querySelector('.stat-card:nth-child(1) .stat-value').textContent = res.data.total.toLocaleString();
|
||||||
|
|
||||||
|
// 更新用户增长图表
|
||||||
|
if (window.userChart) {
|
||||||
|
window.userChart.setOption({
|
||||||
|
xAxis: {
|
||||||
|
data: res.data.dates
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '新增用户',
|
||||||
|
data: res.data.counts
|
||||||
|
}, {
|
||||||
|
name: '总用户数',
|
||||||
|
data: res.data.totalCounts
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('用户统计接口返回异常:', res);
|
||||||
|
document.querySelector('.stat-card:nth-child(1) .stat-value').textContent = '0';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('获取用户统计失败:', error);
|
||||||
|
document.querySelector('.stat-card:nth-child(1) .stat-value').textContent = '0';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 获取文章统计数据
|
// 获取文章统计数据
|
||||||
function getArticleCounts() {
|
function getArticleCounts() {
|
||||||
fetch('{:url("articles/counts")}')
|
fetch('{:url("articles/counts")}')
|
||||||
@@ -323,12 +357,30 @@ function getArticleCounts() {
|
|||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
// 更新文章总数
|
// 更新文章总数
|
||||||
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = res.data.total.toLocaleString();
|
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = res.data.total.toLocaleString();
|
||||||
|
|
||||||
|
// 更新文章统计图表
|
||||||
|
if (window.articleChart) {
|
||||||
|
window.articleChart.setOption({
|
||||||
|
xAxis: {
|
||||||
|
data: res.data.dates
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '新增文章',
|
||||||
|
data: res.data.counts
|
||||||
|
}, {
|
||||||
|
name: '总文章数',
|
||||||
|
data: res.data.totalCounts
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.warn('文章统计接口返回异常:', res);
|
console.warn('文章统计接口返回异常:', res);
|
||||||
|
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = '0';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('获取文章统计失败:', error);
|
console.error('获取文章统计失败:', error);
|
||||||
|
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = '0';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,12 +393,30 @@ function getResourcesCounts() {
|
|||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
// 更新资源总数
|
// 更新资源总数
|
||||||
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = res.data.total.toLocaleString();
|
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = res.data.total.toLocaleString();
|
||||||
|
|
||||||
|
// 更新资源统计图表
|
||||||
|
if (window.resourceChart) {
|
||||||
|
window.resourceChart.setOption({
|
||||||
|
xAxis: {
|
||||||
|
data: res.data.dates
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '新增资源',
|
||||||
|
data: res.data.counts
|
||||||
|
}, {
|
||||||
|
name: '总资源数',
|
||||||
|
data: res.data.totalCounts
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.warn('资源统计接口返回异常:', res);
|
console.warn('资源统计接口返回异常:', res);
|
||||||
|
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = '0';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('获取资源统计失败:', error);
|
console.error('获取资源统计失败:', error);
|
||||||
|
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = '0';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,6 +425,7 @@ setInterval(updateTime, 1000);
|
|||||||
|
|
||||||
// 页面加载完成后获取统计数据
|
// 页面加载完成后获取统计数据
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
getUserCounts();
|
||||||
getArticleCounts();
|
getArticleCounts();
|
||||||
getResourcesCounts();
|
getResourcesCounts();
|
||||||
});
|
});
|
||||||
@@ -433,6 +504,7 @@ function initVisitTrend() {
|
|||||||
// 用户增长图表
|
// 用户增长图表
|
||||||
function initUserGrowth() {
|
function initUserGrowth() {
|
||||||
var chart = echarts.init(document.getElementById('userGrowth'));
|
var chart = echarts.init(document.getElementById('userGrowth'));
|
||||||
|
window.userChart = chart;
|
||||||
var option = {
|
var option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
@@ -455,7 +527,7 @@ function initUserGrowth() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
data: {$chartData.userGrowth.dates|json_encode}
|
data: []
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
@@ -464,7 +536,7 @@ function initUserGrowth() {
|
|||||||
{
|
{
|
||||||
name: '新增用户',
|
name: '新增用户',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {$chartData.userGrowth.newUsers|json_encode},
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#3881fd'
|
color: '#3881fd'
|
||||||
}
|
}
|
||||||
@@ -473,9 +545,12 @@ function initUserGrowth() {
|
|||||||
name: '总用户数',
|
name: '总用户数',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: {$chartData.userGrowth.totalUsers|json_encode},
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#10b981'
|
color: '#10b981'
|
||||||
|
},
|
||||||
|
lineStyle: {
|
||||||
|
width: 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -486,6 +561,7 @@ function initUserGrowth() {
|
|||||||
// 资源统计图表
|
// 资源统计图表
|
||||||
function initResourceStats() {
|
function initResourceStats() {
|
||||||
var chart = echarts.init(document.getElementById('resourceStats'));
|
var chart = echarts.init(document.getElementById('resourceStats'));
|
||||||
|
window.resourceChart = chart;
|
||||||
var option = {
|
var option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
@@ -497,7 +573,7 @@ function initResourceStats() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
data: ['新增资源', '下载量']
|
data: ['新增资源', '总资源数']
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
left: '3%',
|
left: '3%',
|
||||||
@@ -508,7 +584,7 @@ function initResourceStats() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
data: {$chartData.resourceStats.dates|json_encode}
|
data: []
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
@@ -517,18 +593,21 @@ function initResourceStats() {
|
|||||||
{
|
{
|
||||||
name: '新增资源',
|
name: '新增资源',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {$chartData.resourceStats.resources|json_encode},
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#3881fd'
|
color: '#3881fd'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '下载量',
|
name: '总资源数',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: {$chartData.resourceStats.downloads|json_encode},
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#10b981'
|
color: '#10b981'
|
||||||
|
},
|
||||||
|
lineStyle: {
|
||||||
|
width: 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -539,6 +618,7 @@ function initResourceStats() {
|
|||||||
// 文章统计图表
|
// 文章统计图表
|
||||||
function initArticleStats() {
|
function initArticleStats() {
|
||||||
var chart = echarts.init(document.getElementById('articleStats'));
|
var chart = echarts.init(document.getElementById('articleStats'));
|
||||||
|
window.articleChart = chart;
|
||||||
var option = {
|
var option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
@@ -550,7 +630,7 @@ function initArticleStats() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
data: ['新增文章', '访问量']
|
data: ['新增文章', '总文章数']
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
left: '3%',
|
left: '3%',
|
||||||
@@ -561,7 +641,7 @@ function initArticleStats() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
data: {$chartData.articleStats.dates|json_encode}
|
data: []
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
@@ -570,18 +650,21 @@ function initArticleStats() {
|
|||||||
{
|
{
|
||||||
name: '新增文章',
|
name: '新增文章',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {$chartData.articleStats.articles|json_encode},
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#3881fd'
|
color: '#3881fd'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '访问量',
|
name: '总文章数',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: {$chartData.articleStats.views|json_encode},
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#10b981'
|
color: '#10b981'
|
||||||
|
},
|
||||||
|
lineStyle: {
|
||||||
|
width: 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\service;
|
||||||
|
|
||||||
|
use think\facade\Cache;
|
||||||
|
use think\facade\Request;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
class VisitStatsService
|
||||||
|
{
|
||||||
|
// Redis实例
|
||||||
|
protected $redis;
|
||||||
|
|
||||||
|
// 键名前缀
|
||||||
|
protected $prefix = 'stats:';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// 获取Redis处理器
|
||||||
|
$this->redis = Cache::store('redis')->handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录访问并更新统计数据
|
||||||
|
*/
|
||||||
|
public function recordVisit(string $page = 'home', string $userId = null): array
|
||||||
|
{
|
||||||
|
$date = date('Y-m-d');
|
||||||
|
$hour = date('H');
|
||||||
|
$userId = $userId ?? Request::ip();
|
||||||
|
|
||||||
|
// 使用管道提高性能
|
||||||
|
$pipe = $this->redis->multi();
|
||||||
|
|
||||||
|
// 总访问量(PV)
|
||||||
|
$pipe->incr($this->prefix.'total_visits');
|
||||||
|
|
||||||
|
// 每日访问量
|
||||||
|
$pipe->incr($this->prefix.'daily:'.$date);
|
||||||
|
|
||||||
|
// 页面统计
|
||||||
|
$pipe->zIncrBy($this->prefix.'page_views', 1, $page);
|
||||||
|
|
||||||
|
// UV统计(使用HyperLogLog节省内存)
|
||||||
|
$pipe->pfAdd($this->prefix.'uv:'.$date, [$userId]);
|
||||||
|
|
||||||
|
// 时段统计
|
||||||
|
$pipe->hIncrBy($this->prefix.'hourly:'.$date, $hour, 1);
|
||||||
|
|
||||||
|
// 执行所有命令
|
||||||
|
$result = $pipe->exec();
|
||||||
|
|
||||||
|
// 更新数据库统计
|
||||||
|
$this->updateDailyStats($date, [
|
||||||
|
'total_visits' => $result[0],
|
||||||
|
'daily_visits' => $result[1],
|
||||||
|
'unique_visitors' => $this->getUniqueVisitors($date)
|
||||||
|
]);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'total' => $result[0],
|
||||||
|
'daily' => $result[1],
|
||||||
|
'page' => $result[2],
|
||||||
|
'uv' => $result[3],
|
||||||
|
'hourly'=> $result[4]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新每日统计数据
|
||||||
|
*/
|
||||||
|
protected function updateDailyStats(string $date, array $stats)
|
||||||
|
{
|
||||||
|
// 获取其他统计数据
|
||||||
|
$otherStats = [
|
||||||
|
'total_users' => Db::name('users')->where('delete_time', null)->count(),
|
||||||
|
'new_users' => Db::name('users')->whereDay('create_time', $date)->count(),
|
||||||
|
'total_articles' => Db::name('articles')->where('delete_time', null)->count(),
|
||||||
|
'daily_articles' => Db::name('articles')->whereDay('create_time', $date)->count(),
|
||||||
|
'article_views' => Db::name('articles')->whereDay('update_time', $date)->sum('views'),
|
||||||
|
'total_resources' => Db::name('resources')->where('delete_time', null)->count(),
|
||||||
|
'daily_resources' => Db::name('resources')->whereDay('create_time', $date)->count(),
|
||||||
|
'resource_downloads' => Db::name('resources')->whereDay('update_time', $date)->sum('downloads')
|
||||||
|
];
|
||||||
|
|
||||||
|
// 合并统计数据
|
||||||
|
$stats = array_merge($stats, $otherStats);
|
||||||
|
|
||||||
|
// 更新或插入统计数据
|
||||||
|
Db::name('daily_stats')->insertOrUpdate([
|
||||||
|
'date' => $date,
|
||||||
|
'total_users' => $stats['total_users'],
|
||||||
|
'new_users' => $stats['new_users'],
|
||||||
|
'total_visits' => $stats['total_visits'],
|
||||||
|
'daily_visits' => $stats['daily_visits'],
|
||||||
|
'unique_visitors' => $stats['unique_visitors'],
|
||||||
|
'total_articles' => $stats['total_articles'],
|
||||||
|
'daily_articles' => $stats['daily_articles'],
|
||||||
|
'article_views' => $stats['article_views'],
|
||||||
|
'total_resources' => $stats['total_resources'],
|
||||||
|
'daily_resources' => $stats['daily_resources'],
|
||||||
|
'resource_downloads' => $stats['resource_downloads']
|
||||||
|
], ['date']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取总访问量
|
||||||
|
*/
|
||||||
|
public function getTotalVisits(): int
|
||||||
|
{
|
||||||
|
return (int)$this->redis->get($this->prefix.'total_visits');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当日访问量
|
||||||
|
*/
|
||||||
|
public function getDailyVisits(string $date = null): int
|
||||||
|
{
|
||||||
|
$date = $date ?? date('Y-m-d');
|
||||||
|
return (int)$this->redis->get($this->prefix.'daily:'.$date);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取独立访客数(UV)
|
||||||
|
*/
|
||||||
|
public function getUniqueVisitors(string $date = null): int
|
||||||
|
{
|
||||||
|
$date = $date ?? date('Y-m-d');
|
||||||
|
return $this->redis->pfCount($this->prefix.'uv:'.$date);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取热门页面
|
||||||
|
|
||||||
+20
-2
@@ -14,9 +14,9 @@ return [
|
|||||||
// 驱动方式
|
// 驱动方式
|
||||||
'type' => 'File',
|
'type' => 'File',
|
||||||
// 缓存保存目录
|
// 缓存保存目录
|
||||||
'path' => '',
|
'path' => runtime_path() . 'cache',
|
||||||
// 缓存前缀
|
// 缓存前缀
|
||||||
'prefix' => '',
|
'prefix' => 'cache_',
|
||||||
// 缓存有效期 0表示永久缓存
|
// 缓存有效期 0表示永久缓存
|
||||||
'expire' => 0,
|
'expire' => 0,
|
||||||
// 缓存标签前缀
|
// 缓存标签前缀
|
||||||
@@ -25,5 +25,23 @@ return [
|
|||||||
'serialize' => [],
|
'serialize' => [],
|
||||||
],
|
],
|
||||||
// 更多的缓存连接
|
// 更多的缓存连接
|
||||||
|
'redis' => [
|
||||||
|
// 驱动方式
|
||||||
|
'type' => 'redis',
|
||||||
|
// 服务器地址
|
||||||
|
'host' => env('redis.host', '127.0.0.1'),
|
||||||
|
// 端口
|
||||||
|
'port' => env('redis.port', 6379),
|
||||||
|
// 密码
|
||||||
|
'password' => env('redis.password', ''),
|
||||||
|
// 数据库索引
|
||||||
|
'select' => env('redis.select', 0),
|
||||||
|
// 连接超时时间
|
||||||
|
'timeout' => 0,
|
||||||
|
// 是否持久化连接
|
||||||
|
'persistent' => true,
|
||||||
|
// 缓存前缀
|
||||||
|
'prefix' => 'yz_:',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,131 +0,0 @@
|
|||||||
<?php /*a:1:{s:49:"E:\Demo\PHP\yunzer\app\admin\view\login\index.php";i:1747586453;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh-CN">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>后台管理系统</title>
|
|
||||||
<meta name="renderer" content="yz">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport"
|
|
||||||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/login.css">
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">
|
|
||||||
<div class="layadmin-user-login-main">
|
|
||||||
<div class="layadmin-user-login-box layadmin-user-login-header">
|
|
||||||
<img src="/static/images/logo.png" />
|
|
||||||
<h2>后台管理系统</h2>
|
|
||||||
</div>
|
|
||||||
<div class="layadmin-user-login-box layadmin-user-login-body layui-form">
|
|
||||||
<form class="layui-form login-form">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layadmin-user-login-icon layui-icon layui-icon-username" for="account"></label>
|
|
||||||
<input type="text" id="account" name="account" placeholder="邮箱" class="layui-input"
|
|
||||||
value="">
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
|
|
||||||
<input type="password" name="password" lay-affix="eye" class="layui-input" placeholder="密码" class="layui-input"
|
|
||||||
value="">
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-row">
|
|
||||||
<div class="layui-col-xs7">
|
|
||||||
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode"
|
|
||||||
for="code"></label>
|
|
||||||
<input type="text" name="code" placeholder="图形验证码" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<div class="layui-col-xs5">
|
|
||||||
<div style="margin-left:10px;">
|
|
||||||
<img src="<?php echo captcha_src(); ?>?t=<?php echo time(); ?>" class="layadmin-user-login-codeimg" id="img"
|
|
||||||
onclick="reloadImg()">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" style="margin-bottom: 20px;">
|
|
||||||
<input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<button class="layui-btn layui-btn-fluid" onclick="login()">登 陆</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'form'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
// 用户名控件获取焦点
|
|
||||||
$('#account').focus();
|
|
||||||
// 回车登录
|
|
||||||
$('input').keydown(function (e) {
|
|
||||||
if (e.keyCode == 13) {
|
|
||||||
login();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// 重新生成验证码
|
|
||||||
function reloadImg() {
|
|
||||||
var timestamp = new Date().getTime();
|
|
||||||
$('#img').attr('src', '<?php echo captcha_src(); ?>?t=' + timestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 登录处理函数
|
|
||||||
function login() {
|
|
||||||
var account = $('input[name="account"]').val();
|
|
||||||
var password = $('input[name="password"]').val();
|
|
||||||
var code = $('input[name="code"]').val();
|
|
||||||
var remember = $('input[name="remember"]:checked').val();
|
|
||||||
|
|
||||||
if (!account) {
|
|
||||||
layer.msg('邮箱不能为空');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!password) {
|
|
||||||
layer.msg('密码不能为空');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!code) {
|
|
||||||
layer.msg('验证码不能为空');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: 'post',
|
|
||||||
url: '<?php echo url("login"); ?>',
|
|
||||||
data: {
|
|
||||||
account: account,
|
|
||||||
password: password,
|
|
||||||
code: code,
|
|
||||||
remember: remember
|
|
||||||
},
|
|
||||||
dataType: 'json',
|
|
||||||
success: function(res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, {icon: 1, time: 1000}, function() {
|
|
||||||
window.location.href = '<?php echo url("Index/index"); ?>';
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, {icon: 2});
|
|
||||||
reloadImg();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
layer.msg('网络错误,请重试', {icon: 2});
|
|
||||||
reloadImg();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,311 +0,0 @@
|
|||||||
<?php /*a:3:{s:56:"E:\Demo\PHP\yunzer\app\admin\view\yunzer\configvalue.php";i:1747402501;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<style>
|
|
||||||
.config-container {
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 8px;
|
|
||||||
/* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); */
|
|
||||||
}
|
|
||||||
.config-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
}
|
|
||||||
.config-header span {
|
|
||||||
font-size: 18px;
|
|
||||||
color: #2c3e50;
|
|
||||||
font-weight: 500;
|
|
||||||
margin-right: 20px;
|
|
||||||
}
|
|
||||||
.config-header a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.config-header a span {
|
|
||||||
padding: 6px 15px;
|
|
||||||
background: #f8f9fa;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #606266;
|
|
||||||
font-size: 14px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
.config-header a span:hover {
|
|
||||||
background: #e9ecef;
|
|
||||||
color: #409EFF;
|
|
||||||
}
|
|
||||||
.layui-form-item {
|
|
||||||
margin-bottom: 25px;
|
|
||||||
}
|
|
||||||
.layui-form-label {
|
|
||||||
color: #606266;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
.layui-input {
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.layui-input:focus {
|
|
||||||
border-color: #409EFF;
|
|
||||||
}
|
|
||||||
.layui-textarea {
|
|
||||||
border-radius: 4px;
|
|
||||||
min-height: 100px;
|
|
||||||
}
|
|
||||||
.layui-word-aux {
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
.layui-btn {
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
.layui-btn:hover {
|
|
||||||
transform: translateY(-1px);
|
|
||||||
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
|
||||||
}
|
|
||||||
.upload-preview {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
.upload-preview img {
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
.upload-preview img:hover {
|
|
||||||
transform: scale(1.02);
|
|
||||||
}
|
|
||||||
.save-button-container {
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 40px;
|
|
||||||
padding-top: 20px;
|
|
||||||
border-top: 1px solid #eee;
|
|
||||||
}
|
|
||||||
.save-button-container .layui-btn {
|
|
||||||
padding: 0 50px;
|
|
||||||
height: 40px;
|
|
||||||
line-height: 40px;
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header">
|
|
||||||
<span>站点配置</span>
|
|
||||||
<!-- <a href="<?php echo htmlentities((string) $config['admin_route']); ?>Yunzer/configlist">
|
|
||||||
<span>站点管理</span>
|
|
||||||
</a> -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form class="layui-form">
|
|
||||||
<?php foreach($lists as $lists_v): if(($lists_v['config_type'] == 1)): ?>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label"><?php echo htmlentities((string) $lists_v['config_info']); ?></label>
|
|
||||||
<div class="layui-input-inline" style="width: 350px;">
|
|
||||||
<input type="text" class="layui-input" id="<?php echo htmlentities((string) $lists_v['config_name']); ?>" name="<?php echo htmlentities((string) $lists_v['config_name']); ?>" placeholder="<?php echo htmlentities((string) $lists_v['config_desc']); ?>" value="<?php echo htmlentities((string) $lists_v['config_value']); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid layui-word-aux"><?php echo htmlentities((string) $lists_v['config_desc']); ?></div>
|
|
||||||
</div>
|
|
||||||
<?php elseif(($lists_v['config_type'] == 2)): ?>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label"><?php echo htmlentities((string) $lists_v['config_info']); ?></label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" id="<?php echo htmlentities((string) $lists_v['config_name']); ?>">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 上传图片
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid layui-word-aux"><?php echo htmlentities((string) $lists_v['config_desc']); ?></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label"><?php echo htmlentities((string) $lists_v['config_info']); ?>预览</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-upload-list upload-preview" id="yulan_<?php echo htmlentities((string) $lists_v['config_name']); ?>" style="width:90%;">
|
|
||||||
<?php if(!empty($lists_v['config_value'])): ?>
|
|
||||||
<div class="upload_pic_li" style="position:relative;width:120px;margin:0 10px 10px 0">
|
|
||||||
<img style="background-color: #efefef;height:120px;object-fit:cover;" src="<?php echo htmlentities((string) $lists_v['config_value']); ?>" class="layui-upload-img" onmouseover="show_img(this)" onmouseleave="hide_img()">
|
|
||||||
<input type="hidden" name="<?php echo htmlentities((string) $lists_v['config_name']); ?>" value="<?php echo htmlentities((string) $lists_v['config_value']); ?>"/>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','upload'],function(){
|
|
||||||
layer = layui.layer;
|
|
||||||
upload = layui.upload;
|
|
||||||
$ = layui.jquery;
|
|
||||||
|
|
||||||
upload.render({
|
|
||||||
elem: "#<?php echo htmlentities((string) $lists_v['config_name']); ?>",
|
|
||||||
url: "<?php echo htmlentities((string) $config['admin_route']); ?>index/upload_img",
|
|
||||||
multiple: true,
|
|
||||||
done: function(res,title){
|
|
||||||
if(res.code > 0){
|
|
||||||
return layer.msg("上传失败,"+res.msg, {icon: 2});
|
|
||||||
}else{
|
|
||||||
$("#yulan_<?php echo htmlentities((string) $lists_v['config_name']); ?>").html('<div class="upload_pic_li" style="position:relative;width:120px;margin:0 10px 10px 0"><img style="width:120px;height:120px;object-fit:cover;" src="'+ res.url +'" class="layui-upload-img" onmouseover="show_img(this)" onmouseleave="hide_img()"><input type="hidden" name="<?php echo htmlentities((string) $lists_v['config_name']); ?>" value="'+res.data+'"/></div>');
|
|
||||||
layer.msg("上传成功", {icon: 1});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<?php elseif(($lists_v['config_type'] == 3)): ?>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label"><?php echo htmlentities((string) $lists_v['config_info']); ?></label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<textarea class="layui-textarea" id="<?php echo htmlentities((string) $lists_v['config_name']); ?>" name="<?php echo htmlentities((string) $lists_v['config_name']); ?>" placeholder="<?php echo htmlentities((string) $lists_v['config_desc']); ?>"><?php echo htmlentities((string) $lists_v['config_value']); ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class="save-button-container">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="save()">
|
|
||||||
<i class="layui-icon layui-icon-ok"></i> 保存配置
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
function save(){
|
|
||||||
var loadIndex = layer.load(1, {
|
|
||||||
shade: [0.1,'#fff']
|
|
||||||
});
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configvalue',$('form').serialize(),function(res){
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){
|
|
||||||
history.go(0);
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<?php /*a:1:{s:56:"E:\Demos\DemoOwns\PHP\yunzer\app/tpl/think_exception.tpl";i:1745482530;}*/ ?>
|
|
||||||
<html lang="zh-CN">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<title>跳转提示</title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<style type="text/css">
|
|
||||||
*{box-sizing:border-box;margin:0;padding:0;font-family:Lantinghei SC,Open Sans,Arial,Hiragino Sans GB,Microsoft YaHei,"微软雅黑",STHeiti,WenQuanYi Micro Hei,SimSun,sans-serif;-webkit-font-smoothing:antialiased}
|
|
||||||
body{padding:70px 0;background:#edf1f4;font-weight:400;font-size:1pc;-webkit-text-size-adjust:none;color:#333}
|
|
||||||
a{outline:0;color:#3498db;text-decoration:none;cursor:pointer}
|
|
||||||
.system-message{margin:20px 5%;padding:40px 20px;background:#fff;box-shadow:1px 1px 1px hsla(0,0%,39%,.1);text-align:center}
|
|
||||||
.system-message h1{margin:0;margin-bottom:9pt;color:#444;font-weight:400;font-size:40px}
|
|
||||||
.system-message .jump,.system-message .image{margin:20px 0;padding:0;padding:10px 0;font-weight:400}
|
|
||||||
.system-message .jump{font-size:14px}
|
|
||||||
.system-message .jump a{color:#333}
|
|
||||||
.system-message p{font-size:9pt;line-height:20px}
|
|
||||||
.system-message .btn{display:inline-block;margin-right:10px;width:138px;height:2pc;border:1px solid #44a0e8;border-radius:30px;color:#44a0e8;text-align:center;font-size:1pc;line-height:2pc;margin-bottom:5px;}
|
|
||||||
.success .btn{border-color:#69bf4e;color:#69bf4e}
|
|
||||||
.error .btn{border-color:#ff8992;color:#ff8992}
|
|
||||||
.info .btn{border-color:#3498db;color:#3498db}
|
|
||||||
.copyright p{width:100%;color:#919191;text-align:center;font-size:10px}
|
|
||||||
.system-message .btn-grey{border-color:#bbb;color:#bbb}
|
|
||||||
.clearfix:after{clear:both;display:block;visibility:hidden;height:0;content:"."}
|
|
||||||
@media (max-width:768px){body {padding:20px 0;}}
|
|
||||||
@media (max-width:480px){.system-message h1{font-size:30px;}}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="system-message">
|
|
||||||
<?php
|
|
||||||
switch ($code){
|
|
||||||
case 1:
|
|
||||||
?>
|
|
||||||
<h2>
|
|
||||||
<?php
|
|
||||||
echo (strip_tags($msg));
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
?>
|
|
||||||
<h2>
|
|
||||||
<?php
|
|
||||||
echo (strip_tags($msg));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
<?php /*a:3:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzertest\icon_list.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<style type="text/css">
|
|
||||||
ul {
|
|
||||||
display: block;
|
|
||||||
list-style-type: disc;
|
|
||||||
margin-block-start: 1em;
|
|
||||||
margin-block-end: 1em;
|
|
||||||
margin-inline-start: 0px;
|
|
||||||
margin-inline-end: 0px;
|
|
||||||
/* padding-inline-start: 40px; */
|
|
||||||
}
|
|
||||||
.site-doc-icon {
|
|
||||||
margin-bottom: 50px;
|
|
||||||
font-size: 0;
|
|
||||||
}
|
|
||||||
li {
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
.site-doc-icon li {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
width: 132px;
|
|
||||||
height: 105px;
|
|
||||||
line-height: 25px;
|
|
||||||
padding: 20px 0;
|
|
||||||
margin-right: -1px;
|
|
||||||
margin-bottom: -1px;
|
|
||||||
border: 1px solid #e2e2e2;
|
|
||||||
font-size: 14px;
|
|
||||||
text-align: center;
|
|
||||||
color: #666;
|
|
||||||
transition: all .3s;
|
|
||||||
-webkit-transition: all .3s;
|
|
||||||
}
|
|
||||||
.site-doc-icon li .layui-icon {
|
|
||||||
display: inline-block;
|
|
||||||
font-size: 36px;
|
|
||||||
}
|
|
||||||
.site-doc-icon li .doc-icon-name, .site-doc-icon li .doc-icon-code {
|
|
||||||
color: #c2c2c2;
|
|
||||||
}
|
|
||||||
.site-doc-icon li .doc-icon-fontclass {
|
|
||||||
height: 40px;
|
|
||||||
line-height: 20px;
|
|
||||||
padding: 0 5px;
|
|
||||||
font-size: 13px;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div class="header" style="margin-bottom:20px;">
|
|
||||||
<span>图标</span>
|
|
||||||
<div></div>
|
|
||||||
</div>
|
|
||||||
<pre id="pre" class="layui-code">
|
|
||||||
<!-- 图标 -->
|
|
||||||
<i class="layui-icon layui-icon-face-smile"></i>
|
|
||||||
<!-- 图标,设置颜色、大小 -->
|
|
||||||
<i class="layui-icon layui-icon-face-smile" style="font-size:30px;color:#1E9FFF;"></i>
|
|
||||||
<!-- 图标,设置旋转 -->
|
|
||||||
<i class="layui-icon layui-icon-face-smile layui-anim layui-anim-rotate layui-anim-loop"></i>
|
|
||||||
</pre>
|
|
||||||
<ul class="site-doc-icon" style="text-align: center;">
|
|
||||||
<?php foreach($lists as $lists_v): ?>
|
|
||||||
<li>
|
|
||||||
<i class="layui-icon <?php echo htmlentities((string) $lists_v['icon_css']); if(($lists_v['icon_name']=='loading')): ?> layui-anim layui-anim-rotate layui-anim-loop<?php endif; ?>"></i>
|
|
||||||
<div class="doc-icon-name"><?php echo htmlentities((string) $lists_v['icon_name']); ?></div>
|
|
||||||
<div class="doc-icon-code"><?php echo htmlentities((string) $lists_v['icon_html']); ?></div>
|
|
||||||
<div class="doc-icon-fontclass"><?php echo htmlentities((string) $lists_v['icon_css']); ?></div>
|
|
||||||
</li>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use('code', function(){
|
|
||||||
layui.code({
|
|
||||||
elem:'#pre'
|
|
||||||
,title: '使用方法'
|
|
||||||
,encode: true
|
|
||||||
,skin: 'notepad' //如果要默认风格,不用设定该key。
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,343 +0,0 @@
|
|||||||
<?php /*a:2:{s:66:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\banner.php";i:1747385326;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<!-- 主体内容 -->
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-picture"></i>
|
|
||||||
<span>Banner管理</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button class="layui-btn layui-bg-blue" id="addBanner">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加Banner
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-fluid">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<table id="bannerTable" lay-filter="bannerTable"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Banner表单 -->
|
|
||||||
<div id="bannerForm" style="display: none;">
|
|
||||||
<form class="layui-form banner-form">
|
|
||||||
<input type="hidden" name="id">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">标题</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入标题"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">图片</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-upload-drag" id="uploadImage">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i>
|
|
||||||
<p>点击上传或拖拽图片至此处</p>
|
|
||||||
<div id="uploadPreview" style="display: none;">
|
|
||||||
<img src="" alt="Banner图片" class="banner-upload-preview">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="imageInput">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">链接</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="url" placeholder="请输入链接地址" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" name="sort" value="0" class="layui-input" placeholder="数字越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="启用" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="saveBanner">保存</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
layui.use(['table', 'form', 'upload', 'layer'], function () {
|
|
||||||
var table = layui.table,
|
|
||||||
form = layui.form,
|
|
||||||
upload = layui.upload,
|
|
||||||
layer = layui.layer;
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
var tableColumns = [[
|
|
||||||
{ field: 'id', title: 'ID', width: 80, align: 'center' },
|
|
||||||
{ field: 'title', title: '标题', align: 'center' },
|
|
||||||
{
|
|
||||||
field: 'image', title: '图片', width: 180, align: 'center', templet: function (d) {
|
|
||||||
return '<img src="' + d.image + '" class="banner-preview-img" onclick="previewImage(\'' + d.image + '\')">';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ field: 'url', title: '链接', align: 'center', width: 300 },
|
|
||||||
{ field: 'sort', title: '排序', align: 'center', width: 100, sort: true },
|
|
||||||
{ field: 'create_time', title: '创建时间', align: 'center', width: 180, sort: true },
|
|
||||||
{
|
|
||||||
title: '操作', align: 'center', width: 240, templet: function (d) {
|
|
||||||
return '<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>' +
|
|
||||||
'<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]];
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#bannerTable',
|
|
||||||
url: '/admin/yunzeradmin/bannerlist',
|
|
||||||
method: 'get',
|
|
||||||
page: true,
|
|
||||||
cols: tableColumns,
|
|
||||||
limit: 10,
|
|
||||||
limits: [10, 20, 30, 50],
|
|
||||||
text: { none: '暂无相关数据' }
|
|
||||||
});
|
|
||||||
|
|
||||||
// 上传组件配置
|
|
||||||
var uploadConfig = {
|
|
||||||
elem: '#uploadImage',
|
|
||||||
url: '/admin/upload/image',
|
|
||||||
accept: 'images',
|
|
||||||
acceptMime: 'image/*',
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
$('#uploadPreview').show().find('img').attr('src', res.data.url);
|
|
||||||
$('#imageInput').val(res.data.url);
|
|
||||||
layer.msg('上传成功');
|
|
||||||
} else {
|
|
||||||
layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化上传组件
|
|
||||||
upload.render(uploadConfig);
|
|
||||||
|
|
||||||
// 监听表格工具条事件
|
|
||||||
table.on('tool(bannerTable)', function (obj) {
|
|
||||||
var data = obj.data;
|
|
||||||
if (obj.event === 'edit') {
|
|
||||||
showBannerForm(data);
|
|
||||||
} else if (obj.event === 'del') {
|
|
||||||
layer.confirm('确定删除此Banner?', function (index) {
|
|
||||||
deleteBanner(data.id, obj);
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加Banner按钮点击事件
|
|
||||||
$('#addBanner').on('click', function () {
|
|
||||||
showBannerForm();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听表单提交
|
|
||||||
form.on('submit(saveBanner)', function (data) {
|
|
||||||
var url = data.field.id ? '/admin/yunzeradmin/banneredit' : '/admin/yunzeradmin/banneradd';
|
|
||||||
$.post(url, data.field, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.closeAll('page');
|
|
||||||
table.reload('bannerTable');
|
|
||||||
layer.msg('保存成功');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 显示Banner表单
|
|
||||||
function showBannerForm(data) {
|
|
||||||
layer.open({
|
|
||||||
type: 1,
|
|
||||||
title: data ? '编辑Banner' : '添加Banner',
|
|
||||||
content: $('#bannerForm'),
|
|
||||||
area: ['800px', '600px'],
|
|
||||||
success: function (layero) {
|
|
||||||
form.render();
|
|
||||||
if (data) {
|
|
||||||
form.val('bannerForm', data);
|
|
||||||
if (data.image) {
|
|
||||||
$('#uploadPreview').show().find('img').attr('src', data.image);
|
|
||||||
$('#imageInput').val(data.image);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除Banner
|
|
||||||
function deleteBanner(id, obj) {
|
|
||||||
$.post('/admin/yunzeradmin/bannerdel', { id: id }, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
obj.del();
|
|
||||||
layer.msg('删除成功');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 预览图片
|
|
||||||
function previewImage(url) {
|
|
||||||
layer.photos({
|
|
||||||
photos: {
|
|
||||||
"data": [{
|
|
||||||
"src": url
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 页面样式 -->
|
|
||||||
<style>
|
|
||||||
.layui-table-cell {
|
|
||||||
height: 40px;
|
|
||||||
line-height: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-table-cell img {
|
|
||||||
height: 36px;
|
|
||||||
width: auto;
|
|
||||||
max-width: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-preview-img {
|
|
||||||
max-width: 80px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-form {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-upload-preview {
|
|
||||||
max-width: 100%;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,316 +0,0 @@
|
|||||||
<?php /*a:3:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzertest\test_list.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="header">
|
|
||||||
<span>演示列表-方法渲染</span>
|
|
||||||
<div></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form layui-card-header layuiadmin-card-header-auto" lay-filter="layadmin-useradmin-formlist" style="height:100%;">
|
|
||||||
<div class="layui-form-item" id="search"></div>
|
|
||||||
</div>
|
|
||||||
<script type="text/html" id="toolbar">
|
|
||||||
<div class="layui-btn-container">
|
|
||||||
<div class="layui-btn-group">
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary" lay-event="add">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary" lay-event="edit">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>修改
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary" lay-event="del">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</script>
|
|
||||||
<table class="layui-hide" id="datalist" lay-filter="datalist"></table>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','table'],function(){
|
|
||||||
table = layui.table;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
get_data();
|
|
||||||
|
|
||||||
table.on('row(datalist)',function(obj){
|
|
||||||
obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
|
|
||||||
obj.tr.find("div.layui-unselect.layui-form-radio")[0].click();
|
|
||||||
});
|
|
||||||
table.on('toolbar(datalist)',function(obj){
|
|
||||||
var checkStatus = table.checkStatus(obj.config.id);
|
|
||||||
var data = checkStatus.data;
|
|
||||||
var datas = obj.data;
|
|
||||||
var layEvent = obj.event;
|
|
||||||
var tr = obj.tr;
|
|
||||||
|
|
||||||
switch(obj.event){
|
|
||||||
case 'add':
|
|
||||||
layer.full(layer.open({
|
|
||||||
title: '添加',
|
|
||||||
type: 2,
|
|
||||||
content: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzertest/test_add",
|
|
||||||
maxmin: true,
|
|
||||||
area: ['70%','70%'],
|
|
||||||
btn: ['确定','关闭'],
|
|
||||||
yes: function(index,layero){
|
|
||||||
var form = layero.find('iframe')[0].contentWindow;
|
|
||||||
var body = layer.getChildFrame('body', index);
|
|
||||||
var test_img =[];
|
|
||||||
body.find("input[name='test_img']").each(function(){
|
|
||||||
test_img.push($(this).val());
|
|
||||||
})
|
|
||||||
var dataj = {
|
|
||||||
test_input : form.test_input.value,
|
|
||||||
test_reference : form.test_reference.value,
|
|
||||||
test_time : form.test_time.value,
|
|
||||||
test_data : form.test_data.value,
|
|
||||||
test_datatime : form.test_datatime.value,
|
|
||||||
test_img : test_img,
|
|
||||||
test_rich : form.test_rich.value,
|
|
||||||
test_rich_baidu : form.test_rich_baidu.value,
|
|
||||||
test_url : form.test_url.value
|
|
||||||
};
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzertest/test_add',dataj,function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
get_data();
|
|
||||||
layer.close(index);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
break;
|
|
||||||
case 'edit':
|
|
||||||
if(!data[0]){
|
|
||||||
layer.msg('请选择一条数据',{'icon':2});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
layer.full(layer.open({
|
|
||||||
title: '修改',
|
|
||||||
type: 2,
|
|
||||||
content: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzertest/test_edit?test_id="+data[0].test_id,
|
|
||||||
maxmin: true,
|
|
||||||
area: ['70%','70%'],
|
|
||||||
btn: ['确定','关闭'],
|
|
||||||
yes: function(index,layero){
|
|
||||||
var form = layero.find('iframe')[0].contentWindow;
|
|
||||||
var body = layer.getChildFrame('body', index);
|
|
||||||
|
|
||||||
var test_img =[];
|
|
||||||
body.find("input[name='test_img']").each(function(){
|
|
||||||
test_img.push($(this).val());
|
|
||||||
})
|
|
||||||
var dataj = {
|
|
||||||
test_id : data[0].test_id,
|
|
||||||
test_input : form.test_input.value,
|
|
||||||
test_reference : form.test_reference.value,
|
|
||||||
test_time : form.test_time.value,
|
|
||||||
test_data : form.test_data.value,
|
|
||||||
test_datatime : form.test_datatime.value,
|
|
||||||
test_img : test_img,
|
|
||||||
test_rich : form.test_rich.value,
|
|
||||||
test_rich_baidu : form.test_rich_baidu.value,
|
|
||||||
test_url : form.test_url.value
|
|
||||||
};
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzertest/test_edit',dataj,function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
get_data();
|
|
||||||
layer.close(index);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
break;
|
|
||||||
case 'del':
|
|
||||||
if(!data[0]){
|
|
||||||
layer.msg('请选择一条数据',{'icon':2});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
layer.confirm('确定要删除吗?',{
|
|
||||||
icon:3,
|
|
||||||
btn: ['确定','取消']
|
|
||||||
},function(){
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzertest/test_del',{'test_id':data[0].test_id},function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.alert(res.msg,{icon:2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg);
|
|
||||||
setTimeout(function(){window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
function get_data(){
|
|
||||||
table.render({
|
|
||||||
elem: '#datalist',
|
|
||||||
method : 'post'
|
|
||||||
,url:"<?php echo htmlentities((string) $config['admin_route']); ?>yunzertest/test_list"
|
|
||||||
,toolbar: '#toolbar'
|
|
||||||
,defaultToolbar: ['filter', 'print', 'exports', {
|
|
||||||
title: '提示'
|
|
||||||
,layEvent: 'LAYTABLE_TIPS'
|
|
||||||
,icon: 'layui-icon-tips'
|
|
||||||
}]
|
|
||||||
,title: '演示列表'
|
|
||||||
,page: true
|
|
||||||
,cols: [[
|
|
||||||
{type:'checkbox'},
|
|
||||||
{type:'radio'}
|
|
||||||
,{field:'test_id', width:50, title:'ID'}
|
|
||||||
,{field:'test_input', width:100, title: '文本'}
|
|
||||||
,{field:'test_rich', width:100, title: '富文本'}
|
|
||||||
,{field:'test_rich_baidu', width:120, title: '百度文本'}
|
|
||||||
,{field:'test_img', width:100, title: '图片',templet:function(res){
|
|
||||||
return '<img style="width:30px;height:30px;" onmouseover="show_img(this)" onmouseleave="hide_img()" src="'+res.test_img+'"';
|
|
||||||
}}
|
|
||||||
,{field:'test_reference', width:100, title: '参照',templet:function(res){
|
|
||||||
if(res.test_reference == 1){
|
|
||||||
return '<span style="color:green;">开启</span>';
|
|
||||||
}else{
|
|
||||||
return '<span style="color:grey;">关闭</span>';
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
,{field:'test_time', width:100, title: '时间戳'}
|
|
||||||
,{field:'test_data', width:100, title: '日期'}
|
|
||||||
,{field:'test_datatime', width:150, title: '日期时间'}
|
|
||||||
,{field:'test_url', width:150, title: '网址链接',templet:function(res){
|
|
||||||
return '<a href="'+res.test_url+'" target="_blank">'+res.test_url+'</a>';
|
|
||||||
}}
|
|
||||||
]]
|
|
||||||
,data:[]
|
|
||||||
,limit :10
|
|
||||||
,limits:[10,20,30]
|
|
||||||
,height: 'full-100'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,277 +0,0 @@
|
|||||||
<?php /*a:3:{s:55:"E:\Demo\PHP\yunzer\app\admin\view\yunzer\buttoninfo.php";i:1745855804;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<div class="layui-row">
|
|
||||||
<div class="layui-col-md6">
|
|
||||||
<div class="layui-breadcrumb">
|
|
||||||
<a href="<?php echo htmlentities((string) $config['admin_route']); ?>Yunzer/menuInfo"><i class="layui-icon layui-icon-menu-fill"></i> 上级菜单</a>
|
|
||||||
<a><cite>本级菜单</cite></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-col-md6" style="text-align: right;">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" onclick="add(<?php echo htmlentities((string) $smid); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i> 添加按钮
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<div class="layui-row layui-col-space15">
|
|
||||||
<div class="layui-col-md3">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header"><i class="layui-icon layui-icon-tree"></i> 菜单结构</div>
|
|
||||||
<div class="layui-card-body" id="menuTree">
|
|
||||||
<!-- 树形结构将在这里渲染 -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-col-md9">
|
|
||||||
<table class="layui-table" lay-skin="line">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>排序</th>
|
|
||||||
<th>类型</th>
|
|
||||||
<th>按钮名</th>
|
|
||||||
<th>图标</th>
|
|
||||||
<th>状态</th>
|
|
||||||
<th>操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<tr>
|
|
||||||
<td><span class="layui-badge layui-bg-gray"><?php echo htmlentities((string) $vo['sort']); ?></span></td>
|
|
||||||
<td>
|
|
||||||
<?php if(($vo['type']==1)): ?>
|
|
||||||
<span class="layui-badge layui-bg-blue">功能模块</span> <?php echo htmlentities((string) $vo['src']); elseif(($vo['type']==2)): ?>
|
|
||||||
<span class="layui-badge layui-bg-green">超链接</span> <?php echo htmlentities((string) $vo['src']); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><b><?php echo htmlentities((string) $vo['label']); ?></b></td>
|
|
||||||
<td><i class="layui-icon <?php echo htmlentities((string) $vo['icon_class']); ?>"></i> <?php echo htmlentities((string) $vo['icon_class']); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if(($vo['status']==1)): ?>
|
|
||||||
<span class="layui-badge layui-bg-green">开启</span>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="layui-badge layui-bg-red">禁用</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="layui-btn-group">
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs" onclick="edit(<?php echo htmlentities((string) $vo['smid']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i> 编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" onclick="del(<?php echo htmlentities((string) $vo['smid']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i> 删除
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'tree'], function(){
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
var tree = layui.tree;
|
|
||||||
|
|
||||||
// 构建树形结构数据
|
|
||||||
var treeData = [{
|
|
||||||
title: '当前菜单',
|
|
||||||
id: <?php echo htmlentities((string) $smid); ?>,
|
|
||||||
spread: true,
|
|
||||||
children: []
|
|
||||||
}];
|
|
||||||
|
|
||||||
// 将按钮数据添加到树中
|
|
||||||
<?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
treeData[0].children.push({
|
|
||||||
title: '<?php echo htmlentities((string) $vo['label']); ?>',
|
|
||||||
id: <?php echo htmlentities((string) $vo['smid']); ?>,
|
|
||||||
icon: 'layui-icon <?php echo htmlentities((string) $vo['icon_class']); ?>'
|
|
||||||
});
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
|
|
||||||
// 渲染树形结构
|
|
||||||
tree.render({
|
|
||||||
elem: '#menuTree',
|
|
||||||
data: treeData,
|
|
||||||
showLine: true,
|
|
||||||
click: function(obj){
|
|
||||||
var data = obj.data;
|
|
||||||
if(data.id != <?php echo htmlentities((string) $smid); ?>) {
|
|
||||||
edit(data.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加
|
|
||||||
function add(smid){
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '添加按钮',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['550px','550px'],
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/buttonadd?smid='+smid
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 编辑
|
|
||||||
function edit(smid){
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '编辑按钮',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['550px','550px'],
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/buttonedit?smid='+smid
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除
|
|
||||||
function del(smid){
|
|
||||||
layer.confirm('确定要删除吗?', {
|
|
||||||
icon: 3,
|
|
||||||
btn: ['确定','取消']
|
|
||||||
}, function(){
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/buttondel',{'smid':smid},function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.alert(res.msg,{icon:2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{icon:1});
|
|
||||||
setTimeout(function(){window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,409 +0,0 @@
|
|||||||
<?php /*a:3:{s:55:"E:\Demo\PHP\yunzer\app\admin\view\yunzer\configlist.php";i:1747402501;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<style>
|
|
||||||
.config-container {
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 8px;
|
|
||||||
/* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); */
|
|
||||||
}
|
|
||||||
.config-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
}
|
|
||||||
.config-header span {
|
|
||||||
font-size: 18px;
|
|
||||||
color: #2c3e50;
|
|
||||||
font-weight: 500;
|
|
||||||
margin-right: 20px;
|
|
||||||
}
|
|
||||||
.config-header a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.config-header a span {
|
|
||||||
padding: 6px 15px;
|
|
||||||
background: #f8f9fa;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #606266;
|
|
||||||
font-size: 14px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
.config-header a span:hover {
|
|
||||||
background: #e9ecef;
|
|
||||||
color: #409EFF;
|
|
||||||
}
|
|
||||||
.action-buttons {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
.layui-btn {
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
|
||||||
transition: all 0.3s;
|
|
||||||
height: 32px;
|
|
||||||
line-height: 32px;
|
|
||||||
padding: 0 16px;
|
|
||||||
}
|
|
||||||
.layui-btn:hover {
|
|
||||||
transform: translateY(-1px);
|
|
||||||
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
|
||||||
}
|
|
||||||
.layui-btn .layui-icon {
|
|
||||||
margin-right: 4px;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.layui-table {
|
|
||||||
margin: 15px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.layui-table thead tr {
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
.layui-table tbody tr:hover {
|
|
||||||
background-color: #f5f7fa;
|
|
||||||
}
|
|
||||||
.layui-table-cell {
|
|
||||||
height: 40px;
|
|
||||||
line-height: 40px;
|
|
||||||
}
|
|
||||||
.layui-badge {
|
|
||||||
padding: 4px 8px;
|
|
||||||
border-radius: 3px;
|
|
||||||
font-weight: 500;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
.layui-badge.layui-bg-green {
|
|
||||||
background-color: #67C23A !important;
|
|
||||||
}
|
|
||||||
.layui-badge.layui-bg-gray {
|
|
||||||
background-color: #909399 !important;
|
|
||||||
}
|
|
||||||
.layui-layer {
|
|
||||||
border-radius: 8px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header">
|
|
||||||
<span>站点管理</span>
|
|
||||||
<!-- <a href="<?php echo htmlentities((string) $config['admin_route']); ?>Yunzer/configvalue">
|
|
||||||
<span>站点配置</span>
|
|
||||||
</a> -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="layui-card-body" style="padding: 0;">
|
|
||||||
<div class="action-buttons">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" id="btn-add">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" id="btn-edit">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>修改
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-danger" id="btn-del">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<table class="layui-table" id="lists" lay-filter="lists"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'table', 'element'], function () {
|
|
||||||
var table = layui.table;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var element = layui.element;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
function initTable() {
|
|
||||||
table.render({
|
|
||||||
elem: '#lists',
|
|
||||||
method: 'post',
|
|
||||||
url: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzer/configlist",
|
|
||||||
title: '配置列表',
|
|
||||||
page: true,
|
|
||||||
skin: 'line',
|
|
||||||
even: true,
|
|
||||||
size: 'lg',
|
|
||||||
cols: [[
|
|
||||||
{ type: 'radio', fixed: 'left', width: 50 },
|
|
||||||
{ field: 'config_id', width: 80, title: 'ID', sort: true, align: 'center' },
|
|
||||||
{ field: 'config_sort', width: 120, title: '排序', sort: true, align: 'center' },
|
|
||||||
{ field: 'config_name', width: 150, title: '关键词' },
|
|
||||||
{ field: 'config_info', width: 150, title: '作用' },
|
|
||||||
{ field: 'config_desc', minWidth: 300, title: '说明' },
|
|
||||||
{
|
|
||||||
field: 'config_status', width: 100, title: '状态', align: 'center', templet: function (res) {
|
|
||||||
if (res.config_status == 1) {
|
|
||||||
return '<span class="layui-badge layui-bg-green">开启</span>';
|
|
||||||
} else {
|
|
||||||
return '<span class="layui-badge layui-bg-gray">关闭</span>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
limit: 15,
|
|
||||||
limits: [15, 30, 50, 100],
|
|
||||||
height: 'full-180'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载表格数据
|
|
||||||
initTable();
|
|
||||||
|
|
||||||
// 行点击事件
|
|
||||||
table.on('row(lists)', function (obj) {
|
|
||||||
obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
|
|
||||||
obj.tr.find("div.layui-unselect.layui-form-radio")[0].click();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加按钮事件
|
|
||||||
$('#btn-add').on('click', function () {
|
|
||||||
layer.open({
|
|
||||||
title: '<i class="layui-icon layui-icon-add-1"></i> 添加配置',
|
|
||||||
type: 2,
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configadd',
|
|
||||||
maxmin: true,
|
|
||||||
area: ['700px', '550px'],
|
|
||||||
skin: 'layui-layer-molv',
|
|
||||||
btn: ['确定', '取消'],
|
|
||||||
yes: function (index, layero) {
|
|
||||||
var form = layero.find('iframe')[0].contentWindow;
|
|
||||||
var button = {
|
|
||||||
config_name: form.config_name.value,
|
|
||||||
config_info: form.config_info.value,
|
|
||||||
config_type: form.config_type.value,
|
|
||||||
config_desc: form.config_desc.value,
|
|
||||||
config_sort: form.config_sort.value,
|
|
||||||
config_status: form.config_status.value
|
|
||||||
};
|
|
||||||
|
|
||||||
var loadIndex = layer.load(1, {
|
|
||||||
shade: [0.1,'#fff']
|
|
||||||
});
|
|
||||||
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configadd', button, function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.msg(res.msg, { icon: 2, time: 2000 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 1, time: 1000 });
|
|
||||||
initTable();
|
|
||||||
layer.close(index);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 编辑按钮事件
|
|
||||||
$('#btn-edit').on('click', function () {
|
|
||||||
var checkStatus = table.checkStatus('lists');
|
|
||||||
var data = checkStatus.data;
|
|
||||||
|
|
||||||
if (data.length === 0) {
|
|
||||||
layer.msg('请选择一条数据进行编辑', { icon: 0 });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
layer.open({
|
|
||||||
title: '<i class="layui-icon layui-icon-edit"></i> 修改配置',
|
|
||||||
type: 2,
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configedit?config_id=' + data[0].config_id,
|
|
||||||
maxmin: true,
|
|
||||||
area: ['700px', '550px'],
|
|
||||||
skin: 'layui-layer-molv',
|
|
||||||
btn: ['确定', '取消'],
|
|
||||||
yes: function (index, layero) {
|
|
||||||
var form = layero.find('iframe')[0].contentWindow;
|
|
||||||
var button = {
|
|
||||||
config_id: data[0].config_id,
|
|
||||||
config_name: form.config_name.value,
|
|
||||||
config_info: form.config_info.value,
|
|
||||||
config_type: form.config_type.value,
|
|
||||||
config_desc: form.config_desc.value,
|
|
||||||
config_sort: form.config_sort.value,
|
|
||||||
config_status: form.config_status.value
|
|
||||||
};
|
|
||||||
|
|
||||||
var loadIndex = layer.load(1, {
|
|
||||||
shade: [0.1,'#fff']
|
|
||||||
});
|
|
||||||
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configedit', button, function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.msg(res.msg, { icon: 2, time: 2000 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 1, time: 1000 });
|
|
||||||
initTable();
|
|
||||||
layer.close(index);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 删除按钮事件
|
|
||||||
$('#btn-del').on('click', function () {
|
|
||||||
var checkStatus = table.checkStatus('lists');
|
|
||||||
var data = checkStatus.data;
|
|
||||||
|
|
||||||
if (data.length === 0) {
|
|
||||||
layer.msg('请选择一条数据进行删除', { icon: 0 });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
layer.confirm('确定要删除该配置吗?', {
|
|
||||||
icon: 3,
|
|
||||||
title: '删除确认',
|
|
||||||
skin: 'layui-layer-molv',
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
var loadIndex = layer.load(1, {
|
|
||||||
shade: [0.1,'#fff']
|
|
||||||
});
|
|
||||||
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configdel', { 'config_id': data[0].config_id }, function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.msg(res.msg, { icon: 2, time: 2000 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 1, time: 1000 });
|
|
||||||
initTable();
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,732 +0,0 @@
|
|||||||
<?php /*a:3:{s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\index\welcome.php";i:1747626653;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<script src="/static/js/jquery.min.js"></script>
|
|
||||||
<style>
|
|
||||||
.dashboard-container {
|
|
||||||
padding: 24px;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
||||||
/* background-color: #f5f7fa; */
|
|
||||||
/* min-height: calc(100vh - 60px); */
|
|
||||||
}
|
|
||||||
.welcome-header {
|
|
||||||
background: linear-gradient(135deg, #3881fd 0%, #2c5fd9 100%);
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 30px;
|
|
||||||
color: white;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
box-shadow: 0 4px 20px rgba(56, 129, 253, 0.15);
|
|
||||||
}
|
|
||||||
.welcome-header h1 {
|
|
||||||
font-size: 28px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
.welcome-header p {
|
|
||||||
font-size: 15px;
|
|
||||||
opacity: 0.9;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
.stats-container {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
|
||||||
gap: 24px;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
.stat-card {
|
|
||||||
background: white;
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 24px;
|
|
||||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.stat-card::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 4px;
|
|
||||||
height: 100%;
|
|
||||||
background: #3881fd;
|
|
||||||
}
|
|
||||||
.stat-card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
|
|
||||||
}
|
|
||||||
.stat-card .stat-value {
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #2c3e50;
|
|
||||||
margin: 12px 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: baseline;
|
|
||||||
}
|
|
||||||
.stat-card .stat-title {
|
|
||||||
color: #64748b;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.5px;
|
|
||||||
}
|
|
||||||
.stat-card .stat-icon {
|
|
||||||
position: absolute;
|
|
||||||
right: 20px;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
font-size: 48px;
|
|
||||||
opacity: 0.1;
|
|
||||||
}
|
|
||||||
.quick-actions {
|
|
||||||
background: white;
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 24px;
|
|
||||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
|
|
||||||
}
|
|
||||||
.quick-actions h2 {
|
|
||||||
color: #1e293b;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.quick-actions h2::before {
|
|
||||||
content: '';
|
|
||||||
display: inline-block;
|
|
||||||
width: 4px;
|
|
||||||
height: 18px;
|
|
||||||
background: #3881fd;
|
|
||||||
margin-right: 8px;
|
|
||||||
border-radius: 2px;
|
|
||||||
}
|
|
||||||
.action-buttons {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
|
|
||||||
gap: 16px;
|
|
||||||
}
|
|
||||||
.action-button {
|
|
||||||
background: #f8fafc;
|
|
||||||
border: 1px solid #e2e8f0;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 12px 16px;
|
|
||||||
color: #1e293b;
|
|
||||||
font-weight: 500;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.action-button:hover {
|
|
||||||
background: #3881fd;
|
|
||||||
color: white;
|
|
||||||
border-color: #3881fd;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
}
|
|
||||||
.action-button i {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
.recent-activity {
|
|
||||||
margin-top: 24px;
|
|
||||||
background: white;
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 24px;
|
|
||||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
|
|
||||||
}
|
|
||||||
.activity-list {
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
.activity-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 12px 0;
|
|
||||||
border-bottom: 1px solid #f1f5f9;
|
|
||||||
}
|
|
||||||
.activity-item:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
.activity-icon {
|
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
border-radius: 8px;
|
|
||||||
background: #f1f5f9;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin-right: 12px;
|
|
||||||
}
|
|
||||||
.activity-content {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
.activity-title {
|
|
||||||
font-weight: 500;
|
|
||||||
color: #1e293b;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
.activity-time {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #64748b;
|
|
||||||
}
|
|
||||||
.charts-container {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
|
||||||
gap: 24px;
|
|
||||||
margin-top: 24px;
|
|
||||||
}
|
|
||||||
.chart-card {
|
|
||||||
background: white;
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 24px;
|
|
||||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
|
|
||||||
}
|
|
||||||
.chart-card h2 {
|
|
||||||
color: #1e293b;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.chart-card h2::before {
|
|
||||||
content: '';
|
|
||||||
display: inline-block;
|
|
||||||
width: 4px;
|
|
||||||
height: 18px;
|
|
||||||
background: #3881fd;
|
|
||||||
margin-right: 8px;
|
|
||||||
border-radius: 2px;
|
|
||||||
}
|
|
||||||
.chart-container {
|
|
||||||
height: 300px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="dashboard-container">
|
|
||||||
<div class="welcome-header">
|
|
||||||
<h1>欢迎使用<?php echo htmlentities((string) $config['admin_name']); ?></h1>
|
|
||||||
<p>今天是 <span id="current-time"></span>,祝您工作愉快</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="stats-container">
|
|
||||||
<div class="stat-card">
|
|
||||||
<div class="stat-title">用户总数</div>
|
|
||||||
<div class="stat-value"><?php echo htmlentities((string) number_format($stats['total_users'])); ?></div>
|
|
||||||
<div class="stat-icon">👥</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-card">
|
|
||||||
<div class="stat-title">今日访问</div>
|
|
||||||
<div class="stat-value"><?php echo htmlentities((string) number_format($stats['daily_visits'])); ?></div>
|
|
||||||
<div class="stat-icon">📊</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-card">
|
|
||||||
<div class="stat-title">文章总数</div>
|
|
||||||
<div class="stat-value"><?php echo htmlentities((string) number_format($stats['total_articles'])); ?></div>
|
|
||||||
<div class="stat-icon">📝</div>
|
|
||||||
</div>
|
|
||||||
<div class="stat-card">
|
|
||||||
<div class="stat-title">资源总数</div>
|
|
||||||
<div class="stat-value"><?php echo htmlentities((string) number_format($stats['total_resources'])); ?></div>
|
|
||||||
<div class="stat-icon">📦</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="quick-actions">
|
|
||||||
<h2>快捷操作</h2>
|
|
||||||
<div class="action-buttons">
|
|
||||||
<a href="<?php echo url('user/index'); ?>" class="action-button">
|
|
||||||
<i class="fas fa-users"></i>用户管理
|
|
||||||
</a>
|
|
||||||
<a href="<?php echo url('content/publish'); ?>" class="action-button">
|
|
||||||
<i class="fas fa-edit"></i>内容发布
|
|
||||||
</a>
|
|
||||||
<a href="<?php echo url('statistics/index'); ?>" class="action-button">
|
|
||||||
<i class="fas fa-chart-bar"></i>数据统计
|
|
||||||
</a>
|
|
||||||
<a href="<?php echo url('system/settings'); ?>" class="action-button">
|
|
||||||
<i class="fas fa-cog"></i>系统设置
|
|
||||||
</a>
|
|
||||||
<a href="<?php echo url('system/clear_cache'); ?>" class="action-button">
|
|
||||||
<i class="fas fa-broom"></i>清除缓存
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="recent-activity">
|
|
||||||
<h2>最近动态</h2>
|
|
||||||
<div class="activity-list">
|
|
||||||
<?php if(is_array($recentActivities) || $recentActivities instanceof \think\Collection || $recentActivities instanceof \think\Paginator): $i = 0; $__LIST__ = $recentActivities;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$activity): $mod = ($i % 2 );++$i;?>
|
|
||||||
<div class="activity-item">
|
|
||||||
<div class="activity-icon"><?php echo htmlentities((string) $activity['icon']); ?></div>
|
|
||||||
<div class="activity-content">
|
|
||||||
<div class="activity-title"><?php echo htmlentities((string) $activity['title']); ?></div>
|
|
||||||
<div class="activity-time"><?php echo htmlentities((string) $activity['time']); ?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="charts-container">
|
|
||||||
<div class="chart-card">
|
|
||||||
<h2>访问趋势</h2>
|
|
||||||
<div id="visitTrend" class="chart-container"></div>
|
|
||||||
</div>
|
|
||||||
<div class="chart-card">
|
|
||||||
<h2>用户增长</h2>
|
|
||||||
<div id="userGrowth" class="chart-container"></div>
|
|
||||||
</div>
|
|
||||||
<div class="chart-card">
|
|
||||||
<h2>资源统计</h2>
|
|
||||||
<div id="resourceStats" class="chart-container"></div>
|
|
||||||
</div>
|
|
||||||
<div class="chart-card">
|
|
||||||
<h2>文章统计</h2>
|
|
||||||
<div id="articleStats" class="chart-container"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="/static/js/echarts.min.js"></script>
|
|
||||||
<script>
|
|
||||||
function updateTime() {
|
|
||||||
var now = new Date();
|
|
||||||
var year = now.getFullYear();
|
|
||||||
var month = now.getMonth() + 1;
|
|
||||||
var date = now.getDate();
|
|
||||||
var hours = now.getHours();
|
|
||||||
var minutes = now.getMinutes();
|
|
||||||
var seconds = now.getSeconds();
|
|
||||||
|
|
||||||
var padZero = function(num) {
|
|
||||||
return num < 10 ? '0' + num : num;
|
|
||||||
};
|
|
||||||
|
|
||||||
var timeString = year + '年' +
|
|
||||||
padZero(month) + '月' +
|
|
||||||
padZero(date) + '日 ' +
|
|
||||||
padZero(hours) + ':' +
|
|
||||||
padZero(minutes) + ':' +
|
|
||||||
padZero(seconds);
|
|
||||||
|
|
||||||
document.getElementById('current-time').innerHTML = timeString;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取文章统计数据
|
|
||||||
function getArticleCounts() {
|
|
||||||
fetch('<?php echo url("articles/counts"); ?>')
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(res => {
|
|
||||||
console.log('文章统计接口返回数据:', res);
|
|
||||||
if (res.code === 0 && res.data) {
|
|
||||||
// 更新文章总数
|
|
||||||
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = res.data.total.toLocaleString();
|
|
||||||
} else {
|
|
||||||
console.warn('文章统计接口返回异常:', res);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('获取文章统计失败:', error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取资源统计数据
|
|
||||||
function getResourcesCounts() {
|
|
||||||
fetch('<?php echo url("resources/counts"); ?>')
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(res => {
|
|
||||||
console.log('资源统计接口返回数据:', res);
|
|
||||||
if (res.code === 0 && res.data) {
|
|
||||||
// 更新资源总数
|
|
||||||
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = res.data.total.toLocaleString();
|
|
||||||
} else {
|
|
||||||
console.warn('资源统计接口返回异常:', res);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('获取资源统计失败:', error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
updateTime();
|
|
||||||
setInterval(updateTime, 1000);
|
|
||||||
|
|
||||||
// 页面加载完成后获取统计数据
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
getArticleCounts();
|
|
||||||
getResourcesCounts();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 访问趋势图表
|
|
||||||
function initVisitTrend() {
|
|
||||||
var chart = echarts.init(document.getElementById('visitTrend'));
|
|
||||||
var option = {
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis',
|
|
||||||
axisPointer: {
|
|
||||||
type: 'shadow'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
data: ['访问量', '独立访客']
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
left: '3%',
|
|
||||||
right: '4%',
|
|
||||||
bottom: '3%',
|
|
||||||
containLabel: true
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['visitTrend']['dates'])); ?>,
|
|
||||||
axisLine: {
|
|
||||||
lineStyle: {
|
|
||||||
color: '#e2e8f0'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value',
|
|
||||||
axisLine: {
|
|
||||||
lineStyle: {
|
|
||||||
color: '#e2e8f0'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
splitLine: {
|
|
||||||
lineStyle: {
|
|
||||||
color: '#f1f5f9'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
series: [{
|
|
||||||
name: '访问量',
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['visitTrend']['visits'])); ?>,
|
|
||||||
type: 'line',
|
|
||||||
smooth: true,
|
|
||||||
areaStyle: {
|
|
||||||
opacity: 0.1
|
|
||||||
},
|
|
||||||
itemStyle: {
|
|
||||||
color: '#3881fd'
|
|
||||||
},
|
|
||||||
lineStyle: {
|
|
||||||
width: 3
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
name: '独立访客',
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['visitTrend']['uvs'])); ?>,
|
|
||||||
type: 'line',
|
|
||||||
smooth: true,
|
|
||||||
itemStyle: {
|
|
||||||
color: '#10b981'
|
|
||||||
},
|
|
||||||
lineStyle: {
|
|
||||||
width: 3
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
chart.setOption(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 用户增长图表
|
|
||||||
function initUserGrowth() {
|
|
||||||
var chart = echarts.init(document.getElementById('userGrowth'));
|
|
||||||
var option = {
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis',
|
|
||||||
axisPointer: {
|
|
||||||
type: 'cross',
|
|
||||||
label: {
|
|
||||||
backgroundColor: '#6a7985'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
data: ['新增用户', '总用户数']
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
left: '3%',
|
|
||||||
right: '4%',
|
|
||||||
bottom: '3%',
|
|
||||||
containLabel: true
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
boundaryGap: false,
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['userGrowth']['dates'])); ?>
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value'
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: '新增用户',
|
|
||||||
type: 'bar',
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['userGrowth']['newUsers'])); ?>,
|
|
||||||
itemStyle: {
|
|
||||||
color: '#3881fd'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '总用户数',
|
|
||||||
type: 'line',
|
|
||||||
smooth: true,
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['userGrowth']['totalUsers'])); ?>,
|
|
||||||
itemStyle: {
|
|
||||||
color: '#10b981'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
chart.setOption(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 资源统计图表
|
|
||||||
function initResourceStats() {
|
|
||||||
var chart = echarts.init(document.getElementById('resourceStats'));
|
|
||||||
var option = {
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis',
|
|
||||||
axisPointer: {
|
|
||||||
type: 'cross',
|
|
||||||
label: {
|
|
||||||
backgroundColor: '#6a7985'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
data: ['新增资源', '下载量']
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
left: '3%',
|
|
||||||
right: '4%',
|
|
||||||
bottom: '3%',
|
|
||||||
containLabel: true
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
boundaryGap: false,
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['resourceStats']['dates'])); ?>
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value'
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: '新增资源',
|
|
||||||
type: 'bar',
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['resourceStats']['resources'])); ?>,
|
|
||||||
itemStyle: {
|
|
||||||
color: '#3881fd'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '下载量',
|
|
||||||
type: 'line',
|
|
||||||
smooth: true,
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['resourceStats']['downloads'])); ?>,
|
|
||||||
itemStyle: {
|
|
||||||
color: '#10b981'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
chart.setOption(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 文章统计图表
|
|
||||||
function initArticleStats() {
|
|
||||||
var chart = echarts.init(document.getElementById('articleStats'));
|
|
||||||
var option = {
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis',
|
|
||||||
axisPointer: {
|
|
||||||
type: 'cross',
|
|
||||||
label: {
|
|
||||||
backgroundColor: '#6a7985'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
data: ['新增文章', '访问量']
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
left: '3%',
|
|
||||||
right: '4%',
|
|
||||||
bottom: '3%',
|
|
||||||
containLabel: true
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
boundaryGap: false,
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['articleStats']['dates'])); ?>
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value'
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: '新增文章',
|
|
||||||
type: 'bar',
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['articleStats']['articles'])); ?>,
|
|
||||||
itemStyle: {
|
|
||||||
color: '#3881fd'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '访问量',
|
|
||||||
type: 'line',
|
|
||||||
smooth: true,
|
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['articleStats']['views'])); ?>,
|
|
||||||
itemStyle: {
|
|
||||||
color: '#10b981'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
chart.setOption(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化所有图表
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
initVisitTrend();
|
|
||||||
initUserGrowth();
|
|
||||||
initResourceStats();
|
|
||||||
initArticleStats();
|
|
||||||
|
|
||||||
// 监听窗口大小变化,重绘图表
|
|
||||||
window.addEventListener('resize', function() {
|
|
||||||
var charts = document.querySelectorAll('.chart-container');
|
|
||||||
charts.forEach(function(chart) {
|
|
||||||
echarts.getInstanceByDom(chart)?.resize();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,227 +0,0 @@
|
|||||||
<?php /*a:3:{s:75:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzertest\test_static_list.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="header">
|
|
||||||
<span>演示列表-静态表格</span>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加
|
|
||||||
</button>
|
|
||||||
<div></div>
|
|
||||||
</div>
|
|
||||||
<table class="layui-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>文本</th>
|
|
||||||
<th>富文本</th>
|
|
||||||
<th>百度文本</th>
|
|
||||||
<th>图片</th>
|
|
||||||
<th>参照</th>
|
|
||||||
<th>时间戳</th>
|
|
||||||
<th>日期</th>
|
|
||||||
<th>日期时间</th>
|
|
||||||
<th>网址链接</th>
|
|
||||||
<th>操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlentities((string) $vo['test_id']); ?></td>
|
|
||||||
<td><?php echo htmlentities((string) $vo['test_input']); ?></td>
|
|
||||||
<td><?php echo htmlentities((string) $vo['test_rich']); ?></td>
|
|
||||||
<td><?php echo htmlentities((string) $vo['test_rich_baidu']); ?></td>
|
|
||||||
<td>
|
|
||||||
<img style="width:30px;height:30px;" onmouseover="show_img(this)" onmouseleave="hide_img()" src="<?php echo htmlentities((string) $vo['test_img']); ?>">
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php if(($vo['test_reference'] == 1)): ?>
|
|
||||||
<span style="color:green;">开启</span>
|
|
||||||
<?php else: ?>
|
|
||||||
<span style="color:grey;">关闭</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo date('Y-m-d H:i:s',$vo['test_time']); ?></td>
|
|
||||||
<td><?php echo htmlentities((string) $vo['test_data']); ?></td>
|
|
||||||
<td><?php echo htmlentities((string) $vo['test_datatime']); ?></td>
|
|
||||||
<td><a href="<?php echo htmlentities((string) $vo['test_url']); ?>" target="_blank"><?php echo htmlentities((string) $vo['test_url']); ?></a></td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit(<?php echo htmlentities((string) $vo['test_id']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="del(<?php echo htmlentities((string) $vo['test_id']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<div><?php echo $lists; ?></div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer'],function(){
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
// 添加
|
|
||||||
function add(){
|
|
||||||
layer.full(
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '添加',
|
|
||||||
shade: 0.3,
|
|
||||||
maxmin: true,
|
|
||||||
area: ['450px','550px'],
|
|
||||||
content: "<?php echo htmlentities((string) $config['admin_route']); ?>Yunzertest/test_static_add"
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// 编辑
|
|
||||||
function edit(test_id){
|
|
||||||
layer.full(layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '编辑',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['450px','550px'],
|
|
||||||
content: "<?php echo htmlentities((string) $config['admin_route']); ?>Yunzertest/test_static_edit?test_id="+test_id
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
// 删除
|
|
||||||
function del(test_id){
|
|
||||||
layer.confirm('确定要删除吗?', {
|
|
||||||
icon:3,
|
|
||||||
btn: ['确定','取消']
|
|
||||||
}, function(){
|
|
||||||
$.post("<?php echo htmlentities((string) $config['admin_route']); ?>Yunzertest/test_del",{'test_id':test_id},function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.alert(res.msg,{icon:2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{icon:1});
|
|
||||||
setTimeout(function(){window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
<?php /*a:3:{s:69:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\groupedit.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<input type="hidden" name="group_id" value="<?php echo htmlentities((string) $group['group_id']); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">角色名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="group_name" placeholder="请输入角色名称" value="<?php echo htmlentities((string) $group['group_name']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" <?php echo $group['status']==1 ? 'checked' : ''; ?>>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用" <?php echo $group['status']==0 ? 'checked' : ''; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-itme">
|
|
||||||
<label class="layui-form-label">权限菜单</label>
|
|
||||||
<?php if(is_array($menus) || $menus instanceof \think\Collection || $menus instanceof \think\Paginator): $i = 0; $__LIST__ = $menus;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<hr>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="checkbox" name="menu[<?php echo htmlentities((string) $vo['smid']); ?>]" lay-skin="primary" title="<?php echo htmlentities((string) $vo['label']); ?>" <?php echo isset($group['rights']) && $group['rights'] && in_array($vo['smid'],$group['rights'])?'checked':''; ?>>
|
|
||||||
<hr>
|
|
||||||
<?php if(is_array($vo['children']) || $vo['children'] instanceof \think\Collection || $vo['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $vo['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cvo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<input type="checkbox" name="menu[<?php echo htmlentities((string) $cvo['smid']); ?>]" lay-skin="primary" title="<?php echo htmlentities((string) $cvo['label']); ?>" <?php echo isset($group['rights']) && $group['rights'] && in_array($cvo['smid'],$group['rights'])?'checked':''; ?>>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
var form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
|
|
||||||
function save(){
|
|
||||||
$.post("<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/groupedit",$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,379 +0,0 @@
|
|||||||
<?php /*a:2:{s:50:"E:\Demo\PHP\yunzer\app\admin\view\article\edit.php";i:1746803972;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746796639;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/third/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/third/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header" style="display:flex;justify-content: space-between;">
|
|
||||||
<div>
|
|
||||||
<span>编辑文章</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="goBack()">
|
|
||||||
<i class="layui-icon layui-icon-return"></i>返回
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">标题</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入文章标题" autocomplete="off"
|
|
||||||
class="layui-input" value="<?php echo htmlentities((string) $info['title']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cate" lay-verify="required">
|
|
||||||
<option value="">请选择分类</option>
|
|
||||||
<?php foreach($cates as $item): ?>
|
|
||||||
<option value="<?php echo htmlentities((string) $item['id']); ?>" <?php if($info['cate']==$item['id']): ?>selected<?php endif; ?>><?php echo htmlentities((string) $item['name']); ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">描述</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<textarea name="desc" placeholder="请输入描述内容" class="layui-textarea"><?php echo htmlentities((string) $info['desc']); ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">作者</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="author" required lay-verify="required" placeholder="请输入作者" autocomplete="off"
|
|
||||||
class="layui-input" value="<?php echo htmlentities((string) $info['author']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">封面</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" id="upload-btn">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 图片上传
|
|
||||||
</button>
|
|
||||||
<div style="width: 120px;">
|
|
||||||
<div class="layui-upload-list">
|
|
||||||
<img class="layui-upload-img" id="upload-img"
|
|
||||||
style="width: 118px; height: 118px;object-fit: cover;" src="<?php echo htmlentities((string) $info['image']); ?>">
|
|
||||||
<div id="upload-text"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-demo">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="image" value="<?php echo htmlentities((string) $info['image']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
|
||||||
<label class="layui-form-label">内容</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div id="editor—wrapper" id="content" name="content" style="border: 1px solid #ccc;">
|
|
||||||
<div id="toolbar-container" style="border-bottom: 1px solid #ccc;"><!-- 工具栏 --></div>
|
|
||||||
<div id="editor-container" style="height: 800px;"><!-- 编辑器 --></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
|
||||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="formDraft">存草稿</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/js/wangeditor.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var element = layui.element;
|
|
||||||
|
|
||||||
// 图片上传
|
|
||||||
var uploadInst = upload.render({
|
|
||||||
elem: '#upload-btn',
|
|
||||||
url: '<?php echo url("index/upload_img"); ?>', // 上传图片接口
|
|
||||||
before: function (obj) {
|
|
||||||
// 预读本地文件示例,不支持ie8
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#upload-img').attr('src', result); // 图片链接(base64)
|
|
||||||
});
|
|
||||||
element.progress('filter-demo', '0%'); // 进度条复位
|
|
||||||
layer.msg('上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
// 若上传失败
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
// 上传成功
|
|
||||||
$('#image').val(res.data); // 设置图片路径到隐藏输入框
|
|
||||||
$('#upload-text').html(''); // 置空上传失败的状态
|
|
||||||
layer.msg('上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () { // 这里改为 uploadError
|
|
||||||
// 演示失败状态,并实现重传
|
|
||||||
var demoText = $('#upload-text');
|
|
||||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
||||||
demoText.find('.demo-reload').on('click', function () {
|
|
||||||
uploadInst.upload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 进度条
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('filter-demo', n + '%'); // 可配合 layui 进度条元素使用
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("article/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="">请选择分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
// 如果cid为0,则设置为禁用
|
|
||||||
var disabled = item.cid == 0 ? 'disabled' : '';
|
|
||||||
var selected = item.id == '<?php echo htmlentities((string) $info['cate']); ?>' ? 'selected' : '';
|
|
||||||
html += '<option value="' + item.id + '" ' + disabled + ' ' + selected + '>' + item.name + '</option>';
|
|
||||||
// 如果有子分类,添加子分类选项
|
|
||||||
if (item.children && item.children.length > 0) {
|
|
||||||
item.children.forEach(function (child) {
|
|
||||||
var childSelected = child.id == '<?php echo htmlentities((string) $info['cate']); ?>' ? 'selected' : '';
|
|
||||||
html += '<option value="' + child.id + '" ' + childSelected + '>├─ ' + child.name + '</option>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('select[name="cate"]').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
// 获取编辑器内容
|
|
||||||
var content = editor.getHtml();
|
|
||||||
if (!content || content === '<p><br></p>') {
|
|
||||||
layer.msg('请输入文章内容', { icon: 2 });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var loadIndex = layer.load(2);
|
|
||||||
data.field.content = content;
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo url("article/edit"); ?>?id=<?php echo htmlentities((string) $info['id']); ?>',
|
|
||||||
type: 'POST',
|
|
||||||
data: data.field,
|
|
||||||
success: function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
window.location.href = '<?php echo url("article/articlelist"); ?>';
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 返回上一页
|
|
||||||
function goBack() {
|
|
||||||
var index = parent.layer.getFrameIndex(window.name);
|
|
||||||
parent.layer.close(index);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- wangeditor编辑器脚本 -->
|
|
||||||
<script>
|
|
||||||
const { createEditor, createToolbar } = window.wangEditor
|
|
||||||
|
|
||||||
const editorConfig = {
|
|
||||||
MENU_CONF: {},
|
|
||||||
placeholder: '请输入内容...',
|
|
||||||
onChange(editor) {
|
|
||||||
const html = editor.getHtml()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// 配置图片上传
|
|
||||||
editorConfig.MENU_CONF['uploadImage'] = {
|
|
||||||
server: '<?php echo url("index/upload_imgs"); ?>',
|
|
||||||
fieldName: 'file',
|
|
||||||
maxFileSize: 10 * 1024 * 1024, // 10M
|
|
||||||
maxNumberOfFiles: 10,
|
|
||||||
allowedFileTypes: ['image/*'],
|
|
||||||
meta: {
|
|
||||||
token: 'xxx'
|
|
||||||
},
|
|
||||||
metaWithUrl: true,
|
|
||||||
headers: {
|
|
||||||
Accept: 'text/x-json'
|
|
||||||
},
|
|
||||||
timeout: 5 * 1000, // 5s
|
|
||||||
|
|
||||||
onBeforeUpload(file) {
|
|
||||||
console.log('准备上传图片', file)
|
|
||||||
return file
|
|
||||||
},
|
|
||||||
onProgress(progress) {
|
|
||||||
console.log('上传进度', progress)
|
|
||||||
},
|
|
||||||
onSuccess(file, res) {
|
|
||||||
console.log('上传成功', file, res)
|
|
||||||
},
|
|
||||||
onFailed(file, res) {
|
|
||||||
layer.msg('上传失败:' + res.msg, { icon: 2 })
|
|
||||||
console.log('上传失败', file, res)
|
|
||||||
},
|
|
||||||
onError(file, err, res) {
|
|
||||||
layer.msg('上传出错:' + err.message, { icon: 2 })
|
|
||||||
console.error('上传出错', file, err, res)
|
|
||||||
},
|
|
||||||
customInsert(res, insertFn) {
|
|
||||||
// res 即服务端的返回结果
|
|
||||||
if (res.code === 0 && res.data) {
|
|
||||||
// 从res.data中获取src字段
|
|
||||||
const url = String(res.data.src || '');
|
|
||||||
if (url) {
|
|
||||||
insertFn(url);
|
|
||||||
} else {
|
|
||||||
layer.msg('图片地址无效', { icon: 2 });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
layer.msg('图片上传失败', { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const editor = createEditor({
|
|
||||||
selector: '#editor-container',
|
|
||||||
html: `<?php echo (isset($info['content']) && ($info['content'] !== '')?$info['content']:''); ?>`,
|
|
||||||
config: editorConfig,
|
|
||||||
mode: 'default', // or 'simple'
|
|
||||||
})
|
|
||||||
|
|
||||||
const toolbarConfig = {}
|
|
||||||
|
|
||||||
const toolbar = createToolbar({
|
|
||||||
editor,
|
|
||||||
selector: '#toolbar-container',
|
|
||||||
config: toolbarConfig,
|
|
||||||
mode: 'default', // or 'simple'
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
//返回文章列表
|
|
||||||
function goBack() {
|
|
||||||
window.location.href = '<?php echo url("article/articlelist"); ?>';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,310 +0,0 @@
|
|||||||
<?php /*a:2:{s:51:"E:\Demo\PHP\yunzer\app\admin\view\log\operation.php";i:1747589059;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span class="layui-badge layui-bg-blue">操作日志</span>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<form class="layui-form layui-form-pane" action="">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">用户名</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">模块</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" name="module" placeholder="请输入模块" autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">操作</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" name="operation" placeholder="请输入操作" autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="status">
|
|
||||||
<option value="">全部</option>
|
|
||||||
<option value="1">成功</option>
|
|
||||||
<option value="0">失败</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">时间范围</label>
|
|
||||||
<div class="layui-input-inline" style="width: 300px;">
|
|
||||||
<input type="text" name="time_range" class="layui-input" id="timeRange" placeholder="请选择时间范围">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="searchForm">
|
|
||||||
<i class="layui-icon layui-icon-search"></i> 搜索
|
|
||||||
</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<table id="operationLogTable" lay-filter="operationLogTable"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/html" id="tableToolbar">
|
|
||||||
<div class="layui-btn-container">
|
|
||||||
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="clearAll">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i> 清空日志
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="tableBar">
|
|
||||||
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script src="/static/layui/layui.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.use(['table', 'form', 'laydate', 'layer'], function(){
|
|
||||||
var table = layui.table;
|
|
||||||
var form = layui.form;
|
|
||||||
var laydate = layui.laydate;
|
|
||||||
var layer = layui.layer;
|
|
||||||
|
|
||||||
// 初始化时间范围选择器
|
|
||||||
laydate.render({
|
|
||||||
elem: '#timeRange',
|
|
||||||
type: 'datetime',
|
|
||||||
range: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#operationLogTable',
|
|
||||||
url: '<?php echo url("log/operation"); ?>',
|
|
||||||
method: 'get',
|
|
||||||
toolbar: '#tableToolbar',
|
|
||||||
defaultToolbar: ['filter', 'exports', 'print'],
|
|
||||||
parseData: function(res) {
|
|
||||||
return {
|
|
||||||
"code": 0,
|
|
||||||
"msg": res.msg || '获取成功',
|
|
||||||
"count": res.count || 0,
|
|
||||||
"data": res.data || []
|
|
||||||
};
|
|
||||||
},
|
|
||||||
cols: [[
|
|
||||||
{field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
|
|
||||||
{field: 'username', title: '操作人', width: 120, align: 'center'},
|
|
||||||
{field: 'module', title: '模块', width: 120, align: 'center'},
|
|
||||||
{field: 'operation', title: '操作', width: 150, align: 'center'},
|
|
||||||
{field: 'request_method', title: '请求方法', width: 100, align: 'center'},
|
|
||||||
{field: 'request_url', title: '请求地址', align: 'center'},
|
|
||||||
{field: 'ip_address', title: 'IP地址', width: 120, align: 'center'},
|
|
||||||
{field: 'status', title: '状态', width: 100, align: 'center', templet: function(d){
|
|
||||||
return d.status == 1 ? '<span class="layui-badge layui-bg-green">成功</span>' : '<span class="layui-badge layui-bg-red">失败</span>';
|
|
||||||
}},
|
|
||||||
{field: 'operation_time', title: '操作时间', width: 180, align: 'center'},
|
|
||||||
{field: 'execution_time', title: '执行时间(ms)', width: 120, align: 'center'},
|
|
||||||
{title: '操作', width: 120, toolbar: '#operationBar', fixed: 'right', align: 'center'}
|
|
||||||
]],
|
|
||||||
page: true,
|
|
||||||
limit: 10,
|
|
||||||
limits: [10, 20, 50, 100]
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听搜索表单提交
|
|
||||||
form.on('submit(searchForm)', function(data){
|
|
||||||
var timeRange = data.field.time_range;
|
|
||||||
if(timeRange){
|
|
||||||
var times = timeRange.split(' - ');
|
|
||||||
data.field.start_time = times[0];
|
|
||||||
data.field.end_time = times[1];
|
|
||||||
}
|
|
||||||
delete data.field.time_range;
|
|
||||||
|
|
||||||
table.reload('operationLogTable', {
|
|
||||||
where: data.field,
|
|
||||||
page: {curr: 1}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听工具条
|
|
||||||
table.on('tool(operationLogTable)', function(obj){
|
|
||||||
var data = obj.data;
|
|
||||||
if(obj.event === 'del'){
|
|
||||||
layer.confirm('确定删除这条日志吗?', function(index){
|
|
||||||
$.post('<?php echo url("log/deleteOperation"); ?>', {id: data.id}, function(res){
|
|
||||||
if(res.code === 0){
|
|
||||||
layer.msg(res.msg, {icon: 1});
|
|
||||||
obj.del();
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg, {icon: 2});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if(obj.event === 'detail'){
|
|
||||||
// 获取详情
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo url("log/getOperationDetail"); ?>',
|
|
||||||
type: 'GET',
|
|
||||||
data: {id: data.id},
|
|
||||||
success: function(res){
|
|
||||||
if(res.code === 0){
|
|
||||||
var detail = res.data;
|
|
||||||
var content = '<div class="layui-card">' +
|
|
||||||
'<div class="layui-card-body">' +
|
|
||||||
'<table class="layui-table" lay-skin="nob">' +
|
|
||||||
'<colgroup><col width="100"><col></colgroup>' +
|
|
||||||
'<tbody>' +
|
|
||||||
'<tr><td>操作人:</td><td>' + detail.username + '</td></tr>' +
|
|
||||||
'<tr><td>模块:</td><td>' + detail.module + '</td></tr>' +
|
|
||||||
'<tr><td>操作:</td><td>' + detail.operation + '</td></tr>' +
|
|
||||||
'<tr><td>请求方法:</td><td>' + detail.request_method + '</td></tr>' +
|
|
||||||
'<tr><td>请求地址:</td><td>' + detail.request_url + '</td></tr>' +
|
|
||||||
'<tr><td>请求参数:</td><td><pre>' + JSON.stringify(detail.request_params, null, 2) + '</pre></td></tr>' +
|
|
||||||
'<tr><td>IP地址:</td><td>' + detail.ip_address + '</td></tr>' +
|
|
||||||
'<tr><td>状态:</td><td>' + (detail.status == 1 ? '成功' : '失败') + '</td></tr>' +
|
|
||||||
'<tr><td>错误信息:</td><td>' + (detail.error_message || '无') + '</td></tr>' +
|
|
||||||
'<tr><td>操作时间:</td><td>' + detail.operation_time + '</td></tr>' +
|
|
||||||
'<tr><td>执行时间:</td><td>' + detail.execution_time + 'ms</td></tr>' +
|
|
||||||
'</tbody></table></div></div>';
|
|
||||||
|
|
||||||
layer.open({
|
|
||||||
type: 1,
|
|
||||||
title: '操作日志详情',
|
|
||||||
area: ['800px', '600px'],
|
|
||||||
content: content
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听头工具栏事件
|
|
||||||
table.on('toolbar(operationLogTable)', function(obj){
|
|
||||||
if(obj.event === 'clearAll'){
|
|
||||||
layer.confirm('确定要清空所有操作日志吗?', function(index){
|
|
||||||
$.post('<?php echo url("log/clearOperation"); ?>', function(res){
|
|
||||||
if(res.code === 0){
|
|
||||||
layer.msg(res.msg, {icon: 1});
|
|
||||||
table.reload('operationLogTable');
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg, {icon: 2});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- 表格工具栏模板 -->
|
|
||||||
<script type="text/html" id="operationBar">
|
|
||||||
<a class="layui-btn layui-btn-xs" lay-event="detail">详情</a>
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
<?php /*a:3:{s:65:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\configedit.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">关键词</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" id="config_name" name="config_name" placeholder="请输入关键词,在代码中的key" value="<?php echo htmlentities((string) $find['config_name']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">作用</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" id="config_info" name="config_info" placeholder="请输入作用" value="<?php echo htmlentities((string) $find['config_info']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">类型</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select id="config_type" name="config_type" lay-filter="config_type">
|
|
||||||
<option value="1" <?php echo $find['config_type']==1 ? 'selected' : ''; ?>>文本</option>
|
|
||||||
<option value="2" <?php echo $find['config_type']==2 ? 'selected' : ''; ?>>图片</option>
|
|
||||||
<option value="3" <?php echo $find['config_type']==3 ? 'selected' : ''; ?>>富文本</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">说明</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" id="config_desc" name="config_desc" placeholder="请输入说明" value="<?php echo htmlentities((string) $find['config_desc']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" class="layui-input" id="config_sort" name="config_sort" placeholder="请输入排序,值越大,越靠前" value="<?php echo htmlentities((string) $find['config_sort']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select id="config_status" name="config_status" lay-filter="config_status">
|
|
||||||
<option value="1" <?php echo $find['config_status']==1 ? 'selected' : ''; ?>>开启</option>
|
|
||||||
<option value="0" <?php echo $find['config_status']==0 ? 'selected' : ''; ?>>禁用</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,426 +0,0 @@
|
|||||||
<?php /*a:2:{s:52:"E:\Demo\PHP\yunzer\app\admin\view\resources\edit.php";i:1747409592;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header" style="display:flex;justify-content: space-between;">
|
|
||||||
<div>
|
|
||||||
<span>编辑资源</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="goBack()">
|
|
||||||
<i class="layui-icon layui-icon-return"></i>返回
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<input type="hidden" name="id" value="<?php echo htmlentities((string) (isset($resource['id']) && ($resource['id'] !== '')?$resource['id']:'')); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入资源名称" autocomplete="off"
|
|
||||||
class="layui-input" value="<?php echo htmlentities((string) (isset($resource['title']) && ($resource['title'] !== '')?$resource['title']:'')); ?>" lay-affix="clear">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cate" lay-verify="required">
|
|
||||||
<option value="">请选择分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">描述</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<textarea name="desc" placeholder="请输入资源描述" class="layui-textarea" lay-affix="clear"><?php echo htmlentities((string) (isset($resource['desc']) && ($resource['desc'] !== '')?$resource['desc']:'')); ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">上传者</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="uploader" required lay-verify="required" placeholder="请输入上传者"
|
|
||||||
autocomplete="off" class="layui-input" value="<?php echo htmlentities((string) (isset($resource['uploader']) && ($resource['uploader'] !== '')?$resource['uploader']:'')); ?>" lay-affix="clear">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" id="upload-btn">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 图标上传
|
|
||||||
</button>
|
|
||||||
<div style="width: 120px;">
|
|
||||||
<div class="layui-upload-list">
|
|
||||||
<img class="layui-upload-img" id="upload-img"
|
|
||||||
style="width: 118px; height: 118px;object-fit: cover;">
|
|
||||||
<div id="upload-text"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="icon-progress">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="icon" id="icon" value="">
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid layui-word-aux">建议尺寸:128px * 128px</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源文件</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="fileurl" required placeholder="本地资源地址" autocomplete="off"
|
|
||||||
class="layui-input" value="<?php echo htmlentities((string) (isset($resource['fileurl']) && ($resource['fileurl'] !== '')?$resource['fileurl']:'')); ?>" style="margin-bottom: 10px;" lay-affix="clear">
|
|
||||||
<div class="layui-upload-drag" style="display: block;" id="ID-upload-demo-drag">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i>
|
|
||||||
<div>点击上传,或将文件拖拽到此处</div>
|
|
||||||
<div class="layui-hide" id="ID-upload-demo-preview">
|
|
||||||
<hr>
|
|
||||||
<div class="file-info">
|
|
||||||
<i class="layui-icon layui-icon-file"></i>
|
|
||||||
<span class="file-name"></span>
|
|
||||||
<span class="file-size"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="file-progress" style="margin-top: 10px;">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="file" id="file" value="">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源链接</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="url" required placeholder="百度网盘、115网盘、蓝奏云等" autocomplete="off"
|
|
||||||
class="layui-input" value="<?php echo htmlentities((string) (isset($resource['url']) && ($resource['url'] !== '')?$resource['url']:'')); ?>" lay-affix="clear">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分享码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="code" required placeholder="请输入分享码" autocomplete="off"
|
|
||||||
class="layui-input" value="<?php echo htmlentities((string) (isset($resource['code']) && ($resource['code'] !== '')?$resource['code']:'')); ?>" lay-affix="clear">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" name="sort" value="<?php echo htmlentities((string) (isset($resource['sort']) && ($resource['sort'] !== '')?$resource['sort']:'0')); ?>" class="layui-input" placeholder="数字越大越靠前" lay-affix="clear">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.$;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var element = layui.element;
|
|
||||||
|
|
||||||
// 获取资源详情
|
|
||||||
var resourceId = $('input[name="id"]').val();
|
|
||||||
var resourceData = null;
|
|
||||||
|
|
||||||
if (resourceId) {
|
|
||||||
$.get('<?php echo url("resources/get"); ?>', {id: resourceId}, function(res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
resourceData = res.data;
|
|
||||||
console.log('Resource data:', resourceData); // 调试输出
|
|
||||||
|
|
||||||
// 设置表单值
|
|
||||||
$('input[name="title"]').val(resourceData.title || '');
|
|
||||||
$('select[name="cate"]').val(resourceData.cate || '');
|
|
||||||
form.render('select'); // 重新渲染select以显示选中值
|
|
||||||
$('textarea[name="desc"]').val(resourceData.desc || '');
|
|
||||||
$('input[name="uploader"]').val(resourceData.uploader || '');
|
|
||||||
$('input[name="url"]').val(resourceData.url || '');
|
|
||||||
$('input[name="code"]').val(resourceData.code || '');
|
|
||||||
$('input[name="sort"]').val(resourceData.sort || '0');
|
|
||||||
$('input[name="icon"]').val(resourceData.icon || '');
|
|
||||||
$('input[name="file"]').val(resourceData.file || '');
|
|
||||||
|
|
||||||
// 设置图标预览
|
|
||||||
if (resourceData.icon) {
|
|
||||||
$('#upload-img').attr('src', resourceData.icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置文件预览
|
|
||||||
if (resourceData.file) {
|
|
||||||
$('#ID-upload-demo-preview').show();
|
|
||||||
$('.file-name').text(resourceData.file_name || '已上传文件');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 图标上传
|
|
||||||
var iconUpload = upload.render({
|
|
||||||
elem: '#upload-btn',
|
|
||||||
url: '<?php echo url("index/upload_img"); ?>',
|
|
||||||
before: function (obj) {
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#upload-img').attr('src', result);
|
|
||||||
});
|
|
||||||
element.progress('icon-progress', '0%');
|
|
||||||
layer.msg('图标上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('图标上传失败');
|
|
||||||
}
|
|
||||||
$('#icon').val(res.data);
|
|
||||||
$('#upload-text').html('');
|
|
||||||
layer.msg('图标上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () {
|
|
||||||
var demoText = $('#upload-text');
|
|
||||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
||||||
demoText.find('.demo-reload').on('click', function () {
|
|
||||||
iconUpload.upload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('icon-progress', n + '%');
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('图标上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 文件上传
|
|
||||||
var fileUpload = upload.render({
|
|
||||||
elem: '#ID-upload-demo-drag',
|
|
||||||
url: '<?php echo url("index/upload_file"); ?>',
|
|
||||||
accept: 'file',
|
|
||||||
exts: 'doc|docx|xls|xlsx|ppt|pptx|pdf|txt|zip|rar|7z',
|
|
||||||
before: function (obj) {
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#ID-upload-demo-preview').show();
|
|
||||||
$('.file-name').text(file.name);
|
|
||||||
$('.file-size').text(formatFileSize(file.size));
|
|
||||||
});
|
|
||||||
element.progress('file-progress', '0%');
|
|
||||||
layer.msg('文件上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('文件上传失败');
|
|
||||||
}
|
|
||||||
$('#file').val(res.data.src);
|
|
||||||
$('input[name="fileurl"]').val(res.data.src);
|
|
||||||
layer.msg('文件上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () {
|
|
||||||
layer.msg('文件上传失败', { icon: 2 });
|
|
||||||
},
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('file-progress', n + '%');
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('文件上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 格式化文件大小
|
|
||||||
function formatFileSize(bytes) {
|
|
||||||
if (bytes === 0) return '0 B';
|
|
||||||
const k = 1024;
|
|
||||||
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
||||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
||||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("resources/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="">请选择分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
html += '<option value="' + item.id + '">' + item.name + '</option>';
|
|
||||||
if (item.children && item.children.length > 0) {
|
|
||||||
item.children.forEach(function (child) {
|
|
||||||
html += '<option value="' + child.id + '">├─ ' + child.name + '</option>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('select[name="cate"]').html(html);
|
|
||||||
|
|
||||||
// 如果有资源数据,设置分类值
|
|
||||||
if (resourceData && resourceData.cate) {
|
|
||||||
console.log('Setting cate value:', resourceData.cate); // 调试输出
|
|
||||||
setTimeout(function() {
|
|
||||||
$('select[name="cate"]').val(resourceData.cate);
|
|
||||||
form.render('select');
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
var loadIndex = layer.load(2);
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo url("resources/edit"); ?>',
|
|
||||||
type: 'POST',
|
|
||||||
data: data.field,
|
|
||||||
success: function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
window.location.href = '<?php echo url("resources/lists"); ?>';
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 重置按钮点击事件
|
|
||||||
$('button[type="reset"]').on('click', function() {
|
|
||||||
// 重新加载分类列表
|
|
||||||
$.get('<?php echo url("resources/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="">请选择分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
html += '<option value="' + item.id + '">' + item.name + '</option>';
|
|
||||||
if (item.children && item.children.length > 0) {
|
|
||||||
item.children.forEach(function (child) {
|
|
||||||
html += '<option value="' + child.id + '">├─ ' + child.name + '</option>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('select[name="cate"]').html(html);
|
|
||||||
|
|
||||||
// 如果有资源数据,设置分类值
|
|
||||||
if (resourceData && resourceData.cate) {
|
|
||||||
setTimeout(function() {
|
|
||||||
$('select[name="cate"]').val(resourceData.cate);
|
|
||||||
form.render('select');
|
|
||||||
}, 100);
|
|
||||||
} else {
|
|
||||||
form.render('select');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
//返回资源列表
|
|
||||||
function goBack() {
|
|
||||||
window.location.href = '<?php echo url("resources/lists"); ?>';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
<?php /*a:3:{s:59:"E:\Demo\PHP\yunzer\app\admin\view\yunzeradmin\groupedit.php";i:1745855804;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<input type="hidden" name="group_id" value="<?php echo htmlentities((string) $group['group_id']); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">角色名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="group_name" placeholder="请输入角色名称" value="<?php echo htmlentities((string) $group['group_name']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" <?php echo $group['status']==1 ? 'checked' : ''; ?>>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用" <?php echo $group['status']==0 ? 'checked' : ''; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-itme">
|
|
||||||
<label class="layui-form-label">权限菜单</label>
|
|
||||||
<?php if(is_array($menus) || $menus instanceof \think\Collection || $menus instanceof \think\Paginator): $i = 0; $__LIST__ = $menus;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<hr>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="checkbox" name="menu[<?php echo htmlentities((string) $vo['smid']); ?>]" lay-skin="primary" title="<?php echo htmlentities((string) $vo['label']); ?>" <?php echo isset($group['rights']) && $group['rights'] && in_array($vo['smid'],$group['rights'])?'checked':''; ?>>
|
|
||||||
<hr>
|
|
||||||
<?php if(is_array($vo['children']) || $vo['children'] instanceof \think\Collection || $vo['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $vo['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cvo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<input type="checkbox" name="menu[<?php echo htmlentities((string) $cvo['smid']); ?>]" lay-skin="primary" title="<?php echo htmlentities((string) $cvo['label']); ?>" <?php echo isset($group['rights']) && $group['rights'] && in_array($cvo['smid'],$group['rights'])?'checked':''; ?>>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
var form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
|
|
||||||
function save(){
|
|
||||||
$.post("<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/groupedit",$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,304 +0,0 @@
|
|||||||
<?php /*a:2:{s:63:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\resources\lists.php";i:1747624589;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-file"></i>
|
|
||||||
<span>资源列表</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div class="shaixuan">
|
|
||||||
<label>筛选:</label>
|
|
||||||
<div class="layui-form" style="display: flex; gap: 10px;">
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select id="categoryFilter" lay-filter="categoryFilter" lay-verify="">
|
|
||||||
<option value="">全部分类</option>
|
|
||||||
<?php if(is_array($categories) || $categories instanceof \think\Collection || $categories instanceof \think\Paginator): $i = 0; $__LIST__ = $categories;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$category): $mod = ($i % 2 );++$i;?>
|
|
||||||
<optgroup label="<?php echo htmlentities((string) $category['name']); ?>">
|
|
||||||
<?php if(is_array($category['children']) || $category['children'] instanceof \think\Collection || $category['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $category['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$subCategory): $mod = ($i % 2 );++$i;?>
|
|
||||||
<option value="<?php echo htmlentities((string) $subCategory['id']); ?>"><?php echo htmlentities((string) $subCategory['name']); ?></option>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</optgroup>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" id="nameSearch" placeholder="搜索资源名称" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" id="uploaderSearch" placeholder="搜索上传者" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="doSearch()">
|
|
||||||
<i class="layui-icon layui-icon-search"></i>搜索
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="doRefresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>重置
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加资源
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table id="resourceTable" lay-filter="resourceTable"></table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/html" id="iconTemplate">
|
|
||||||
{{# if(d.icon){ }}
|
|
||||||
<img src="{{ d.icon }}" style="max-width: 50px; max-height: 50px;">
|
|
||||||
{{# } }}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="statusTemplate">
|
|
||||||
{{# if(d.status == '0'){ }}
|
|
||||||
<span style="color:red;">未审核</span>
|
|
||||||
{{# } else if(d.status == '1'){ }}
|
|
||||||
<span style="color:orange;">待审核</span>
|
|
||||||
{{# } else if(d.status == '2'){ }}
|
|
||||||
<span style="color:green;">已发布</span>
|
|
||||||
{{# } else if(d.status == '3'){ }}
|
|
||||||
<span style="color:gray;">已下架</span>
|
|
||||||
{{# } }}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="operationBar">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'form', 'table'], function () {
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var form = layui.form;
|
|
||||||
var table = layui.table;
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#resourceTable',
|
|
||||||
url: '/admin/resources/lists',
|
|
||||||
method: 'post',
|
|
||||||
cols: [[
|
|
||||||
{ field: 'id', title: 'ID', align: 'center', width: 80 },
|
|
||||||
{ field: 'title', title: '资源名称' },
|
|
||||||
{ field: 'cate', title: '分类', align: 'center', width: 120 },
|
|
||||||
{ field: 'icon', title: '图标', templet: '#iconTemplate', align: 'center', width: 100 },
|
|
||||||
{ field: 'uploader', title: '上传者', align: 'center', width: 100 },
|
|
||||||
{ field: 'desc', title: '描述', width: 200 },
|
|
||||||
{ field: 'status', title: '状态', templet: '#statusTemplate', align: 'center', width: 80 },
|
|
||||||
{ title: '操作', toolbar: '#operationBar', align: 'center', width: 150, fixed: 'right' }
|
|
||||||
]],
|
|
||||||
page: true,
|
|
||||||
limit: 10,
|
|
||||||
limits: [10, 50, 100],
|
|
||||||
//height: 'full-220'
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听工具条事件
|
|
||||||
table.on('tool(resourceTable)', function (obj) {
|
|
||||||
var data = obj.data;
|
|
||||||
if (obj.event === 'edit') {
|
|
||||||
edit(data.id);
|
|
||||||
} else if (obj.event === 'del') {
|
|
||||||
del(data.id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听分类筛选变化
|
|
||||||
form.on('select(categoryFilter)', function (data) {
|
|
||||||
filterByCategory(data.value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function filterByCategory(categoryId) {
|
|
||||||
reloadTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function doSearch() {
|
|
||||||
var nameKeyword = $('#nameSearch').val().trim();
|
|
||||||
var uploaderKeyword = $('#uploaderSearch').val().trim();
|
|
||||||
|
|
||||||
if (!nameKeyword && !uploaderKeyword && !$('#categoryFilter').val()) {
|
|
||||||
layer.msg('请输入搜索条件', { icon: 0 });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
reloadTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function doRefresh() {
|
|
||||||
// 清空搜索条件
|
|
||||||
$('#nameSearch').val('');
|
|
||||||
$('#uploaderSearch').val('');
|
|
||||||
$('#categoryFilter').val('');
|
|
||||||
layui.form.render('select'); // 重新渲染select
|
|
||||||
|
|
||||||
// 重新加载表格,不带任何筛选条件
|
|
||||||
layui.table.reload('resourceTable', {
|
|
||||||
where: {},
|
|
||||||
page: {
|
|
||||||
curr: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
layer.msg('已重置', { icon: 1 });
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadTable() {
|
|
||||||
var categoryId = $('#categoryFilter').val();
|
|
||||||
var categoryName = '';
|
|
||||||
if (categoryId) {
|
|
||||||
var selectedOption = $('#categoryFilter option[value="' + categoryId + '"]');
|
|
||||||
if (selectedOption.length > 0) {
|
|
||||||
categoryName = selectedOption.text().trim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var nameKeyword = $('#nameSearch').val().trim();
|
|
||||||
var uploaderKeyword = $('#uploaderSearch').val().trim();
|
|
||||||
|
|
||||||
layui.table.reload('resourceTable', {
|
|
||||||
where: {
|
|
||||||
category: categoryName,
|
|
||||||
name: nameKeyword,
|
|
||||||
uploader: uploaderKeyword
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
curr: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function add() {
|
|
||||||
window.location.href = '/admin/resources/add';
|
|
||||||
}
|
|
||||||
|
|
||||||
function edit(id) {
|
|
||||||
window.location.href = '/admin/resources/edit?id=' + id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function del(id) {
|
|
||||||
layer.confirm('确定要删除该资源吗?', {
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.post('/admin/resources/delete', { id: id }, function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
layui.table.reload('resourceTable');
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
layui.table.reload('resourceTable');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,368 +0,0 @@
|
|||||||
<?php /*a:2:{s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\add.php";i:1746841528;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header" style="display:flex;justify-content: space-between;">
|
|
||||||
<div>
|
|
||||||
<span>添加文章</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="goBack()">
|
|
||||||
<i class="layui-icon layui-icon-return"></i>返回
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">标题</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入文章标题" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cate" lay-verify="required">
|
|
||||||
<option value="">请选择分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">描述</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<textarea name="desc" placeholder="请输入描述内容" class="layui-textarea"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">作者</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="author" required lay-verify="required" placeholder="请输入作者" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">封面</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" id="upload-btn">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 图片上传
|
|
||||||
</button>
|
|
||||||
<div style="width: 120px;">
|
|
||||||
<div class="layui-upload-list">
|
|
||||||
<img class="layui-upload-img" id="upload-img"
|
|
||||||
style="width: 118px; height: 118px;object-fit: cover;">
|
|
||||||
<div id="upload-text"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-demo">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="image" value="">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
|
||||||
<label class="layui-form-label">内容</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div id="editor—wrapper" id="content" name="content" style="border: 1px solid #ccc;">
|
|
||||||
<div id="toolbar-container" style="border-bottom: 1px solid #ccc;"><!-- 工具栏 --></div>
|
|
||||||
<div id="editor-container" style="height: 800px;"><!-- 编辑器 --></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
|
||||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="formDraft">存草稿</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/js/wangeditor.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var element = layui.element;
|
|
||||||
|
|
||||||
// 图片上传
|
|
||||||
var uploadInst = upload.render({
|
|
||||||
elem: '#upload-btn',
|
|
||||||
url: '<?php echo url("index/upload_img"); ?>', // 上传图片接口
|
|
||||||
before: function (obj) {
|
|
||||||
// 预读本地文件示例,不支持ie8
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#upload-img').attr('src', result); // 图片链接(base64)
|
|
||||||
});
|
|
||||||
element.progress('filter-demo', '0%'); // 进度条复位
|
|
||||||
layer.msg('上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
// 若上传失败
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
// 上传成功
|
|
||||||
$('#image').val(res.data); // 设置图片路径到隐藏输入框
|
|
||||||
$('#upload-text').html(''); // 置空上传失败的状态
|
|
||||||
layer.msg('上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () { // 这里改为 uploadError
|
|
||||||
// 演示失败状态,并实现重传
|
|
||||||
var demoText = $('#upload-text');
|
|
||||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
||||||
demoText.find('.demo-reload').on('click', function () {
|
|
||||||
uploadInst.upload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 进度条
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('filter-demo', n + '%'); // 可配合 layui 进度条元素使用
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("article/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="">请选择分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
// 如果cid为0,则设置为禁用
|
|
||||||
var disabled = item.cid == 0 ? 'disabled' : '';
|
|
||||||
html += '<option value="' + item.id + '" ' + disabled + '>' + item.name + '</option>';
|
|
||||||
// 如果有子分类,添加子分类选项
|
|
||||||
if (item.children && item.children.length > 0) {
|
|
||||||
item.children.forEach(function (child) {
|
|
||||||
html += '<option value="' + child.id + '">├─ ' + child.name + '</option>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('select[name="cate"]').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
// 获取编辑器内容
|
|
||||||
var content = editor.getHtml();
|
|
||||||
if (!content || content === '<p><br></p>') {
|
|
||||||
layer.msg('请输入文章内容', { icon: 2 });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var loadIndex = layer.load(2);
|
|
||||||
data.field.content = content;
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo url("article/add"); ?>',
|
|
||||||
type: 'POST',
|
|
||||||
data: data.field,
|
|
||||||
success: function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
window.location.href = '<?php echo url("article/articlelist"); ?>';
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- wangeditor编辑器脚本 -->
|
|
||||||
<script>
|
|
||||||
const { createEditor, createToolbar } = window.wangEditor
|
|
||||||
|
|
||||||
const editorConfig = {
|
|
||||||
MENU_CONF: {},
|
|
||||||
placeholder: '请输入内容...',
|
|
||||||
onChange(editor) {
|
|
||||||
const html = editor.getHtml()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// 配置图片上传
|
|
||||||
editorConfig.MENU_CONF['uploadImage'] = {
|
|
||||||
server: '<?php echo url("index/upload_imgs"); ?>',
|
|
||||||
fieldName: 'file',
|
|
||||||
maxFileSize: 10 * 1024 * 1024, // 10M
|
|
||||||
maxNumberOfFiles: 10,
|
|
||||||
allowedFileTypes: ['image/*'],
|
|
||||||
meta: {
|
|
||||||
token: 'xxx'
|
|
||||||
},
|
|
||||||
metaWithUrl: true,
|
|
||||||
headers: {
|
|
||||||
Accept: 'text/x-json'
|
|
||||||
},
|
|
||||||
timeout: 5 * 1000, // 5s
|
|
||||||
|
|
||||||
onBeforeUpload(file) {
|
|
||||||
console.log('准备上传图片', file)
|
|
||||||
return file
|
|
||||||
},
|
|
||||||
onProgress(progress) {
|
|
||||||
console.log('上传进度', progress)
|
|
||||||
},
|
|
||||||
onSuccess(file, res) {
|
|
||||||
console.log('上传成功', file, res)
|
|
||||||
},
|
|
||||||
onFailed(file, res) {
|
|
||||||
layer.msg('上传失败:' + res.msg, { icon: 2 })
|
|
||||||
console.log('上传失败', file, res)
|
|
||||||
},
|
|
||||||
onError(file, err, res) {
|
|
||||||
layer.msg('上传出错:' + err.message, { icon: 2 })
|
|
||||||
console.error('上传出错', file, err, res)
|
|
||||||
},
|
|
||||||
customInsert(res, insertFn) {
|
|
||||||
// res 即服务端的返回结果
|
|
||||||
if (res.code === 0 && res.data) {
|
|
||||||
// 从res.data中获取src字段
|
|
||||||
const url = String(res.data.src || '');
|
|
||||||
if (url) {
|
|
||||||
insertFn(url);
|
|
||||||
} else {
|
|
||||||
layer.msg('图片地址无效', { icon: 2 });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
layer.msg('图片上传失败', { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const editor = createEditor({
|
|
||||||
selector: '#editor-container',
|
|
||||||
html: '<p><br></p>',
|
|
||||||
config: editorConfig,
|
|
||||||
mode: 'default', // or 'simple'
|
|
||||||
})
|
|
||||||
|
|
||||||
const toolbarConfig = {}
|
|
||||||
|
|
||||||
const toolbar = createToolbar({
|
|
||||||
editor,
|
|
||||||
selector: '#toolbar-container',
|
|
||||||
config: toolbarConfig,
|
|
||||||
mode: 'default', // or 'simple'
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
//返回文章列表
|
|
||||||
function goBack() {
|
|
||||||
window.location.href = '<?php echo url("article/articlelist"); ?>';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
<?php /*a:2:{s:53:"E:\Demo\PHP\yunzer\app\admin\view\article\cateadd.php";i:1746796639;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div style="padding: 50px;padding-bottom: 0px;">
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" id="name" name="name" required lay-verify="required" placeholder="请输入分类名称"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">父级分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select id="cid" name="cid" lay-verify="required">
|
|
||||||
<option value="0">顶级分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" id="sort" name="sort" value="0" placeholder="请输入排序值" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">添加分类</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
|
|
||||||
// 获取URL中的cid参数
|
|
||||||
var urlParams = new URLSearchParams(window.location.search);
|
|
||||||
var cid = urlParams.get('cid');
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("article/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="0">顶级分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
html += '<option value="' + item.id + '"' + (cid == item.id ? ' selected' : '') + '>' + item.name + '</option>';
|
|
||||||
});
|
|
||||||
$('#cid').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
$.post('<?php echo url("article/cateadd"); ?>', data.field, function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
var index = parent.layer.getFrameIndex(window.name);
|
|
||||||
parent.layer.close(index);
|
|
||||||
parent.location.reload();
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,241 +0,0 @@
|
|||||||
<?php /*a:3:{s:63:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\menuinfo.php";i:1747385555;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-picture"></i>
|
|
||||||
<span>菜单管理</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button class="layui-btn layui-bg-blue" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加菜单
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="test7" class="demo-tree"></div>
|
|
||||||
<table class="layui-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="text-align:center">类型</th>
|
|
||||||
<th style="text-align:center">菜单名</th>
|
|
||||||
<th style="text-align:center">图标</th>
|
|
||||||
<th style="text-align:center">排序</th>
|
|
||||||
<th style="text-align:center">状态</th>
|
|
||||||
<th style="text-align:center">操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<tr>
|
|
||||||
<td align="center">
|
|
||||||
<?php if(($vo['type']==1)): ?>
|
|
||||||
功能模块:<?php echo htmlentities((string) $vo['src']); elseif(($vo['type']==2)): ?>
|
|
||||||
超链接:<?php echo htmlentities((string) $vo['src']); else: ?>
|
|
||||||
顶级
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td align="center"><?php echo htmlentities((string) $vo['label']); ?></td>
|
|
||||||
<td align="center"><i class="layui-icon <?php echo htmlentities((string) $vo['icon_class']); ?>"></i> <?php echo htmlentities((string) $vo['icon_class']); ?></td>
|
|
||||||
<td align="center"><?php echo htmlentities((string) $vo['sort']); ?></td>
|
|
||||||
<td align="center"><?php echo $vo['status']==1 ? '开启' : '<span style="color:red;">禁用</span>'; ?></td>
|
|
||||||
<td align="center">
|
|
||||||
<?php if(($vo['type'] == 0)): ?>
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal"
|
|
||||||
onclick="buttonInfo(<?php echo htmlentities((string) $vo['smid']); ?>)">下级菜单</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" onclick="edit(<?php echo htmlentities((string) $vo['smid']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" onclick="del(<?php echo htmlentities((string) $vo['smid']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer'], function () {
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
// 添加
|
|
||||||
function add() {
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '添加菜单',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['550px', '550px'],
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/menuadd'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 编辑
|
|
||||||
function edit(smid) {
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '编辑菜单',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['550px', '550px'],
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/menuedit?smid=' + smid
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 删除
|
|
||||||
function del(smid) {
|
|
||||||
layer.confirm('确定要删除吗?', {
|
|
||||||
icon: 3,
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/menudel', { 'smid': smid }, function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.alert(res.msg, { icon: 2 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () { window.location.reload(); }, 1000);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 按钮列表
|
|
||||||
function buttonInfo(smid) {
|
|
||||||
window.location.href = "<?php echo htmlentities((string) $config['admin_route']); ?>yunzer/buttoninfo?smid=" + smid;
|
|
||||||
}
|
|
||||||
|
|
||||||
//刷新列表
|
|
||||||
function refresh() {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,284 +0,0 @@
|
|||||||
<?php /*a:2:{s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\resources\add.php";i:1747388179;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header" style="display:flex;justify-content: space-between;">
|
|
||||||
<div>
|
|
||||||
<span>添加资源</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="goBack()">
|
|
||||||
<i class="layui-icon layui-icon-return"></i>返回
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入资源名称" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cate_id" lay-verify="required">
|
|
||||||
<option value="">请选择分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">描述</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<textarea name="desc" placeholder="请输入资源描述" class="layui-textarea"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">上传者</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="uploader" required lay-verify="required" placeholder="请输入上传者" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" id="upload-btn">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 图标上传
|
|
||||||
</button>
|
|
||||||
<div style="width: 120px;">
|
|
||||||
<div class="layui-upload-list">
|
|
||||||
<img class="layui-upload-img" id="upload-img"
|
|
||||||
style="width: 118px; height: 118px;object-fit: cover;">
|
|
||||||
<div id="upload-text"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-demo">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="icon" id="icon" value="">
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid layui-word-aux">建议尺寸:128px * 128px</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源链接</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="url" required lay-verify="required" placeholder="请输入资源链接" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分享码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="code" required lay-verify="required" placeholder="请输入分享码" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" name="sort" value="0" class="layui-input" placeholder="数字越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var element = layui.element;
|
|
||||||
|
|
||||||
// 图标上传
|
|
||||||
var uploadInst = upload.render({
|
|
||||||
elem: '#upload-btn',
|
|
||||||
url: '<?php echo url("index/upload_img"); ?>',
|
|
||||||
before: function (obj) {
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#upload-img').attr('src', result);
|
|
||||||
});
|
|
||||||
element.progress('filter-demo', '0%');
|
|
||||||
layer.msg('上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
$('#icon').val(res.data);
|
|
||||||
$('#upload-text').html('');
|
|
||||||
layer.msg('上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () {
|
|
||||||
var demoText = $('#upload-text');
|
|
||||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
||||||
demoText.find('.demo-reload').on('click', function () {
|
|
||||||
uploadInst.upload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('filter-demo', n + '%');
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("resources/cate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="">请选择分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
var disabled = item.cid == 0 ? 'disabled' : '';
|
|
||||||
html += '<option value="' + item.id + '" ' + disabled + '>' + item.name + '</option>';
|
|
||||||
if (item.children && item.children.length > 0) {
|
|
||||||
item.children.forEach(function (child) {
|
|
||||||
html += '<option value="' + child.id + '">├─ ' + child.name + '</option>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('select[name="cate_id"]').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
var loadIndex = layer.load(2);
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo url("resources/add"); ?>',
|
|
||||||
type: 'POST',
|
|
||||||
data: data.field,
|
|
||||||
success: function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
window.location.href = '<?php echo url("resources/lists"); ?>';
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
//返回资源列表
|
|
||||||
function goBack() {
|
|
||||||
window.location.href = '<?php echo url("resources/lists"); ?>';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,217 +0,0 @@
|
|||||||
<?php /*a:3:{s:64:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\buttonadd.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<input type="hidden" name="smid" value="<?php echo htmlentities((string) $smid); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">按钮名</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="label" placeholder="请输入按钮名">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="icon_class" lay-verify="required" lay-search="">
|
|
||||||
<option value="">请输入layui图标</option>
|
|
||||||
<?php foreach($iconfont as $icon_v): ?>
|
|
||||||
<option value="<?php echo htmlentities((string) $icon_v['icon_css']); ?>"><?php echo htmlentities((string) $icon_v['icon_css']); ?> <?php echo htmlentities((string) $icon_v['icon_name']); ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">类型</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="type" lay-filter="type">
|
|
||||||
<option value='1' selected>内部代码</option>
|
|
||||||
<option value='2'>超链接</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" id="src1">
|
|
||||||
<label class="layui-form-label">内部代码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src1" placeholder="请输入:模块/方法">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" style="display:none;" id="src2">
|
|
||||||
<label class="layui-form-label">链接地址</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src2" placeholder="请输入http网址">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" class="layui-input" name="sort" placeholder="值越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
var form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
|
|
||||||
form.on('select(type)', function(data){
|
|
||||||
if(data.value == 1){
|
|
||||||
$("#src1").show();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else if(data.value == 2){
|
|
||||||
$("#src1").hide();
|
|
||||||
$("#src2").show();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else{
|
|
||||||
$("#src1").show();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
function save(){
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/buttonadd',$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,348 +0,0 @@
|
|||||||
<?php /*a:2:{s:51:"E:\Demo\PHP\yunzer\app\admin\view\resources\add.php";i:1747406940;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header" style="display:flex;justify-content: space-between;">
|
|
||||||
<div>
|
|
||||||
<span>添加资源</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="goBack()">
|
|
||||||
<i class="layui-icon layui-icon-return"></i>返回
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入资源名称" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cate" lay-verify="required">
|
|
||||||
<option value="">请选择分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">描述</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<textarea name="desc" placeholder="请输入资源描述" class="layui-textarea"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">上传者</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="uploader" required lay-verify="required" placeholder="请输入上传者"
|
|
||||||
autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" id="upload-btn">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 图标上传
|
|
||||||
</button>
|
|
||||||
<div style="width: 120px;">
|
|
||||||
<div class="layui-upload-list">
|
|
||||||
<img class="layui-upload-img" id="upload-img"
|
|
||||||
style="width: 118px; height: 118px;object-fit: cover;">
|
|
||||||
<div id="upload-text"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="icon-progress">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="icon" id="icon" value="">
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid layui-word-aux">建议尺寸:128px * 128px</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源文件</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-upload-drag" style="display: block;" id="ID-upload-demo-drag">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i>
|
|
||||||
<div>点击上传,或将文件拖拽到此处</div>
|
|
||||||
<div class="layui-hide" id="ID-upload-demo-preview">
|
|
||||||
<hr>
|
|
||||||
<div class="file-info">
|
|
||||||
<i class="layui-icon layui-icon-file"></i>
|
|
||||||
<span class="file-name"></span>
|
|
||||||
<span class="file-size"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="file-progress" style="margin-top: 10px;">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="file" id="file" value="">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">资源链接</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="url" required placeholder="百度网盘、115网盘、蓝奏云等" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分享码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="code" required placeholder="请输入分享码" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" name="sort" value="0" class="layui-input" placeholder="数字越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.$;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var element = layui.element;
|
|
||||||
|
|
||||||
// 图标上传
|
|
||||||
var iconUpload = upload.render({
|
|
||||||
elem: '#upload-btn',
|
|
||||||
url: '<?php echo url("index/upload_img"); ?>',
|
|
||||||
before: function (obj) {
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#upload-img').attr('src', result);
|
|
||||||
});
|
|
||||||
element.progress('icon-progress', '0%');
|
|
||||||
layer.msg('图标上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('图标上传失败');
|
|
||||||
}
|
|
||||||
$('#icon').val(res.data);
|
|
||||||
$('#upload-text').html('');
|
|
||||||
layer.msg('图标上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () {
|
|
||||||
var demoText = $('#upload-text');
|
|
||||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
||||||
demoText.find('.demo-reload').on('click', function () {
|
|
||||||
iconUpload.upload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('icon-progress', n + '%');
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('图标上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 文件上传
|
|
||||||
var fileUpload = upload.render({
|
|
||||||
elem: '#ID-upload-demo-drag',
|
|
||||||
url: '<?php echo url("index/upload_file"); ?>',
|
|
||||||
accept: 'file',
|
|
||||||
exts: 'doc|docx|xls|xlsx|ppt|pptx|pdf|txt|zip|rar|7z',
|
|
||||||
before: function (obj) {
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#ID-upload-demo-preview').show();
|
|
||||||
$('.file-name').text(file.name);
|
|
||||||
$('.file-size').text(formatFileSize(file.size));
|
|
||||||
});
|
|
||||||
element.progress('file-progress', '0%');
|
|
||||||
layer.msg('文件上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('文件上传失败');
|
|
||||||
}
|
|
||||||
$('#file').val(res.data.src);
|
|
||||||
layer.msg('文件上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () {
|
|
||||||
layer.msg('文件上传失败', { icon: 2 });
|
|
||||||
},
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('file-progress', n + '%');
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('文件上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 格式化文件大小
|
|
||||||
function formatFileSize(bytes) {
|
|
||||||
if (bytes === 0) return '0 B';
|
|
||||||
const k = 1024;
|
|
||||||
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
||||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
||||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("resources/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="">请选择分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
var disabled = item.cid == 0 ? 'disabled' : '';
|
|
||||||
html += '<option value="' + item.id + '" ' + disabled + '>' + item.name + '</option>';
|
|
||||||
if (item.children && item.children.length > 0) {
|
|
||||||
item.children.forEach(function (child) {
|
|
||||||
html += '<option value="' + child.id + '">├─ ' + child.name + '</option>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('select[name="cate"]').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
var loadIndex = layer.load(2);
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo url("resources/add"); ?>',
|
|
||||||
type: 'POST',
|
|
||||||
data: data.field,
|
|
||||||
success: function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
window.location.href = '<?php echo url("resources/lists"); ?>';
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
//返回资源列表
|
|
||||||
function goBack() {
|
|
||||||
window.location.href = '<?php echo url("resources/lists"); ?>';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,409 +0,0 @@
|
|||||||
<?php /*a:3:{s:65:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\configlist.php";i:1747370938;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<style>
|
|
||||||
.config-container {
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 8px;
|
|
||||||
/* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); */
|
|
||||||
}
|
|
||||||
.config-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
}
|
|
||||||
.config-header span {
|
|
||||||
font-size: 18px;
|
|
||||||
color: #2c3e50;
|
|
||||||
font-weight: 500;
|
|
||||||
margin-right: 20px;
|
|
||||||
}
|
|
||||||
.config-header a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.config-header a span {
|
|
||||||
padding: 6px 15px;
|
|
||||||
background: #f8f9fa;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #606266;
|
|
||||||
font-size: 14px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
.config-header a span:hover {
|
|
||||||
background: #e9ecef;
|
|
||||||
color: #409EFF;
|
|
||||||
}
|
|
||||||
.action-buttons {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
.layui-btn {
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
|
||||||
transition: all 0.3s;
|
|
||||||
height: 32px;
|
|
||||||
line-height: 32px;
|
|
||||||
padding: 0 16px;
|
|
||||||
}
|
|
||||||
.layui-btn:hover {
|
|
||||||
transform: translateY(-1px);
|
|
||||||
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
|
||||||
}
|
|
||||||
.layui-btn .layui-icon {
|
|
||||||
margin-right: 4px;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.layui-table {
|
|
||||||
margin: 15px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.layui-table thead tr {
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
.layui-table tbody tr:hover {
|
|
||||||
background-color: #f5f7fa;
|
|
||||||
}
|
|
||||||
.layui-table-cell {
|
|
||||||
height: 40px;
|
|
||||||
line-height: 40px;
|
|
||||||
}
|
|
||||||
.layui-badge {
|
|
||||||
padding: 4px 8px;
|
|
||||||
border-radius: 3px;
|
|
||||||
font-weight: 500;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
.layui-badge.layui-bg-green {
|
|
||||||
background-color: #67C23A !important;
|
|
||||||
}
|
|
||||||
.layui-badge.layui-bg-gray {
|
|
||||||
background-color: #909399 !important;
|
|
||||||
}
|
|
||||||
.layui-layer {
|
|
||||||
border-radius: 8px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header">
|
|
||||||
<span>站点管理</span>
|
|
||||||
<!-- <a href="<?php echo htmlentities((string) $config['admin_route']); ?>Yunzer/configvalue">
|
|
||||||
<span>站点配置</span>
|
|
||||||
</a> -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="layui-card-body" style="padding: 0;">
|
|
||||||
<div class="action-buttons">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" id="btn-add">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" id="btn-edit">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>修改
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-danger" id="btn-del">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<table class="layui-table" id="lists" lay-filter="lists"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'table', 'element'], function () {
|
|
||||||
var table = layui.table;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var element = layui.element;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
function initTable() {
|
|
||||||
table.render({
|
|
||||||
elem: '#lists',
|
|
||||||
method: 'post',
|
|
||||||
url: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzer/configlist",
|
|
||||||
title: '配置列表',
|
|
||||||
page: true,
|
|
||||||
skin: 'line',
|
|
||||||
even: true,
|
|
||||||
size: 'lg',
|
|
||||||
cols: [[
|
|
||||||
{ type: 'radio', fixed: 'left', width: 50 },
|
|
||||||
{ field: 'config_id', width: 80, title: 'ID', sort: true, align: 'center' },
|
|
||||||
{ field: 'config_sort', width: 120, title: '排序', sort: true, align: 'center' },
|
|
||||||
{ field: 'config_name', width: 150, title: '关键词' },
|
|
||||||
{ field: 'config_info', width: 150, title: '作用' },
|
|
||||||
{ field: 'config_desc', minWidth: 300, title: '说明' },
|
|
||||||
{
|
|
||||||
field: 'config_status', width: 100, title: '状态', align: 'center', templet: function (res) {
|
|
||||||
if (res.config_status == 1) {
|
|
||||||
return '<span class="layui-badge layui-bg-green">开启</span>';
|
|
||||||
} else {
|
|
||||||
return '<span class="layui-badge layui-bg-gray">关闭</span>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]],
|
|
||||||
limit: 15,
|
|
||||||
limits: [15, 30, 50, 100],
|
|
||||||
height: 'full-180'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载表格数据
|
|
||||||
initTable();
|
|
||||||
|
|
||||||
// 行点击事件
|
|
||||||
table.on('row(lists)', function (obj) {
|
|
||||||
obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
|
|
||||||
obj.tr.find("div.layui-unselect.layui-form-radio")[0].click();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加按钮事件
|
|
||||||
$('#btn-add').on('click', function () {
|
|
||||||
layer.open({
|
|
||||||
title: '<i class="layui-icon layui-icon-add-1"></i> 添加配置',
|
|
||||||
type: 2,
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configadd',
|
|
||||||
maxmin: true,
|
|
||||||
area: ['700px', '550px'],
|
|
||||||
skin: 'layui-layer-molv',
|
|
||||||
btn: ['确定', '取消'],
|
|
||||||
yes: function (index, layero) {
|
|
||||||
var form = layero.find('iframe')[0].contentWindow;
|
|
||||||
var button = {
|
|
||||||
config_name: form.config_name.value,
|
|
||||||
config_info: form.config_info.value,
|
|
||||||
config_type: form.config_type.value,
|
|
||||||
config_desc: form.config_desc.value,
|
|
||||||
config_sort: form.config_sort.value,
|
|
||||||
config_status: form.config_status.value
|
|
||||||
};
|
|
||||||
|
|
||||||
var loadIndex = layer.load(1, {
|
|
||||||
shade: [0.1,'#fff']
|
|
||||||
});
|
|
||||||
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configadd', button, function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.msg(res.msg, { icon: 2, time: 2000 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 1, time: 1000 });
|
|
||||||
initTable();
|
|
||||||
layer.close(index);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 编辑按钮事件
|
|
||||||
$('#btn-edit').on('click', function () {
|
|
||||||
var checkStatus = table.checkStatus('lists');
|
|
||||||
var data = checkStatus.data;
|
|
||||||
|
|
||||||
if (data.length === 0) {
|
|
||||||
layer.msg('请选择一条数据进行编辑', { icon: 0 });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
layer.open({
|
|
||||||
title: '<i class="layui-icon layui-icon-edit"></i> 修改配置',
|
|
||||||
type: 2,
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configedit?config_id=' + data[0].config_id,
|
|
||||||
maxmin: true,
|
|
||||||
area: ['700px', '550px'],
|
|
||||||
skin: 'layui-layer-molv',
|
|
||||||
btn: ['确定', '取消'],
|
|
||||||
yes: function (index, layero) {
|
|
||||||
var form = layero.find('iframe')[0].contentWindow;
|
|
||||||
var button = {
|
|
||||||
config_id: data[0].config_id,
|
|
||||||
config_name: form.config_name.value,
|
|
||||||
config_info: form.config_info.value,
|
|
||||||
config_type: form.config_type.value,
|
|
||||||
config_desc: form.config_desc.value,
|
|
||||||
config_sort: form.config_sort.value,
|
|
||||||
config_status: form.config_status.value
|
|
||||||
};
|
|
||||||
|
|
||||||
var loadIndex = layer.load(1, {
|
|
||||||
shade: [0.1,'#fff']
|
|
||||||
});
|
|
||||||
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configedit', button, function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.msg(res.msg, { icon: 2, time: 2000 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 1, time: 1000 });
|
|
||||||
initTable();
|
|
||||||
layer.close(index);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 删除按钮事件
|
|
||||||
$('#btn-del').on('click', function () {
|
|
||||||
var checkStatus = table.checkStatus('lists');
|
|
||||||
var data = checkStatus.data;
|
|
||||||
|
|
||||||
if (data.length === 0) {
|
|
||||||
layer.msg('请选择一条数据进行删除', { icon: 0 });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
layer.confirm('确定要删除该配置吗?', {
|
|
||||||
icon: 3,
|
|
||||||
title: '删除确认',
|
|
||||||
skin: 'layui-layer-molv',
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
var loadIndex = layer.load(1, {
|
|
||||||
shade: [0.1,'#fff']
|
|
||||||
});
|
|
||||||
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configdel', { 'config_id': data[0].config_id }, function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.msg(res.msg, { icon: 2, time: 2000 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 1, time: 1000 });
|
|
||||||
initTable();
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
<?php /*a:3:{s:59:"E:\Demo\PHP\yunzer\app\admin\view\yunzeradmin\groupinfo.php";i:1747402501;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-group"></i>
|
|
||||||
<span>角色列表</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button class="layui-btn layui-bg-blue" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table class="layui-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>角色名</th>
|
|
||||||
<th>状态</th>
|
|
||||||
<th>添加时间</th>
|
|
||||||
<th>操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php if(is_array($group) || $group instanceof \think\Collection || $group instanceof \think\Paginator): $i = 0; $__LIST__ = $group;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlentities((string) $vo['group_name']); ?></td>
|
|
||||||
<td><?php echo $vo['status']==1 ? '开启' : '<span style="color:red;">禁用</span>'; ?></td>
|
|
||||||
<td><?php echo date('Y-m-d H:i:s',$vo['create_time']); ?></td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs"
|
|
||||||
onclick="edit(<?php echo htmlentities((string) $vo['group_id']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs"
|
|
||||||
onclick="del(<?php echo htmlentities((string) $vo['group_id']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer'], function () {
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
// 添加
|
|
||||||
function add() {
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '添加角色',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['450px', '550px'],
|
|
||||||
content: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/groupadd"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 编辑
|
|
||||||
function edit(group_id) {
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '编辑角色',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['450px', '550px'],
|
|
||||||
content: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/groupedit?group_id=" + group_id
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 删除
|
|
||||||
function del(group_id) {
|
|
||||||
layer.confirm('确定要删除吗?', {
|
|
||||||
icon: 3,
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.post("<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/groupdel", { 'group_id': group_id }, function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.alert(res.msg, { icon: 2 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () { window.location.reload(); }, 1000);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//刷新列表
|
|
||||||
function refresh() {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,425 +0,0 @@
|
|||||||
<?php /*a:1:{s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\index\index.php";i:1747638193;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport"
|
|
||||||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/third/layui/css/layui.css" media="all">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/index.css" media="all">
|
|
||||||
<script type="text/javascript" src="/static/third/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript" src="/static/js/admin.js"></script>
|
|
||||||
<style>
|
|
||||||
.layadmin-side-shrink .layui-layout-admin .layui-logo {
|
|
||||||
width: 60px;
|
|
||||||
background-image: url("/static/images/logob32.jpg");
|
|
||||||
}
|
|
||||||
.main-content {
|
|
||||||
height: 100%;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
#mainWorkspace {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
#mainTabs.layui-tab {
|
|
||||||
margin: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.layui-tab-content {
|
|
||||||
padding: 0;
|
|
||||||
height: calc(100% - 41px);
|
|
||||||
}
|
|
||||||
.layui-tab-item {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.main-iframe {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
border: none;
|
|
||||||
/* background-color: #f2f2f2; */
|
|
||||||
}
|
|
||||||
.layui-tab-title {
|
|
||||||
background: #fff;
|
|
||||||
box-shadow: 0 1px 2px 0 rgba(0,0,0,.1);
|
|
||||||
}
|
|
||||||
.layui-tab-title .layui-this:after {
|
|
||||||
border-bottom-color: #009688;
|
|
||||||
}
|
|
||||||
#LAY_app_body {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.layui-tab-content .layui-tab-item {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body layadmin-themealias="default" class="layui-layout-body">
|
|
||||||
<div id="LAY_app" class="layadmin-tabspage-none">
|
|
||||||
<div class="layui-layout layui-layout-admin">
|
|
||||||
<div class="layui-header">
|
|
||||||
<!-- 头部区域 -->
|
|
||||||
<div style="display: flex;align-items: center;height:70px;">
|
|
||||||
<ul class="layui-nav layui-layout-left">
|
|
||||||
<li class="layui-nav-item layadmin-flexible" lay-unselect onclick="shrink()">
|
|
||||||
<a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
|
|
||||||
<i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
|
|
||||||
<li class="layui-nav-item layui-hide-xs" lay-unselect title="前端站点" onclick="gotoFront()">
|
|
||||||
<a href="javascript:;" layadmin-event="gotoFront">
|
|
||||||
<i class="layui-icon layui-icon-website"></i>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="layui-nav-item layui-hide-xs" lay-unselect title="全屏" onclick="fullScreen()">
|
|
||||||
<a href="javascript:;" layadmin-event="fullscreen">
|
|
||||||
<i class="layui-icon layui-icon-screen-full"></i>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="layui-nav-item" lay-unselect>
|
|
||||||
<a href="javascript:;">
|
|
||||||
<cite><?php echo htmlentities((string) $aUser['name']); ?></cite>
|
|
||||||
</a>
|
|
||||||
<dl class="layui-nav-child">
|
|
||||||
<dd><a lay-href="" onclick="menuFire('yunzeradmin/admininfo',1)">个人中心</a></dd>
|
|
||||||
<hr>
|
|
||||||
<dd layadmin-event="logout" style="text-align:center;" onclick="logout()">
|
|
||||||
<a>退出</a>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 侧边菜单 -->
|
|
||||||
<div class="layui-side layui-side-menu">
|
|
||||||
<div class="layui-side-scroll">
|
|
||||||
<!-- <div class="layui-logo" lay-href="" style="display: flex;align-items: center;">
|
|
||||||
<img src="/static/images/logo-l-w.png" alt="<?php echo htmlentities((string) $config['admin_name']); ?>"
|
|
||||||
style="max-width: 100%; max-height: 100%;">
|
|
||||||
</div> -->
|
|
||||||
<ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
|
|
||||||
lay-filter="layadmin-system-side-menu">
|
|
||||||
<!-- 固定的工作台菜单项 -->
|
|
||||||
<li class="layui-nav-item" data-name="index/welcome">
|
|
||||||
<a href="javascript:;" lay-tips="工作台" lay-direction="2"
|
|
||||||
onclick="menuFire('index/welcome',1)">
|
|
||||||
<i class="layui-icon layui-icon-home" style="margin-top: -20px;"></i>
|
|
||||||
<cite>工作台</cite>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<!-- 下面是原有的菜单循环 -->
|
|
||||||
<?php if(is_array($menu) || $menu instanceof \think\Collection || $menu instanceof \think\Paginator): $i = 0; $__LIST__ = $menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<li data-name="<?php echo htmlentities((string) $vo['src']); ?>" data-jump="" class="layui-nav-item">
|
|
||||||
<!-- 修改一级菜单的点击事件,只有当有src时才跳转 -->
|
|
||||||
<a href="javascript:;" lay-tips="<?php echo htmlentities((string) $vo['label']); ?>" lay-direction="2" <?php if(isset($vo['src']) &&
|
|
||||||
$vo['src']): ?>onclick="menuFire('<?php echo htmlentities((string) $vo['src']); ?>',1)" <?php endif; ?>>
|
|
||||||
<i class="layui-icon layui-icons <?php echo htmlentities((string) $vo['icon_class']); ?>"></i>
|
|
||||||
<cite><?php echo htmlentities((string) $vo['label']); ?></cite>
|
|
||||||
</a>
|
|
||||||
<?php if((isset($vo['children']) && $vo['children'])): ?>
|
|
||||||
<dl class="layui-nav-child">
|
|
||||||
<?php if(is_array($vo['children']) || $vo['children'] instanceof \think\Collection || $vo['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $vo['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cvo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<dd data-name="" data-jump="/">
|
|
||||||
<?php if($cvo['type'] == 1): ?>
|
|
||||||
<a href="javascript:;" onclick="menuFire('<?php echo htmlentities((string) $cvo['src']); ?>',1)">
|
|
||||||
<i class="layui-icon layui-icons <?php echo htmlentities((string) $cvo['icon_class']); ?>"></i><?php echo htmlentities((string) $cvo['label']); ?>
|
|
||||||
</a>
|
|
||||||
<?php elseif($cvo['type'] == 2): ?>
|
|
||||||
<a href="<?php echo htmlentities((string) $cvo['src']); ?>" target="_blank">
|
|
||||||
<i class="layui-icon layui-icons <?php echo htmlentities((string) $cvo['icon_class']); ?>"></i><?php echo htmlentities((string) $cvo['label']); ?>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</dd>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</dl>
|
|
||||||
<?php endif; ?>
|
|
||||||
</li>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</ul>
|
|
||||||
<div style="position: absolute;bottom:20px;width:200px;display:flex;justify-content: center;">
|
|
||||||
<a style="color:#848484" href="https://www.yunzer.cn/">POWER BY 云泽网</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 主体内容 -->
|
|
||||||
<div class="layui-body" id="LAY_app_body">
|
|
||||||
<div class="main-content">
|
|
||||||
<!-- 默认工作台界面 -->
|
|
||||||
<div id="mainWorkspace">
|
|
||||||
<iframe src="<?php echo htmlentities((string) $config['admin_route']); ?>index/welcome" class="main-iframe" frameborder="0" scrolling="0"></iframe>
|
|
||||||
</div>
|
|
||||||
<!-- 动态标签页 -->
|
|
||||||
<div id="mainTabs" class="layui-tab" lay-allowClose="true" lay-filter="mainTabs" style="margin-top: 10px;">
|
|
||||||
<ul class="layui-tab-title"></ul>
|
|
||||||
<div class="layui-tab-content"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 辅助元素,一般用于移动设备下遮罩 -->
|
|
||||||
<div class="layadmin-body-shade" layadmin-event="shade" onclick="shrink()"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 辅助元素,一般用于移动设备下遮罩 -->
|
|
||||||
<div class="layadmin-body-shade" layadmin-event="shade"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['element', 'layer', 'jquery'], function () {
|
|
||||||
var element = layui.element;
|
|
||||||
$ = layui.jquery;
|
|
||||||
layer = layui.layer;
|
|
||||||
setter = layui.setter;
|
|
||||||
|
|
||||||
// 保存标签状态
|
|
||||||
function saveTabState(layid, title, url) {
|
|
||||||
var tabState = {
|
|
||||||
layid: layid,
|
|
||||||
title: title,
|
|
||||||
url: url
|
|
||||||
};
|
|
||||||
sessionStorage.setItem('currentTab', JSON.stringify(tabState));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 恢复标签状态
|
|
||||||
function restoreTabState() {
|
|
||||||
var tabState = sessionStorage.getItem('currentTab');
|
|
||||||
if (tabState) {
|
|
||||||
try {
|
|
||||||
var tab = JSON.parse(tabState);
|
|
||||||
if (tab.url && tab.title) {
|
|
||||||
addTab(tab.title, tab.url, tab.layid);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Failed to restore tab state:', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 在页面加载完成后执行
|
|
||||||
$(document).ready(function () {
|
|
||||||
// 获取URL参数
|
|
||||||
var urlParams = new URLSearchParams(window.location.search);
|
|
||||||
var page = urlParams.get('page');
|
|
||||||
|
|
||||||
if (page) {
|
|
||||||
// 如果有page参数,加载对应页面到iframe
|
|
||||||
$('iframe').attr('src', "<?php echo htmlentities((string) $config['admin_route']); ?>" + page);
|
|
||||||
} else {
|
|
||||||
// 否则加载默认页面
|
|
||||||
$('iframe').attr('src', "<?php echo htmlentities((string) $config['admin_route']); ?>index/welcome");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 恢复标签状态
|
|
||||||
restoreTabState();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加或切换到标签页
|
|
||||||
window.addTab = function(title, url, id) {
|
|
||||||
var element = layui.element;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var layid = id || url.replace(/\//g, '_');
|
|
||||||
|
|
||||||
// 如果是首页/工作台,直接显示主工作区
|
|
||||||
if(url.indexOf('index/welcome') > -1 || url.indexOf('welcome') > -1) {
|
|
||||||
$('#mainTabs').hide();
|
|
||||||
$('#mainWorkspace').show();
|
|
||||||
$('#mainWorkspace iframe').attr('src', url);
|
|
||||||
sessionStorage.removeItem('currentTab');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示标签区域
|
|
||||||
$('#mainWorkspace').hide();
|
|
||||||
$('#mainTabs').show();
|
|
||||||
|
|
||||||
// 如果标签已存在,直接切换
|
|
||||||
if($('.layui-tab-title li[lay-id="'+ layid +'"]').length > 0) {
|
|
||||||
element.tabChange('mainTabs', layid);
|
|
||||||
saveTabState(layid, title, url);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加新标签
|
|
||||||
element.tabAdd('mainTabs', {
|
|
||||||
title: title,
|
|
||||||
content: '<iframe src="' + url + '" class="main-iframe" frameborder="0"></iframe>',
|
|
||||||
id: layid
|
|
||||||
});
|
|
||||||
|
|
||||||
// 切换到新标签页
|
|
||||||
element.tabChange('mainTabs', layid);
|
|
||||||
|
|
||||||
// 保存当前标签状态
|
|
||||||
saveTabState(layid, title, url);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 监听标签切换事件
|
|
||||||
element.on('tab(mainTabs)', function(data){
|
|
||||||
var layid = $(this).attr('lay-id');
|
|
||||||
// 确保当前标签页内容可见
|
|
||||||
$('.layui-tab-content .layui-tab-item').eq(data.index).addClass('layui-show')
|
|
||||||
.siblings().removeClass('layui-show');
|
|
||||||
|
|
||||||
// 更新保存的标签状态
|
|
||||||
var title = $(this).text();
|
|
||||||
var url = $('.layui-tab-content .layui-tab-item').eq(data.index).find('iframe').attr('src');
|
|
||||||
saveTabState(layid, title, url);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听标签删除事件
|
|
||||||
element.on('tabDelete(mainTabs)', function(data){
|
|
||||||
// 如果没有标签了,显示工作台
|
|
||||||
if($('.layui-tab-title li').length === 0) {
|
|
||||||
$('#mainTabs').hide();
|
|
||||||
$('#mainWorkspace').show();
|
|
||||||
sessionStorage.removeItem('currentTab');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 左侧菜单点击事件
|
|
||||||
$('.left-nav #nav li').click(function (event) {
|
|
||||||
if ($(this).children('.sub-menu').length) {
|
|
||||||
if ($(this).hasClass('open')) {
|
|
||||||
$(this).removeClass('open');
|
|
||||||
$(this).find('.nav_right').html('');
|
|
||||||
$(this).children('.sub-menu').stop().slideUp();
|
|
||||||
$(this).siblings().children('.sub-menu').slideUp();
|
|
||||||
} else {
|
|
||||||
$(this).addClass('open');
|
|
||||||
$(this).children('a').find('.nav_right').html('');
|
|
||||||
$(this).children('.sub-menu').stop().slideDown();
|
|
||||||
$(this).siblings().children('.sub-menu').stop().slideUp();
|
|
||||||
$(this).siblings().find('.nav_right').html('');
|
|
||||||
$(this).siblings().removeClass('open');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var url = $(this).children('a').attr('_href');
|
|
||||||
var title = $(this).children('a').html();
|
|
||||||
title = title.replace(/<[^>]+>/g, "").trim(); // 移除HTML标签
|
|
||||||
|
|
||||||
if (url) {
|
|
||||||
window.addTab(title, url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.stopPropagation();
|
|
||||||
})
|
|
||||||
|
|
||||||
// 修改resetMainHeight函数
|
|
||||||
function resetMainHeight(iframe) {
|
|
||||||
if (!iframe) return;
|
|
||||||
try {
|
|
||||||
// 获取视口高度
|
|
||||||
var clientHeight = document.documentElement.clientHeight;
|
|
||||||
// 计算iframe应该的高度(减去头部和tab标签的高度)
|
|
||||||
var iframeHeight = clientHeight - 60 - 40; // 60px是头部高度,40px是tab标签高度
|
|
||||||
$(iframe).css({
|
|
||||||
'height': iframeHeight + 'px',
|
|
||||||
'width': '100%',
|
|
||||||
'display': 'block'
|
|
||||||
});
|
|
||||||
} catch(e) {
|
|
||||||
console.error('Reset iframe height failed:', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 在窗口大小改变时重置所有iframe高度
|
|
||||||
$(window).on('resize', function() {
|
|
||||||
$('.main-iframe').each(function() {
|
|
||||||
resetMainHeight(this);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 菜单点击
|
|
||||||
function menuFire(obj, num) {
|
|
||||||
if (num == 1) {
|
|
||||||
var title = '';
|
|
||||||
// 获取菜单标题
|
|
||||||
$('.layui-nav-item a').each(function() {
|
|
||||||
if($(this).attr('onclick') && $(this).attr('onclick').indexOf(obj) > -1) {
|
|
||||||
title = $(this).text().trim();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 如果没找到标题,使用子菜单查找
|
|
||||||
if(!title) {
|
|
||||||
$('.layui-nav-child a').each(function() {
|
|
||||||
if($(this).attr('onclick') && $(this).attr('onclick').indexOf(obj) > -1) {
|
|
||||||
title = $(this).text().trim();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加或切换到标签页
|
|
||||||
window.addTab(title || '新页面', "<?php echo htmlentities((string) $config['admin_route']); ?>" + obj, obj.replace(/\//g, '_'));
|
|
||||||
|
|
||||||
// 更新浏览器URL,但保持在index页面
|
|
||||||
window.history.pushState({}, '', "<?php echo htmlentities((string) $config['admin_route']); ?>index/index?page=" + obj);
|
|
||||||
|
|
||||||
// 如果是子菜单,确保父菜单展开
|
|
||||||
if (obj.indexOf('/') > -1) {
|
|
||||||
var parentMenu = obj.split('/')[0];
|
|
||||||
$('.layui-nav-item').each(function () {
|
|
||||||
var menuSrc = $(this).find('a').attr('onclick');
|
|
||||||
if (menuSrc && menuSrc.indexOf(parentMenu) > -1) {
|
|
||||||
$(this).addClass('layui-nav-itemed');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var width = screen();
|
|
||||||
if (width < 2) {
|
|
||||||
shrink();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 监听浏览器前进后退按钮
|
|
||||||
window.addEventListener('popstate', function (event) {
|
|
||||||
// 获取URL参数
|
|
||||||
var urlParams = new URLSearchParams(window.location.search);
|
|
||||||
var page = urlParams.get('page');
|
|
||||||
|
|
||||||
if (page) {
|
|
||||||
// 如果有page参数,通过标签系统加载页面
|
|
||||||
var title = '新页面';
|
|
||||||
window.addTab(title, "<?php echo htmlentities((string) $config['admin_route']); ?>" + page, page.replace(/\//g, '_'));
|
|
||||||
} else {
|
|
||||||
// 否则加载默认页面
|
|
||||||
element.tabChange('mainTabs', 'welcome');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 退出
|
|
||||||
function logout() {
|
|
||||||
layer.confirm('确定要退出吗?', {
|
|
||||||
icon: 3,
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.get("<?php echo htmlentities((string) $config['admin_route']); ?>login/logout", function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.msg(res.msg, { 'icon': 2 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { 'icon': 1 });
|
|
||||||
setTimeout(function () { window.location.href = "<?php echo htmlentities((string) $config['admin_route']); ?>login/index"; }, 1000);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//跳转前端站点
|
|
||||||
function gotoFront() {
|
|
||||||
window.open("//<?php echo htmlentities((string) $config['admin_domain']); ?>", "_blank");
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@@ -1,252 +0,0 @@
|
|||||||
<?php /*a:2:{s:57:"E:\Demo\PHP\yunzer\app\admin\view\article\articlelist.php";i:1747323773;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header" style="display:flex;justify-content: space-between;">
|
|
||||||
<div style="display: flex; align-items: center;">
|
|
||||||
<span>文章列表</span>
|
|
||||||
<div class="shaixuan">
|
|
||||||
<label>筛选:</label>
|
|
||||||
<div class="layui-form">
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select id="categoryFilter" lay-filter="categoryFilter" lay-verify="">
|
|
||||||
<option value="">全部分类</option>
|
|
||||||
<?php if(is_array($categories) || $categories instanceof \think\Collection || $categories instanceof \think\Paginator): $i = 0; $__LIST__ = $categories;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$category): $mod = ($i % 2 );++$i;?>
|
|
||||||
<optgroup label="<?php echo htmlentities((string) $category['name']); ?>">
|
|
||||||
<?php if(is_array($category['children']) || $category['children'] instanceof \think\Collection || $category['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $category['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$subCategory): $mod = ($i % 2 );++$i;?>
|
|
||||||
<option value="<?php echo htmlentities((string) $subCategory['id']); ?>"><?php echo htmlentities((string) $subCategory['name']); ?></option>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</optgroup>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table id="articleTable" lay-filter="articleTable"></table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/html" id="imageTemplate">
|
|
||||||
{{# if(d.image){ }}
|
|
||||||
<img src="{{ d.image }}" style="max-width: 50px; max-height: 50px;">
|
|
||||||
{{# } }}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="statusTemplate">
|
|
||||||
{{# if(d.status === 0){ }}
|
|
||||||
<span style="color:red;">草稿</span>
|
|
||||||
{{# } else if(d.status === 1){ }}
|
|
||||||
<span style="color:orange;">待审核</span>
|
|
||||||
{{# } else if(d.status === 2){ }}
|
|
||||||
<span style="color:green;">已发布</span>
|
|
||||||
{{# } else if(d.status === 3){ }}
|
|
||||||
<span style="color:gray;">隐藏</span>
|
|
||||||
{{# } }}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="operationBar">
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'form', 'table'], function () {
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var form = layui.form;
|
|
||||||
var table = layui.table;
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#articleTable',
|
|
||||||
url: '/admin/article/articlelist',
|
|
||||||
method: 'post',
|
|
||||||
cols: [[
|
|
||||||
{field: 'id', title: 'ID', align:'center', width: 80},
|
|
||||||
{field: 'title', title: '标题'},
|
|
||||||
{field: 'cate', title: '分类', align:'center', width: 180},
|
|
||||||
{field: 'image', title: '封面', templet: '#imageTemplate', align:'center', width: 180},
|
|
||||||
{field: 'author', title: '作者', align:'center', width: 120},
|
|
||||||
{field: 'status', title: '状态', templet: '#statusTemplate', align:'center', width: 80},
|
|
||||||
{field: 'publishdate', title: '发布时间', align:'center', width: 180},
|
|
||||||
{title: '操作', toolbar: '#operationBar', align:'center', width: 150}
|
|
||||||
]],
|
|
||||||
page: true,
|
|
||||||
limit: 20,
|
|
||||||
limits: [10, 20, 30, 50],
|
|
||||||
//height: 'full-220'
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听工具条事件
|
|
||||||
table.on('tool(articleTable)', function(obj){
|
|
||||||
var data = obj.data;
|
|
||||||
if(obj.event === 'edit'){
|
|
||||||
edit(data.id);
|
|
||||||
} else if(obj.event === 'del'){
|
|
||||||
del(data.id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听分类筛选变化
|
|
||||||
form.on('select(categoryFilter)', function(data){
|
|
||||||
filterByCategory(data.value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function filterByCategory(categoryId) {
|
|
||||||
if (!categoryId) {
|
|
||||||
layui.table.reload('articleTable', {
|
|
||||||
where: {},
|
|
||||||
page: {
|
|
||||||
curr: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var categoryName = $('#categoryFilter option[value="' + categoryId + '"]').text();
|
|
||||||
layui.table.reload('articleTable', {
|
|
||||||
where: {
|
|
||||||
category: categoryName
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
curr: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function add() {
|
|
||||||
window.location.href = '/admin/article/add';
|
|
||||||
}
|
|
||||||
|
|
||||||
function edit(id) {
|
|
||||||
window.location.href = '/admin/article/edit?id=' + id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function del(id) {
|
|
||||||
layer.confirm('确定要删除该文章吗?', {
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.post('/admin/article/delete', { id: id }, function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
layui.table.reload('articleTable');
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
layui.table.reload('articleTable');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,248 +0,0 @@
|
|||||||
<?php /*a:2:{s:54:"E:\Demo\PHP\yunzer\app\admin\view\article\cateedit.php";i:1746890051;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div style="padding: 50px;padding-bottom: 0px;">
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<input type="hidden" name="id" value="<?php echo htmlentities((string) $info['id']); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类图片</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" id="upload-btn">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 图片上传
|
|
||||||
</button>
|
|
||||||
<div style="width: 120px;">
|
|
||||||
<div class="layui-upload-list">
|
|
||||||
<img class="layui-upload-img" id="upload-img"
|
|
||||||
style="width: 118px; height: 118px;object-fit: cover;" src="<?php echo htmlentities((string) $info['image']); ?>">
|
|
||||||
<div id="upload-text"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-demo">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="image" value="<?php echo htmlentities((string) $info['image']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" id="name" name="name" required lay-verify="required" placeholder="请输入分类名称"
|
|
||||||
value="<?php echo htmlentities((string) $info['name']); ?>" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">父级分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select id="cid" name="cid" lay-verify="required">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select id="status" name="status" lay-verify="required">
|
|
||||||
<option value="1">启用</option>
|
|
||||||
<option value="0">关闭</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" id="sort" name="sort" value="<?php echo htmlentities((string) $info['sort']); ?>" placeholder="请输入排序值"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">保存修改</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// 首先定义PHP变量,确保类型正确
|
|
||||||
var currentCid = parseInt('<?php echo htmlentities((string) (isset($info['cid']) && ($info['cid'] !== '')?$info['cid']:0)); ?>'); // 转换为数字
|
|
||||||
var currentId = parseInt('<?php echo htmlentities((string) (isset($info['id']) && ($info['id'] !== '')?$info['id']:0)); ?>'); // 转换为数字
|
|
||||||
|
|
||||||
layui.use(['form', 'layer', 'upload', 'element'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var element = layui.element;
|
|
||||||
|
|
||||||
// 获取URL中的id参数
|
|
||||||
var urlParams = new URLSearchParams(window.location.search);
|
|
||||||
var id = parseInt(urlParams.get('id')) || 0; // 转换为数字
|
|
||||||
|
|
||||||
// 图片上传
|
|
||||||
var uploadInst = upload.render({
|
|
||||||
elem: '#upload-btn',
|
|
||||||
url: '<?php echo url("index/upload_img"); ?>',
|
|
||||||
before: function (obj) {
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#upload-img').attr('src', result);
|
|
||||||
});
|
|
||||||
element.progress('filter-demo', '0%');
|
|
||||||
layer.msg('上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
$('#image').val(res.data);
|
|
||||||
$('#upload-text').html('');
|
|
||||||
layer.msg('上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () {
|
|
||||||
var demoText = $('#upload-text');
|
|
||||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
||||||
demoText.find('.demo-reload').on('click', function () {
|
|
||||||
uploadInst.upload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('filter-demo', n + '%');
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("article/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="0">顶级分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
// 确保item.id是数字类型
|
|
||||||
var itemId = parseInt(item.id);
|
|
||||||
if (itemId !== id) { // 使用严格比较
|
|
||||||
html += '<option value="' + itemId + '"' +
|
|
||||||
(itemId === currentCid ? ' selected' : '') +
|
|
||||||
'>' + item.name + '</option>';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('#cid').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
$.post('<?php echo url("article/cateedit"); ?>', data.field, function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
var index = parent.layer.getFrameIndex(window.name);
|
|
||||||
parent.layer.close(index);
|
|
||||||
parent.location.reload();
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php /*a:3:{s:51:"E:\Demo\PHP\yunzer\app\admin\view\index\welcome.php";i:1747583088;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
<?php /*a:3:{s:51:"E:\Demo\PHP\yunzer\app\admin\view\index\welcome.php";i:1747658497;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@@ -255,8 +255,7 @@
|
|||||||
}
|
}
|
||||||
.activity-title {
|
.activity-title {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #1e293b;
|
color: #9b9b9b;
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
}
|
||||||
.activity-time {
|
.activity-time {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@@ -352,10 +351,9 @@
|
|||||||
<div class="activity-list">
|
<div class="activity-list">
|
||||||
<?php if(is_array($recentActivities) || $recentActivities instanceof \think\Collection || $recentActivities instanceof \think\Paginator): $i = 0; $__LIST__ = $recentActivities;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$activity): $mod = ($i % 2 );++$i;?>
|
<?php if(is_array($recentActivities) || $recentActivities instanceof \think\Collection || $recentActivities instanceof \think\Paginator): $i = 0; $__LIST__ = $recentActivities;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$activity): $mod = ($i % 2 );++$i;?>
|
||||||
<div class="activity-item">
|
<div class="activity-item">
|
||||||
<div class="activity-icon"><?php echo htmlentities((string) $activity['icon']); ?></div>
|
<div class="activity-icon"><?php echo htmlentities((string) (isset($activity['icon']) && ($activity['icon'] !== '')?$activity['icon']:'📌')); ?></div>
|
||||||
<div class="activity-content">
|
<div class="activity-content">
|
||||||
<div class="activity-title"><?php echo htmlentities((string) $activity['title']); ?></div>
|
<div class="activity-title"><?php echo htmlentities((string) $activity['content']); ?></div>
|
||||||
<div class="activity-time"><?php echo htmlentities((string) $activity['time']); ?></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
<?php endforeach; endif; else: echo "" ;endif; ?>
|
||||||
@@ -408,21 +406,75 @@ function updateTime() {
|
|||||||
document.getElementById('current-time').innerHTML = timeString;
|
document.getElementById('current-time').innerHTML = timeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取用户统计数据
|
||||||
|
function getUserCounts() {
|
||||||
|
fetch('<?php echo url("users/counts"); ?>')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(res => {
|
||||||
|
console.log('用户统计接口返回数据:', res);
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
// 更新用户总数
|
||||||
|
document.querySelector('.stat-card:nth-child(1) .stat-value').textContent = res.data.total.toLocaleString();
|
||||||
|
|
||||||
|
// 更新用户增长图表
|
||||||
|
if (window.userChart) {
|
||||||
|
window.userChart.setOption({
|
||||||
|
xAxis: {
|
||||||
|
data: res.data.dates
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '新增用户',
|
||||||
|
data: res.data.counts
|
||||||
|
}, {
|
||||||
|
name: '总用户数',
|
||||||
|
data: res.data.totalCounts
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('用户统计接口返回异常:', res);
|
||||||
|
document.querySelector('.stat-card:nth-child(1) .stat-value').textContent = '0';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('获取用户统计失败:', error);
|
||||||
|
document.querySelector('.stat-card:nth-child(1) .stat-value').textContent = '0';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 获取文章统计数据
|
// 获取文章统计数据
|
||||||
function getArticleCounts() {
|
function getArticleCounts() {
|
||||||
fetch('<?php echo url("article/counts"); ?>')
|
fetch('<?php echo url("articles/counts"); ?>')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('文章统计接口返回数据:', res);
|
console.log('文章统计接口返回数据:', res);
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
// 更新文章总数
|
// 更新文章总数
|
||||||
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = res.data.total.toLocaleString();
|
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = res.data.total.toLocaleString();
|
||||||
|
|
||||||
|
// 更新文章统计图表
|
||||||
|
if (window.articleChart) {
|
||||||
|
window.articleChart.setOption({
|
||||||
|
xAxis: {
|
||||||
|
data: res.data.dates
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '新增文章',
|
||||||
|
data: res.data.counts
|
||||||
|
}, {
|
||||||
|
name: '总文章数',
|
||||||
|
data: res.data.totalCounts
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.warn('文章统计接口返回异常:', res);
|
console.warn('文章统计接口返回异常:', res);
|
||||||
|
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = '0';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('获取文章统计失败:', error);
|
console.error('获取文章统计失败:', error);
|
||||||
|
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = '0';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,12 +487,30 @@ function getResourcesCounts() {
|
|||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
// 更新资源总数
|
// 更新资源总数
|
||||||
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = res.data.total.toLocaleString();
|
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = res.data.total.toLocaleString();
|
||||||
|
|
||||||
|
// 更新资源统计图表
|
||||||
|
if (window.resourceChart) {
|
||||||
|
window.resourceChart.setOption({
|
||||||
|
xAxis: {
|
||||||
|
data: res.data.dates
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '新增资源',
|
||||||
|
data: res.data.counts
|
||||||
|
}, {
|
||||||
|
name: '总资源数',
|
||||||
|
data: res.data.totalCounts
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.warn('资源统计接口返回异常:', res);
|
console.warn('资源统计接口返回异常:', res);
|
||||||
|
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = '0';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('获取资源统计失败:', error);
|
console.error('获取资源统计失败:', error);
|
||||||
|
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = '0';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,6 +519,7 @@ setInterval(updateTime, 1000);
|
|||||||
|
|
||||||
// 页面加载完成后获取统计数据
|
// 页面加载完成后获取统计数据
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
getUserCounts();
|
||||||
getArticleCounts();
|
getArticleCounts();
|
||||||
getResourcesCounts();
|
getResourcesCounts();
|
||||||
});
|
});
|
||||||
@@ -527,6 +598,7 @@ function initVisitTrend() {
|
|||||||
// 用户增长图表
|
// 用户增长图表
|
||||||
function initUserGrowth() {
|
function initUserGrowth() {
|
||||||
var chart = echarts.init(document.getElementById('userGrowth'));
|
var chart = echarts.init(document.getElementById('userGrowth'));
|
||||||
|
window.userChart = chart;
|
||||||
var option = {
|
var option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
@@ -549,7 +621,7 @@ function initUserGrowth() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['userGrowth']['dates'])); ?>
|
data: []
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
@@ -558,7 +630,7 @@ function initUserGrowth() {
|
|||||||
{
|
{
|
||||||
name: '新增用户',
|
name: '新增用户',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['userGrowth']['newUsers'])); ?>,
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#3881fd'
|
color: '#3881fd'
|
||||||
}
|
}
|
||||||
@@ -567,9 +639,12 @@ function initUserGrowth() {
|
|||||||
name: '总用户数',
|
name: '总用户数',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['userGrowth']['totalUsers'])); ?>,
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#10b981'
|
color: '#10b981'
|
||||||
|
},
|
||||||
|
lineStyle: {
|
||||||
|
width: 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -580,6 +655,7 @@ function initUserGrowth() {
|
|||||||
// 资源统计图表
|
// 资源统计图表
|
||||||
function initResourceStats() {
|
function initResourceStats() {
|
||||||
var chart = echarts.init(document.getElementById('resourceStats'));
|
var chart = echarts.init(document.getElementById('resourceStats'));
|
||||||
|
window.resourceChart = chart;
|
||||||
var option = {
|
var option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
@@ -591,7 +667,7 @@ function initResourceStats() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
data: ['新增资源', '下载量']
|
data: ['新增资源', '总资源数']
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
left: '3%',
|
left: '3%',
|
||||||
@@ -602,7 +678,7 @@ function initResourceStats() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['resourceStats']['dates'])); ?>
|
data: []
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
@@ -611,18 +687,21 @@ function initResourceStats() {
|
|||||||
{
|
{
|
||||||
name: '新增资源',
|
name: '新增资源',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['resourceStats']['resources'])); ?>,
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#3881fd'
|
color: '#3881fd'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '下载量',
|
name: '总资源数',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['resourceStats']['downloads'])); ?>,
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#10b981'
|
color: '#10b981'
|
||||||
|
},
|
||||||
|
lineStyle: {
|
||||||
|
width: 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -633,6 +712,7 @@ function initResourceStats() {
|
|||||||
// 文章统计图表
|
// 文章统计图表
|
||||||
function initArticleStats() {
|
function initArticleStats() {
|
||||||
var chart = echarts.init(document.getElementById('articleStats'));
|
var chart = echarts.init(document.getElementById('articleStats'));
|
||||||
|
window.articleChart = chart;
|
||||||
var option = {
|
var option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
@@ -644,7 +724,7 @@ function initArticleStats() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
data: ['新增文章', '访问量']
|
data: ['新增文章', '总文章数']
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
left: '3%',
|
left: '3%',
|
||||||
@@ -655,7 +735,7 @@ function initArticleStats() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
boundaryGap: false,
|
boundaryGap: false,
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['articleStats']['dates'])); ?>
|
data: []
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
@@ -664,18 +744,21 @@ function initArticleStats() {
|
|||||||
{
|
{
|
||||||
name: '新增文章',
|
name: '新增文章',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['articleStats']['articles'])); ?>,
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#3881fd'
|
color: '#3881fd'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '访问量',
|
name: '总文章数',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: <?php echo htmlentities((string) json_encode($chartData['articleStats']['views'])); ?>,
|
data: [],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#10b981'
|
color: '#10b981'
|
||||||
|
},
|
||||||
|
lineStyle: {
|
||||||
|
width: 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,199 +0,0 @@
|
|||||||
<?php /*a:3:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\useredit.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<input type="hidden" name="uid" value="<?php echo htmlentities((string) $lists['uid']); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">账户</label>
|
|
||||||
<div class="layui-input-inline"><input type="text" class="layui-input" value="<?php echo htmlentities((string) $lists['account']); ?>" readonly></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">姓 名</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" class="layui-input" name="name" placeholder="请输入真实姓名" value="<?php echo htmlentities((string) $lists['name']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">手机号</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" class="layui-input" name="phone" placeholder="请输入手机号" value="<?php echo htmlentities((string) $lists['phone']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">QQ号</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" class="layui-input" name="qq" placeholder="请输入QQ号" value="<?php echo htmlentities((string) $lists['qq']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">角色</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="group_id">
|
|
||||||
<option value=0></option>
|
|
||||||
<?php if(is_array($group) || $group instanceof \think\Collection || $group instanceof \think\Paginator): $i = 0; $__LIST__ = $group;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<option value="<?php echo htmlentities((string) $vo['group_id']); ?>" <?php echo $vo['group_id']==$lists['group_id'] ? 'selected' : ''; ?>><?php echo htmlentities((string) $vo['group_name']); ?></option>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">性别</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="sex" value="1" title="男" <?php echo $lists['sex']==1 ? 'checked' : ''; ?>>
|
|
||||||
<input type="radio" name="sex" value="2" title="女" <?php echo $lists['sex']==2 ? 'checked' : ''; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" <?php echo $lists['status']==1 ? 'checked' : ''; ?>>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用" <?php echo $lists['status']==0 ? 'checked' : ''; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
// 保存管理员
|
|
||||||
function save(){
|
|
||||||
$.post("<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/useredit",$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.alert(res.msg,{icon:2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg);
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,298 +0,0 @@
|
|||||||
<?php /*a:2:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\articles\articlelist.php";i:1747623409;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-list"></i>
|
|
||||||
<span>文章列表</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div class="shaixuan">
|
|
||||||
<label>筛选:</label>
|
|
||||||
<div class="layui-form" style="display: flex; gap: 10px;">
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select id="categoryFilter" lay-filter="categoryFilter" lay-verify="">
|
|
||||||
<option value="">全部分类</option>
|
|
||||||
<?php if(is_array($categories) || $categories instanceof \think\Collection || $categories instanceof \think\Paginator): $i = 0; $__LIST__ = $categories;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$category): $mod = ($i % 2 );++$i;?>
|
|
||||||
<optgroup label="<?php echo htmlentities((string) $category['name']); ?>">
|
|
||||||
<?php if(is_array($category['children']) || $category['children'] instanceof \think\Collection || $category['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $category['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$subCategory): $mod = ($i % 2 );++$i;?>
|
|
||||||
<option value="<?php echo htmlentities((string) $subCategory['id']); ?>"><?php echo htmlentities((string) $subCategory['name']); ?></option>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</optgroup>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" id="titleSearch" placeholder="搜索标题" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" id="authorSearch" placeholder="搜索作者" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="doSearch()">
|
|
||||||
<i class="layui-icon layui-icon-search"></i>搜索
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="doRefresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>重置
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加文章
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table id="articleTable" lay-filter="articleTable"></table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/html" id="imageTemplate">
|
|
||||||
{{# if(d.image){ }}
|
|
||||||
<img src="{{ d.image }}" style="max-width: 50px; max-height: 50px;">
|
|
||||||
{{# } }}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="statusTemplate">
|
|
||||||
{{# if(d.status === 0){ }}
|
|
||||||
<span style="color:red;">草稿</span>
|
|
||||||
{{# } else if(d.status === 1){ }}
|
|
||||||
<span style="color:orange;">待审核</span>
|
|
||||||
{{# } else if(d.status === 2){ }}
|
|
||||||
<span style="color:green;">已发布</span>
|
|
||||||
{{# } else if(d.status === 3){ }}
|
|
||||||
<span style="color:gray;">隐藏</span>
|
|
||||||
{{# } }}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="operationBar">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'form', 'table'], function () {
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var form = layui.form;
|
|
||||||
var table = layui.table;
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#articleTable',
|
|
||||||
url: '/admin/article/articlelist',
|
|
||||||
method: 'post',
|
|
||||||
cols: [[
|
|
||||||
{ field: 'id', title: 'ID', align: 'center', width: 80 },
|
|
||||||
{ field: 'title', title: '标题' },
|
|
||||||
{ field: 'cate', title: '分类', align: 'center', width: 180 },
|
|
||||||
{ field: 'image', title: '封面', templet: '#imageTemplate', align: 'center', width: 180 },
|
|
||||||
{ field: 'author', title: '作者', align: 'center', width: 120 },
|
|
||||||
{ field: 'status', title: '状态', templet: '#statusTemplate', align: 'center', width: 80 },
|
|
||||||
{ field: 'publishdate', title: '发布时间', align: 'center', width: 180 },
|
|
||||||
{ title: '操作', toolbar: '#operationBar', align: 'center', width: 150 }
|
|
||||||
]],
|
|
||||||
page: true,
|
|
||||||
limit: 10,
|
|
||||||
limits: [10, 50, 100],
|
|
||||||
//height: 'full-220'
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听工具条事件
|
|
||||||
table.on('tool(articleTable)', function (obj) {
|
|
||||||
var data = obj.data;
|
|
||||||
if (obj.event === 'edit') {
|
|
||||||
edit(data.id);
|
|
||||||
} else if (obj.event === 'del') {
|
|
||||||
del(data.id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听分类筛选变化
|
|
||||||
form.on('select(categoryFilter)', function (data) {
|
|
||||||
filterByCategory(data.value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function filterByCategory(categoryId) {
|
|
||||||
reloadTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function doSearch() {
|
|
||||||
var titleKeyword = $('#titleSearch').val().trim();
|
|
||||||
var authorKeyword = $('#authorSearch').val().trim();
|
|
||||||
|
|
||||||
if (!titleKeyword && !authorKeyword && !$('#categoryFilter').val()) {
|
|
||||||
layer.msg('请输入搜索条件', { icon: 0 });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
reloadTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function doRefresh() {
|
|
||||||
// 清空搜索条件
|
|
||||||
$('#titleSearch').val('');
|
|
||||||
$('#authorSearch').val('');
|
|
||||||
$('#categoryFilter').val('');
|
|
||||||
layui.form.render('select'); // 重新渲染select
|
|
||||||
|
|
||||||
// 重新加载表格,不带任何筛选条件
|
|
||||||
layui.table.reload('articleTable', {
|
|
||||||
where: {},
|
|
||||||
page: {
|
|
||||||
curr: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
layer.msg('已重置', { icon: 1 });
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadTable() {
|
|
||||||
var categoryId = $('#categoryFilter').val();
|
|
||||||
var categoryName = categoryId ? $('#categoryFilter option[value="' + categoryId + '"]').text() : '';
|
|
||||||
var titleKeyword = $('#titleSearch').val().trim();
|
|
||||||
var authorKeyword = $('#authorSearch').val().trim();
|
|
||||||
|
|
||||||
layui.table.reload('articleTable', {
|
|
||||||
where: {
|
|
||||||
category: categoryName,
|
|
||||||
title: titleKeyword,
|
|
||||||
author: authorKeyword
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
curr: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function add() {
|
|
||||||
window.location.href = '/admin/article/add';
|
|
||||||
}
|
|
||||||
|
|
||||||
function edit(id) {
|
|
||||||
window.location.href = '/admin/article/edit?id=' + id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function del(id) {
|
|
||||||
layer.confirm('确定要删除该文章吗?', {
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.post('/admin/article/delete', { id: id }, function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
layui.table.reload('articleTable');
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
layui.table.reload('articleTable');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,267 +0,0 @@
|
|||||||
<?php /*a:2:{s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\log\operation.php";i:1747615358;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span class="layui-badge layui-bg-blue">操作日志</span>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<form class="layui-form layui-form-pane" action="">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">用户名</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">模块</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" name="module" placeholder="请输入模块" autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">操作</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" name="operation" placeholder="请输入操作" autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="status">
|
|
||||||
<option value="">全部</option>
|
|
||||||
<option value="1">成功</option>
|
|
||||||
<option value="0">失败</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">时间范围</label>
|
|
||||||
<div class="layui-input-inline" style="width: 300px;">
|
|
||||||
<input type="text" name="time_range" class="layui-input" id="timeRange" placeholder="请选择时间范围">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="searchForm">
|
|
||||||
<i class="layui-icon layui-icon-search"></i> 搜索
|
|
||||||
</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<table id="operationLogTable" lay-filter="operationLogTable"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/layui/layui.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.use(['table', 'form', 'laydate', 'layer'], function(){
|
|
||||||
var table = layui.table;
|
|
||||||
var form = layui.form;
|
|
||||||
var laydate = layui.laydate;
|
|
||||||
var layer = layui.layer;
|
|
||||||
|
|
||||||
// 初始化时间范围选择器
|
|
||||||
laydate.render({
|
|
||||||
elem: '#timeRange',
|
|
||||||
type: 'datetime',
|
|
||||||
range: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#operationLogTable',
|
|
||||||
url: '<?php echo url("log/operation"); ?>',
|
|
||||||
method: 'get',
|
|
||||||
defaultToolbar: ['filter', 'exports', 'print'],
|
|
||||||
parseData: function(res) {
|
|
||||||
return {
|
|
||||||
"code": 0,
|
|
||||||
"msg": res.msg || '获取成功',
|
|
||||||
"count": res.count || 0,
|
|
||||||
"data": res.data || []
|
|
||||||
};
|
|
||||||
},
|
|
||||||
cols: [[
|
|
||||||
{field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
|
|
||||||
{field: 'username', title: '操作人', width: 120, align: 'center'},
|
|
||||||
{field: 'module', title: '模块', width: 120, align: 'center'},
|
|
||||||
{field: 'operation', title: '操作', width: 150, align: 'center'},
|
|
||||||
{field: 'request_method', title: '请求方法', width: 100, align: 'center'},
|
|
||||||
{field: 'request_url', title: '请求地址', align: 'center'},
|
|
||||||
{field: 'ip_address', title: 'IP地址', width: 120, align: 'center'},
|
|
||||||
{field: 'status', title: '状态', width: 100, align: 'center', templet: function(d){
|
|
||||||
return d.status == 1 ? '<span class="layui-badge layui-bg-green">成功</span>' : '<span class="layui-badge layui-bg-red">失败</span>';
|
|
||||||
}},
|
|
||||||
{field: 'operation_time', title: '操作时间', width: 180, align: 'center'},
|
|
||||||
{field: 'execution_time', title: '执行时间(ms)', width: 120, align: 'center'},
|
|
||||||
{title: '操作', width: 120, toolbar: '#operationBar', fixed: 'right', align: 'center'}
|
|
||||||
]],
|
|
||||||
page: true,
|
|
||||||
limit: 10,
|
|
||||||
limits: [10, 20, 50, 100]
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听搜索表单提交
|
|
||||||
form.on('submit(searchForm)', function(data){
|
|
||||||
var timeRange = data.field.time_range;
|
|
||||||
if(timeRange){
|
|
||||||
var times = timeRange.split(' - ');
|
|
||||||
data.field.start_time = times[0];
|
|
||||||
data.field.end_time = times[1];
|
|
||||||
}
|
|
||||||
delete data.field.time_range;
|
|
||||||
|
|
||||||
table.reload('operationLogTable', {
|
|
||||||
where: data.field,
|
|
||||||
page: {curr: 1}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听工具条
|
|
||||||
table.on('tool(operationLogTable)', function(obj){
|
|
||||||
var data = obj.data;
|
|
||||||
if(obj.event === 'detail'){
|
|
||||||
// 获取详情
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo url("log/getOperationDetail"); ?>',
|
|
||||||
type: 'GET',
|
|
||||||
data: {id: data.id},
|
|
||||||
success: function(res){
|
|
||||||
if(res.code === 0){
|
|
||||||
var detail = res.data;
|
|
||||||
var content = '<div class="layui-card">' +
|
|
||||||
'<div class="layui-card-body">' +
|
|
||||||
'<table class="layui-table" lay-skin="nob">' +
|
|
||||||
'<colgroup><col width="100"><col></colgroup>' +
|
|
||||||
'<tbody>' +
|
|
||||||
'<tr><td>操作人:</td><td>' + detail.username + '</td></tr>' +
|
|
||||||
'<tr><td>模块:</td><td>' + detail.module + '</td></tr>' +
|
|
||||||
'<tr><td>操作:</td><td>' + detail.operation + '</td></tr>' +
|
|
||||||
'<tr><td>请求方法:</td><td>' + detail.request_method + '</td></tr>' +
|
|
||||||
'<tr><td>请求地址:</td><td>' + detail.request_url + '</td></tr>' +
|
|
||||||
'<tr><td>请求参数:</td><td><pre>' + JSON.stringify(detail.request_params, null, 2) + '</pre></td></tr>' +
|
|
||||||
'<tr><td>IP地址:</td><td>' + detail.ip_address + '</td></tr>' +
|
|
||||||
'<tr><td>状态:</td><td>' + (detail.status == 1 ? '成功' : '失败') + '</td></tr>' +
|
|
||||||
'<tr><td>错误信息:</td><td>' + (detail.error_message || '无') + '</td></tr>' +
|
|
||||||
'<tr><td>操作时间:</td><td>' + detail.operation_time + '</td></tr>' +
|
|
||||||
'<tr><td>执行时间:</td><td>' + detail.execution_time + 'ms</td></tr>' +
|
|
||||||
'</tbody></table></div></div>';
|
|
||||||
|
|
||||||
layer.open({
|
|
||||||
type: 1,
|
|
||||||
title: '操作日志详情',
|
|
||||||
area: ['800px', '600px'],
|
|
||||||
content: content
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- 表格工具栏模板 -->
|
|
||||||
<script type="text/html" id="operationBar">
|
|
||||||
<a class="layui-btn layui-btn-xs" lay-event="detail">详情</a>
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
<?php /*a:3:{s:63:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\menuedit.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<input type="hidden" name="smid" value="<?php echo htmlentities((string) $lists['smid']); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">菜单名</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="label" placeholder="请输入菜单名" value="<?php echo htmlentities((string) $lists['label']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="icon_class" lay-verify="required" lay-search="">
|
|
||||||
<option value="">请输入layui图标</option>
|
|
||||||
<?php foreach($iconfont as $icon_v): ?>
|
|
||||||
<option value="<?php echo htmlentities((string) $icon_v['icon_css']); ?>" <?php if(($icon_v['icon_css'] == $lists['icon_class'])): ?>selected<?php endif; ?>><?php echo htmlentities((string) $icon_v['icon_css']); ?> <?php echo htmlentities((string) $icon_v['icon_name']); ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" class="layui-input" name="sort" placeholder="值越大越靠前" value="<?php echo htmlentities((string) $lists['sort']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" <?php echo $lists['status']==1 ? 'checked' : ''; ?>>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用" <?php echo $lists['status']==0 ? 'checked' : ''; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
|
|
||||||
function save(){
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/menuedit',$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,260 +0,0 @@
|
|||||||
<?php /*a:2:{s:47:"E:\Demo\PHP\yunzer\app\admin\view\log\login.php";i:1747584845;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span class="layui-badge layui-bg-blue">登录日志</span>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<form class="layui-form layui-form-pane" action="">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">用户名</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">IP地址</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" name="ip" placeholder="请输入IP地址" autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="status">
|
|
||||||
<option value="">全部</option>
|
|
||||||
<option value="1">成功</option>
|
|
||||||
<option value="0">失败</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">时间范围</label>
|
|
||||||
<div class="layui-input-inline" style="width: 300px;">
|
|
||||||
<input type="text" name="time_range" class="layui-input" id="timeRange" placeholder="请选择时间范围">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="searchForm">
|
|
||||||
<i class="layui-icon layui-icon-search"></i> 搜索
|
|
||||||
</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<table id="loginLogTable" lay-filter="loginLogTable"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/html" id="tableToolbar">
|
|
||||||
<div class="layui-btn-container">
|
|
||||||
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="clearAll">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i> 清空日志
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="tableBar">
|
|
||||||
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script src="/static/layui/layui.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.use(['table', 'form', 'laydate'], function(){
|
|
||||||
var table = layui.table;
|
|
||||||
var form = layui.form;
|
|
||||||
var laydate = layui.laydate;
|
|
||||||
|
|
||||||
// 初始化时间范围选择器
|
|
||||||
laydate.render({
|
|
||||||
elem: '#timeRange',
|
|
||||||
type: 'datetime',
|
|
||||||
range: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#loginLogTable',
|
|
||||||
url: '<?php echo url("log/login"); ?>',
|
|
||||||
method: 'post',
|
|
||||||
toolbar: '#tableToolbar',
|
|
||||||
defaultToolbar: ['filter', 'exports', 'print'],
|
|
||||||
parseData: function(res) {
|
|
||||||
return {
|
|
||||||
"code": res.code === 0 ? 0 : 1,
|
|
||||||
"msg": res.msg,
|
|
||||||
"count": res.count,
|
|
||||||
"data": res.data
|
|
||||||
};
|
|
||||||
},
|
|
||||||
cols: [[
|
|
||||||
{field: 'id', title: 'ID', width: 80, sort: true},
|
|
||||||
{field: 'username', title: '用户名', width: 120},
|
|
||||||
{field: 'ip_address', title: 'IP地址', width: 130},
|
|
||||||
{field: 'location', title: '登录地点', width: 120},
|
|
||||||
{field: 'device_type', title: '设备类型', width: 100},
|
|
||||||
{field: 'user_agent', title: '浏览器', width: 200},
|
|
||||||
{field: 'login_status', title: '状态', width: 100, templet: function(d){
|
|
||||||
return d.login_status == 1 ?
|
|
||||||
'<span class="layui-badge layui-bg-green">成功</span>' :
|
|
||||||
'<span class="layui-badge layui-bg-red">失败</span>';
|
|
||||||
}},
|
|
||||||
{field: 'failure_reason', title: '失败原因', width: 150},
|
|
||||||
{field: 'login_time', title: '登录时间', width: 180, sort: true},
|
|
||||||
{title: '操作', toolbar: '#tableBar', width: 80, fixed: 'right'}
|
|
||||||
]],
|
|
||||||
page: true,
|
|
||||||
limit: 10,
|
|
||||||
limits: [10, 20, 50, 100]
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听搜索表单提交
|
|
||||||
form.on('submit(searchForm)', function(data){
|
|
||||||
var timeRange = data.field.time_range;
|
|
||||||
if(timeRange){
|
|
||||||
var times = timeRange.split(' - ');
|
|
||||||
data.field.start_time = times[0];
|
|
||||||
data.field.end_time = times[1];
|
|
||||||
}
|
|
||||||
delete data.field.time_range;
|
|
||||||
|
|
||||||
table.reload('loginLogTable', {
|
|
||||||
where: data.field,
|
|
||||||
page: {curr: 1}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听工具条
|
|
||||||
table.on('tool(loginLogTable)', function(obj){
|
|
||||||
var data = obj.data;
|
|
||||||
if(obj.event === 'del'){
|
|
||||||
layer.confirm('确定删除这条日志吗?', function(index){
|
|
||||||
$.post('<?php echo url("log/deleteLogin"); ?>', {id: data.id}, function(res){
|
|
||||||
if(res.code === 0){
|
|
||||||
layer.msg(res.msg, {icon: 1});
|
|
||||||
obj.del();
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg, {icon: 2});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听头工具栏事件
|
|
||||||
table.on('toolbar(loginLogTable)', function(obj){
|
|
||||||
if(obj.event === 'clearAll'){
|
|
||||||
layer.confirm('确定要清空所有登录日志吗?', function(index){
|
|
||||||
$.post('<?php echo url("log/clearLogin"); ?>', function(res){
|
|
||||||
if(res.code === 0){
|
|
||||||
layer.msg(res.msg, {icon: 1});
|
|
||||||
table.reload('loginLogTable');
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg, {icon: 2});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,176 +0,0 @@
|
|||||||
<?php /*a:3:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\groupadd.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">角色名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="group_name" placeholder="请输入角色名称">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" checked="">
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-itme">
|
|
||||||
<label class="layui-form-label">权限菜单</label>
|
|
||||||
<?php if(is_array($menus) || $menus instanceof \think\Collection || $menus instanceof \think\Paginator): $i = 0; $__LIST__ = $menus;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<hr>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="checkbox" name="menu[<?php echo htmlentities((string) $vo['smid']); ?>]" lay-skin="primary" title="<?php echo htmlentities((string) $vo['label']); ?>">
|
|
||||||
<hr>
|
|
||||||
<?php if(is_array($vo['children']) || $vo['children'] instanceof \think\Collection || $vo['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $vo['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cvo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<input type="checkbox" name="menu[<?php echo htmlentities((string) $cvo['smid']); ?>]" lay-skin="primary" title="<?php echo htmlentities((string) $cvo['label']); ?>">
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
var form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
|
|
||||||
function save(){
|
|
||||||
$.post("<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/groupadd",$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,619 +0,0 @@
|
|||||||
<?php /*a:2:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\articles\articlecate.php";i:1747623415;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-app"></i>
|
|
||||||
<span>文章分类管理</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加分类
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 主要内容区 -->
|
|
||||||
<div class="main-content">
|
|
||||||
<div class="layui-row layui-col-space20">
|
|
||||||
<!-- 左侧分类列表 -->
|
|
||||||
<div class="layui-col-md7">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span>分类列表</span>
|
|
||||||
<small class="text-muted">支持两级分类结构</small>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<div id="categoryList" class="category-tree"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 右侧分类信息 -->
|
|
||||||
<div class="layui-col-md5">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span>分类信息</span>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<!-- 默认提示 -->
|
|
||||||
<div id="defaultTip" class="empty-tip">
|
|
||||||
<i class="layui-icon layui-icon-face-surprised"></i>
|
|
||||||
<p>请选择左侧分类或点击新增按钮</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 分类表单 -->
|
|
||||||
<form class="layui-form category-form" lay-filter="categoryForm" style="display: none;">
|
|
||||||
<input type="hidden" name="id" id="categoryId">
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入分类名称"
|
|
||||||
autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">父级分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cid" lay-verify="required">
|
|
||||||
<option value="0">顶级分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">封面图片</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-upload-drag" id="uploadImage">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i>
|
|
||||||
<p>点击上传或拖拽图片至此处</p>
|
|
||||||
<div class="layui-hide" id="uploadPreview">
|
|
||||||
<hr>
|
|
||||||
<img src="" alt="封面图片" style="max-width: 100%">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="imageInput">
|
|
||||||
<div class="layui-form-mid layui-word-aux">建议尺寸:250px * 140px</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" name="sort" value="0" class="layui-input"
|
|
||||||
placeholder="数字越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="正常" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item form-actions">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="saveCategory">保存</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-danger" id="deleteBtn"
|
|
||||||
style="display: none;">删除</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
/* 页面整体样式 */
|
|
||||||
.config-container {
|
|
||||||
padding: 15px;
|
|
||||||
/* background: #f2f2f2; */
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-col-md7 .layui-btn-primary {
|
|
||||||
border-color: #d2d2d2;
|
|
||||||
background: 0 0;
|
|
||||||
color: #5f5f5f
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-col-md7 .layui-btn-primary:hover {
|
|
||||||
background-color: #1e9fff;
|
|
||||||
color: #efefef
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 页面头部样式 */
|
|
||||||
.page-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
padding: 10px 15px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 2px;
|
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-title {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-title .layui-icon {
|
|
||||||
margin-right: 8px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-actions .layui-btn {
|
|
||||||
margin-left: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 主要内容区样式 */
|
|
||||||
.main-content {
|
|
||||||
min-height: calc(100vh - 170px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-card {
|
|
||||||
margin-bottom: 0;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-card-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
height: auto;
|
|
||||||
padding: 12px 15px;
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-muted {
|
|
||||||
margin-left: 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: normal;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 分类树样式 */
|
|
||||||
.category-tree {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-item {
|
|
||||||
margin: 5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 10px 15px;
|
|
||||||
background-color: #f8f8f8;
|
|
||||||
border-radius: 2px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header:hover {
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header.active {
|
|
||||||
background-color: #e6f7ff;
|
|
||||||
border-right: 3px solid #1890ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-name {
|
|
||||||
flex: 1;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-actions {
|
|
||||||
/* opacity: 0; */
|
|
||||||
transition: opacity 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header:hover .category-actions {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-children {
|
|
||||||
margin-left: 20px;
|
|
||||||
padding-left: 15px;
|
|
||||||
border-left: 1px dashed #e6e6e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-child {
|
|
||||||
padding: 3px 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-child .layui-icon {
|
|
||||||
font-size: 12px;
|
|
||||||
margin-right: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 空状态提示 */
|
|
||||||
.empty-tip {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 40px 0;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-tip .layui-icon {
|
|
||||||
font-size: 32px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表单样式优化 */
|
|
||||||
.category-form {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-form-label {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-input-block {
|
|
||||||
margin-left: 130px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-actions {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag {
|
|
||||||
padding: 20px;
|
|
||||||
border: 1px dashed #e2e2e2;
|
|
||||||
background-color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag:hover {
|
|
||||||
border-color: #009688;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag img {
|
|
||||||
max-width: 100%;
|
|
||||||
margin: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-btn-xs {
|
|
||||||
height: 30px;
|
|
||||||
line-height: 25px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// 定义全局变量和函数
|
|
||||||
var categoryManager = {
|
|
||||||
init: function () {
|
|
||||||
this.initLayui();
|
|
||||||
},
|
|
||||||
|
|
||||||
initLayui: function () {
|
|
||||||
var that = this;
|
|
||||||
layui.use(['layer', 'form', 'upload'], function () {
|
|
||||||
var layer = layui.layer;
|
|
||||||
var form = layui.form;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
|
|
||||||
// 初始化分类列表
|
|
||||||
that.initCategoryList = function () {
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/article/articlecate',
|
|
||||||
type: 'POST',
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
var html = '';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
html += that.renderCategory(item);
|
|
||||||
});
|
|
||||||
$('#categoryList').html(html);
|
|
||||||
that.bindEvents();
|
|
||||||
} else {
|
|
||||||
layer.msg('获取分类数据失败', { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 渲染分类项
|
|
||||||
that.renderCategory = function (category, level = 0) {
|
|
||||||
var html = '<div class="category-item" data-id="' + category.id + '">';
|
|
||||||
html += '<div class="category-header">';
|
|
||||||
html += '<div class="category-name">' + category.title + '</div>';
|
|
||||||
if (level === 0) {
|
|
||||||
html += '<div class="category-actions">';
|
|
||||||
html += '<button type="button" class="layui-btn layui-btn-primary layui-btn-xs add-child">';
|
|
||||||
html += '<i class="layui-icon layui-icon-add-1"></i>添加子分类</button>';
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
|
|
||||||
if (category.children && category.children.length > 0) {
|
|
||||||
html += '<div class="category-children">';
|
|
||||||
category.children.forEach(function (child) {
|
|
||||||
html += that.renderCategory(child, level + 1);
|
|
||||||
});
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
return html;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 绑定事件
|
|
||||||
that.bindEvents = function () {
|
|
||||||
// 点击分类项加载编辑信息
|
|
||||||
$('.category-header').off('click').on('click', function (e) {
|
|
||||||
if (!$(e.target).closest('.add-child').length) {
|
|
||||||
var id = $(this).closest('.category-item').data('id');
|
|
||||||
that.loadCategoryInfo(id);
|
|
||||||
|
|
||||||
// 添加选中效果
|
|
||||||
$('.category-header').removeClass('active');
|
|
||||||
$(this).addClass('active');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加子分类
|
|
||||||
$('.add-child').off('click').on('click', function (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
var parentId = $(this).closest('.category-item').data('id');
|
|
||||||
that.showCategoryForm(parentId);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 加载分类信息
|
|
||||||
that.loadCategoryInfo = function (id) {
|
|
||||||
$.get('/admin/article/cateedit?id=' + id, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
that.showCategoryForm(0, res.data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 显示分类表单
|
|
||||||
that.showCategoryForm = function (parentId = 0, data = null) {
|
|
||||||
$('#defaultTip').hide();
|
|
||||||
$('.category-form').show();
|
|
||||||
|
|
||||||
// 重置表单
|
|
||||||
form.val('categoryForm', {
|
|
||||||
id: data ? data.info.id : '',
|
|
||||||
name: data ? data.info.name : '',
|
|
||||||
cid: data ? data.info.cid : parentId,
|
|
||||||
sort: data ? data.info.sort : 0,
|
|
||||||
status: data ? data.info.status : 1
|
|
||||||
});
|
|
||||||
|
|
||||||
// 更新父级分类选项
|
|
||||||
var $select = $('select[name="cid"]');
|
|
||||||
$select.empty().append('<option value="0">顶级分类</option>');
|
|
||||||
// 获取所有分类作为父级选项
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/article/articlecate',
|
|
||||||
type: 'POST',
|
|
||||||
async: false,
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
// 当前编辑的分类ID
|
|
||||||
var currentId = data ? data.info.id : 0;
|
|
||||||
// 递归构建分类选项
|
|
||||||
function buildOptions(categories, level) {
|
|
||||||
categories.forEach(function (category) {
|
|
||||||
// 不能选择自己或自己的子分类作为父级
|
|
||||||
if (category.id != currentId) {
|
|
||||||
var prefix = new Array(level + 1).join('├─ ');
|
|
||||||
$select.append('<option value="' + category.id + '">' + prefix + category.title + '</option>'); if (category.children && category.children.length > 0) { buildOptions(category.children, level + 1); }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} buildOptions(res.data, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 设置选中的父级分类
|
|
||||||
if (data && data.info.cid) {
|
|
||||||
$select.val(data.info.cid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新图片预览
|
|
||||||
if (data && data.info.image) {
|
|
||||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', data.info.image);
|
|
||||||
$('#imageInput').val(data.info.image);
|
|
||||||
} else {
|
|
||||||
$('#uploadPreview').addClass('layui-hide').find('img').attr('src', '');
|
|
||||||
$('#imageInput').val('');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示/隐藏删除按钮
|
|
||||||
$('#deleteBtn')[data ? 'show' : 'hide']();
|
|
||||||
|
|
||||||
form.render();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化上传组件
|
|
||||||
upload.render({
|
|
||||||
elem: '#uploadImage',
|
|
||||||
url: '/admin/upload/image',
|
|
||||||
accept: 'images',
|
|
||||||
acceptMime: 'image/*',
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', res.data.url);
|
|
||||||
$('#imageInput').val(res.data.url);
|
|
||||||
layer.msg('上传成功');
|
|
||||||
} else {
|
|
||||||
layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听表单提交
|
|
||||||
form.on('submit(saveCategory)', function (data) {
|
|
||||||
var url = data.field.id ? '/admin/article/cateedit' : '/admin/article/cateadd';
|
|
||||||
$.post(url, data.field, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
that.initCategoryList();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听删除按钮
|
|
||||||
$('#deleteBtn').on('click', function () {
|
|
||||||
var id = $('#categoryId').val();
|
|
||||||
if (!id) return;
|
|
||||||
|
|
||||||
layer.confirm('确定要删除该分类吗?', function (index) {
|
|
||||||
$.post('/admin/article/catedel', { id: id }, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
that.initCategoryList();
|
|
||||||
$('#defaultTip').show();
|
|
||||||
$('.category-form').hide();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化页面
|
|
||||||
that.initCategoryList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
categoryManager.init();
|
|
||||||
|
|
||||||
// 新增分类
|
|
||||||
function add() {
|
|
||||||
categoryManager.showCategoryForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 刷新列表
|
|
||||||
function refresh() {
|
|
||||||
categoryManager.initCategoryList();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,298 +0,0 @@
|
|||||||
<?php /*a:2:{s:67:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\articlelist.php";i:1747642386;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-list"></i>
|
|
||||||
<span>文章列表</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div class="shaixuan">
|
|
||||||
<label>筛选:</label>
|
|
||||||
<div class="layui-form" style="display: flex; gap: 10px;">
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select id="categoryFilter" lay-filter="categoryFilter" lay-verify="">
|
|
||||||
<option value="">全部分类</option>
|
|
||||||
<?php if(is_array($categories) || $categories instanceof \think\Collection || $categories instanceof \think\Paginator): $i = 0; $__LIST__ = $categories;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$category): $mod = ($i % 2 );++$i;?>
|
|
||||||
<optgroup label="<?php echo htmlentities((string) $category['name']); ?>">
|
|
||||||
<?php if(is_array($category['children']) || $category['children'] instanceof \think\Collection || $category['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $category['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$subCategory): $mod = ($i % 2 );++$i;?>
|
|
||||||
<option value="<?php echo htmlentities((string) $subCategory['id']); ?>"><?php echo htmlentities((string) $subCategory['name']); ?></option>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</optgroup>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" id="titleSearch" placeholder="搜索标题" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" id="authorSearch" placeholder="搜索作者" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="doSearch()">
|
|
||||||
<i class="layui-icon layui-icon-search"></i>搜索
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="doRefresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>重置
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加文章
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table id="articleTable" lay-filter="articleTable"></table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/html" id="imageTemplate">
|
|
||||||
{{# if(d.image){ }}
|
|
||||||
<img src="{{ d.image }}" style="max-width: 50px; max-height: 50px;">
|
|
||||||
{{# } }}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="statusTemplate">
|
|
||||||
{{# if(d.status === 0){ }}
|
|
||||||
<span style="color:red;">草稿</span>
|
|
||||||
{{# } else if(d.status === 1){ }}
|
|
||||||
<span style="color:orange;">待审核</span>
|
|
||||||
{{# } else if(d.status === 2){ }}
|
|
||||||
<span style="color:green;">已发布</span>
|
|
||||||
{{# } else if(d.status === 3){ }}
|
|
||||||
<span style="color:gray;">隐藏</span>
|
|
||||||
{{# } }}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="operationBar">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'form', 'table'], function () {
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var form = layui.form;
|
|
||||||
var table = layui.table;
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#articleTable',
|
|
||||||
url: '/admin/article/articlelist',
|
|
||||||
method: 'post',
|
|
||||||
cols: [[
|
|
||||||
{ field: 'id', title: 'ID', align: 'center', width: 80 },
|
|
||||||
{ field: 'title', title: '标题' },
|
|
||||||
{ field: 'cate', title: '分类', align: 'center', width: 180 },
|
|
||||||
{ field: 'image', title: '封面', templet: '#imageTemplate', align: 'center', width: 180 },
|
|
||||||
{ field: 'author', title: '作者', align: 'center', width: 120 },
|
|
||||||
{ field: 'status', title: '状态', templet: '#statusTemplate', align: 'center', width: 80 },
|
|
||||||
{ field: 'publishdate', title: '发布时间', align: 'center', width: 180 },
|
|
||||||
{ title: '操作', toolbar: '#operationBar', align: 'center', width: 150 }
|
|
||||||
]],
|
|
||||||
page: true,
|
|
||||||
limit: 10,
|
|
||||||
limits: [10, 50, 100],
|
|
||||||
//height: 'full-220'
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听工具条事件
|
|
||||||
table.on('tool(articleTable)', function (obj) {
|
|
||||||
var data = obj.data;
|
|
||||||
if (obj.event === 'edit') {
|
|
||||||
edit(data.id);
|
|
||||||
} else if (obj.event === 'del') {
|
|
||||||
del(data.id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听分类筛选变化
|
|
||||||
form.on('select(categoryFilter)', function (data) {
|
|
||||||
filterByCategory(data.value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function filterByCategory(categoryId) {
|
|
||||||
reloadTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function doSearch() {
|
|
||||||
var titleKeyword = $('#titleSearch').val().trim();
|
|
||||||
var authorKeyword = $('#authorSearch').val().trim();
|
|
||||||
|
|
||||||
if (!titleKeyword && !authorKeyword && !$('#categoryFilter').val()) {
|
|
||||||
layer.msg('请输入搜索条件', { icon: 0 });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
reloadTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function doRefresh() {
|
|
||||||
// 清空搜索条件
|
|
||||||
$('#titleSearch').val('');
|
|
||||||
$('#authorSearch').val('');
|
|
||||||
$('#categoryFilter').val('');
|
|
||||||
layui.form.render('select'); // 重新渲染select
|
|
||||||
|
|
||||||
// 重新加载表格,不带任何筛选条件
|
|
||||||
layui.table.reload('articleTable', {
|
|
||||||
where: {},
|
|
||||||
page: {
|
|
||||||
curr: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
layer.msg('已重置', { icon: 1 });
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadTable() {
|
|
||||||
var categoryId = $('#categoryFilter').val();
|
|
||||||
var categoryName = categoryId ? $('#categoryFilter option[value="' + categoryId + '"]').text() : '';
|
|
||||||
var titleKeyword = $('#titleSearch').val().trim();
|
|
||||||
var authorKeyword = $('#authorSearch').val().trim();
|
|
||||||
|
|
||||||
layui.table.reload('articleTable', {
|
|
||||||
where: {
|
|
||||||
category: categoryName,
|
|
||||||
title: titleKeyword,
|
|
||||||
author: authorKeyword
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
curr: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function add() {
|
|
||||||
window.location.href = '/admin/article/add';
|
|
||||||
}
|
|
||||||
|
|
||||||
function edit(id) {
|
|
||||||
window.location.href = '/admin/article/edit?id=' + id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function del(id) {
|
|
||||||
layer.confirm('确定要删除该文章吗?', {
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.post('/admin/article/delete', { id: id }, function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
layui.table.reload('articleTable');
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
layui.table.reload('articleTable');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,619 +0,0 @@
|
|||||||
<?php /*a:2:{s:57:"E:\Demo\PHP\yunzer\app\admin\view\article\articlecate.php";i:1747402501;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-app"></i>
|
|
||||||
<span>文章分类管理</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加分类
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 主要内容区 -->
|
|
||||||
<div class="main-content">
|
|
||||||
<div class="layui-row layui-col-space20">
|
|
||||||
<!-- 左侧分类列表 -->
|
|
||||||
<div class="layui-col-md7">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span>分类列表</span>
|
|
||||||
<small class="text-muted">支持两级分类结构</small>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<div id="categoryList" class="category-tree"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 右侧分类信息 -->
|
|
||||||
<div class="layui-col-md5">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span>分类信息</span>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<!-- 默认提示 -->
|
|
||||||
<div id="defaultTip" class="empty-tip">
|
|
||||||
<i class="layui-icon layui-icon-face-surprised"></i>
|
|
||||||
<p>请选择左侧分类或点击新增按钮</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 分类表单 -->
|
|
||||||
<form class="layui-form category-form" lay-filter="categoryForm" style="display: none;">
|
|
||||||
<input type="hidden" name="id" id="categoryId">
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入分类名称"
|
|
||||||
autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">父级分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cid" lay-verify="required">
|
|
||||||
<option value="0">顶级分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">封面图片</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-upload-drag" id="uploadImage">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i>
|
|
||||||
<p>点击上传或拖拽图片至此处</p>
|
|
||||||
<div class="layui-hide" id="uploadPreview">
|
|
||||||
<hr>
|
|
||||||
<img src="" alt="封面图片" style="max-width: 100%">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="imageInput">
|
|
||||||
<div class="layui-form-mid layui-word-aux">建议尺寸:250px * 140px</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" name="sort" value="0" class="layui-input"
|
|
||||||
placeholder="数字越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="正常" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item form-actions">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="saveCategory">保存</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-danger" id="deleteBtn"
|
|
||||||
style="display: none;">删除</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
/* 页面整体样式 */
|
|
||||||
.config-container {
|
|
||||||
padding: 15px;
|
|
||||||
/* background: #f2f2f2; */
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-col-md7 .layui-btn-primary {
|
|
||||||
border-color: #d2d2d2;
|
|
||||||
background: 0 0;
|
|
||||||
color: #5f5f5f
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-col-md7 .layui-btn-primary:hover {
|
|
||||||
background-color: #1e9fff;
|
|
||||||
color: #efefef
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 页面头部样式 */
|
|
||||||
.page-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
padding: 10px 15px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 2px;
|
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-title {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-title .layui-icon {
|
|
||||||
margin-right: 8px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-actions .layui-btn {
|
|
||||||
margin-left: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 主要内容区样式 */
|
|
||||||
.main-content {
|
|
||||||
min-height: calc(100vh - 170px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-card {
|
|
||||||
margin-bottom: 0;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-card-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
height: auto;
|
|
||||||
padding: 12px 15px;
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-muted {
|
|
||||||
margin-left: 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: normal;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 分类树样式 */
|
|
||||||
.category-tree {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-item {
|
|
||||||
margin: 5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 10px 15px;
|
|
||||||
background-color: #f8f8f8;
|
|
||||||
border-radius: 2px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header:hover {
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header.active {
|
|
||||||
background-color: #e6f7ff;
|
|
||||||
border-right: 3px solid #1890ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-name {
|
|
||||||
flex: 1;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-actions {
|
|
||||||
/* opacity: 0; */
|
|
||||||
transition: opacity 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header:hover .category-actions {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-children {
|
|
||||||
margin-left: 20px;
|
|
||||||
padding-left: 15px;
|
|
||||||
border-left: 1px dashed #e6e6e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-child {
|
|
||||||
padding: 3px 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-child .layui-icon {
|
|
||||||
font-size: 12px;
|
|
||||||
margin-right: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 空状态提示 */
|
|
||||||
.empty-tip {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 40px 0;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-tip .layui-icon {
|
|
||||||
font-size: 32px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表单样式优化 */
|
|
||||||
.category-form {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-form-label {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-input-block {
|
|
||||||
margin-left: 130px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-actions {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag {
|
|
||||||
padding: 20px;
|
|
||||||
border: 1px dashed #e2e2e2;
|
|
||||||
background-color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag:hover {
|
|
||||||
border-color: #009688;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag img {
|
|
||||||
max-width: 100%;
|
|
||||||
margin: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-btn-xs {
|
|
||||||
height: 30px;
|
|
||||||
line-height: 25px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// 定义全局变量和函数
|
|
||||||
var categoryManager = {
|
|
||||||
init: function () {
|
|
||||||
this.initLayui();
|
|
||||||
},
|
|
||||||
|
|
||||||
initLayui: function () {
|
|
||||||
var that = this;
|
|
||||||
layui.use(['layer', 'form', 'upload'], function () {
|
|
||||||
var layer = layui.layer;
|
|
||||||
var form = layui.form;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
|
|
||||||
// 初始化分类列表
|
|
||||||
that.initCategoryList = function () {
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/article/articlecate',
|
|
||||||
type: 'POST',
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
var html = '';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
html += that.renderCategory(item);
|
|
||||||
});
|
|
||||||
$('#categoryList').html(html);
|
|
||||||
that.bindEvents();
|
|
||||||
} else {
|
|
||||||
layer.msg('获取分类数据失败', { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 渲染分类项
|
|
||||||
that.renderCategory = function (category, level = 0) {
|
|
||||||
var html = '<div class="category-item" data-id="' + category.id + '">';
|
|
||||||
html += '<div class="category-header">';
|
|
||||||
html += '<div class="category-name">' + category.title + '</div>';
|
|
||||||
if (level === 0) {
|
|
||||||
html += '<div class="category-actions">';
|
|
||||||
html += '<button type="button" class="layui-btn layui-btn-primary layui-btn-xs add-child">';
|
|
||||||
html += '<i class="layui-icon layui-icon-add-1"></i>添加子分类</button>';
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
|
|
||||||
if (category.children && category.children.length > 0) {
|
|
||||||
html += '<div class="category-children">';
|
|
||||||
category.children.forEach(function (child) {
|
|
||||||
html += that.renderCategory(child, level + 1);
|
|
||||||
});
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
return html;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 绑定事件
|
|
||||||
that.bindEvents = function () {
|
|
||||||
// 点击分类项加载编辑信息
|
|
||||||
$('.category-header').off('click').on('click', function (e) {
|
|
||||||
if (!$(e.target).closest('.add-child').length) {
|
|
||||||
var id = $(this).closest('.category-item').data('id');
|
|
||||||
that.loadCategoryInfo(id);
|
|
||||||
|
|
||||||
// 添加选中效果
|
|
||||||
$('.category-header').removeClass('active');
|
|
||||||
$(this).addClass('active');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加子分类
|
|
||||||
$('.add-child').off('click').on('click', function (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
var parentId = $(this).closest('.category-item').data('id');
|
|
||||||
that.showCategoryForm(parentId);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 加载分类信息
|
|
||||||
that.loadCategoryInfo = function (id) {
|
|
||||||
$.get('/admin/article/cateedit?id=' + id, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
that.showCategoryForm(0, res.data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 显示分类表单
|
|
||||||
that.showCategoryForm = function (parentId = 0, data = null) {
|
|
||||||
$('#defaultTip').hide();
|
|
||||||
$('.category-form').show();
|
|
||||||
|
|
||||||
// 重置表单
|
|
||||||
form.val('categoryForm', {
|
|
||||||
id: data ? data.info.id : '',
|
|
||||||
name: data ? data.info.name : '',
|
|
||||||
cid: data ? data.info.cid : parentId,
|
|
||||||
sort: data ? data.info.sort : 0,
|
|
||||||
status: data ? data.info.status : 1
|
|
||||||
});
|
|
||||||
|
|
||||||
// 更新父级分类选项
|
|
||||||
var $select = $('select[name="cid"]');
|
|
||||||
$select.empty().append('<option value="0">顶级分类</option>');
|
|
||||||
// 获取所有分类作为父级选项
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/article/articlecate',
|
|
||||||
type: 'POST',
|
|
||||||
async: false,
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
// 当前编辑的分类ID
|
|
||||||
var currentId = data ? data.info.id : 0;
|
|
||||||
// 递归构建分类选项
|
|
||||||
function buildOptions(categories, level) {
|
|
||||||
categories.forEach(function (category) {
|
|
||||||
// 不能选择自己或自己的子分类作为父级
|
|
||||||
if (category.id != currentId) {
|
|
||||||
var prefix = new Array(level + 1).join('├─ ');
|
|
||||||
$select.append('<option value="' + category.id + '">' + prefix + category.title + '</option>'); if (category.children && category.children.length > 0) { buildOptions(category.children, level + 1); }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} buildOptions(res.data, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 设置选中的父级分类
|
|
||||||
if (data && data.info.cid) {
|
|
||||||
$select.val(data.info.cid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新图片预览
|
|
||||||
if (data && data.info.image) {
|
|
||||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', data.info.image);
|
|
||||||
$('#imageInput').val(data.info.image);
|
|
||||||
} else {
|
|
||||||
$('#uploadPreview').addClass('layui-hide').find('img').attr('src', '');
|
|
||||||
$('#imageInput').val('');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示/隐藏删除按钮
|
|
||||||
$('#deleteBtn')[data ? 'show' : 'hide']();
|
|
||||||
|
|
||||||
form.render();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化上传组件
|
|
||||||
upload.render({
|
|
||||||
elem: '#uploadImage',
|
|
||||||
url: '/admin/upload/image',
|
|
||||||
accept: 'images',
|
|
||||||
acceptMime: 'image/*',
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', res.data.url);
|
|
||||||
$('#imageInput').val(res.data.url);
|
|
||||||
layer.msg('上传成功');
|
|
||||||
} else {
|
|
||||||
layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听表单提交
|
|
||||||
form.on('submit(saveCategory)', function (data) {
|
|
||||||
var url = data.field.id ? '/admin/article/cateedit' : '/admin/article/cateadd';
|
|
||||||
$.post(url, data.field, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
that.initCategoryList();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听删除按钮
|
|
||||||
$('#deleteBtn').on('click', function () {
|
|
||||||
var id = $('#categoryId').val();
|
|
||||||
if (!id) return;
|
|
||||||
|
|
||||||
layer.confirm('确定要删除该分类吗?', function (index) {
|
|
||||||
$.post('/admin/article/catedel', { id: id }, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
that.initCategoryList();
|
|
||||||
$('#defaultTip').show();
|
|
||||||
$('.category-form').hide();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化页面
|
|
||||||
that.initCategoryList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
categoryManager.init();
|
|
||||||
|
|
||||||
// 新增分类
|
|
||||||
function add() {
|
|
||||||
categoryManager.showCategoryForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 刷新列表
|
|
||||||
function refresh() {
|
|
||||||
categoryManager.initCategoryList();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
<?php /*a:3:{s:52:"E:\Demo\PHP\yunzer\app\admin\view\yunzer\menuadd.php";i:1745855804;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">菜单名</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="label" placeholder="请输入菜单名">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="icon_class" lay-verify="required" lay-search="">
|
|
||||||
<option value="">请输入layui图标</option>
|
|
||||||
<?php foreach($iconfont as $icon_v): ?>
|
|
||||||
<option value="<?php echo htmlentities((string) $icon_v['icon_css']); ?>"><?php echo htmlentities((string) $icon_v['icon_css']); ?> <?php echo htmlentities((string) $icon_v['icon_name']); ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">类型</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="type" lay-filter="type">
|
|
||||||
<option value='0' selected>顶级菜单</option>
|
|
||||||
<option value='1'>内部代码</option>
|
|
||||||
<option value='2'>超链接</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" style="display:none;" id="src1">
|
|
||||||
<label class="layui-form-label">内部代码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src1" placeholder="请输入:模块/方法">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" style="display:none;" id="src2">
|
|
||||||
<label class="layui-form-label">链接地址</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src2" placeholder="请输入http网址">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" class="layui-input" name="sort" placeholder="值越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
var form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
|
|
||||||
form.on('select(type)', function(data){
|
|
||||||
if(data.value == 1){
|
|
||||||
$("#src1").show();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else if(data.value == 2){
|
|
||||||
$("#src1").hide();
|
|
||||||
$("#src2").show();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else{
|
|
||||||
$("#src1").hide();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function save(){
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/menuadd',$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
<?php /*a:3:{s:69:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\groupinfo.php";i:1747385540;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-group"></i>
|
|
||||||
<span>角色列表</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button class="layui-btn layui-bg-blue" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table class="layui-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>角色名</th>
|
|
||||||
<th>状态</th>
|
|
||||||
<th>添加时间</th>
|
|
||||||
<th>操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php if(is_array($group) || $group instanceof \think\Collection || $group instanceof \think\Paginator): $i = 0; $__LIST__ = $group;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlentities((string) $vo['group_name']); ?></td>
|
|
||||||
<td><?php echo $vo['status']==1 ? '开启' : '<span style="color:red;">禁用</span>'; ?></td>
|
|
||||||
<td><?php echo date('Y-m-d H:i:s',$vo['create_time']); ?></td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs"
|
|
||||||
onclick="edit(<?php echo htmlentities((string) $vo['group_id']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs"
|
|
||||||
onclick="del(<?php echo htmlentities((string) $vo['group_id']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer'], function () {
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
// 添加
|
|
||||||
function add() {
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '添加角色',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['450px', '550px'],
|
|
||||||
content: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/groupadd"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 编辑
|
|
||||||
function edit(group_id) {
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '编辑角色',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['450px', '550px'],
|
|
||||||
content: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/groupedit?group_id=" + group_id
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 删除
|
|
||||||
function del(group_id) {
|
|
||||||
layer.confirm('确定要删除吗?', {
|
|
||||||
icon: 3,
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.post("<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/groupdel", { 'group_id': group_id }, function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.alert(res.msg, { icon: 2 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () { window.location.reload(); }, 1000);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//刷新列表
|
|
||||||
function refresh() {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
<?php /*a:3:{s:62:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\menuadd.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">菜单名</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="label" placeholder="请输入菜单名">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="icon_class" lay-verify="required" lay-search="">
|
|
||||||
<option value="">请输入layui图标</option>
|
|
||||||
<?php foreach($iconfont as $icon_v): ?>
|
|
||||||
<option value="<?php echo htmlentities((string) $icon_v['icon_css']); ?>"><?php echo htmlentities((string) $icon_v['icon_css']); ?> <?php echo htmlentities((string) $icon_v['icon_name']); ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">类型</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="type" lay-filter="type">
|
|
||||||
<option value='0' selected>顶级菜单</option>
|
|
||||||
<option value='1'>内部代码</option>
|
|
||||||
<option value='2'>超链接</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" style="display:none;" id="src1">
|
|
||||||
<label class="layui-form-label">内部代码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src1" placeholder="请输入:模块/方法">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" style="display:none;" id="src2">
|
|
||||||
<label class="layui-form-label">链接地址</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src2" placeholder="请输入http网址">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" class="layui-input" name="sort" placeholder="值越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
var form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
|
|
||||||
form.on('select(type)', function(data){
|
|
||||||
if(data.value == 1){
|
|
||||||
$("#src1").show();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else if(data.value == 2){
|
|
||||||
$("#src1").hide();
|
|
||||||
$("#src2").show();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else{
|
|
||||||
$("#src1").hide();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function save(){
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/menuadd',$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,248 +0,0 @@
|
|||||||
<?php /*a:2:{s:64:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\cateedit.php";i:1746861076;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div style="padding: 50px;padding-bottom: 0px;">
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<input type="hidden" name="id" value="<?php echo htmlentities((string) $info['id']); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类图片</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" id="upload-btn">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 图片上传
|
|
||||||
</button>
|
|
||||||
<div style="width: 120px;">
|
|
||||||
<div class="layui-upload-list">
|
|
||||||
<img class="layui-upload-img" id="upload-img"
|
|
||||||
style="width: 118px; height: 118px;object-fit: cover;" src="<?php echo htmlentities((string) $info['image']); ?>">
|
|
||||||
<div id="upload-text"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-demo">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="image" value="<?php echo htmlentities((string) $info['image']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" id="name" name="name" required lay-verify="required" placeholder="请输入分类名称"
|
|
||||||
value="<?php echo htmlentities((string) $info['name']); ?>" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">父级分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select id="cid" name="cid" lay-verify="required">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select id="status" name="status" lay-verify="required">
|
|
||||||
<option value="1">启用</option>
|
|
||||||
<option value="0">关闭</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" id="sort" name="sort" value="<?php echo htmlentities((string) $info['sort']); ?>" placeholder="请输入排序值"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">保存修改</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// 首先定义PHP变量,确保类型正确
|
|
||||||
var currentCid = parseInt('<?php echo htmlentities((string) (isset($info['cid']) && ($info['cid'] !== '')?$info['cid']:0)); ?>'); // 转换为数字
|
|
||||||
var currentId = parseInt('<?php echo htmlentities((string) (isset($info['id']) && ($info['id'] !== '')?$info['id']:0)); ?>'); // 转换为数字
|
|
||||||
|
|
||||||
layui.use(['form', 'layer', 'upload', 'element'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var element = layui.element;
|
|
||||||
|
|
||||||
// 获取URL中的id参数
|
|
||||||
var urlParams = new URLSearchParams(window.location.search);
|
|
||||||
var id = parseInt(urlParams.get('id')) || 0; // 转换为数字
|
|
||||||
|
|
||||||
// 图片上传
|
|
||||||
var uploadInst = upload.render({
|
|
||||||
elem: '#upload-btn',
|
|
||||||
url: '<?php echo url("index/upload_img"); ?>',
|
|
||||||
before: function (obj) {
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#upload-img').attr('src', result);
|
|
||||||
});
|
|
||||||
element.progress('filter-demo', '0%');
|
|
||||||
layer.msg('上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
$('#image').val(res.data);
|
|
||||||
$('#upload-text').html('');
|
|
||||||
layer.msg('上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () {
|
|
||||||
var demoText = $('#upload-text');
|
|
||||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
||||||
demoText.find('.demo-reload').on('click', function () {
|
|
||||||
uploadInst.upload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('filter-demo', n + '%');
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("article/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="0">顶级分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
// 确保item.id是数字类型
|
|
||||||
var itemId = parseInt(item.id);
|
|
||||||
if (itemId !== id) { // 使用严格比较
|
|
||||||
html += '<option value="' + itemId + '"' +
|
|
||||||
(itemId === currentCid ? ' selected' : '') +
|
|
||||||
'>' + item.name + '</option>';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('#cid').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
$.post('<?php echo url("article/cateedit"); ?>', data.field, function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
var index = parent.layer.getFrameIndex(window.name);
|
|
||||||
parent.layer.close(index);
|
|
||||||
parent.location.reload();
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
<?php /*a:1:{s:62:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\login\resetpwd.php";i:1746753630;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>重置密码</title>
|
|
||||||
<meta name="renderer" content="yz">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport"
|
|
||||||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/login.css">
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">
|
|
||||||
<div class="layadmin-user-login-main">
|
|
||||||
<div class="layadmin-user-login-box layadmin-user-login-header">
|
|
||||||
<h2>重置密码</h2>
|
|
||||||
</div>
|
|
||||||
<div class="layadmin-user-login-box layadmin-user-login-body layui-form">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layadmin-user-login-icon layui-icon layui-icon-username"
|
|
||||||
for="LAY-user-login-username"></label>
|
|
||||||
<input type="text" name="account" id="LAY-user-login-username" lay-verify="required"
|
|
||||||
placeholder="用户名" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<button class="layui-btn layui-btn-fluid" lay-submit
|
|
||||||
lay-filter="LAY-user-reset-submit">确认重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/layui/layui.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var $ = layui.$
|
|
||||||
, form = layui.form
|
|
||||||
, layer = layui.layer;
|
|
||||||
|
|
||||||
form.on('submit(LAY-user-reset-submit)', function (obj) {
|
|
||||||
var field = obj.field;
|
|
||||||
|
|
||||||
//请求重置密码
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/login/resetpwd'
|
|
||||||
, type: 'post'
|
|
||||||
, data: {
|
|
||||||
account: field.account
|
|
||||||
}
|
|
||||||
, success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg('密码重置成功', {
|
|
||||||
offset: '15px'
|
|
||||||
, icon: 1
|
|
||||||
, time: 1000
|
|
||||||
}, function () {
|
|
||||||
location.href = '/admin/login/index';
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, {
|
|
||||||
offset: '15px'
|
|
||||||
, icon: 2
|
|
||||||
, time: 1000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@@ -1,239 +0,0 @@
|
|||||||
<?php /*a:3:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\userinfo.php";i:1747385548;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-user"></i>
|
|
||||||
<span>用户列表</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button class="layui-btn layui-bg-blue" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table class="layui-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>真实姓名</th>
|
|
||||||
<th>账户</th>
|
|
||||||
<th>手机</th>
|
|
||||||
<th>QQ</th>
|
|
||||||
<th>角色</th>
|
|
||||||
<th>性别</th>
|
|
||||||
<th>状态</th>
|
|
||||||
<th>登陆次数</th>
|
|
||||||
<th>登陆时间</th>
|
|
||||||
<th>操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlentities((string) $vo['name']); ?></td>
|
|
||||||
<td><?php echo htmlentities((string) $vo['account']); ?></td>
|
|
||||||
<td><?php echo htmlentities((string) $vo['phone']); ?></td>
|
|
||||||
<td><?php echo htmlentities((string) $vo['qq']); ?></td>
|
|
||||||
<td><?php echo isset($group[$vo['group_id']])?$group[$vo['group_id']]['group_name']:''; ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if($vo['sex']==1): ?>
|
|
||||||
<span style="color:red;">男</span>
|
|
||||||
<?php elseif($vo['sex'] == 2): ?>
|
|
||||||
<span style="color:green;">女</span>
|
|
||||||
<?php else: ?>
|
|
||||||
未知
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo $vo['status']==1 ? '开启' : '<span style="color:red;">禁用</span>'; ?></td>
|
|
||||||
<td><?php echo htmlentities((string) $vo['login_count']); ?></td>
|
|
||||||
<td><?php echo date('Y-m-d H:i:s',$vo['update_time']); ?></td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit(<?php echo htmlentities((string) $vo['uid']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="del(<?php echo htmlentities((string) $vo['uid']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer'], function () {
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
// 添加
|
|
||||||
function add() {
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '添加管理员',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['450px', '550px'],
|
|
||||||
content: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/useradd"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 编辑
|
|
||||||
function edit(uid) {
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '编辑管理员',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['450px', '550px'],
|
|
||||||
content: "<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/useredit?uid=" + uid
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 删除
|
|
||||||
function del(uid) {
|
|
||||||
layer.confirm('确定要删除吗?', {
|
|
||||||
icon: 3,
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.post("<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/userdel", { 'uid': uid }, function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.alert(res.msg, { icon: 2 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg);
|
|
||||||
setTimeout(function () { window.location.reload(); }, 1000);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//刷新列表
|
|
||||||
function refresh() {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,277 +0,0 @@
|
|||||||
<?php /*a:3:{s:65:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\buttoninfo.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<div class="layui-row">
|
|
||||||
<div class="layui-col-md6">
|
|
||||||
<div class="layui-breadcrumb">
|
|
||||||
<a href="<?php echo htmlentities((string) $config['admin_route']); ?>Yunzer/menuInfo"><i class="layui-icon layui-icon-menu-fill"></i> 上级菜单</a>
|
|
||||||
<a><cite>本级菜单</cite></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-col-md6" style="text-align: right;">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" onclick="add(<?php echo htmlentities((string) $smid); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i> 添加按钮
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<div class="layui-row layui-col-space15">
|
|
||||||
<div class="layui-col-md3">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header"><i class="layui-icon layui-icon-tree"></i> 菜单结构</div>
|
|
||||||
<div class="layui-card-body" id="menuTree">
|
|
||||||
<!-- 树形结构将在这里渲染 -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-col-md9">
|
|
||||||
<table class="layui-table" lay-skin="line">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>排序</th>
|
|
||||||
<th>类型</th>
|
|
||||||
<th>按钮名</th>
|
|
||||||
<th>图标</th>
|
|
||||||
<th>状态</th>
|
|
||||||
<th>操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<tr>
|
|
||||||
<td><span class="layui-badge layui-bg-gray"><?php echo htmlentities((string) $vo['sort']); ?></span></td>
|
|
||||||
<td>
|
|
||||||
<?php if(($vo['type']==1)): ?>
|
|
||||||
<span class="layui-badge layui-bg-blue">功能模块</span> <?php echo htmlentities((string) $vo['src']); elseif(($vo['type']==2)): ?>
|
|
||||||
<span class="layui-badge layui-bg-green">超链接</span> <?php echo htmlentities((string) $vo['src']); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><b><?php echo htmlentities((string) $vo['label']); ?></b></td>
|
|
||||||
<td><i class="layui-icon <?php echo htmlentities((string) $vo['icon_class']); ?>"></i> <?php echo htmlentities((string) $vo['icon_class']); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if(($vo['status']==1)): ?>
|
|
||||||
<span class="layui-badge layui-bg-green">开启</span>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="layui-badge layui-bg-red">禁用</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="layui-btn-group">
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs" onclick="edit(<?php echo htmlentities((string) $vo['smid']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i> 编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" onclick="del(<?php echo htmlentities((string) $vo['smid']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i> 删除
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'tree'], function(){
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
var tree = layui.tree;
|
|
||||||
|
|
||||||
// 构建树形结构数据
|
|
||||||
var treeData = [{
|
|
||||||
title: '当前菜单',
|
|
||||||
id: <?php echo htmlentities((string) $smid); ?>,
|
|
||||||
spread: true,
|
|
||||||
children: []
|
|
||||||
}];
|
|
||||||
|
|
||||||
// 将按钮数据添加到树中
|
|
||||||
<?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
treeData[0].children.push({
|
|
||||||
title: '<?php echo htmlentities((string) $vo['label']); ?>',
|
|
||||||
id: <?php echo htmlentities((string) $vo['smid']); ?>,
|
|
||||||
icon: 'layui-icon <?php echo htmlentities((string) $vo['icon_class']); ?>'
|
|
||||||
});
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
|
|
||||||
// 渲染树形结构
|
|
||||||
tree.render({
|
|
||||||
elem: '#menuTree',
|
|
||||||
data: treeData,
|
|
||||||
showLine: true,
|
|
||||||
click: function(obj){
|
|
||||||
var data = obj.data;
|
|
||||||
if(data.id != <?php echo htmlentities((string) $smid); ?>) {
|
|
||||||
edit(data.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加
|
|
||||||
function add(smid){
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '添加按钮',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['550px','550px'],
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/buttonadd?smid='+smid
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 编辑
|
|
||||||
function edit(smid){
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '编辑按钮',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['550px','550px'],
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/buttonedit?smid='+smid
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除
|
|
||||||
function del(smid){
|
|
||||||
layer.confirm('确定要删除吗?', {
|
|
||||||
icon: 3,
|
|
||||||
btn: ['确定','取消']
|
|
||||||
}, function(){
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/buttondel',{'smid':smid},function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.alert(res.msg,{icon:2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{icon:1});
|
|
||||||
setTimeout(function(){window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,211 +0,0 @@
|
|||||||
<?php /*a:2:{s:57:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\log\login.php";i:1747639417;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span class="layui-badge layui-bg-blue">登录日志</span>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<form class="layui-form layui-form-pane" action="">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">用户名</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">IP地址</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" name="ip" placeholder="请输入IP地址" autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="status">
|
|
||||||
<option value="">全部</option>
|
|
||||||
<option value="1">成功</option>
|
|
||||||
<option value="0">失败</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">时间范围</label>
|
|
||||||
<div class="layui-input-inline" style="width: 300px;">
|
|
||||||
<input type="text" name="time_range" class="layui-input" id="timeRange" placeholder="请选择时间范围">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-inline">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="searchForm">
|
|
||||||
<i class="layui-icon layui-icon-search"></i> 搜索
|
|
||||||
</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<table id="loginLogTable" lay-filter="loginLogTable"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/layui/layui.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.use(['table', 'form', 'laydate'], function(){
|
|
||||||
var table = layui.table;
|
|
||||||
var form = layui.form;
|
|
||||||
var laydate = layui.laydate;
|
|
||||||
|
|
||||||
// 初始化时间范围选择器
|
|
||||||
laydate.render({
|
|
||||||
elem: '#timeRange',
|
|
||||||
type: 'datetime',
|
|
||||||
range: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#loginLogTable',
|
|
||||||
url: '<?php echo url("log/login"); ?>',
|
|
||||||
method: 'post',
|
|
||||||
defaultToolbar: ['filter', 'exports', 'print'],
|
|
||||||
parseData: function(res) {
|
|
||||||
return {
|
|
||||||
"code": res.code === 0 ? 0 : 1,
|
|
||||||
"msg": res.msg,
|
|
||||||
"count": res.count,
|
|
||||||
"data": res.data
|
|
||||||
};
|
|
||||||
},
|
|
||||||
cols: [[
|
|
||||||
{field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
|
|
||||||
{field: 'username', title: '用户名', align: 'center'},
|
|
||||||
{field: 'ip_address', title: 'IP地址', width: 130, align: 'center'},
|
|
||||||
{field: 'location', title: '登录地点', width: 120, align: 'center'},
|
|
||||||
{field: 'device_type', title: '设备类型', width: 100, align: 'center'},
|
|
||||||
{field: 'user_agent', title: '浏览器', width: 200, align: 'center'},
|
|
||||||
{field: 'login_status', title: '状态', width: 100, align: 'center', templet: function(d){
|
|
||||||
return d.login_status == 1 ?
|
|
||||||
'<span class="layui-badge layui-bg-green">成功</span>' :
|
|
||||||
'<span class="layui-badge layui-bg-red">失败</span>';
|
|
||||||
}},
|
|
||||||
{field: 'failure_reason', title: '失败原因', width: 150, align: 'center'},
|
|
||||||
{field: 'login_time', title: '登录时间', width: 180, sort: true, align: 'center'}
|
|
||||||
]],
|
|
||||||
page: true,
|
|
||||||
limit: 10,
|
|
||||||
limits: [10, 20, 50, 100]
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听搜索表单提交
|
|
||||||
form.on('submit(searchForm)', function(data){
|
|
||||||
var timeRange = data.field.time_range;
|
|
||||||
if(timeRange){
|
|
||||||
var times = timeRange.split(' - ');
|
|
||||||
data.field.start_time = times[0];
|
|
||||||
data.field.end_time = times[1];
|
|
||||||
}
|
|
||||||
delete data.field.time_range;
|
|
||||||
|
|
||||||
table.reload('loginLogTable', {
|
|
||||||
where: data.field,
|
|
||||||
page: {curr: 1}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php /*a:1:{s:49:"E:\Demo\PHP\yunzer\app\admin\view\index\index.php";i:1747582419;}*/ ?>
|
<?php /*a:1:{s:49:"E:\Demo\PHP\yunzer\app\admin\view\index\index.php";i:1747649140;}*/ ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
@@ -100,10 +100,10 @@
|
|||||||
<!-- 侧边菜单 -->
|
<!-- 侧边菜单 -->
|
||||||
<div class="layui-side layui-side-menu">
|
<div class="layui-side layui-side-menu">
|
||||||
<div class="layui-side-scroll">
|
<div class="layui-side-scroll">
|
||||||
<div class="layui-logo" lay-href="" style="display: flex;align-items: center;">
|
<!-- <div class="layui-logo" lay-href="" style="display: flex;align-items: center;">
|
||||||
<img src="/static/images/logo-l-w.png" alt="<?php echo htmlentities((string) $config['admin_name']); ?>"
|
<img src="/static/images/logo-l-w.png" alt="<?php echo htmlentities((string) $config['admin_name']); ?>"
|
||||||
style="max-width: 100%; max-height: 100%;">
|
style="max-width: 100%; max-height: 100%;">
|
||||||
</div>
|
</div> -->
|
||||||
<ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
|
<ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
|
||||||
lay-filter="layadmin-system-side-menu">
|
lay-filter="layadmin-system-side-menu">
|
||||||
<!-- 固定的工作台菜单项 -->
|
<!-- 固定的工作台菜单项 -->
|
||||||
|
|||||||
@@ -1,232 +0,0 @@
|
|||||||
<?php /*a:3:{s:69:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\admininfo.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form" style="padding:0 20%;">
|
|
||||||
<div class="layui-tab">
|
|
||||||
<ul class="layui-tab-title">
|
|
||||||
<li class="layui-this">个人信息</li>
|
|
||||||
<li>密码信息</li>
|
|
||||||
<li>其它信息</li>
|
|
||||||
</ul>
|
|
||||||
<div class="layui-tab-content">
|
|
||||||
<div class="layui-tab-item layui-show">
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">账户</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-form-label" style="color:#3881fd;text-align:left;width:100%;"><?php echo htmlentities((string) $aUser['account']); ?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">说明</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-form-label" style="width:100%;text-align:left;color:#999;">账户用于登录系统的账号,不能修改</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">姓名</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="name" placeholder="请输入真实姓名" value="<?php echo htmlentities((string) $aUser['name']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">手机号</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="phone" placeholder="请输入手机号" value="<?php echo htmlentities((string) $aUser['phone']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">QQ号</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="qq" placeholder="请输入QQ号" value="<?php echo htmlentities((string) $aUser['qq']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">性别</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="sex" value="1" title="男" <?php echo $aUser['status']==1 ? 'checked' : ''; ?>>
|
|
||||||
<input type="radio" name="sex" value="2" title="女" <?php echo $aUser['status']==2 ? 'checked' : ''; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-tab-item">
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">老密码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="old_pw" placeholder="请输入老密码,不修改不填写">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">新密码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="new_pw" placeholder="请输入新密码,不修改不填写">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-tab-item">
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">登陆次数</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-form-label" style="text-align:left;width:100%;"><?php echo htmlentities((string) $aUser['login_count']); ?>次</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">注册时间</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-form-label" style="text-align:left;width:100%;"><?php echo date('Y-m-d H:i:s',$aUser['create_time']); ?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="padding:15px;">
|
|
||||||
<label class="layui-form-label">登陆时间</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-form-label" style="text-align:left;width:100%;"><?php echo date('Y-m-d H:i:s',$aUser['update_time']); ?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block" style="text-align:center;">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','element'],function(){
|
|
||||||
var form = layui.form;
|
|
||||||
element = layui.element;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
function save(){
|
|
||||||
$.post("<?php echo htmlentities((string) $config['admin_route']); ?>yunzeradmin/admininfo",$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,363 +0,0 @@
|
|||||||
<?php /*a:2:{s:60:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\articles\add.php";i:1747641342;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header" style="display:flex;justify-content: space-between;">
|
|
||||||
<div>
|
|
||||||
<span>添加文章</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="goBack()">
|
|
||||||
<i class="layui-icon layui-icon-return"></i>返回
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">标题</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入文章标题" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cate" lay-verify="required">
|
|
||||||
<option value="">请选择分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">描述</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<textarea name="desc" placeholder="请输入描述内容" class="layui-textarea"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">作者</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="author" required lay-verify="required" placeholder="请输入作者" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">封面</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" id="upload-btn">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 图片上传
|
|
||||||
</button>
|
|
||||||
<div style="width: 120px;">
|
|
||||||
<div class="layui-upload-list">
|
|
||||||
<img class="layui-upload-img" id="upload-img"
|
|
||||||
style="width: 118px; height: 118px;object-fit: cover;">
|
|
||||||
<div id="upload-text"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-demo">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="image" value="">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
|
||||||
<label class="layui-form-label">内容</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div id="editor—wrapper" id="content" name="content" style="border: 1px solid #ccc;">
|
|
||||||
<div id="toolbar-container" style="border-bottom: 1px solid #ccc;"><!-- 工具栏 --></div>
|
|
||||||
<div id="editor-container" style="height: 800px;"><!-- 编辑器 --></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
|
||||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="formDraft">存草稿</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/js/wangeditor.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var element = layui.element;
|
|
||||||
|
|
||||||
// 图片上传
|
|
||||||
var uploadInst = upload.render({
|
|
||||||
elem: '#upload-btn',
|
|
||||||
url: '<?php echo url("index/upload_img"); ?>', // 上传图片接口
|
|
||||||
before: function (obj) {
|
|
||||||
// 预读本地文件示例,不支持ie8
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#upload-img').attr('src', result); // 图片链接(base64)
|
|
||||||
});
|
|
||||||
element.progress('filter-demo', '0%'); // 进度条复位
|
|
||||||
layer.msg('上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
// 若上传失败
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
// 上传成功
|
|
||||||
$('#image').val(res.data); // 设置图片路径到隐藏输入框
|
|
||||||
$('#upload-text').html(''); // 置空上传失败的状态
|
|
||||||
layer.msg('上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () { // 这里改为 uploadError
|
|
||||||
// 演示失败状态,并实现重传
|
|
||||||
var demoText = $('#upload-text');
|
|
||||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
||||||
demoText.find('.demo-reload').on('click', function () {
|
|
||||||
uploadInst.upload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 进度条
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('filter-demo', n + '%'); // 可配合 layui 进度条元素使用
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("articles/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="">请选择分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
// 如果cid为0,则设置为禁用
|
|
||||||
var disabled = item.cid == 0 ? 'disabled' : '';
|
|
||||||
html += '<option value="' + item.id + '" ' + disabled + '>' + item.name + '</option>';
|
|
||||||
// 如果有子分类,添加子分类选项
|
|
||||||
if (item.children && item.children.length > 0) {
|
|
||||||
item.children.forEach(function (child) {
|
|
||||||
html += '<option value="' + child.id + '">├─ ' + child.name + '</option>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('select[name="cate"]').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
// 获取编辑器内容
|
|
||||||
var content = editor.getHtml();
|
|
||||||
if (!content || content === '<p><br></p>') {
|
|
||||||
layer.msg('请输入文章内容', { icon: 2 });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var loadIndex = layer.load(2);
|
|
||||||
data.field.content = content;
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo url("articles/add"); ?>',
|
|
||||||
type: 'POST',
|
|
||||||
data: data.field,
|
|
||||||
success: function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
window.location.href = '<?php echo url("articles/articlelist"); ?>';
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- wangeditor编辑器脚本 -->
|
|
||||||
<script>
|
|
||||||
const { createEditor, createToolbar } = window.wangEditor
|
|
||||||
|
|
||||||
const editorConfig = {
|
|
||||||
MENU_CONF: {},
|
|
||||||
placeholder: '请输入内容...',
|
|
||||||
onChange(editor) {
|
|
||||||
const html = editor.getHtml()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// 配置图片上传
|
|
||||||
editorConfig.MENU_CONF['uploadImage'] = {
|
|
||||||
server: '<?php echo url("index/upload_img"); ?>',
|
|
||||||
fieldName: 'file',
|
|
||||||
maxFileSize: 10 * 1024 * 1024, // 10M
|
|
||||||
maxNumberOfFiles: 10,
|
|
||||||
allowedFileTypes: ['image/*'],
|
|
||||||
meta: {
|
|
||||||
token: 'xxx'
|
|
||||||
},
|
|
||||||
metaWithUrl: true,
|
|
||||||
headers: {
|
|
||||||
Accept: 'text/x-json'
|
|
||||||
},
|
|
||||||
timeout: 5 * 1000, // 5s
|
|
||||||
|
|
||||||
onBeforeUpload(file) {
|
|
||||||
console.log('准备上传图片', file)
|
|
||||||
return file
|
|
||||||
},
|
|
||||||
onProgress(progress) {
|
|
||||||
console.log('上传进度', progress)
|
|
||||||
},
|
|
||||||
onSuccess(file, res) {
|
|
||||||
console.log('上传成功', file, res)
|
|
||||||
},
|
|
||||||
onFailed(file, res) {
|
|
||||||
layer.msg('上传失败:' + res.msg, { icon: 2 })
|
|
||||||
console.log('上传失败', file, res)
|
|
||||||
},
|
|
||||||
onError(file, err, res) {
|
|
||||||
layer.msg('上传出错:' + err.message, { icon: 2 })
|
|
||||||
console.error('上传出错', file, err, res)
|
|
||||||
},
|
|
||||||
customInsert(res, insertFn) {
|
|
||||||
// res 即服务端的返回结果
|
|
||||||
if (res.code === 0 && res.data) {
|
|
||||||
// 直接使用res.data作为图片地址
|
|
||||||
insertFn(res.data);
|
|
||||||
} else {
|
|
||||||
layer.msg('图片上传失败', { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const editor = createEditor({
|
|
||||||
selector: '#editor-container',
|
|
||||||
html: '<p><br></p>',
|
|
||||||
config: editorConfig,
|
|
||||||
mode: 'default', // or 'simple'
|
|
||||||
})
|
|
||||||
|
|
||||||
const toolbarConfig = {}
|
|
||||||
|
|
||||||
const toolbar = createToolbar({
|
|
||||||
editor,
|
|
||||||
selector: '#toolbar-container',
|
|
||||||
config: toolbarConfig,
|
|
||||||
mode: 'default', // or 'simple'
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
//返回文章列表
|
|
||||||
function goBack() {
|
|
||||||
window.location.href = '<?php echo url("articles/articlelist"); ?>';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,298 +0,0 @@
|
|||||||
<?php /*a:2:{s:53:"E:\Demo\PHP\yunzer\app\admin\view\resources\lists.php";i:1747407920;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-file"></i>
|
|
||||||
<span>资源列表</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div class="shaixuan">
|
|
||||||
<label>筛选:</label>
|
|
||||||
<div class="layui-form" style="display: flex; gap: 10px;">
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select id="categoryFilter" lay-filter="categoryFilter" lay-verify="">
|
|
||||||
<option value="">全部分类</option>
|
|
||||||
<?php if(is_array($categories) || $categories instanceof \think\Collection || $categories instanceof \think\Paginator): $i = 0; $__LIST__ = $categories;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$category): $mod = ($i % 2 );++$i;?>
|
|
||||||
<optgroup label="<?php echo htmlentities((string) $category['name']); ?>">
|
|
||||||
<?php if(is_array($category['children']) || $category['children'] instanceof \think\Collection || $category['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $category['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$subCategory): $mod = ($i % 2 );++$i;?>
|
|
||||||
<option value="<?php echo htmlentities((string) $subCategory['id']); ?>"><?php echo htmlentities((string) $subCategory['name']); ?></option>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</optgroup>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" id="nameSearch" placeholder="搜索资源名称" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input type="text" id="uploaderSearch" placeholder="搜索上传者" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="doSearch()">
|
|
||||||
<i class="layui-icon layui-icon-search"></i>搜索
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="doRefresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>重置
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加资源
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table id="resourceTable" lay-filter="resourceTable"></table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/html" id="iconTemplate">
|
|
||||||
{{# if(d.icon){ }}
|
|
||||||
<img src="{{ d.icon }}" style="max-width: 50px; max-height: 50px;">
|
|
||||||
{{# } }}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="statusTemplate">
|
|
||||||
{{# if(d.status === 0){ }}
|
|
||||||
<span style="color:red;">未审核</span>
|
|
||||||
{{# } else if(d.status === 1){ }}
|
|
||||||
<span style="color:orange;">待审核</span>
|
|
||||||
{{# } else if(d.status === 2){ }}
|
|
||||||
<span style="color:green;">已发布</span>
|
|
||||||
{{# } else if(d.status === 3){ }}
|
|
||||||
<span style="color:gray;">已下架</span>
|
|
||||||
{{# } }}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/html" id="operationBar">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'form', 'table'], function () {
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var form = layui.form;
|
|
||||||
var table = layui.table;
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#resourceTable',
|
|
||||||
url: '/admin/resources/lists',
|
|
||||||
method: 'post',
|
|
||||||
cols: [[
|
|
||||||
{ field: 'id', title: 'ID', align: 'center', width: 80 },
|
|
||||||
{ field: 'title', title: '资源名称' },
|
|
||||||
{ field: 'cate', title: '分类', align: 'center', width: 120 },
|
|
||||||
{ field: 'icon', title: '图标', templet: '#iconTemplate', align: 'center', width: 100 },
|
|
||||||
{ field: 'uploader', title: '上传者', align: 'center', width: 100 },
|
|
||||||
{ field: 'desc', title: '描述', width: 200 },
|
|
||||||
{ field: 'status', title: '状态', templet: '#statusTemplate', align: 'center', width: 80 },
|
|
||||||
{ title: '操作', toolbar: '#operationBar', align: 'center', width: 150, fixed: 'right' }
|
|
||||||
]],
|
|
||||||
page: true,
|
|
||||||
limit: 10,
|
|
||||||
limits: [10, 50, 100],
|
|
||||||
//height: 'full-220'
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听工具条事件
|
|
||||||
table.on('tool(resourceTable)', function (obj) {
|
|
||||||
var data = obj.data;
|
|
||||||
if (obj.event === 'edit') {
|
|
||||||
edit(data.id);
|
|
||||||
} else if (obj.event === 'del') {
|
|
||||||
del(data.id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听分类筛选变化
|
|
||||||
form.on('select(categoryFilter)', function (data) {
|
|
||||||
filterByCategory(data.value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function filterByCategory(categoryId) {
|
|
||||||
reloadTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function doSearch() {
|
|
||||||
var nameKeyword = $('#nameSearch').val().trim();
|
|
||||||
var uploaderKeyword = $('#uploaderSearch').val().trim();
|
|
||||||
|
|
||||||
if (!nameKeyword && !uploaderKeyword && !$('#categoryFilter').val()) {
|
|
||||||
layer.msg('请输入搜索条件', { icon: 0 });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
reloadTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
function doRefresh() {
|
|
||||||
// 清空搜索条件
|
|
||||||
$('#nameSearch').val('');
|
|
||||||
$('#uploaderSearch').val('');
|
|
||||||
$('#categoryFilter').val('');
|
|
||||||
layui.form.render('select'); // 重新渲染select
|
|
||||||
|
|
||||||
// 重新加载表格,不带任何筛选条件
|
|
||||||
layui.table.reload('resourceTable', {
|
|
||||||
where: {},
|
|
||||||
page: {
|
|
||||||
curr: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
layer.msg('已重置', { icon: 1 });
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadTable() {
|
|
||||||
var categoryId = $('#categoryFilter').val();
|
|
||||||
var categoryName = categoryId ? $('#categoryFilter option[value="' + categoryId + '"]').text() : '';
|
|
||||||
var nameKeyword = $('#nameSearch').val().trim();
|
|
||||||
var uploaderKeyword = $('#uploaderSearch').val().trim();
|
|
||||||
|
|
||||||
layui.table.reload('resourceTable', {
|
|
||||||
where: {
|
|
||||||
category: categoryName,
|
|
||||||
name: nameKeyword,
|
|
||||||
uploader: uploaderKeyword
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
curr: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function add() {
|
|
||||||
window.location.href = '/admin/resources/add';
|
|
||||||
}
|
|
||||||
|
|
||||||
function edit(id) {
|
|
||||||
window.location.href = '/admin/resources/edit?id=' + id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function del(id) {
|
|
||||||
layer.confirm('确定要删除该资源吗?', {
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.post('/admin/resources/delete', { id: id }, function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
layui.table.reload('resourceTable');
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function refresh() {
|
|
||||||
layui.table.reload('resourceTable');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,221 +0,0 @@
|
|||||||
<?php /*a:3:{s:65:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\buttonedit.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<input type="hidden" name="smid" value="<?php echo htmlentities((string) $lists['smid']); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">按钮名</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="label" placeholder="请输入按钮名" value="<?php echo htmlentities((string) $lists['label']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="icon_class" lay-verify="required" lay-search="">
|
|
||||||
<option value="">请输入layui图标</option>
|
|
||||||
<?php foreach($iconfont as $icon_v): ?>
|
|
||||||
<option value="<?php echo htmlentities((string) $icon_v['icon_css']); ?>" <?php if(($icon_v['icon_css'] == $lists['icon_class'])): ?>selected<?php endif; ?>><?php echo htmlentities((string) $icon_v['icon_css']); ?> <?php echo htmlentities((string) $icon_v['icon_name']); ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">类型</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="type" lay-filter="type">
|
|
||||||
<option value='1' <?php echo $lists['type']==1 ? 'selected' : ''; ?>>内部代码</option>
|
|
||||||
<option value='2' <?php echo $lists['type']==2 ? 'selected' : ''; ?>>超链接</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" <?php echo $lists['type']==1 ? 'style="display : none;"':''; ?> id="src1">
|
|
||||||
<label class="layui-form-label">内部代码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src1" placeholder="请输入:/项目/模块/方法" <?php if($lists['type']==1): ?>value="<?php echo htmlentities((string) $lists['src']); ?>"<?php endif; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" <?php echo $lists['type']==2 ? 'style="display : none;"':''; ?> id="src2">
|
|
||||||
<label class="layui-form-label">链接地址</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src2" placeholder="请输入http网址" <?php if($lists['type']==2): ?>value="<?php echo htmlentities((string) $lists['src']); ?>"<?php endif; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" class="layui-input" name="sort" placeholder="值越大越靠前" value="<?php echo htmlentities((string) $lists['sort']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" <?php echo $lists['status']==1 ? 'checked' : ''; ?>>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用" <?php echo $lists['status']==0 ? 'checked' : ''; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
|
|
||||||
type(<?php echo htmlentities((string) $lists['type']); ?>);
|
|
||||||
form.on('select(type)', function(data){
|
|
||||||
type(data.value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
function type(value){
|
|
||||||
if(value == 1){
|
|
||||||
$("#src1").show();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else if(value == 2){
|
|
||||||
$("#src1").hide();
|
|
||||||
$("#src2").show();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else{
|
|
||||||
$("#src1").show();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function save(){
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/buttonedit',$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,368 +0,0 @@
|
|||||||
<?php /*a:2:{s:49:"E:\Demo\PHP\yunzer\app\admin\view\article\add.php";i:1746804004;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header" style="display:flex;justify-content: space-between;">
|
|
||||||
<div>
|
|
||||||
<span>添加文章</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="goBack()">
|
|
||||||
<i class="layui-icon layui-icon-return"></i>返回
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">标题</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入文章标题" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cate" lay-verify="required">
|
|
||||||
<option value="">请选择分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">描述</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<textarea name="desc" placeholder="请输入描述内容" class="layui-textarea"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">作者</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="author" required lay-verify="required" placeholder="请输入作者" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">封面</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" id="upload-btn">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 图片上传
|
|
||||||
</button>
|
|
||||||
<div style="width: 120px;">
|
|
||||||
<div class="layui-upload-list">
|
|
||||||
<img class="layui-upload-img" id="upload-img"
|
|
||||||
style="width: 118px; height: 118px;object-fit: cover;">
|
|
||||||
<div id="upload-text"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-demo">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="image" value="">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
|
||||||
<label class="layui-form-label">内容</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div id="editor—wrapper" id="content" name="content" style="border: 1px solid #ccc;">
|
|
||||||
<div id="toolbar-container" style="border-bottom: 1px solid #ccc;"><!-- 工具栏 --></div>
|
|
||||||
<div id="editor-container" style="height: 800px;"><!-- 编辑器 --></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
|
||||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="formDraft">存草稿</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/js/wangeditor.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var element = layui.element;
|
|
||||||
|
|
||||||
// 图片上传
|
|
||||||
var uploadInst = upload.render({
|
|
||||||
elem: '#upload-btn',
|
|
||||||
url: '<?php echo url("index/upload_img"); ?>', // 上传图片接口
|
|
||||||
before: function (obj) {
|
|
||||||
// 预读本地文件示例,不支持ie8
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#upload-img').attr('src', result); // 图片链接(base64)
|
|
||||||
});
|
|
||||||
element.progress('filter-demo', '0%'); // 进度条复位
|
|
||||||
layer.msg('上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
// 若上传失败
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
// 上传成功
|
|
||||||
$('#image').val(res.data); // 设置图片路径到隐藏输入框
|
|
||||||
$('#upload-text').html(''); // 置空上传失败的状态
|
|
||||||
layer.msg('上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () { // 这里改为 uploadError
|
|
||||||
// 演示失败状态,并实现重传
|
|
||||||
var demoText = $('#upload-text');
|
|
||||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
||||||
demoText.find('.demo-reload').on('click', function () {
|
|
||||||
uploadInst.upload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 进度条
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('filter-demo', n + '%'); // 可配合 layui 进度条元素使用
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("article/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="">请选择分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
// 如果cid为0,则设置为禁用
|
|
||||||
var disabled = item.cid == 0 ? 'disabled' : '';
|
|
||||||
html += '<option value="' + item.id + '" ' + disabled + '>' + item.name + '</option>';
|
|
||||||
// 如果有子分类,添加子分类选项
|
|
||||||
if (item.children && item.children.length > 0) {
|
|
||||||
item.children.forEach(function (child) {
|
|
||||||
html += '<option value="' + child.id + '">├─ ' + child.name + '</option>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('select[name="cate"]').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
// 获取编辑器内容
|
|
||||||
var content = editor.getHtml();
|
|
||||||
if (!content || content === '<p><br></p>') {
|
|
||||||
layer.msg('请输入文章内容', { icon: 2 });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var loadIndex = layer.load(2);
|
|
||||||
data.field.content = content;
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo url("article/add"); ?>',
|
|
||||||
type: 'POST',
|
|
||||||
data: data.field,
|
|
||||||
success: function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
window.location.href = '<?php echo url("article/articlelist"); ?>';
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- wangeditor编辑器脚本 -->
|
|
||||||
<script>
|
|
||||||
const { createEditor, createToolbar } = window.wangEditor
|
|
||||||
|
|
||||||
const editorConfig = {
|
|
||||||
MENU_CONF: {},
|
|
||||||
placeholder: '请输入内容...',
|
|
||||||
onChange(editor) {
|
|
||||||
const html = editor.getHtml()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// 配置图片上传
|
|
||||||
editorConfig.MENU_CONF['uploadImage'] = {
|
|
||||||
server: '<?php echo url("index/upload_imgs"); ?>',
|
|
||||||
fieldName: 'file',
|
|
||||||
maxFileSize: 10 * 1024 * 1024, // 10M
|
|
||||||
maxNumberOfFiles: 10,
|
|
||||||
allowedFileTypes: ['image/*'],
|
|
||||||
meta: {
|
|
||||||
token: 'xxx'
|
|
||||||
},
|
|
||||||
metaWithUrl: true,
|
|
||||||
headers: {
|
|
||||||
Accept: 'text/x-json'
|
|
||||||
},
|
|
||||||
timeout: 5 * 1000, // 5s
|
|
||||||
|
|
||||||
onBeforeUpload(file) {
|
|
||||||
console.log('准备上传图片', file)
|
|
||||||
return file
|
|
||||||
},
|
|
||||||
onProgress(progress) {
|
|
||||||
console.log('上传进度', progress)
|
|
||||||
},
|
|
||||||
onSuccess(file, res) {
|
|
||||||
console.log('上传成功', file, res)
|
|
||||||
},
|
|
||||||
onFailed(file, res) {
|
|
||||||
layer.msg('上传失败:' + res.msg, { icon: 2 })
|
|
||||||
console.log('上传失败', file, res)
|
|
||||||
},
|
|
||||||
onError(file, err, res) {
|
|
||||||
layer.msg('上传出错:' + err.message, { icon: 2 })
|
|
||||||
console.error('上传出错', file, err, res)
|
|
||||||
},
|
|
||||||
customInsert(res, insertFn) {
|
|
||||||
// res 即服务端的返回结果
|
|
||||||
if (res.code === 0 && res.data) {
|
|
||||||
// 从res.data中获取src字段
|
|
||||||
const url = String(res.data.src || '');
|
|
||||||
if (url) {
|
|
||||||
insertFn(url);
|
|
||||||
} else {
|
|
||||||
layer.msg('图片地址无效', { icon: 2 });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
layer.msg('图片上传失败', { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const editor = createEditor({
|
|
||||||
selector: '#editor-container',
|
|
||||||
html: '<p><br></p>',
|
|
||||||
config: editorConfig,
|
|
||||||
mode: 'default', // or 'simple'
|
|
||||||
})
|
|
||||||
|
|
||||||
const toolbarConfig = {}
|
|
||||||
|
|
||||||
const toolbar = createToolbar({
|
|
||||||
editor,
|
|
||||||
selector: '#toolbar-container',
|
|
||||||
config: toolbarConfig,
|
|
||||||
mode: 'default', // or 'simple'
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
//返回文章列表
|
|
||||||
function goBack() {
|
|
||||||
window.location.href = '<?php echo url("article/articlelist"); ?>';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
<?php /*a:2:{s:63:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\cateadd.php";i:1746776163;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div style="padding: 50px;padding-bottom: 0px;">
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" id="name" name="name" required lay-verify="required" placeholder="请输入分类名称"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">父级分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select id="cid" name="cid" lay-verify="required">
|
|
||||||
<option value="0">顶级分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" id="sort" name="sort" value="0" placeholder="请输入排序值" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">添加分类</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
|
|
||||||
// 获取URL中的cid参数
|
|
||||||
var urlParams = new URLSearchParams(window.location.search);
|
|
||||||
var cid = urlParams.get('cid');
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("article/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="0">顶级分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
html += '<option value="' + item.id + '"' + (cid == item.id ? ' selected' : '') + '>' + item.name + '</option>';
|
|
||||||
});
|
|
||||||
$('#cid').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
$.post('<?php echo url("article/cateadd"); ?>', data.field, function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
var index = parent.layer.getFrameIndex(window.name);
|
|
||||||
parent.layer.close(index);
|
|
||||||
parent.location.reload();
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
<?php /*a:3:{s:64:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\configadd.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">关键词</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" id="config_name" name="config_name" placeholder="请输入关键词,在代码中的key">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">作用</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" id="config_info" name="config_info" placeholder="请输入作用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">类型</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select id="config_type" name="config_type" lay-filter="config_type">
|
|
||||||
<option value="1" selected>文本</option>
|
|
||||||
<option value="2">图片</option>
|
|
||||||
<option value="3">富文本</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">说明</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" id="config_desc" name="config_desc" placeholder="请输入说明">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" class="layui-input" id="config_sort" name="config_sort" placeholder="请输入排序,值越大,越靠前" value="0">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select id="config_status" name="config_status" lay-filter="config_status">
|
|
||||||
<option value="1" selected>开启</option>
|
|
||||||
<option value="0">禁用</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,619 +0,0 @@
|
|||||||
<?php /*a:2:{s:62:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\resources\cate.php";i:1747620136;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-app"></i>
|
|
||||||
<span>资源分类管理</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加分类
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 主要内容区 -->
|
|
||||||
<div class="main-content">
|
|
||||||
<div class="layui-row layui-col-space20">
|
|
||||||
<!-- 左侧分类列表 -->
|
|
||||||
<div class="layui-col-md7">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span>分类列表</span>
|
|
||||||
<small class="text-muted">支持两级分类结构</small>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<div id="categoryList" class="category-tree"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 右侧分类信息 -->
|
|
||||||
<div class="layui-col-md5">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span>分类信息</span>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<!-- 默认提示 -->
|
|
||||||
<div id="defaultTip" class="empty-tip">
|
|
||||||
<i class="layui-icon layui-icon-face-surprised"></i>
|
|
||||||
<p>请选择左侧分类或点击新增按钮</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 分类表单 -->
|
|
||||||
<form class="layui-form category-form" lay-filter="categoryForm" style="display: none;">
|
|
||||||
<input type="hidden" name="id" id="categoryId">
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入分类名称"
|
|
||||||
autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">父级分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cid" lay-verify="required">
|
|
||||||
<option value="0">顶级分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-upload-drag" id="uploadImage">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i>
|
|
||||||
<p>点击上传或拖拽图片至此处</p>
|
|
||||||
<div class="layui-hide" id="uploadPreview">
|
|
||||||
<hr>
|
|
||||||
<img src="" alt="分类图标" style="max-width: 100%">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="icon" id="imageInput">
|
|
||||||
<div class="layui-form-mid layui-word-aux">建议尺寸:128px * 128px</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" name="sort" value="0" class="layui-input"
|
|
||||||
placeholder="数字越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="正常" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item form-actions">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="saveCategory">保存</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-danger" id="deleteBtn"
|
|
||||||
style="display: none;">删除</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
/* 页面整体样式 */
|
|
||||||
.config-container {
|
|
||||||
padding: 15px;
|
|
||||||
/* background: #f2f2f2; */
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-col-md7 .layui-btn-primary {
|
|
||||||
border-color: #d2d2d2;
|
|
||||||
background: 0 0;
|
|
||||||
color: #5f5f5f
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-col-md7 .layui-btn-primary:hover {
|
|
||||||
background-color: #1e9fff;
|
|
||||||
color: #efefef
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 页面头部样式 */
|
|
||||||
.page-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
padding: 10px 15px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 2px;
|
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-title {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-title .layui-icon {
|
|
||||||
margin-right: 8px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-actions .layui-btn {
|
|
||||||
margin-left: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 主要内容区样式 */
|
|
||||||
.main-content {
|
|
||||||
min-height: calc(100vh - 170px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-card {
|
|
||||||
margin-bottom: 0;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-card-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
height: auto;
|
|
||||||
padding: 12px 15px;
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-muted {
|
|
||||||
margin-left: 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: normal;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 分类树样式 */
|
|
||||||
.category-tree {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-item {
|
|
||||||
margin: 5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 10px 15px;
|
|
||||||
background-color: #f8f8f8;
|
|
||||||
border-radius: 2px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header:hover {
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header.active {
|
|
||||||
background-color: #e6f7ff;
|
|
||||||
border-right: 3px solid #1890ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-name {
|
|
||||||
flex: 1;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-actions {
|
|
||||||
/* opacity: 0; */
|
|
||||||
transition: opacity 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header:hover .category-actions {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-children {
|
|
||||||
margin-left: 20px;
|
|
||||||
padding-left: 15px;
|
|
||||||
border-left: 1px dashed #e6e6e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-child {
|
|
||||||
padding: 3px 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-child .layui-icon {
|
|
||||||
font-size: 12px;
|
|
||||||
margin-right: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 空状态提示 */
|
|
||||||
.empty-tip {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 40px 0;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-tip .layui-icon {
|
|
||||||
font-size: 32px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表单样式优化 */
|
|
||||||
.category-form {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-form-label {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-input-block {
|
|
||||||
margin-left: 130px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-actions {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag {
|
|
||||||
padding: 20px;
|
|
||||||
border: 1px dashed #e2e2e2;
|
|
||||||
background-color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag:hover {
|
|
||||||
border-color: #009688;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag img {
|
|
||||||
max-width: 100%;
|
|
||||||
margin: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-btn-xs {
|
|
||||||
height: 30px;
|
|
||||||
line-height: 25px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// 定义全局变量和函数
|
|
||||||
var categoryManager = {
|
|
||||||
init: function () {
|
|
||||||
this.initLayui();
|
|
||||||
},
|
|
||||||
|
|
||||||
initLayui: function () {
|
|
||||||
var that = this;
|
|
||||||
layui.use(['layer', 'form', 'upload'], function () {
|
|
||||||
var layer = layui.layer;
|
|
||||||
var form = layui.form;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
|
|
||||||
// 初始化分类列表
|
|
||||||
that.initCategoryList = function () {
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/resources/cate',
|
|
||||||
type: 'POST',
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
var html = '';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
html += that.renderCategory(item);
|
|
||||||
});
|
|
||||||
$('#categoryList').html(html);
|
|
||||||
that.bindEvents();
|
|
||||||
} else {
|
|
||||||
layer.msg('获取分类数据失败', { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 渲染分类项
|
|
||||||
that.renderCategory = function (category, level = 0) {
|
|
||||||
var html = '<div class="category-item" data-id="' + category.id + '">';
|
|
||||||
html += '<div class="category-header">';
|
|
||||||
html += '<div class="category-name">' + category.title + '</div>';
|
|
||||||
if (level === 0) {
|
|
||||||
html += '<div class="category-actions">';
|
|
||||||
html += '<button type="button" class="layui-btn layui-btn-primary layui-btn-xs add-child">';
|
|
||||||
html += '<i class="layui-icon layui-icon-add-1"></i>添加子分类</button>';
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
|
|
||||||
if (category.children && category.children.length > 0) {
|
|
||||||
html += '<div class="category-children">';
|
|
||||||
category.children.forEach(function (child) {
|
|
||||||
html += that.renderCategory(child, level + 1);
|
|
||||||
});
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
return html;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 绑定事件
|
|
||||||
that.bindEvents = function () {
|
|
||||||
// 点击分类项加载编辑信息
|
|
||||||
$('.category-header').off('click').on('click', function (e) {
|
|
||||||
if (!$(e.target).closest('.add-child').length) {
|
|
||||||
var id = $(this).closest('.category-item').data('id');
|
|
||||||
that.loadCategoryInfo(id);
|
|
||||||
|
|
||||||
// 添加选中效果
|
|
||||||
$('.category-header').removeClass('active');
|
|
||||||
$(this).addClass('active');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加子分类
|
|
||||||
$('.add-child').off('click').on('click', function (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
var parentId = $(this).closest('.category-item').data('id');
|
|
||||||
that.showCategoryForm(parentId);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 加载分类信息
|
|
||||||
that.loadCategoryInfo = function (id) {
|
|
||||||
$.get('/admin/resources/cateedit?id=' + id, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
that.showCategoryForm(0, res.data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 显示分类表单
|
|
||||||
that.showCategoryForm = function (parentId = 0, data = null) {
|
|
||||||
$('#defaultTip').hide();
|
|
||||||
$('.category-form').show();
|
|
||||||
|
|
||||||
// 重置表单
|
|
||||||
form.val('categoryForm', {
|
|
||||||
id: data ? data.info.id : '',
|
|
||||||
name: data ? data.info.name : '',
|
|
||||||
cid: data ? data.info.cid : parentId,
|
|
||||||
sort: data ? data.info.sort : 0,
|
|
||||||
status: data ? data.info.status : 1
|
|
||||||
});
|
|
||||||
|
|
||||||
// 更新父级分类选项
|
|
||||||
var $select = $('select[name="cid"]');
|
|
||||||
$select.empty().append('<option value="0">顶级分类</option>');
|
|
||||||
// 获取所有分类作为父级选项
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/resources/cate',
|
|
||||||
type: 'POST',
|
|
||||||
async: false,
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
// 当前编辑的分类ID
|
|
||||||
var currentId = data ? data.info.id : 0;
|
|
||||||
// 递归构建分类选项
|
|
||||||
function buildOptions(categories, level) {
|
|
||||||
categories.forEach(function (category) {
|
|
||||||
// 不能选择自己或自己的子分类作为父级
|
|
||||||
if (category.id != currentId) {
|
|
||||||
var prefix = new Array(level + 1).join('├─ ');
|
|
||||||
$select.append('<option value="' + category.id + '">' + prefix + category.title + '</option>'); if (category.children && category.children.length > 0) { buildOptions(category.children, level + 1); }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} buildOptions(res.data, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 设置选中的父级分类
|
|
||||||
if (data && data.info.cid) {
|
|
||||||
$select.val(data.info.cid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新图标预览
|
|
||||||
if (data && data.info.icon) {
|
|
||||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', data.info.icon);
|
|
||||||
$('#imageInput').val(data.info.icon);
|
|
||||||
} else {
|
|
||||||
$('#uploadPreview').addClass('layui-hide').find('img').attr('src', '');
|
|
||||||
$('#imageInput').val('');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示/隐藏删除按钮
|
|
||||||
$('#deleteBtn')[data ? 'show' : 'hide']();
|
|
||||||
|
|
||||||
form.render();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化上传组件
|
|
||||||
upload.render({
|
|
||||||
elem: '#uploadImage',
|
|
||||||
url: '/admin/upload/image',
|
|
||||||
accept: 'images',
|
|
||||||
acceptMime: 'image/*',
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', res.data.url);
|
|
||||||
$('#imageInput').val(res.data.url);
|
|
||||||
layer.msg('上传成功');
|
|
||||||
} else {
|
|
||||||
layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听表单提交
|
|
||||||
form.on('submit(saveCategory)', function (data) {
|
|
||||||
var url = data.field.id ? '/admin/resources/cateedit' : '/admin/resources/cateadd';
|
|
||||||
$.post(url, data.field, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
that.initCategoryList();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听删除按钮
|
|
||||||
$('#deleteBtn').on('click', function () {
|
|
||||||
var id = $('#categoryId').val();
|
|
||||||
if (!id) return;
|
|
||||||
|
|
||||||
layer.confirm('确定要删除该分类吗?', function (index) {
|
|
||||||
$.post('/admin/resources/catedel', { id: id }, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
that.initCategoryList();
|
|
||||||
$('#defaultTip').show();
|
|
||||||
$('.category-form').hide();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化页面
|
|
||||||
that.initCategoryList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
categoryManager.init();
|
|
||||||
|
|
||||||
// 新增分类
|
|
||||||
function add() {
|
|
||||||
categoryManager.showCategoryForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 刷新列表
|
|
||||||
function refresh() {
|
|
||||||
categoryManager.initCategoryList();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,241 +0,0 @@
|
|||||||
<?php /*a:3:{s:53:"E:\Demo\PHP\yunzer\app\admin\view\yunzer\menuinfo.php";i:1747402501;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-picture"></i>
|
|
||||||
<span>菜单管理</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button class="layui-btn layui-bg-blue" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加菜单
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="test7" class="demo-tree"></div>
|
|
||||||
<table class="layui-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="text-align:center">类型</th>
|
|
||||||
<th style="text-align:center">菜单名</th>
|
|
||||||
<th style="text-align:center">图标</th>
|
|
||||||
<th style="text-align:center">排序</th>
|
|
||||||
<th style="text-align:center">状态</th>
|
|
||||||
<th style="text-align:center">操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php if(is_array($lists) || $lists instanceof \think\Collection || $lists instanceof \think\Paginator): $i = 0; $__LIST__ = $lists;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
|
|
||||||
<tr>
|
|
||||||
<td align="center">
|
|
||||||
<?php if(($vo['type']==1)): ?>
|
|
||||||
功能模块:<?php echo htmlentities((string) $vo['src']); elseif(($vo['type']==2)): ?>
|
|
||||||
超链接:<?php echo htmlentities((string) $vo['src']); else: ?>
|
|
||||||
顶级
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td align="center"><?php echo htmlentities((string) $vo['label']); ?></td>
|
|
||||||
<td align="center"><i class="layui-icon <?php echo htmlentities((string) $vo['icon_class']); ?>"></i> <?php echo htmlentities((string) $vo['icon_class']); ?></td>
|
|
||||||
<td align="center"><?php echo htmlentities((string) $vo['sort']); ?></td>
|
|
||||||
<td align="center"><?php echo $vo['status']==1 ? '开启' : '<span style="color:red;">禁用</span>'; ?></td>
|
|
||||||
<td align="center">
|
|
||||||
<?php if(($vo['type'] == 0)): ?>
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal"
|
|
||||||
onclick="buttonInfo(<?php echo htmlentities((string) $vo['smid']); ?>)">下级菜单</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" onclick="edit(<?php echo htmlentities((string) $vo['smid']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" onclick="del(<?php echo htmlentities((string) $vo['smid']); ?>)">
|
|
||||||
<i class="layui-icon layui-icon-delete"></i>删除
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer'], function () {
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
});
|
|
||||||
// 添加
|
|
||||||
function add() {
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '添加菜单',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['550px', '550px'],
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/menuadd'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 编辑
|
|
||||||
function edit(smid) {
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '编辑菜单',
|
|
||||||
shade: 0.3,
|
|
||||||
area: ['550px', '550px'],
|
|
||||||
content: '<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/menuedit?smid=' + smid
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 删除
|
|
||||||
function del(smid) {
|
|
||||||
layer.confirm('确定要删除吗?', {
|
|
||||||
icon: 3,
|
|
||||||
btn: ['确定', '取消']
|
|
||||||
}, function () {
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/menudel', { 'smid': smid }, function (res) {
|
|
||||||
if (res.code > 0) {
|
|
||||||
layer.alert(res.msg, { icon: 2 });
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () { window.location.reload(); }, 1000);
|
|
||||||
}
|
|
||||||
}, 'json');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 按钮列表
|
|
||||||
function buttonInfo(smid) {
|
|
||||||
window.location.href = "<?php echo htmlentities((string) $config['admin_route']); ?>yunzer/buttoninfo?smid=" + smid;
|
|
||||||
}
|
|
||||||
|
|
||||||
//刷新列表
|
|
||||||
function refresh() {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,311 +0,0 @@
|
|||||||
<?php /*a:3:{s:66:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\configvalue.php";i:1747370939;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<style>
|
|
||||||
.config-container {
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 8px;
|
|
||||||
/* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); */
|
|
||||||
}
|
|
||||||
.config-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
}
|
|
||||||
.config-header span {
|
|
||||||
font-size: 18px;
|
|
||||||
color: #2c3e50;
|
|
||||||
font-weight: 500;
|
|
||||||
margin-right: 20px;
|
|
||||||
}
|
|
||||||
.config-header a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.config-header a span {
|
|
||||||
padding: 6px 15px;
|
|
||||||
background: #f8f9fa;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #606266;
|
|
||||||
font-size: 14px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
.config-header a span:hover {
|
|
||||||
background: #e9ecef;
|
|
||||||
color: #409EFF;
|
|
||||||
}
|
|
||||||
.layui-form-item {
|
|
||||||
margin-bottom: 25px;
|
|
||||||
}
|
|
||||||
.layui-form-label {
|
|
||||||
color: #606266;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
.layui-input {
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.layui-input:focus {
|
|
||||||
border-color: #409EFF;
|
|
||||||
}
|
|
||||||
.layui-textarea {
|
|
||||||
border-radius: 4px;
|
|
||||||
min-height: 100px;
|
|
||||||
}
|
|
||||||
.layui-word-aux {
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
.layui-btn {
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
.layui-btn:hover {
|
|
||||||
transform: translateY(-1px);
|
|
||||||
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
|
||||||
}
|
|
||||||
.upload-preview {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
.upload-preview img {
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
.upload-preview img:hover {
|
|
||||||
transform: scale(1.02);
|
|
||||||
}
|
|
||||||
.save-button-container {
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 40px;
|
|
||||||
padding-top: 20px;
|
|
||||||
border-top: 1px solid #eee;
|
|
||||||
}
|
|
||||||
.save-button-container .layui-btn {
|
|
||||||
padding: 0 50px;
|
|
||||||
height: 40px;
|
|
||||||
line-height: 40px;
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header">
|
|
||||||
<span>站点配置</span>
|
|
||||||
<!-- <a href="<?php echo htmlentities((string) $config['admin_route']); ?>Yunzer/configlist">
|
|
||||||
<span>站点管理</span>
|
|
||||||
</a> -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form class="layui-form">
|
|
||||||
<?php foreach($lists as $lists_v): if(($lists_v['config_type'] == 1)): ?>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label"><?php echo htmlentities((string) $lists_v['config_info']); ?></label>
|
|
||||||
<div class="layui-input-inline" style="width: 350px;">
|
|
||||||
<input type="text" class="layui-input" id="<?php echo htmlentities((string) $lists_v['config_name']); ?>" name="<?php echo htmlentities((string) $lists_v['config_name']); ?>" placeholder="<?php echo htmlentities((string) $lists_v['config_desc']); ?>" value="<?php echo htmlentities((string) $lists_v['config_value']); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid layui-word-aux"><?php echo htmlentities((string) $lists_v['config_desc']); ?></div>
|
|
||||||
</div>
|
|
||||||
<?php elseif(($lists_v['config_type'] == 2)): ?>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label"><?php echo htmlentities((string) $lists_v['config_info']); ?></label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" id="<?php echo htmlentities((string) $lists_v['config_name']); ?>">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 上传图片
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid layui-word-aux"><?php echo htmlentities((string) $lists_v['config_desc']); ?></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label"><?php echo htmlentities((string) $lists_v['config_info']); ?>预览</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-upload-list upload-preview" id="yulan_<?php echo htmlentities((string) $lists_v['config_name']); ?>" style="width:90%;">
|
|
||||||
<?php if(!empty($lists_v['config_value'])): ?>
|
|
||||||
<div class="upload_pic_li" style="position:relative;width:120px;margin:0 10px 10px 0">
|
|
||||||
<img style="background-color: #efefef;height:120px;object-fit:cover;" src="<?php echo htmlentities((string) $lists_v['config_value']); ?>" class="layui-upload-img" onmouseover="show_img(this)" onmouseleave="hide_img()">
|
|
||||||
<input type="hidden" name="<?php echo htmlentities((string) $lists_v['config_name']); ?>" value="<?php echo htmlentities((string) $lists_v['config_value']); ?>"/>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','upload'],function(){
|
|
||||||
layer = layui.layer;
|
|
||||||
upload = layui.upload;
|
|
||||||
$ = layui.jquery;
|
|
||||||
|
|
||||||
upload.render({
|
|
||||||
elem: "#<?php echo htmlentities((string) $lists_v['config_name']); ?>",
|
|
||||||
url: "<?php echo htmlentities((string) $config['admin_route']); ?>index/upload_img",
|
|
||||||
multiple: true,
|
|
||||||
done: function(res,title){
|
|
||||||
if(res.code > 0){
|
|
||||||
return layer.msg("上传失败,"+res.msg, {icon: 2});
|
|
||||||
}else{
|
|
||||||
$("#yulan_<?php echo htmlentities((string) $lists_v['config_name']); ?>").html('<div class="upload_pic_li" style="position:relative;width:120px;margin:0 10px 10px 0"><img style="width:120px;height:120px;object-fit:cover;" src="'+ res.url +'" class="layui-upload-img" onmouseover="show_img(this)" onmouseleave="hide_img()"><input type="hidden" name="<?php echo htmlentities((string) $lists_v['config_name']); ?>" value="'+res.data+'"/></div>');
|
|
||||||
layer.msg("上传成功", {icon: 1});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<?php elseif(($lists_v['config_type'] == 3)): ?>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label"><?php echo htmlentities((string) $lists_v['config_info']); ?></label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<textarea class="layui-textarea" id="<?php echo htmlentities((string) $lists_v['config_name']); ?>" name="<?php echo htmlentities((string) $lists_v['config_name']); ?>" placeholder="<?php echo htmlentities((string) $lists_v['config_desc']); ?>"><?php echo htmlentities((string) $lists_v['config_value']); ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class="save-button-container">
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="save()">
|
|
||||||
<i class="layui-icon layui-icon-ok"></i> 保存配置
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
function save(){
|
|
||||||
var loadIndex = layer.load(1, {
|
|
||||||
shade: [0.1,'#fff']
|
|
||||||
});
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/configvalue',$('form').serialize(),function(res){
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){
|
|
||||||
history.go(0);
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,619 +0,0 @@
|
|||||||
<?php /*a:2:{s:52:"E:\Demo\PHP\yunzer\app\admin\view\resources\cate.php";i:1747402501;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-app"></i>
|
|
||||||
<span>资源分类管理</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加分类
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 主要内容区 -->
|
|
||||||
<div class="main-content">
|
|
||||||
<div class="layui-row layui-col-space20">
|
|
||||||
<!-- 左侧分类列表 -->
|
|
||||||
<div class="layui-col-md7">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span>分类列表</span>
|
|
||||||
<small class="text-muted">支持两级分类结构</small>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<div id="categoryList" class="category-tree"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 右侧分类信息 -->
|
|
||||||
<div class="layui-col-md5">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span>分类信息</span>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<!-- 默认提示 -->
|
|
||||||
<div id="defaultTip" class="empty-tip">
|
|
||||||
<i class="layui-icon layui-icon-face-surprised"></i>
|
|
||||||
<p>请选择左侧分类或点击新增按钮</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 分类表单 -->
|
|
||||||
<form class="layui-form category-form" lay-filter="categoryForm" style="display: none;">
|
|
||||||
<input type="hidden" name="id" id="categoryId">
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入分类名称"
|
|
||||||
autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">父级分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cid" lay-verify="required">
|
|
||||||
<option value="0">顶级分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-upload-drag" id="uploadImage">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i>
|
|
||||||
<p>点击上传或拖拽图片至此处</p>
|
|
||||||
<div class="layui-hide" id="uploadPreview">
|
|
||||||
<hr>
|
|
||||||
<img src="" alt="分类图标" style="max-width: 100%">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="icon" id="imageInput">
|
|
||||||
<div class="layui-form-mid layui-word-aux">建议尺寸:128px * 128px</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" name="sort" value="0" class="layui-input"
|
|
||||||
placeholder="数字越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="正常" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item form-actions">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="saveCategory">保存</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-danger" id="deleteBtn"
|
|
||||||
style="display: none;">删除</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
/* 页面整体样式 */
|
|
||||||
.config-container {
|
|
||||||
padding: 15px;
|
|
||||||
/* background: #f2f2f2; */
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-col-md7 .layui-btn-primary {
|
|
||||||
border-color: #d2d2d2;
|
|
||||||
background: 0 0;
|
|
||||||
color: #5f5f5f
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-col-md7 .layui-btn-primary:hover {
|
|
||||||
background-color: #1e9fff;
|
|
||||||
color: #efefef
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 页面头部样式 */
|
|
||||||
.page-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
padding: 10px 15px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 2px;
|
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-title {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-title .layui-icon {
|
|
||||||
margin-right: 8px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-actions .layui-btn {
|
|
||||||
margin-left: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 主要内容区样式 */
|
|
||||||
.main-content {
|
|
||||||
min-height: calc(100vh - 170px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-card {
|
|
||||||
margin-bottom: 0;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-card-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
height: auto;
|
|
||||||
padding: 12px 15px;
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-muted {
|
|
||||||
margin-left: 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: normal;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 分类树样式 */
|
|
||||||
.category-tree {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-item {
|
|
||||||
margin: 5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 10px 15px;
|
|
||||||
background-color: #f8f8f8;
|
|
||||||
border-radius: 2px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header:hover {
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header.active {
|
|
||||||
background-color: #e6f7ff;
|
|
||||||
border-right: 3px solid #1890ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-name {
|
|
||||||
flex: 1;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-actions {
|
|
||||||
/* opacity: 0; */
|
|
||||||
transition: opacity 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header:hover .category-actions {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-children {
|
|
||||||
margin-left: 20px;
|
|
||||||
padding-left: 15px;
|
|
||||||
border-left: 1px dashed #e6e6e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-child {
|
|
||||||
padding: 3px 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-child .layui-icon {
|
|
||||||
font-size: 12px;
|
|
||||||
margin-right: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 空状态提示 */
|
|
||||||
.empty-tip {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 40px 0;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-tip .layui-icon {
|
|
||||||
font-size: 32px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表单样式优化 */
|
|
||||||
.category-form {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-form-label {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-input-block {
|
|
||||||
margin-left: 130px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-actions {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag {
|
|
||||||
padding: 20px;
|
|
||||||
border: 1px dashed #e2e2e2;
|
|
||||||
background-color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag:hover {
|
|
||||||
border-color: #009688;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag img {
|
|
||||||
max-width: 100%;
|
|
||||||
margin: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-btn-xs {
|
|
||||||
height: 30px;
|
|
||||||
line-height: 25px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// 定义全局变量和函数
|
|
||||||
var categoryManager = {
|
|
||||||
init: function () {
|
|
||||||
this.initLayui();
|
|
||||||
},
|
|
||||||
|
|
||||||
initLayui: function () {
|
|
||||||
var that = this;
|
|
||||||
layui.use(['layer', 'form', 'upload'], function () {
|
|
||||||
var layer = layui.layer;
|
|
||||||
var form = layui.form;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
|
|
||||||
// 初始化分类列表
|
|
||||||
that.initCategoryList = function () {
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/resources/cate',
|
|
||||||
type: 'POST',
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
var html = '';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
html += that.renderCategory(item);
|
|
||||||
});
|
|
||||||
$('#categoryList').html(html);
|
|
||||||
that.bindEvents();
|
|
||||||
} else {
|
|
||||||
layer.msg('获取分类数据失败', { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 渲染分类项
|
|
||||||
that.renderCategory = function (category, level = 0) {
|
|
||||||
var html = '<div class="category-item" data-id="' + category.id + '">';
|
|
||||||
html += '<div class="category-header">';
|
|
||||||
html += '<div class="category-name">' + category.title + '</div>';
|
|
||||||
if (level === 0) {
|
|
||||||
html += '<div class="category-actions">';
|
|
||||||
html += '<button type="button" class="layui-btn layui-btn-primary layui-btn-xs add-child">';
|
|
||||||
html += '<i class="layui-icon layui-icon-add-1"></i>添加子分类</button>';
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
|
|
||||||
if (category.children && category.children.length > 0) {
|
|
||||||
html += '<div class="category-children">';
|
|
||||||
category.children.forEach(function (child) {
|
|
||||||
html += that.renderCategory(child, level + 1);
|
|
||||||
});
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
return html;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 绑定事件
|
|
||||||
that.bindEvents = function () {
|
|
||||||
// 点击分类项加载编辑信息
|
|
||||||
$('.category-header').off('click').on('click', function (e) {
|
|
||||||
if (!$(e.target).closest('.add-child').length) {
|
|
||||||
var id = $(this).closest('.category-item').data('id');
|
|
||||||
that.loadCategoryInfo(id);
|
|
||||||
|
|
||||||
// 添加选中效果
|
|
||||||
$('.category-header').removeClass('active');
|
|
||||||
$(this).addClass('active');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加子分类
|
|
||||||
$('.add-child').off('click').on('click', function (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
var parentId = $(this).closest('.category-item').data('id');
|
|
||||||
that.showCategoryForm(parentId);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 加载分类信息
|
|
||||||
that.loadCategoryInfo = function (id) {
|
|
||||||
$.get('/admin/resources/cateedit?id=' + id, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
that.showCategoryForm(0, res.data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 显示分类表单
|
|
||||||
that.showCategoryForm = function (parentId = 0, data = null) {
|
|
||||||
$('#defaultTip').hide();
|
|
||||||
$('.category-form').show();
|
|
||||||
|
|
||||||
// 重置表单
|
|
||||||
form.val('categoryForm', {
|
|
||||||
id: data ? data.info.id : '',
|
|
||||||
name: data ? data.info.name : '',
|
|
||||||
cid: data ? data.info.cid : parentId,
|
|
||||||
sort: data ? data.info.sort : 0,
|
|
||||||
status: data ? data.info.status : 1
|
|
||||||
});
|
|
||||||
|
|
||||||
// 更新父级分类选项
|
|
||||||
var $select = $('select[name="cid"]');
|
|
||||||
$select.empty().append('<option value="0">顶级分类</option>');
|
|
||||||
// 获取所有分类作为父级选项
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/resources/cate',
|
|
||||||
type: 'POST',
|
|
||||||
async: false,
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
// 当前编辑的分类ID
|
|
||||||
var currentId = data ? data.info.id : 0;
|
|
||||||
// 递归构建分类选项
|
|
||||||
function buildOptions(categories, level) {
|
|
||||||
categories.forEach(function (category) {
|
|
||||||
// 不能选择自己或自己的子分类作为父级
|
|
||||||
if (category.id != currentId) {
|
|
||||||
var prefix = new Array(level + 1).join('├─ ');
|
|
||||||
$select.append('<option value="' + category.id + '">' + prefix + category.title + '</option>'); if (category.children && category.children.length > 0) { buildOptions(category.children, level + 1); }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} buildOptions(res.data, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 设置选中的父级分类
|
|
||||||
if (data && data.info.cid) {
|
|
||||||
$select.val(data.info.cid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新图标预览
|
|
||||||
if (data && data.info.icon) {
|
|
||||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', data.info.icon);
|
|
||||||
$('#imageInput').val(data.info.icon);
|
|
||||||
} else {
|
|
||||||
$('#uploadPreview').addClass('layui-hide').find('img').attr('src', '');
|
|
||||||
$('#imageInput').val('');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示/隐藏删除按钮
|
|
||||||
$('#deleteBtn')[data ? 'show' : 'hide']();
|
|
||||||
|
|
||||||
form.render();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化上传组件
|
|
||||||
upload.render({
|
|
||||||
elem: '#uploadImage',
|
|
||||||
url: '/admin/upload/image',
|
|
||||||
accept: 'images',
|
|
||||||
acceptMime: 'image/*',
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', res.data.url);
|
|
||||||
$('#imageInput').val(res.data.url);
|
|
||||||
layer.msg('上传成功');
|
|
||||||
} else {
|
|
||||||
layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听表单提交
|
|
||||||
form.on('submit(saveCategory)', function (data) {
|
|
||||||
var url = data.field.id ? '/admin/resources/cateedit' : '/admin/resources/cateadd';
|
|
||||||
$.post(url, data.field, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
that.initCategoryList();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听删除按钮
|
|
||||||
$('#deleteBtn').on('click', function () {
|
|
||||||
var id = $('#categoryId').val();
|
|
||||||
if (!id) return;
|
|
||||||
|
|
||||||
layer.confirm('确定要删除该分类吗?', function (index) {
|
|
||||||
$.post('/admin/resources/catedel', { id: id }, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
that.initCategoryList();
|
|
||||||
$('#defaultTip').show();
|
|
||||||
$('.category-form').hide();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化页面
|
|
||||||
that.initCategoryList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
categoryManager.init();
|
|
||||||
|
|
||||||
// 新增分类
|
|
||||||
function add() {
|
|
||||||
categoryManager.showCategoryForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 刷新列表
|
|
||||||
function refresh() {
|
|
||||||
categoryManager.initCategoryList();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,221 +0,0 @@
|
|||||||
<?php /*a:3:{s:55:"E:\Demo\PHP\yunzer\app\admin\view\yunzer\buttonedit.php";i:1745855804;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<input type="hidden" name="smid" value="<?php echo htmlentities((string) $lists['smid']); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">按钮名</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="label" placeholder="请输入按钮名" value="<?php echo htmlentities((string) $lists['label']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="icon_class" lay-verify="required" lay-search="">
|
|
||||||
<option value="">请输入layui图标</option>
|
|
||||||
<?php foreach($iconfont as $icon_v): ?>
|
|
||||||
<option value="<?php echo htmlentities((string) $icon_v['icon_css']); ?>" <?php if(($icon_v['icon_css'] == $lists['icon_class'])): ?>selected<?php endif; ?>><?php echo htmlentities((string) $icon_v['icon_css']); ?> <?php echo htmlentities((string) $icon_v['icon_name']); ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">类型</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="type" lay-filter="type">
|
|
||||||
<option value='1' <?php echo $lists['type']==1 ? 'selected' : ''; ?>>内部代码</option>
|
|
||||||
<option value='2' <?php echo $lists['type']==2 ? 'selected' : ''; ?>>超链接</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" <?php echo $lists['type']==1 ? 'style="display : none;"':''; ?> id="src1">
|
|
||||||
<label class="layui-form-label">内部代码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src1" placeholder="请输入:/项目/模块/方法" <?php if($lists['type']==1): ?>value="<?php echo htmlentities((string) $lists['src']); ?>"<?php endif; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" <?php echo $lists['type']==2 ? 'style="display : none;"':''; ?> id="src2">
|
|
||||||
<label class="layui-form-label">链接地址</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src2" placeholder="请输入http网址" <?php if($lists['type']==2): ?>value="<?php echo htmlentities((string) $lists['src']); ?>"<?php endif; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" class="layui-input" name="sort" placeholder="值越大越靠前" value="<?php echo htmlentities((string) $lists['sort']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" <?php echo $lists['status']==1 ? 'checked' : ''; ?>>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用" <?php echo $lists['status']==0 ? 'checked' : ''; ?>>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
|
|
||||||
type(<?php echo htmlentities((string) $lists['type']); ?>);
|
|
||||||
form.on('select(type)', function(data){
|
|
||||||
type(data.value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
function type(value){
|
|
||||||
if(value == 1){
|
|
||||||
$("#src1").show();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else if(value == 2){
|
|
||||||
$("#src1").hide();
|
|
||||||
$("#src2").show();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else{
|
|
||||||
$("#src1").show();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function save(){
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/buttonedit',$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
<?php /*a:1:{s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\login\index.php";i:1747615358;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh-CN">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>后台管理系统</title>
|
|
||||||
<meta name="renderer" content="yz">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport"
|
|
||||||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/login.css">
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">
|
|
||||||
<div class="layadmin-user-login-main">
|
|
||||||
<div class="layadmin-user-login-box layadmin-user-login-header">
|
|
||||||
<img src="/static/images/logo.png" />
|
|
||||||
<h2>后台管理系统</h2>
|
|
||||||
</div>
|
|
||||||
<div class="layadmin-user-login-box layadmin-user-login-body layui-form">
|
|
||||||
<form class="layui-form login-form">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layadmin-user-login-icon layui-icon layui-icon-username" for="account"></label>
|
|
||||||
<input type="text" id="account" name="account" placeholder="邮箱" class="layui-input"
|
|
||||||
value="">
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
|
|
||||||
<input type="password" name="password" lay-affix="eye" class="layui-input" placeholder="密码" class="layui-input"
|
|
||||||
value="">
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-row">
|
|
||||||
<div class="layui-col-xs7">
|
|
||||||
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode"
|
|
||||||
for="code"></label>
|
|
||||||
<input type="text" name="code" placeholder="图形验证码" class="layui-input">
|
|
||||||
</div>
|
|
||||||
<div class="layui-col-xs5">
|
|
||||||
<div style="margin-left:10px;">
|
|
||||||
<img src="<?php echo captcha_src(); ?>?t=<?php echo time(); ?>" class="layadmin-user-login-codeimg" id="img"
|
|
||||||
onclick="reloadImg()">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" style="margin-bottom: 20px;">
|
|
||||||
<input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<button class="layui-btn layui-btn-fluid" onclick="login()">登 陆</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer', 'form'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
// 用户名控件获取焦点
|
|
||||||
$('#account').focus();
|
|
||||||
// 回车登录
|
|
||||||
$('input').keydown(function (e) {
|
|
||||||
if (e.keyCode == 13) {
|
|
||||||
login();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// 重新生成验证码
|
|
||||||
function reloadImg() {
|
|
||||||
var timestamp = new Date().getTime();
|
|
||||||
$('#img').attr('src', '<?php echo captcha_src(); ?>?t=' + timestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 登录处理函数
|
|
||||||
function login() {
|
|
||||||
var account = $('input[name="account"]').val();
|
|
||||||
var password = $('input[name="password"]').val();
|
|
||||||
var code = $('input[name="code"]').val();
|
|
||||||
var remember = $('input[name="remember"]:checked').val();
|
|
||||||
|
|
||||||
if (!account) {
|
|
||||||
layer.msg('邮箱不能为空');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!password) {
|
|
||||||
layer.msg('密码不能为空');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!code) {
|
|
||||||
layer.msg('验证码不能为空');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: 'post',
|
|
||||||
url: '<?php echo url("login"); ?>',
|
|
||||||
data: {
|
|
||||||
account: account,
|
|
||||||
password: password,
|
|
||||||
code: code,
|
|
||||||
remember: remember
|
|
||||||
},
|
|
||||||
dataType: 'json',
|
|
||||||
success: function(res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, {icon: 1, time: 1000}, function() {
|
|
||||||
window.location.href = '<?php echo url("Index/index"); ?>';
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, {icon: 2});
|
|
||||||
reloadImg();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
layer.msg('网络错误,请重试', {icon: 2});
|
|
||||||
reloadImg();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,217 +0,0 @@
|
|||||||
<?php /*a:3:{s:54:"E:\Demo\PHP\yunzer\app\admin\view\yunzer\buttonadd.php";i:1745855804;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<form class="layui-form">
|
|
||||||
<input type="hidden" name="smid" value="<?php echo htmlentities((string) $smid); ?>">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">按钮名</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="label" placeholder="请输入按钮名">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">图标</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="icon_class" lay-verify="required" lay-search="">
|
|
||||||
<option value="">请输入layui图标</option>
|
|
||||||
<?php foreach($iconfont as $icon_v): ?>
|
|
||||||
<option value="<?php echo htmlentities((string) $icon_v['icon_css']); ?>"><?php echo htmlentities((string) $icon_v['icon_css']); ?> <?php echo htmlentities((string) $icon_v['icon_name']); ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">类型</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="type" lay-filter="type">
|
|
||||||
<option value='1' selected>内部代码</option>
|
|
||||||
<option value='2'>超链接</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" id="src1">
|
|
||||||
<label class="layui-form-label">内部代码</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src1" placeholder="请输入:模块/方法">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item" style="display:none;" id="src2">
|
|
||||||
<label class="layui-form-label">链接地址</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" class="layui-input" name="src2" placeholder="请输入http网址">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" class="layui-input" name="sort" placeholder="值越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="开启" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="layui-form-item" style="margin-top:10px;">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" onclick="save()">保存</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form'],function(){
|
|
||||||
var form = layui.form;
|
|
||||||
layer = layui.layer;
|
|
||||||
$ = layui.jquery;
|
|
||||||
|
|
||||||
form.on('select(type)', function(data){
|
|
||||||
if(data.value == 1){
|
|
||||||
$("#src1").show();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else if(data.value == 2){
|
|
||||||
$("#src1").hide();
|
|
||||||
$("#src2").show();
|
|
||||||
$("#src3").hide();
|
|
||||||
}else{
|
|
||||||
$("#src1").show();
|
|
||||||
$("#src2").hide();
|
|
||||||
$("#src3").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
function save(){
|
|
||||||
$.post('<?php echo htmlentities((string) $config["admin_route"]); ?>yunzer/buttonadd',$('form').serialize(),function(res){
|
|
||||||
if(res.code>0){
|
|
||||||
layer.msg(res.msg,{'icon':2});
|
|
||||||
}else{
|
|
||||||
layer.msg(res.msg,{'icon':1});
|
|
||||||
setTimeout(function(){parent.window.location.reload();},1000);
|
|
||||||
}
|
|
||||||
},'json');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<script type="text/javascript">
|
|
||||||
// 显示图片
|
|
||||||
function show_img(obj){
|
|
||||||
var imgurl = $(obj).attr('src');
|
|
||||||
var res = getMousePos();
|
|
||||||
var html = '<div style="background:#fff;position:absolute;width:200px;border:solid 1px #cdcdcd;border-radius:6px;padding:2px;left:'+res.x+'px;top:'+res.y+'px;z-index:1000" id="preview">\
|
|
||||||
<img style="width:100%;border-radius:6px;" src="'+imgurl+'">\
|
|
||||||
</div>';
|
|
||||||
$('body').append(html);
|
|
||||||
}
|
|
||||||
// 隐藏图片
|
|
||||||
function hide_img(){
|
|
||||||
$('#preview').remove();
|
|
||||||
}
|
|
||||||
// 图片位置计算
|
|
||||||
function getMousePos(event) {
|
|
||||||
var e = event || window.event;
|
|
||||||
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
||||||
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
||||||
var x = e.pageX || e.clientX + scrollX;
|
|
||||||
var y = e.pageY || e.clientY + scrollY;
|
|
||||||
return { 'x': x, 'y': y };
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
function deleteImage(path,obj){
|
|
||||||
$(obj).closest('.upload_pic_li').remove();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,343 +0,0 @@
|
|||||||
<?php /*a:2:{s:56:"E:\Demo\PHP\yunzer\app\admin\view\yunzeradmin\banner.php";i:1747402501;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<!-- 主体内容 -->
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-picture"></i>
|
|
||||||
<span>Banner管理</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button class="layui-btn layui-bg-blue" id="addBanner">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加Banner
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-fluid">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<table id="bannerTable" lay-filter="bannerTable"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Banner表单 -->
|
|
||||||
<div id="bannerForm" style="display: none;">
|
|
||||||
<form class="layui-form banner-form">
|
|
||||||
<input type="hidden" name="id">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">标题</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入标题"
|
|
||||||
class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">图片</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-upload-drag" id="uploadImage">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i>
|
|
||||||
<p>点击上传或拖拽图片至此处</p>
|
|
||||||
<div id="uploadPreview" style="display: none;">
|
|
||||||
<img src="" alt="Banner图片" class="banner-upload-preview">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="imageInput">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">链接</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="url" placeholder="请输入链接地址" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" name="sort" value="0" class="layui-input" placeholder="数字越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="启用" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="saveBanner">保存</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
layui.use(['table', 'form', 'upload', 'layer'], function () {
|
|
||||||
var table = layui.table,
|
|
||||||
form = layui.form,
|
|
||||||
upload = layui.upload,
|
|
||||||
layer = layui.layer;
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
var tableColumns = [[
|
|
||||||
{ field: 'id', title: 'ID', width: 80, align: 'center' },
|
|
||||||
{ field: 'title', title: '标题', align: 'center' },
|
|
||||||
{
|
|
||||||
field: 'image', title: '图片', width: 180, align: 'center', templet: function (d) {
|
|
||||||
return '<img src="' + d.image + '" class="banner-preview-img" onclick="previewImage(\'' + d.image + '\')">';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ field: 'url', title: '链接', align: 'center', width: 300 },
|
|
||||||
{ field: 'sort', title: '排序', align: 'center', width: 100, sort: true },
|
|
||||||
{ field: 'create_time', title: '创建时间', align: 'center', width: 180, sort: true },
|
|
||||||
{
|
|
||||||
title: '操作', align: 'center', width: 240, templet: function (d) {
|
|
||||||
return '<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>' +
|
|
||||||
'<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]];
|
|
||||||
|
|
||||||
// 初始化表格
|
|
||||||
table.render({
|
|
||||||
elem: '#bannerTable',
|
|
||||||
url: '/admin/yunzeradmin/bannerlist',
|
|
||||||
method: 'get',
|
|
||||||
page: true,
|
|
||||||
cols: tableColumns,
|
|
||||||
limit: 10,
|
|
||||||
limits: [10, 20, 30, 50],
|
|
||||||
text: { none: '暂无相关数据' }
|
|
||||||
});
|
|
||||||
|
|
||||||
// 上传组件配置
|
|
||||||
var uploadConfig = {
|
|
||||||
elem: '#uploadImage',
|
|
||||||
url: '/admin/upload/image',
|
|
||||||
accept: 'images',
|
|
||||||
acceptMime: 'image/*',
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
$('#uploadPreview').show().find('img').attr('src', res.data.url);
|
|
||||||
$('#imageInput').val(res.data.url);
|
|
||||||
layer.msg('上传成功');
|
|
||||||
} else {
|
|
||||||
layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化上传组件
|
|
||||||
upload.render(uploadConfig);
|
|
||||||
|
|
||||||
// 监听表格工具条事件
|
|
||||||
table.on('tool(bannerTable)', function (obj) {
|
|
||||||
var data = obj.data;
|
|
||||||
if (obj.event === 'edit') {
|
|
||||||
showBannerForm(data);
|
|
||||||
} else if (obj.event === 'del') {
|
|
||||||
layer.confirm('确定删除此Banner?', function (index) {
|
|
||||||
deleteBanner(data.id, obj);
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加Banner按钮点击事件
|
|
||||||
$('#addBanner').on('click', function () {
|
|
||||||
showBannerForm();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听表单提交
|
|
||||||
form.on('submit(saveBanner)', function (data) {
|
|
||||||
var url = data.field.id ? '/admin/yunzeradmin/banneredit' : '/admin/yunzeradmin/banneradd';
|
|
||||||
$.post(url, data.field, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.closeAll('page');
|
|
||||||
table.reload('bannerTable');
|
|
||||||
layer.msg('保存成功');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 显示Banner表单
|
|
||||||
function showBannerForm(data) {
|
|
||||||
layer.open({
|
|
||||||
type: 1,
|
|
||||||
title: data ? '编辑Banner' : '添加Banner',
|
|
||||||
content: $('#bannerForm'),
|
|
||||||
area: ['800px', '600px'],
|
|
||||||
success: function (layero) {
|
|
||||||
form.render();
|
|
||||||
if (data) {
|
|
||||||
form.val('bannerForm', data);
|
|
||||||
if (data.image) {
|
|
||||||
$('#uploadPreview').show().find('img').attr('src', data.image);
|
|
||||||
$('#imageInput').val(data.image);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除Banner
|
|
||||||
function deleteBanner(id, obj) {
|
|
||||||
$.post('/admin/yunzeradmin/bannerdel', { id: id }, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
obj.del();
|
|
||||||
layer.msg('删除成功');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 预览图片
|
|
||||||
function previewImage(url) {
|
|
||||||
layer.photos({
|
|
||||||
photos: {
|
|
||||||
"data": [{
|
|
||||||
"src": url
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 页面样式 -->
|
|
||||||
<style>
|
|
||||||
.layui-table-cell {
|
|
||||||
height: 40px;
|
|
||||||
line-height: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-table-cell img {
|
|
||||||
height: 36px;
|
|
||||||
width: auto;
|
|
||||||
max-width: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-preview-img {
|
|
||||||
max-width: 80px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-form {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-upload-preview {
|
|
||||||
max-width: 100%;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,379 +0,0 @@
|
|||||||
<?php /*a:2:{s:60:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\edit.php";i:1746841528;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<div class="config-header" style="display:flex;justify-content: space-between;">
|
|
||||||
<div>
|
|
||||||
<span>编辑文章</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="goBack()">
|
|
||||||
<i class="layui-icon layui-icon-return"></i>返回
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form class="layui-form" action="" method="post">
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">标题</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入文章标题" autocomplete="off"
|
|
||||||
class="layui-input" value="<?php echo htmlentities((string) $info['title']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cate" lay-verify="required">
|
|
||||||
<option value="">请选择分类</option>
|
|
||||||
<?php foreach($cates as $item): ?>
|
|
||||||
<option value="<?php echo htmlentities((string) $item['id']); ?>" <?php if($info['cate']==$item['id']): ?>selected<?php endif; ?>><?php echo htmlentities((string) $item['name']); ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">描述</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<textarea name="desc" placeholder="请输入描述内容" class="layui-textarea"><?php echo htmlentities((string) $info['desc']); ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">作者</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="author" required lay-verify="required" placeholder="请输入作者" autocomplete="off"
|
|
||||||
class="layui-input" value="<?php echo htmlentities((string) $info['author']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">封面</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button type="button" class="layui-btn" id="upload-btn">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i> 图片上传
|
|
||||||
</button>
|
|
||||||
<div style="width: 120px;">
|
|
||||||
<div class="layui-upload-list">
|
|
||||||
<img class="layui-upload-img" id="upload-img"
|
|
||||||
style="width: 118px; height: 118px;object-fit: cover;" src="<?php echo htmlentities((string) $info['image']); ?>">
|
|
||||||
<div id="upload-text"></div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-demo">
|
|
||||||
<div class="layui-progress-bar" lay-percent=""></div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="image" value="<?php echo htmlentities((string) $info['image']); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
|
||||||
<label class="layui-form-label">内容</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div id="editor—wrapper" id="content" name="content" style="border: 1px solid #ccc;">
|
|
||||||
<div id="toolbar-container" style="border-bottom: 1px solid #ccc;"><!-- 工具栏 --></div>
|
|
||||||
<div id="editor-container" style="height: 800px;"><!-- 编辑器 --></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
|
||||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="formDraft">存草稿</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/js/wangeditor.js"></script>
|
|
||||||
<script>
|
|
||||||
layui.use(['form', 'layer'], function () {
|
|
||||||
var form = layui.form;
|
|
||||||
var layer = layui.layer;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var element = layui.element;
|
|
||||||
|
|
||||||
// 图片上传
|
|
||||||
var uploadInst = upload.render({
|
|
||||||
elem: '#upload-btn',
|
|
||||||
url: '<?php echo url("index/upload_img"); ?>', // 上传图片接口
|
|
||||||
before: function (obj) {
|
|
||||||
// 预读本地文件示例,不支持ie8
|
|
||||||
obj.preview(function (index, file, result) {
|
|
||||||
$('#upload-img').attr('src', result); // 图片链接(base64)
|
|
||||||
});
|
|
||||||
element.progress('filter-demo', '0%'); // 进度条复位
|
|
||||||
layer.msg('上传中', { icon: 16, time: 0 });
|
|
||||||
},
|
|
||||||
done: function (res) {
|
|
||||||
// 若上传失败
|
|
||||||
if (res.code > 0) {
|
|
||||||
return layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
// 上传成功
|
|
||||||
$('#image').val(res.data); // 设置图片路径到隐藏输入框
|
|
||||||
$('#upload-text').html(''); // 置空上传失败的状态
|
|
||||||
layer.msg('上传成功', { icon: 1 });
|
|
||||||
},
|
|
||||||
uploadError: function () { // 这里改为 uploadError
|
|
||||||
// 演示失败状态,并实现重传
|
|
||||||
var demoText = $('#upload-text');
|
|
||||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
|
||||||
demoText.find('.demo-reload').on('click', function () {
|
|
||||||
uploadInst.upload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 进度条
|
|
||||||
progress: function (n, elem, e) {
|
|
||||||
element.progress('filter-demo', n + '%'); // 可配合 layui 进度条元素使用
|
|
||||||
if (n == 100) {
|
|
||||||
layer.msg('上传完毕', { icon: 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取分类列表
|
|
||||||
$.get('<?php echo url("article/getcate"); ?>', function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
var html = '<option value="">请选择分类</option>';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
// 如果cid为0,则设置为禁用
|
|
||||||
var disabled = item.cid == 0 ? 'disabled' : '';
|
|
||||||
var selected = item.id == '<?php echo htmlentities((string) $info['cate']); ?>' ? 'selected' : '';
|
|
||||||
html += '<option value="' + item.id + '" ' + disabled + ' ' + selected + '>' + item.name + '</option>';
|
|
||||||
// 如果有子分类,添加子分类选项
|
|
||||||
if (item.children && item.children.length > 0) {
|
|
||||||
item.children.forEach(function (child) {
|
|
||||||
var childSelected = child.id == '<?php echo htmlentities((string) $info['cate']); ?>' ? 'selected' : '';
|
|
||||||
html += '<option value="' + child.id + '" ' + childSelected + '>├─ ' + child.name + '</option>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('select[name="cate"]').html(html);
|
|
||||||
form.render('select');
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 表单提交
|
|
||||||
form.on('submit(formSubmit)', function (data) {
|
|
||||||
// 获取编辑器内容
|
|
||||||
var content = editor.getHtml();
|
|
||||||
if (!content || content === '<p><br></p>') {
|
|
||||||
layer.msg('请输入文章内容', { icon: 2 });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var loadIndex = layer.load(2);
|
|
||||||
data.field.content = content;
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo url("article/edit"); ?>?id=<?php echo htmlentities((string) $info['id']); ?>',
|
|
||||||
type: 'POST',
|
|
||||||
data: data.field,
|
|
||||||
success: function (res) {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
if (res.code == 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
setTimeout(function () {
|
|
||||||
window.location.href = '<?php echo url("article/articlelist"); ?>';
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 返回上一页
|
|
||||||
function goBack() {
|
|
||||||
var index = parent.layer.getFrameIndex(window.name);
|
|
||||||
parent.layer.close(index);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- wangeditor编辑器脚本 -->
|
|
||||||
<script>
|
|
||||||
const { createEditor, createToolbar } = window.wangEditor
|
|
||||||
|
|
||||||
const editorConfig = {
|
|
||||||
MENU_CONF: {},
|
|
||||||
placeholder: '请输入内容...',
|
|
||||||
onChange(editor) {
|
|
||||||
const html = editor.getHtml()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// 配置图片上传
|
|
||||||
editorConfig.MENU_CONF['uploadImage'] = {
|
|
||||||
server: '<?php echo url("index/upload_imgs"); ?>',
|
|
||||||
fieldName: 'file',
|
|
||||||
maxFileSize: 10 * 1024 * 1024, // 10M
|
|
||||||
maxNumberOfFiles: 10,
|
|
||||||
allowedFileTypes: ['image/*'],
|
|
||||||
meta: {
|
|
||||||
token: 'xxx'
|
|
||||||
},
|
|
||||||
metaWithUrl: true,
|
|
||||||
headers: {
|
|
||||||
Accept: 'text/x-json'
|
|
||||||
},
|
|
||||||
timeout: 5 * 1000, // 5s
|
|
||||||
|
|
||||||
onBeforeUpload(file) {
|
|
||||||
console.log('准备上传图片', file)
|
|
||||||
return file
|
|
||||||
},
|
|
||||||
onProgress(progress) {
|
|
||||||
console.log('上传进度', progress)
|
|
||||||
},
|
|
||||||
onSuccess(file, res) {
|
|
||||||
console.log('上传成功', file, res)
|
|
||||||
},
|
|
||||||
onFailed(file, res) {
|
|
||||||
layer.msg('上传失败:' + res.msg, { icon: 2 })
|
|
||||||
console.log('上传失败', file, res)
|
|
||||||
},
|
|
||||||
onError(file, err, res) {
|
|
||||||
layer.msg('上传出错:' + err.message, { icon: 2 })
|
|
||||||
console.error('上传出错', file, err, res)
|
|
||||||
},
|
|
||||||
customInsert(res, insertFn) {
|
|
||||||
// res 即服务端的返回结果
|
|
||||||
if (res.code === 0 && res.data) {
|
|
||||||
// 从res.data中获取src字段
|
|
||||||
const url = String(res.data.src || '');
|
|
||||||
if (url) {
|
|
||||||
insertFn(url);
|
|
||||||
} else {
|
|
||||||
layer.msg('图片地址无效', { icon: 2 });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
layer.msg('图片上传失败', { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const editor = createEditor({
|
|
||||||
selector: '#editor-container',
|
|
||||||
html: `<?php echo (isset($info['content']) && ($info['content'] !== '')?$info['content']:''); ?>`,
|
|
||||||
config: editorConfig,
|
|
||||||
mode: 'default', // or 'simple'
|
|
||||||
})
|
|
||||||
|
|
||||||
const toolbarConfig = {}
|
|
||||||
|
|
||||||
const toolbar = createToolbar({
|
|
||||||
editor,
|
|
||||||
selector: '#toolbar-container',
|
|
||||||
config: toolbarConfig,
|
|
||||||
mode: 'default', // or 'simple'
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
//返回文章列表
|
|
||||||
function goBack() {
|
|
||||||
window.location.href = '<?php echo url("article/articlelist"); ?>';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,619 +0,0 @@
|
|||||||
<?php /*a:2:{s:67:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\articlecate.php";i:1747642386;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
|
||||||
<style type="text/css">
|
|
||||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
|
||||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
|
||||||
.header button{float:right;margin-top:-5px;}
|
|
||||||
.pagination {
|
|
||||||
display: inline-block;
|
|
||||||
padding-left: 0;
|
|
||||||
margin: 20px 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.pagination > li > a,
|
|
||||||
.pagination > li > span {
|
|
||||||
position: relative;
|
|
||||||
float: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.42857143;
|
|
||||||
color: #337ab7;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
.pagination > li:first-child > a,
|
|
||||||
.pagination > li:first-child > span {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li:last-child > a,
|
|
||||||
.pagination > li:last-child > span {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.pagination > li > a:hover,
|
|
||||||
.pagination > li > span:hover,
|
|
||||||
.pagination > li > a:focus,
|
|
||||||
.pagination > li > span:focus {
|
|
||||||
z-index: 2;
|
|
||||||
color: #23527c;
|
|
||||||
background-color: #eee;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.pagination > .active > a,
|
|
||||||
.pagination > .active > span,
|
|
||||||
.pagination > .active > a:hover,
|
|
||||||
.pagination > .active > span:hover,
|
|
||||||
.pagination > .active > a:focus,
|
|
||||||
.pagination > .active > span:focus {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
cursor: default;
|
|
||||||
background-color: #337ab7;
|
|
||||||
border-color: #337ab7;
|
|
||||||
}
|
|
||||||
.pagination > .disabled > span,
|
|
||||||
.pagination > .disabled > span:hover,
|
|
||||||
.pagination > .disabled > span:focus,
|
|
||||||
.pagination > .disabled > a,
|
|
||||||
.pagination > .disabled > a:hover,
|
|
||||||
.pagination > .disabled > a:focus {
|
|
||||||
color: #777;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
|
||||||
layer = layui.layer; // layui 弹框
|
|
||||||
form = layui.form; // layui form表单
|
|
||||||
table = layui.table; // layui 表格
|
|
||||||
laydate = layui.laydate; // layui 时间框
|
|
||||||
element = layui.element; // layui element
|
|
||||||
upload = layui.upload; // layui 上传
|
|
||||||
$ = layui.jquery; // layui jquery
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body style="padding:10px; box-sizing: border-box;">
|
|
||||||
<div class="config-container">
|
|
||||||
<!-- 页面头部样式 -->
|
|
||||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
|
||||||
<div class="maintitle">
|
|
||||||
<i class="layui-icon layui-icon-app"></i>
|
|
||||||
<span>文章分类管理</span>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
|
||||||
<div>
|
|
||||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加分类
|
|
||||||
</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
|
||||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 主要内容区 -->
|
|
||||||
<div class="main-content">
|
|
||||||
<div class="layui-row layui-col-space20">
|
|
||||||
<!-- 左侧分类列表 -->
|
|
||||||
<div class="layui-col-md7">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span>分类列表</span>
|
|
||||||
<small class="text-muted">支持两级分类结构</small>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<div id="categoryList" class="category-tree"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 右侧分类信息 -->
|
|
||||||
<div class="layui-col-md5">
|
|
||||||
<div class="layui-card">
|
|
||||||
<div class="layui-card-header">
|
|
||||||
<span>分类信息</span>
|
|
||||||
</div>
|
|
||||||
<div class="layui-card-body">
|
|
||||||
<!-- 默认提示 -->
|
|
||||||
<div id="defaultTip" class="empty-tip">
|
|
||||||
<i class="layui-icon layui-icon-face-surprised"></i>
|
|
||||||
<p>请选择左侧分类或点击新增按钮</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 分类表单 -->
|
|
||||||
<form class="layui-form category-form" lay-filter="categoryForm" style="display: none;">
|
|
||||||
<input type="hidden" name="id" id="categoryId">
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">分类名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入分类名称"
|
|
||||||
autocomplete="off" class="layui-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">父级分类</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<select name="cid" lay-verify="required">
|
|
||||||
<option value="0">顶级分类</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">封面图片</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="layui-upload-drag" id="uploadImage">
|
|
||||||
<i class="layui-icon layui-icon-upload"></i>
|
|
||||||
<p>点击上传或拖拽图片至此处</p>
|
|
||||||
<div class="layui-hide" id="uploadPreview">
|
|
||||||
<hr>
|
|
||||||
<img src="" alt="封面图片" style="max-width: 100%">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="image" id="imageInput">
|
|
||||||
<div class="layui-form-mid layui-word-aux">建议尺寸:250px * 140px</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">排序</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="number" name="sort" value="0" class="layui-input"
|
|
||||||
placeholder="数字越大越靠前">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label class="layui-form-label">状态</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="radio" name="status" value="1" title="正常" checked>
|
|
||||||
<input type="radio" name="status" value="0" title="禁用">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item form-actions">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button class="layui-btn" lay-submit lay-filter="saveCategory">保存</button>
|
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
||||||
<button type="button" class="layui-btn layui-btn-danger" id="deleteBtn"
|
|
||||||
style="display: none;">删除</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
/* 页面整体样式 */
|
|
||||||
.config-container {
|
|
||||||
padding: 15px;
|
|
||||||
/* background: #f2f2f2; */
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-col-md7 .layui-btn-primary {
|
|
||||||
border-color: #d2d2d2;
|
|
||||||
background: 0 0;
|
|
||||||
color: #5f5f5f
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-col-md7 .layui-btn-primary:hover {
|
|
||||||
background-color: #1e9fff;
|
|
||||||
color: #efefef
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 页面头部样式 */
|
|
||||||
.page-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
padding: 10px 15px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 2px;
|
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-title {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-title .layui-icon {
|
|
||||||
margin-right: 8px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-actions .layui-btn {
|
|
||||||
margin-left: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 主要内容区样式 */
|
|
||||||
.main-content {
|
|
||||||
min-height: calc(100vh - 170px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-card {
|
|
||||||
margin-bottom: 0;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-card-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
height: auto;
|
|
||||||
padding: 12px 15px;
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-muted {
|
|
||||||
margin-left: 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: normal;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 分类树样式 */
|
|
||||||
.category-tree {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-item {
|
|
||||||
margin: 5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 10px 15px;
|
|
||||||
background-color: #f8f8f8;
|
|
||||||
border-radius: 2px;
|
|
||||||
transition: all 0.3s;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header:hover {
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header.active {
|
|
||||||
background-color: #e6f7ff;
|
|
||||||
border-right: 3px solid #1890ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-name {
|
|
||||||
flex: 1;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-actions {
|
|
||||||
/* opacity: 0; */
|
|
||||||
transition: opacity 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-header:hover .category-actions {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-children {
|
|
||||||
margin-left: 20px;
|
|
||||||
padding-left: 15px;
|
|
||||||
border-left: 1px dashed #e6e6e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-child {
|
|
||||||
padding: 3px 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-child .layui-icon {
|
|
||||||
font-size: 12px;
|
|
||||||
margin-right: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 空状态提示 */
|
|
||||||
.empty-tip {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 40px 0;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-tip .layui-icon {
|
|
||||||
font-size: 32px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表单样式优化 */
|
|
||||||
.category-form {
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-form-label {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-input-block {
|
|
||||||
margin-left: 130px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-actions {
|
|
||||||
margin-top: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag {
|
|
||||||
padding: 20px;
|
|
||||||
border: 1px dashed #e2e2e2;
|
|
||||||
background-color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag:hover {
|
|
||||||
border-color: #009688;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-upload-drag img {
|
|
||||||
max-width: 100%;
|
|
||||||
margin: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-btn-xs {
|
|
||||||
height: 30px;
|
|
||||||
line-height: 25px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// 定义全局变量和函数
|
|
||||||
var categoryManager = {
|
|
||||||
init: function () {
|
|
||||||
this.initLayui();
|
|
||||||
},
|
|
||||||
|
|
||||||
initLayui: function () {
|
|
||||||
var that = this;
|
|
||||||
layui.use(['layer', 'form', 'upload'], function () {
|
|
||||||
var layer = layui.layer;
|
|
||||||
var form = layui.form;
|
|
||||||
var upload = layui.upload;
|
|
||||||
var $ = layui.jquery;
|
|
||||||
|
|
||||||
// 初始化分类列表
|
|
||||||
that.initCategoryList = function () {
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/article/articlecate',
|
|
||||||
type: 'POST',
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
var html = '';
|
|
||||||
res.data.forEach(function (item) {
|
|
||||||
html += that.renderCategory(item);
|
|
||||||
});
|
|
||||||
$('#categoryList').html(html);
|
|
||||||
that.bindEvents();
|
|
||||||
} else {
|
|
||||||
layer.msg('获取分类数据失败', { icon: 2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 渲染分类项
|
|
||||||
that.renderCategory = function (category, level = 0) {
|
|
||||||
var html = '<div class="category-item" data-id="' + category.id + '">';
|
|
||||||
html += '<div class="category-header">';
|
|
||||||
html += '<div class="category-name">' + category.title + '</div>';
|
|
||||||
if (level === 0) {
|
|
||||||
html += '<div class="category-actions">';
|
|
||||||
html += '<button type="button" class="layui-btn layui-btn-primary layui-btn-xs add-child">';
|
|
||||||
html += '<i class="layui-icon layui-icon-add-1"></i>添加子分类</button>';
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
|
|
||||||
if (category.children && category.children.length > 0) {
|
|
||||||
html += '<div class="category-children">';
|
|
||||||
category.children.forEach(function (child) {
|
|
||||||
html += that.renderCategory(child, level + 1);
|
|
||||||
});
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
return html;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 绑定事件
|
|
||||||
that.bindEvents = function () {
|
|
||||||
// 点击分类项加载编辑信息
|
|
||||||
$('.category-header').off('click').on('click', function (e) {
|
|
||||||
if (!$(e.target).closest('.add-child').length) {
|
|
||||||
var id = $(this).closest('.category-item').data('id');
|
|
||||||
that.loadCategoryInfo(id);
|
|
||||||
|
|
||||||
// 添加选中效果
|
|
||||||
$('.category-header').removeClass('active');
|
|
||||||
$(this).addClass('active');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 添加子分类
|
|
||||||
$('.add-child').off('click').on('click', function (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
var parentId = $(this).closest('.category-item').data('id');
|
|
||||||
that.showCategoryForm(parentId);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 加载分类信息
|
|
||||||
that.loadCategoryInfo = function (id) {
|
|
||||||
$.get('/admin/article/cateedit?id=' + id, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
that.showCategoryForm(0, res.data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 显示分类表单
|
|
||||||
that.showCategoryForm = function (parentId = 0, data = null) {
|
|
||||||
$('#defaultTip').hide();
|
|
||||||
$('.category-form').show();
|
|
||||||
|
|
||||||
// 重置表单
|
|
||||||
form.val('categoryForm', {
|
|
||||||
id: data ? data.info.id : '',
|
|
||||||
name: data ? data.info.name : '',
|
|
||||||
cid: data ? data.info.cid : parentId,
|
|
||||||
sort: data ? data.info.sort : 0,
|
|
||||||
status: data ? data.info.status : 1
|
|
||||||
});
|
|
||||||
|
|
||||||
// 更新父级分类选项
|
|
||||||
var $select = $('select[name="cid"]');
|
|
||||||
$select.empty().append('<option value="0">顶级分类</option>');
|
|
||||||
// 获取所有分类作为父级选项
|
|
||||||
$.ajax({
|
|
||||||
url: '/admin/article/articlecate',
|
|
||||||
type: 'POST',
|
|
||||||
async: false,
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
// 当前编辑的分类ID
|
|
||||||
var currentId = data ? data.info.id : 0;
|
|
||||||
// 递归构建分类选项
|
|
||||||
function buildOptions(categories, level) {
|
|
||||||
categories.forEach(function (category) {
|
|
||||||
// 不能选择自己或自己的子分类作为父级
|
|
||||||
if (category.id != currentId) {
|
|
||||||
var prefix = new Array(level + 1).join('├─ ');
|
|
||||||
$select.append('<option value="' + category.id + '">' + prefix + category.title + '</option>'); if (category.children && category.children.length > 0) { buildOptions(category.children, level + 1); }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} buildOptions(res.data, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 设置选中的父级分类
|
|
||||||
if (data && data.info.cid) {
|
|
||||||
$select.val(data.info.cid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新图片预览
|
|
||||||
if (data && data.info.image) {
|
|
||||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', data.info.image);
|
|
||||||
$('#imageInput').val(data.info.image);
|
|
||||||
} else {
|
|
||||||
$('#uploadPreview').addClass('layui-hide').find('img').attr('src', '');
|
|
||||||
$('#imageInput').val('');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示/隐藏删除按钮
|
|
||||||
$('#deleteBtn')[data ? 'show' : 'hide']();
|
|
||||||
|
|
||||||
form.render();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化上传组件
|
|
||||||
upload.render({
|
|
||||||
elem: '#uploadImage',
|
|
||||||
url: '/admin/upload/image',
|
|
||||||
accept: 'images',
|
|
||||||
acceptMime: 'image/*',
|
|
||||||
done: function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', res.data.url);
|
|
||||||
$('#imageInput').val(res.data.url);
|
|
||||||
layer.msg('上传成功');
|
|
||||||
} else {
|
|
||||||
layer.msg('上传失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听表单提交
|
|
||||||
form.on('submit(saveCategory)', function (data) {
|
|
||||||
var url = data.field.id ? '/admin/article/cateedit' : '/admin/article/cateadd';
|
|
||||||
$.post(url, data.field, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
that.initCategoryList();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 监听删除按钮
|
|
||||||
$('#deleteBtn').on('click', function () {
|
|
||||||
var id = $('#categoryId').val();
|
|
||||||
if (!id) return;
|
|
||||||
|
|
||||||
layer.confirm('确定要删除该分类吗?', function (index) {
|
|
||||||
$.post('/admin/article/catedel', { id: id }, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
layer.msg(res.msg, { icon: 1 });
|
|
||||||
that.initCategoryList();
|
|
||||||
$('#defaultTip').show();
|
|
||||||
$('.category-form').hide();
|
|
||||||
} else {
|
|
||||||
layer.msg(res.msg, { icon: 2 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化页面
|
|
||||||
that.initCategoryList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
categoryManager.init();
|
|
||||||
|
|
||||||
// 新增分类
|
|
||||||
function add() {
|
|
||||||
categoryManager.showCategoryForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 刷新列表
|
|
||||||
function refresh() {
|
|
||||||
categoryManager.initCategoryList();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
<?php /*a:4:{s:49:"E:\Demo\PHP\yunzer\app\index\view\index\index.php";i:1746890051;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\header.php";i:1747416219;s:52:"E:\Demo\PHP\yunzer\app\index\view\component\main.php";i:1747410946;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\footer.php";i:1747402501;}*/ ?>
|
<?php /*a:4:{s:49:"E:\Demo\PHP\yunzer\app\index\view\index\index.php";i:1746890051;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\header.php";i:1747416219;s:52:"E:\Demo\PHP\yunzer\app\index\view\component\main.php";i:1747649140;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\footer.php";i:1747649140;}*/ ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
@@ -799,7 +799,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<div class="opencourse product-item" onclick="window.open('/index/article/detail?id=${article.id || ''}', '_blank')">
|
<div class="opencourse product-item" onclick="window.open('/index/articles/detail?id=${article.id || ''}', '_blank')">
|
||||||
<div class="video">
|
<div class="video">
|
||||||
<img src="${article.image || ''}" alt="" class="cover">
|
<img src="${article.image || ''}" alt="" class="cover">
|
||||||
</div>
|
</div>
|
||||||
@@ -1017,6 +1017,10 @@
|
|||||||
<p class="copyright__text">Copyright <span class="dynamic-year">2025</span> | All Rights By <a
|
<p class="copyright__text">Copyright <span class="dynamic-year">2025</span> | All Rights By <a
|
||||||
href="http://www.yunzer.cn">Yunzer</a></p>
|
href="http://www.yunzer.cn">Yunzer</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tongji">
|
||||||
|
<script id="LA-DATA-WIDGET" crossorigin="anonymous" charset="UTF-8"
|
||||||
|
src="https://v6-widget.51.la/v6/KoyzaWWEcLvPzkQn/quote.js?theme=#1690FF,#FFFFFF,#999999,#FFFFFF,#FFFFFF,#1690FF,12&f=12"></script>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user