勾股CMS3.0

This commit is contained in:
hdm 2022-05-31 22:01:51 +08:00
parent c984dd4f1c
commit 21330471c5
939 changed files with 39064 additions and 162630 deletions

View File

@ -22,12 +22,26 @@ class Api extends BaseController
public function upload()
{
$param = get_params();
if (request()->file('file')) {
$file = request()->file('file');
} else {
return to_assign(1, '没有选择上传文件');
}
// dump($file);die;
//var_dump($param);exit;
$sourse = 'file';
if(isset($param['sourse'])){
$sourse = $param['sourse'];
}
if($sourse == 'file' || $sourse == 'tinymce'){
if(request()->file('file')){
$file = request()->file('file');
}
else{
return to_assign(1, '没有选择上传文件');
}
}
else{
if (request()->file('editormd-image-file')) {
$file = request()->file('editormd-image-file');
} else {
return to_assign(1, '没有选择上传文件');
}
}
// 获取上传文件的hash散列值
$sha1 = $file->hash('sha1');
$md5 = $file->hash('md5');
@ -87,69 +101,22 @@ class Api extends BaseController
$res['name'] = $data['name'];
$res['filename'] = $data['filename'];
add_log('upload', $data['user_id'], $data);
return to_assign(0, '上传成功', $res);
if($sourse == 'editormd'){
//editormd编辑器上传返回
return json(['success'=>1,'message'=>'上传成功','url'=>$data['filepath']]);
}
else if($sourse == 'tinymce'){
//tinymce编辑器上传返回
return json(['success'=>1,'message'=>'上传成功','location'=>$data['filepath']]);
}
else{
//普通上传返回
return to_assign(0, '上传成功', $res);
}
} else {
return to_assign(1, '上传失败,请重试');
}
}
//编辑器图片上传
public function md_upload()
{
$param = get_params();
if (request()->file('editormd-image-file')) {
$file = request()->file('editormd-image-file');
} else {
return to_assign(1, '没有选择上传文件');
}
// dump($file);die;
// 获取上传文件的hash散列值
$sha1 = $file->hash('sha1');
$md5 = $file->hash('md5');
$rule = [
'image' => 'jpg,png,jpeg,gif',
'doc' => 'doc,docx,ppt,pptx,xls,xlsx,pdf',
'file' => 'zip,gz,7z,rar,tar',
];
$fileExt = $rule['image'] . ',' . $rule['doc'] . ',' . $rule['file'];
//1M=1024*1024=1048576字节
$fileSize = 2 * 1024 * 1024;
if (isset($param['type']) && $param['type']) {
$fileExt = $rule[$param['type']];
}
if (isset($param['size']) && $param['size']) {
$fileSize = $param['size'];
}
$validate = \think\facade\Validate::rule([
'image' => 'require|fileSize:' . $fileSize . '|fileExt:' . $fileExt,
]);
$file_check['image'] = $file;
if (!$validate->check($file_check)) {
return json(['success'=>0,'message'=>$validate->getError(),'url'=>'']);
}
// 日期前綴
$dataPath = date('Ym');
$use = 'thumb';
$filename = \think\facade\Filesystem::disk('public')->putFile($dataPath, $file, function () use ($md5) {
return $md5;
});
if ($filename) {
//写入到附件表
$data = [];
$path = get_config('filesystem.disks.public.url');
$data['filepath'] = $path . '/' . $filename;
$data['name'] = $file->getOriginalName();
$data['mimetype'] = $file->getOriginalMime();
$data['fileext'] = $file->extension();
$data['filesize'] = $file->getSize();
$data['filename'] = $filename;
$data['sha1'] = $sha1;
$data['md5'] = $md5;
return json(['success'=>1,'message'=>'上传成功','url'=>$data['filepath']]);
} else {
return json(['success'=>0,'message'=>'上传失败','url'=>'']);
}
}
//获取权限树所需的节点列表
public function get_rule()

View File

@ -151,16 +151,15 @@ class Article extends BaseController
if (isset($param['table-align'])) {
unset($param['table-align']);
}
if (isset($param['content'])) {
$param['md_content'] = '';
}
if (isset($param['docContent-html-code'])) {
$param['content'] = $param['docContent-html-code'];
$param['md_content'] = $param['docContent-markdown-doc'];
unset($param['docContent-html-code']);
unset($param['docContent-markdown-doc']);
}
if (isset($param['ueditorcontent'])) {
$param['content'] = $param['ueditorcontent'];
$param['md_content'] = '';
}
$DbRes=false;
if (!empty($param['id']) && $param['id'] > 0) {
try {
@ -246,6 +245,9 @@ class Article extends BaseController
View::assign('editor', get_system_config('other','editor'));
if ($id > 0) {
$article = (new ArticleList())->detail($id);
if(empty($article['md_content'])){
View::assign('editor',1);
}
View::assign('article', $article);
return view('edit');
}

View File

@ -103,13 +103,22 @@ class Conf extends BaseController
} else {
$id = isset($param['id']) ? $param['id'] : 0;
$conf = Db::name('Config')->where('id', $id)->find();
$module = strtolower(app('http')->getName());
$class = strtolower(app('request')->controller());
$action = strtolower(app('request')->action());
$template = $module . '/view/'. $class .'/'.$conf['name'].'.html';
$config = [];
if ($conf['content']) {
$config = unserialize($conf['content']);
}
View::assign('id', $id);
View::assign('config', $config);
return view($conf['name']);
if(isTemplate($template)){
return view($conf['name']);
}else{
return view('common/errortemplate',['file' =>$template]);
}
}
}
}

View File

@ -151,16 +151,15 @@ class Goods extends BaseController
if (isset($param['table-align'])) {
unset($param['table-align']);
}
if (isset($param['content'])) {
$param['md_content'] = '';
}
if (isset($param['docContent-html-code'])) {
$param['content'] = $param['docContent-html-code'];
$param['md_content'] = $param['docContent-markdown-doc'];
unset($param['docContent-html-code']);
unset($param['docContent-markdown-doc']);
}
if (isset($param['ueditorcontent'])) {
$param['content'] = $param['ueditorcontent'];
$param['md_content'] = '';
}
$DbRes=false;
if (isset($param['tag_values']) && $param['tag_values']) {
$param['tag_values'] = implode(',',$param['tag_values']);
@ -178,7 +177,7 @@ class Goods extends BaseController
$res = GoodsList::strict(false)->field(true)->update($param);
$aid = $param['id'];
if ($res) {
//关联角色
//关联关键字
if (isset($param['keyword_names']) && $param['keyword_names']) {
Db::name('GoodsKeywords')->where(['aid'=>$aid])->delete();
$keywordArray = explode(',', $param['keyword_names']);
@ -214,7 +213,7 @@ class Goods extends BaseController
}
$aid = GoodsList::strict(false)->field(true)->insertGetId($param);
if ($aid) {
//关联角色
//关联关键字
if (isset($param['keyword_names']) && $param['keyword_names']) {
Db::name('GoodsKeywords')->where(['aid'=>$aid])->delete();
$keywordArray = explode(',', $param['keyword_names']);

View File

@ -70,16 +70,9 @@ class Level extends BaseController
public function disable()
{
$param = get_params();
$module = Db::name('AdminModule')->where('id',$param['id'])->find();
if($module['type'] == 1){
return to_assign(1,'系统模块不能禁用');
}
$param['update_time']= time();
$res = Db::name('AdminModule')->strict(false)->field('status,update_time')->update($param);
$res = Db::name('UserLevel')->strict(false)->field('status,update_time')->update($param);
if($res!==false){
Db::name('AdminRule')->strict(false)->where('module',$module['name'])->field('status')->update(['status'=>$param['status']]);
// 删除后台节点缓存
clear_cache('adminRules');
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}

View File

@ -32,12 +32,12 @@ class Module extends BaseController
{
$param = get_params();
if (request()->isAjax()) {
$param['name'] = preg_replace('# #','',$param['name']);
$param['name'] = preg_replace('# #', '', $param['name']);
if ($param['id'] > 0) {
$module = Db::name('AdminModule')->where('id',$param['id'])->find();
if($module['type'] == 1){
return to_assign(1,'系统默认模块不能编辑');
}
$module = Db::name('AdminModule')->where('id', $param['id'])->find();
if ($module['type'] == 1) {
return to_assign(1, '系统默认模块不能编辑');
}
try {
validate(ModuleCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
@ -61,8 +61,8 @@ class Module extends BaseController
return to_assign();
} else {
$id = isset($param['id']) ? $param['id'] : 0;
if($id>0){
$detail = Db::name('AdminModule')->where('id',$id)->find();
if ($id > 0) {
$detail = Db::name('AdminModule')->where('id', $id)->find();
View::assign('detail', $detail);
}
View::assign('id', $id);
@ -74,26 +74,24 @@ class Module extends BaseController
public function disable()
{
$param = get_params();
$module = Db::name('AdminModule')->where('id',$param['id'])->find();
if($module['type'] == 1){
return to_assign(1,'系统模块不能禁用');
}
$param['update_time']= time();
$res = Db::name('AdminModule')->strict(false)->field('status,update_time')->update($param);
if($res!==false){
Db::name('AdminRule')->strict(false)->where('module',$module['name'])->field('status')->update(['status'=>$param['status']]);
// 删除后台节点缓存
$module = Db::name('AdminModule')->where('id', $param['id'])->find();
if ($module['type'] == 1) {
return to_assign(1, '系统模块不能禁用');
}
$param['update_time'] = time();
$res = Db::name('AdminModule')->strict(false)->field('status,update_time')->update($param);
if ($res !== false) {
Db::name('AdminRule')->strict(false)->where('module', $module['name'])->field('status')->update(['status' => $param['status']]);
// 删除后台节点缓存
clear_cache('adminRules');
if($param['status'] == 0){
add_log('disable', $param['id'], $param);
}
else if($param['status'] == 1){
add_log('recovery', $param['id'], $param);
}
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
if ($param['status'] == 0) {
add_log('disable', $param['id'], $param);
} else if ($param['status'] == 1) {
add_log('recovery', $param['id'], $param);
}
return to_assign();
} else {
return to_assign(1, '操作失败');
}
}
}

View File

@ -0,0 +1,171 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\admin\controller;
use app\admin\BaseController;
use app\admin\model\Pages as PagesList;
use app\admin\model\Keywords;
use app\admin\validate\PagesCheck;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Pages extends BaseController
{
public function index()
{
if (request()->isAjax()) {
$param = get_params();
$where = array();
if (!empty($param['keywords'])) {
$where[] = ['id|title|keywords|desc|content', 'like', '%' . $param['keywords'] . '%'];
}
$where[] = ['status', '>=', 0];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = PagesList::where($where)
->field('id,title,status,create_time')
->order('create_time desc')
->paginate($rows, false, ['query' => $param]);
return table_assign(0, '', $content);
}
else{
return view();
}
}
//添加&&编辑
public function add()
{
$param = get_params();
if (request()->isAjax()) {
if (isset($param['table-align'])) {
unset($param['table-align']);
}
if (isset($param['content'])) {
$param['md_content'] = '';
}
if (isset($param['docContent-html-code'])) {
$param['content'] = $param['docContent-html-code'];
$param['md_content'] = $param['docContent-markdown-doc'];
unset($param['docContent-html-code']);
unset($param['docContent-markdown-doc']);
}
$DbRes=false;
if (!empty($param['id']) && $param['id'] > 0) {
try {
validate(PagesCheck::class)->scene('edit')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['update_time'] = time();
Db::startTrans();
try {
$res = PagesList::strict(false)->field(true)->update($param);
$aid = $param['id'];
if ($res) {
//关联关键字
if (isset($param['keyword_names']) && $param['keyword_names']) {
Db::name('PagesKeywords')->where(['aid'=>$aid])->delete();
$keywordArray = explode(',', $param['keyword_names']);
$res_keyword = (new PagesList())->insertKeyword($keywordArray,$aid);
}
else{
$res_keyword == true;
}
if($res_keyword!== false){
add_log('edit', $param['id'], $param);
Db::commit();
$DbRes=true;
}
} else {
Db::rollback();
}
}
catch (\Exception $e) { ##这里参数不能删除($e错误信息)
Db::rollback();
}
} else {
try {
validate(PagesCheck::class)->scene('add')->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['create_time'] = time();
Db::startTrans();
try {
if(empty($param['desc'])){
$param['desc'] = getDescriptionFromContent($param['content'], 100);
}
$aid = PagesList::strict(false)->field(true)->insertGetId($param);
if ($aid) {
//关联关键字
if (isset($param['keyword_names']) && $param['keyword_names']) {
Db::name('PagesKeywords')->where(['aid'=>$aid])->delete();
$keywordArray = explode(',', $param['keyword_names']);
$res_keyword = (new PagesList())->insertKeyword($keywordArray,$aid);
}
else{
$res_keyword == true;
}
if($res_keyword!== false){
add_log('add', $aid, $param);
Db::commit();
$DbRes=true;
}
} else {
Db::rollback();
}
}
catch (\Exception $e) { ##这里参数不能删除($e错误信息)
Db::rollback();
}
}
if($DbRes){
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else{
$id = isset($param['id']) ? $param['id'] : 0;
View::assign('id', $id);
View::assign('editor', get_system_config('other','editor'));
$templates = get_file_list(CMS_ROOT . '/app/home/view/pages/');
View::assign('templates', $templates);
if ($id > 0) {
$detail = (new PagesList())->detail($id);
if(empty($detail['md_content'])){
View::assign('editor',1);
}
View::assign('detail', $detail);
return view('edit');
}
return view();
}
}
//删除
public function delete()
{
$id = get_params("id");
$data['status'] = '-1';
$data['id'] = $id;
$data['update_time'] = time();
if (Db::name('Pages')->update($data) !== false) {
add_log('delete', $id);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
}
}

View File

@ -31,15 +31,15 @@ class User extends BaseController
if ($start_time > 0 && $end_time > 0) {
if ($start_time === $end_time) {
$where[] = ['register_time','=',$start_time];
$where[] = ['register_time', '=', $start_time];
} else {
$where[] = ['register_time','>=',$start_time];
$where[] = ['register_time','<=',$end_time];
$where[] = ['register_time', '>=', $start_time];
$where[] = ['register_time', '<=', $end_time];
}
} elseif ($start_time > 0 && $end_time == 0) {
$where[] = ['register_time','>=',$start_time];
$where[] = ['register_time', '>=', $start_time];
} elseif ($start_time == 0 && $end_time > 0) {
$where[] = ['register_time','<=',$end_time];
$where[] = ['register_time', '<=', $end_time];
}
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
@ -62,7 +62,7 @@ class User extends BaseController
$param = get_params();
if (request()->isAjax()) {
if (!empty($param['id']) && $param['id'] > 0) {
$param['update_time'] = time();
$param['update_time'] = time();
$res = Db::name('User')->where(['id' => $param['id']])->strict(false)->field(true)->update($param);
if ($res !== false) {
add_log('edit', $param['id'], $param);
@ -71,15 +71,14 @@ class User extends BaseController
return to_assign(1, '提交失败');
}
}
} else {
$id = isset($param['id']) ? $param['id'] : 0;
$user = Db::name('User')->where(['id' => $id])->find();
$levels = Db::name('UserLevel')->where(['status' => 1])->select()->toArray();
View::assign('user', $user);
View::assign('levels', $levels);
return view();
}
else{
$id = isset($param['id']) ? $param['id'] : 0;
$user = Db::name('User')->where(['id' => $id])->find();
$levels = Db::name('UserLevel')->where(['status' => 1])->select()->toArray();
View::assign('user', $user);
View::assign('levels', $levels);
return view();
}
}
//查看
@ -87,20 +86,25 @@ class User extends BaseController
{
$id = empty(get_params('id')) ? 0 : get_params('id');
$user = Db::name('User')->where(['id' => $id])->find();
$user['level_name'] = Db::name('UserLevel')->where(['id' => $user['level']])->value('title');
$user['level_name'] = Db::name('UserLevel')->where(['id' => $user['level']])->value('title');
add_log('view', get_params('id'));
View::assign('user', $user);
return view();
}
//删除
public function delete()
//禁用/启用
public function disable()
{
$id = get_params("id");
$data['status'] = get_params("status");
$data['update_time'] = time();
$data['id'] = $id;
if (Db::name('User')->update($data) !== false) {
add_log('edit', $id);
return to_assign(0, "操作成功");
if ($param['status'] == 0) {
add_log('disable', $param['id'], $param);
} else if ($param['status'] == 1) {
add_log('recovery', $param['id'], $param);
}
return to_assign();
} else {
return to_assign(1, "操作失败");
}
@ -115,8 +119,8 @@ class User extends BaseController
if (!empty($param['keywords'])) {
$where[] = ['nickname|content|param_id', 'like', '%' . $param['keywords'] . '%'];
}
if (!empty($param['action'])) {
$where[] = ['title','=',$param['action']];
if (!empty($param['action'])) {
$where[] = ['title', '=', $param['action']];
}
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
$content = DB::name('UserLog')
@ -141,8 +145,8 @@ class User extends BaseController
}
return table_assign(0, '', $content);
} else {
$type_action = get_config('log.user_action');
View::assign('type_action', $type_action);
$type_action = get_config('log.user_action');
View::assign('type_action', $type_action);
return view();
}
}

View File

@ -19,7 +19,7 @@ class Article extends Model
if (empty($article)) {
return $this->error('文章不存在');
}
$keywrod_array = \think\facade\Db::name('ArticleKeywords')
$keyword_array = \think\facade\Db::name('ArticleKeywords')
->field('i.aid,i.keywords_id,k.title')
->alias('i')
->join('keywords k', 'k.id = i.keywords_id', 'LEFT')
@ -27,8 +27,9 @@ class Article extends Model
->where(array('i.aid' => $id, 'k.status' => 1))
->select()->toArray();
$article['keyword_ids'] = implode(",", array_column($keywrod_array, 'keywords_id'));
$article['keyword_names'] = implode(',', array_column($keywrod_array, 'title'));
$article['keyword_ids'] = implode(",", array_column($keyword_array, 'keywords_id'));
$article['keyword_names'] = implode(',', array_column($keyword_array, 'title'));
$article['keyword_array'] = $keyword_array;
return $article;
}

View File

@ -25,7 +25,7 @@ class Goods extends Model
$goods['banner_array'] = explode(',',$goods['banner']);
}
//关键字
$keywrod_array = \think\facade\Db::name('ArticleKeywords')
$keywrod_array = \think\facade\Db::name('GoodsKeywords')
->field('i.aid,i.keywords_id,k.title')
->alias('i')
->join('keywords k', 'k.id = i.keywords_id', 'LEFT')

60
app/admin/model/Pages.php Normal file
View File

@ -0,0 +1,60 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\model;
use app\admin\model\Keywords;
use think\Model;
class Pages extends Model
{
// 获取详情
public function detail($id)
{
$detail = \think\facade\Db::name('Pages')->where(['id'=>$id])->find();
if(empty($detail)) {
return $this->error('页面不存在');
}
//轮播图
if(!empty($detail['banner'])) {
$detail['banner_array'] = explode(',',$detail['banner']);
}
//关键字
$keyword_array = \think\facade\Db::name('PagesKeywords')
->field('i.aid,i.keywords_id,k.title')
->alias('i')
->join('keywords k', 'k.id = i.keywords_id', 'LEFT')
->order('i.create_time asc')
->where(array('i.aid' => $id, 'k.status' => 1))
->select()->toArray();
$detail['keyword_ids'] = implode(",", array_column($keyword_array, 'keywords_id'));
$detail['keyword_names'] = implode(',', array_column($keyword_array, 'title'));
$detail['keyword_array'] = $keyword_array;
return $detail;
}
//插入关键字
public function insertKeyword($keywordArray = [], $aid)
{
$insert = [];
$time = time();
foreach ($keywordArray as $key => $value) {
if (!$value) {
continue;
}
$keywords_id = (new Keywords())->increase($value);
$insert[] = ['aid' => $aid,
'keywords_id' => $keywords_id,
'create_time' => $time,
];
}
$res = \think\facade\Db::name('PagesKeywords')->strict(false)->field(true)->insertAll($insert);
return $res;
}
}

View File

@ -22,6 +22,7 @@ class ArticleCheck extends Validate
protected $message = [
'title.require' => '标题不能为空',
'title.unique' => '同样的文章标题已经存在',
'content.require' => '文章内容不能为空',
'article_cate_id.require' => '所属分类为必选',
'id.require' => '缺少更新条件',
'status.require' => '状态为必选',

View File

@ -12,14 +12,15 @@ use think\Validate;
class ConfCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:config',
'name' => 'require|unique:config',
'title' => 'require|unique:config,title^status',
'name' => 'require|alphaDash|unique:config,name^status',
];
protected $message = [
'title.require' => '配置名称不能为空',
'title.unique' => '同样的配置名称已经存在',
'name.require' => '配置标识不能为空',
'name.alphaDash' => '配置标识只能是字母和数字下划线_及破折号-',
'name.unique' => '同样的配置标识已经存在',
];
}

View File

@ -12,17 +12,18 @@ use think\Validate;
class GoodsCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:article',
'title' => 'require|unique:goods',
'content' => 'require',
'id' => 'require',
'article_cate_id' => 'require',
'cate_id' => 'require',
'status' => 'require',
];
protected $message = [
'title.require' => '标题不能为空',
'title.require' => '商品标题不能为空',
'title.unique' => '同样的商品标题已经存在',
'cate_id.require' => '所属分类为必选',
'cate_id.require' => '所属商品分类为必选',
'content.require' => '商品内容不能为空',
'id.require' => '缺少更新条件',
'status.require' => '状态为必选',
];

View File

@ -0,0 +1,33 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class PagesCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:pages',
'content' => 'require',
'id' => 'require',
'status' => 'require',
];
protected $message = [
'title.require' => '标题不能为空',
'title.unique' => '同样的页面标题已经存在',
'content.require' => '页面内容不能为空',
'id.require' => '缺少更新条件',
'status.require' => '状态为必选',
];
protected $scene = [
'add' => ['title', 'content', 'status'],
'edit' => ['title', 'content', 'id', 'status'],
];
}

View File

@ -16,17 +16,19 @@ class SitemapCheck extends Validate
'id' => 'require',
'sitemap_cate_id' => 'require',
'pc_img' => 'require',
'pc_src' => 'require',
'pc_src' => 'require|url',
'mobile_img' => 'require',
'mobile_src' => 'require',
'mobile_src' => 'require|url',
];
protected $message = [
'name.require' => '名称不能为空',
'pc_img.require' => 'pc端图片不能为空',
'pc_src.require' => 'pc端链接不能为空',
'pc_img.require' => 'PC端图片不能为空',
'pc_src.require' => 'PC端链接不能为空',
'pc_src.url' => 'PC端链接必须以http开头',
'mobile_img.require' => '移动端图片不能为空',
'mobile_src.require' => '移动端链接不能为空',
'mobile_src.url' => '移动端链接必须以http开头',
'id.require' => '缺少更新条件',
'sitemap_cate_id.require' => '缺少更新条件',
];

View File

@ -15,7 +15,7 @@ class linksCheck extends Validate
{
protected $rule = [
'name' => 'require|unique:links',
'src' => 'require|unique:links',
'src' => 'require|url|unique:links',
'id' => 'require',
];
@ -23,6 +23,7 @@ class linksCheck extends Validate
'name.require' => '网站名称不能为空',
'name.unique' => '同样的网站名称已经存在',
'src' => '网站链接不能为空',
'src.url' => '网站链接不是有效的URL地址',
'src.unique' => '同样的网站链接已经存在',
'id.require' => '缺少更新条件',
];

View File

@ -1,10 +1,10 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-table">
<form class="layui-form p-4">
{if condition="$id eq 0"}
<div class="layui-form-bar" style="padding-bottom:0">
<h3 class="h3-title">新增管理员</h3>
<div class="layui-form-bar">
<h3 class="pb-3">新增管理员</h3>
</div>
<table class="layui-table layui-table-form">
<tr>
@ -16,19 +16,19 @@
<td>
<input type="text" name="nickname" lay-verify="required" placeholder="请输入用户名" lay-reqText="请输入用户名" autocomplete="off" class="layui-input">
</td>
<td rowspan="3" class="layui-td-gray2">头像<br /><span style="font-size: 12px;">(如若不上传<br />系统将自动生成)</span></td>
<td rowspan="3" class="layui-td-gray-2">头像<br /><span style="font-size: 12px;">(如若不上传<br />系统将自动生成)</span></td>
<td rowspan="3" valign="top" style="width: 100px;">
<div class="layui-upload" style="width: 100px;">
<div class="layui-upload-list" id="demo1" style="width: 100%; height:100px; overflow: hidden;">
<img src="/static/admin/images/nonepic600x600.jpg" height="100" style="max-width: 100%; width: 100%;" />
<input type="hidden" name="thumb" value="">
</div>
<button type="button" class="layui-btn layui-btn-normal" style="width: 100%;" id="test1">上传头像</button>
<button type="button" class="layui-btn layui-btn-normal" style="width: 100%;" id="uploadBtn">上传头像</button>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">密码<font>*</font></td>
<td class="layui-td-gray">登录密码<font>*</font></td>
<td>
<input type="password" name="pwd" lay-verify="required" placeholder="请输入密码" lay-reqText="请输入密码" autocomplete="off" class="layui-input">
</td>
@ -42,8 +42,14 @@
<td>
<input type="text" name="mobile" lay-verify="required" placeholder="请输入手机" lay-reqText="请输入手机" autocomplete="off" class="layui-input">
</td>
<td class="layui-td-gray">状态<font>*</font></td>
<td class="layui-td-gray">电子邮箱</td>
<td>
<input type="text" name="email" placeholder="电子邮箱" autocomplete="off" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">用户状态<font>*</font></td>
<td colspan="5">
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="0" title="禁止登录">
</td>
@ -65,8 +71,8 @@
</tr>
</table>
{else/}
<div class="layui-form-bar" style="padding-bottom:0">
<h3 class="h3-title">编辑管理员</h3>
<div class="layui-form-bar">
<h3 class="pb-3">编辑管理员</h3>
</div>
<table class="layui-table layui-table-form">
<tr>
@ -79,7 +85,7 @@
<td>
<input type="text" name="nickname" lay-verify="required" placeholder="请输入用户名" lay-reqText="请输入用户名" autocomplete="off" class="layui-input" value="{$admin.nickname}">
</td>
<td rowspan="3" class="layui-td-gray2">头像<br /><span style="font-size: 12px;">(如若不上传<br />系统将自动生成)</span>
<td rowspan="3" class="layui-td-gray-2">头像<br /><span style="font-size: 12px;">(如若不上传<br />系统将自动生成)</span>
</td>
<td rowspan="3" valign="top" style="width: 100px;">
<div class="layui-upload" style="width: 100px;">
@ -87,12 +93,12 @@
<img src="{$admin.thumb}" height="100" style="max-width: 100%; width: 100%;" />
<input type="hidden" name="thumb" value="{$admin.thumb}">
</div>
<button type="button" class="layui-btn layui-btn-normal" style="width: 100%;" id="test1">上传头像</button>
<button type="button" class="layui-btn layui-btn-normal" style="width: 100%;" id="uploadBtn">上传头像</button>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">密码</td>
<td class="layui-td-gray">登录密码</td>
<td>
<input type="password" name="edit_pwd" placeholder="请输入密码" autocomplete="off" class="layui-input">
</td>
@ -107,8 +113,14 @@
<input type="text" name="mobile" lay-verify="required" placeholder="请输入手机" lay-reqText="请输入手机"
autocomplete="off" class="layui-input" value="{$admin.mobile}">
</td>
<td class="layui-td-gray2">状态<font>*</font></td>
<td class="layui-td-gray">电子邮箱</td>
<td>
<input type="text" name="email" placeholder="电子邮箱" autocomplete="off" class="layui-input" value="{$admin.email}">
</td>
</tr>
<tr>
<td class="layui-td-gray">用户状态<font>*</font></td>
<td colspan="5">
<input type="radio" name="status" value="1" title="正常" {eq name="$admin.status" value="1" }checked{/eq}>
<input type="radio" name="status" value="0" title="禁止登录" {eq name="$admin.status" value="0"}checked{/eq}>
</td>
@ -129,10 +141,9 @@
</tr>
</table>
{/if}
<div style="padding: 10px">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<span lay-event="back" class="layui-btn layui-btn-primary">返回</span>
</div>
</form>
{/block}
@ -141,15 +152,12 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var TAB = parent.layui.tab,
form = layui.form,
layer = layui.layer,
upload = layui.upload;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool,upload = layui.upload;
//头像上传
var uploadInst = upload.render({
elem: '#test1'
elem: '#uploadBtn'
, url: '/admin/api/upload'
, done: function (e) {
//如果上传失败
@ -164,31 +172,20 @@
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/admin/add",
type: 'post',
data: data.field,
success: function (e) {
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
window.location.href="/admin/admin/index";
layer.close(index);
});
} else {
layer.msg(e.msg);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
}
})
return false;
});
//监听返回
$('.body-table').on('click', '[lay-event="back"]', function () {
window.location.href="/admin/admin/index";
}
tool.post("/admin/admin/add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,33 +1,36 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<h3 style="height:36px">重置密码</h3>
<form class="layui-form p-4">
<h3 class="pb-3">重置密码</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">用户名 <span style="color: red">*</span></td>
<td class="layui-td-gray">用户名 <span style="color: red">*</span></td>
<td><input type="text" lay-verify="required" autocomplete="off" placeholder="" class="layui-input"
value="{$admin.username}" disabled></td>
<td class="layui-td-gray2">旧密码<span style="color: red">*</span></td>
value="{$admin.username}" disabled></td>
<td class="layui-td-gray">旧密码<span style="color: red">*</span></td>
<td>
<input type="password" lay-verify="required" name="old_pwd" placeholder="请输入旧密码" lay-reqText="请输入旧密码" autocomplete="off" class="layui-input">
<input type="password" lay-verify="required" name="old_pwd" placeholder="请输入旧密码" lay-reqText="请输入旧密码"
autocomplete="off" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray2">新密码 <span style="color: red">*</span></td>
<td class="layui-td-gray">新密码 <span style="color: red">*</span></td>
<td>
<input type="password" lay-verify="required" name="pwd" placeholder="请输入新密码" lay-reqText="请输入新密码" autocomplete="off" class="layui-input">
<input type="password" lay-verify="required" name="pwd" placeholder="请输入新密码" lay-reqText="请输入新密码"
autocomplete="off" class="layui-input">
</td>
<td class="layui-td-gray2">确认新密码 <span style="color: red">*</span></td>
<td class="layui-td-gray-2">确认新密码 <span style="color: red">*</span></td>
<td>
<input type="password" lay-verify="required" name="pwd_confirm" placeholder="请再次输入新密码" lay-reqText="请再次输入新密码" autocomplete="off" class="layui-input">
<input type="password" lay-verify="required" name="pwd_confirm" placeholder="请再次输入新密码" lay-reqText="请再次输入新密码"
autocomplete="off" class="layui-input">
</td>
</tr>
</table>
<div style="padding: 10px 0">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
@ -35,33 +38,24 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var TAB = parent.layui.tab,
form = layui.form,
layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/api/password_submit",
type: 'post',
data: data.field,
success: function (e) {
if (e.code == 0) {
layer.msg('修改密码成功');
setTimeout(function () {
TAB.sonDelete();
layer.close(index);
}, 1000)
} else {
layer.msg(e.msg);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.confirm('修改密码成功,关闭本页面吗?', { icon: 3, title: '提示' }, function (index) {
TAB.sonDelete();
layer.close(index);
});
}
})
}
tool.post("/admin/api/password_submit", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,17 +1,17 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<h3 style="height:36px">修改个人信息</h3>
<form class="layui-form p-4">
<h3 class="pb-3">修改个人信息</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">用户名 <span style="color: red">*</span></td>
<td class="layui-td-gray">用户名 <span style="color: red">*</span></td>
<td><input type="text" lay-verify="required" autocomplete="off" placeholder="请输入节点名称" class="layui-input"
value="{$admin.username}" disabled></td>
<td class="layui-td-gray2" rowspan="3">头像</td>
<td class="layui-td-gray" rowspan="3">头像</td>
<td rowspan="3">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal" id="test1">上传头像</button>
<button type="button" class="layui-btn layui-btn-normal" id="uploadBtn">上传头像</button>
<div class="layui-upload-list" id="demo1">
<img src="{$admin.thumb}" width="100" />
<input type="hidden" name="thumb" value="{$admin.thumb}">
@ -20,19 +20,19 @@
</td>
</tr>
<tr>
<td class="layui-td-gray2">昵称<span style="color: red">*</span></td>
<td class="layui-td-gray">昵称<span style="color: red">*</span></td>
<td>
<input type="text" name="nickname" lay-verify="required" placeholder="请输入昵称" lay-reqText="请输入昵称"
autocomplete="off" class="layui-input" value="{$admin.nickname}">
</td>
</tr>
<tr>
<td class="layui-td-gray2">手机</td>
<td class="layui-td-gray">手机号码</td>
<td><input type="text" name="mobile" lay-verify="required" placeholder="请输入手机" autocomplete="off"
class="layui-input" value="{$admin.mobile}"></td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -43,22 +43,19 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var TAB = parent.layui.tab,
form = layui.form,
layer = layui.layer,
upload = layui.upload;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool, upload = layui.upload;
//头像上传
var uploadInst = upload.render({
elem: '#test1'
elem: '#uploadBtn'
, url: '/admin/api/upload'
, done: function (e) {
//如果上传失败
if (e.code == 1) {
return layer.msg('上传失败');
}
else{
else {
//上传成功
$('#demo1 input').attr('value', e.data.filepath);
$('#demo1 img').attr('src', e.data.filepath);
@ -68,26 +65,20 @@
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/api/personal_submit",
type: 'post',
data: data.field,
success: function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭本页面吗?', { icon: 3, title: '提示' }, function (index) {
TAB.sonDelete();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.confirm('保存成功,关闭本页面吗?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
}
})
}
tool.post("/admin/api/personal_submit", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,14 +1,14 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="layui-input-inline">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width: 320px;">
<input type="text" name="keywords" placeholder="登录账户/用户名/手机号码" class="layui-input" autocomplete="off"/>
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="admin" lay-filter="admin"></table>
</div>
<script type="text/html" id="thumb">
@ -19,11 +19,11 @@
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<a class="layui-btn layui-btn-normal layui-btn-sm" href="/admin/admin/add">+ 添加管理员</a>
<span class="layui-btn layui-btn-normal layui-btn-sm add-user">+ 添加管理员</span>
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group"><span class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">详情</span><a class="layui-btn layui-btn-xs" href="/admin/admin/add?id={{d.id}}">编辑</a><span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span></div>
<div class="layui-btn-group"><span class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">详情</span><span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span><span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span></div>
</script>
{/block}
@ -32,12 +32,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var TAB = parent.layui.tab,
table = layui.table,
form = layui.form;
var tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#admin',
title: '管理员列表',
toolbar: '#toolbarDemo',
url: '/admin/admin/index', //数据接口
@ -53,8 +52,7 @@
}, {
field: 'username',
title: '登录账号',
align: 'center',
width: 132
width: 120
}, {
field: 'thumb',
title: '头像',
@ -64,7 +62,6 @@
}, {
field: 'nickname',
title: '用户名',
align: 'center',
width: 120
}, {
field: 'groupName',
@ -73,16 +70,16 @@
field: 'login_num',
title: '累计登录',
align: 'center',
width: 90
width: 80
}, {
field: 'last_login_time',
title: '最后登录时间',
align: 'center',
width: 148
width: 142
}, {
field: 'last_login_ip',
title: '最后登录IP',
width: 150
width: 130
}, {
field: 'status',
title: '状态',
@ -91,20 +88,29 @@
width: 60
}, {
field: 'right',
fixed: 'right',
title: '操作',
toolbar: '#barDemo',
width: 136,
width: 132,
align: 'center'
}
]
]
});
//表头工具栏事件
$('body').on('click','.add-user', function () {
tool.side("/admin/admin/add");
return;
});
//监听行工具事件
table.on('tool(test)', function (obj) {
table.on('tool(admin)', function (obj) {
var data = obj.data;
if (obj.event === 'view') {
TAB.sonAdd('/admin/admin/view?id='+data.id,'管理员详情');
tool.side('/admin/admin/view?id='+data.id);
return;
}
else if (obj.event === 'edit') {
tool.side('/admin/admin/add?id='+data.id);
return;
}
else if (obj.event === 'del') {
@ -116,18 +122,13 @@
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/admin/delete",
data: {
id: data.id
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/admin/delete", { id: data.id }, callback);
layer.close(index);
});
}
@ -135,7 +136,7 @@
//监听搜索提交
form.on('submit(webform)', function (data) {
tableIns.reload({
layui.pageTable.reload({
where: {
keywords: data.field.keywords
},
@ -147,6 +148,5 @@
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,21 +1,43 @@
{extend name="common/base" /}
{block name="style"}
<style type="text/css">
.latest-news{padding-top: 12px; padding-bottom:30px; padding-left: 20px; position: relative;}
.latest-news .layui-timeline-title{padding-bottom:0; font-size: 14px;}
.latest-news .layui-timeline-item{padding-bottom:5px;}
.layui-timeline-title span{color:#999}
.panel-more{width: 100%; height:48px; line-height: 48px; text-align: center; position: absolute; bottom: 0; left:0;}
.panel-more a{color:#0088FF}
.layui-card-body .layui-timeline-title {
padding-bottom: 0;
font-size: 14px;
}
.layui-card-body .layui-timeline-item {
padding-bottom: 5px;
}
.layui-timeline-title span {
color: #999
}
.panel-more {
width: 100%;
height: 48px;
line-height: 48px;
text-align: center;
position: absolute;
bottom: 0;
left: 0;
}
.panel-more a {
color: #0088FF
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="body-content" style="padding: 20px;">
<div class="h3-title">操作日志</div>
<div class="latest-news">
<ul class="layui-timeline" id="logs"></ul>
<div class="panel-more"><a href="javascript:getLogs();">查看更多日志</a></div>
<div class="p-3">
<div class="layui-card">
<div class="layui-card-header"><h3>操作日志</h3></div>
<div class="layui-card-body">
<ul class="layui-timeline" id="logs"></ul>
<div class="panel-more"><a href="javascript:;">查看更多日志</a></div>
</div>
</div>
</div>
{/block}
@ -28,7 +50,7 @@
function getLogs() {
$.ajax({
url: "/admin/api/get_log_list",
type: 'post',
type: 'get',
data: {
page:page,
limit: limit
@ -54,7 +76,12 @@
}
})
}
getLogs();
function gouguInit() {
getLogs();
$('.panel-more').on('click',function(){
getLogs();
})
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -7,71 +7,75 @@
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-table">
<h3 style="font-weight:600; padding:10px">管理员信息</h3>
<form class="layui-form p-4">
<h3 class="pb-3">管理员信息</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">登录账号</td>
<td class="layui-td-gray">登录账号</td>
<td>
{$admin.username}
</td>
<td class="layui-td-gray2">用户名</td>
<td class="layui-td-gray">用户名</td>
<td>
{$admin.nickname}
</td>
<td rowspan="2" class="layui-td-gray2">头像</td>
<td rowspan="2" valign="top" style="width: 100px;">
<td rowspan="3" class="layui-td-gray">头像</td>
<td rowspan="3" valign="top" style="width: 100px;">
<div class="layui-upload">
<img src="{$admin.thumb}" width="100" height="100" />
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray2">手机号码</td>
<td class="layui-td-gray">手机号码</td>
<td>
{$admin.mobile}
</td>
<td class="layui-td-gray2">状态</td>
<td class="layui-td-gray">电子邮箱</td>
<td>
{$admin.email}
</td>
</tr>
<tr>
<td class="layui-td-gray">用户角色<font>*</font>
</td>
<td>
{volist name=":get_admin_group()" id="v"}
{volist name="$admin.group_id" id="a"}{eq name="$a" value="$v.id" }{$v.title},{/eq}{/volist}
{/volist}
</td>
<td class="layui-td-gray">状态</td>
<td>
{eq name="$admin.status" value="1" }正常{/eq}
{eq name="$admin.status" value="0" }禁止登录{/eq}
</td>
</tr>
<tr>
<td class="layui-td-gray2">用户角色<font>*</font>
</td>
<td colspan="5">
{volist name=":get_admin_group()" id="v"}
{volist name="$admin.group_id" id="a"}{eq name="$a" value="$v.id" }{$v.title},{/eq}{/volist}
{/volist}
</td>
</tr>
<tr>
<td class="layui-td-gray2">最后登录时间</td>
<td class="layui-td-gray-2">最后登录时间</td>
<td>
{$admin.last_login_time | date='Y-m-d H:i:s'}
</td>
<td class="layui-td-gray2">最后登录IP</td>
<td class="layui-td-gray-2">最后登录IP</td>
<td>
{$admin.last_login_ip}
</td>
<td class="layui-td-gray2">累计登录次数</td>
<td class="layui-td-gray">累计登录</td>
<td>
{$admin.login_num}
{$admin.login_num}
</td>
</tr>
<tr>
<td class="layui-td-gray2">备注</td>
<td class="layui-td-gray">备注</td>
<td colspan="5">
{$admin.desc}
</td>
</tr>
</table>
<h3 class="h3-title2">用户权限</h3>
<h3 class="py-3">用户权限</h3>
<table class="layui-table layui-table-form">
{volist name="role_rule" id="vo"}
<tr>
<td style="font-weight:800">
<td class="layui-td-gray-2" style="font-weight:800">
<input type="checkbox" disabled value="{$vo.id}" title="{$vo.title}" {eq name="$vo.checked" value="true" }checked{/eq}>
</td>
{notempty name="vo.children"}
@ -97,26 +101,6 @@
</tr>
{/volist}
</table>
<div style="padding: 10px">
<button lay-event="back" class="layui-btn layui-btn-primary">关闭</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var TAB = parent.layui.tab,
form = layui.form;
//监听返回
$('.body-table').on('click', '[lay-event="back"]', function () {
TAB.sonDelete();
return false;
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->
<!-- /主体 -->

View File

@ -28,7 +28,7 @@ fieldset.layui-field-title {
{/block}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<div class="layui-row layui-col-space15">
<div class="layui-col-xs6 layui-col-md3">
<div class="layui-card">
@ -117,13 +117,14 @@ fieldset.layui-field-title {
</div>
</div>
</div>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script src="https://cdn.staticfile.org/echarts/5.3.0/echarts.min.js"></script>
<script src="{__STATIC__}/chart/china.js"></script>
<script src="{__GOUGU__}/gougu/module/echart/china.js"></script>
<script>
function init(layui) {
var layer = layui.layer, table = layui.table;
@ -226,7 +227,6 @@ fieldset.layui-field-title {
return Math.round(Math.random()*1000);
}
var mapCharts = echarts.init(document.getElementById('map'));
var dataList=[
{name:"南海诸岛",value:0},
{name: '北京', value: randomValue()},
@ -416,7 +416,6 @@ fieldset.layui-field-title {
// 窗口大小改变事件
window.onresize = function () {
myCharts.resize();
mapCharts.resize();
fwlCharts.resize();
zfbsCharts.resize();
@ -424,6 +423,5 @@ fieldset.layui-field-title {
};
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,123 +1,128 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<style type="text/css">
.editormd-code-toolbar select{display:inline-block}
.editormd li{list-style: inherit;}
</style>
<form class="layui-form body-table">
<div class="layui-form-bar" style="padding-bottom:0">
<h3 class="h3-title">创建文章</h3>
</div>
<table class="layui-table">
<tr>
<td class="layui-td-gray">文章标题 <span style="color: red">*</span></td>
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入文章标题" autocomplete="off" placeholder="请输入文章标题" class="layui-input"></td>
</tr>
<tr>
<td class="layui-td-gray">文章分类<span style="color: red">*</span></td>
<td>
<select name="article_cate_id" lay-verify="required" lay-reqText="请选择分类">
<option value="">请选择分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
<option value="{$v.id}">{$v.title}</option>
{/volist}
</select>
</td>
<td class="layui-td-gray">关键字<span style="color: red">*</span></td>
<td>
<input type="text" id="keyword_name" name="keyword_names" autocomplete="off" lay-verify="required" lay-reqText="请选择关键字" placeholder="请选择关键字"
class="layui-input" readonly>
<input type="hidden" id="keyword_id" name="keyword_ids" autocomplete="off">
</td>
<td class="layui-td-gray">状态<span style="color: red">*</span></td>
<td>
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="0" title="下架">
</td>
</tr>
<tr>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入排序,数字" autocomplete="off" class="layui-input">
</td>
<td class="layui-td-gray">首页显示</td>
<td>
<input type="radio" name="is_home" value="1" title="是" checked>
<input type="radio" name="is_home" value="0" title="否">
</td>
<td class="layui-td-gray">属性</td>
<td>
<select name="type">
<option value="">请选择属性</option>
<option value="1">精华</option>
<option value="2">热门</option>
<option value="3">推荐</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">是否原创</td>
<td>
<input type="radio" name="original" value="1" title="是">
<input type="radio" name="original" value="0" title="否" checked>
</td>
<td class="layui-td-gray">作者/来源</td>
<td>
<input type="text" name="origin" class="layui-input" autocomplete="off" placeholder="请输入文章作者或来源">
</td>
<td class="layui-td-gray">来源链接</td>
<td>
<input type="text" name="origin_url" class="layui-input" autocomplete="off" placeholder="请输入来源链接">
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">文章摘要</td>
<td colspan="3">
<textarea name="desc" placeholder="请输入摘要不能超过200个字" class="layui-textarea"></textarea>
</td>
<td class="layui-td-gray" style="vertical-align:top;">缩略图</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="test1">上传缩略图尺寸240x136</button>
<div class="layui-upload-list" id="demo1" style="width: 120px; height:66px; overflow: hidden;">
<img src="" style="max-width: 100%; height:66px;" />
<input type="hidden" name="thumb" value="">
</div>
</div>
</td>
</tr>
{eq name="$editor" value="1"}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<span style="color: red">*</span><span style="margin-left:30px; color: red">当前为ueditor富文本编辑器可在【系统管理->其他配置】中切换为mardown编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<textarea name="ueditorcontent" placeholder="请输入内容" class="layui-textarea" id="container" lay-verify="required" lay-reqText="请完善文章内容"
style="border:0;padding:0"></textarea>
{include file="common/ueditor" id="container" name="ueditorcontent" width="100%" height="500" toolbar="[]" /}
</td>
</tr>
{else/}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<span style="color: red">*</span><span style="margin-left:30px; color: red">当前为mardown编辑器可在【系统管理->其他配置】中切换为ueditor富文本编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<div>
<textarea id="mdContent" style="display:none;"></textarea>
<div id="docContent"></div>
</div>
{include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /}
</td>
<form class="layui-form p-3">
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">文章标题 <span style="color: red">*</span></td>
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入文章标题"
autocomplete="off" placeholder="请输入文章标题" class="layui-input"></td>
</tr>
{/eq}
</table>
<div class="layui-form-item" style="padding:10px;">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">返回</button>
</div>
<tr>
<td class="layui-td-gray">文章分类<span style="color: red">*</span></td>
<td>
<select name="article_cate_id" lay-verify="required" lay-reqText="请选择分类">
<option value="">请选择分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
<option value="{$v.id}">{$v.title}</option>
{/volist}
</select>
</td>
<td class="layui-td-gray">关键字<span style="color: red">*</span></td>
<td>
<input type="text" id="keyword_name" name="keyword_names" autocomplete="off" lay-verify="required"
lay-reqText="请选择关键字" placeholder="请选择关键字" class="layui-input" readonly>
<input type="hidden" id="keyword_id" name="keyword_ids" autocomplete="off">
</td>
<td class="layui-td-gray">状态<span style="color: red">*</span></td>
<td>
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="0" title="下架">
</td>
</tr>
<tr>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入排序,数字" autocomplete="off" class="layui-input">
</td>
<td class="layui-td-gray">首页显示</td>
<td>
<input type="radio" name="is_home" value="1" title="是" checked>
<input type="radio" name="is_home" value="0" title="否">
</td>
<td class="layui-td-gray">属性</td>
<td>
<select name="type">
<option value="">请选择属性</option>
<option value="1">精华</option>
<option value="2">热门</option>
<option value="3">推荐</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">是否原创</td>
<td>
<input type="radio" name="original" value="1" title="是">
<input type="radio" name="original" value="0" title="否" checked>
</td>
<td class="layui-td-gray">作者/来源</td>
<td>
<input type="text" name="origin" class="layui-input" autocomplete="off" placeholder="请输入文章作者或来源">
</td>
<td class="layui-td-gray">来源链接</td>
<td>
<input type="text" name="origin_url" class="layui-input" autocomplete="off" placeholder="请输入来源链接">
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">文章摘要</td>
<td colspan="3">
<textarea name="desc" placeholder="请输入摘要不能超过200个字" class="layui-textarea"></textarea>
</td>
<td class="layui-td-gray" style="vertical-align:top;">缩略图</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm"
id="uploadBtn">上传缩略图尺寸240x136</button>
<div class="layui-upload-list" id="demo1" style="width: 120px; height:66px; overflow: hidden;">
<img src="" style="max-width: 100%; height:66px;" />
<input type="hidden" name="thumb" value="">
</div>
</div>
</td>
</tr>
{eq name="$editor" value="1"}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为TinyMCE富文本编辑器可在【系统管理->其他配置】中切换为mardown编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<textarea class="layui-textarea" id="container"></textarea>
</td>
</tr>
{else/}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为mardown编辑器可在【系统管理->其他配置】中切换为ueditor富文本编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<div>
<textarea id="mdContent" style="display:none;"></textarea>
<div id="docContent"></div>
</div>
</td>
</tr>
{/eq}
</table>
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">返回</button>
</div>
</form>
{/block}
<!-- /主体 -->
@ -125,64 +130,100 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
, layer = layui.layer
, tagspicker = layui.tagpicker
, upload = layui.upload;
const editorType = '{$editor}';
var moduleInit;
if (editorType == 1) {
moduleInit = ['tool', 'tagpicker', 'tinymce'];
}
else {
moduleInit = ['tool', 'tagpicker', 'editormd'];
}
var tags = new tagspicker({
'url': '/admin/api/get_keyword_cate',
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
'height': 500,
'isDiy': 1
});
function gouguInit() {
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker, upload = layui.upload;
var tags = new tagspicker({
'url': '/admin/api/get_keyword_cate',
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
'height': 500,
'isDiy': 1
});
//封面上传
var uploadInst = upload.render({
elem: '#test1'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value', res.data.id);
$('#demo1 img').attr('src', res.data.filepath);
}
});
//封面上传
var uploadInst = upload.render({
elem: '#uploadBtn'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value', res.data.id);
$('#demo1 img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/article/add",
type: 'post',
data: data.field,
success: function (e) {
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
window.location.href="/admin/article/index.html";
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
})
return false;
});
//监听返回
$('.body-table').on('click', '[lay-event="back"]', function () {
window.location.href="/admin/article/index.html";
return false;
});
}
//监听返回
$('body').on('click', '[lay-event="back"]', function () {
window.location.href = "/admin/article/index.html";
return false;
});
if (editorType == 1) {
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.content = tinyMCE.editors['container'].getContent();
if (data.field.content == '') {
layer.msg('请先完善文章内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/article/add", data.field, callback);
return false;
});
}
else {
var editor = layui.editormd;
var edit = editor.render('docContent', {
markdown: document.getElementById('mdContent').value
});
//监听提交
form.on('submit(webform)', function (data) {
if (data.field.mdContent == '') {
layer.msg('请先完善文章内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/article/add", data.field, callback);
return false;
});
}
}
</script>
{include file="common/layui" base='base' extend="['tagpicker']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table" style="margin-bottom:0">
<div class="layui-form-bar">
<div class="p-3">
<div class="gg-form-bar border-t border-x">
<button class="layui-btn layui-btn-normal layui-btn-sm add-menu">+ 添加分类</button>
</div>
<div>
@ -18,13 +18,12 @@
<!-- 脚本 -->
{block name="script"}
<script>
var editObj=null,ptable=null,treeGrid=null,tableId='treeTable',layer=null;
function init(layui){
var table=layui.table,form = layui.form,rightpage = layui.rightpage,layer=layui.layer;
treeGrid = layui.treeGrid;//很重要
ptable=treeGrid.render({
id:tableId
,elem: '#'+tableId
const moduleInit = ['tool', 'treeGrid'];
function gouguInit() {
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
layui.pageTable = treeGrid.render({
id:'treeTable'
,elem: '#treeTable'
,idField:'id'
,url:'/admin/article/cate'
,cellMinWidth: 100
@ -45,43 +44,37 @@
}
]]
,page:false
//,skin:'line'
});
//表头工具栏事件
$('.add-menu').on('click', function(){
rightpage.open("/admin/article/cate_add",'900px');
tool.side("/admin/article/cate_add");
return;
});
//操作按钮
treeGrid.on('tool('+tableId+')',function (obj) {
treeGrid.on('tool(treeTable)',function (obj) {
if (obj.event === 'add') {
rightpage.open('/admin/article/cate_add?pid='+obj.data.id,'900px');
tool.side('/admin/article/cate_add?pid='+obj.data.id);
return;
}
if (obj.event === 'edit') {
rightpage.open('/admin/article/cate_add?id='+obj.data.id,'900px');
tool.side('/admin/article/cate_add?id='+obj.data.id);
return;
}
if(obj.event === 'del'){
layer.confirm('确定要删除吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url:"/admin/article/cate_delete",
type:'post',
data:{id:obj.data.id},
success:function(res){
layer.msg(res.msg);
if(res.code == 0){
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
})
}
tool.delete("/admin/article/cate_delete", { id: obj.data.id }, callback);
layer.close(index);
});
}
});
}
</script>
{include file="common/layui" base='base' extend="['treeGrid','rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,74 +1,75 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">文章分类</h3>
<form class="layui-form p-4">
<h3 class="pb-3">文章分类</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">父级分类<font>*</font></td>
<td class="layui-td-gray">父级分类<font>*</font>
</td>
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择父级分类">
<option value="0">作为顶级分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
<option value="{$v.id}" {eq name="pid" value="$v.id"}selected=""{/eq}>{$v.title}</option>
{/volist}
<option value="0">作为顶级分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
<option value="{$v.id}" {eq name="pid" value="$v.id" }selected="" {/eq}>{$v.title}</option>
{/volist}
</select>
</td>
<td class="layui-td-gray">分类名称<font>*</font></td>
<td class="layui-td-gray">分类名称<font>*</font>
</td>
<td>
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入分类名称" lay-reqText="请输入分类名称" class="layui-input" {notempty name="$cate.title" }value="{$cate.title}" {/notempty}>
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入分类名称"
lay-reqText="请输入分类名称" class="layui-input" {notempty name="$cate.title" }value="{$cate.title}"
{/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" placeholder="请输入排序,数字" value="0" autocomplete="off" class="layui-input" {notempty name="$cate.sort" }value="{$cate.sort}" {/notempty}>
<input type="text" name="sort" placeholder="请输入排序,数字" value="0" autocomplete="off" class="layui-input"
{notempty name="$cate.sort" }value="{$cate.sort}" {/notempty}>
</td>
<td class="layui-td-gray">关键词</td>
<td>
<input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" {notempty name="$cate.keywords" }value="{$cate.keywords}" {/notempty}>
<input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input"
{notempty name="$cate.keywords" }value="{$cate.keywords}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray">描述</td>
<td colspan="3"><textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea">{notempty name="$cate.desc" }{$cate.desc}{/notempty}</textarea></td>
<td colspan="3"><textarea name="desc" placeholder="请输入描述,可空"
class="layui-textarea">{notempty name="$cate.desc" }{$cate.desc}{/notempty}</textarea></td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<input type="hidden" name="id" value="{$id}" />
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui){
var form = layui.form
,layer = layui.layer;
//监听提交
form.on('submit(webform)', function(data){
$.ajax({
url:"/admin/article/cate_add",
type:'post',
data:data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function(){
parent.location.reload();
},1000);
}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
})
}
tool.post("/admin/article/cate_add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -2,140 +2,138 @@
<!-- 主体 -->
{block name="body"}
<style type="text/css">
.editormd-code-toolbar select{display:inline-block}
.editormd li{list-style: inherit;}
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
</style>
<form class="layui-form body-table">
<div class="layui-form-bar" style="padding-bottom:0">
<h3 class="h3-title">编辑文章</h3>
</div>
<table class="layui-table">
<tr>
<td class="layui-td-gray">文章标题 <span style="color: red">*</span></td>
<td colspan="7"> <input type="text" name="title" lay-verify="required" lay-reqText="请输入文章标题" autocomplete="off" placeholder="请输入文章标题"
class="layui-input" value="{$article.title}"></td>
</tr>
<tr>
<td class="layui-td-gray">文章分类<span style="color: red">*</span></td>
<td>
<select name="article_cate_id" lay-verify="required" lay-reqText="请选择分类">
<option value="">请选择分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
<option value="{$v.id}" {eq name="$article.article_cate_id" value="$v.id" }selected{/eq}>{$v.title}</option>
{/volist}
</select>
</td>
<td class="layui-td-gray">关键字<span style="color: red">*</span></td>
<td>
<input type="text" id="keyword_name" name="keyword_names" autocomplete="off" lay-verify="required" lay-reqText="请选择关键字" placeholder="请选择关键字"
class="layui-input" value="{$article.keyword_names}" readonly>
<input type="hidden" id="keyword_id" name="keywords_id" autocomplete="off" value="{$article.keyword_ids}">
</td>
<td class="layui-td-gray">状态<span style="color: red">*</span></td>
<td>
<input type="radio" name="status" value="1" title="正常" {eq name="$article.status" value="1" }checked{/eq}>
<input type="radio" name="status" value="0" title="下架" {eq name="$article.status" value="0" }checked{/eq}>
</td>
</tr>
<tr>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input"
value="{$article.sort}">
</td>
<td class="layui-td-gray">首页显示</td>
<td>
<input type="radio" name="is_home" value="1" title="是" {eq name="$article.is_home" value="1" }checked{/eq}>
<input type="radio" name="is_home" value="0" title="否" {eq name="$article.is_home" value="0" }checked{/eq}>
</td>
<td class="layui-td-gray">属性</td>
<td>
<select name="type">
<option value="">请选择属性</option>
<option value="1" {eq name="$article.type" value="1" }selected{/eq}>精华</option>
<option value="2" {eq name="$article.type" value="2" }selected{/eq}>热门</option>
<option value="3" {eq name="$article.type" value="3" }selected{/eq}>推荐</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">是否原创</td>
<td>
<input type="radio" name="original" value="1" title="是" {eq name="$article.original" value="1" }checked{/eq}>
<input type="radio" name="original" value="0" title="否" {eq name="$article.original" value="0" }checked{/eq}>
</td>
<td class="layui-td-gray">作者/来源</td>
<td>
<input type="text" name="origin" class="layui-input" autocomplete="off" placeholder="请输入文章来源"
value="{$article.origin}">
</td>
<td class="layui-td-gray">来源链接</td>
<td>
<input type="text" name="origin_url" class="layui-input" autocomplete="off" placeholder="请输入来源链接"
value="{$article.origin_url}">
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">摘要</td>
<td colspan="3">
<textarea name="desc" placeholder="请输入摘要不能超过200个字" class="layui-textarea">{$article.desc}</textarea>
</td>
<td class="layui-td-gray" style="vertical-align:top;">缩略图</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="test1">上传缩略图尺寸240x136</button>
<div class="layui-upload-list" id="demo1" style="width: 120px; height:66px; overflow: hidden;">
<img src="{:get_file($article.thumb)}" style="max-width: 100%; height:66px;" />
<input type="hidden" name="thumb" value="{$article.thumb}">
</div>
</div>
</td>
</tr>
{empty name="$article.md_content"}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<span style="color: red">*</span></td>
</tr>
<tr>
<td colspan="6">
<textarea name="ueditorcontent" placeholder="请输入内容" class="layui-textarea" id="container" lay-verify="required" lay-reqText="请完善文章内容"
style="border:0;padding:0">{$article.content}</textarea>
{include file="common/ueditor" id="container" name="ueditorcontent" width="100%" height="500" toolbar="[]" /}
<form class="layui-form p-3">
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">文章标题 <span style="color: red">*</span></td>
<td colspan="7"> <input type="text" name="title" lay-verify="required" lay-reqText="请输入文章标题"
autocomplete="off" placeholder="请输入文章标题" class="layui-input" value="{$article.title}"></td>
</tr>
<tr>
<td class="layui-td-gray">文章分类<span style="color: red">*</span></td>
<td>
<select name="article_cate_id" lay-verify="required" lay-reqText="请选择分类">
<option value="">请选择分类</option>
{volist name=":set_recursion(get_article_cate())" id="v"}
<option value="{$v.id}" {eq name="$article.article_cate_id" value="$v.id" }selected{/eq}>{$v.title}
</option>
{/volist}
</select>
</td>
</tr>
{else/}
<td class="layui-td-gray">关键字<span style="color: red">*</span></td>
<td>
<input type="text" id="keyword_name" name="keyword_names" autocomplete="off" lay-verify="required"
lay-reqText="请选择关键字" placeholder="请选择关键字" class="layui-input" value="{$article.keyword_names}"
readonly>
<input type="hidden" id="keyword_id" name="keywords_id" autocomplete="off"
value="{$article.keyword_ids}">
</td>
<td class="layui-td-gray">状态<span style="color: red">*</span></td>
<td>
<input type="radio" name="status" value="1" title="正常" {eq name="$article.status" value="1"
}checked{/eq}>
<input type="radio" name="status" value="0" title="下架" {eq name="$article.status" value="0"
}checked{/eq}>
</td>
</tr>
<tr>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input"
value="{$article.sort}">
</td>
<td class="layui-td-gray">首页显示</td>
<td>
<input type="radio" name="is_home" value="1" title="是" {eq name="$article.is_home" value="1"
}checked{/eq}>
<input type="radio" name="is_home" value="0" title="否" {eq name="$article.is_home" value="0"
}checked{/eq}>
</td>
<td class="layui-td-gray">属性</td>
<td>
<select name="type">
<option value="">请选择属性</option>
<option value="1" {eq name="$article.type" value="1" }selected{/eq}>精华</option>
<option value="2" {eq name="$article.type" value="2" }selected{/eq}>热门</option>
<option value="3" {eq name="$article.type" value="3" }selected{/eq}>推荐</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">是否原创</td>
<td>
<input type="radio" name="original" value="1" title="是" {eq name="$article.original" value="1"
}checked{/eq}>
<input type="radio" name="original" value="0" title="否" {eq name="$article.original" value="0"
}checked{/eq}>
</td>
<td class="layui-td-gray">作者/来源</td>
<td>
<input type="text" name="origin" class="layui-input" autocomplete="off" placeholder="请输入文章来源"
value="{$article.origin}">
</td>
<td class="layui-td-gray">来源链接</td>
<td>
<input type="text" name="origin_url" class="layui-input" autocomplete="off" placeholder="请输入来源链接"
value="{$article.origin_url}">
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">摘要</td>
<td colspan="3">
<textarea name="desc" placeholder="请输入摘要不能超过200个字" class="layui-textarea">{$article.desc}</textarea>
</td>
<td class="layui-td-gray" style="vertical-align:top;">缩略图</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm"
id="uploadBtn">上传缩略图尺寸240x136</button>
<div class="layui-upload-list" id="demo1" style="width: 120px; height:66px; overflow: hidden;">
<img src="{:get_file($article.thumb)}" style="max-width: 100%; height:66px;" />
<input type="hidden" name="thumb" value="{$article.thumb}">
</div>
</div>
</td>
</tr>
{eq name="$editor" value="1"}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<span style="color: red">*</span><span style="margin-left:30px; color: red">当前为ueditor富文本编辑器可在【系统管理->其他配置】中切换为mardown编辑器</span></td>
</tr>
<tr>
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为TinyMCE富文本编辑器可在【系统管理->其他配置】中切换为mardown编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<textarea name="content" placeholder="请输入内容" class="layui-textarea" id="container" lay-verify="required" lay-reqText="请完善文章内容"
style="border:0;padding:0">{$article.content}</textarea>
{include file="common/ueditor" id="container" name="content" width="100%" height="500" toolbar="[]" /}
<textarea placeholder="请输入内容" class="layui-textarea" id="container">{$article.content}</textarea>
</td>
</tr>
{else/}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<span style="color: red">*</span><span style="margin-left:30px; color: red">当前为mardown编辑器可在【系统管理->其他配置】中切换为ueditor富文本编辑器</span></td>
</tr>
<tr>
</tr>
{else/}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为mardown编辑器可在【系统管理->其他配置】中切换为TinyMCE富文本编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<div style="margin-top:-2px; margin-right:2px">
<textarea id="mdContent" style="display:none;">{$article.md_content|raw}</textarea>
<div id="docContent"></div>
</div>
{include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /}
<div style="margin-top:-2px; margin-right:2px">
<textarea id="mdContent" style="display:none;">{$article.md_content|raw}</textarea>
<div id="docContent"></div>
</div>
</td>
</tr>
</tr>
{/eq}
{/empty}
</table>
<div class="layui-form-item" style="padding:10px;">
<input type="hidden" name="id" value="{$article.id}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">返回</button>
</div>
</table>
<div class="py-3">
<input type="hidden" name="id" value="{$article.id}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">关闭</button>
</div>
</form>
{/block}
<!-- /主体 -->
@ -143,64 +141,100 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
, layer = layui.layer
, tagspicker = layui.tagpicker
, upload = layui.upload;
const editorType = '{$editor}';
var moduleInit;
if (editorType == 1) {
moduleInit = ['tool', 'tagpicker', 'tinymce'];
}
else {
moduleInit = ['tool', 'tagpicker', 'editormd'];
}
var tags = new tagspicker({
'url': '/admin/api/get_keyword_cate',
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
'height': 500,
'isDiy': 1
});
function gouguInit() {
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker, upload = layui.upload;
var tags = new tagspicker({
'url': '/admin/api/get_keyword_cate',
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
'height': 500,
'isDiy': 1
});
//封面上传
var uploadInst = upload.render({
elem: '#test1'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value', res.data.id);
$('#demo1 img').attr('src', res.data.filepath);
}
});
//封面上传
var uploadInst = upload.render({
elem: '#uploadBtn'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value', res.data.id);
$('#demo1 img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/article/add",
type: 'post',
data: data.field,
success: function (e) {
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
window.location.href="/admin/article/index.html";
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
})
return false;
});
//监听返回
$('.body-table').on('click', '[lay-event="back"]', function () {
window.location.href="/admin/article/index.html";
return false;
});
}
//监听返回
$('body').on('click', '[lay-event="back"]', function () {
tool.tabClose();
return false;
});
if (editorType == 1) {
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.content = tinyMCE.editors['container'].getContent();
if (data.field.content == '') {
layer.msg('请先完善文章内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面吗?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/article/add", data.field, callback);
return false;
});
}
else {
var editor = layui.editormd;
var edit = editor.render('docContent', {
markdown: document.getElementById('mdContent').value
});
//监听提交
form.on('submit(webform)', function (data) {
if (data.field.mdContent == '') {
layer.msg('请先完善文章内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面吗?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/article/add", data.field, callback);
return false;
});
}
}
</script>
{include file="common/layui" base='base' extend="['tagpicker']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline">
<select name="article_cate_id">
<option value="">请选择文章分类</option>
@ -16,7 +16,7 @@
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="article" lay-filter="article"></table>
</div>
<script type="text/html" id="status">
@ -27,11 +27,11 @@
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<a class="layui-btn layui-btn-normal layui-btn-sm" title="添加文章" href="/admin/article/add">+ 添加文章</a>
<span class="layui-btn layui-btn-normal layui-btn-sm tab-a" data-title="添加文章" data-href="/admin/article/add">+ 添加文章</span>
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group"><a class="layui-btn layui-btn-xs" href="/admin/article/add?id={{d.id}}">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
<div class="layui-btn-group"><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
</script>
{/block}
<!-- /主体 -->
@ -39,13 +39,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var TAB = parent.layui.tab,
table = layui.table,
form = layui.form;
var tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '文章列表',
toolbar: '#toolbarDemo',
url: '/admin/article/index', //数据接口
@ -70,7 +68,7 @@
}, {
field: 'title',
title: '文章标题',
templet: '<div><a href="/home/index/index/id/{{d.id}}.html" class="layui-table-link" target="_blank">{{d.title}}</a></div>'
templet: '<div><a href="/home/article/detail/id/{{d.id}}.html" class="layui-table-link" target="_blank">{{d.title}}</a></div>'
},{
field: 'read',
title: '阅读数',
@ -100,25 +98,23 @@
});
//监听行工具事件
table.on('tool(test)', function(obj) {
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'del') {
if (obj.event === 'edit') {
tool.tabAdd('/admin/article/add?id='+obj.data.id,'编辑文章'+obj.data.id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除吗?', {
icon: 3,
title: '提示'
}, function(index) {
$.ajax({
url: "/admin/article/delete",
data: {
id: data.id
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/article/delete", { id: data.id }, callback);
layer.close(index);
});
}
@ -126,7 +122,7 @@
//监听搜索提交
form.on('submit(webform)', function(data) {
tableIns.reload({
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
article_cate_id: data.field.article_cate_id
@ -139,6 +135,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -2,9 +2,9 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<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, maximum-scale=1">
<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, minimum-scale=1, maximum-scale=1, user-scalable=0">
{block name="meta"}
<link rel="mobile-prefetch" href=""/>
{/block}
@ -16,13 +16,9 @@
<meta name="description" content="{:get_system_config('web','desc')}"/>
{/block}
{block name="css"}
<link rel="stylesheet" href="{__LAYUI__}/css/layui.css?v={:get_system_config('web','version')}" media="all">
<link rel="stylesheet" href="{__ADMIN_CSS__}/common.css?v={:get_system_config('web','version')}" media="all">
<link rel="stylesheet" href="{__GOUGU__}/gougu/css/gougu.css?v={:get_system_config('web','version')}" media="all">
{/block}
{block name="style"}{/block}
{block name="js"}
<script language="javascript" src="{__STATIC__}/jquery.min.js"></script>
{/block}
</head>
<body class="main-body">
<!-- 主体 -->
@ -34,9 +30,19 @@
<!-- /底部 -->
<!-- 脚本 -->
{block name="script"}{/block}
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
console.log('初始化成功...');
}
</script>
{/block}
<!-- /脚本 -->
{block name="js"}
<script src="{__GOUGU__}/layui/layui.js"></script>
<script src="{__GOUGU__}/gougu/gouguInit.js"></script>
{/block}
<!-- 统计代码 -->
{block name="code"}{/block}
<!-- /统计代码 -->

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>找不到模板</title>
<style>
.box-404{padding: 36px 0; text-align: center;}
.error-404{max-width:666px; margin: 0 auto; line-height: 2;}
.title-404{font-size: 24px; color: #EA4335;}
.text-404{font-size: 16px; color:#EA4335;}
.btn-404{padding-top: 16px;color:#EA4335;}
</style>
</head>
<body>
<div class="box-404">
<div><img src="/static/home/images/404.gif" width="500" height="300" alt="404"></div>
</div>
<div class="error-404">
<div class="title-404">出错啦!</div>
<div class="text-404">对不起,找不到模板文件...</div>
<div class="btn-404">{$file | default=""}模板不存在,请检查对应的目录文件,注意区分大小写!</div>
</div>
</body>
</html>

View File

@ -1,23 +0,0 @@
<script src="{__LAYUI__}/layui.js?v={:get_system_config('web','version')}"></script>
<script>
var base="{__LAYUI__}/plugin/";
{if condition=" '[base]'!=='base' "}
base=[base];
{/if}
var extendArray=[extend];
var callback=[callback];
var extend={};
if(extendArray){
if(extendArray.length>0){
for(var i=0;i<extendArray.length;i++){
extend[extendArray[i]]=extendArray[i];
}
}
}
layui.config({
base: base,
version:"{:get_system_config('web','version')}"
}).extend(extend).use(extendArray, function(){
callback(layui);
});
</script>

View File

@ -1,55 +0,0 @@
<link rel="stylesheet" href="{__STATIC__}/mdeditor/css/editormd.min.css?v=1.0.2">
<script src="{__STATIC__}/mdeditor/editormd.min.js"></script>
<script src="{__STATIC__}/mdeditor/plugins/paste.upload.img.js"></script>
<script type="text/javascript">
var editormdId='[id]';
var editormdMarkdown='[markdown]';
var editormdSub='[sub]';
var toolbarArray=[toolbar];
var editormdToolbar=[
"undo", "redo", "|",
"bold", "del", "italic", "quote", "ucwords", "uppercase", "lowercase", "|",
"h1", "h2", "h3", "h4", "h5", "h6", "|",
"list-ul", "list-ol", "hr", "|",
"link", "reference-link", "image", "code", "preformatted-text", "code-block", "table", "datetime", "html-entities", "pagebreak", "|",
"goto-line", "watch", "preview", "fullscreen", "clear", "search", "|",
"help"
];
if(toolbarArray && toolbarArray.length>0){
editormdToolbar=toolbarArray;
}
var indexMarkdownEditor;
indexMarkdownEditor = editormd(editormdId, {
placeholder : "此处开始编写您要发布的内容...",//这里不设置则为默认的
path : '/static/mdeditor/lib/',
height : window.innerHeight-editormdSub,
markdown : document.getElementById(editormdMarkdown).value,
htmlDecode : "style,script,iframe",
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL: "/admin/api/md_upload",
saveHTMLToTextarea : true,//保存html到textarea
toolbarIcons : function() {
return editormdToolbar;
},
lang:{
dialog:{
preformattedText:{placeholder : "此处编写代码..."},
codeBlock:{placeholder : "此处编写代码...."}
}
},
onfullscreen : function() {
this.editor.css("z-index", 120);
},
onfullscreenExit : function() {
this.editor.css({
zIndex : 10,
border : "none",
});
this.resize();
},
onload : function() {
initPasteDragImg(this); //必须
}
});
</script>

View File

@ -1,30 +0,0 @@
<script id="[id]" name="[name]" type="text/plain"></script>
{if condition=" '[ueditor]'!=='more' "}
<script type="text/javascript" src="{__STATIC__}/ueditor/ueditor.config.min.js"></script>
<script type="text/javascript" src="{__STATIC__}/ueditor/ueditor.all.min.js"></script>
{/if}
<script type="text/javascript">
var ueditorId='[id]';
var ueditorWidth='[width]';
var ueditorHeight='[height]';
var readonly='[readonly]';
var toolbarArray=[toolbar];
var ueditorRead=false;
if(readonly=='true'){
ueditorRead=true;
}
var ueditorToolbar=['fullscreen', 'source', 'undo', 'redo','|','fontsize','bold', 'italic', 'underline','forecolor', 'strikethrough', 'superscript', 'subscript','|', 'removeformat', 'formatmatch', 'insertcode', 'pasteplain','link','unlink','|','justifyleft','justifycenter','justifyright','justifyjustify','|', 'insertorderedlist', 'insertunorderedlist','simpleupload', 'insertimage', 'inserttable', 'selectall', 'cleardoc'];
if(toolbarArray && toolbarArray.length>0){
ueditorToolbar=toolbarArray;
}
var ue = UE.getEditor(ueditorId,{
//初始化高度
toolbars: [
ueditorToolbar
],
pasteplain:true,
readonly:ueditorRead,
initialFrameWidth:ueditorWidth,
initialFrameHeight:ueditorHeight
});
</script>

View File

@ -1,17 +1,20 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">配置项</h3>
<table class="layui-table">
<form class="layui-form p-4">
<h3 class="pb-3">配置项</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">配置名称<font>*</font>
</td>
<td>
<input type="hidden" name="id" value="{$id}" />
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入配置名称" lay-reqText="请输入配置名称" class="layui-input" {notempty name="$config.title"} value="{$config.title}" {/notempty}>
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入配置名称"
lay-reqText="请输入配置名称" class="layui-input" {notempty name="$config.title" } value="{$config.title}"
{/notempty}>
</td>
<td class="layui-td-gray">状态<font>*</font>
</td>
<td class="layui-td-gray">状态<font>*</font></td>
<td>{if condition="$id eq 0"}
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="0" title="禁用">
@ -24,23 +27,23 @@
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align: top;">
<td class="layui-td-gray">
配置标识<font>*</font>
</td>
<td colspan="3">
<input type="text" name="name" lay-verify="required" placeholder="请输入配置标识" lay-reqText="请输入配置标识" autocomplete="off" class="layui-input" {notempty name="$config.name"} value="{$config.name}" {/notempty}>
<input type="text" name="name" lay-verify="required" placeholder="请输入配置标识" lay-reqText="请输入配置标识"
autocomplete="off" class="layui-input" {notempty name="$config.name" } value="{$config.name}"
{/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray2" style="vertical-align: top;">
注意
</td>
<td colspan="3">
<span style ="color: red; font-size: 12px;">(注意:新增配置项以后,需要对应新增模板文件,模板文件名称需与标识名称一致,建议复制现有的配置模板文件,然后根据需求修改对应的表单即可)</span>
<td colspan="4">
<span
style="color: red; font-size: 12px;">注意:新增配置项以后,需要对应新增模板文件,模板文件名称需与标识名称一致,建议复制现有的配置模板文件,然后根据需求修改对应的表单即可。</span>
</td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -51,30 +54,24 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
, layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/conf/add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
}
})
}
tool.post("/admin/conf/add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,69 +1,80 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">邮箱配置</h3>
<table class="layui-table">
<form class="layui-form p-4">
<h3 class="pb-3">邮箱配置</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">SMTP地址<font>*</font>
<td class="layui-td-gray-2">SMTP地址<font>*</font>
</td>
<td>
<input type="hidden" name="id" value="{$id}">
<input type="text" name="smtp" lay-verify="required" autocomplete="off" placeholder="请输入SMTP服务器地址" lay-reqText="请输入SMTP服务器地址" class="layui-input" {notempty name="$config.smtp"} value="{$config.smtp}" {/notempty} style="width:240px;display: inline-block;">
<span style="color:#999; font-size:12px;">QQ邮箱的SMTP服务器地址是smtp.qq.com163邮箱的SMTP服务器地址是smtp.163.com</span>
<input type="text" name="smtp" lay-verify="required" autocomplete="off" placeholder="请输入SMTP服务器地址"
lay-reqText="请输入SMTP服务器地址" class="layui-input" {notempty name="$config.smtp" }
value="{$config.smtp}" {/notempty} style="width:240px;display: inline-block;">
<span
style="color:#999; font-size:12px;">如QQ邮箱的SMTP服务器地址是smtp.qq.com163邮箱的SMTP服务器地址是smtp.163.com</span>
</td>
</tr>
<tr>
<td class="layui-td-gray2">协议端口号<font>*</font>
<td class="layui-td-gray-2">协议端口号<font>*</font>
</td>
<td>
<input type="text" name="smtp_port" lay-verify="required" autocomplete="off" placeholder="请输入端口" lay-reqText="请输入端口" class="layui-input" {notempty name="$config.smtp_port"} value="{$config.smtp_port}" {/notempty} style="width:240px;display: inline-block;">
<span style="color:#999; font-size:12px;">QQ邮箱的ssl协议方式端口号是465/587163邮箱的ssl协议方式端口号是465/994</span>
<input type="text" name="smtp_port" lay-verify="required" autocomplete="off" placeholder="请输入端口"
lay-reqText="请输入端口" class="layui-input" {notempty name="$config.smtp_port" }
value="{$config.smtp_port}" {/notempty} style="width:240px;display: inline-block;">
<span style="color:#999; font-size:12px;">QQ邮箱的ssl协议方式端口号是465/587163邮箱的ssl协议方式端口号是465/994</span>
</td>
</tr>
<tr>
<td class="layui-td-gray2">邮箱账户<font>*</font>
<td class="layui-td-gray">邮箱账户<font>*</font>
</td>
<td>
<input type="text" name="smtp_user" autocomplete="off" lay-verify="required" placeholder="请输入邮箱用户名" lay-reqText="请输入邮箱用户名" class="layui-input" {notempty name="$config.smtp_user"} value="{$config.smtp_user}" {/notempty} style="width:240px;display: inline-block;">
<span style="color:#999; font-size:12px;">gougucms@qq.com</span>
<input type="text" name="smtp_user" autocomplete="off" lay-verify="required" placeholder="请输入邮箱用户名"
lay-reqText="请输入邮箱用户名" class="layui-input" {notempty name="$config.smtp_user" }
value="{$config.smtp_user}" {/notempty} style="width:240px;display: inline-block;">
<span style="color:#999; font-size:12px;">gougucms@qq.com</span>
</td>
</tr>
<tr>
<td class="layui-td-gray2">邮箱密码<font>*</font>
<td class="layui-td-gray">邮箱密码<font>*</font>
</td>
<td>
<input type="password" name="smtp_pwd" lay-verify="required" autocomplete="off" placeholder="请输入邮箱密码"
class="layui-input" {notempty name="$config.smtp_pwd"} value="{$config.smtp_pwd}" {/notempty} style="width:240px;display: inline-block;">
<span style="color:#999; font-size:12px;">
class="layui-input" {notempty name="$config.smtp_pwd" } value="{$config.smtp_pwd}" {/notempty}
style="width:240px;display: inline-block;">
<span style="color:#999; font-size:12px;">
不一定是登录密码如QQ邮箱的是第三方授权登录码要自己去开启在邮箱的设置->账户->POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务</span>
</td>
</tr>
<tr>
<td class="layui-td-gray2">发送人<font>*</font>
<td class="layui-td-gray">发送人<font>*</font>
</td>
<td>
<input type="text" name="from" autocomplete="off" lay-verify="required" placeholder="请输入要显示的发送者" lay-reqText="请输入要显示的发送者"
class="layui-input" {notempty name="$config.from"} value="{$config.from}" {/notempty} style="width:240px; display: inline-block;">
<input type="text" name="from" autocomplete="off" lay-verify="required" placeholder="请输入要显示的发送者"
lay-reqText="请输入要显示的发送者" class="layui-input" {notempty name="$config.from" } value="{$config.from}"
{/notempty} style="width:240px; display: inline-block;">
<span style="color:#999; font-size:12px;">用于展示给发送方勾股CMS系统管理员</span>
</td>
</tr>
<tr>
<td class="layui-td-gray2">显示的邮箱<font>*</font>
<td class="layui-td-gray">显示的邮箱<font>*</font>
</td>
<td>
<input type="text" name="email" lay-verify="required" autocomplete="off" placeholder="请输入要显示的发送者邮箱" lay-reqText="请输入要显示的发送者邮箱"
class="layui-input" {notempty name="$config.email"} value="{$config.email}" {/notempty} style="width:240px;display: inline-block;">
<input type="text" name="email" lay-verify="required" autocomplete="off" placeholder="请输入要显示的发送者邮箱"
lay-reqText="请输入要显示的发送者邮箱" class="layui-input" {notempty name="$config.email" }
value="{$config.email}" {/notempty} style="width:240px;display: inline-block;">
<span style="color:#999;font-size:12px;">可以不同于上面的账户用于展示给发送方的邮箱admin@gougucms.com</span>
</td>
</tr>
<tr>
<td class="layui-td-gray2">邮件模板</td>
<td><textarea name="template" placeholder="" class="layui-textarea" id="container" style="border:0;padding:0">{notempty name="$config.template"}{$config.template}{/notempty}</textarea></td>
<td class="layui-td-gray">邮件模板</td>
<td><textarea name="template" placeholder="" class="layui-textarea" id="container">{notempty name="$config.template"}{$config.template}{/notempty}</textarea>
</td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button lay-event="email" class="layui-btn">发送测试</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
@ -75,29 +86,30 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
, layer = layui.layer;
const moduleInit = ['tool','tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tinymce = layui.tinymce;
var edit = tinymce.render({
selector: "#container",
height: 300
});
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/conf/edit",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
data.field.template = tinyMCE.editors['container'].getContent();
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
}
})
}
tool.post("/admin/conf/edit", data.field, callback);
return false;
});
$('.body-content').on('click', '[lay-event="email"]', function () {
$('body').on('click', '[lay-event="email"]', function () {
layer.prompt({
formType: 0,
value: '',
@ -128,9 +140,6 @@
return false;
})
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{include file="common/ueditor" id="container" name="content" width="100%" height="100%" toolbar="[]" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table class="layui-hide" id="test" lay-filter="test"></table>
<div class="p-3">
<table class="layui-hide" id="conf" lay-filter="conf"></table>
</div>
<script type="text/html" id="status">
@ -19,14 +19,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#conf',
title: '配置列表',
toolbar: '#toolbarDemo',
url: "/admin/conf/index",
@ -38,14 +35,14 @@
width: 80,
title: 'ID编号',
align: 'center'
},{
}, {
field: 'title',
width: 200,
title: '配置名称'
}, {
field: 'name',
title: '配置标识(新增的模板文件名称需与标识名称一致)'
},{
}, {
field: 'status',
width: 80,
title: '状态',
@ -62,16 +59,24 @@
}]
]
});
//监听行工具事件
table.on('tool(test)', function(obj){
var data = obj.data;
if(obj.event === 'add'){
rightpage.open('/admin/conf/add?id='+data.id,'900px');
//表头工具栏事件
table.on('toolbar(conf)', function (obj) {
if (obj.event === 'add') {
tool.side("/admin/conf/add");
return;
}
if(obj.event === 'edit'){
rightpage.open('/admin/conf/edit?id='+data.id);
});
//监听行工具事件
table.on('tool(conf)', function (obj) {
var data = obj.data;
if (obj.event === 'add') {
tool.side('/admin/conf/add?id=' + data.id);
return;
}
if (obj.event === 'edit') {
tool.side('/admin/conf/edit?id=' + data.id);
return;
}
if (obj.event === 'del') {
@ -79,42 +84,23 @@
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/conf/delete",
type: 'post',
data: {
id: obj.data.id
},
success: function (res) {
layer.msg(res.msg);
if (res.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
layer.close(index);
}
})
layer.close(index);
}
tool.delete("/admin/conf/delete", { id: obj.data.id }, callback);
});
}
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
if (obj.event === 'add') {
rightpage.open("/admin/conf/add",'900px');
return;
}
});
//监听搜索提交
form.on('submit(webform)', function (data) {
if (data.field.keywords) {
tableIns.reload({
where: {
keywords: data.field.keywords
},
page: {
curr: 1
}
where: { keywords: data.field.keywords }, page: { curr: 1 }
});
} else {
location.reload();
@ -123,6 +109,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,37 +1,45 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">其他配置</h3>
<table class="layui-table">
<form class="layui-form p-4">
<h3 class="pb-3">其他配置</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">开发者</td>
<td class="layui-td-gray">开发者</td>
<td>
<input type="hidden" value="{$id}" name="id">
<input type="text" name="author" autocomplete="off" placeholder="请输入开发者" lay-reqText="请输入开发者" class="layui-input"{notempty name="$config.author"} value="{$config.author}" {/notempty}>
<input type="text" name="author" autocomplete="off" placeholder="请输入开发者" lay-reqText="请输入开发者"
class="layui-input" {notempty name="$config.author" } value="{$config.author}" {/notempty}>
</td>
<td class="layui-td-gray2">开发版本号
<td class="layui-td-gray-2">开发版本号
</td>
<td>
<input type="text" name="version" autocomplete="off" placeholder="请输入版本号" lay-reqText="请输入版本号" class="layui-input" {notempty name="$config.version"} value="{$config.version}" {/notempty}>
<input type="text" name="version" autocomplete="off" placeholder="请输入版本号" lay-reqText="请输入版本号"
class="layui-input" {notempty name="$config.version" } value="{$config.version}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray2">系统文本编辑器</td>
<td colspan="3">
<td class="layui-td-gray-3">系统文本编辑器</td>
<td colspan="3">
{empty name="$config.editor"}
<input type="radio" name="editor" value="1" title="百度编辑器(ueditor)" checked>
<input type="radio" name="editor" value="2" title="Markdown编辑器(editor.md)" >
<input type="radio" name="editor" value="2" title="Markdown编辑器(editor.md)">
{else/}
<input type="radio" name="editor" value="1" title="百度编辑器(ueditor)" {eq name="$config.editor" value="1"}checked{/eq}>
<input type="radio" name="editor" value="2" title="Markdown编辑器(editor.md)" {eq name="$config.editor" value="2"}checked{/eq}>
<input type="radio" name="editor" value="1" title="百度编辑器(ueditor)" {eq name="$config.editor" value="1"
}checked{/eq}>
<input type="radio" name="editor" value="2" title="Markdown编辑器(editor.md)" {eq name="$config.editor"
value="2" }checked{/eq}>
{/empty}
<span style="margin-left:30px; color: red">注意:切换编辑器后,文本内容可能需要重新编辑。</span>
</td>
</tr>
<tr>
<td colspan="4">
<span style="margin-left:20px; color: red">注意:切换编辑器后,文章内容对应的文本内容可能需要重新编辑。</span>
</td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -42,29 +50,23 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form,
layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/conf/edit",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
}
})
}
tool.post("/admin/conf/edit", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,43 +1,47 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">Token配置</h3>
<table class="layui-table">
<form class="layui-form p-4">
<h3 class="pb-3">TOKEN配置</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">Token签发组织</td>
<td class="layui-td-gray-2">Token签发组织</td>
<td>
<input type="hidden" value="{$id}" name="id">
<input type="text" name="iss" autocomplete="off" placeholder="请输入签发组织" lay-reqText="请输入签发组织" class="layui-input"{notempty name="$config.iss"} value="{$config.iss}" {/notempty}>
<input type="text" name="iss" autocomplete="off" placeholder="请输入签发组织" lay-reqText="请输入签发组织"
class="layui-input" {notempty name="$config.iss" } value="{$config.iss}" {/notempty}>
</td>
<td class="layui-td-gray2">Token签发作者
<td class="layui-td-gray-2">Token签发作者
</td>
<td>
<input type="text" name="aud" autocomplete="off" placeholder="请输入签发作者" lay-reqText="请输入签发作者" class="layui-input" {notempty name="$config.aud"} value="{$config.aud}" {/notempty}>
<input type="text" name="aud" autocomplete="off" placeholder="请输入签发作者" lay-reqText="请输入签发作者"
class="layui-input" {notempty name="$config.aud" } value="{$config.aud}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray2">Token Secrect</td>
<td class="layui-td-gray">Token Secrect</td>
<td>
<input type="text" name="secrect" autocomplete="off" placeholder="请输入secrect" lay-reqText="请输入secrect" class="layui-input"{notempty name="$config.secrect"} value="{$config.secrect}" {/notempty}>
<input type="text" name="secrect" autocomplete="off" placeholder="请输入secrect" lay-reqText="请输入secrect"
class="layui-input" {notempty name="$config.secrect" } value="{$config.secrect}" {/notempty}>
</td>
<td class="layui-td-gray2">Token过期时间
<td class="layui-td-gray">Token过期时间
</td>
<td>
<input type="text" name="exptime" autocomplete="off" placeholder="请输入过期时间" lay-reqText="请输入过期时间" class="layui-input" {notempty name="$config.exptime"} value="{$config.exptime}" {/notempty}>
<input type="text" name="exptime" autocomplete="off" placeholder="请输入过期时间" lay-reqText="请输入过期时间"
class="layui-input" {notempty name="$config.exptime" } value="{$config.exptime}" {/notempty}>
</td>
</tr>
</table>
<div style="padding:20px 0;">
<span class="layui-btn layui-btn-sm" onclick="testReg();">Api测试注册</span>
<span class="layui-btn layui-btn-sm" onclick="testLogin();">Api测试登录</span>
<span class="layui-btn layui-btn-sm" onclick="testToken();">Token测试</span>
<span class="layui-btn layui-btn-sm" onclick="testReg();">Api测试注册</span>
<span class="layui-btn layui-btn-sm" onclick="testLogin();">Api测试登录</span>
<span class="layui-btn layui-btn-sm" onclick="testToken();">Token测试</span>
</div>
<div style="padding:20px; background-color:#f2f2f2;word-wrap:break-word">
<div style="padding:12px 0;word-wrap:break-word">
测试结果:
<div id="res"></div>
</div>
<div style="padding: 20px 0">
<div class="p-y3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -48,36 +52,26 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form,
layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/conf/edit",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
}
})
}
tool.post("/admin/conf/edit", data.field, callback);
return false;
});
//监听返回
$('.body-content').on('click', '[lay-event="back"]', function () {
history.back(-1);
return false;
});
}
var token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuZ291Z3VjbXMuY29tIiwiYXVkIjoiZ291Z3VjbXMiLCJpYXQiOjE2MjczMTY1MTgsImV4cCI6MTYyNzMyMDExOCwidWlkIjoxfQ.3soLDbwrEqn4EZtpD4h05FmvmMtJEh1LtE1vZ_ANcnI';
function testToken(){
function testToken() {
$.ajax({
headers: {
Token: token
@ -86,15 +80,15 @@
type: "get",
success: function (res) {
$('#res').html(JSON.stringify(res));
if(res.code == 111){
if (res.code == 111) {
layer.msg(res.msg);
}
}
});
}
function testReg(){
var content='<form class="layui-form" style="width:400px"><div style="padding:10px 15px">\
function testReg() {
var content = '<form class="layui-form" style="width:400px"><div style="padding:10px 15px">\
<p style="padding:10px 0">用户名:</p>\
<p><input name="username" type="text" class="layui-input" value=""/></p>\
<p style="padding:10px 0">密 码:</p>\
@ -104,89 +98,88 @@
</div>\
</form>';
layer.open({
type:1,
title:'API测试用户注册',
area:['432px','360px'],
content:content,
type: 1,
title: 'API测试用户注册',
area: ['432px', '360px'],
content: content,
btnAlign: 'c',
btn: ['注册'],
yes: function(idx){
yes: function (idx) {
var username = $('[name="username"]').val();
var password = $('[name="password"]').val();
var newpassword = $('[name="newpassword"]').val();
if(username==''){
if (username == '') {
layer.msg('请填写用户名');
return;
}
if(password==''){
if (password == '') {
layer.msg('请填写密码');
return;
}
if(password != newpassword){
if (password != newpassword) {
layer.msg('两次密码填写不一致');
return;
}
$.ajax({
url: "/api/index/reg",
type:'post',
data:{username:username,pwd:password},
success:function(res){
type: 'post',
data: { username: username, pwd: password },
success: function (res) {
$('#res').html(JSON.stringify(res));
layer.msg(res.msg);
if(res.code==1){
if (res.code == 1) {
token = res.data.token;
layer.close(idx);
}
}
})
})
}
})
})
}
function testLogin(){
var content='<form class="layui-form" style="width:400px"><div style="padding:10px 15px">\
function testLogin() {
var content = '<form class="layui-form" style="width:400px"><div style="padding:10px 15px">\
<p style="padding:10px 0">用户名:</p>\
<p><input name="username" type="text" class="layui-input" value="hdm58"/></p>\
<p style="padding:10px 0">密 码:</p>\
<p><input name="password" type="password" class="layui-input" value="123456"/></p>\
</div>\
</form>';
layer.open({
type:1,
title:'API测试用户登录',
area:['432px','300px'],
content:content,
btnAlign: 'c',
btn: ['登录'],
yes: function(idx){
var username = $('[name="username"]').val();
var password = $('[name="password"]').val();
if(username==''){
layer.msg('请填写用户名');
return;
}
if(password==''){
layer.msg('请填写密码');
return;
}
$.ajax({
url: "/api/index/login",
type:'post',
data:{username:username,password:password},
success:function(res){
$('#res').html(JSON.stringify(res));
layer.msg(res.msg);
if(res.code==1){
token = res.data.token;
layer.close(idx);
}
}
})
layer.open({
type: 1,
title: 'API测试用户登录',
area: ['432px', '300px'],
content: content,
btnAlign: 'c',
btn: ['登录'],
yes: function (idx) {
var username = $('[name="username"]').val();
var password = $('[name="password"]').val();
if (username == '') {
layer.msg('请填写用户名');
return;
}
})
}
if (password == '') {
layer.msg('请填写密码');
return;
}
$.ajax({
url: "/api/index/login",
type: 'post',
data: { username: username, password: password },
success: function (res) {
$('#res').html(JSON.stringify(res));
layer.msg(res.msg);
if (res.code == 1) {
token = res.data.token;
layer.close(idx);
}
}
})
}
})
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,82 +1,99 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">系统配置</h3>
<table class="layui-table">
<form class="layui-form p-4">
<h3 class="pb-3">系统配置</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">系统名称<font>*</font>
<td class="layui-td-gray-2">系统名称<font>*</font>
</td>
<td>
<input type="hidden" name="id" value="{$id}">
<input type="text" name="admin_title" lay-verify="required" autocomplete="off" placeholder="请输入系统名称" lay-reqText="请输入系统名称" class="layui-input" {notempty name="$config.admin_title"} value="{$config.admin_title}" {/notempty}>
<input type="text" name="admin_title" lay-verify="required" autocomplete="off" placeholder="请输入系统名称"
lay-reqText="请输入系统名称" class="layui-input" {notempty name="$config.admin_title" }
value="{$config.admin_title}" {/notempty}>
</td>
<td class="layui-td-gray2">网站名称<font>*</font>
<td class="layui-td-gray">网站名称<font>*</font>
</td>
<td>
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入网站平台名称" lay-reqText="请输入网站名称" class="layui-input" {notempty name="$config.title"} value="{$config.title}" {/notempty}>
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入网站平台名称"
lay-reqText="请输入网站名称" class="layui-input" {notempty name="$config.title" } value="{$config.title}"
{/notempty}>
</td>
<td rowspan="3" class="layui-td-gray2">系统LOGO</td>
<td rowspan="3" class="layui-td-gray">系统LOGO</td>
<td rowspan="3" style="width: 240px;">
<div class="layui-upload" style="width: 240px;">
<div class="layui-upload-list" id="demo1" style="width: 100%; height:100px; overflow: hidden;">
<img src='{notempty name="$config.logo"}{$config.logo}{/notempty}' style="max-width: 100%; width: 100%;" />
<input type="hidden" name="logo" {notempty name="$config.logo"} value="{$config.logo}" {/notempty}>
<img src='{notempty name="$config.logo"}{$config.logo}{/notempty}'
style="max-width: 100%; width: 100%;" />
<input type="hidden" name="logo" {notempty name="$config.logo" } value="{$config.logo}"
{/notempty}>
</div>
<button type="button" class="layui-btn layui-btn-normal" style="width: 100%;"
id="test1">上传LOGO</button>
id="uploadBtn">上传LOGO</button>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray2">网站域名<font>*</font>
<td class="layui-td-gray">网站域名<font>*</font>
</td>
<td>
<input type="text" name="domain" lay-verify="required" autocomplete="off" placeholder="请输入网站域名" lay-reqText="请输入网站域名" class="layui-input" {notempty name="$config.domain"} value="{$config.domain}" {/notempty}>
<input type="text" name="domain" lay-verify="required" autocomplete="off" placeholder="请输入网站域名"
lay-reqText="请输入网站域名" class="layui-input" {notempty name="$config.domain" } value="{$config.domain}"
{/notempty}>
</td>
<td class="layui-td-gray2">ICP备案号</td>
<td class="layui-td-gray">ICP备案号</td>
<td>
<input type="text" name="icp" autocomplete="off" placeholder="请输入ICP备案号" class="layui-input" {notempty name="$config.icp"} value="{$config.icp}" {/notempty}>
<input type="text" name="icp" autocomplete="off" placeholder="请输入ICP备案号" class="layui-input" {notempty
name="$config.icp" } value="{$config.icp}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray2">SEO关键词<font>*</font>
<td class="layui-td-gray">SEO关键词<font>*</font>
</td>
<td>
<input type="text" name="keywords" lay-verify="required" autocomplete="off" placeholder="多个关键词用“,”隔开" lay-reqText="请输入SEO关键字" class="layui-input" {notempty name="$config.keywords"} value="{$config.keywords}" {/notempty}>
<input type="text" name="keywords" lay-verify="required" autocomplete="off" placeholder="多个关键词用“,”隔开"
lay-reqText="请输入SEO关键字" class="layui-input" {notempty name="$config.keywords" }
value="{$config.keywords}" {/notempty}>
</td>
<td class="layui-td-gray2">公安备案号</td>
<td class="layui-td-gray-2">公安备案号</td>
<td>
<input type="text" name="beian" autocomplete="off" placeholder="请输入公安备案号" class="layui-input" {notempty name="$config.beian"} value="{$config.beian}" {/notempty}>
<input type="text" name="beian" autocomplete="off" placeholder="请输入公安备案号" class="layui-input" {notempty
name="$config.beian" } value="{$config.beian}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray2">SEO描述<font>*</font>
<td class="layui-td-gray">SEO描述<font>*</font>
</td>
<td colspan="5">
<textarea name="desc" lay-verify="required" placeholder="请输入网站描述" lay-reqText="请输入网站描述" class="layui-textarea">{notempty name="$config.desc"}{$config.desc} {/notempty}</textarea>
<textarea name="desc" lay-verify="required" placeholder="请输入网站描述" lay-reqText="请输入网站描述"
class="layui-textarea">{notempty name="$config.desc"}{$config.desc} {/notempty}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray2">统计代码</td>
<td class="layui-td-gray">统计代码</td>
<td colspan="5">
<textarea name="code" placeholder="请输入完整的统计代码" class="layui-textarea">{notempty name="$config.code"} value={$config.code}{/notempty}</textarea>
<textarea name="code" placeholder="请输入完整的统计代码"
class="layui-textarea">{notempty name="$config.code"} value={$config.code}{/notempty}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray2">版权信息</td>
<td class="layui-td-gray">版权信息</td>
<td colspan="3">
<input type="text" name="copyright" autocomplete="off" placeholder="请输入版权信息" lay-reqText="请输入版权信息" class="layui-input"{notempty name="$config.copyright"} value="{$config.copyright}" {/notempty}>
<input type="text" name="copyright" autocomplete="off" placeholder="请输入版权信息" lay-reqText="请输入版权信息"
class="layui-input" {notempty name="$config.copyright" } value="{$config.copyright}" {/notempty}>
</td>
<td class="layui-td-gray2">代码版本号<font>*</font>
<td class="layui-td-gray-2">代码版本号<font>*</font>
</td>
<td>
<input type="text" lay-verify="required" name="version" autocomplete="off" placeholder="请输入版本号" lay-reqText="请输入版本号" class="layui-input" {notempty name="$config.version"} value="{$config.version}" {/notempty}>
<input type="text" lay-verify="required" name="version" autocomplete="off" placeholder="请输入版本号"
lay-reqText="请输入版本号" class="layui-input" {notempty name="$config.version" }
value="{$config.version}" {/notempty}>
</td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -87,47 +104,38 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form,
layer = layui.layer,
upload = layui.upload;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool, upload = layui.upload;
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
}
}
tool.post("/admin/conf/edit", data.field, callback);
return false;
});
//logo上传
var uploadInst = upload.render({
elem: '#test1',
elem: '#uploadBtn',
url: "/admin/api/upload",
done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
layer.msg('上传失败');
} else {
layer.msg('上传成功');
$('#demo1 input').attr('value', res.data.filepath);
$('#demo1 img').attr('src', res.data.filepath);
}
//上传成功
layer.msg('上传成功');
$('#demo1 input').attr('value', res.data.filepath);
$('#demo1 img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/conf/edit",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,64 +1,80 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 style="height:36px">微信配置</h3>
<form class="layui-form p-4">
<h3 class="pb-3">微信配置</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray3">token<font>*</font></td>
<td>
<td class="layui-td-gray">token<font>*</font>
</td>
<td>
<input type="hidden" value="{$id}" name="id">
<input type="text" name="token" lay-verify="required" autocomplete="off" placeholder="请输入Token" class="layui-input" {notempty name="$config.token"} value="{$config.token}" {/notempty}>
<input type="text" name="token" lay-verify="required" autocomplete="off" placeholder="请输入Token"
class="layui-input" {notempty name="$config.token" } value="{$config.token}" {/notempty}>
</td>
<td class="layui-td-gray">登录回调地址<font>*</font>
</td>
<td class="layui-td-gray3">登录回调地址<font>*</font></td>
<td>
<input type="text" name="login_back_url" lay-verify="required" autocomplete="off" placeholder="请输入微信登录回调地址" class="layui-input" {notempty name="$config.login_back_url"} value="{$config.login_back_url}" {/notempty}>
<input type="text" name="login_back_url" lay-verify="required" autocomplete="off"
placeholder="请输入微信登录回调地址" class="layui-input" {notempty name="$config.login_back_url" }
value="{$config.login_back_url}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray3">公众号appid<font>*</font></td>
<td>
<input type="text" name="appid" lay-verify="required" autocomplete="off" placeholder="请输入appID" class="layui-input" {notempty name="$config.appid"} value="{$config.appid}" {/notempty}>
<td class="layui-td-gray">公众号appid<font>*</font>
</td>
<td class="layui-td-gray3">公众号appsecret<font>*</font></td>
<td>
<input type="text" name="appsecret" lay-verify="required" autocomplete="off" placeholder="请输入secretey" class="layui-input" {notempty name="$config.appsecret"} value="{$config.appsecret}" {/notempty}>
<input type="text" name="appid" lay-verify="required" autocomplete="off" placeholder="请输入appID"
class="layui-input" {notempty name="$config.appid" } value="{$config.appid}" {/notempty}>
</td>
<td class="layui-td-gray">公众号appsecret<font>*</font>
</td>
<td>
<input type="text" name="appsecret" lay-verify="required" autocomplete="off" placeholder="请输入secretey"
class="layui-input" {notempty name="$config.appsecret" } value="{$config.appsecret}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray3">支付商户号</td>
<td class="layui-td-gray">支付商户号</td>
<td>
<input type="text" name="mchid" autocomplete="off" placeholder="请输入微信支付商户号" class="layui-input" {notempty name="$config.mchid"} value="{$config.mchid}" {/notempty}>
<input type="text" name="mchid" autocomplete="off" placeholder="请输入微信支付商户号" class="layui-input"
{notempty name="$config.mchid" } value="{$config.mchid}" {/notempty}>
</td>
<td class="layui-td-gray3">支付API密钥</td>
<td class="layui-td-gray">支付API密钥</td>
<td>
<input type="text" name="secrect_key" autocomplete="off" placeholder="请输入微信支付API密钥" class="layui-input"
{notempty name="$config.secrect_key"} value="{$config.secrect_key}" {/notempty}>
{notempty name="$config.secrect_key" } value="{$config.secrect_key}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray3">支付证书路径</td>
<td class="layui-td-gray">支付证书路径</td>
<td>
<input type="text" name="cert_url" autocomplete="off" placeholder="请输入微信支付证书路径" class="layui-input"
{notempty name="$config.cert_url"} value="{$config.cert_url}" {/notempty}>
{notempty name="$config.cert_url" } value="{$config.cert_url}" {/notempty}>
</td>
<td class="layui-td-gray3">支付回调地址</td>
<td class="layui-td-gray">支付回调地址</td>
<td>
<input type="text" name="pay_back_url" autocomplete="off" placeholder="请输入微信支付回调地址" class="layui-input" {notempty name="$config.pay_back_url"} value="{$config.pay_back_url}" {/notempty}>
<input type="text" name="pay_back_url" autocomplete="off" placeholder="请输入微信支付回调地址" class="layui-input"
{notempty name="$config.pay_back_url" } value="{$config.pay_back_url}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray3">小程序appid<font>*</font></td>
<td>
<input type="text" name="xcx_appid" lay-verify="required" autocomplete="off" placeholder="请输入小程序appid" class="layui-input" {notempty name="$config.xcx_appid"} value="{$config.xcx_appid}" {/notempty}>
<td class="layui-td-gray-2">小程序appid<font>*</font>
</td>
<td class="layui-td-gray3">小程序appsecret<font>*</font></td>
<td>
<input type="text" name="xcx_appsecret" lay-verify="required" autocomplete="off" placeholder="请输入小程序appsecret" class="layui-input" {notempty name="$config.xcx_appsecret"} value="{$config.xcx_appsecret}" {/notempty}>
<input type="text" name="xcx_appid" lay-verify="required" autocomplete="off" placeholder="请输入小程序appid"
class="layui-input" {notempty name="$config.xcx_appid" } value="{$config.xcx_appid}" {/notempty}>
</td>
<td class="layui-td-gray-3">小程序appsecret<font>*</font>
</td>
<td>
<input type="text" name="xcx_appsecret" lay-verify="required" autocomplete="off"
placeholder="请输入小程序appsecret" class="layui-input" {notempty name="$config.xcx_appsecret" }
value="{$config.xcx_appsecret}" {/notempty}>
</td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -69,29 +85,23 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form,
layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/conf/edit",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
}
})
}
tool.post("/admin/conf/edit", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->
<!-- /脚本 -->

View File

@ -1,50 +1,55 @@
{extend name="common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
<tr style="background-color: #f5f5f5; text-align: center;">
<div class="p-3">
<div class="gg-form-bar border-t border-x" style="background-color:#FAFAFA">
<h3>数据还原</h3>
</div>
<table cellspacing="0" cellpadding="0" border="0" class="layui-table layui-table-form">
<tr>
<th style=" text-align: center; font-weight: 800;"><span>文件名称</span></th>
<th style=" text-align: center; font-weight: 800;"><span>文件格式</span></th>
<th style=" text-align: center; font-weight: 800;"><span>分隔符</span></th>
<th style=" text-align: center; font-weight: 800;"><span>文件总大小</span></th>
<th style=" text-align: center; font-weight: 800;"><span>分卷总数</span></th>
<th style=" text-align: center; font-weight: 800; width:222px"><span>操作</span></th>
</tr>
</tr>
{empty name="list"}
<tr>
<td colspan="6" align="center">暂无备份数据</td>
</tr>
{/empty}
{volist name="list" id="vo" key="k"}
<tr style="background-color: #fafafa;">
<td><strong>备份时间:{$vo.time}</strong>{if $vo.timespan == $lock_time}<span style="color:red; margin-left:20px;">该备份不是完整备份,请删除重新备份</span>{/if}</td>
<td align="center"><span>.sql</span></td>
<td align="center"><span>{$vo.data.compress}</span></td>
<td align="center"><span>{:format_bytes($vo.data.size)}</span></td>
<td align="center"><span>{$vo.data.part}</span></td>
<td align="center">
<div class="layui-btn-group" data-time='{$vo.timespan}'>
{if $vo.timespan == $lock_time}
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="reset">清除不完整的备份</a>
{else/}
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="import">数据还原</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">备份删除</a>
{/if}
</div>
</td>
</tr>
{for start="0" end="$vo.data.part" step="1"}
<tr>
<td colspan="5">
{:date("Ymd",$vo.timespan)}{$vo.data.compress}{:date("His",$vo.timespan)}{$vo.data.compress}{$i+1}.sql
</td>
<td align="center">
<a class="layui-btn layui-btn-xs" href='/admin/database/downfile?time={$vo.data.time}&part={$i+1}'>下载备份(分卷{$i+1})</a>
</td>
</tr>
{/for}
{/volist}
{volist name="list" id="vo" key="k"}
<tr style="background-color: #fafafa;">
<td><strong>备份时间:{$vo.time}</strong>{if $vo.timespan == $lock_time}<span
style="color:red; margin-left:20px;">该备份不是完整备份,请删除重新备份</span>{/if}</td>
<td align="center"><span>.sql</span></td>
<td align="center"><span>{$vo.data.compress}</span></td>
<td align="center"><span>{:format_bytes($vo.data.size)}</span></td>
<td align="center"><span>{$vo.data.part}</span></td>
<td align="center">
<div class="layui-btn-group" data-time='{$vo.timespan}'>
{if $vo.timespan == $lock_time}
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="reset">清除不完整的备份</a>
{else/}
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="import">数据还原</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">备份删除</a>
{/if}
</div>
</td>
</tr>
{for start="0" end="$vo.data.part" step="1"}
<tr>
<td colspan="5">
{:date("Ymd",$vo.timespan)}{$vo.data.compress}{:date("His",$vo.timespan)}{$vo.data.compress}{$i+1}.sql
</td>
<td align="center">
<a class="layui-btn layui-btn-xs"
href='/admin/database/downfile?time={$vo.data.time}&part={$i+1}'>下载备份(分卷{$i+1})</a>
</td>
</tr>
{/for}
{/volist}
</table>
</div>
@ -54,97 +59,96 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
function importData(data){
if(data.code==0){
function gouguInit() {
function importData(data) {
if (data.code == 0) {
console.log(data.msg);
layer.closeAll();
layer.msg(data.msg,{time: 200000});
if($.isPlainObject(data.data)){
layer.msg(data.msg, { time: 200000 });
if ($.isPlainObject(data.data)) {
$.ajax({
url: "/admin/database/import",
type:'get',
data:{"part" : data.data.part, "start" : data.data.start,time:data.data.time},
success: function (res) {
importData(res);
}
})
}else {
layer.msg(data.msg);
window.onbeforeunload = function(){ return null; }
}
} else {
layer.msg(data.msg);
}
}
//监听行工具事件
$('[lay-event="import"]').on('click',function(){
var time=$(this).parent().data('time');
layer.confirm('确认要还原该备份吗?', {
icon: 3,
title: '提示'
}, function (index) {
layer.msg("数据还原中...",{time: 200000});
$.ajax({
url: "/admin/database/import?time="+time,
type:'get',
type: 'get',
data: { "part": data.data.part, "start": data.data.start, time: data.data.time },
success: function (res) {
importData(res);
}
})
window.onbeforeunload = function(){ return "正在还原数据库,请不要关闭!" }
} else {
layer.msg(data.msg);
window.onbeforeunload = function () { return null; }
}
} else {
layer.msg(data.msg);
}
}
//监听行工具事件
$('[lay-event="import"]').on('click', function () {
var time = $(this).parent().data('time');
layer.confirm('确认要还原该备份吗?', {
icon: 3,
title: '提示'
}, function (index) {
layer.msg("数据还原中...", { time: 200000 });
$.ajax({
url: "/admin/database/import?time=" + time,
type: 'post',
success: function (res) {
importData(res);
}
})
window.onbeforeunload = function () { return "正在还原数据库,请不要关闭!" }
layer.close(index);
});
return false;
})
$('[lay-event="del"]').on('click',function(){
var time=$(this).parent().data('time');
$('[lay-event="del"]').on('click', function () {
var time = $(this).parent().data('time');
layer.confirm('确认要删除该备份吗?', {
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/database/del",
data: {'time':time},
success: function (res) {
layer.msg(res.msg);
if (res.code == 0) {
setTimeout(function(){
location.reload();
},2000)
}
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/database/del",
data: { 'time': time },
success: function (res) {
layer.msg(res.msg);
if (res.code == 0) {
setTimeout(function () {
location.reload();
}, 2000)
}
})
layer.close(index);
});
}
})
layer.close(index);
});
return false;
})
$('[lay-event="reset"]').on('click',function(){
var time=$(this).parent().data('time');
$('[lay-event="reset"]').on('click', function () {
var time = $(this).parent().data('time');
layer.confirm('确认要清除该备份吗?', {
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/database/del",
data: {'time':time,'lock':1},
success: function (res) {
layer.msg(res.msg);
if (res.code == 0) {
setTimeout(function(){
location.reload();
},2000)
}
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/database/del",
data: { 'time': time, 'lock': 1 },
success: function (res) {
layer.msg(res.msg);
if (res.code == 0) {
setTimeout(function () {
location.reload();
}, 2000)
}
})
layer.close(index);
});
}
})
layer.close(index);
});
return false;
})
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table class="layui-hide" id="backup" lay-filter="test"></table>
<div class="p-3">
<table class="layui-hide" id="backup" lay-filter="backup"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-group">
@ -12,16 +12,11 @@
</script>
{/block}
<!-- /主体 -->
<script>
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var table = layui.table,
form = layui.form;
function gouguInit() {
var table = layui.table, form = layui.form;
var tableIns = table.render({
elem: '#backup',
title: '数据备份',
@ -30,45 +25,45 @@
page: false,
cols: [
[ //表头
{type: 'checkbox'},
{ type: 'checkbox' },
{
field: 'name',
title: '数据表',
width: 220
width: 200
},
{
field: 'status',
title: '状态',
width: 120,
templet:function(d){
return '<span id="table_'+d.name+'">-</span>';
width: 100,
templet: function (d) {
return '<span id="table_' + d.name + '">-</span>';
}
},
{
field: 'engine',
title: '存储引擎',
align: 'center',
width: 90
width: 80
}, {
field: 'row_format',
title: '行格式',
align: 'center',
width: 90
width: 80
}, {
field: 'rows',
title: '行数',
align: 'center',
width: 100,
width: 60,
}, {
field: 'data_size',
title: '字节数',
align: 'center',
width: 120
width: 80
}, {
field: 'data_length',
title: '数据大小',
align: 'center',
width: 120
width: 80
}, {
field: 'comment',
title: '数据表注释'
@ -80,61 +75,60 @@
}
]
],
done:function(res, curr, count){
done: function (res, curr, count) {
$('#dataTips').html(res.msg);
}
});
      //递归备份表
       function backup(tab,status,table){
//递归备份表
function backup(tab, status, table) {
layer.closeAll();
layer.msg("备份中...,请勿关闭本页面",{time: 200000});
        $.get("/admin/database/backup", tab, function(data){
           // console.log(data)
if(data.code==0){
             showmsg(data.data.tab.table, data.msg);
              if(data.data.tab.start=='ok'){
layer.msg("备份中...,请勿关闭本页面", { time: 200000 });
$.get("/admin/database/backup", tab, function (data) {
if (data.code == 0) {
showmsg(data.data.tab.table, data.msg);
if (data.data.tab.start == 'ok') {
layer.msg('备份完成');
                    window.onbeforeunload = function(){ return null }
                    return;
                } 
                backup(data.data.tab, tab.id != data.data.tab.id);
            } else {
window.onbeforeunload = function () { return null }
return;
}
backup(data.data.tab, tab.id != data.data.tab.id);
} else {
layer.msg('立即备份');
            }
        }, "json"); 
       }
}
}, "json");
}
    //修改备份状态
    function showmsg(table, msg){
//修改备份状态
function showmsg(table, msg) {
console.log(table);
     $("#table_"+table).addClass('span-color-2').html(msg);
    }
$("#table_" + table).addClass('span-color-2').html(msg);
}
//监听行工具事件
table.on('toolbar(test)', function (obj) {
table.on('toolbar(backup)', function (obj) {
var checkData = table.checkStatus(obj.config.id).data;
var len = checkData.length;
var tables=[];
if(len==0){
var tables = [];
if (len == 0) {
layer.msg('请先选择表');
return false;
}
for(var i=0;i<len;i++){
tables.push(checkData[i].name);
for (var i = 0; i < len; i++) {
tables.push(checkData[i].name);
}
if (obj.event === 'backup') {
layer.confirm('确认要备份选中的'+len+'个数据表吗?', {
layer.confirm('确认要备份选中的' + len + '个数据表吗?', {
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/database/backup",
type:'post',
data: {'tables':tables},
type: 'post',
data: { 'tables': tables },
success: function (res) {
if (res.code == 0) {
layer.msg( "开始备份,请不要关闭本页面!");
                window.onbeforeunload = function(){ return "正在备份数据库,请不要关闭!" }
layer.msg("开始备份,请不要关闭本页面!");
window.onbeforeunload = function () { return "正在备份数据库,请不要关闭!" }
backup(res.data.tab);
}
if (res.code == 2) {
@ -144,53 +138,55 @@
}, function (index) {
$.ajax({
url: "/admin/database/del",
data: {'lock':1},
data: { 'lock': 1 },
success: function (res) {
layer.msg(res.msg);
}
})
})
})
}
else{
else {
layer.msg(res.msg);
}
}
})
layer.close(index);
});
}else if (obj.event === 'optimize') {
layer.confirm('确认要优化选中的'+len+'个数据表吗?', {
} else if (obj.event === 'optimize') {
layer.confirm('确认要优化选中的' + len + '个数据表吗?', {
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/database/optimize",
data: {'tables':tables},
type: 'post',
data: { 'tables': tables },
success: function (res) {
layer.msg(res.msg);
if (res.code == 0) {
setTimeout(function(){
setTimeout(function () {
location.reload();
},2000)
}, 2000)
}
}
})
layer.close(index);
});
}else if (obj.event === 'repair') {
layer.confirm('确认要修复选中的'+len+'个数据表吗?', {
} else if (obj.event === 'repair') {
layer.confirm('确认要修复选中的' + len + '个数据表吗?', {
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/database/repair",
data: {'tables':tables},
type: 'post',
data: { 'tables': tables },
success: function (res) {
layer.msg(res.msg);
if (res.code == 0) {
setTimeout(function(){
setTimeout(function () {
location.reload();
},2000)
}, 2000)
}
}
})
@ -200,6 +196,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->
<!-- /脚本 -->

View File

@ -1,165 +1,176 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
{block name="style"}
<style>
.upload-img {
width:100px;
height:120px;
overflow:hidden;
position:relative;
border:1px solid #eee;
padding:1px;
margin:5px;
float:left;
width: 120px;
height: 90px;
overflow: hidden;
position: relative;
border: 1px solid #eee;
padding: 1px;
margin: 5px;
float: left;
}
.upload-close{
position:absolute;
top:1px;
right:1px;
.upload-close {
position: absolute;
top: 1px;
right: 1px;
}
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.editormd-code-toolbar select{display:inline-block}
.editormd li{list-style: inherit;}
</style>
<form class="layui-form body-table">
<div class="layui-form-bar" style="padding-bottom:0">
<h3 class="h3-title">创建商品</h3>
</div>
<table class="layui-table">
<tr>
<td class="layui-td-gray">商品标题 <span style="color: red">*</span></td>
<td colspan="3"><input type="text" name="title" lay-verify="required" lay-reqText="请输入商品标题" placeholder="请输入商品标题" class="layui-input"></td>
<td class="layui-td-gray">状态 <span style="color: red">*</span></td>
<td>
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="0" title="下架">
</td>
</tr>
<tr>
<td class="layui-td-gray">关键字 <span style="color: red">*</span></td>
<td colspan="3">
<input type="text" id="keyword_name" name="keyword_names" lay-verify="required" lay-reqText="请选择关键字" placeholder="请选择关键字" class="layui-input" readonly>
<input type="hidden" id="keyword_id" name="keyword_ids">
</td>
<td class="layui-td-gray">商品分类<span style="color: red">*</span></td>
<td>
<select name="cate_id" lay-verify="required" lay-reqText="请选择商品分类">
<option value="">请选择商品分类</option>
{volist name=":set_recursion(get_goods_cate())" id="v"}
<option value="{$v.id}">{$v.title}</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">商品卖点 <span style="color: red">*</span></td>
<td colspan="3">
<input type="text" name="tips" lay-verify="required" lay-reqText="请输入商品卖点" placeholder="一句话描述商品卖点30字以内" class="layui-input">
</td>
<td class="layui-td-gray" rowspan="3">缩略图 <span style="color: red">*</span></td>
<td rowspan="3" style="vertical-align:top">
<div class="layui-upload" style="text-align:center;">
<button type="button" class="layui-btn layui-btn-sm" id="test1">上传商品封面图(尺寸750x560)</button>
<div class="layui-upload-list" id="demo1">
<img src="" width="100" style="width:200px;max-width:200px"/>
<input type="hidden" name="thumb" value="" lay-verify="required" lay-reqText="请上传缩略图">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">商品简介</td>
<td colspan="3">
<textarea name="desc" placeholder="请输入商品简介200字以内" class="layui-textarea"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">商品标签 <span style="color: red">*</span></td>
<td colspan="3">
<input type="checkbox" name="tag_values[]" title="正品保证" lay-skin="primary" value="1" checked />
<input type="checkbox" name="tag_values[]" title="一年保修" lay-skin="primary" value="2" checked />
<input type="checkbox" name="tag_values[]" title="七天退换(拆封后不支持)" lay-skin="primary" value="3" />
<input type="checkbox" name="tag_values[]" title="赠运费险" lay-skin="primary" value="4" />
<input type="checkbox" name="tag_values[]" title="闪电发货" lay-skin="primary" value="5" />
<input type="checkbox" name="tag_values[]" title="售后无忧" lay-skin="primary" value="6" />
</td>
</tr>
<tr>
<td class="layui-td-gray">市场价格 <span style="color: red">*</span></td>
<td>
<input type="text" name="base_price" lay-verify="required|number" lay-reqText="请输入市场价格" placeholder="请输入市场价格" class="layui-input">
</td>
<td class="layui-td-gray">实际价格 <span style="color: red">*</span></td>
<td>
<input type="text" name="price" lay-verify="required|number" lay-reqText="请输入实际价格" placeholder="请输入实际价格" class="layui-input">
</td>
<td class="layui-td-gray">是否包邮 <span style="color: red">*</span></td>
<td colspan="5">
<input type="radio" name="is_mail" value="1" title="是" checked lay-verify="otherReq" lay-reqText="请选择是否包邮">
<input type="radio" name="is_mail" value="0" title="否" lay-verify="otherReq" lay-reqText="请选择是否包邮">
</td>
</tr>
<tr>
<td class="layui-td-gray">首页显示</td>
<td>
<input type="radio" name="is_home" value="1" title="是" checked>
<input type="radio" name="is_home" value="0" title="否">
</td>
<td class="layui-td-gray">属性</td>
<td>
<select name="type">
<option value="">请选择属性</option>
<option value="1">精华</option>
<option value="2">热门</option>
<option value="3">推荐</option>
</select>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" lay-verify="number" placeholder="请输入排序,数字" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">商品图集</td>
<td colspan="5">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="test2">上传商品图</button>
<div class="layui-upload-list clearfix" id="demo2">
<input type="hidden" name="banner" value="">
</div>
</div>
</td>
</tr>
{eq name="$editor" value="1"}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">商品介绍<span style="color: red">*</span><span style="margin-left:30px; color: red">当前为ueditor富文本编辑器可在【系统管理->其他配置】中切换为mardown编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<textarea name="ueditorcontent" placeholder="请输入内容" class="layui-textarea" id="container" lay-verify="required" lay-reqText="请完善文章内容"
style="border:0;padding:0"></textarea>
{include file="common/ueditor" id="container" name="ueditorcontent" width="100%" height="500" toolbar="[]" /}
</td>
</tr>
{else/}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">商品介绍<span style="color: red">*</span><span style="margin-left:30px; color: red">当前为mardown编辑器可在【系统管理->其他配置】中切换为ueditor富文本编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<div>
<textarea id="mdContent" style="display:none;"></textarea>
<div id="docContent"></div>
</div>
{include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /}
</td>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-3">
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">商品标题 <span style="color: red">*</span></td>
<td colspan="3"><input type="text" name="title" lay-verify="required" lay-reqText="请输入商品标题"
placeholder="请输入商品标题" class="layui-input"></td>
<td class="layui-td-gray">状态 <span style="color: red">*</span></td>
<td>
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="0" title="下架">
</td>
</tr>
{/eq}
</table>
<div class="layui-form-item" style="padding:10px;">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">返回</button>
</div>
<tr>
<td class="layui-td-gray">关键字 <span style="color: red">*</span></td>
<td colspan="3">
<input type="text" id="keyword_name" name="keyword_names" lay-verify="required" lay-reqText="请选择关键字"
placeholder="请选择关键字" class="layui-input" readonly>
<input type="hidden" id="keyword_id" name="keyword_ids">
</td>
<td class="layui-td-gray">商品分类<span style="color: red">*</span></td>
<td>
<select name="cate_id" lay-verify="required" lay-reqText="请选择商品分类">
<option value="">请选择商品分类</option>
{volist name=":set_recursion(get_goods_cate())" id="v"}
<option value="{$v.id}">{$v.title}</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">商品卖点 <span style="color: red">*</span></td>
<td colspan="3">
<input type="text" name="tips" lay-verify="required" lay-reqText="请输入商品卖点" placeholder="一句话描述商品卖点30字以内"
class="layui-input">
</td>
<td class="layui-td-gray" rowspan="3">缩略图 <span style="color: red">*</span></td>
<td rowspan="3" style="vertical-align:top">
<div class="layui-upload" style="text-align:center;">
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn">上传商品封面图(尺寸750x560)</button>
<div class="layui-upload-list" id="demo1">
<img src="" width="100" style="width:200px;max-width:200px" />
<input type="hidden" name="thumb" value="" lay-verify="required" lay-reqText="请上传缩略图">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">商品简介</td>
<td colspan="3">
<textarea name="desc" placeholder="请输入商品简介200字以内" class="layui-textarea"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">商品标签 <span style="color: red">*</span></td>
<td colspan="3">
<input type="checkbox" name="tag_values[]" title="正品保证" lay-skin="primary" value="1" checked />
<input type="checkbox" name="tag_values[]" title="一年保修" lay-skin="primary" value="2" checked />
<input type="checkbox" name="tag_values[]" title="七天退换(拆封后不支持)" lay-skin="primary" value="3" />
<input type="checkbox" name="tag_values[]" title="赠运费险" lay-skin="primary" value="4" />
<input type="checkbox" name="tag_values[]" title="闪电发货" lay-skin="primary" value="5" />
<input type="checkbox" name="tag_values[]" title="售后无忧" lay-skin="primary" value="6" />
</td>
</tr>
<tr>
<td class="layui-td-gray">市场价格 <span style="color: red">*</span></td>
<td>
<input type="text" name="base_price" lay-verify="required|number" lay-reqText="请输入市场价格"
placeholder="请输入市场价格" class="layui-input">
</td>
<td class="layui-td-gray">实际价格 <span style="color: red">*</span></td>
<td>
<input type="text" name="price" lay-verify="required|number" lay-reqText="请输入实际价格" placeholder="请输入实际价格"
class="layui-input">
</td>
<td class="layui-td-gray">是否包邮 <span style="color: red">*</span></td>
<td colspan="5">
<input type="radio" name="is_mail" value="1" title="是" checked lay-verify="otherReq"
lay-reqText="请选择是否包邮">
<input type="radio" name="is_mail" value="0" title="否" lay-verify="otherReq" lay-reqText="请选择是否包邮">
</td>
</tr>
<tr>
<td class="layui-td-gray">首页显示</td>
<td>
<input type="radio" name="is_home" value="1" title="是" checked>
<input type="radio" name="is_home" value="0" title="否">
</td>
<td class="layui-td-gray">属性</td>
<td>
<select name="type">
<option value="">请选择属性</option>
<option value="1">精华</option>
<option value="2">热门</option>
<option value="3">推荐</option>
</select>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" value="0" lay-verify="number" placeholder="请输入排序,数字" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray">商品图集</td>
<td colspan="5">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn2">上传商品图</button>
<div class="layui-upload-list clearfix" id="demo2">
<input type="hidden" name="banner" value="">
</div>
</div>
</td>
</tr>
{eq name="$editor" value="1"}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">商品介绍<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为TinyMCE富文本编辑器可在【系统管理->其他配置】中切换为mardown编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<textarea class="layui-textarea" id="container"></textarea>
</td>
</tr>
{else/}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">商品介绍<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为mardown编辑器可在【系统管理->其他配置】中切换为TinyMCE富文本编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<div>
<textarea id="mdContent" style="display:none;"></textarea>
<div id="docContent"></div>
</div>
</td>
</tr>
{/eq}
</table>
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">返回</button>
</div>
</form>
{/block}
<!-- /主体 -->
@ -168,140 +179,177 @@
{block name="script"}
<script>
// 查找指定的元素在数组中的位置
Array.prototype.indexOf = function(val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function(val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
function init(layui) {
var form = layui.form
, layer = layui.layer
, tagspicker = layui.tagpicker
, upload = layui.upload;
var tags = new tagspicker({
'url': '/admin/api/get_keyword_cate',
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
'height': 500,
'isDiy': 1
});
//自定义验证规则
form.verify({
otherReq: function(value,item){
var verifyName=$(item).attr('name')
, verifyType=$(item).attr('type')
,formElem=$(item).parents('.layui-form')//获取当前所在的form元素如果存在的话
,verifyElem=formElem.find('input[name='+verifyName+']')//获取需要校验的元素
,isTrue= verifyElem.is(':checked')//是否命中校验
,focusElem = verifyElem.next().find('i.layui-icon');//焦点元素
if(!isTrue || !value){
//定位焦点
focusElem.css(verifyType=='radio'?{"color":"#FF5722"}:{"border-color":"#FF5722"});
//对非输入框设置焦点
focusElem.first().attr("tabIndex","1").css("outline","0").blur(function() {
focusElem.css(verifyType=='radio'?{"color":""}:{"border-color":""});
}).focus();
var reqText = verifyElem.attr('lay-reqText');
if(reqText && reqText!=''){
return reqText;
}
else{
return '必填项不能为空';
}
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
});
//缩略图上传
var uploadInst = upload.render({
elem: '#test1'
,url: '/admin/api/upload'
,done: function(res){
//如果上传失败
if(res.code == 1){
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value',res.data.id);
$('#demo1 img').attr('src',res.data.filepath);
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
});
};
//广告图上传
var uploadInst2 = upload.render({
elem: '#test2'
,url: '/admin/api/upload'
,done: function(res){
//如果上传失败
if(res.code == 1){
return layer.msg('上传失败');
}
//上传成功
var idsStr=$('#demo2 input').val();
var idsArray=[];
if(idsStr!=''){
idsArray=idsStr.split(",");
const editorType = '{$editor}';
var moduleInit;
if (editorType == 1) {
moduleInit = ['tool', 'tagpicker', 'tinymce'];
}
else {
moduleInit = ['tool', 'tagpicker', 'editormd'];
}
function gouguInit() {
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker, upload = layui.upload;
var tags = new tagspicker({
'url': '/admin/api/get_keyword_cate',
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
'height': 500,
'isDiy': 1
});
//自定义验证规则
form.verify({
otherReq: function (value, item) {
var verifyName = $(item).attr('name')
, verifyType = $(item).attr('type')
, formElem = $(item).parents('.layui-form')//获取当前所在的form元素如果存在的话
, verifyElem = formElem.find('input[name=' + verifyName + ']')//获取需要校验的元素
, isTrue = verifyElem.is(':checked')//是否命中校验
, focusElem = verifyElem.next().find('i.layui-icon');//焦点元素
if (!isTrue || !value) {
//定位焦点
focusElem.css(verifyType == 'radio' ? { "color": "#FF5722" } : { "border-color": "#FF5722" });
//对非输入框设置焦点
focusElem.first().attr("tabIndex", "1").css("outline", "0").blur(function () {
focusElem.css(verifyType == 'radio' ? { "color": "" } : { "border-color": "" });
}).focus();
var reqText = verifyElem.attr('lay-reqText');
if (reqText && reqText != '') {
return reqText;
}
else {
return '必填项不能为空';
}
}
}
});
//缩略图上传
var uploadInst = upload.render({
elem: '#uploadBtn'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value', res.data.id);
$('#demo1 img').attr('src', res.data.filepath);
}
});
//广告图上传
var uploadInst2 = upload.render({
elem: '#uploadBtn2'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
var idsStr = $('#demo2 input').val();
var idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#demo2 input').attr('value', idsArray.join(','));
$('#demo2').append('<div class="upload-img img-cover" id="uploadImg' + res.data.id + '"><div class="gg-img-cover cover-4-3"><img src="' + res.data.filepath + '"><div class="upload-close"><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delimg" data-id="' + res.data.id + '">删除</a></div></div>');
}
});
$('#demo2').on('click', '[lay-event="delimg"]', function () {
var _id = $(this).data('id');
var idsStr = $('#demo2 input').val();
var idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#demo2 input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
//监听返回
$('body').on('click', '[lay-event="back"]', function () {
tool.tabClose();
return false;
});
if (editorType == 1) {
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.content = tinyMCE.editors['container'].getContent();
if (data.field.content == '') {
layer.msg('请先完善商品内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面吗?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/goods/add", data.field, callback);
return false;
});
}
idsArray.push(res.data.id);
$('#demo2 input').attr('value',idsArray.join(','));
$('#demo2').append('<div class="upload-img" id="uploadImg'+res.data.id+'"><img src="'+ res.data.filepath +'"><div class="upload-close"><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delimg" data-id="'+res.data.id+'">删除</a></div>');
}
});
$('#demo2').on('click','[lay-event="delimg"]',function(){
var _id=$(this).data('id');
var idsStr=$('#demo2 input').val();
var idsArray=[];
if(idsStr!=''){
idsArray=idsStr.split(",");
else {
var editor = layui.editormd;
var edit = editor.render('docContent', {
markdown: document.getElementById('mdContent').value
});
//监听提交
form.on('submit(webform)', function (data) {
if (data.field.mdContent == '') {
layer.msg('请先完善商品内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面吗?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/goods/add", data.field, callback);
return false;
});
}
idsArray.remove(_id);
$('#demo2 input').attr('value',idsArray.join(','));
$('#uploadImg'+_id).remove();
})
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/goods/add",
type: 'post',
data: data.field,
success: function (e) {
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
window.location.href="/admin/goods/index.html";
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
})
return false;
});
//监听返回
$('.body-table').on('click', '[lay-event="back"]', function () {
window.location.href="/admin/goods/index.html";
return false;
});
}
}
</script>
{include file="common/layui" base='base' extend="['tagpicker']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table" style="margin-bottom:0">
<div class="layui-form-bar">
<div class="p-3">
<div class="gg-form-bar border-t border-x">
<button class="layui-btn layui-btn-normal layui-btn-sm add-menu">+ 添加分类</button>
</div>
<div>
@ -18,13 +18,12 @@
<!-- 脚本 -->
{block name="script"}
<script>
var editObj=null,ptable=null,treeGrid=null,tableId='treeTable',layer=null;
function init(layui){
var table=layui.table,form = layui.form,rightpage = layui.rightpage,layer=layui.layer;
treeGrid = layui.treeGrid;//很重要
ptable=treeGrid.render({
id:tableId
,elem: '#'+tableId
const moduleInit = ['tool', 'treeGrid'];
function gouguInit() {
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
layui.pageTable = treeGrid.render({
id:'treeTable'
,elem: '#treeTable'
,idField:'id'
,url:'/admin/goods/cate'
,cellMinWidth: 100
@ -49,39 +48,34 @@
});
//表头工具栏事件
$('.add-menu').on('click', function(){
rightpage.open("/admin/goods/cate_add",'900px');
tool.side("/admin/goods/cate_add");
return;
});
//操作按钮
treeGrid.on('tool('+tableId+')',function (obj) {
treeGrid.on('tool(treeTable)',function (obj) {
if (obj.event === 'add') {
rightpage.open('/admin/goods/cate_add?pid='+obj.data.id,'900px');
tool.side('/admin/goods/cate_add?pid='+obj.data.id);
return;
}
if (obj.event === 'edit') {
rightpage.open('/admin/goods/cate_add?id='+obj.data.id,'900px');
tool.side('/admin/goods/cate_add?id='+obj.data.id);
return;
}
if(obj.event === 'del'){
layer.confirm('确定要删除吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url:"/admin/goods/cate_delete",
type:'post',
data:{id:obj.data.id},
success:function(res){
layer.msg(res.msg);
if(res.code == 0){
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
})
}
tool.delete("/admin/goods/cate_delete", { id: obj.data.id }, callback);
layer.close(index);
});
}
});
}
</script>
{include file="common/layui" base='base' extend="['treeGrid','rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,74 +1,75 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">商品分类</h3>
<form class="layui-form p-4">
<h3 class="pb-3">商品分类</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">父级分类<font>*</font></td>
<td class="layui-td-gray">父级分类<font>*</font>
</td>
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择父级分类">
<option value="0">作为顶级分类</option>
{volist name=":set_recursion(get_goods_cate())" id="v"}
<option value="{$v.id}" {eq name="pid" value="$v.id"}selected=""{/eq}>{$v.title}</option>
{/volist}
<option value="0">作为顶级分类</option>
{volist name=":set_recursion(get_goods_cate())" id="v"}
<option value="{$v.id}" {eq name="pid" value="$v.id" }selected="" {/eq}>{$v.title}</option>
{/volist}
</select>
</td>
<td class="layui-td-gray">分类名称<font>*</font></td>
<td class="layui-td-gray">分类名称<font>*</font>
</td>
<td>
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入分类名称" lay-reqText="请输入分类名称" class="layui-input" {notempty name="$cate.title" }value="{$cate.title}" {/notempty}>
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入分类名称"
lay-reqText="请输入分类名称" class="layui-input" {notempty name="$cate.title" }value="{$cate.title}"
{/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" placeholder="请输入排序,数字" value="0" autocomplete="off" class="layui-input" {notempty name="$cate.sort" }value="{$cate.sort}" {/notempty}>
<input type="text" name="sort" placeholder="请输入排序,数字" value="0" autocomplete="off" class="layui-input"
{notempty name="$cate.sort" }value="{$cate.sort}" {/notempty}>
</td>
<td class="layui-td-gray">关键词</td>
<td>
<input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" {notempty name="$cate.keywords" }value="{$cate.keywords}" {/notempty}>
<input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input"
{notempty name="$cate.keywords" }value="{$cate.keywords}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray">描述</td>
<td colspan="3"><textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea">{notempty name="$cate.desc" }{$cate.desc}{/notempty}</textarea></td>
<td colspan="3"><textarea name="desc" placeholder="请输入描述,可空"
class="layui-textarea">{notempty name="$cate.desc" }{$cate.desc}{/notempty}</textarea></td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<input type="hidden" name="id" value="{$id}" />
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui){
var form = layui.form
,layer = layui.layer;
//监听提交
form.on('submit(webform)', function(data){
$.ajax({
url:"/admin/goods/cate_add",
type:'post',
data:data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function(){
parent.location.reload();
},1000);
}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
})
}
tool.post("/admin/goods/cate_add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -1,184 +1,203 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
{block name="style"}
<style>
.upload-img {
width:100px;
height:120px;
overflow:hidden;
position:relative;
border:1px solid #eee;
padding:1px;
margin:5px;
float:left;
width: 120px;
height: 90px;
overflow: hidden;
position: relative;
border: 1px solid #eee;
padding: 1px;
margin: 5px;
float: left;
}
.upload-close{
position:absolute;
top:1px;
right:1px;
.upload-close {
position: absolute;
top: 1px;
right: 1px;
}
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.editormd-code-toolbar select{display:inline-block}
.editormd li{list-style: inherit;}
</style>
<form class="layui-form body-table">
<div class="layui-form-bar" style="padding-bottom:0">
<h3 class="h3-title">编辑商品</h3>
</div>
<table class="layui-table">
<tr>
<td class="layui-td-gray2">商品标题 <span style="color: red">*</span></td>
<td colspan="3"><input type="text" name="title" lay-verify="required" lay-reqText="请输入商品标题" placeholder="请输入商品标题" class="layui-input" value="{$goods.title}"></td>
<td class="layui-td-gray2">状态 <span style="color: red">*</span></td>
<td>
<input type="radio" name="status" value="1" title="正常" {eq name="$goods.status" value="1"}checked{/eq}>
<input type="radio" name="status" value="0" title="下架" {eq name="$goods.status" value="0"}checked{/eq}>
</td>
</tr>
<tr>
<td class="layui-td-gray2">关键字 <span style="color: red">*</span></td>
<td colspan="3">
<input type="text" id="keyword_name" name="keyword_names" lay-verify="required" lay-reqText="请选择关键字" placeholder="请选择关键字" class="layui-input" value="{$goods.keyword_names}" readonly>
<input type="hidden" id="keyword_id" name="keyword_ids" value="{$goods.keyword_ids}">
</td>
<td class="layui-td-gray2">商品分类<span style="color: red">*</span></td>
<td>
<select name="cate_id" lay-verify="required" lay-reqText="请选择商品分类">
<option value="">请选择商品分类</option>
{volist name=":set_recursion(get_goods_cate())" id="v"}
<option value="{$v.id}" {eq name="$goods.cate_id" value="$v.id"}selected{/eq}>{$v.title}</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray2">商品卖点 <span style="color: red">*</span></td>
<td colspan="3">
<input type="text" name="tips" lay-verify="required" lay-reqText="请输入商品卖点" placeholder="一句话描述商品卖点30字以内" value="{$goods.tips}" class="layui-input">
</td>
<td class="layui-td-gray2" rowspan="3">缩略图 <span style="color: red">*</span></td>
<td rowspan="3" style="vertical-align:top">
<div class="layui-upload" style="text-align:center;">
<button type="button" class="layui-btn layui-btn-sm" id="test1">上传商品封面图(尺寸750x560)</button>
<div class="layui-upload-list" id="demo1">
<img src="{$goods.thumb|get_file}" style="width:200px;max-width:200px" />
<input type="hidden" name="thumb" value="{$goods.thumb}">
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-3">
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">商品标题 <span style="color: red">*</span></td>
<td colspan="3"><input type="text" name="title" lay-verify="required" lay-reqText="请输入商品标题"
placeholder="请输入商品标题" class="layui-input" value="{$goods.title}"></td>
<td class="layui-td-gray">状态 <span style="color: red">*</span></td>
<td>
<input type="radio" name="status" value="1" title="正常" {eq name="$goods.status" value="1" }checked{/eq}>
<input type="radio" name="status" value="0" title="下架" {eq name="$goods.status" value="0" }checked{/eq}>
</td>
</tr>
<tr>
<td class="layui-td-gray">关键字 <span style="color: red">*</span></td>
<td colspan="3">
<input type="text" id="keyword_name" name="keyword_names" lay-verify="required" lay-reqText="请选择关键字"
placeholder="请选择关键字" class="layui-input" value="{$goods.keyword_names}" readonly>
<input type="hidden" id="keyword_id" name="keyword_ids" value="{$goods.keyword_ids}">
</td>
<td class="layui-td-gray">商品分类<span style="color: red">*</span></td>
<td>
<select name="cate_id" lay-verify="required" lay-reqText="请选择商品分类">
<option value="">请选择商品分类</option>
{volist name=":set_recursion(get_goods_cate())" id="v"}
<option value="{$v.id}" {eq name="$goods.cate_id" value="$v.id" }selected{/eq}>{$v.title}</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">商品卖点 <span style="color: red">*</span></td>
<td colspan="3">
<input type="text" name="tips" lay-verify="required" lay-reqText="请输入商品卖点" placeholder="一句话描述商品卖点30字以内"
value="{$goods.tips}" class="layui-input">
</td>
<td class="layui-td-gray" rowspan="3">缩略图 <span style="color: red">*</span></td>
<td rowspan="3" style="vertical-align:top">
<div class="layui-upload" style="text-align:center;">
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn">上传商品封面图(尺寸750x560)</button>
<div class="layui-upload-list" id="demo1">
<img src="{$goods.thumb|get_file}" style="width:200px;max-width:200px" />
<input type="hidden" name="thumb" value="{$goods.thumb}">
</div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray2" style="vertical-align:top;">商品简介</td>
<td colspan="3">
<textarea name="desc" placeholder="请输入商品简介200字以内" class="layui-textarea">{$goods.desc}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray2">商品标签 <span style="color: red">*</span></td>
<td colspan="3">
<input type="checkbox" name="tag_values[]" title="正品保证" lay-skin="primary" value="1" {eq name="$goods.tag1" value="1"}checked{/eq} />
<input type="checkbox" name="tag_values[]" title="一年保修" lay-skin="primary" value="2" {eq name="$goods.tag2" value="1"}checked{/eq} />
<input type="checkbox" name="tag_values[]" title="七天退换(拆封后不支持)" lay-skin="primary" value="3" {eq name="$goods.tag3" value="1"}checked{/eq}/>
<input type="checkbox" name="tag_values[]" title="赠运费险" lay-skin="primary" value="4" {eq name="$goods.tag4" value="1"}checked{/eq}/>
<input type="checkbox" name="tag_values[]" title="闪电发货" lay-skin="primary" value="5" {eq name="$goods.tag5" value="1"}checked{/eq}/>
<input type="checkbox" name="tag_values[]" title="售后无忧" lay-skin="primary" value="6" {eq name="$goods.tag6" value="1"}checked{/eq}/>
</td>
</tr>
<tr>
<td class="layui-td-gray2">市场价格 <span style="color: red">*</span></td>
<td>
<input type="text" name="base_price" lay-verify="required|number" lay-reqText="请输入市场价格" placeholder="请输入市场价格" class="layui-input" value="{$goods.base_price}">
</td>
<td class="layui-td-gray2">实际价格 <span style="color: red">*</span></td>
<td>
<input type="text" name="price" lay-verify="required|number" lay-reqText="请输入实际价格" placeholder="请输入实际价格" class="layui-input" value="{$goods.price}">
</td>
<td class="layui-td-gray2">是否包邮 <span style="color: red">*</span></td>
<td>
<input type="radio" name="is_mail" value="1" title="是" {eq name="$goods.is_mail" value="1"}checked{/eq}>
<input type="radio" name="is_mail" value="0" title="否" {eq name="$goods.is_mail" value="0"}checked{/eq}>
</td>
</tr>
<tr>
<td class="layui-td-gray2">首页显示</td>
<td>
<input type="radio" name="is_home" value="1" title="是" {eq name="$goods.is_home" value="1"}checked{/eq}>
<input type="radio" name="is_home" value="0" title="否" {eq name="$goods.is_home" value="0"}checked{/eq}>
</td>
<td class="layui-td-gray2">属性</td>
<td>
<select name="type">
<option value="">请选择属性</option>
<option value="1" {eq name="$goods.type" value="1"}selected{/eq}>精华</option>
<option value="2" {eq name="$goods.type" value="2"}selected{/eq}>热门</option>
<option value="3" {eq name="$goods.type" value="3"}selected{/eq}>推荐</option>
</select>
</td>
<td class="layui-td-gray2">排序</td>
<td>
<input type="text" name="sort" placeholder="请输入排序,数字" lay-verify="number" class="layui-input" value="{$goods.sort}">
</td>
</tr>
<tr>
<td class="layui-td-gray2">商品轮播图</td>
<td colspan="5">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="test2">上传轮播图</button>
<div class="layui-upload-list" id="demo2">
<input type="hidden" name="banner" value="{$goods.banner}">
{notempty name="goods.banner"}
{volist name="goods.banner_array" id="vo"}
<div class="upload-img" id="uploadImg{$vo}"><img src="{$vo|get_file}"><div class="upload-close"><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delimg" data-id="{$vo}">删除</a></div></div>
{/volist}
{/notempty}
</div>
</div>
</td>
</tr>
{empty name="$goods.md_content"}
<tr>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">商品简介</td>
<td colspan="3">
<textarea name="desc" placeholder="请输入商品简介200字以内" class="layui-textarea">{$goods.desc}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">商品标签 <span style="color: red">*</span></td>
<td colspan="3">
<input type="checkbox" name="tag_values[]" title="正品保证" lay-skin="primary" value="1" {eq
name="$goods.tag1" value="1" }checked{/eq} />
<input type="checkbox" name="tag_values[]" title="一年保修" lay-skin="primary" value="2" {eq
name="$goods.tag2" value="1" }checked{/eq} />
<input type="checkbox" name="tag_values[]" title="七天退换(拆封后不支持)" lay-skin="primary" value="3" {eq
name="$goods.tag3" value="1" }checked{/eq} />
<input type="checkbox" name="tag_values[]" title="赠运费险" lay-skin="primary" value="4" {eq
name="$goods.tag4" value="1" }checked{/eq} />
<input type="checkbox" name="tag_values[]" title="闪电发货" lay-skin="primary" value="5" {eq
name="$goods.tag5" value="1" }checked{/eq} />
<input type="checkbox" name="tag_values[]" title="售后无忧" lay-skin="primary" value="6" {eq
name="$goods.tag6" value="1" }checked{/eq} />
</td>
</tr>
<tr>
<td class="layui-td-gray">市场价格 <span style="color: red">*</span></td>
<td>
<input type="text" name="base_price" lay-verify="required|number" lay-reqText="请输入市场价格"
placeholder="请输入市场价格" class="layui-input" value="{$goods.base_price}">
</td>
<td class="layui-td-gray">实际价格 <span style="color: red">*</span></td>
<td>
<input type="text" name="price" lay-verify="required|number" lay-reqText="请输入实际价格" placeholder="请输入实际价格"
class="layui-input" value="{$goods.price}">
</td>
<td class="layui-td-gray">是否包邮 <span style="color: red">*</span></td>
<td>
<input type="radio" name="is_mail" value="1" title="是" {eq name="$goods.is_mail" value="1"
}checked{/eq}>
<input type="radio" name="is_mail" value="0" title="否" {eq name="$goods.is_mail" value="0"
}checked{/eq}>
</td>
</tr>
<tr>
<td class="layui-td-gray">首页显示</td>
<td>
<input type="radio" name="is_home" value="1" title="是" {eq name="$goods.is_home" value="1"
}checked{/eq}>
<input type="radio" name="is_home" value="0" title="否" {eq name="$goods.is_home" value="0"
}checked{/eq}>
</td>
<td class="layui-td-gray">属性</td>
<td>
<select name="type">
<option value="">请选择属性</option>
<option value="1" {eq name="$goods.type" value="1" }selected{/eq}>精华</option>
<option value="2" {eq name="$goods.type" value="2" }selected{/eq}>热门</option>
<option value="3" {eq name="$goods.type" value="3" }selected{/eq}>推荐</option>
</select>
</td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="sort" placeholder="请输入排序,数字" lay-verify="number" class="layui-input"
value="{$goods.sort}">
</td>
</tr>
<tr>
<td class="layui-td-gray">商品图集</td>
<td colspan="5">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn2">上传轮播图</button>
<div class="layui-upload-list" id="demo2">
<input type="hidden" name="banner" value="{$goods.banner}">
{notempty name="goods.banner"}
{volist name="goods.banner_array" id="vo"}
<div class="upload-img img-cover" id="uploadImg{$vo}"><div class="gg-img-cover cover-4-3"><img src="{$vo|get_file}"><div class="upload-close"><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delimg" data-id="{$vo}">删除</a></div></div>
{/volist}
{/notempty}
</div>
</div>
</td>
</tr>
{empty name="$goods.md_content"}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">商品介绍<span style="color: red">*</span></td>
</tr>
<tr>
</tr>
<tr>
<td colspan="6">
<textarea name="ueditorcontent" placeholder="请输入内容" class="layui-textarea" id="container" lay-verify="required" lay-reqText="请完善商品介绍内容"
style="border:0;padding:0">{$goods.content}</textarea>
{include file="common/ueditor" id="container" name="ueditorcontent" width="100%" height="500" toolbar="[]" /}
<textarea class="layui-textarea" id="container">{$goods.content}</textarea>
</td>
</tr>
{else/}
</tr>
{else/}
{eq name="$editor" value="1"}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">商品介绍<span style="color: red">*</span><span style="margin-left:30px; color: red">当前为ueditor富文本编辑器可在【系统管理->其他配置】中切换为mardown编辑器</span></td>
</tr>
<tr>
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">商品介绍<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为TinyMCE富文本编辑器可在【系统管理->其他配置】中切换为mardown编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<textarea name="content" placeholder="请输入内容" class="layui-textarea" id="container" lay-verify="required" lay-reqText="请完善商品介绍内容"
style="border:0;padding:0">{$goods.content}</textarea>
{include file="common/ueditor" id="container" name="content" width="100%" height="500" toolbar="[]" /}
<textarea placeholder="请输入内容" class="layui-textarea" id="container">{$goods.content}</textarea>
</td>
</tr>
{else/}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">商品介绍<span style="color: red">*</span><span style="margin-left:30px; color: red">当前为mardown编辑器可在【系统管理->其他配置】中切换为ueditor富文本编辑器</span></td>
</tr>
<tr>
</tr>
{else/}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">商品介绍<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为mardown编辑器可在【系统管理->其他配置】中切换为TinyMCE富文本编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<div>
<textarea id="mdContent" style="display:none;">{$goods.md_content|raw}</textarea>
<div id="docContent"></div>
</div>
{include file="common/mdeditor" id="docContent" markdown="mdContent" sub="100" toolbar="[]" /}
<div>
<textarea id="mdContent" style="display:none;">{$goods.md_content|raw}</textarea>
<div id="docContent"></div>
</div>
</td>
</tr>
</tr>
{/eq}
{/empty}
</table>
<div class="layui-form-item" style="padding:10px">
<input type="hidden" name="id" value="{$goods.id}">
<button class="layui-btn" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">返回</button>
</div>
{/empty}
</table>
<div class="py-3">
<input type="hidden" name="id" value="{$goods.id}">
<button class="layui-btn" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">关闭</button>
</div>
</form>
{/block}
<!-- /主体 -->
@ -187,139 +206,177 @@
{block name="script"}
<script>
// 查找指定的元素在数组中的位置
Array.prototype.indexOf = function(val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function(val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
function init(layui) {
var form = layui.form
, layer = layui.layer
, tagspicker = layui.tagpicker
, upload = layui.upload;
var tags = new tagspicker({
'url': '/admin/api/get_keyword_cate',
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
'height': 500,
'isDiy': 1
});
//自定义验证规则
form.verify({
otherReq: function(value,item){
var verifyName=$(item).attr('name')
, verifyType=$(item).attr('type')
,formElem=$(item).parents('.layui-form')//获取当前所在的form元素如果存在的话
,verifyElem=formElem.find('input[name='+verifyName+']')//获取需要校验的元素
,isTrue= verifyElem.is(':checked')//是否命中校验
,focusElem = verifyElem.next().find('i.layui-icon');//焦点元素
if(!isTrue || !value){
//定位焦点
focusElem.css(verifyType=='radio'?{"color":"#FF5722"}:{"border-color":"#FF5722"});
//对非输入框设置焦点
focusElem.first().attr("tabIndex","1").css("outline","0").blur(function() {
focusElem.css(verifyType=='radio'?{"color":""}:{"border-color":""});
}).focus();
var reqText = verifyElem.attr('lay-reqText');
if(reqText && reqText!=''){
return reqText;
}
else{
return '必填项不能为空';
}
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
});
//缩略图上传
var uploadInst = upload.render({
elem: '#test1'
,url: '/admin/api/upload'
,done: function(res){
//如果上传失败
if(res.code == 1){
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value',res.data.id);
$('#demo1 img').attr('src',res.data.filepath);
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
});
};
//广告图上传
var uploadInst2 = upload.render({
elem: '#test2'
,url: '/admin/api/upload'
,done: function(res){
//如果上传失败
if(res.code == 1){
return layer.msg('上传失败');
}
//上传成功
var idsStr=$('#demo2 input').val();
var idsArray=[];
if(idsStr!=''){
idsArray=idsStr.split(",");
const editorType = '{$editor}';
var moduleInit;
if (editorType == 1) {
moduleInit = ['tool', 'tagpicker', 'tinymce'];
}
else {
moduleInit = ['tool', 'tagpicker', 'editormd'];
}
function gouguInit() {
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker, upload = layui.upload;
var tags = new tagspicker({
'url': '/admin/api/get_keyword_cate',
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
'height': 500,
'isDiy': 1
});
//自定义验证规则
form.verify({
otherReq: function (value, item) {
var verifyName = $(item).attr('name')
, verifyType = $(item).attr('type')
, formElem = $(item).parents('.layui-form')//获取当前所在的form元素如果存在的话
, verifyElem = formElem.find('input[name=' + verifyName + ']')//获取需要校验的元素
, isTrue = verifyElem.is(':checked')//是否命中校验
, focusElem = verifyElem.next().find('i.layui-icon');//焦点元素
if (!isTrue || !value) {
//定位焦点
focusElem.css(verifyType == 'radio' ? { "color": "#FF5722" } : { "border-color": "#FF5722" });
//对非输入框设置焦点
focusElem.first().attr("tabIndex", "1").css("outline", "0").blur(function () {
focusElem.css(verifyType == 'radio' ? { "color": "" } : { "border-color": "" });
}).focus();
var reqText = verifyElem.attr('lay-reqText');
if (reqText && reqText != '') {
return reqText;
}
else {
return '必填项不能为空';
}
}
}
});
//缩略图上传
var uploadInst = upload.render({
elem: '#uploadBtn'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value', res.data.id);
$('#demo1 img').attr('src', res.data.filepath);
}
});
//广告图上传
var uploadInst2 = upload.render({
elem: '#uploadBtn2'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
var idsStr = $('#demo2 input').val();
var idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#demo2 input').attr('value', idsArray.join(','));
$('#demo2').append('<div class="upload-img img-cover" id="uploadImg' + res.data.id + '"><div class="gg-img-cover cover-4-3"><img src="' + res.data.filepath + '"><div class="upload-close"><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delimg" data-id="' + res.data.id + '">删除</a></div></div>');
}
});
$('#demo2').on('click', '[lay-event="delimg"]', function () {
var _id = $(this).data('id');
var idsStr = $('#demo2 input').val();
var idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#demo2 input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
//监听返回
$('body').on('click', '[lay-event="back"]', function () {
tool.tabClose();
return false;
});
if (editorType == 1) {
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.content = tinyMCE.editors['container'].getContent();
if (data.field.content == '') {
layer.msg('请先完善商品内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/goods/add", data.field, callback);
return false;
});
}
idsArray.push(res.data.id);
$('#demo2 input').attr('value',idsArray.join(','));
$('#demo2').append('<div class="upload-img" id="uploadImg'+res.data.id+'"><img src="'+ res.data.filepath +'"><div class="upload-close"><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delimg" data-id="'+res.data.id+'">删除</a></div>');
}
});
$('#demo2').on('click','[lay-event="delimg"]',function(){
var _id=$(this).data('id');
var idsStr=$('#demo2 input').val();
var idsArray=[];
if(idsStr!=''){
idsArray=idsStr.split(",");
else {
var editor = layui.editormd;
var edit = editor.render('docContent', {
markdown: document.getElementById('mdContent').value
});
//监听提交
form.on('submit(webform)', function (data) {
if (data.field.mdContent == '') {
layer.msg('请先完善商品内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/goods/add", data.field, callback);
return false;
});
}
idsArray.remove(_id);
$('#demo2 input').attr('value',idsArray.join(','));
$('#uploadImg'+_id).remove();
})
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/goods/add",
type: 'post',
data: data.field,
success: function (e) {
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
window.location.href="/admin/goods/index.html";
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
})
return false;
});
//监听返回
$('.body-table').on('click', '[lay-event="back"]', function () {
window.location.href="/admin/goods/index.html";
return false;
});
}
</script>
{include file="common/layui" base='base' extend="['tagpicker']" use="['upload','form','laydate','table','tagpicker']" callback="init" /}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline">
<select name="cate_id">
<option value="">请选择商品分类</option>
@ -16,7 +16,7 @@
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="goods" lay-filter="goods"></table>
</div>
<script type="text/html" id="status">
@ -27,11 +27,11 @@
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<a class="layui-btn layui-btn-normal layui-btn-sm" title="添加文章" href="/admin/goods/add">+ 添加商品</a>
<span class="layui-btn layui-btn-normal layui-btn-sm tab-a" data-title="添加商品" data-href="/admin/goods/add">+ 添加商品</span>
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group"><a class="layui-btn layui-btn-xs" href="/admin/goods/add?id={{d.id}}">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
<div class="layui-btn-group"><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
</script>
{/block}
<!-- /主体 -->
@ -39,13 +39,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var TAB = parent.layui.tab,
table = layui.table,
form = layui.form;
var tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#goods',
title: '商品列表',
toolbar: '#toolbarDemo',
url: '/admin/goods/index', //数据接口
@ -104,25 +102,23 @@
});
//监听行工具事件
table.on('tool(test)', function(obj) {
table.on('tool(goods)', function(obj) {
var data = obj.data;
if (obj.event === 'del') {
if (obj.event === 'edit') {
tool.tabAdd('/admin/goods/add?id='+obj.data.id,'编辑商品'+obj.data.id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除吗?', {
icon: 3,
title: '提示'
}, function(index) {
$.ajax({
url: "/admin/goods/delete",
data: {
id: data.id
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/goods/delete", { id: data.id }, callback);
layer.close(index);
});
}
@ -130,7 +126,7 @@
//监听搜索提交
form.on('submit(webform)', function(data) {
tableIns.reload({
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
@ -143,6 +139,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,67 +1,89 @@
{extend name="common/base"/}
{block name="style"}
<link rel="stylesheet" href="{__LAYUI__}/font/extend/iconfont.css?v={:get_system_config('web','version')}">
<link rel="stylesheet" href="{__ADMIN_CSS__}/gougucms.css?v={:get_system_config('web','version')}">
<link rel="stylesheet" href="{__GOUGU__}/gougu/css/layout.css" media="all">
{/block}
<!-- 主体 -->
{block name="body"}
<body class="layui-layout-body">
<div id="GouguApp">
<div class="layui-layout gg-layout">
<div class="layui-header">
<!-- 头部区域 -->
<div class="layui-layout-left">
<span class="gg-head-item">
<a href="javascript:;" gg-event="shrink" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
</span>
<span class="gg-head-item gg-head-cache">
<a href="javascript:;" gg-event="cache" title="清空缓存"><i class="layui-icon layui-icon-fonts-clear"></i></a>
</span>
<span class="gg-head-item gg-head-home">
<a href="/" target="_blank" title="前台首页"><i class="layui-icon layui-icon-website"></i></a>
</span>
</div>
<div class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<div class="layui-header">
<div class="layui-logo" ittab-home><img src="{__ADMIN_IMG__}/syslogo.png" width="186"
alt="{:get_system_config('web','admin_title')}" /></div>
<ul class="layui-nav layui-layout-right">
<li class="layui-nav-item" lay-unselect>
<a href="javascript:;" ittab-refresh class="refreshThis" id="ittab-refresh" title="刷新当前页"
style="margin-top:3px;">
<i class="layui-icon layui-icon-refresh-3"></i>
</a>
</li>
<li class="layui-nav-item" lay-unselect>
<a href="javascript:;" ittab-del-cache id="ittab-del-cache" style="margin-top:2px;" title="清空缓存"><i
class="layui-icon layui-icon-fonts-clear"></i></a>
</li>
<li class="layui-nav-item" lay-unselect>
<a href="javascript:;" ittab-logout title="{:get_login_admin('nickname')}-点击退出登录">
<img src="{:get_login_admin('thumb')}" class="layui-nav-img"
onerror="javascript:this.src='{__ADMIN_IMG__}/nonepic360x360.jpg';this.onerror=null;">
</a>
</li>
</ul>
</div>
<div class="layui-layout-right">
<span class="gg-head-item gg-head-refresh">
<a href="javascript:;" class="refreshThis" gg-event="refresh" title="刷新">
<i class="layui-icon layui-icon-refresh-3"></i>
</a>
</span>
<span class="gg-head-item gg-head-screen">
<a href="javascript:;" gg-event="screen" data-screen="full">
<i class="fullScreen layui-icon layui-icon-screen-full"></i>
</a>
</span>
<span class="gg-head-item gg-head-message">
<a data-text="消息中心" data-url="" gg-event="message" title="消息中心">
<i class="layui-icon layui-icon-notice"></i>
<!-- 如果有新消息,则显示 -->
<div class="gg-message-num"><span>99</span></div>
</a>
</span>
<span class="gg-head-item gg-head-avatar">
<ul class="layui-nav">
<li class="layui-nav-item">
<a href="javascript:;">
<img src="{:get_login_admin('thumb')}" onerror="javascript:this.src='{__ADMIN_IMG__}/nonepic360x360.jpg';this.onerror=null;">
<cite>{:get_login_admin('nickname')}</cite>
</a>
<dl class="layui-nav-child" style="text-align: center; cursor: pointer;">
<dd><a data-href="/admin/api/edit_personal" data-id="0101" data-title="基本资料" class="side-menu-item">基本资料</a></dd>
<dd><a data-href="/admin/api/edit_password" data-id="0102" data-title="修改密码" class="side-menu-item">修改密码</a></dd>
<hr>
<dd gg-event="logout"><a>退出</a></dd>
</dl>
</li>
</ul>
</span>
</div>
</div>
<div class="layui-side menulist-bg-gray">
<div class="menulist">
<div class="menulist-top">
<a href="/admin/index" title="返回系统首页" style="background-color: #E94335"><i
class="layui-icon layui-icon-windows"></i></a><a href="javascript:;" title="修改个人信息"
style="background-color:#fbbc05" data-id="10000" data-title="修改个人信息"
data-src="/admin/api/edit_personal" class="menu-active"><i
class="layui-icon layui-icon-username"></i></a><a href="javascript:;" title="修改密码"
style="background-color:#34a853" data-id="10001" data-title="修改密码"
data-src="/admin/api/edit_password" class="menu-active"><i
class="layui-icon layui-icon-password"></i></a><a href="/home/index" title="门户首页" style="background-color:#4285f4" target="_blank"><i
class="layui-icon layui-icon-home"></i></a>
</div>
<ul class="layui-nav layui-nav-tree layui-inline" lay-shrink="all">
<!-- 侧边菜单 -->
<div class="layui-side layui-side-menu">
<div class="layui-side-scroll">
<div class="layui-logo" gg-event="closeAllTabs">
<img src="{__ADMIN__}/images/syslogo.png" style="height: 40px;" class="syslogo">
<img src="{__ADMIN__}/images/logo.png" style="height: 40px;" class="logo">
</div>
<ul id="menuList" class="layui-nav layui-nav-tree layui-inline" lay-shrink="all">
{foreach name="menu" item="a"}
<li class="layui-nav-item">
<a href="javascript:;" class="menu-active" data-id="{$a.id}" data-title="{$a.title}" data-src="/{$a.src}"><i class="iconfont {$a.icon}"></i> {$a.title}</a>
<li class="layui-nav-item menu-li">
<a href="javascript:;" lay-tips="{$a.title}" lay-direction="2" data-id="{$a.id}" data-title="{$a.title}" data-href="/{$a.src}"><i class="bi {$a.icon}"></i> {$a.title}</a>
{notempty name="$a.list"}
<dl class="layui-nav-child">
{foreach name="$a.list" item="b"}
<dd>
<a href="javascript:;" class="menu-active menu-b" data-id="{$b.id}" data-title="{$b.title}" data-src="/{$b.src}">{$b.title}</a>
<a href="javascript:;" class="side-menu-item" data-id="{$b.id}" data-title="{$b.title}" data-href="/{$b.src}">{$b.title}</a>
{notempty name="$b.list"}
<dl class="layui-nav-child">
{foreach name="$b.list" item="c"}
<dd>
<a href="javascript:;" class="menu-active menu-c" data-id="{$c.id}" data-title="{$c.title}" data-src="/{$c.src}">{$c.title}</a>
<a href="javascript:;" class="side-menu-item" data-id="{$c.id}" data-title="{$c.title}" data-href="/{$c.src}">{$c.title}</a>
{notempty name="$c.list"}
<dl class="layui-nav-child">
{foreach name="$c.list" item="d"}
<dd><a href="javascript:;" class="menu-active menu-d" data-id="{$d.id}" data-title="{$d.title}" data-src="/{$d.src}">{$d.title}</a></dd>
<dd><a href="javascript:;" class="side-menu-item" data-id="{$d.id}" data-title="{$d.title}" data-href="/{$d.src}">{$d.title}</a></dd>
{/foreach}
</dl>
{/notempty}
@ -75,53 +97,68 @@
{/notempty}
</li>
{/foreach}
</ul>
</div>
</div>
</ul>
</div>
</div>
<div class="layui-body">
<div class="layui-tab layui-tab-brief gougu-admin-tab" lay-filter="gougu-admin-tab" lay-unauto="" lay-allowClose="true" style="height: 100%;">
<ul class="layui-tab-title">
<li class="layui-this ittab-tab-home" lay-id="0">首页</li>
</ul>
<div class="layui-icon layui-icon-prev" id="left_button" title="向左滚动菜单"></div>
<div class="layui-icon layui-icon-next" id="right_button" title="向右滚动菜单"></div>
<div class="layui-tab-content" style="height: 100%;">
<div class="layui-tab-item layui-show">
<iframe id="0" data-frameid="0" name="myiframe" src="{:url('/admin/index/main')}"
frameborder="0" align="left" width="100%" height="100%" scrolling="yes"></iframe>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 页面标签 -->
<div id="pageTabs" class="page-tabs">
<div class="layui-icon gg-tabs-control layui-icon-prev" gg-event="tabRollLeft"></div>
<div class="layui-icon gg-tabs-control layui-icon-next" gg-event="tabRollRight"></div>
<div class="layui-icon gg-tabs-control layui-icon-down">
<ul class="layui-nav gg-tabs-select">
<li class="layui-nav-item">
<a href="javascript:;"></a>
<dl class="layui-nav-child layui-anim-fadein">
<dd gg-event="closeThisTabs"><a href="javascript:;">关闭当前</a></dd>
<dd gg-event="closeOtherTabs"><a href="javascript:;">关闭其它</a></dd>
<dd gg-event="closeAllTabs"><a href="javascript:;">关闭全部</a></dd>
</dl>
</li>
</ul>
</div>
<div class="layui-tab gg-admin-tab" lay-unauto lay-allowClose="true" lay-filter="gg-admin-tab">
<ul class="layui-tab-title">
<li lay-id="0" lay-attr="view/home/index.html" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
</ul>
</div>
</div>
<!-- 主体内容 -->
<div class="layui-body" id="GouguAppBody">
<div class="gg-tab-page layui-show" id="tabItem0">
<iframe id="0" data-frameid="0" name="myiframe" src="{:url('/admin/index/main')}" frameborder="0" align="left" width="100%" height="100%" scrolling="yes"></iframe>
</div>
</div>
<!-- 辅助元素,用于移动设备下遮罩 -->
<div class="gg-body-shade" gg-event="shade"></div>
</div>
</div>
<!-- /主体 -->
{/block}
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var layer = layui.layer;
$("[ittab-logout]").on("click", function () {
layer.confirm('确认注销登录吗?', { icon: 7, title: '警告' }, function (index) {
//注销
$.ajax({
url: "/admin/login/login_out",
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
location.href = "{:url('admin/login/index')}"
}, 1000)
<script>
const moduleInit = ['tool','admin'];
function gouguInit() {
$('#GouguApp').on("click",'[gg-event="logout"]',function () {
layer.confirm('确认注销登录吗?', { icon: 7, title: '警告' }, function (index) {
//注销
$.ajax({
url: "/admin/login/login_out",
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
location.href = "{:url('admin/login/index')}"
}, 1000)
}
}
}
})
layer.close(index);
})
layer.close(index);
});
});
});
};
</script>
{include file="common/layui" base='base' extend="['gougucms']" callback="init" /}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -2,105 +2,69 @@
{block name="style"}
<style type="text/css">
.table-title {
font-size: 18px;
font-weight: 800;
padding: 12px 12px 0;
}
.panel-num table {
width: 100%;
}
.panel-num td {
text-align: center;
padding: 20px 0;
width: 20%;
border-bottom: 1px solid #eee;
border-left: 1px solid #eee
}
.panel-num .num-title {
padding-bottom: 10px;
color: #999;
}
.panel-num .num-num {
font-size: 28px;
font-weight: 300;
color: #009688;
}
.layui-timeline-title {
.dashboard-num table {width: 100%;}
.dashboard-num td {text-align: center; padding: 16px 0; width: 20%;border-left: 1px solid #f1f1f1; position: relative;}
.dashboard-num td:nth-child(1) { border-left: none}
.dashboard-num .num-title { padding-bottom: 10px; color: #999;}
.dashboard-num .blue {font-size: 20px; font-weight: 300;}
.dashboard-num td .badge {position: absolute;top: 0; right: 0;}
.dashboard-num td .badge span { padding: 2px 4px; font-size: 12px; border-radius: 0 0 0 4px;}
.dashboard-total td {border-top: 1px solid #f1f1f1}
.dashboard-logs .layui-timeline-item {padding-bottom: 1px;}
.info-td { width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
.info-td {width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
.layui-card-body .layui-timeline-title {
padding-bottom: 0;
font-size: 14px;
}
.layui-timeline-item {
padding-bottom: 1px;
.layui-card-body .layui-timeline-item {
padding-bottom: 5px;
}
.layui-timeline-title span {
color: #999
}
.layui-timeline{
padding-bottom: 30px;
}
.panel-more {
width: 100%;
height: 48px;
line-height: 48px;
text-align: center;
position: absolute;
bottom: 0;
left: 0;
}
.panel-more a {
color: #0088FF
}
.info-td{width:90px; text-align:right; background-color:#f8f8f8; color:#999; padding:5px 3px;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<div class="layui-row layui-col-space12">
<div class="layui-col-md8">
<div class="layui-row layui-col-space12">
<div class="layui-col-md12">
<div class="layui-card panel-num">
<div class="layui-card dashboard-num">
<table>
<tr>
<td>
<div class="num-title">系统用户</div>
<div class="num-num">{$adminCount}</div>
<div class="blue">{$adminCount}</div>
</td>
<td>
<div class="num-title">注册用户</div>
<div class="num-num">{$userCount}</div>
<div class="blue">{$userCount}</div>
</td>
<td>
<div class="num-title">文章</div>
<div class="num-num">{$articleCount}</div>
<div class="blue">{$articleCount}</div>
</td>
<td>
<div class="num-title">商品</div>
<div class="num-num">{$goodsCount}</div>
<div class="blue">{$goodsCount}</div>
</td>
<td>
<div class="num-title">附件</div>
<div class="num-num">{$fileCount}</div>
<div class="blue">{$fileCount}</div>
</td>
</tr>
</table>
</div>
<div class="layui-card">
<div class="table-title">注册用户</div>
<div style="padding: 12px;">
<div class="layui-card-title">注册用户</div>
<div class="p-3">
<table id="UserList" lay-filter="UserList" class="layui-hide"></table>
</div>
</div>
<div class="layui-card">
<div class="table-title">文章列表</div>
<div style="padding: 12px;">
<div class="layui-card-title">文章列表</div>
<div class="p-3">
<table id="Article" lay-filter="Article" class="layui-hide" style="margin-top:0"></table>
</div>
</div>
@ -115,7 +79,7 @@
</div>
<div class="layui-col-md4">
<div class="layui-card">
<div class="table-title">系统信息</div>
<div class="layui-card-title">系统信息</div>
<div class="layui-card-body">
<table class="layui-table" lay-skin="" lay-size="sm">
{if condition="($install == true)"}
@ -167,27 +131,17 @@
</td>
</tr>
</table>
<script>
$('body').on('click','[data-event="pay"]',function(){
var src=$(this).attr('src');
layer.open({
type:1,
title:'感谢您给作者加鸡腿🍗🍗',
content:'<img src="'+src+'" style="width:100%" align=center />',
});
})
</script>
</div>
</div>
<div class="layui-card">
<div class="table-title">操作日志</div>
<div class="layui-card-header"><h3>操作日志</h3><a data-title="操作日志" data-href="/admin/api/log_list/" class="pull-right tab-a">更多</a></div>
<div class="layui-card-body">
<ul class="layui-timeline" id="logs"></ul>
<div class="panel-more"><a href="/admin/api/log_list/">查看更多日志</a></div>
</div>
</div>
</div>
</div>
</div>
{/block}
<!-- /主体 -->
@ -220,8 +174,17 @@
})
}
function init(layui) {
var layer = layui.layer, table = layui.table;
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table;
$('body').on('click','[data-event="pay"]',function(){
var src=$(this).attr('src');
layer.open({
type:1,
title:'感谢您给作者加鸡腿🍗🍗',
content:'<img src="'+src+'" style="width:100%" align=center />',
});
})
getLogs();
//注册用户
table.render({
@ -509,6 +472,5 @@
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,27 +1,24 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">关键字</h3>
<form class="layui-form p-4">
<h3 class="pb-3">关键字</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">关键字名称<font>*</font>
<td class="layui-td-gray-2">关键字名称<font>*</font>
</td>
<td>
<input type="hidden" name="id" value="{$id}" />
<input type="text" name="title" lay-verify="required" lay-reqText="请输入关键字名称" autocomplete="off" placeholder="请输入关键字名称"
class="layui-input" style="max-width: 360px;" {notempty name="$keywords.title"}
class="layui-input" {notempty name="$keywords.title"}
value="{$keywords.title}" {/notempty}>
</td>
<td class="layui-td-gray">排序</td>
<td><input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input"
style="max-width: 360px;" {notempty name="$keywords.sort" }value="{$keywords.sort}" {/notempty}>
<td><input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" {notempty name="$keywords.sort" }value="{$keywords.sort}" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray2">状态<font>*</font>
<td class="layui-td-gray">状态
</td>
<td colspan="3">
<td>
{if condition="$id eq 0"}
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="0" title="禁用">
@ -34,7 +31,7 @@
</td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -45,31 +42,25 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
, layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/keywords/add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
}
})
}
tool.post("/admin/keywords/add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,14 +1,14 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="关键字名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="keywords" lay-filter="keywords"></table>
</div>
<script type="text/html" id="status">
@ -25,14 +25,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#keywords',
title: '关键字列表',
toolbar: '#toolbarDemo',
url: '/admin/keywords/index',
@ -75,7 +72,7 @@
//监听搜索提交
form.on('submit(webform)', function (data) {
if (data.field.keywords) {
tableIns.reload({
layui.pageTable.reload({
where: {
keywords: data.field.keywords
},
@ -90,17 +87,17 @@
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
table.on('toolbar(keywords)', function(obj){
if (obj.event === 'add') {
rightpage.open("/admin/keywords/add","900px");
tool.side("/admin/keywords/add");
return;
}
});
//监听行工具事件
table.on('tool(test)', function (obj) {
table.on('tool(keywords)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
rightpage.open('/admin/keywords/add?id='+obj.data.id,"900px");
tool.side('/admin/keywords/add?id='+obj.data.id);
return;
}
if (obj.event === 'del') {
@ -108,25 +105,18 @@
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/keywords/delete",
type: 'post',
data: {
id: obj.data.id
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/keywords/delete", { id: data.id }, callback);
layer.close(index);
});
}
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table class="layui-hide" id="test" lay-filter="test"></table>
<div class="p-3">
<table class="layui-hide" id="level" lay-filter="level"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
@ -14,152 +14,141 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui){
var table=layui.table,
layer=layui.layer;
var tableIns = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'用户等级列表'
,url: "/admin/level/index"
,page: false //开启分页
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '等级名称',width:120, align:'center'}
,{field:'desc',title: '等级描述'}
,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
var html1='<span>正常</span>';
var html2='<span style="color:#FF5722">禁用</span>';
if(d.status==1){
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool;
layui.pageTable = table.render({
elem: '#level'
, toolbar: '#toolbarDemo'
, title: '用户等级列表'
, url: "/admin/level/index"
, page: false //开启分页
, cellMinWidth: 120
, cols: [[
{ field: 'id', width: 80, title: 'ID号', align: 'center' }
, { field: 'title', title: '等级名称', width: 120, align: 'center' }
, { field: 'desc', title: '等级描述' }
, {
field: 'status', title: '状态', width: 80, align: 'center', templet: function (d) {
var html1 = '<span>正常</span>';
var html2 = '<span style="color:#FF5722">禁用</span>';
if (d.status == 1) {
return html1;
}
else{
else {
return html2;
}
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}
}
, {
width: 100, title: '操作', align: 'center', templet: function (d) {
var html = '';
var btn = '<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn1 = '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2 = '<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
if (d.status == 1) {
html = '<div class="layui-btn-group">' + btn + btn1 + '</div>';
}
else{
html = '<div class="layui-btn-group">'+btn+btn2+'</div>';
else {
html = '<div class="layui-btn-group">' + btn + btn2 + '</div>';
}
return html;
}}
]]
});
table.on('tool(test)',function (obj) {
if(obj.event === 'edit'){
addExpense(obj.data.id,obj.data.title,obj.data.desc);
}
}
if(obj.event === 'disable'){
layer.confirm('确定要禁用该等级吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/admin/level/disable",
type: 'post',
data: {
id: obj.data.id,
status: 0
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.location.reload();
}
}
})
layer.close(index);
});
}
if(obj.event === 'open'){
layer.confirm('确定要启用该等级吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/admin/level/disable",
type: 'post',
data: {
id: obj.data.id,
status: 1
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.location.reload();
}
}
})
layer.close(index);
});
}
});
$('.body-table').on('click','.addNew',function(){
addExpense(0,'','');
});
function addExpense(id,title,desc){
var biaoti = '新增等级';
if(id>0){
biaoti = '编辑等级';
}
layer.open({
type: 1
,title: biaoti
,area: '512px;'
,id: 'LAY_module' //设定一个id防止重复弹出
,btn: ['确定', '取消']
,btnAlign: 'c'
,content: '<div style="padding-top:15px;">\
]]
});
table.on('tool(level)', function (obj) {
if (obj.event === 'edit') {
addExpense(obj.data.id, obj.data.title, obj.data.desc);
}
if (obj.event === 'disable') {
layer.confirm('确定要禁用该等级吗?', { icon: 3, title: '提示' }, function (index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
layui.pageTable.reload()
}
}
tool.post("/admin/level/disable", { id: obj.data.id, status: 0 }, callback);
layer.close(index);
});
}
if (obj.event === 'open') {
layer.confirm('确定要启用该等级吗?', { icon: 3, title: '提示' }, function (index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
layui.pageTable.reload()
}
}
tool.post("/admin/level/disable", { id: obj.data.id, status: 1 }, callback);
layer.close(index);
});
}
});
$('body').on('click', '.addNew', function () {
addExpense(0, '', '');
});
function addExpense(id, title, desc) {
var biaoti = '新增等级';
if (id > 0) {
biaoti = '编辑等级';
}
layer.open({
type: 1
, title: biaoti
, area: '512px;'
, id: 'LAY_module' //设定一个id防止重复弹出
, btn: ['确定', '取消']
, btnAlign: 'c'
, content: '<div style="padding-top:15px;">\
<div class="layui-form-item">\
<label class="layui-form-label">等级名称</label>\
<div class="layui-input-inline" style="width:360px;">\
<input type="hidden" name="id" value="'+id+'">\
<input type="text" name="title" autocomplete="off" value="'+title+'" placeholder="请输入模块名称" class="layui-input">\
<input type="hidden" name="id" value="'+ id + '">\
<input type="text" name="title" autocomplete="off" value="'+ title + '" placeholder="请输入模块名称" class="layui-input">\
</div>\
</div>\
<div class="layui-form-item">\
<label class="layui-form-label">等级描述</label>\
<div class="layui-input-inline" style="width:360px;">\
<textarea name="desc" placeholder="请输入等级描述100字以内" class="layui-textarea">'+desc+'</textarea>\
<textarea name="desc" placeholder="请输入等级描述100字以内" class="layui-textarea">'+ desc + '</textarea>\
</div>\
</div>\
</div>'
,yes: function(index){
let id = $('#LAY_module').find('[name="id"]').val();
let title = $('#LAY_module').find('[name="title"]').val();
let desc = $('#LAY_module').find('[name="desc"]').val();
$.ajax({
url: "/admin/level/add",
type: 'post',
data: {
id: id,
title: title,
desc: desc
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
tableIns.reload();
}
}
})
, yes: function (index) {
let id = $('#LAY_module').find('[name="id"]').val();
let title = $('#LAY_module').find('[name="title"]').val();
let desc = $('#LAY_module').find('[name="desc"]').val();
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
if (e.code == 0) {
layer.close(index);
layui.pageTable.reload();
}
}
}
,btn2: function(){
layer.closeAll();
}
});
}
tool.post("/admin/level/add", {
id: id,
title: title,
desc: desc
}, callback);
return false;
}
, btn2: function () {
layer.closeAll();
}
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">友情链接</h3>
<form class="layui-form p-4">
<h3 class="pb-3">友情链接</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">网站名称<font>*</font></td>
@ -13,7 +13,7 @@
<td rowspan="4" class="layui-td-gray">网站Logo</td>
<td rowspan="4">
<div class="layui-upload" style="text-align:center">
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="test1">上传网站Logo</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="uploadBtn">上传网站Logo</button>
<div class="layui-upload-list" id="demo1" style="width:200px; height:120px; overflow:hidden">
<img {notempty name="$links.logo" }src="{:get_file($links.logo)}" {/notempty} heght="120px;" style="max-width: 100%;" />
<input type="hidden" name="logo" {notempty name="$links.logo" }value="{$links.logo}" {/notempty}>
@ -28,7 +28,7 @@
</td>
</tr>
<tr>
<td class="layui-td-gray2">是否新窗口打开</td>
<td class="layui-td-gray-2">新窗口打开</td>
<td>
{notempty name="$links.target" }
<input type="radio" name="target" value="1" title="是" {eq name="$links.target" value="1" }checked{/eq}>
@ -51,7 +51,7 @@
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -62,14 +62,12 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form,
layer = layui.layer,
upload = layui.upload;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool,upload = layui.upload;
//pc端图片
var uploadInst = upload.render({
elem: '#test1',
elem: '#uploadBtn',
url: '/admin/api/upload',
done: function (e) {
//如果上传失败
@ -84,24 +82,19 @@
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/links/add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
}
})
}
tool.post("/admin/links/add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,14 +1,14 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="ID/名称" class="layui-input" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="link" lay-filter="link"></table>
</div>
<script type="text/html" id="status">
@ -29,14 +29,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#link',
title: '友情链接列表',
toolbar: '#toolbarDemo',
url: '/admin/links/index', //数据接口
@ -48,7 +45,7 @@
title: 'ID号',
align: 'center',
width: 80
},{
}, {
field: 'name',
title: '网站名称',
width: 240
@ -70,20 +67,20 @@
]
]
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
table.on('toolbar(link)', function (obj) {
if (obj.event === 'add') {
rightpage.open("/admin/links/add","900px");
tool.side("/admin/links/add");
return;
}
});
//监听行工具事件
table.on('tool(test)', function (obj) {
table.on('tool(link)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
rightpage.open('/admin/links/add?id='+obj.data.id,"900px");
tool.side('/admin/links/add?id=' + obj.data.id);
return;
}
if (obj.event === 'del') {
@ -91,26 +88,21 @@
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/links/delete",
data: {
id: data.id
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/links/delete", { id: data.id }, callback);
layer.close(index);
});
}
});
//监听搜索提交
form.on('submit(webform)', function (data) {
tableIns.reload({
layui.pageTable.reload({
where: {
keywords: data.field.keywords
},
@ -122,6 +114,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="昵称/操作数据id/操作描述" class="layui-input" autocomplete="off" />
</div>
@ -16,7 +16,7 @@
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="log" lay-filter="log"></table>
</div>
{/block}
<!-- /主体 -->
@ -24,12 +24,10 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var table = layui.table,
form = layui.form;
function gouguInit() {
var table = layui.table, form = layui.form;
var tableIns = table.render({
elem: '#test',
elem: '#log',
title: '操作日志列表',
toolbar: '#toolbarDemo',
url: "/admin/log/index", //数据接口
@ -64,7 +62,7 @@
field: 'ip',
title: 'IP地址',
align: 'center',
width: 150
width: 130
}, {
field: 'create_time',
title: '操作时间',
@ -91,6 +89,5 @@
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>404错误</title>
<style>
.box-404{padding: 50px 0; text-align: center;}
.error-404{width:480px; margin: 0 auto; line-height: 2;}
.title-404{font-size: 24px; color: #EA4335;}
.text-404{font-size: 16px; color:#333;}
.btn-404{padding-top: 20px;}
.btn-404 a{padding: 3px 20px; font-size: 14px; display: inline-block; background-color: #EA4335; color: #fff; margin-right: 30px; border-radius: 4px; text-decoration: none;}
.btn-404 a:hover{opacity: .9;}
</style>
</head>
<body>
<div class="box-404">
<div><img src="/static/home/images/404.gif" width="500" height="300" alt="404"></div>
</div>
<div class="error-404">
<div class="title-404">出错啦!</div>
<div class="text-404">对不起,您要访问的页面不见了...</div>
<div class="btn-404"><a href="javascript:history.go(-1);">返回上一页</a><a href="/admin/index">返回首页</a></div>
</div>
</body>
</html>

View File

@ -6,19 +6,16 @@
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{:get_system_config('web','admin_title')}</title>
<link rel="stylesheet" href="{__LAYUI__}/css/layui.css?v={:get_system_config('web','version')}" media="all">
<link rel="stylesheet" href="{__GOUGU__}/layui/css/layui.css" media="all">
<style type="text/css">
html,body {width: 100%;height: 100%;background: #34a853;}
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px white inset;
}
#container {width: 100%;height: 100%;position: fixed;top: 0;left: 0;z-index: 999;color: #ffffff;
background: url({__ADMIN_IMG__}/bg.jpg);
background-size: cover;
background: url("{__ADMIN_IMG__}/bg_pattern.png"), -webkit-linear-gradient(to left, #34a853, #4285f4);
/* Chrome 10-25, Safari 5.1-6 */
background: url("{__ADMIN_IMG__}/bg_pattern.png"), linear-gradient(to left, #34a853, #4285f4);
/* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
background: url("{__ADMIN__}/images/bg_pattern.png"), -webkit-linear-gradient(to left, #34a853, #4285f4);
background: url("{__ADMIN__}/images/bg_pattern.png"), linear-gradient(to left, #34a853, #4285f4);
}
.container h2 {font-size: 36px;padding: 36px 0;font-weight: 500;}
.login {width: 400px;text-align: center;position: absolute;top: 50%;left: 50%;margin-top: -240px;margin-left: -200px;border-radius: 12px;box-shadow: 0 2px 6px rgba(26, 26, 26, .36);
@ -44,7 +41,7 @@
<div id="container">
<div class="login">
<div class="top">
<img src="{__ADMIN_IMG__}/login_logo.png" height="60" width="200">
<img src="{__ADMIN__}/images/login_logo.png" height="60" width="200">
<span class="bg1"></span>
<span class="bg2"></span>
</div>
@ -75,7 +72,7 @@
rel="nofollow" style="margin-left: 15px;color:#d3e8fa;">{:get_system_config('web','icp')}</a>Powered by GouguCMS
</div>
</div>
<script src="{__LAYUI__}/layui.js?v={:get_system_config('web','version')}"></script>
<script src="{__GOUGU__}/layui/layui.js"></script>
<script type="text/javascript">
layui.use(['form'], function() {
var form = layui.form,

View File

@ -1,8 +1,8 @@
{extend name="common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<table class="layui-hide" id="test" lay-filter="test"></table>
<div class="p-3">
<table class="layui-hide" id="list" lay-filter="list"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
@ -14,166 +14,147 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui){
var table=layui.table,
layer=layui.layer;
var tableIns = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'功能模块列表'
,url: "/admin/module/index"
,page: false //开启分页
,cellMinWidth: 80
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '模块名称'}
,{field:'name',title: '模块所在目录',templet: function(d){
var html='app/'+d.name;
<script>
const moduleInit = ['tool'];
function gouguInit() {
var tool = layui.tool, table = layui.table;
layui.pageTable = table.render({
elem: '#list'
, toolbar: '#toolbarDemo'
, title: '功能模块列表'
, url: "/admin/module/index"
, page: false //开启分页
, cellMinWidth: 80
, cols: [[
{ field: 'id', width: 80, title: 'ID号', align: 'center' }
, { field: 'title', title: '模块名称' }
, {
field: 'name', title: '模块所在目录', templet: function (d) {
var html = 'app/' + d.name;
return html;
}}
,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
var html1='<span>正常</span>';
var html2='<span style="color:#FF5722">禁用</span>';
if(d.status==1){
}
}
, {
field: 'status', title: '状态', width: 80, align: 'center', templet: function (d) {
var html1 = '<span>正常</span>';
var html2 = '<span style="color:#FF5722">禁用</span>';
if (d.status == 1) {
return html1;
}
else{
else {
return html2;
}
}}
,{field:'type', title: '类型',width:120,align:'center',templet: function(d){
var html1='<span>系统模块</span>';
var html2='<span style="color:#FF5722">普通模块</span>';
if(d.type==1){
}
}
, {
field: 'type', title: '类型', width: 120, align: 'center', templet: function (d) {
var html1 = '<span>系统模块</span>';
var html2 = '<span style="color:#FF5722">普通模块</span>';
if (d.type == 1) {
return html1;
}
else{
else {
return html2;
}
}}
,{width:100,title: '操作', align:'center',templet: function(d){
var html='';
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn1='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
if(d.status==1){
html = '<div class="layui-btn-group">'+btn+btn1+'</div>';
}
}
, {
width: 100, title: '操作', align: 'center', templet: function (d) {
var html = '';
var btn = '<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
var btn1 = '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="disable">禁用</a>';
var btn2 = '<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>';
if (d.status == 1) {
html = '<div class="layui-btn-group">' + btn + btn1 + '</div>';
}
else{
html = '<div class="layui-btn-group">'+btn+btn2+'</div>';
else {
html = '<div class="layui-btn-group">' + btn + btn2 + '</div>';
}
return html;
}}
]]
});
table.on('tool(test)',function (obj) {
if(obj.event === 'edit'){
addExpense(obj.data.id,obj.data.title,obj.data.name);
}
if(obj.event === 'disable'){
layer.confirm('确定要禁用该模块吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/admin/module/disable",
type: 'post',
data: {
id: obj.data.id,
status: 0
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.location.reload();
}
}
})
layer.close(index);
});
}
if(obj.event === 'open'){
layer.confirm('确定要启用该模块吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/admin/module/disable",
type: 'post',
data: {
id: obj.data.id,
status: 1
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.location.reload();
}
}
})
layer.close(index);
});
}
});
$('.body-table').on('click','.addNew',function(){
addExpense(0,'','');
});
function addExpense(id,title,name){
var biaoti = '新增模块';
if(id>0){
biaoti = '编辑模块';
}
layer.open({
type: 1
,title: biaoti
,area: '398px;'
,id: 'LAY_module' //设定一个id防止重复弹出
,btn: ['确定', '取消']
,btnAlign: 'c'
,content: '<div style="padding-top:15px;">\
<div class="layui-form-item">\
<label class="layui-form-label">模块名称</label>\
<div class="layui-input-inline">\
<input type="hidden" name="id" value="'+id+'">\
<input type="text" name="title" autocomplete="off" value="'+title+'" placeholder="请输入模块名称" class="layui-input">\
</div>\
</div>\
<div class="layui-form-item">\
<label class="layui-form-label">所在目录</label>\
<div class="layui-input-inline">\
<input type="text" name="name" autocomplete="off" value="'+name+'" placeholder="请输入至少2个小写字符" class="layui-input">\
</div>\
</div>\
<div style="text-align:center;color:red">目录如:"app/admin",只需要填写"admin"就可以了。</div>\
</div>'
,yes: function(index){
let id = $('#LAY_module').find('[name="id"]').val();
let title = $('#LAY_module').find('[name="title"]').val();
let name = $('#LAY_module').find('[name="name"]').val();
$.ajax({
url: "/admin/module/add",
type: 'post',
data: {
id: id,
title: title,
name: name
},
success: function(e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
tableIns.reload();
}
}
})
}
,btn2: function(){
layer.closeAll();
}
]]
});
table.on('tool(list)', function (obj) {
if (obj.event === 'edit') {
addExpense(obj.data.id, obj.data.title, obj.data.name);
}
if (obj.event === 'disable') {
layer.confirm('确定要禁用该模块吗?', { icon: 3, title: '提示' }, function (index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
layui.pageTable.reload()
}
}
tool.post("/admin/module/disable", { id: obj.data.id, status: 0 }, callback);
layer.close(index);
});
}
if (obj.event === 'open') {
layer.confirm('确定要启用该模块吗?', { icon: 3, title: '提示' }, function (index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
layui.pageTable.reload()
}
}
tool.post("/admin/module/disable", { id: obj.data.id, status: 1 }, callback);
layer.close(index);
});
}
});
$('body').on('click', '.addNew', function () {
addExpense(0, '', '');
});
function addExpense(id, title, name) {
layer.open({
type: 1
, title: id > 0 ? '新增模块' : '编辑模块'
, area: '398px;'
, id: 'GG_module' //设定一个id防止重复弹出
, btn: ['确定', '取消']
, btnAlign: 'c'
, content: `<div style="padding-top:16px;">
<div class="layui-form-item">
<label class="layui-form-label">模块名称</label>
<div class="layui-input-inline">
<input type="hidden" name="id" value="${id}">
<input type="text" name="title" autocomplete="off" value="${title}" placeholder="请输入模块名称" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">所在目录</label>
<div class="layui-input-inline">
<input type="text" name="name" autocomplete="off" value="${name}" placeholder="请输入至少2个小写字符" class="layui-input">
</div>
</div>
<div style="padding:8px 0;text-align:center;color:red">目录如:"app/admin",只需要填写"admin"就可以了。</div>
</div>`
, yes: function (index) {
let id = $('#GG_module').find('[name="id"]').val();
let title = $('#GG_module').find('[name="title"]').val();
let name = $('#GG_module').find('[name="name"]').val();
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
layui.pageTable.reload();
}
}
tool.post("/admin/module/add", { id: id, title: title, name: name }, callback);
}
, btn2: function () {
layer.closeAll();
}
});
}
</script>
{include file="common/layui" base='base' extend="[]" callback="init" /}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">导航组</h3>
<form class="layui-form p-4">
<h3 class="pb-3">导航组</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">标题<font>*</font></td>
@ -32,7 +32,7 @@
<td colspan="3"><textarea name="desc" placeholder="请输入备注" class="layui-textarea">{notempty name="$nav.desc" }{$nav.desc}{/notempty}</textarea></td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -43,30 +43,24 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form,
layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/nav/add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
}
})
}
tool.post("/admin/nav/add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,14 +1,14 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="ID/标题/标识/备注" class="layui-input" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="nav" lay-filter="nav"></table>
</div>
<script type="text/html" id="status">
@ -28,14 +28,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#nav',
toolbar: '#toolbarDemo',
url: '/admin/nav/index', //数据接口
page: true, //开启分页
@ -77,17 +74,17 @@
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
table.on('toolbar(nav)', function (obj) {
if (obj.event === 'add') {
rightpage.open("/admin/nav/add","900px");
tool.side("/admin/nav/add");
return;
}
});
//监听行工具事件
table.on('tool(test)', function (obj) {
table.on('tool(nav)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
rightpage.open('/admin/nav/add?id='+obj.data.id,"900px");
tool.side('/admin/nav/add?id=' + obj.data.id);
return;
}
if (obj.event === 'del') {
@ -95,18 +92,13 @@
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/nav/delete",
data: {
id: data.id
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/nav/delete", { id: data.id }, callback);
layer.close(index);
});
}
@ -114,7 +106,7 @@
//监听搜索提交
form.on('submit(webform)', function (data) {
tableIns.reload({
layui.pageTable.reload({
where: { keywords: data.field.keywords },
page: { curr: 1 }
});
@ -122,6 +114,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table" style="margin-bottom:0;">
<div class="layui-form-bar">
<div class="p-3">
<div class="gg-form-bar border-t border-x">
<button class="layui-btn layui-btn-normal layui-btn-sm add-menu">+ 添加导航</button>
<button class="layui-btn layui-btn-primary layui-btn-sm add-back">返回</button>
</div>
@ -22,16 +22,13 @@
<!-- 脚本 -->
{block name="script"}
<script>
var nid = {$nav_id},ptable = null, treeGrid = null,rightpage=null, layer = null, tableId = "treeTable";
function init(layui) {
var table = layui.table;
treeGrid = layui.treeGrid;
layer = layui.layer;
rightpage = layui.rightpage;
ptable = treeGrid.render({
id: tableId,
elem: '#' + tableId,
var nid = {$nav_id};
const moduleInit = ['tool', 'treeGrid'];
function gouguInit() {
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
layui.pageTable = treeGrid.render({
id: 'treeTable',
elem: '#treeTable',
idField: 'id',
url: '/admin/nav/nav_info', //数据接口
where: {
@ -93,7 +90,7 @@
//表头工具栏事件
$('.add-menu').on('click',function(){
rightpage.open("/admin/nav/nav_info_add?nid="+nid,'900px');
tool.side("/admin/nav/nav_info_add?nid="+nid);
return;
});
@ -104,13 +101,13 @@
});
//删除
treeGrid.on('tool(' + tableId + ')', function (obj) {
treeGrid.on('tool(treeTable)', function (obj) {
if (obj.event === 'add') {
rightpage.open('/admin/nav/nav_info_add?nid='+nid+'&pid='+obj.data.id,'900px');
tool.side('/admin/nav/nav_info_add?nid='+nid+'&pid='+obj.data.id);
return;
}
if (obj.event === 'edit') {
rightpage.open('/admin/nav/nav_info_add?nid='+nid+'&id='+obj.data.id,'900px');
tool.side('/admin/nav/nav_info_add?nid='+nid+'&id='+obj.data.id);
return;
}
if (obj.event === 'del') {
@ -118,25 +115,18 @@
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/nav/nav_info_delete",
type: 'post',
data: {
id: obj.data.id
},
success: function (res) {
layer.msg(res.msg);
if (res.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/nav/nav_info_delete", { id: obj.data.id }, callback);
layer.close(index);
});
}
});
}
</script>
{include file="common/layui" base="base" extend="['treeGrid','rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,41 +1,42 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">导航内容</h3>
<form class="layui-form p-4">
<h3 class="pb-3">导航内容</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">父级导航<font>*</font></td>
<td class="layui-td-gray">父级导航<font>*</font>
</td>
<td>
<input type="hidden" name="id" value="{$id}"/>
<input type="hidden" name="nav_id" value="{$nav_id}"/>
<select name="pid" lay-verify="required" lay-reqText="请选择父级导航" >
<input type="hidden" name="id" value="{$id}" />
<input type="hidden" name="nav_id" value="{$nav_id}" />
<select name="pid" lay-verify="required" lay-reqText="请选择父级导航">
<option value="0">作为顶级导航</option>
{volist name=":set_recursion(get_nav($nav_id))" id="v"}
<option value="{$v.id}" {eq name="pid" value="$v.id" }selected="" {/eq}>{$v.title} </option>
<option value="{$v.id}" {eq name="pid" value="$v.id" }selected="" {/eq}>{$v.title} </option>
{/volist}
</select>
</td>
<td class="layui-td-gray">排序</td><td>
<input type="text" name="sort" autocomplete="off" class="layui-input" {notempty name="$nav.sort" }value="{$nav.sort}"{else/}value="0" {/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray">导航名称<font>*</font></td>
<td class="layui-td-gray">排序</td>
<td>
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入名称" lay-reqText="请输入名称" class="layui-input" {notempty name="$nav.title" }value="{$nav.title}"{/notempty}>
<input type="text" name="sort" autocomplete="off" class="layui-input" {notempty name="$nav.sort"
}value="{$nav.sort}" {else/}value="0" {/notempty}>
</td>
<td class="layui-td-gray">网址链接</td>
<td>
<input type="text" name="src" placeholder="请输入导航网址链接,可空" autocomplete="off" class="layui-input" {notempty name="$nav.src" }value="{$nav.src}"{/notempty}>
</td>
</tr>
<tr>
<td class="layui-td-gray">参数</td>
<td>
<input type="text" name="param" placeholder="请输入导航参数,可空" autocomplete="off" class="layui-input" {notempty name="$nav.param" }value="{$nav.param}"{/notempty}>
<input type="text" name="param" placeholder="请输入导航参数,可空" autocomplete="off" class="layui-input"
{notempty name="$nav.param" }value="{$nav.param}" {/notempty}>
</td>
<td class="layui-td-gray2">是否新窗口打开</td>
</tr>
<tr>
<td class="layui-td-gray">导航名称<font>*</font>
</td>
<td colspan="3">
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入名称"
lay-reqText="请输入名称" class="layui-input" {notempty name="$nav.title" }value="{$nav.title}"
{/notempty}>
</td>
<td class="layui-td-gray-2">新窗口打开</td>
<td>
{if condition="$id eq 0"}
<input type="radio" name="target" value="0" title="否" checked>
@ -43,12 +44,18 @@
{else/}
<input type="radio" name="target" value="0" title="否" {eq name="$nav.target" value="0" }checked{/eq}>
<input type="radio" name="target" value="1" title="是" {eq name="$nav.target" value="1" }checked{/eq}>
{/if}
{/if}
</td>
</tr>
<tr>
<td class="layui-td-gray2">状态<font>*</font></td>
<td class="layui-td-gray">网址链接</td>
<td colspan="3">
<input type="text" name="src" placeholder="请输入导航网址链接,可空" autocomplete="off" class="layui-input"
{notempty name="$nav.src" }value="{$nav.src}" {/notempty}>
</td>
<td class="layui-td-gray">状态<font>*</font>
</td>
<td>
{if condition="$id eq 0"}
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="-1" title="禁用">
@ -59,9 +66,8 @@
</td>
</tr>
</table>
<div style="padding: 10px 0">
<button class="layui-btn" lay-submit="" lay-filter="webform">立即提交</button>
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
@ -71,29 +77,23 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form,
layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool;
//监听提交
form.on('submit(webform)', function(data) {
$.ajax({
url: "/admin/nav/nav_info_add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
window.setTimeout(function(){
parent.location.reload();
},1000);
}
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
})
}
tool.post("/admin/nav/nav_info_add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->
<!-- /脚本 -->

View File

@ -0,0 +1,273 @@
{extend name="common/base"/}
{block name="style"}
<style>
.upload-img {
width: 120px;
height: 90px;
overflow: hidden;
position: relative;
border: 1px solid #eee;
padding: 1px;
margin: 5px;
float: left;
}
.upload-close {
position: absolute;
top: 1px;
right: 1px;
}
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-3">
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">页面标题 <span style="color: red">*</span></td>
<td><input type="text" name="title" lay-verify="required" lay-reqText="请输入页面标题" placeholder="请输入页面标题" class="layui-input"></td>
<td class="layui-td-gray" rowspan="3">缩略图 <span style="color: red">*</span></td>
<td rowspan="3" style="vertical-align:top">
<div class="layui-upload" style="text-align:center;">
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn">上传封面图(尺寸750x560)</button>
<div class="layui-upload-list" id="demo1">
<img src="" style="width:200px;max-width:200px" />
<input type="hidden" name="thumb" value="" lay-verify="required" lay-reqText="请上传缩略图">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">关键字 <span style="color: red">*</span></td>
<td>
<input type="text" id="keyword_name" name="keyword_names" lay-verify="required" lay-reqText="请选择关键字"
placeholder="请选择关键字" class="layui-input" readonly>
<input type="hidden" id="keyword_id" name="keyword_ids">
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">页面摘要</td>
<td>
<textarea name="desc" placeholder="请输入页面摘要200字以内" class="layui-textarea"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">图集相册</td>
<td colspan="3">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn2">上传图片</button>
<div class="layui-upload-list clearfix" id="demo2">
<input type="hidden" name="banner" value="">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">展示模板 <span style="color: red">*</span></td>
<td>
<select name="template" lay-verify="required" lay-reqText="请选择前台展示模板">
<option value="">请选择前台展示模板</option>
{volist name="$templates" id="vo"}
<option value="{$vo.filename}">{$vo.basename}</option>
{/volist}
</select>
</td>
<td class="layui-td-gray">状态 <span style="color: red">*</span></td>
<td>
<input type="radio" name="status" value="1" title="正常" checked>
<input type="radio" name="status" value="0" title="下架">
</td>
</tr>
{eq name="$editor" value="1"}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">页面内容<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为TinyMCE富文本编辑器可在【系统管理->其他配置】中切换为mardown编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<textarea class="layui-textarea" id="container"></textarea>
</td>
</tr>
{else/}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">页面内容<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为mardown编辑器可在【系统管理->其他配置】中切换为TinyMCE富文本编辑器</span></td>
</tr>
<tr>
<td colspan="6">
<div>
<textarea id="mdContent" style="display:none;"></textarea>
<div id="docContent"></div>
</div>
</td>
</tr>
{/eq}
</table>
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">关闭</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
// 查找指定的元素在数组中的位置
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
const editorType = '{$editor}';
var moduleInit;
if (editorType == 1) {
moduleInit = ['tool', 'tagpicker', 'tinymce'];
}
else {
moduleInit = ['tool', 'tagpicker', 'editormd'];
}
function gouguInit() {
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker, upload = layui.upload;
var tags = new tagspicker({
'url': '/admin/api/get_keyword_cate',
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
'height': 500,
'isDiy': 1
});
//缩略图上传
var uploadInst = upload.render({
elem: '#uploadBtn'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value', res.data.id);
$('#demo1 img').attr('src', res.data.filepath);
}
});
//广告图上传
var uploadInst2 = upload.render({
elem: '#uploadBtn2'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
var idsStr = $('#demo2 input').val();
var idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#demo2 input').attr('value', idsArray.join(','));
$('#demo2').append('<div class="upload-img img-cover" id="uploadImg' + res.data.id + '"><div class="gg-img-cover cover-4-3"><img src="' + res.data.filepath + '"><div class="upload-close"><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delimg" data-id="' + res.data.id + '">删除</a></div></div></div>');
}
});
$('#demo2').on('click', '[lay-event="delimg"]', function () {
var _id = $(this).data('id');
var idsStr = $('#demo2 input').val();
var idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#demo2 input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
//监听返回
$('body').on('click', '[lay-event="back"]', function () {
tool.tabClose();
return false;
});
if (editorType == 1) {
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.content = tinyMCE.editors['container'].getContent();
if (data.field.content == '') {
layer.msg('请先完善页面内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面吗?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/pages/add", data.field, callback);
return false;
});
}
else {
var editor = layui.editormd;
var edit = editor.render('docContent', {
markdown: document.getElementById('mdContent').value
});
//监听提交
form.on('submit(webform)', function (data) {
if (data.field.mdContent == '') {
layer.msg('请先完善页面内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面吗?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/pages/add", data.field, callback);
return false;
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,290 @@
{extend name="common/base"/}
{block name="style"}
<style>
.upload-img {
width: 120px;
height: 90px;
overflow: hidden;
position: relative;
border: 1px solid #eee;
padding: 1px;
margin: 5px;
float: left;
}
.upload-close {
position: absolute;
top: 1px;
right: 1px;
}
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-3">
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">页面标题 <span style="color: red">*</span></td>
<td><input type="text" name="title" lay-verify="required" lay-reqText="请输入页面标题" placeholder="请输入页面标题" class="layui-input" value="{$detail.title}"></td>
<td class="layui-td-gray" rowspan="3">缩略图 <span style="color: red">*</span></td>
<td rowspan="3" style="vertical-align:top">
<div class="layui-upload" style="text-align:center;">
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn">上传封面图(尺寸750x560)</button>
<div class="layui-upload-list" id="demo1">
<img src="{$detail.thumb|get_file}" style="width:200px;max-width:200px" />
<input type="hidden" name="thumb" value="{$detail.thumb}">
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">关键字 <span style="color: red">*</span></td>
<td>
<input type="text" id="keyword_name" name="keyword_names" lay-verify="required" lay-reqText="请选择关键字"
placeholder="请选择关键字" class="layui-input" value="{$detail.keyword_names}" readonly>
<input type="hidden" id="keyword_id" name="keyword_ids" value="{$detail.keyword_ids}">
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">页面摘要</td>
<td>
<textarea name="desc" placeholder="请输入页面摘要200字以内" class="layui-textarea">{$detail.desc}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">图集相册</td>
<td colspan="3">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn2">上传图片</button>
<div class="layui-upload-list" id="demo2">
<input type="hidden" name="banner" value="{$detail.banner}">
{notempty name="detail.banner"}
{volist name="detail.banner_array" id="vo"}
<div class="upload-img img-cover" id="uploadImg{$vo}"><div class="gg-img-cover cover-4-3"><img src="{$vo|get_file}"><div class="upload-close"><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delimg" data-id="{$vo}">删除</a></div></div></div>
{/volist}
{/notempty}
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">展示模板 <span style="color: red">*</span></td>
<td>
<select name="template" lay-verify="required" lay-reqText="请选择前台展示模板">
<option value="">请选择前台展示模板</option>
{volist name="$templates" id="vo"}
<option value="{$vo.filename}" {eq name="$vo.filename" value="$detail.template" }selected{/eq}>{$vo.basename}</option>
{/volist}
</select>
</td>
<td class="layui-td-gray">状态 <span style="color: red">*</span></td>
<td>
<input type="radio" name="status" value="1" title="正常" {eq name="$detail.status" value="1" }checked{/eq}>
<input type="radio" name="status" value="0" title="下架" {eq name="$detail.status" value="0" }checked{/eq}>
</td>
</tr>
{empty name="$detail.md_content"}
<tr>
<td colspan="4" class="layui-td-gray" style="text-align:left">页面内容<span style="color: red">*</span></td>
</tr>
<tr>
<td colspan="4">
<textarea class="layui-textarea" id="container">{$detail.content}</textarea>
</td>
</tr>
{else/}
{eq name="$editor" value="1"}
<tr>
<td colspan="4" class="layui-td-gray" style="text-align:left">页面内容<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为TinyMCE富文本编辑器可在【系统管理->其他配置】中切换为mardown编辑器</span></td>
</tr>
<tr>
<td colspan="4">
<textarea placeholder="请输入内容" class="layui-textarea" id="container">{$detail.content}</textarea>
</td>
</tr>
{else/}
<tr>
<td colspan="4" class="layui-td-gray" style="text-align:left">页面内容<span style="color: red">*</span><span
style="margin-left:30px; color: red">当前为mardown编辑器可在【系统管理->其他配置】中切换为TinyMCE富文本编辑器</span></td>
</tr>
<tr>
<td colspan="4">
<div>
<textarea id="mdContent" style="display:none;">{$detail.md_content|raw}</textarea>
<div id="docContent"></div>
</div>
</td>
</tr>
{/eq}
{/empty}
</table>
<div class="py-3">
<input type="hidden" name="id" value="{$detail.id}">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">关闭</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
// 查找指定的元素在数组中的位置
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) {
return i;
}
}
return -1;
};
// 通过索引删除数组元素
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
const editorType = '{$editor}';
var moduleInit;
if (editorType == 1) {
moduleInit = ['tool', 'tagpicker', 'tinymce'];
}
else {
moduleInit = ['tool', 'tagpicker', 'editormd'];
}
function gouguInit() {
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker, upload = layui.upload;
var tags = new tagspicker({
'url': '/admin/api/get_keyword_cate',
'target': 'keyword_name',
'tag_ids': 'keyword_id',
'tag_tags': 'keyword_name',
'height': 500,
'isDiy': 1
});
//缩略图上传
var uploadInst = upload.render({
elem: '#uploadBtn'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value', res.data.id);
$('#demo1 img').attr('src', res.data.filepath);
}
});
//广告图上传
var uploadInst2 = upload.render({
elem: '#uploadBtn2'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
var idsStr = $('#demo2 input').val();
var idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.push(res.data.id);
$('#demo2 input').attr('value', idsArray.join(','));
$('#demo2').append('<div class="upload-img img-cover" id="uploadImg' + res.data.id + '"><div class="gg-img-cover cover-4-3"><img src="' + res.data.filepath + '"><div class="upload-close"><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delimg" data-id="' + res.data.id + '">删除</a></div></div></div>');
}
});
$('#demo2').on('click', '[lay-event="delimg"]', function () {
var _id = $(this).data('id');
var idsStr = $('#demo2 input').val();
var idsArray = [];
if (idsStr != '') {
idsArray = idsStr.split(",");
}
idsArray.remove(_id);
$('#demo2 input').attr('value', idsArray.join(','));
$('#uploadImg' + _id).remove();
})
//监听返回
$('body').on('click', '[lay-event="back"]', function () {
tool.tabClose();
return false;
});
if (editorType == 1) {
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container",
height: 500
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.content = tinyMCE.editors['container'].getContent();
if (data.field.content == '') {
layer.msg('请先完善页面内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面吗?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/pages/add", data.field, callback);
return false;
});
}
else {
var editor = layui.editormd;
var edit = editor.render('docContent', {
markdown: document.getElementById('mdContent').value
});
//监听提交
form.on('submit(webform)', function (data) {
if (data.field.mdContent == '') {
layer.msg('请先完善页面内容');
return false;
}
let callback = function (e) {
if (e.code == 0) {
layer.confirm('保存成功,关闭当前页面吗?', { icon: 3, title: '提示' }, function (index) {
tool.tabClose();
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
tool.post("/admin/pages/add", data.field, callback);
return false;
});
}
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,112 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="ID/标题/描述" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="pages" lay-filter="pages"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-normal layui-btn-sm tab-a" data-title="添加页面" data-href="/admin/pages/add">+ 添加页面</span>
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group"><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#pages',
title: '单页面列表',
toolbar: '#toolbarDemo',
url: '/admin/pages/index', //数据接口
page: true, //开启分页
limit: 20,
cols: [
[ //表头
{
field: 'id',
title: '编号',
align: 'center',
width: 80
}, {
field: 'title',
title: '页面标题',
templet: '<div><a href="/home/pages/detail/id/{{d.id}}.html" class="layui-table-link" target="_blank">{{d.title}}</a></div>'
},{
field: 'create_time',
title: '发布时间',
align: 'center',
width: 160
},{
field: 'status',
title: '状态',
toolbar: '#status',
align: 'center',
width: 66
},{
field: 'right',
title: '操作',
toolbar: '#barDemo',
width: 100,
align: 'center'
}
]
]
});
//监听行工具事件
table.on('tool(pages)', function(obj) {
var data = obj.data;
if (obj.event === 'edit') {
tool.tabAdd('/admin/pages/add?id='+obj.data.id,'编辑商品'+obj.data.id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete("/admin/pages/delete", { id: data.id }, callback);
layer.close(index);
});
}
});
//监听搜索提交
form.on('submit(webform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -1,22 +1,25 @@
{extend name="common/base" /}
{block name="style"}
<style>
.checkbox16 .layui-form-checkbox span{font-size:15px;font-weight:800;}
#rule .layui-checkbox-disabled span {color: #666666!important;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<style>
.checkbox16 .layui-form-checkbox span{font-size:15px;font-weight:800;}
#rule .layui-checkbox-disabled span {color: #666666!important;}
</style>
<form class="layui-form page-content">
<h3 class="h3-title">权限角色</h3>
<table class="layui-table">
<form class="layui-form p-4">
<h3 class="pb-3">权限角色</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">角色名称<font>*</font>
<td class="layui-td-gray">角色名称<font>*</font>
</td>
<td>
<input type="hidden" name="id" value="{$id}" />
<input class="layui-input" type="text" name="title" lay-verify="required" lay-reqText="请输入角色名称" {notempty name="$role.title"
}value="{$role.title}" {/notempty} placeholder="请输入角色名称" autocomplete="off" />
</td>
<td class="layui-td-gray2">状态<font>*</font>
<td class="layui-td-gray">状态<font>*</font>
</td>
<td>
{if condition="$id eq 0"}
@ -29,7 +32,7 @@
</td>
</tr>
<tr>
<td class="layui-td-gray2" style="vertical-align:top">权限配置</td>
<td class="layui-td-gray" style="vertical-align:top">权限配置<font>*</font></td>
<td colspan="3">
<table style="width:100%" id="rule">
<tr>
@ -67,7 +70,7 @@
</td>
</tr>
<tr>
<td class="layui-td-gray2" style="vertical-align: top;">备注内容
<td class="layui-td-gray" style="vertical-align: top;">备注内容
</td>
<td colspan="3">
<textarea name="desc" placeholder="请输入备注" class="layui-textarea">{notempty name="$role.desc" }{$role.desc}{/notempty}</textarea>
@ -85,13 +88,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var tree = layui.tree;
var form = layui.form;
var layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool, tree = layui.tree;
//监听提交
form.on('submit(webform)', function (obj) {
console.log(obj.field);
$.ajax({
url: "/admin/role/add",
data: obj.field,
@ -99,9 +100,9 @@
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.rightpage.close();
parent.layui.tool.close();
},1000);
}
}
@ -137,6 +138,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,14 +1,14 @@
{extend name="common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="名称/备注" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="role" lay-filter="role"></table>
</div>
<script type="text/html" id="status">
@ -25,14 +25,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#role',
toolbar: '#toolbarDemo',
url: "/admin/role/index", //数据接口
page: true, //开启分页
@ -51,31 +48,32 @@
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
table.on('toolbar(role)', function(obj){
if (obj.event === 'add') {
rightpage.open("/admin/role/add");
tool.side("/admin/role/add");
return;
}
});
//监听行工具事件
table.on('tool(test)', function (obj) {
table.on('tool(role)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
rightpage.open('/admin/role/add?id='+obj.data.id);
tool.side('/admin/role/add?id='+obj.data.id);
return;
}
if (obj.event === 'del') {
layer.confirm('确定要删除该权限角色吗?', { icon: 3, title: '提示' }, function (index) {
$.ajax({
url: "/admin/role/delete",
data: { id: data.id },
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.msg(res.msg);
if (res.code == 0) {
obj.del();
layer.close(index);
}
}
})
}
tool.delete("/admin/role/delete", { id: obj.data.id }, callback);
layer.close(index);
});
}
@ -83,7 +81,7 @@
//监听搜索提交
form.on('submit(webform)', function (data) {
tableIns.reload({
layui.pageTable.reload({
where: { keywords: data.field.keywords },
page: { curr: 1 }
});
@ -92,6 +90,5 @@
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,12 +1,13 @@
{extend name="common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">功能菜单/节点</h3>
<form class="layui-form p-4">
<h3 class="pb-3">功能菜单/节点</h3>
{if condition="$id eq 0"}
<table class="layui-table">
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">父级菜单/节点<font>*</font></td>
<td class="layui-td-gray-2">父级菜单/节点<font>*</font>
</td>
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择父级菜单/节点">
<option value="0">作为顶级菜单/节点</option>
@ -15,44 +16,52 @@
{/volist}
</select>
</td>
<td class="layui-td-gray3">左侧菜单显示<font>*</font></td>
<td class="layui-td-gray-2">左侧菜单显示<font>*</font>
</td>
<td>
<input type="radio" name="menu" value="1" title="是">
<input type="radio" name="menu" value="2" title="不是">
</td>
</tr>
<tr>
<td class="layui-td-gray2">菜单/节点名称<font>*</font></td>
<td>
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入菜单/节点名称" lay-reqText="请输入菜单/节点名称" class="layui-input">
<td class="layui-td-gray">菜单/节点名称<font>*</font>
</td>
<td class="layui-td-gray2">操作日志名称<font>*</font></td>
<td>
<input type="text" name="name" lay-verify="required" placeholder="请输入操作日志名称" lay-reqText="请输入操作日志名称" autocomplete="off" class="layui-input">
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入菜单/节点名称"
lay-reqText="请输入菜单/节点名称" class="layui-input">
</td>
<td class="layui-td-gray">操作日志名称<font>*</font>
</td>
<td>
<input type="text" name="name" lay-verify="required" placeholder="请输入操作日志名称" lay-reqText="请输入操作日志名称"
autocomplete="off" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray2">菜单/节点URL</td>
<td class="layui-td-gray">菜单/节点URL</td>
<td>
<input type="text" name="src" placeholder="请输入菜单/节点URL可空" autocomplete="off" class="layui-input">
</td>
<td class="layui-td-gray2">排序</td>
<td class="layui-td-gray">菜单排序</td>
<td>
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off" class="layui-input">
<input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray3">图标</td>
<td class="layui-td-gray">菜单图标</td>
<td colspan="3">
<input type="text" name="icon" style="width:150px; display:inline" placeholder="请输入图标,可空" autocomplete="off" class="layui-input">
icon-jichuguanli<a href="{__LAYUI__}/font/extend/demo_index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
<input type="text" name="icon" style="width:150px; display:inline" placeholder="请输入图标,可空"
autocomplete="off" class="layui-input">
bi-gear<a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
</td>
</tr>
</table>
{else/}
<table class="layui-table">
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">父级菜单/节点<font>*</font></td>
<td class="layui-td-gray-2">父级菜单/节点<font>*</font>
</td>
<td>
<select name="pid" lay-verify="required" lay-reqText="请选择父级菜单/节点">
<option value="0">作为顶级节点</option>
@ -61,37 +70,44 @@
{/volist}
</select>
</td>
<td class="layui-td-gray3">左侧菜单显示<font>*</font></td>
<td class="layui-td-gray-2">左侧菜单显示<font>*</font>
</td>
<td>
<input type="radio" name="menu" value="1" title="是" {eq name="$detail.menu" value="1"} checked{/eq}>
<input type="radio" name="menu" value="2" title="不是" {eq name="$detail.menu" value="2"} checked{/eq}>
<input type="radio" name="menu" value="1" title="是" {eq name="$detail.menu" value="1" } checked{/eq}>
<input type="radio" name="menu" value="2" title="不是" {eq name="$detail.menu" value="2" } checked{/eq}>
</td>
</tr>
<tr>
<td class="layui-td-gray2">菜单/节点名称<font>*</font></td>
<td>
<input type="text" name="title" value="{$detail.title}" lay-verify="required" autocomplete="off" placeholder="请输入菜单/节点名称" lay-reqText="请输入菜单/节点名称" class="layui-input">
<td class="layui-td-gray">菜单/节点名称<font>*</font>
</td>
<td class="layui-td-gray2">操作日志名称<font>*</font></td>
<td>
<input type="text" name="name" value="{$detail.name}" lay-verify="required" placeholder="请输入操作日志名称" lay-reqText="请输入操作日志名称" autocomplete="off" class="layui-input">
<input type="text" name="title" value="{$detail.title}" lay-verify="required" autocomplete="off"
placeholder="请输入菜单/节点名称" lay-reqText="请输入菜单/节点名称" class="layui-input">
</td>
<td class="layui-td-gray">操作日志名称<font>*</font>
</td>
<td>
<input type="text" name="name" value="{$detail.name}" lay-verify="required" placeholder="请输入操作日志名称"
lay-reqText="请输入操作日志名称" autocomplete="off" class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray2">菜单/节点URL</td>
<td class="layui-td-gray">菜单/节点URL</td>
<td>
<input type="text" name="src" value="{$detail.src}" placeholder="请输入菜单/节点URL可空" autocomplete="off" class="layui-input">
<input type="text" name="src" value="{$detail.src}" placeholder="请输入菜单/节点URL可空" autocomplete="off"
class="layui-input">
</td>
<td class="layui-td-gray2">排序</td>
<td class="layui-td-gray">菜单排序</td>
<td>
<input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off" class="layui-input">
<input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off"
class="layui-input">
</td>
</tr>
<tr>
<td class="layui-td-gray2">图标</td>
<td class="layui-td-gray">菜单图标</td>
<td colspan="3">
<input style="width:150px; display:inline" type="text" name="icon" value="{$detail.icon}" placeholder="请输入图标,可空" autocomplete="off" class="layui-input">
icon-jichuguanli<a href="{__LAYUI__}/font/extend/demo_index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
<input style="width:150px; display:inline" type="text" name="icon" value="{$detail.icon}" placeholder="请输入图标,可空" autocomplete="off" class="layui-input">
<i class="bi {$detail.icon}"></i><a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
</td>
</tr>
</table>
@ -108,34 +124,27 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form,
layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
if(!data.field.menu || data.field.menu == ''){
if (!data.field.menu || data.field.menu == '') {
layer.msg('请选择是否在左侧菜单显示');
return false;
}
$.ajax({
url: "/admin/rule/add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
window.setTimeout(function(){
parent.location.reload();
},1200);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
})
}
tool.post("/admin/rule/add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table" style="margin-bottom:0;">
<div class="layui-form-bar">
<div class="p-3">
<div class="gg-form-bar border-t border-x">
<button class="layui-btn layui-btn-normal layui-btn-sm add-menu">+ 添加菜单/节点</button>
</div>
<div>
@ -15,14 +15,12 @@
<!-- 脚本 -->
{block name="script"}
<script>
var ptable = null, treeGrid = null,rightpage=null, layer = null, tableId = "treeTable";
function init(layui) {
treeGrid = layui.treeGrid;
rightpage = layui.rightpage;
layer = layui.layer;
ptable = treeGrid.render({
id: tableId
, elem: '#' + tableId
const moduleInit = ['tool', 'treeGrid'];
function gouguInit() {
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
layui.pageTable = treeGrid.render({
id: 'treeTable'
, elem: '#treeTable'
, idField: 'id'
, url: "/admin/rule/index"
, cellMinWidth: 80
@ -30,21 +28,23 @@
, treeUpId: 'pid'//树形父id字段名称
, treeShowName: 'title'//以树形式显示的字段
, cols: [[
{ field: 'id', width: 80, title: 'ID号', align: 'center'}
, { field: 'sort', width: 80, title: '排序',align: 'center'}
, { field: 'title', width: 160, title: '菜单/节点名称'}
{ field: 'id', width: 80, title: 'ID号', align: 'center' }
, { field: 'sort', width: 60, title: '排序', align: 'center' }
, { field: 'title', width: 160, title: '菜单/节点名称' }
, { field: 'pid', title: '父ID', width: 80, align: 'center' }
, { field: 'src', title: 'URL链接'}
, { field: 'menu', width: 100, title: '是否是菜单',align: 'center', templet: function (d) {
, { field: 'src', title: 'URL链接' }
, {
field: 'menu', width: 100, title: '是否是菜单', align: 'center', templet: function (d) {
var html = '<span style="color:#fbbc05"></span>';
if(d.menu=='1'){
if (d.menu == '1') {
html = '<span style="color:#12bb37"></span>';
}
return html;
}
}
, {field: 'name', width: 110, title: '操作日志名称',align: 'center'}
, {width: 188, title: '操作', align: 'center'
, { field: 'name', width: 110, title: '操作日志名称', align: 'center' }
, {
width: 188, title: '操作', align: 'center'
, templet: function (d) {
var html = '<span class="layui-btn-group"><button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="add">添加子菜单/节点</button><button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
return html;
@ -54,41 +54,36 @@
, page: false
});
//表头工具栏事件
$('.add-menu').on('click',function(){
rightpage.open("/admin/rule/add",'900px');
$('.add-menu').on('click', function () {
tool.side("/admin/rule/add");
return;
});
//操作按钮
treeGrid.on('tool(' + tableId + ')', function (obj) {
treeGrid.on('tool(treeTable)', function (obj) {
console.log(obj);
if (obj.event === 'add') {
rightpage.open('/admin/rule/add?pid='+obj.data.id,'900px');
tool.side('/admin/rule/add?pid=' + obj.data.id);
return;
}
if (obj.event === 'edit') {
rightpage.open('/admin/rule/add?id='+obj.data.id,'900px');
tool.side('/admin/rule/add?id=' + obj.data.id);
return;
}
if (obj.event === 'del') {
layer.confirm('确定要删除吗?', { icon: 3, title: '提示' }, function (index) {
$.ajax({
url: "/admin/rule/delete",
type: 'post',
data: { id: obj.data.id },
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/rule/delete", { id: obj.data.id }, callback);
layer.close(index);
});
}
});
}
</script>
{include file="common/layui" base="base" extend="['treeGrid','rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,14 +1,14 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="关键字名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="search" lay-filter="search"></table>
</div>
{/block}
@ -17,12 +17,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var table = layui.table,
form = layui.form;
var tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#search',
title: '关键字搜索列表',
toolbar: '#toolbarDemo',
url: '/admin/search/index',
@ -57,7 +56,7 @@
//监听搜索提交
form.on('submit(webform)', function (data) {
tableIns.reload({
layui.pageTable.reload({
where: {
keywords: data.field.keywords
},
@ -68,33 +67,25 @@
return false;
});
//删除
table.on('tool(test)', function (obj) {
table.on('tool(search)', function (obj) {
if (obj.event === 'del') {
layer.confirm('确定要删除吗?', {
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/search/delete",
type: 'post',
data: {
id: obj.data.id
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/search/delete", { id: obj.data.id }, callback);
layer.close(index);
});
}
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">网站地图分类</h3>
<form class="layui-form p-4">
<h3 class="pb-3">网站地图分类</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">分类名称<font>*</font></td>
@ -16,7 +16,7 @@
</td>
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
@ -27,30 +27,24 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form,
layer = layui.layer;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/sitemap/add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
}
})
}
tool.post("/admin/sitemap/add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,14 +1,14 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="ID/分类名" class="layui-input" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="sitemap" lay-filter="sitemap"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
@ -27,14 +27,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#sitemap',
title: '网站地图分类列表',
toolbar: '#toolbarDemo',
url: '/admin/sitemap/index', //数据接口
@ -67,17 +64,17 @@
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
table.on('toolbar(sitemap)', function (obj) {
if (obj.event === 'add') {
rightpage.open("/admin/sitemap/add","900px");
tool.side("/admin/sitemap/add", "900px");
return;
}
});
//监听行工具事件
table.on('tool(test)', function (obj) {
table.on('tool(sitemap)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
rightpage.open('/admin/sitemap/add?id='+obj.data.id,"900px");
tool.side('/admin/sitemap/add?id=' + obj.data.id, "900px");
return;
}
if (obj.event === 'del') {
@ -85,18 +82,13 @@
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/sitemap/delete",
data: {
id: data.id
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/sitemap/delete", { id: data.id }, callback);
layer.close(index);
});
}
@ -104,7 +96,7 @@
//监听搜索提交
form.on('submit(webform)', function (data) {
tableIns.reload({
layui.pageTable.reload({
where: {
keywords: data.field.keywords
},
@ -116,6 +108,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,10 +1,9 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table" style="margin-bottom:0;">
<table class="layui-hide" id="test" lay-filter="test"></table>
<div class="p-3">
<table class="layui-hide" id="sitemap_cate" lay-filter="sitemap_cate"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
@ -23,14 +22,12 @@
<!-- 脚本 -->
{block name="script"}
<script>
var sitemap_cate_id = '{$sitemap_cate_id}',tableIns = null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
tableIns = table.render({
elem: '#test',
var sitemap_cate_id = '{$sitemap_cate_id}';
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool;
layui.pageTable = table.render({
elem: '#sitemap_cate',
title: '网站地图列表',
toolbar: '#toolbarDemo',
url: '/admin/sitemap/sitemap_info', //数据接口
@ -72,21 +69,21 @@
});
//表头工具栏事件
$('.add-menu').on('click',function(){
rightpage.open("/admin/sitemap/sitemap_info_add?cid="+sitemap_cate_id,'900px');
$('body').on('click','.add-menu',function(){
tool.side("/admin/sitemap/sitemap_info_add?cid="+sitemap_cate_id);
return;
});
//监听返回
$('.add-back').on('click',function () {
$('body').on('click','.add-back',function () {
history.back(-1);
return false;
});
//监听行工具事件
table.on('tool(test)', function (obj) {
table.on('tool(sitemap_cate)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
rightpage.open('/admin/sitemap/sitemap_info_add?id='+obj.data.id,'900px');
tool.side('/admin/sitemap/sitemap_info_add?id='+obj.data.id);
return;
}
if (obj.event === 'del') {
@ -94,24 +91,18 @@
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/sitemap/sitemap_info_delete",
data: {
id: data.id
},
success: function (res) {
layer.msg(res.msg);
if (res.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/sitemap/sitemap_info_delete", { id: data.id }, callback);
layer.close(index);
});
}
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">网站地图内容</h3>
<form class="layui-form p-4">
<h3 class="pb-3">网站地图内容</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">标题<font>*</font></td>
@ -24,20 +24,20 @@
</td>
</tr>
<tr>
<td class="layui-td-gray">PC端图片</td>
<td class="layui-td-gray-2">PC端图片</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="test1">上传PC端图片</button>
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn">上传PC端图片</button>
<div class="layui-upload-list" id="demo1" style="width:200px; height:120px; overflow:hidden">
<img {notempty name="$sitemap.pc_img" }src="{:get_file($sitemap.pc_img)}" {/notempty} heght="120px;" style="max-width: 100%;" />
<input type="hidden" name="pc_img" {notempty name="$sitemap.pc_img" }value="{$sitemap.pc_img}" {/notempty}>
</div>
</div>
</td>
<td class="layui-td-gray">移动端图片</td>
<td class="layui-td-gray-2">移动端图片</td>
<td>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="test2">上传移动端图片</button>
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn2">上传移动端图片</button>
<div class="layui-upload-list" id="demo2" style="width:200px; height:120px; overflow:hidden">
<img {notempty name="$sitemap.mobile_img" }src="{:get_file($sitemap.mobile_img)}" {/notempty} heght="120px;" style="max-width: 100%;" />
<input type="hidden" name="mobile_img" {notempty name="$sitemap.mobile_img" }value="{$sitemap.mobile_img}" {/notempty}>
@ -47,7 +47,7 @@
</tr>
</table>
<div style="padding: 10px 0">
<div class="py-3">
{notempty name="$sitemap.sitemap_cate_id" }
<input type="hidden" name="sitemap_cate_id" value="{$sitemap.sitemap_cate_id}" />
{else/}
@ -63,14 +63,12 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form,
layer = layui.layer,
upload = layui.upload;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool,upload = layui.upload;
//pc端图片
var uploadInst = upload.render({
elem: '#test1',
elem: '#uploadBtn',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
@ -84,7 +82,7 @@
});
//移动端图片
var uploadInst2 = upload.render({
elem: '#test2',
elem: '#uploadBtn2',
url: '/admin/api/upload',
done: function (res) {
//如果上传失败
@ -99,24 +97,19 @@
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/sitemap/sitemap_info_add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
}
})
}
tool.post("/admin/sitemap/sitemap_info_add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">轮播组</h3>
<form class="layui-form p-4">
<h3 class="pb-3">轮播组</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">标题<font>*</font></td>
@ -44,32 +44,24 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
, layer = layui.layer
, upload = layui.upload;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/slide/add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function(){
parent.layui.tool.close();
},1000);
}
})
}
tool.post("/admin/slide/add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,14 +1,14 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="ID/标题/标识/备注" class="layui-input"/>
<input type="text" name="keywords" placeholder="ID/标题/标识/备注" class="layui-input" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="slide" lay-filter="slide"></table>
</div>
<script type="text/html" id="status">
@ -28,14 +28,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
var tableIns = null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
tableIns = table.render({
elem: '#test',
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#slide',
title: '轮播组列表',
toolbar: '#toolbarDemo',
url: '/admin/slide/index', //数据接口
@ -78,17 +75,17 @@
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
table.on('toolbar(slide)', function (obj) {
if (obj.event === 'add') {
rightpage.open("/admin/slide/add","900px");
tool.side("/admin/slide/add");
return;
}
});
//监听行工具事件
table.on('tool(test)', function (obj) {
table.on('tool(slide)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
rightpage.open('/admin/slide/add?id='+obj.data.id,"900px");
tool.side('/admin/slide/add?id=' + obj.data.id);
return;
}
if (obj.event === 'del') {
@ -96,18 +93,13 @@
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/slide/delete",
data: {
id: data.id
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/slide/delete", { id: data.id }, callback);
layer.close(index);
});
}
@ -115,7 +107,7 @@
//监听搜索提交
form.on('submit(webform)', function (data) {
tableIns.reload({
layui.pageTable.reload({
where: {
keywords: data.field.keywords
},
@ -127,6 +119,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table" style="margin-bottom:0;">
<table class="layui-hide" id="test" lay-filter="test"></table>
<div class="p-3">
<table class="layui-hide" id="slide_info" lay-filter="slide_info"></table>
</div>
<script type="text/html" id="status">
@ -23,15 +23,12 @@
<!-- 脚本 -->
{block name="script"}
<script>
var slide_id = '{$slide_id}',tableIns = null;
function init(layui) {
var table = layui.table,
rightpage = layui.rightpage,
form = layui.form;
tableIns = table.render({
elem: '#test',
var slide_id = '{$slide_id}';
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, tool = layui.tool;
layui.pageTable = table.render({
elem: '#slide_info',
title: '轮播列表',
toolbar: '#toolbarDemo',
url: '/admin/slide/slide_info', //数据接口
@ -60,8 +57,8 @@
title: '图片',
width: 136,
align: 'center',
templet:function(d){
var html='<img src="'+d.filepath+'" style="max-width: 100px;" />';
templet: function (d) {
var html = '<img src="' + d.filepath + '" style="max-width: 100px;" />';
return html;
}
}, {
@ -85,46 +82,40 @@
});
//表头工具栏事件
$('.add-menu').on('click',function(){
rightpage.open("/admin/slide/slide_info_add?sid="+slide_id,'900px');
$('body').on('click', '.add-menu', function () {
tool.side("/admin/slide/slide_info_add?sid=" + slide_id);
return;
});
//监听返回
$('.add-back').on('click',function () {
$('body').on('click', '.add-back', function () {
history.back(-1);
return false;
});
//监听行工具事件
table.on('tool(test)', function (obj) {
table.on('tool(slide_info)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
rightpage.open('/admin/slide/slide_info_add?id='+obj.data.id,'900px');
tool.side('/admin/slide/slide_info_add?id=' + obj.data.id);
return;
}
if (obj.event === 'del') {
layer.confirm('确定删除该轮播数据吗?', {
icon: 3,
title: '提示'
}, function(index) {
$.ajax({
url: "/admin/slide/slide_info_delete",
data: {
id: data.id
},
success: function(res) {
layer.msg(res.msg);
if (res.code == 0) {
obj.del();
}
}, function (index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
})
}
tool.delete("/admin/slide/slide_info_delete", { id: data.id }, callback);
layer.close(index);
});
}
});
}
</script>
{include file="common/layui" base="base" extend="['rightpage']" callback="init" /}
{/block}
<!-- /脚本 -->
<!-- /脚本 -->

View File

@ -1,24 +1,27 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form page-content">
<h3 class="h3-title">幻灯片</h3>
<form class="layui-form p-4">
<h3 class="pb-3">幻灯片</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">标题<font>*</font></td>
<td class="layui-td-gray">标题<font>*</font>
</td>
<td colspan="3">
<input type="hidden" name="id" value="{$id}" />
<input type="text" name="title" lay-verify="required" lay-reqText="请输入标题" autocomplete="off" placeholder="请输入标题" class="layui-input"
{notempty name="$slide_info.title" }value="{$slide_info.title}" {/notempty}>
<input type="text" name="title" lay-verify="required" lay-reqText="请输入标题" autocomplete="off" placeholder="请输入标题"
class="layui-input" {notempty name="$slide_info.title" }value="{$slide_info.title}" {/notempty}>
</td>
<td class="layui-td-gray" rowspan="3">图片<font>*</font>
</td>
<td class="layui-td-gray" rowspan="3">图片<font>*</font></td>
<td rowspan="3" style="vertical-align:top">
<div class="layui-upload" style="text-align:center;">
<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="test1">选择要上传的图片</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="uploadBtn">选择要上传的图片</button>
<div class="layui-upload-list" id="demo1" style="width: 100%;height:100px; overflow:hidden;">
<img {notempty name="$slide_info.img" }src="{:get_file($slide_info.img)}" {/notempty}
style="max-width: 120px;" />
<input type="hidden" lay-verify="required" lay-reqText="请选择要上传的图片" name="img" {notempty name="$slide_info.img" }value="{$slide_info.img}" {/notempty}>
<input type="hidden" lay-verify="required" lay-reqText="请选择要上传的图片" name="img" {notempty
name="$slide_info.img" }value="{$slide_info.img}" {/notempty}>
</div>
</div>
</td>
@ -31,7 +34,8 @@
</td>
</tr>
<tr>
<td class="layui-td-gray">状态<font>*</font></td>
<td class="layui-td-gray">状态<font>*</font>
</td>
<td>
{if condition="$id eq 0"}
<input type="radio" name="status" value="1" title="正常" checked>
@ -41,14 +45,15 @@
<input type="radio" name="status" value="-1" title="禁用" {eq name="$slide_info.status" value="-1" }checked{/eq}>
{/if}
</td>
<td class="layui-td-gray">排序</td>
<td class="layui-td-gray">排序</td>
<td><input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" {notempty
name="$slide_info.sort" }value="{$slide_info.sort}" {/notempty}></td>
</tr>
<tr>
<td class="layui-td-gray">备注</td>
<td colspan="5">
<textarea name="desc" placeholder="请输入备注" class="layui-textarea">{notempty name="$slide_info.desc" }{$slide_info.desc}{/notempty}</textarea>
<textarea name="desc" placeholder="请输入备注"
class="layui-textarea">{notempty name="$slide_info.desc" }{$slide_info.desc}{/notempty}</textarea>
</td>
</tr>
</table>
@ -65,14 +70,12 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
, layer = layui.layer
, upload = layui.upload;
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form, tool = layui.tool, upload = layui.upload;
//头像上传
var uploadInst = upload.render({
elem: '#test1'
elem: '#uploadBtn'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
@ -87,25 +90,20 @@
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/slide/slide_info_add",
type: 'post',
data: data.field,
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.tableIns.reload();
setTimeout(function(){
parent.layui.rightpage.close();
},1000);
}
}
})
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
}
}
tool.post("/admin/slide/slide_info_add", data.field, callback);
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-table">
<h3 style="font-weight:600; padding:10px">编辑用户信息</h3>
<form class="layui-form p-4">
<h3 class="pb-3">编辑用户信息</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">用户等级 <span style="color: red">*</span></td>
@ -67,10 +67,9 @@
</tr>
</table>
<div style="padding: 10px">
<div class="py-3">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">返回</button>
</div>
</form>
{/block}
@ -79,54 +78,24 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
, layer = layui.layer
, upload = layui.upload;
//头像上传
var uploadInst = upload.render({
elem: '#test1'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 1) {
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value', res.data.filepath);
$('#demo1 img').attr('src', res.data.filepath);
}
});
const moduleInit = ['tool'];
function gouguInit() {
var tool = layui.tool, form = layui.form;
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/user/edit",
type: 'post',
data: data.field,
success: function (e) {
if (e.code == 0) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
window.location.href="/admin/user/index.html";
layer.close(index);
});
} else {
layer.msg(e.msg);
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
parent.layui.pageTable.reload();
setTimeout(function () {
parent.layui.tool.close();
}, 1000);
}
})
}
tool.post("/admin/user/edit", data.field, callback);
return false;
});
//监听返回
$('.body-table').on('click', '[lay-event="back"]', function () {
window.location.href="/admin/user/index.html";
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,10 +1,10 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="昵称/真实姓名/手机号" class="layui-input" autocomplete="off"/>
<input type="text" name="keywords" placeholder="昵称/真实姓名/手机号" class="layui-input" autocomplete="off" />
</div>
<div class="layui-input-inline" style="width:120px;">
<input type="text" class="layui-input" id="start_time" readonly placeholder="注册开始时间" name="start_time">
@ -15,28 +15,20 @@
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="user" lay-filter="user"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group"><span class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">详情</span><a class="layui-btn layui-btn-xs" href="/admin/user/edit?id={{d.id}}">编辑</a>
{{# if(d.status == 1){ }}<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">禁用</a>{{# } else { }}<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</a>{{# } }}</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var TAB = parent.layui.tab,
table = layui.table,
form = layui.form,
laydate = layui.laydate;
const moduleInit = ['tool'];
function gouguInit() {
var tool = layui.tool, table = layui.table, laydate = layui.laydate, form = layui.form;
laydate.render({
elem: '#start_time',
type: 'date'
@ -47,9 +39,8 @@
type: 'date'
});
var tableIns = table.render({
elem: '#test',
layui.pageTable = table.render({
elem: '#user',
title: '用户列表',
toolbar: '#toolbarDemo',
url: '/admin/user/index', //数据接口
@ -67,7 +58,7 @@
title: '头像',
align: 'center',
width: 60,
templet: function(d) {
templet: function (d) {
var html = '';
var delBtn = '<img src="' + d.headimgurl + '" width="28" height="28"/>';
return delBtn;
@ -87,7 +78,7 @@
title: '性别',
align: 'center',
width: 60,
templet: function(d) {
templet: function (d) {
var html = '-';
if (d.sex == 1) {
html = '男'
@ -101,7 +92,7 @@
title: '昵称',
align: 'center',
width: 100
},{
}, {
field: 'name',
title: '真实姓名',
align: 'center',
@ -116,7 +107,7 @@
title: '电子邮箱',
align: 'center',
minWidth: 150
},{
}, {
field: 'register_time',
title: '注册时间',
align: 'center',
@ -127,22 +118,36 @@
toolbar: '#status',
align: 'center',
width: 60
},{
}, {
field: 'right',
fixed: 'right',
title: '操作',
align: 'center',
toolbar: '#barDemo',
width: 130
width: 136,
templet:function(d){
let btn1 = '<span class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">详情</span><span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span>';
let btn2 = '<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">禁用</span>';
let btn3 = '<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="open">启用</span>';
if(d.status == 1){
return '<div class="layui-btn-group">'+btn1+btn2+'</div>';
}else{
return '<div class="layui-btn-group">'+btn1+btn3+'</div>';
}
}
}
]
]
});
//监听行工具事件
table.on('tool(test)', function (obj) {
//监听行工具事件
table.on('tool(user)', function (obj) {
var data = obj.data;
if (obj.event === 'view') {
TAB.sonAdd('/admin/user/view?id='+data.id,'用户详情');
tool.side('/admin/user/view?id=' + data.id);
return;
}
else if (obj.event === 'edit') {
tool.side('/admin/user/edit?id=' + data.id);
return;
}
else if (obj.event === 'del') {
@ -150,46 +155,36 @@
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/user/delete",
data: {
id: data.id,
status:0
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
location.reload();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
layui.pageTable.reload()
}
})
}
tool.post("/admin/user/disable", { id: data.id, status: 0 }, callback);
layer.close(index);
});
}else if (obj.event === 'open') {
} else if (obj.event === 'open') {
layer.confirm('您确定要启用该用户', {
icon: 3,
title: '提示'
}, function (index) {
$.ajax({
url: "/admin/user/delete",
data: {
id: data.id,
status:1
},
success: function (e) {
layer.msg(e.msg);
if (e.code == 0) {
location.reload();
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layer.close(index);
layui.pageTable.reload()
}
})
}
tool.post("/admin/user/disable", { id: data.id, status: 1 }, callback);
layer.close(index);
});
}
});
});
//监听搜索提交
form.on('submit(webform)', function(data) {
tableIns.reload({
form.on('submit(webform)', function (data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
attach: data.field.attach,
@ -204,6 +199,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="body-table">
<form class="layui-form layui-form-bar">
<div class="p-3">
<form class="layui-form gg-form-bar">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="昵称/操作数据id/操作描述" class="layui-input" autocomplete="off" />
</div>
@ -16,7 +16,7 @@
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<table class="layui-hide" id="log" lay-filter="log"></table>
</div>
{/block}
<!-- /主体 -->
@ -24,12 +24,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var table = layui.table,
form = layui.form;
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table, form = layui.form;
var tableIns = table.render({
elem: '#test',
elem: '#log',
title: '用户操作日志列表',
toolbar: '#toolbarDemo',
url: '/admin/user/log', //数据接口
@ -46,11 +45,11 @@
field: 'title',
title: '操作类型',
align: 'center',
width: 90
width: 80
}, {
field: 'content',
title: '操作描述',
width: 360
width: 300
},{
field: 'param_id',
title: '操作数据ID',
@ -63,12 +62,12 @@
field: 'nickname',
title: '昵称',
align: 'center',
width: 120
width: 90
}, {
field: 'ip',
title: 'IP地址',
align: 'center',
width: 150
width: 130
}, {
field: 'create_time',
title: '操作时间',
@ -94,6 +93,5 @@
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->

View File

@ -1,25 +1,46 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.table-title{font-size: 20px; padding-bottom: 12px;}
.latest-news{padding-top: 12px; padding-bottom:30px; padding-left: 20px; position: relative;}
.latest-news .layui-timeline-title{padding-bottom:0; font-size: 14px;}
.latest-news .layui-timeline-item{padding-bottom:5px;}
.layui-timeline-title span{color:#999}
.panel-more{width: 100%; height:48px; line-height: 48px; text-align: center; position: absolute; bottom: 0; left:0;}
.panel-more a{color:#0088FF}
.layui-card-body .layui-timeline-title {
padding-bottom: 0;
font-size: 14px;
}
.layui-card-body .layui-timeline-item {
padding-bottom: 5px;
}
.layui-timeline-title span {
color: #999
}
.panel-more {
width: 100%;
height: 48px;
line-height: 48px;
text-align: center;
position: absolute;
bottom: 0;
left: 0;
}
.panel-more a {
color: #0088FF
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="body-content" style="padding: 20px;">
<div class="table-title">用户操作记录</div>
<div class="latest-news">
<ul class="layui-timeline" id="logs">
</ul>
<div class="panel-more"><a href="javascript:getLogs();">查看更多动态</a></div>
<div class="p-3">
<div class="layui-card">
<div class="layui-card-header"><h3>用户操作记录</h3></div>
<div class="layui-card-body">
<ul class="layui-timeline" id="logs"></ul>
<div class="panel-more"><a href="javascript:;">查看更多操作记录</a></div>
</div>
</div>
</div>
</div>
{/block}
<!-- /主体 -->
@ -28,35 +49,40 @@
<script>
var page=1,limit=20;
function getLogs() {
$.ajax({
url: "/admin/user/record",
type: 'post',
data: {
page:page,
limit: limit
},
success: function(e) {
if (e.code == 0) {
var html = '';
if(e.data.length>0){
page++;
$.each(e.data, function(key, value) {
html += '<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis"></i>\
<div class="layui-timeline-content layui-text">\
<div class="layui-timeline-title"><span title="'+value.id+'">'+value.times+'</span>'+value.content+'</div>\
</div>\
</li>';
});
$('#logs').append(html);
}else{
$('.panel-more').remove();
}
$.ajax({
url: "/admin/user/record",
type: 'get',
data: {
page:page,
limit: limit
},
success: function(e) {
if (e.code == 0) {
var html = '';
if(e.data.length>0){
page++;
$.each(e.data, function(key, value) {
html += '<li class="layui-timeline-item">\
<i class="layui-icon layui-timeline-axis"></i>\
<div class="layui-timeline-content layui-text">\
<div class="layui-timeline-title"><span title="'+value.id+'">'+value.times+'</span>'+value.content+'</div>\
</div>\
</li>';
});
$('#logs').append(html);
}else{
$('.panel-more').remove();
}
}
})
}
})
}
function gouguInit() {
getLogs();
$('.panel-more').on('click',function(){
getLogs();
})
}
getLogs();
</script>
{/block}
<!-- /脚本 -->

View File

@ -1,8 +1,8 @@
{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="layui-form body-table">
<h3 style="font-weight:600; padding:10px">用户信息</h3>
<div class="layui-form p-4">
<h3 class="pb-3">用户信息</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">登录账号</td>
@ -94,40 +94,20 @@
</td>
</tr>
<tr>
<td class="layui-td-gray">最后登录IP</td>
<td class="layui-td-gray-2">最后登录IP</td>
<td>
{$user.last_login_ip}
</td>
<td class="layui-td-gray2">最后登录时间</td>
<td class="layui-td-gray-2">最后登录时间</td>
<td>
{$user.last_login_time | date='Y-m-d H:i:s'}
</td>
<td class="layui-td-gray2">累计登录次数</td>
<td class="layui-td-gray">累计登录</td>
<td>
{$user.login_num}
{$user.login_num}
</td>
</tr>
</table>
<div style="padding: 10px">
<button lay-event="back" class="layui-btn layui-btn-primary">关闭</button>
</div>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var TAB = parent.layui.tab;
//监听返回
$('.body-table').on('click', '[lay-event="back"]', function () {
TAB.sonDelete();
return false;
});
}
</script>
{include file="common/layui" base="base" extend="[]" callback="init" /}
{/block}
<!-- /脚本 -->
<!-- /主体 -->

View File

@ -111,6 +111,16 @@ function is_installed()
return $isInstalled;
}
//判断cms是否存在模板
function isTemplate($url='')
{
static $isTemplate;
if (empty($isTemplate)) {
$isTemplate = file_exists(CMS_ROOT . 'app/'.$url);
}
return $isTemplate;
}
/**
* 返回json数据用于接口
* @param integer $code
@ -263,15 +273,31 @@ function get_file($id)
return $url;
} elseif ($geturl['status'] == 0) {
//待审核
return '/static/admin/images/none_pic.jpg';
return '/static/admin/images/nonepic360x360.jpg';
} else {
//不通过
return '/static/admin/images/none_pic.jpg';
return '/static/admin/images/nonepic360x360.jpg';
}
}
return false;
}
function get_file_list($dir)
{
$list=[];
if(is_dir($dir)){
$info = opendir($dir);
while (($file = readdir($info)) !== false) {
//echo $file.'<br>';
$pathinfo=pathinfo($file);
if($pathinfo['extension']=='html'){ //只获取符合后缀的文件
array_push($list, $pathinfo);
}
}
closedir($info);
}
return $list;
}
//获取当前登录用户的信息
function get_login_user($key = "")

View File

@ -0,0 +1,28 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\home\BaseController;
use app\admin\model\Article as ArticleModel;
use think\facade\Db;
use think\facade\View;
class Article extends BaseController
{
public function detail()
{
$param = get_params();
$id = isset($param['id']) ? $param['id'] : 0;
$detail = (new ArticleModel())->detail($id);
ArticleModel::where('id', $param['id'])->inc('read')->update();
View::assign('detail', $detail);
return view();
}
}

View File

@ -0,0 +1,28 @@
<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/Apache-2.0
* @link https://www.gougucms.com
*/
declare (strict_types = 1);
namespace app\home\controller;
use app\home\BaseController;
use app\admin\model\Pages as ArticleModel;
use think\facade\Db;
use think\facade\View;
class Pages extends BaseController
{
public function detail()
{
$param = get_params();
$id = isset($param['id']) ? $param['id'] : 0;
$detail = (new ArticleModel())->detail($id);
ArticleModel::where('id', $param['id'])->inc('read')->update();
View::assign('detail', $detail);
return view($detail['template']);
}
}

View File

@ -0,0 +1,83 @@
{extend name="common/base"/}
{block name="style"}
<link rel="stylesheet" href="{__GOUGU__}/gougu/module/prism/prism.css?v=1"/>
<link rel="stylesheet" href="{__JS__}/viewer/viewer.min.css?v=1"/>
<link rel="stylesheet" href="{__CSS__}/detail.css?v=1"/>
{/block}
{block name="title"}
<title>{$detail.title}</title>
{/block}
{block name="keywords"}
<meta name="keywords" content="{$detail.keyword_names}" />
<meta name="description" content="{$detail.desc}" />
{/block}
<!-- 主体 -->
{block name="body"}
{include file="common/header" nav='index' /}
<div class="detail">
<h1 class="detail-title">
{$detail.title}
</h1>
<div class="detial-ops">
<span>发表于:{:date('Y-m-d H:i:s',$detail.create_time)}</span><span>浏览:{$detail.read}次</span><span class="color-tags">TAG{foreach name='$detail.keyword_array' item='vo'}
<a href="#" title="{$vo.title}">#{$vo.title}</a>
{/foreach}</span>
</div>
<div id="Detail" class="detial-content">
{$detail.content|raw}
</div>
</div>
{/block}
<!-- 脚本 -->
{block name="script"}
<script src="{__GOUGU__}/gougu/module/prism/prism.js?v=1"></script>
<script src="{__JS__}/viewer/viewer.min.js?v=1"></script>
<script>
function unhtml(str, reg) {
return str ? str.replace(reg || /[&<">'](?:(amp|lt|quot|gt|#39|nbsp|#\d+);)?/g, function (a, b) {
if (b) {
return a;
} else {
return {
'<':'&lt;',
'&':'&amp;',
'"':'&quot;',
'>':'&gt;',
"'":'&#39;'
}[a]
}
}) : '';
}
var $codepre = $("pre[class]");
if($codepre.length>0){
for(var i = 0;i<$codepre.length;i++){
var item = $codepre.eq(i);
var language = "";
item.attr("class").replace(/brush:([^;]+)/,function(a,b){
language = b;
});
if(language){
var codehtml = item.html();
var code = $("<code>");
code.attr("class","language-"+language+" line-numbers");
//codehtml= unhtml(codehtml);
code.html(codehtml);
item.html(code);
Prism.highlightElement(code[0]);
}
}
}
var $code=$("code[class]");
if($code.length>0){
for(var i = 0;i<$code.length;i++){
var item = $code.eq(i);
item.addClass("line-numbers");
//Prism.highlightElement(item);
}
}
var viewer = new Viewer(document.getElementById('Detail'));
</script>
{/block}
<!-- /脚本 -->

View File

@ -36,14 +36,11 @@
left: 0;
z-index: 999;
overflow: hidden;
background: url({__ADMIN_IMG__}/bg.jpg);
background-size: cover;
background: url("{__ADMIN_IMG__}/bg_pattern.png"),
background: url("{__ADMIN__}/images/bg_pattern.png"),
-webkit-linear-gradient(to left, #34a853, #4285f4);
/* Chrome 10-25, Safari 5.1-6 */
background: url("{__ADMIN_IMG__}/bg_pattern.png"),
background: url("{__ADMIN__}/images/bg_pattern.png"),
linear-gradient(to left, #34a853, #4285f4);
/* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
.login {
@ -218,7 +215,7 @@
rel="nofollow" style="margin-left: 15px;color:#d3e8fa;">{:get_system_config('web','icp')}</a>Powered by GouguCMS
</div>
</div>
<script language="javascript" src="{__STATIC__}/jquery.min.js"></script>
<script language="javascript" src="{__JS__}/jquery.min.js"></script>
<script language="javascript" src="{__JS__}/layer/layer.js"></script>
<script type="text/javascript">
$('#loginSubmit').on('click', function () {

View File

@ -36,14 +36,11 @@
left: 0;
z-index: 999;
overflow: hidden;
background: url({__ADMIN_IMG__}/bg.jpg);
background-size: cover;
background: url("{__ADMIN_IMG__}/bg_pattern.png"),
background: url("{__ADMIN__}/images/bg_pattern.png"),
-webkit-linear-gradient(to left, #34a853, #4285f4);
/* Chrome 10-25, Safari 5.1-6 */
background: url("{__ADMIN_IMG__}/bg_pattern.png"),
background: url("{__ADMIN__}/images/bg_pattern.png"),
linear-gradient(to left, #34a853, #4285f4);
/* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
.login {
@ -153,7 +150,7 @@
}
.footer-operation{
padding:12px 0;
line-height: 2.4;
line-height: 2.7;
font-size: 14px;
}
.footer-operation a{
@ -221,7 +218,7 @@
rel="nofollow" style="margin-left: 15px;color:#d3e8fa;">{:get_system_config('web','icp')}</a>Powered by GouguCMS
</div>
</div>
<script language="javascript" src="{__STATIC__}/jquery.min.js"></script>
<script language="javascript" src="{__JS__}/jquery.min.js"></script>
<script language="javascript" src="{__JS__}/layer/layer.js"></script>
<script type="text/javascript">
$('#loginSubmit').on('click', function () {

View File

@ -0,0 +1,83 @@
{extend name="common/base"/}
{block name="style"}
<link rel="stylesheet" href="{__GOUGU__}/gougu/module/prism/prism.css?v=1"/>
<link rel="stylesheet" href="{__JS__}/viewer/viewer.min.css?v=1"/>
<link rel="stylesheet" href="{__CSS__}/detail.css?v=1"/>
{/block}
{block name="title"}
<title>{$detail.title}</title>
{/block}
{block name="keywords"}
<meta name="keywords" content="{$detail.keyword_names}" />
<meta name="description" content="{$detail.desc}" />
{/block}
<!-- 主体 -->
{block name="body"}
{include file="common/header" nav='index' /}
<div class="detail">
<h1 class="detail-title">
{$detail.title}
</h1>
<div class="detial-ops">
<span>发表于:{:date('Y-m-d H:i:s',$detail.create_time)}</span><span>浏览:{$detail.read}次</span><span class="color-tags">TAG{foreach name='$detail.keyword_array' item='vo'}
<a href="#" title="{$vo.title}">#{$vo.title}</a>
{/foreach}</span>
</div>
<div id="Detail" class="detial-content">
{$detail.content|raw}
</div>
</div>
{/block}
<!-- 脚本 -->
{block name="script"}
<script src="{__GOUGU__}/gougu/module/prism/prism.js?v=1"></script>
<script src="{__JS__}/viewer/viewer.min.js?v=1"></script>
<script>
function unhtml(str, reg) {
return str ? str.replace(reg || /[&<">'](?:(amp|lt|quot|gt|#39|nbsp|#\d+);)?/g, function (a, b) {
if (b) {
return a;
} else {
return {
'<':'&lt;',
'&':'&amp;',
'"':'&quot;',
'>':'&gt;',
"'":'&#39;'
}[a]
}
}) : '';
}
var $codepre = $("pre[class]");
if($codepre.length>0){
for(var i = 0;i<$codepre.length;i++){
var item = $codepre.eq(i);
var language = "";
item.attr("class").replace(/brush:([^;]+)/,function(a,b){
language = b;
});
if(language){
var codehtml = item.html();
var code = $("<code>");
code.attr("class","language-"+language+" line-numbers");
//codehtml= unhtml(codehtml);
code.html(codehtml);
item.html(code);
Prism.highlightElement(code[0]);
}
}
}
var $code=$("code[class]");
if($code.length>0){
for(var i = 0;i<$code.length;i++){
var item = $code.eq(i);
item.addClass("line-numbers");
//Prism.highlightElement(item);
}
}
var viewer = new Viewer(document.getElementById('Detail'));
</script>
{/block}
<!-- /脚本 -->

View File

@ -19,6 +19,7 @@ CREATE TABLE `cms_admin` (
`nickname` varchar(255) DEFAULT '',
`thumb` varchar(255) DEFAULT NULL,
`mobile` bigint(11) DEFAULT '0',
`email` varchar(255) DEFAULT '',
`desc` text COMMENT '备注',
`create_time` int(11) NOT NULL DEFAULT '0',
`update_time` int(11) NOT NULL DEFAULT '0',
@ -49,8 +50,8 @@ CREATE TABLE `cms_admin_group` (
-- ----------------------------
-- Records of cms_admin_group
-- ----------------------------
INSERT INTO `cms_admin_group` VALUES ('1', '超级管理员', '1', '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80', '超级管理员,系统自动分配所有可操作权限及菜单。', '0', '0');
INSERT INTO `cms_admin_group` VALUES (2, '测试角色', 1, '1,7,11,14,17,20,22,24,25,29,2,33,36,39,42,45,48,51,54,57,3,59,62,64,66,67,4,68,71,5,74,76,77,6,80', '测试角色', 0, 0);
INSERT INTO `cms_admin_group` VALUES ('1', '超级管理员', '1', '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,81,83', '超级管理员,系统自动分配所有可操作权限及菜单。', 0, 0);
INSERT INTO `cms_admin_group` VALUES (2, '测试角色', 1, '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,81,83', '测试角色', 0, 0);
-- ----------------------------
-- Table structure for `cms_admin_group_access`
-- ----------------------------
@ -68,28 +69,6 @@ CREATE TABLE `cms_admin_group_access` (
-- ----------------------------
INSERT INTO `cms_admin_group_access` VALUES ('1', '1', '0', '0');
-- ----------------------------
-- Table structure for cms_admin_module
-- ----------------------------
DROP TABLE IF EXISTS `cms_admin_module`;
CREATE TABLE `cms_admin_module` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '模块名称',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '模块所在目录,小写字母',
`icon` varchar(255) NOT NULL DEFAULT '' COMMENT '图标',
`status` int(1) NOT NULL DEFAULT 1 COMMENT '状态,0禁用,1正常',
`type` int(1) NOT NULL DEFAULT 2 COMMENT '模块类型,2普通模块,1系统模块',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '功能模块表';
-- ----------------------------
-- Records of cms_admin_module
-- ----------------------------
INSERT INTO `cms_admin_module` VALUES (1, '后台模块', 'admin', '', 1, 1, 1639562910, 0);
INSERT INTO `cms_admin_module` VALUES (2, '前台模块', 'home', '', 1, 1, 1639562910, 0);
-- ----------------------------
-- Table structure for cms_admin_rule
-- ----------------------------
@ -112,12 +91,12 @@ CREATE TABLE `cms_admin_rule` (
-- ----------------------------
-- Records of cms_admin_rule
-- ----------------------------
INSERT INTO `cms_admin_rule` VALUES (1, 0, '', '系统管理', '系统管理', 'icon-jichupeizhi', 1, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (2, 0, '', '基础数据', '基础数据', 'icon-hetongshezhi', 1, 2, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (3, 0, '', '平台用户', '平台用户', 'icon-renshishezhi', 1, 3, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (4, 0, '', '资讯中心', '资讯中心', 'icon-kechengziyuanguanli', 1, 4, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (5, 0, '', '商品中心', '商品中心', 'icon-dianshang', 1, 5, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (6, 0, '', '商业智能', '数据统计', 'icon-KPIguanli', 1, 6, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (1, 0, '', '系统管理', '系统管理', 'bi-gear', 1, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (2, 0, '', '基础数据', '基础数据', 'bi-box', 1, 2, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (3, 0, '', '平台用户', '平台用户', 'bi-people', 1, 3, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (4, 0, '', '资讯中心', '资讯中心', 'bi-journal-text', 1, 4, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (5, 0, '', '商品中心', '商品中心', 'bi-cart', 1, 5, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (6, 0, '', '单 页 面', '单页面管理', 'bi-bookmarks', 1, 6, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (7, 1, 'admin/conf/index', '系统配置', '系统配置', '', 1, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (8, 7, 'admin/conf/add', '新建/编辑', '配置项', '', 2, 1, 1, 0, 0);
@ -191,7 +170,7 @@ INSERT INTO `cms_admin_rule` VALUES (61, 59, 'admin/level/disable', '禁用/启
INSERT INTO `cms_admin_rule` VALUES (62, 3, 'admin/user/index', '用户管理','用户', '', 1, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (63, 62, 'admin/user/edit', '编辑','用户信息', '', 2, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (64, 62, 'admin/user/view', '查看','用户信息', '', 2, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (65, 62, 'admin/user/delete', '','用户', '', 2, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (65, 62, 'admin/user/disable', '用/启','用户', '', 2, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (66, 3, 'admin/user/record', '操作记录','用户操作记录', '', 1, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (67, 3, 'admin/user/log', '操作日志','用户操作日志', '', 1, 1, 1, 0, 0);
@ -211,8 +190,33 @@ INSERT INTO `cms_admin_rule` VALUES (77, 5, 'admin/goods/index', '商品列表',
INSERT INTO `cms_admin_rule` VALUES (78, 77, 'admin/goods/add', '新建/编辑','商品', '', 2, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (79, 77, 'admin/goods/delete', '删除','商品', '', 2, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (80, 6, 'admin/analysis/index', '智能分析', '智能分析', '', 1, 0, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (80, 6, 'admin/pages/index', '单页面列表','单页面', '', 1, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (81, 80, 'admin/pages/add', '新建/编辑','单页面', '', 2, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (82, 80, 'admin/pages/delete', '删除','单页面', '', 2, 1, 1, 0, 0);
INSERT INTO `cms_admin_rule` VALUES (83, 6, 'admin/analysis/index', '智能分析', '智能分析', '', 1, 1, 1, 0, 0);
-- ----------------------------
-- Table structure for cms_admin_module
-- ----------------------------
DROP TABLE IF EXISTS `cms_admin_module`;
CREATE TABLE `cms_admin_module` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '模块名称',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '模块所在目录,小写字母',
`icon` varchar(255) NOT NULL DEFAULT '' COMMENT '图标',
`status` int(1) NOT NULL DEFAULT 1 COMMENT '状态,0禁用,1正常',
`type` int(1) NOT NULL DEFAULT 2 COMMENT '模块类型,2普通模块,1系统模块',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '功能模块表';
-- ----------------------------
-- Records of cms_admin_module
-- ----------------------------
INSERT INTO `cms_admin_module` VALUES (1, '后台模块', 'admin', '', 1, 1, 1639562910, 0);
INSERT INTO `cms_admin_module` VALUES (2, '前台模块', 'home', '', 1, 1, 1639562910, 0);
-- ----------------------------
-- Table structure for `cms_admin_log`
@ -257,7 +261,7 @@ CREATE TABLE `cms_config` (
-- ----------------------------
-- Records of cms_config
-- ----------------------------
INSERT INTO `cms_config` VALUES (1, '网站配置', 'web', 'a:13:{s:2:\"id\";s:1:\"1\";s:11:\"admin_title\";s:9:\"勾股cms\";s:5:\"title\";s:9:\"勾股cms\";s:4:\"logo\";s:39:\"/static/admin/images/nonepic360x360.jpg\";s:4:\"file\";s:0:\"\";s:6:\"domain\";s:24:\"https://www.gougucms.com\";s:3:\"icp\";s:23:\"粤ICP备1xxxxxx11号-1\";s:8:\"keywords\";s:9:\"勾股cms\";s:5:\"beian\";s:29:\"粤公网安备1xxxxxx11号-1\";s:4:\"desc\";s:258:\"勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能快速建站的内容管理系统。后台管理模块一目了然操作简单通用型后台权限管理框架紧随潮流、极低门槛、开箱即用。 \";s:4:\"code\";s:0:\"\";s:9:\"copyright\";s:39:\"© 2022 gougucms.com Apache-2.0 license\";s:7:\"version\";s:6:\"2.0.18\";}', 1, 1612514630, 1645057819);
INSERT INTO `cms_config` VALUES (1, '网站配置', 'web', 'a:13:{s:2:\"id\";s:1:\"1\";s:11:\"admin_title\";s:9:\"勾股CMS\";s:5:\"title\";s:9:\"勾股cms\";s:4:\"logo\";s:39:\"/static/admin/images/nonepic360x360.jpg\";s:4:\"file\";s:0:\"\";s:6:\"domain\";s:24:\"https://www.gougucms.com\";s:3:\"icp\";s:23:\"粤ICP备1xxxxxx11号-1\";s:8:\"keywords\";s:9:\"勾股cms\";s:5:\"beian\";s:29:\"粤公网安备1xxxxxx11号-1\";s:4:\"desc\";s:258:\"勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能快速建站的内容管理系统。后台管理模块一目了然操作简单通用型后台权限管理框架紧随潮流、极低门槛、开箱即用。 \";s:4:\"code\";s:0:\"\";s:9:\"copyright\";s:39:\"© 2022 gougucms.com Apache-2.0 license\";s:7:\"version\";s:6:\"2.0.18\";}', 1, 1612514630, 1645057819);
INSERT INTO `cms_config` VALUES (2, '邮箱配置', 'email', 'a:8:{s:2:\"id\";s:1:\"2\";s:4:\"smtp\";s:11:\"smtp.qq.com\";s:9:\"smtp_port\";s:3:\"465\";s:9:\"smtp_user\";s:15:\"gougucms@qq.com\";s:8:\"smtp_pwd\";s:6:\"123456\";s:4:\"from\";s:24:\"勾股CMS系统管理员\";s:5:\"email\";s:18:\"admin@gougucms.com\";s:8:\"template\";s:122:\"<p>勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能快速建站的内容管理系统。</p>\";}', 1, 1612521657, 1619088538);
INSERT INTO `cms_config` VALUES (3, '微信配置', 'wechat', 'a:11:{s:2:\"id\";s:1:\"3\";s:5:\"token\";s:8:\"GOUGUCMS\";s:14:\"login_back_url\";s:49:\"https://www.gougucms.com/wechat/index/getChatInfo\";s:5:\"appid\";s:18:\"wxdf96xxxx7cd6f0c5\";s:9:\"appsecret\";s:32:\"1dbf319a4f0dfed7xxxxfd1c7dbba488\";s:5:\"mchid\";s:10:\"151xxxx331\";s:11:\"secrect_key\";s:29:\"gougucmsxxxxhumabcxxxxjixxxng\";s:8:\"cert_url\";s:13:\"/extend/cert/\";s:12:\"pay_back_url\";s:42:\"https://www.gougucms.com/wxappv1/wx/notify\";s:9:\"xcx_appid\";s:18:\"wxdf96xxxx9cd6f0c5\";s:13:\"xcx_appsecret\";s:28:\"gougucmsxxxxhunangdmabcxxxng\";}', 1, 1612522314, 1613789058);
INSERT INTO `cms_config` VALUES (4, 'Api Token配置', 'token', 'a:5:{s:2:\"id\";s:1:\"5\";s:3:\"iss\";s:16:\"www.gougucms.com\";s:3:\"aud\";s:8:\"gougucms\";s:7:\"secrect\";s:8:\"GOUGUCMS\";s:7:\"exptime\";s:4:\"3600\";}', 1, 1627313142, 1627376290);
@ -334,10 +338,10 @@ CREATE TABLE `cms_article` (
-- ----------------------------
-- Records of cms_article
-- ----------------------------
INSERT INTO `cms_article` VALUES (1, '勾股CMS——轻量级、高性能极速后台开发框架', '', '勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能极速后台开发框架。通用型的后台权限管理框架极低门槛、操作简单、开箱即用。系统易于功能扩展代码维护方便二次开发让开发者更专注于业务深度需求的开发帮助开发者简单高效降低二次开发成本。', 1, 7, 0, '', '', '<p>勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能极速后台开发框架。通用型的后台权限管理框架极低门槛、操作简单、开箱即用。系统易于功能扩展代码维护方便二次开发让开发者更专注于业务深度需求的开发帮助开发者简单高效降低二次开发成本。</p>\n', '勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能极速后台开发框架。通用型的后台权限管理框架极低门槛、操作简单、开箱即用。系统易于功能扩展代码维护方便二次开发让开发者更专注于业务深度需求的开发帮助开发者简单高效降低二次开发成本。', 0, 2, 1, 0, 1, 1625071256, 1650811576, 0);
INSERT INTO `cms_article` VALUES (2, '勾股BLOG——简约易用开源的个人博客系统', '', '勾股BLOG是一款实用的开源免费的个人博客系统。集成了系统管理、基础数据、博客文章、博客动态、语雀知识库、用户管理、访问统计等功能。具有简约易用内存占用低等特点可以用来做个人博客工作室官网自...', 1, 0, 0, '', '', '<p>勾股BLOG是一款实用的开源免费的个人博客系统。集成了系统管理、基础数据、博客文章、博客动态、语雀知识库、用户管理、访问统计等功能。具有简约易用内存占用低等特点可以用来做个人博客工作室官网自媒体官网等网站二次开发之后也可以作为资讯、展品展示等网站。</p>\n', '勾股BLOG是一款实用的开源免费的个人博客系统。集成了系统管理、基础数据、博客文章、博客动态、语雀知识库、用户管理、访问统计等功能。具有简约易用内存占用低等特点可以用来做个人博客工作室官网自媒体官网等网站二次开发之后也可以作为资讯、展品展示等网站。', 0, 0, 1, 0, 1, 1650811439, 1650811624, 0);
INSERT INTO `cms_article` VALUES (3, '勾股OA——实用的开源的企业办公系统框架', '', '勾股OA是一款实用的开源免费的企业办公系统框架。它集成了系统设置、人事管理、消息管理、审批管理、日常办公、财务管理等基础模块。系统简约易于功能扩展方便二次开发让开发者更专注于业务深度需求的开发...', 1, 0, 0, '', '', '<p>勾股OA是一款实用的开源免费的企业办公系统框架。它集成了系统设置、人事管理、消息管理、审批管理、日常办公、财务管理等基础模块。系统简约易于功能扩展方便二次开发让开发者更专注于业务深度需求的开发通过二次开发之后可以用来做CRMERP业务管理等系统。</p>\n', '勾股OA是一款实用的开源免费的企业办公系统框架。它集成了系统设置、人事管理、消息管理、审批管理、日常办公、财务管理等基础模块。系统简约易于功能扩展方便二次开发让开发者更专注于业务深度需求的开发通过二次开发之后可以用来做CRMERP业务管理等系统。', 0, 0, 1, 0, 1, 1650811502, 1650811709, 0);
INSERT INTO `cms_article` VALUES (4, '勾股DEV——研发管理与团队协作的工具软件', '', '勾股DEV是一款专为IT行业研发团队打造的智能化项目管理与团队协作的工具软件可以在线管理团队的工作、项目和任务覆盖从需求提出到研发完成上线整个过程的项目协作。', 1, 0, 0, '', '', '<p>勾股DEV是一款专为IT行业研发团队打造的智能化项目管理与团队协作的工具软件可以在线管理团队的工作、项目和任务覆盖从需求提出到研发完成上线整个过程的项目协作。</p>\n', '勾股DEV是一款专为IT行业研发团队打造的智能化项目管理与团队协作的工具软件可以在线管理团队的工作、项目和任务覆盖从需求提出到研发完成上线整个过程的项目协作。', 0, 0, 1, 0, 1, 1650811542, 1650811682, 0);
INSERT INTO `cms_article` VALUES (1, '勾股CMS——轻量级、高性能极速后台开发框架', '', '勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能极速后台开发框架。通用型的后台权限管理框架极低门槛、操作简单、开箱即用。系统易于功能扩展代码维护方便二次开发让开发者更专注于业务深度需求的开发帮助开发者简单高效降低二次开发成本。', 1, 7, 0, '', '', '<p>勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能极速后台开发框架。通用型的后台权限管理框架极低门槛、操作简单、开箱即用。系统易于功能扩展代码维护方便二次开发让开发者更专注于业务深度需求的开发帮助开发者简单高效降低二次开发成本。</p>\n<p><img src=\"https://blog.gougucms.com/storage/image/202109/1630457997502502.png\" /></p>', '勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能极速后台开发框架。通用型的后台权限管理框架极低门槛、操作简单、开箱即用。系统易于功能扩展代码维护方便二次开发让开发者更专注于业务深度需求的开发帮助开发者简单高效降低二次开发成本。', 0, 2, 1, 0, 1, 1625071256, 1650811576, 0);
INSERT INTO `cms_article` VALUES (2, '勾股BLOG——简约易用开源的个人博客系统', '', '勾股BLOG是一款实用的开源免费的个人博客系统。集成了系统管理、基础数据、博客文章、博客动态、语雀知识库、用户管理、访问统计等功能。具有简约易用内存占用低等特点可以用来做个人博客工作室官网自...', 1, 0, 0, '', '', '<p>勾股BLOG是一款实用的开源免费的个人博客系统。集成了系统管理、基础数据、博客文章、博客动态、语雀知识库、用户管理、访问统计等功能。具有简约易用内存占用低等特点可以用来做个人博客工作室官网自媒体官网等网站二次开发之后也可以作为资讯、展品展示等网站。</p>\n<p><img src=\"https://blog.gougucms.com/storage/image/b1.png\" /></p>', '勾股BLOG是一款实用的开源免费的个人博客系统。集成了系统管理、基础数据、博客文章、博客动态、语雀知识库、用户管理、访问统计等功能。具有简约易用内存占用低等特点可以用来做个人博客工作室官网自媒体官网等网站二次开发之后也可以作为资讯、展品展示等网站。', 0, 0, 1, 0, 1, 1650811439, 1650811624, 0);
INSERT INTO `cms_article` VALUES (3, '勾股OA——实用的开源的企业办公系统框架', '', '勾股OA是一款实用的开源免费的企业办公系统框架。它集成了系统设置、人事管理、消息管理、审批管理、日常办公、财务管理等基础模块。系统简约易于功能扩展方便二次开发让开发者更专注于业务深度需求的开发...', 1, 0, 0, '', '', '<p>勾股OA是一款实用的开源免费的企业办公系统框架。它集成了系统设置、人事管理、消息管理、审批管理、日常办公、财务管理等基础模块。系统简约易于功能扩展方便二次开发让开发者更专注于业务深度需求的开发通过二次开发之后可以用来做CRMERP业务管理等系统。</p>\n<p><img src=\"https://oa.gougucms.com/storage/image/oa1.png\" /></p>', '勾股OA是一款实用的开源免费的企业办公系统框架。它集成了系统设置、人事管理、消息管理、审批管理、日常办公、财务管理等基础模块。系统简约易于功能扩展方便二次开发让开发者更专注于业务深度需求的开发通过二次开发之后可以用来做CRMERP业务管理等系统。', 0, 0, 1, 0, 1, 1650811502, 1650811709, 0);
INSERT INTO `cms_article` VALUES (4, '勾股DEV——研发管理与团队协作的工具软件', '', '勾股DEV是一款专为IT行业研发团队打造的智能化项目管理与团队协作的工具软件可以在线管理团队的工作、项目和任务覆盖从需求提出到研发完成上线整个过程的项目协作。', 1, 0, 0, '', '', '<p>勾股DEV是一款专为IT行业研发团队打造的智能化项目管理与团队协作的工具软件可以在线管理团队的工作、项目和任务覆盖从需求提出到研发完成上线整个过程的项目协作。</p>\n<p><img src=\"https://dev.gougucms.com/storage/202204/dev2.png\" /></p>', '勾股DEV是一款专为IT行业研发团队打造的智能化项目管理与团队协作的工具软件可以在线管理团队的工作、项目和任务覆盖从需求提出到研发完成上线整个过程的项目协作。', 0, 0, 1, 0, 1, 1650811542, 1650811682, 0);
-- ----------------------------
@ -441,7 +445,7 @@ CREATE TABLE `cms_nav_info` (
INSERT INTO `cms_nav_info` VALUES ('1', '0', '1', '首页', '/', 'index', '0', '1', '1', '0', '0');
INSERT INTO `cms_nav_info` VALUES ('2', '0', '1', '开发日志', 'https://www.gougucms.com/home/index/logs.html', 'logs', '1', '1', '2', '0', '0');
INSERT INTO `cms_nav_info` VALUES ('3', '0', '1', 'API接口', '/api/index', '', '1', '1', '3', '0', '0');
INSERT INTO `cms_nav_info` VALUES ('4', '0', '1', '后台演示', 'https://www.gougucms.com/admin/index/index.html', '', '1', '1', '4', '0', '0');
INSERT INTO `cms_nav_info` VALUES ('4', '0', '1', '后台演示', '/admin/', '', '1', '1', '4', '0', '0');
INSERT INTO `cms_nav_info` VALUES ('5', '0', '1', '勾股博客', 'https://blog.gougucms.com/', '', '1', '1', '5', '0', '0');
INSERT INTO `cms_nav_info` VALUES ('6', '0', '1', '勾股OA', 'https://gitee.com/gougucms/office', '', '1', '1', '6', '0', '0');
INSERT INTO `cms_nav_info` VALUES ('7', '0', '1', '勾股DEV', 'https://gitee.com/gougucms/dev', '', '1', '1', '7', '0', '0');
@ -734,4 +738,51 @@ CREATE TABLE `cms_goods_keywords` (
-- ----------------------------
-- Records of cms_goods_keywords
-- ----------------------------
INSERT INTO `cms_goods_keywords` VALUES (1, 1, 1, 1, 1644823517);
INSERT INTO `cms_goods_keywords` VALUES (1, 1, 1, 1, 1644823517);
-- ----------------------------
-- Table structure for cms_pages
-- ----------------------------
DROP TABLE IF EXISTS `cms_pages`;
CREATE TABLE `cms_pages` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '-1删除 0下架 1正常',
`title` varchar(200) NOT NULL DEFAULT '' COMMENT '页面名称',
`thumb` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '缩略图',
`banner` varchar(1000) NOT NULL DEFAULT '' COMMENT '图集相册',
`desc` varchar(1000) NOT NULL DEFAULT '' COMMENT '页面摘要',
`content` text NOT NULL COMMENT '内容',
`md_content` text NOT NULL COMMENT 'markdown内容',
`read` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '阅读量',
`sort` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序',
`template` varchar(200) NOT NULL DEFAULT '' COMMENT '前端模板',
`admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '编辑时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '单页面表';
-- ----------------------------
-- Records of cms_pages
-- ----------------------------
INSERT INTO `cms_pages` VALUES (1, 1, '勾股CMS介绍', 1, '', '勾股CMS是一套基于ThinkPHP6+Layui+MySql打造的轻量级、高性能快速建站的内容管理系统。后台管理模块一目了然操作简单通用型后台权限管理框架紧随潮流、极低门槛、开箱即用。', '<p>勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能极速后台开发框架。通用型的后台权限管理框架极低门槛、操作简单、开箱即用。系统易于功能扩展代码维护方便二次开发让开发者更专注于业务深度需求的开发帮助开发者简单高效降低二次开发成本。</p>\n<p><img src=\"https://blog.gougucms.com/storage/image/202109/1630457997502502.png\" /></p>', '', 1, 0, 'default', 0, 1653984295, 1653993466);
-- ----------------------------
-- Table structure for `cms_pages_keywords`
-- ----------------------------
DROP TABLE IF EXISTS `cms_pages_keywords`;
CREATE TABLE `cms_pages_keywords` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`aid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '页面ID',
`keywords_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '关联关键字id',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:-1删除 0禁用 1启用',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`),
KEY `aid` (`aid`),
KEY `inid` (`keywords_id`)
) ENGINE=InnoDB DEFAULT CHARACTER SET = utf8mb4 COMMENT='单页面关联表';
-- ----------------------------
-- Records of cms_pages_keywords
-- ----------------------------
INSERT INTO `cms_pages_keywords` VALUES (1, 1, 1, 1, 1644823517);

View File

@ -7,21 +7,21 @@
<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, maximum-scale=1">
<link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
<link rel="stylesheet" href="{__GOUGU__}/layui/css/layui.css" media="all">
<style>
body {
width: 100%;
height: 100%;
background-size: cover;
background: url("/static/admin/images/bg_pattern.png"), #7b4397;
background: url("/static/admin/images/bg_pattern.png"), -webkit-linear-gradient(to left, #34a853, #4285f4);
background: url("/static/admin/images/bg_pattern.png"), linear-gradient(to left, #34a853, #4285f4);
background: url("{__ADMIN__}/images/bg_pattern.png"), #7b4397;
background: url("{__ADMIN__}/images/bg_pattern.png"), -webkit-linear-gradient(to left, #34a853, #4285f4);
background: url("{__ADMIN__}/images/bg_pattern.png"), linear-gradient(to left, #34a853, #4285f4);
}
</style>
</head>
<body>
<div style="width:200px;margin: 20px auto;"><img src="/static/admin/images/login_logo.png" alt="勾股CMS安装" width="200"></div>
<div style="width:200px;margin: 20px auto;"><img src="{__ADMIN__}/images/login_logo.png" alt="勾股CMS安装" width="200"></div>
<div style="width:888px;margin:0 auto 30px;">
<div class="layui-layout layui-layout-admin">
<div class="layui-header layui-bg-red" style="border-radius:6px 6px 0 0; position:relative;">
@ -49,7 +49,7 @@
</div>
</div>
</div>
<script src="/static/layui/layui.js" charset="utf-8"></script>
<script src="{__GOUGU__}/layui/layui.js" charset="utf-8"></script>
</body>
</html>

View File

@ -7,21 +7,21 @@
<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, maximum-scale=1">
<link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
<link rel="stylesheet" href="{__GOUGU__}/layui/css/layui.css" media="all">
<style>
body {
width: 100%;
height: 100%;
background-size: cover;
background: url("/static/admin/images/bg_pattern.png"), #7b4397;
background: url("/static/admin/images/bg_pattern.png"), -webkit-linear-gradient(to left, #34a853, #4285f4);
background: url("/static/admin/images/bg_pattern.png"), linear-gradient(to left, #34a853, #4285f4);
background: url("{__ADMIN__}/images/bg_pattern.png"), #7b4397;
background: url("{__ADMIN__}/images/bg_pattern.png"), -webkit-linear-gradient(to left, #34a853, #4285f4);
background: url("{__ADMIN__}/images/bg_pattern.png"), linear-gradient(to left, #34a853, #4285f4);
}
</style>
</head>
<body>
<div style="width:200px;margin: 20px auto;"><img src="/static/admin/images/login_logo.png" alt="勾股CMS安装"
<div style="width:200px;margin: 20px auto;"><img src="{__ADMIN__}/images/login_logo.png" alt="勾股CMS安装"
width="200"></div>
<div style="width:888px;margin:0 auto 30px;">
<div class="layui-layout layui-layout-admin">
@ -190,7 +190,7 @@
</div>
</div>
<script src="/static/layui/layui.js" charset="utf-8"></script>
<script src="{__GOUGU__}/layui/layui.js" charset="utf-8"></script>
<script>
layui.use(['jquery', 'layer'], function () {
var $ = layui.jquery,

View File

@ -7,21 +7,21 @@
<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, maximum-scale=1">
<link rel="stylesheet" href="{__LAYUI__}/css/layui.css" media="all">
<link rel="stylesheet" href="{__GOUGU__}/layui/css/layui.css" media="all">
<style>
body {
width: 100%;
height: 100%;
background-size: cover;
background: url("/static/admin/images/bg_pattern.png"), #7b4397;
background: url("/static/admin/images/bg_pattern.png"), -webkit-linear-gradient(to left, #34a853, #4285f4);
background: url("/static/admin/images/bg_pattern.png"), linear-gradient(to left, #34a853, #4285f4);
background: url("{__ADMIN__}/images/bg_pattern.png"), #7b4397;
background: url("{__ADMIN__}/images/bg_pattern.png"), -webkit-linear-gradient(to left, #34a853, #4285f4);
background: url("{__ADMIN__}/images/bg_pattern.png"), linear-gradient(to left, #34a853, #4285f4);
}
</style>
</head>
<body>
<div style="width:200px;margin: 20px auto;"><img src="/static/admin/images/login_logo.png" alt="勾股CMS安装"
<div style="width:200px;margin: 20px auto;"><img src="{__ADMIN__}/images/login_logo.png" alt="勾股CMS安装"
width="200"></div>
<div style="width:888px;margin:0 auto 30px;">
<div class="layui-layout layui-layout-admin">
@ -137,7 +137,7 @@
</div>
</div>
<script src="{__LAYUI__}/layui.js" charset="utf-8"></script>
<script src="{__GOUGU__}/layui/layui.js" charset="utf-8"></script>
<script>
layui.use(['element', 'jquery', 'layer', 'form'], function () {
var $ = layui.jquery,

View File

@ -24,12 +24,10 @@ return [
'taglib_end' => '}',
'tpl_replace_string' => array(
'{__STATIC__}' => '/static',
'{__LAYUI__}' => '/static/layui',
'{__GOUGU__}' => '/static/assets',
'{__ADMIN__}' => '/static/admin',
'{__CSS__}' => '/static/home/css',
'{__JS__}' => '/static/home/js',
'{__IMG__}' => '/static/home/images',
'{__ADMIN_CSS__}' => '/static/admin/css',
'{__ADMIN_JS__}' => '/static/admin/js',
'{__ADMIN_IMG__}' => '/static/admin/images',
'{__IMG__}' => '/static/home/images'
),
];

View File

@ -15,13 +15,10 @@ if (empty(file_exists(__DIR__ . '/../vendor/autoload.php'))) {
require __DIR__ . '/../vendor/autoload.php';
// 定义当前版本号
define('CMS_VERSION','2.4.25');
// 定义ThinkPHP版本号
define('TP_VERSION','6.0.12');
define('CMS_VERSION','3.0.61');
// 定义Layui版本号
define('LAYUI_VERSION','2.6.8');
define('LAYUI_VERSION','2.7.0-rc5');
// 定义项目目录
define('CMS_ROOT', __DIR__ . '/../');

File diff suppressed because it is too large Load Diff

View File

@ -1,77 +0,0 @@
.main-body{padding:0;min-width: 1220px;
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
-ms-user-select: none; /*IE10*/
-khtml-user-select: none; /*早期浏览器*/
user-select: none;}
.layui-layout-admin .layui-header {height:49px;background-color:#fff;box-shadow: 0 2px 6px 0 rgb(5 32 96 / 10%);}
.layui-layout-admin .layui-logo {line-height:49px;cursor:pointer;font-size:16px;color:#fff;background:#001529;width:200px;border-bottom: 1px solid #001529;}
.layui-layout-admin .layui-side {top:50px;width:200px;border-right:1px solid #ddd;}
.layui-header .layui-nav-item {line-height:49px; height:49px; border-left: 1px solid #eee;position: relative;display: inline-block; *display: inline; *zoom: 1; vertical-align: middle;}
.layui-header .layui-nav-item a{padding: 0 12px; text-align: center; min-width: 24px;}
.layui-header.layui-layout-left {color:#333;margin-left:10px;}
.layui-header.layui-layout-left input {border:0;}
.layui-header .layui-nav-bar {display:none;}
.layui-layout-right{padding: 0 3px; background-color:#fff;}
.layui-header .layui-nav-item #ittab-refresh {color:#000;}
.layui-header .layui-nav-item #ittab-refresh i {font-size:16px;}
.layui-header .layui-nav-item #ittab-del-cache{color:#000}
.layui-header .layui-nav-item #ittab-del-cache i{font-size:16px}
.layui-header.layui-layout-right .layui-nav-bar {background-color: #fff;}
.layui-tab-brief>.layui-tab-more li.layui-this:after {border-bottom: 0;}
.layui-nav-img {width:25px;height:25px;margin-right:0;}
.layui-header .msg-num { min-width: 18px;height: 18px;position: absolute;top: -10px;right: 5px;display: none;}
.layui-header .msg-num a {min-width: 18px; height: 18px; margin: 0; padding: 0; display: inline-block; font-size: 11px;line-height: 18px;text-align: center; background-color: #FF5722; color: #fff;border-radius: 12px; cursor: pointer;}
.layui-layout-admin .layui-body {top:50px; z-index:1008; padding:0;padding-right:0;padding-bottom:0;bottom:0;left:200px;overflow:visible;right:0;background-color:#F5F8FA;}
.menulist {width:100%;height:100%; border-right:1px solid #ccc; font-size:14px; color:#aaaaaa;}
.menulist-bg-gray{background-color:#001529;}
.layui-side.menulist-bg-gray::-webkit-scrollbar{width: 0; height: 0;}
.menulist-top {padding: 10px 12px; font-size:0; border-bottom: 1px solid #17232c; text-align:center;}
.menulist-top a {background-color:#34a853; opacity:1; width: 25%; margin:0; padding: 5px 0; display:inline-block;}
.menulist-top .layui-icon {color:#fff;font-size:16px;}
.menulist-top a:first-child {border-radius: 3px 0 0 3px;}
.menulist-top a:last-child {border-radius: 0 3px 3px 0;}
.menulist-top a:hover{opacity: .9;}
.menulist .layui-nav{background-color:#001529;}
.menulist .layui-nav-tree .layui-nav-bar{width:4px;background-color:#E94335}
.layui-nav-tree .layui-nav-child{padding:0;}
.layui-nav-tree .layui-nav-child dd.layui-this, .layui-nav-tree .layui-nav-child dd.layui-this a, .layui-nav-tree .layui-this, .layui-nav-tree .layui-this>a, .layui-nav-tree .layui-this>a:hover{background-color:#131E25}
.layui-nav .layui-nav-item a{padding-left:12px;}
.layui-nav .layui-nav-item a.menu-b{padding-left:32px;}
.layui-nav .layui-nav-item a.menu-c{padding-left:45px;}
.layui-nav .layui-nav-item a.menu-d{padding-left:58px;}
.gougu-admin-tab {margin:0;}
.gougu-admin-tab .layui-icon-prev,.gougu-admin-tab .layui-icon-next {position:absolute;top:-50px; width:39px; height:49px; line-height:49px; color: #999; text-align:center; cursor:pointer; background-color:#fff;}
.gougu-admin-tab .layui-icon-prev{left:0; border-right: 1px solid #eee;}
.gougu-admin-tab .layui-icon-next {right:152px; border-left: 1px solid #eee;}
.gougu-admin-tab .layui-icon-prev:hover,.gougu-admin-tab .layui-icon-next:hover{color: #333;}
.gougu-admin-tab .layui-tab-title {position:absolute;top:-50px; z-index:58; height:49px;left:40px; border:0;max-width:calc(100% - 226px); overflow:hidden;}
.gougu-admin-tab .layui-tab-title li {min-width:36px; padding:0 24px 0 12px; color:#666;font-size:12px;line-height:48px;border-top:3px solid #fff; border-right: 1px solid #F5F8FA; background-color:#fff;}
.gougu-admin-tab .layui-tab-title li .gougu-tab-active {display: inline-block; background-color: #999; width: 8px; height: 8px; border-radius: 20px; margin-right: 6px;}
.gougu-admin-tab .layui-tab-title li .layui-tab-close {position:absolute;width:15px;height:15px;line-height:16px;top:16px;right:5px;font-size:10px;display:none;border-radius:50%;}
.gougu-admin-tab .layui-tab-title li:hover {color:#333;background-color:#F5F8FA;border-top:3px solid #333;}
.gougu-admin-tab .layui-tab-title li:hover .gougu-tab-active {background-color:#333}
.gougu-admin-tab .layui-tab-title li:hover .layui-tab-close {display:inline-block;}
.gougu-admin-tab .layui-tab-title li .layui-tab-close:hover {background-color:#E94335;color:#fff;}
.gougu-admin-tab .layui-tab-title li.layui-this {color:#333;background-color:#F5F8FA;border-top:3px solid #E94335;}
.gougu-admin-tab .layui-tab-title li.layui-this .gougu-tab-active{background-color:#E94335;}
.gougu-admin-tab .layui-tab-title li.layui-this .layui-tab-close{display:inline-block;}
.gougu-admin-tab .layui-tab-title li.ittab-tab-home{padding:0 16px;}
.gougu-admin-tab .layui-tab-title li.ittab-tab-home .layui-tab-close {display:none;}
.gougu-admin-tab .layui-tab-title li.ittab-tab-home:hover .layui-tab-close {display:none;}
.gougu-admin-tab .layui-tab-brief>.layui-tab-more li.layui-this:after,.layui-tab-brief>.layui-tab-title .layui-this:after {border:0;}
.gougu-admin-tab .layui-tab-item {height:100%;}
.gougu-admin-tab .layui-tab-bar {height: 50px;border-width: 0;line-height: 50px;}
.layui-layout-admin .layui-footer {left:200px;height:30px;line-height:30px;background-color:#f0f0f0;font-size:12px;}
.layui-tab-content {padding:0px;}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Some files were not shown because too many files have changed in this diff Show More