增加文章发布功能
This commit is contained in:
parent
f879d27fac
commit
e7bcaf29f5
279
app/admin/controller/Article.php
Normal file
279
app/admin/controller/Article.php
Normal file
@ -0,0 +1,279 @@
|
||||
<?php
|
||||
/**
|
||||
* 后台管理系统-文章管理
|
||||
*/
|
||||
namespace app\admin\controller;
|
||||
use app\admin\controller\Base;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
|
||||
class Article extends Base
|
||||
{
|
||||
// 文章列表
|
||||
public function articlelist()
|
||||
{
|
||||
if (Request::isPost()) {
|
||||
$lists = Db::table('yz_article')
|
||||
->where('delete_time', null)
|
||||
->where('status', '<>', 3)
|
||||
->order('id DESC')
|
||||
->select()
|
||||
->each(function ($item) {
|
||||
$item['create_time'] = date('Y-m-d H:i:s', strtotime($item['create_time']));
|
||||
$item['publishdate'] = $item['publishdate'] ? date('Y-m-d H:i:s', strtotime($item['publishdate'])) : '';
|
||||
return $item;
|
||||
});
|
||||
return json(['code' => 0, 'msg' => '获取成功', 'data' => $lists]);
|
||||
} else {
|
||||
$lists = Db::table('yz_article')
|
||||
->where('delete_time', null)
|
||||
->where('status', '<>', 3)
|
||||
->order('id DESC')
|
||||
->select()
|
||||
->each(function ($item) {
|
||||
$item['create_time'] = date('Y-m-d H:i:s', strtotime($item['create_time']));
|
||||
return $item;
|
||||
});
|
||||
View::assign(['lists' => $lists]);
|
||||
return View::fetch();
|
||||
}
|
||||
}
|
||||
|
||||
// 添加文章
|
||||
public function add()
|
||||
{
|
||||
if (Request::isPost()) {
|
||||
$data = [
|
||||
'title' => input('post.title'),
|
||||
'cate' => input('post.cate'),
|
||||
'image' => input('post.image'),
|
||||
'content' => input('post.content'),
|
||||
'author' => input('post.author'),
|
||||
'desc' => input('post.desc'),
|
||||
'status' => input('post.status', 2),
|
||||
'publishdate' => date('Y-m-d H:i:s', time()),
|
||||
'create_time' => date('Y-m-d H:i:s', time())
|
||||
];
|
||||
|
||||
$insert = Db::table('yz_article')->insert($data);
|
||||
if (empty($insert)) {
|
||||
return json(['code' => 1, 'msg' => '添加失败', 'data' => []]);
|
||||
}
|
||||
return json(['code' => 0, 'msg' => '添加成功', 'data' => []]);
|
||||
} else {
|
||||
$lists = Db::table('yz_article')
|
||||
->order('id DESC')
|
||||
->select()
|
||||
->each(function ($item, $key) {
|
||||
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
|
||||
return $item;
|
||||
});
|
||||
View::assign([
|
||||
'lists' => $lists
|
||||
]);
|
||||
return View::fetch();
|
||||
}
|
||||
}
|
||||
|
||||
// 编辑文章
|
||||
public function edit()
|
||||
{
|
||||
if (Request::isPost()) {
|
||||
$article_id = input('post.article_id');
|
||||
$data = [
|
||||
'title' => input('post.title'),
|
||||
'content' => input('post.content'),
|
||||
'author' => input('post.author'),
|
||||
'status' => input('post.status', 1),
|
||||
'update_time' => time()
|
||||
];
|
||||
|
||||
$update = Db::table('yz_article')
|
||||
->where('article_id', $article_id)
|
||||
->update($data);
|
||||
|
||||
if ($update === false) {
|
||||
return json(['code' => 1, 'msg' => '更新失败', 'data' => []]);
|
||||
}
|
||||
return json(['code' => 0, 'msg' => '更新成功', 'data' => []]);
|
||||
} else {
|
||||
$article_id = input('get.article_id');
|
||||
$info = Db::table('yz_article')->where('article_id', $article_id)->find();
|
||||
View::assign([
|
||||
'info' => $info
|
||||
]);
|
||||
return View::fetch();
|
||||
}
|
||||
}
|
||||
|
||||
// 删除文章
|
||||
public function delete()
|
||||
{
|
||||
$id = input('post.id');
|
||||
$data = [
|
||||
'delete_time' => date('Y-m-d H:i:s', time()),
|
||||
];
|
||||
$delete = Db::table('yz_article')->where('id', $id)->update($data);
|
||||
if ($delete === false) {
|
||||
return json(['code' => 1, 'msg' => '删除失败', 'data' => []]);
|
||||
}
|
||||
return json(['code' => 0, 'msg' => '删除成功', 'data' => []]);
|
||||
}
|
||||
|
||||
// 文章分类
|
||||
public function articlecate()
|
||||
{
|
||||
if (Request::isPost()) {
|
||||
$count = Db::table('yz_article_category')
|
||||
->where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->count();
|
||||
$page = (int) input('post.page', 1);
|
||||
$limit = (int) input('post.limit', 10);
|
||||
$lists = Db::table('yz_article_category')
|
||||
->where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->order('id asc')
|
||||
->page($page, $limit)
|
||||
->select();
|
||||
return json(['code' => 0, 'msg' => '获取成功', 'data' => $lists]);
|
||||
} else {
|
||||
// 获取分类列表
|
||||
$lists = Db::table('yz_article_category')
|
||||
->where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->order('id asc')
|
||||
->select();
|
||||
|
||||
View::assign([
|
||||
'lists' => $lists
|
||||
]);
|
||||
return View::fetch();
|
||||
}
|
||||
}
|
||||
|
||||
//获取分类结构
|
||||
public function getcate()
|
||||
{
|
||||
// 获取所有分类
|
||||
$lists = Db::table('yz_article_category')
|
||||
->where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->order('sort asc, id asc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
// 构建父子结构
|
||||
$tree = [];
|
||||
foreach ($lists as $item) {
|
||||
if ($item['cid'] == 0) {
|
||||
// 顶级分类
|
||||
$tree[] = $item;
|
||||
} else {
|
||||
// 子分类
|
||||
foreach ($tree as &$parent) {
|
||||
if ($parent['id'] == $item['cid']) {
|
||||
if (!isset($parent['children'])) {
|
||||
$parent['children'] = [];
|
||||
}
|
||||
$parent['children'][] = $item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return json(['code' => 0, 'msg' => '获取成功', 'data' => $tree]);
|
||||
}
|
||||
|
||||
// 添加文章分类
|
||||
public function cateadd()
|
||||
{
|
||||
if (Request::isPost()) {
|
||||
// 将时间戳转换为 'Y-m-d H:i:s' 格式
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
$data = [
|
||||
'name' => input('post.name'),
|
||||
'cid' => input('post.cid'),
|
||||
'sort' => input('post.sort', 0),
|
||||
'status' => input('post.status', 1),
|
||||
'create_time' => $currentDateTime
|
||||
];
|
||||
|
||||
$insert = Db::table('yz_article_category')->insert($data);
|
||||
if (empty($insert)) {
|
||||
return json(['code' => 1, 'msg' => '添加失败', 'data' => []]);
|
||||
}
|
||||
return json(['code' => 0, 'msg' => '添加成功', 'data' => []]);
|
||||
} else {
|
||||
$lists = Db::table('yz_article_category')
|
||||
->order('id DESC')
|
||||
->select()
|
||||
->each(function ($item, $key) {
|
||||
$item['create_time'] = date('Y-m-d H:i:s', strtotime($item['create_time']));
|
||||
return $item;
|
||||
});
|
||||
View::assign([
|
||||
'lists' => $lists
|
||||
]);
|
||||
return View::fetch();
|
||||
}
|
||||
}
|
||||
|
||||
//编辑文章分类
|
||||
public function cateedit()
|
||||
{
|
||||
if (Request::isPost()) {
|
||||
$data = [
|
||||
'id' => input('post.id'),
|
||||
'name' => input('post.name'),
|
||||
'cid' => input('post.cid'),
|
||||
'sort' => input('post.sort', 0),
|
||||
'status' => input('post.status', 1),
|
||||
'update_time' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
$update = Db::table('yz_article_category')
|
||||
->where('id', $data['id'])
|
||||
->update($data);
|
||||
|
||||
if ($update === false) {
|
||||
return json(['code' => 1, 'msg' => '更新失败', 'data' => []]);
|
||||
}
|
||||
return json(['code' => 0, 'msg' => '更新成功', 'data' => []]);
|
||||
} else {
|
||||
$id = input('get.id');
|
||||
$info = Db::table('yz_article_category')->where('id', $id)->find();
|
||||
View::assign([
|
||||
'info' => $info
|
||||
]);
|
||||
return View::fetch();
|
||||
}
|
||||
}
|
||||
|
||||
//删除文章分类
|
||||
public function catedel()
|
||||
{
|
||||
$id = input('post.id');
|
||||
|
||||
// 检查是否有子分类
|
||||
$hasChildren = Db::table('yz_article_category')
|
||||
->where('cid', $id)
|
||||
->where('delete_time', null)
|
||||
->find();
|
||||
|
||||
if ($hasChildren) {
|
||||
return json(['code' => 1, 'msg' => '该分类下有子分类,无法删除', 'data' => []]);
|
||||
}
|
||||
|
||||
$delete = Db::table('yz_article_category')
|
||||
->where('id', $id)
|
||||
->update(['delete_time' => date('Y-m-d H:i:s')]);
|
||||
|
||||
if ($delete === false) {
|
||||
return json(['code' => 1, 'msg' => '删除失败', 'data' => []]);
|
||||
}
|
||||
return json(['code' => 0, 'msg' => '删除成功', 'data' => []]);
|
||||
}
|
||||
}
|
||||
@ -62,7 +62,7 @@ class Base{
|
||||
if($code == 0){
|
||||
$arr = array(
|
||||
'code'=>$code,
|
||||
'msg'=>'成功',
|
||||
'msg'=>'操作成功',
|
||||
'count'=> $count,
|
||||
'data' => $data
|
||||
);
|
||||
|
||||
@ -198,9 +198,9 @@ class Index extends Base{
|
||||
$a = delete_dir_file(Env::get('runtime_path').'cache/');
|
||||
$b = delete_dir_file(Env::get('runtime_path').'temp/');
|
||||
if ($a || $b) {
|
||||
$this->returnCode(0);
|
||||
$this->returnCode(0, '清除缓存成功');
|
||||
} else {
|
||||
$this->returnCode('91000006');
|
||||
$this->returnCode(1, '清除缓存失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -31,11 +31,11 @@ class Login
|
||||
if (Request::isPost()) {
|
||||
$account = trim(input('post.account'));
|
||||
if (empty($account)) {
|
||||
$this->returnCode('90000001');
|
||||
$this->returnCode(1, '账号不能为空');
|
||||
}
|
||||
$pattern = "/^([0-9A-Za-z-_.]+)@([0-9a-z]+.[a-z]{2,3}(.[a-z]{2})?)$/i";
|
||||
if (!preg_match($pattern, $account)) {
|
||||
$this->returnCode('90000006');
|
||||
$this->returnCode(1, '邮箱格式不正确');
|
||||
}
|
||||
$password = trim(input('post.password'));
|
||||
if (empty($password)) {
|
||||
@ -50,13 +50,13 @@ class Login
|
||||
}
|
||||
$aUser = Db::table('yz_admin_user')->where('account', $account)->find();
|
||||
if (empty($aUser)) {
|
||||
$this->returnCode('90000029');
|
||||
$this->returnCode(1, '账号不存在');
|
||||
}
|
||||
if ($aUser['status'] != 1) {
|
||||
$this->returnCode('90000030');
|
||||
$this->returnCode(1, '账号已被禁用');
|
||||
}
|
||||
if ($aUser['password'] != md5($password)) {
|
||||
$this->returnCode('90000031');
|
||||
$this->returnCode(1, '密码错误');
|
||||
}
|
||||
$remember = input('post.remember');
|
||||
if (!empty($remember)) {
|
||||
@ -69,7 +69,7 @@ class Login
|
||||
Db::table('yz_admin_user')->where('uid', $aUser['uid'])->update(
|
||||
['login_count' => $aUser['login_count'] + 1, 'update_time' => time()]
|
||||
);
|
||||
$this->returnCode(0, [], '登陆成功');
|
||||
$this->returnCode(0, [], '登录成功');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,38 +19,63 @@ class Yunzer extends Base{
|
||||
return View::fetch();
|
||||
}
|
||||
# 菜单添加
|
||||
public function menuadd(){
|
||||
public function menuadd()
|
||||
{
|
||||
$req = request();
|
||||
if($req->isPost()){
|
||||
if ($req->isPost()) {
|
||||
$data['label'] = trim(input('post.label'));
|
||||
if(empty($data['label'])){
|
||||
View::returnCode('90000009');
|
||||
if (empty($data['label'])) {
|
||||
$this->returnCode(1, '请输入菜单名称');
|
||||
}
|
||||
$data['icon_class'] = trim(input('post.icon_class'));
|
||||
$data['sort'] = (int)trim(input('post.sort'));
|
||||
$data['status'] = (int)trim(input('post.status'));
|
||||
$data['type'] = (int)trim(input('post.type',0));
|
||||
if($data['type'] == 1){
|
||||
$data['sort'] = (int) trim(input('post.sort'));
|
||||
$data['status'] = (int) trim(input('post.status'));
|
||||
$data['type'] = (int) trim(input('post.type', 0));
|
||||
if ($data['type'] == 1) {
|
||||
$data['src'] = trim(input('post.src1'));
|
||||
if(empty($data['src'])){
|
||||
$this->returnCode('90000012');
|
||||
if (empty($data['src'])) {
|
||||
$this->returnCode(1, '请输入内部跳转地址');
|
||||
}
|
||||
}else if($data['type'] == 2){
|
||||
} else if ($data['type'] == 2) {
|
||||
$data['src'] = trim(input('post.src2'));
|
||||
if(empty($data['src'])){
|
||||
$this->returnCode('90000013');
|
||||
if (empty($data['src'])) {
|
||||
$this->returnCode(1, '请输入超链接地址');
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$data['src'] = '';
|
||||
}
|
||||
// 保存用户
|
||||
// 保存菜单
|
||||
$res = Db::table('yz_admin_sys_menu')->insert($data);
|
||||
if(!$res){
|
||||
$this->returnCode('91000001');
|
||||
if (!$res) {
|
||||
$this->returnCode(1, '添加菜单失败');
|
||||
}
|
||||
|
||||
// 获取新插入的菜单ID
|
||||
$newMenuId = Db::table('yz_admin_sys_menu')->getLastInsID();
|
||||
|
||||
// 获取所有管理员用户组
|
||||
$adminGroups = Db::table('yz_admin_user_group')->select();
|
||||
foreach ($adminGroups as $group) {
|
||||
// 获取现有权限
|
||||
$rights = [];
|
||||
if (!empty($group['rights'])) {
|
||||
$rights = json_decode($group['rights'], true);
|
||||
}
|
||||
|
||||
// 添加新菜单ID到权限列表
|
||||
if (!in_array($newMenuId, $rights)) {
|
||||
$rights[] = $newMenuId;
|
||||
|
||||
// 更新用户组权限
|
||||
Db::table('yz_admin_user_group')
|
||||
->where('group_id', $group['group_id'])
|
||||
->update(['rights' => json_encode($rights)]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
$iconfont = Db::table('yz_z_iconfont')->where('status',1)->select();
|
||||
} else {
|
||||
$iconfont = Db::table('yz_z_iconfont')->where('status', 1)->select();
|
||||
View::assign([
|
||||
'iconfont' => $iconfont
|
||||
]);
|
||||
@ -64,7 +89,7 @@ class Yunzer extends Base{
|
||||
$smid = (int)input('post.smid');
|
||||
$data['label'] = trim(input('post.label'));
|
||||
if(!$data['label']){
|
||||
$this->returnCode('90000009');
|
||||
$this->returnCode(1, '请输入菜单名称');
|
||||
}
|
||||
$data['icon_class'] = trim(input('post.icon_class'));
|
||||
$data['sort'] = (int)trim(input('post.sort'));
|
||||
@ -73,12 +98,12 @@ class Yunzer extends Base{
|
||||
if($data['type'] == 1){
|
||||
$data['src'] = trim(input('post.src1'));
|
||||
if(empty($data['src'])){
|
||||
$this->returnCode('90000012');
|
||||
$this->returnCode(1, '请输入内部跳转地址');
|
||||
}
|
||||
}else if($data['type'] == 2){
|
||||
$data['src'] = trim(input('post.src2'));
|
||||
if(empty($data['src'])){
|
||||
$this->returnCode('90000013');
|
||||
$this->returnCode(1, '请输入超链接地址');
|
||||
}
|
||||
}else{
|
||||
$data['src'] = '';
|
||||
@ -86,7 +111,7 @@ class Yunzer extends Base{
|
||||
// 保存用户
|
||||
$res = Db::table('yz_admin_sys_menu')->where('smid',$smid)->update($data);
|
||||
if(!$res){
|
||||
$this->returnCode('91000002');
|
||||
$this->returnCode(1, '修改菜单失败');
|
||||
}
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
@ -105,11 +130,11 @@ class Yunzer extends Base{
|
||||
$smid = (int)input('post.smid');
|
||||
$count = Db::table('yz_admin_sys_menu')->where('parent_id',$smid)->count();
|
||||
if($count > 0){
|
||||
$this->returnCode('90000010');
|
||||
$this->returnCode(1, '该菜单下还有子菜单,不能删除');
|
||||
}
|
||||
$res = Db::table('yz_admin_sys_menu')->where('smid',$smid)->delete();
|
||||
if(empty($res)){
|
||||
$this->returnCode('91000003');
|
||||
$this->returnCode(1, '删除菜单失败');
|
||||
}
|
||||
$this->returnCode(0);
|
||||
}
|
||||
@ -148,30 +173,30 @@ class Yunzer extends Base{
|
||||
$smid = (int)input('post.smid');
|
||||
$data['label'] = trim(input('post.label'));
|
||||
if(!$data['label']){
|
||||
$this->returnCode('90000015');
|
||||
$this->returnCode(1, '请输入按钮名称');
|
||||
}
|
||||
$data['icon_class'] = trim(input('post.icon_class'));
|
||||
$data['sort'] = (int)trim(input('post.sort'));
|
||||
$data['status'] = (int)trim(input('post.status'));
|
||||
$data['type'] = (int)trim(input('post.type'));
|
||||
if(empty($data['type'])){
|
||||
$this->returnCode('90000011');
|
||||
$this->returnCode(1, '请选择按钮类型');
|
||||
}
|
||||
if($data['type'] == 1){
|
||||
$data['src'] = trim(input('post.src1'));
|
||||
if(empty($data['src'])){
|
||||
$this->returnCode('90000012');
|
||||
$this->returnCode(1, '请输入内部跳转地址');
|
||||
}
|
||||
}else if($data['type'] == 2){
|
||||
$data['src'] = trim(input('post.src2'));
|
||||
if(empty($data['src'])){
|
||||
$this->returnCode('90000013');
|
||||
$this->returnCode(1, '请输入超链接地址');
|
||||
}
|
||||
}
|
||||
$data['parent_id'] = $smid;
|
||||
$res = Db::table('yz_admin_sys_menu')->insert($data);
|
||||
if(!$res){
|
||||
$this->returnCode('91000001');
|
||||
$this->returnCode(1, '添加按钮失败');
|
||||
}
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
@ -191,29 +216,29 @@ class Yunzer extends Base{
|
||||
$smid = (int)input('post.smid');
|
||||
$data['label'] = trim(input('post.label'));
|
||||
if(!$data['label']){
|
||||
$this->returnCode('90000015');
|
||||
$this->returnCode(1, '请输入按钮名称');
|
||||
}
|
||||
$data['icon_class'] = trim(input('post.icon_class'));
|
||||
$data['sort'] = (int)trim(input('post.sort'));
|
||||
$data['status'] = (int)trim(input('post.status'));
|
||||
$data['type'] = (int)trim(input('post.type'));
|
||||
if(empty($data['type'])){
|
||||
$this->returnCode('90000011');
|
||||
$this->returnCode(1, '请选择按钮类型');
|
||||
}
|
||||
if($data['type'] == 1){
|
||||
$data['src'] = trim(input('post.src1'));
|
||||
if(empty($data['src'])){
|
||||
$this->returnCode('90000012');
|
||||
$this->returnCode(1, '请输入内部跳转地址');
|
||||
}
|
||||
}else if($data['type'] == 2){
|
||||
$data['src'] = trim(input('post.src2'));
|
||||
if(empty($data['src'])){
|
||||
$this->returnCode('90000013');
|
||||
$this->returnCode(1, '请输入超链接地址');
|
||||
}
|
||||
}
|
||||
$res = Db::table('yz_admin_sys_menu')->where('smid',$smid)->update($data);
|
||||
if(!$res){
|
||||
$this->returnCode('91000002');
|
||||
$this->returnCode(1, '修改按钮失败');
|
||||
}
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
@ -232,7 +257,7 @@ class Yunzer extends Base{
|
||||
$smid = (int)input('post.smid');
|
||||
$res = Db::table('yz_admin_sys_menu')->where('smid',$smid)->delete();
|
||||
if(empty($res)){
|
||||
$this->returnCode('91000003');
|
||||
$this->returnCode(1, '删除按钮失败');
|
||||
}
|
||||
$this->returnCode(0);
|
||||
}
|
||||
@ -267,7 +292,7 @@ class Yunzer extends Base{
|
||||
$data['config_sort'] = trim(input('post.config_sort'));
|
||||
$res = Db::table('yz_admin_config')->insert($data);
|
||||
if(empty($res)){
|
||||
$this->returnCode('91000001');
|
||||
$this->returnCode(1, '添加配置失败');
|
||||
}
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
@ -296,7 +321,7 @@ class Yunzer extends Base{
|
||||
$data['config_sort'] = trim(input('post.config_sort'));
|
||||
$res = Db::table('yz_admin_config')->where('config_id',$config_id)->update($data);
|
||||
if(empty($res)){
|
||||
$this->returnCode('91000002');
|
||||
$this->returnCode(1, '修改配置失败');
|
||||
}
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
@ -316,7 +341,7 @@ class Yunzer extends Base{
|
||||
}
|
||||
$res = Db::table('yz_admin_config')->where('config_id',$config_id)->delete();
|
||||
if(empty($res)){
|
||||
$this->returnCode('91000003');
|
||||
$this->returnCode(1, '删除配置失败');
|
||||
}
|
||||
$this->returnCode(0);
|
||||
}
|
||||
@ -331,7 +356,7 @@ class Yunzer extends Base{
|
||||
$oConfig = new YzAdminConfig();
|
||||
$updateAll = $oConfig->updateAll($post);
|
||||
if(empty($updateAll)){
|
||||
$this->returnCode('91000002');
|
||||
$this->returnCode(1, '更新配置值失败');
|
||||
}
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
|
||||
226
app/admin/view/article/add.php
Normal file
226
app/admin/view/article/add.php
Normal file
@ -0,0 +1,226 @@
|
||||
{include file="public/header" /}
|
||||
<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: 500px;"><!-- 编辑器 --></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: '{: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('{: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: '{: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 () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
parent.location.reload();
|
||||
}, 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 = {
|
||||
placeholder: '请输入内容...',
|
||||
onChange(editor) {
|
||||
const html = editor.getHtml()
|
||||
// console.log('editor content', html)
|
||||
// 也可以同步到 <textarea>
|
||||
},
|
||||
}
|
||||
|
||||
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>
|
||||
137
app/admin/view/article/articlecate.php
Normal file
137
app/admin/view/article/articlecate.php
Normal file
@ -0,0 +1,137 @@
|
||||
{include file="public/header" /}
|
||||
<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="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 class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20">ID</th>
|
||||
<th width="120">分类名称</th>
|
||||
<th>描述</th>
|
||||
<th width="80">排序</th>
|
||||
<th width="80">状态</th>
|
||||
<th width="180">创建时间</th>
|
||||
<th width="240">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="lists" id='vo'}
|
||||
{if condition="$vo.cid eq 0"}
|
||||
<tr>
|
||||
<td>{$vo.id}</td>
|
||||
<td>{$vo.name}</td>
|
||||
<td>{$vo.desc}</td>
|
||||
<td>{$vo.sort}</td>
|
||||
<td>{$vo.status==1?'开启':'<span style="color:red;">禁用</span>'}</td>
|
||||
<td>{$vo.create_time}</td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs"
|
||||
onclick="addchanel({$vo.id})">
|
||||
<i class="layui-icon layui-icon-add-1"></i>添加子栏目
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit({$vo.id})">
|
||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="del({$vo.id})">
|
||||
<i class="layui-icon layui-icon-delete"></i>删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{volist name="lists" id='sub'}
|
||||
{if condition="$sub.cid eq $vo.id"}
|
||||
<tr>
|
||||
<td>{$sub.id}</td>
|
||||
<td style="padding-left: 30px;">├─ {$sub.name}</td>
|
||||
<td>{$sub.desc}</td>
|
||||
<td>{$sub.sort}</td>
|
||||
<td>{$sub.status==1?'开启':'<span style="color:red;">禁用</span>'}</td>
|
||||
<td>{$sub.create_time}</td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit({$sub.id})">
|
||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="del({$sub.id})">
|
||||
<i class="layui-icon layui-icon-delete"></i>删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{/volist}
|
||||
{/if}
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
layui.use(['layer'], function () {
|
||||
layer = layui.layer;
|
||||
$ = layui.jquery;
|
||||
});
|
||||
|
||||
function add() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '添加分类',
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['800px', '600px'],
|
||||
content: '{:url("article/cateadd")}'
|
||||
});
|
||||
}
|
||||
|
||||
function edit(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '编辑分类',
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['500px', '400px'],
|
||||
content: '{:url("article/cateedit")}?id=' + id
|
||||
});
|
||||
}
|
||||
|
||||
function del(id) {
|
||||
layer.confirm('确定要删除该分类吗?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
$.post('{:url("article/catedel")}', { id: id }, function (res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
window.location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function addchanel(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '添加子栏目',
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['800px', '600px'],
|
||||
content: '{:url("article/cateadd")}?cid=' + id
|
||||
});
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
window.location.reload();
|
||||
}
|
||||
</script>
|
||||
106
app/admin/view/article/articlelist.php
Normal file
106
app/admin/view/article/articlelist.php
Normal file
@ -0,0 +1,106 @@
|
||||
{include file="public/header" /}
|
||||
<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="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 class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20">ID</th>
|
||||
<th>标题</th>
|
||||
<th>分类</th>
|
||||
<th>封面</th>
|
||||
<th>作者</th>
|
||||
<th>状态</th>
|
||||
<th>发布时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="lists" id='vo'}
|
||||
<tr>
|
||||
<td>{$vo.id}</td>
|
||||
<td>{$vo.title}</td>
|
||||
<td>{$vo.cate}</td>
|
||||
<td>
|
||||
{if condition="$vo.image"}
|
||||
<img src="{$vo.image}" style="max-width: 50px; max-height: 50px;">
|
||||
{/if}
|
||||
</td>
|
||||
<td>{$vo.author}</td>
|
||||
<td>
|
||||
{switch name="vo.status"}
|
||||
{case value="0"}<span style="color:red;">草稿</span>{/case}
|
||||
{case value="1"}<span style="color:orange;">待审核</span>{/case}
|
||||
{case value="2"}<span style="color:green;">已发布</span>{/case}
|
||||
{case value="3"}<span style="color:gray;">隐藏</span>{/case}
|
||||
{/switch}
|
||||
</td>
|
||||
<td>{$vo.publishdate}</td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit({$vo.id})">
|
||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="del({$vo.id})">
|
||||
<i class="layui-icon layui-icon-delete"></i>删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
layui.use(['layer'], function () {
|
||||
layer = layui.layer;
|
||||
$ = layui.jquery;
|
||||
});
|
||||
|
||||
function add() {
|
||||
window.location.href = '{:url("article/add")}';
|
||||
}
|
||||
|
||||
function edit(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '编辑文章',
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['800px', '600px'],
|
||||
content: '{:url("article/edit")}?id=' + id
|
||||
});
|
||||
}
|
||||
|
||||
function del(id) {
|
||||
layer.confirm('确定要删除该文章吗?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
$.post('{:url("article/delete")}', { id: id }, function (res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
window.location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
window.location.reload();
|
||||
}
|
||||
</script>
|
||||
77
app/admin/view/article/cateadd.php
Normal file
77
app/admin/view/article/cateadd.php
Normal file
@ -0,0 +1,77 @@
|
||||
{include file="public/header" /}
|
||||
<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('{: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('{: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>
|
||||
90
app/admin/view/article/cateedit.php
Normal file
90
app/admin/view/article/cateedit.php
Normal file
@ -0,0 +1,90 @@
|
||||
{include file="public/header" /}
|
||||
<div style="padding: 50px;padding-bottom: 0px;">
|
||||
<form class="layui-form" action="" method="post">
|
||||
<input type="hidden" name="id" value="{$info.id}">
|
||||
<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="{$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="{$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>
|
||||
layui.use(['form', 'layer'], function () {
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
var $ = layui.jquery;
|
||||
|
||||
// 获取URL中的id参数
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
var id = urlParams.get('id');
|
||||
|
||||
// 获取分类列表
|
||||
$.get('{:url("article/getcate")}', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="0">顶级分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
// 排除自己及其子分类作为父级选项
|
||||
if(item.id != id) {
|
||||
html += '<option value="' + item.id + '"' + (item.id == {$info.cid} ? ' selected' : '') + '>' + item.name + '</option>';
|
||||
}
|
||||
});
|
||||
$('#cid').html(html);
|
||||
form.render('select');
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
}
|
||||
});
|
||||
|
||||
// 表单提交
|
||||
form.on('submit(formSubmit)', function (data) {
|
||||
$.post('{: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>
|
||||
@ -5,8 +5,9 @@
|
||||
<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/css/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/third/layui/css/layui.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="__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;}
|
||||
|
||||
27
public/static/css/wangeditor.css
Normal file
27
public/static/css/wangeditor.css
Normal file
File diff suppressed because one or more lines are too long
24129
public/static/js/wangeditor.js
Normal file
24129
public/static/js/wangeditor.js
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 173 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 173 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 173 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 173 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 173 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 173 KiB |
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\index\welcome.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<?php /*a:3:{s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\index\welcome.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746778404;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -6,8 +6,9 @@
|
||||
<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/css/moban.css" media="all"/>
|
||||
<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;}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:75:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzertest\test_static_list.php";i:1745483534;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1745564348;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1745482530;}*/ ?>
|
||||
<?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:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:69:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\groupedit.php";i:1745570765;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1745564348;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1745482530;}*/ ?>
|
||||
<?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:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
320
runtime/admin/temp/4a16c5a5006908b0b790472a2898d2bf.php
Normal file
320
runtime/admin/temp/4a16c5a5006908b0b790472a2898d2bf.php
Normal file
@ -0,0 +1,320 @@
|
||||
<?php /*a:2:{s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\add.php";i:1746782028;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746778404;}*/ ?>
|
||||
<!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">
|
||||
</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: 500px;"><!-- 编辑器 --></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 () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
parent.location.reload();
|
||||
}, 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 = {
|
||||
placeholder: '请输入内容...',
|
||||
onChange(editor) {
|
||||
const html = editor.getHtml()
|
||||
// console.log('editor content', html)
|
||||
// 也可以同步到 <textarea>
|
||||
},
|
||||
}
|
||||
|
||||
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>
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:63:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\menuinfo.php";i:1745566591;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1745564348;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1745482530;}*/ ?>
|
||||
<?php /*a:3:{s:63:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\menuinfo.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
216
runtime/admin/temp/5fcc0e440c64e4a69fa6ab9d4849f68a.php
Normal file
216
runtime/admin/temp/5fcc0e440c64e4a69fa6ab9d4849f68a.php
Normal file
@ -0,0 +1,216 @@
|
||||
<?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:1746709977;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/css/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/third/layui/css/layui.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;">
|
||||
<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,4 +1,4 @@
|
||||
<?php /*a:3:{s:63:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\menuedit.php";i:1745504993;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1745564348;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1745482530;}*/ ?>
|
||||
<?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:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
196
runtime/admin/temp/a4422e18098f908e0359a72e8b02a77c.php
Normal file
196
runtime/admin/temp/a4422e18098f908e0359a72e8b02a77c.php
Normal file
@ -0,0 +1,196 @@
|
||||
<?php /*a:2:{s:67:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\articlelist.php";i:1746783178;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746778404;}*/ ?>
|
||||
<!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="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 class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20">ID</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['id']); ?></td>
|
||||
<td><?php echo htmlentities((string) $vo['title']); ?></td>
|
||||
<td><?php echo htmlentities((string) $vo['cate']); ?></td>
|
||||
<td>
|
||||
<?php if($vo['image']): ?>
|
||||
<img src="<?php echo htmlentities((string) $vo['image']); ?>" style="max-width: 50px; max-height: 50px;">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?php echo htmlentities((string) $vo['author']); ?></td>
|
||||
<td>
|
||||
<?php switch($vo['status']): case "0": ?><span style="color:red;">草稿</span><?php break; case "1": ?><span style="color:orange;">待审核</span><?php break; case "2": ?><span style="color:green;">已发布</span><?php break; case "3": ?><span style="color:gray;">隐藏</span><?php break; ?>
|
||||
<?php endswitch; ?>
|
||||
</td>
|
||||
<td><?php echo htmlentities((string) $vo['publishdate']); ?></td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit(<?php echo htmlentities((string) $vo['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['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() {
|
||||
window.location.href = '<?php echo url("article/add"); ?>';
|
||||
}
|
||||
|
||||
function edit(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '编辑文章',
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['800px', '600px'],
|
||||
content: '<?php echo url("article/edit"); ?>?id=' + id
|
||||
});
|
||||
}
|
||||
|
||||
function del(id) {
|
||||
layer.confirm('确定要删除该文章吗?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
$.post('<?php echo url("article/delete"); ?>', { id: id }, function (res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
window.location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
window.location.reload();
|
||||
}
|
||||
</script>
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:69:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\groupinfo.php";i:1745570756;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1745564348;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1745482530;}*/ ?>
|
||||
<?php /*a:3:{s:69:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\groupinfo.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:62:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\menuadd.php";i:1745507043;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1745500576;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1745482530;}*/ ?>
|
||||
<?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:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -6,6 +6,7 @@
|
||||
<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/css/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/third/layui/css/layui.css" media="all"/>
|
||||
<style type="text/css">
|
||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
||||
|
||||
183
runtime/admin/temp/b2b7ed878a16cded7916ccc3ff270d4b.php
Normal file
183
runtime/admin/temp/b2b7ed878a16cded7916ccc3ff270d4b.php
Normal file
@ -0,0 +1,183 @@
|
||||
<?php /*a:2:{s:64:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\cateedit.php";i:1746776155;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.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/css/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/third/layui/css/layui.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 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">
|
||||
<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>
|
||||
layui.use(['form', 'layer'], function () {
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
var $ = layui.jquery;
|
||||
|
||||
// 获取URL中的id参数
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
var id = urlParams.get('id');
|
||||
|
||||
// 获取分类列表
|
||||
$.get('<?php echo url("article/getcate"); ?>', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="0">顶级分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
// 排除自己及其子分类作为父级选项
|
||||
if(item.id != id) {
|
||||
html += '<option value="' + item.id + '"' + (item.id == <?php echo htmlentities((string) $info['cid']); ?> ? ' 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:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\userinfo.php";i:1745571449;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1745564348;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1745482530;}*/ ?>
|
||||
<?php /*a:3:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzeradmin\userinfo.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:65:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\buttoninfo.php";i:1745505170;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1745564348;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1745482530;}*/ ?>
|
||||
<?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:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:65:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzer\buttonedit.php";i:1745483534;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1745564348;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1745482530;}*/ ?>
|
||||
<?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:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
170
runtime/admin/temp/da1e5ef515e9305545e65d884dd881a9.php
Normal file
170
runtime/admin/temp/da1e5ef515e9305545e65d884dd881a9.php
Normal file
@ -0,0 +1,170 @@
|
||||
<?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: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/css/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/third/layui/css/layui.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 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>
|
||||
229
runtime/admin/temp/fed9a1a8ceb5c7246f7bfd4eaf6ebab4.php
Normal file
229
runtime/admin/temp/fed9a1a8ceb5c7246f7bfd4eaf6ebab4.php
Normal file
@ -0,0 +1,229 @@
|
||||
<?php /*a:2:{s:67:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\article\articlecate.php";i:1746775555;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746778404;}*/ ?>
|
||||
<!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="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 class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20">ID</th>
|
||||
<th width="120">分类名称</th>
|
||||
<th>描述</th>
|
||||
<th width="80">排序</th>
|
||||
<th width="80">状态</th>
|
||||
<th width="180">创建时间</th>
|
||||
<th width="240">操作</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;if($vo['cid'] == 0): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlentities((string) $vo['id']); ?></td>
|
||||
<td><?php echo htmlentities((string) $vo['name']); ?></td>
|
||||
<td><?php echo htmlentities((string) $vo['desc']); ?></td>
|
||||
<td><?php echo htmlentities((string) $vo['sort']); ?></td>
|
||||
<td><?php echo $vo['status']==1 ? '开启' : '<span style="color:red;">禁用</span>'; ?></td>
|
||||
<td><?php echo htmlentities((string) $vo['create_time']); ?></td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs"
|
||||
onclick="addchanel(<?php echo htmlentities((string) $vo['id']); ?>)">
|
||||
<i class="layui-icon layui-icon-add-1"></i>添加子栏目
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit(<?php echo htmlentities((string) $vo['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['id']); ?>)">
|
||||
<i class="layui-icon layui-icon-delete"></i>删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?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=>$sub): $mod = ($i % 2 );++$i;if($sub['cid'] == $vo['id']): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlentities((string) $sub['id']); ?></td>
|
||||
<td style="padding-left: 30px;">├─ <?php echo htmlentities((string) $sub['name']); ?></td>
|
||||
<td><?php echo htmlentities((string) $sub['desc']); ?></td>
|
||||
<td><?php echo htmlentities((string) $sub['sort']); ?></td>
|
||||
<td><?php echo $sub['status']==1 ? '开启' : '<span style="color:red;">禁用</span>'; ?></td>
|
||||
<td><?php echo htmlentities((string) $sub['create_time']); ?></td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit(<?php echo htmlentities((string) $sub['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) $sub['id']); ?>)">
|
||||
<i class="layui-icon layui-icon-delete"></i>删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
||||
<?php endif; ?>
|
||||
<?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: '添加分类',
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['800px', '600px'],
|
||||
content: '<?php echo url("article/cateadd"); ?>'
|
||||
});
|
||||
}
|
||||
|
||||
function edit(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '编辑分类',
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['500px', '400px'],
|
||||
content: '<?php echo url("article/cateedit"); ?>?id=' + id
|
||||
});
|
||||
}
|
||||
|
||||
function del(id) {
|
||||
layer.confirm('确定要删除该分类吗?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
$.post('<?php echo url("article/catedel"); ?>', { id: id }, function (res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
window.location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function addchanel(id) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '添加子栏目',
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['800px', '600px'],
|
||||
content: '<?php echo url("article/cateadd"); ?>?cid=' + id
|
||||
});
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
window.location.reload();
|
||||
}
|
||||
</script>
|
||||
Loading…
x
Reference in New Issue
Block a user