Merge branch 'master' of https://gitee.com/luzhou-lihai-agriculture/nk-lihaink-cn
# Conflicts: # app/admin/controller/Api.php
This commit is contained in:
commit
62a174c0d9
@ -336,26 +336,7 @@ class Api extends BaseController
|
||||
$content = $log->get_log_list($param);
|
||||
return table_assign(0, '', $content);
|
||||
}
|
||||
|
||||
//获取访问记录
|
||||
public function get_view_data()
|
||||
{
|
||||
$param = get_params();
|
||||
$first_time = time();
|
||||
$second_time = $first_time - 86400;
|
||||
$three_time = $first_time - 86400*365;
|
||||
$begin_first = strtotime(date('Y-m-d', $first_time) . " 00:00:00");
|
||||
$end_first = strtotime(date('Y-m-d', $first_time) . " 23:59:59");
|
||||
$begin_second = strtotime(date('Y-m-d', $second_time) . " 00:00:00");
|
||||
$end_second = strtotime(date('Y-m-d', $second_time) . " 23:59:59");
|
||||
$begin_three = strtotime(date('Y-m-d', $three_time) . " 00:00:00");
|
||||
$data_first = Db::name('UserLog')->field('create_time')->whereBetween('create_time', "$begin_first,$end_first")->select();
|
||||
$data_second = Db::name('UserLog')->field('create_time')->whereBetween('create_time', "$begin_second,$end_second")->select();
|
||||
|
||||
$data_three = Db::name('UserLog')->field('create_time')->whereBetween('create_time', "$begin_three,$end_first")->select();
|
||||
|
||||
return to_assign(0, '', ['data_first' => hour_document($data_first), 'data_second' => hour_document($data_second), 'data_three'=>date_document($data_three)]);
|
||||
}
|
||||
|
||||
public function getbytype(){
|
||||
$type = get_params("type");
|
||||
$where['type'] = $type;
|
||||
|
@ -1,190 +0,0 @@
|
||||
<?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\Article as ArticleModel;
|
||||
use app\admin\validate\ArticleValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Article extends BaseController
|
||||
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new ArticleModel();
|
||||
$this->uid = get_login_admin('id');
|
||||
}
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['a.id|a.title|a.desc|a.content|c.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['cate_id'])) {
|
||||
$where[] = ['a.cate_id', '=', $param['cate_id']];
|
||||
}
|
||||
$where[] = ['a.delete_time', '=', 0];
|
||||
$ArticleModel = new ArticleModel();
|
||||
$list = $ArticleModel->getArticleList($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
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']);
|
||||
}
|
||||
$param['admin_id'] = $this->uid;
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(ArticleValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
|
||||
$ArticleModel = new ArticleModel();
|
||||
$ArticleModel->addArticle($param);
|
||||
}else{
|
||||
View::assign('editor', get_system_config('other','editor'));
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$param = get_params();
|
||||
$ArticleModel = new ArticleModel();
|
||||
|
||||
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']);
|
||||
}
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(ArticleValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$ArticleModel->editArticle($param);
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $ArticleModel->getArticleById($id);
|
||||
View::assign('editor', get_system_config('other','editor'));
|
||||
if (!empty($detail)) {
|
||||
if(!empty($article['md_content'])){
|
||||
View::assign('editor',1);
|
||||
}
|
||||
$keyword_array = Db::name('ArticleKeywords')
|
||||
->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;
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看信息
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$ArticleModel = new ArticleModel();
|
||||
$detail = $ArticleModel->getArticleById($id);
|
||||
if (!empty($detail)) {
|
||||
$keyword_array = Db::name('ArticleKeywords')
|
||||
->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;
|
||||
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$type = isset($param['type']) ? $param['type'] : 0;
|
||||
|
||||
$ArticleModel = new ArticleModel();
|
||||
$ArticleModel->delArticleById($id,$type);
|
||||
}
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
<?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\ArticleCate as ArticleCateModel;
|
||||
use app\admin\validate\ArticleCateValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class ArticleCate extends BaseController
|
||||
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new ArticleCateModel();
|
||||
}
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$list = $this->model->where('delete_time',0)->order('sort asc')->select();
|
||||
return to_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//获取子分类id.$is_self=1包含自己
|
||||
public function get_cate_son($id = 0, $is_self = 1)
|
||||
{
|
||||
$cates = $this->model->where('delete_time',0)->order('sort asc')->select()->toArray();
|
||||
$cates_list = get_data_node($cates, $id);
|
||||
$cates_array = array_column($cates_list, 'id');
|
||||
if ($is_self == 1) {
|
||||
//包括自己在内
|
||||
$cates_array[] = $id;
|
||||
}
|
||||
return $cates_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(ArticleCateValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$this->model->addArticleCate($param);
|
||||
}else{
|
||||
$pid = isset($param['pid']) ? $param['pid'] : 0;
|
||||
View::assign('pid', $pid);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$param = get_params();
|
||||
|
||||
if (request()->isAjax()) {
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(ArticleCateValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$cate_array = $this->get_cate_son($param['id']);
|
||||
if (in_array($param['pid'], $cate_array)) {
|
||||
return to_assign(1, '上级分类不能是该分类本身或其子分类');
|
||||
}
|
||||
$this->model->editArticleCate($param);
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getArticleCateById($id);
|
||||
if (!empty($detail)) {
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看信息
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getArticleCateById($id);
|
||||
if (!empty($detail)) {
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$type = isset($param['type']) ? $param['type'] : 0;
|
||||
$count_cate = Db::name('ArticleCate')->where(["pid"=>$id,"delete_time"=>0])->count();
|
||||
if ($count_cate > 0) {
|
||||
return to_assign(1, "该分类下还有子分类,无法删除");
|
||||
}
|
||||
$count_article = Db::name('Article')->where(["cate_id" => $id,"delete_time"=>0])->count();
|
||||
if ($count_article > 0) {
|
||||
return to_assign(1, "该分类下还有文章,无法删除");
|
||||
}
|
||||
$this->model->delArticleCateById($id,$type);
|
||||
}
|
||||
}
|
@ -1,171 +0,0 @@
|
||||
<?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\Gallery as GalleryModel;
|
||||
use app\admin\validate\GalleryValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Gallery extends BaseController
|
||||
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new GalleryModel();
|
||||
$this->uid = get_login_admin('id');
|
||||
}
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['a.id|a.title|a.desc|c.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['cate_id'])) {
|
||||
$where[] = ['a.cate_id', '=', $param['cate_id']];
|
||||
}
|
||||
$where[] = ['a.delete_time', '=', 0];
|
||||
$list = $this->model->getGalleryList($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(GalleryValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['admin_id'] = $this->uid;
|
||||
$this->model->addGallery($param);
|
||||
}else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(GalleryValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$this->model->editGallery($param);
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getGalleryById($id);
|
||||
if (!empty($detail)) {
|
||||
//关键字
|
||||
$keywrod_array = Db::name('GalleryKeywords')
|
||||
->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($keywrod_array, 'keywords_id'));
|
||||
$detail['keyword_names'] = implode(',', array_column($keywrod_array, 'title'));
|
||||
$detail['keyword_array'] = $keywrod_array;
|
||||
|
||||
//图集
|
||||
$gallery_array = Db::name('GalleryFile')
|
||||
->order('create_time asc')
|
||||
->where(array('aid' => $id))
|
||||
->select()->toArray();
|
||||
$detail['gallery_array'] = $gallery_array;
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看信息
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getGalleryById($id);
|
||||
if (!empty($detail)) {
|
||||
//关键字
|
||||
$keywrod_array = Db::name('GalleryKeywords')
|
||||
->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($keywrod_array, 'keywords_id'));
|
||||
$detail['keyword_names'] = implode(',', array_column($keywrod_array, 'title'));
|
||||
$detail['keyword_array'] = $keywrod_array;
|
||||
|
||||
//图集
|
||||
$gallery_array = Db::name('GalleryFile')
|
||||
->order('create_time asc')
|
||||
->where(array('aid' => $id))
|
||||
->select()->toArray();
|
||||
$detail['gallery_array'] = $gallery_array;
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$type = isset($param['type']) ? $param['type'] : 0;
|
||||
|
||||
$this->model->delGalleryById($id,$type);
|
||||
}
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
<?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\GalleryCate as GalleryCateModel;
|
||||
use app\admin\validate\GalleryCateValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class GalleryCate extends BaseController
|
||||
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new GalleryCateModel();
|
||||
}
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$list = $this->model->where('delete_time',0)->order('sort asc')->select();
|
||||
return to_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//获取子分类id.$is_self=1包含自己
|
||||
public function get_cate_son($id = 0, $is_self = 1)
|
||||
{
|
||||
$cates = $this->model->where('delete_time',0)->order('sort asc')->select()->toArray();
|
||||
$cates_list = get_data_node($cates, $id);
|
||||
$cates_array = array_column($cates_list, 'id');
|
||||
if ($is_self == 1) {
|
||||
//包括自己在内
|
||||
$cates_array[] = $id;
|
||||
}
|
||||
return $cates_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(GalleryCateValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
|
||||
$this->model->addGalleryCate($param);
|
||||
}else{
|
||||
$pid = isset($param['pid']) ? $param['pid'] : 0;
|
||||
View::assign('pid', $pid);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$param = get_params();
|
||||
|
||||
if (request()->isAjax()) {
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(GalleryCateValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$cate_array = $this->get_cate_son($param['id']);
|
||||
if (in_array($param['pid'], $cate_array)) {
|
||||
return to_assign(1, '上级分类不能是该分类本身或其子分类');
|
||||
}
|
||||
$this->model->editGalleryCate($param);
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getGalleryCateById($id);
|
||||
if (!empty($detail)) {
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看信息
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getGalleryCateById($id);
|
||||
if (!empty($detail)) {
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$type = isset($param['type']) ? $param['type'] : 0;
|
||||
$count_cate = Db::name('GalleryCate')->where(["pid"=>$id,"delete_time"=>0])->count();
|
||||
if ($count_cate > 0) {
|
||||
return to_assign(1, "该分类下还有子分类,无法删除");
|
||||
}
|
||||
$count_gallery = Db::name('Gallery')->where(["cate_id" => $id,"delete_time"=>0])->count();
|
||||
if ($count_gallery > 0) {
|
||||
return to_assign(1, "该分类下还有图集,无法删除");
|
||||
}
|
||||
$this->model->delGalleryCateById($id,$type);
|
||||
}
|
||||
}
|
@ -1,223 +0,0 @@
|
||||
<?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\Goods as GoodsModel;
|
||||
use app\admin\validate\GoodsValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Goods extends BaseController
|
||||
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new GoodsModel();
|
||||
$this->uid = get_login_admin('id');
|
||||
}
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['a.id|a.title|a.desc|a.content|c.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['cate_id'])) {
|
||||
$where[] = ['a.cate_id', '=', $param['cate_id']];
|
||||
}
|
||||
$where[] = ['a.delete_time', '=', 0];
|
||||
$param['order'] = 'a.sort asc';
|
||||
$list = $this->model->getGoodsList($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(GoodsValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
if (isset($param['tag_values']) && $param['tag_values']) {
|
||||
$param['tag_values'] = implode(',',$param['tag_values']);
|
||||
}
|
||||
if(empty($param['desc'])){
|
||||
$param['desc'] = getDescriptionFromContent($param['content'], 100);
|
||||
}
|
||||
$param['admin_id'] = $this->uid;
|
||||
$this->model->addGoods($param);
|
||||
}else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$param = get_params();
|
||||
|
||||
if (request()->isAjax()) {
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(GoodsValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
if (isset($param['tag_values']) && $param['tag_values']) {
|
||||
$param['tag_values'] = implode(',',$param['tag_values']);
|
||||
}
|
||||
$this->model->editGoods($param);
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getGoodsById($id);
|
||||
if (!empty($detail)) {
|
||||
//轮播图
|
||||
if(!empty($detail['banner'])) {
|
||||
$detail['banner_array'] = explode(',',$detail['banner']);
|
||||
}
|
||||
//关键字
|
||||
$keywrod_array = Db::name('GoodsKeywords')
|
||||
->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($keywrod_array, 'keywords_id'));
|
||||
$detail['keyword_names'] = implode(',', array_column($keywrod_array, 'title'));
|
||||
|
||||
//标签设置
|
||||
$detail['tag1'] = $detail['tag2'] = $detail['tag3'] = $detail['tag4'] = $detail['tag5'] = $detail['tag6'] =0;
|
||||
if(!empty($detail['tag_values'])) {
|
||||
$tag_values_array = explode(',', $detail['tag_values']);
|
||||
if(in_array('1', $tag_values_array)){
|
||||
$detail['tag1'] = 1;
|
||||
}
|
||||
if(in_array('2', $tag_values_array)){
|
||||
$detail['tag2'] = 1;
|
||||
}
|
||||
if(in_array('3', $tag_values_array)){
|
||||
$detail['tag3'] = 1;
|
||||
}
|
||||
if(in_array('4', $tag_values_array)){
|
||||
$detail['tag4'] = 1;
|
||||
}
|
||||
if(in_array('5', $tag_values_array)){
|
||||
$detail['tag5'] = 1;
|
||||
}
|
||||
if(in_array('6', $tag_values_array)){
|
||||
$detail['tag6'] = 1;
|
||||
}
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看信息
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getGoodsById($id);
|
||||
if (!empty($detail)) {
|
||||
//分类名
|
||||
$detail['cate_name'] = Db::name('GoodsCate')->where('id',$detail['cate_id'])->value('title');
|
||||
//轮播图
|
||||
if(!empty($detail['banner'])) {
|
||||
$detail['banner_array'] = explode(',',$detail['banner']);
|
||||
}
|
||||
//关键字
|
||||
$keywrod_array = Db::name('GoodsKeywords')
|
||||
->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($keywrod_array, 'keywords_id'));
|
||||
$detail['keyword_names'] = implode(',', array_column($keywrod_array, 'title'));
|
||||
|
||||
//标签设置
|
||||
$detail['tag1'] = $detail['tag2'] = $detail['tag3'] = $detail['tag4'] = $detail['tag5'] = $detail['tag6'] =0;
|
||||
if(!empty($detail['tag_values'])) {
|
||||
$tag_values_array = explode(',', $detail['tag_values']);
|
||||
if(in_array('1', $tag_values_array)){
|
||||
$detail['tag1'] = 1;
|
||||
}
|
||||
if(in_array('2', $tag_values_array)){
|
||||
$detail['tag2'] = 1;
|
||||
}
|
||||
if(in_array('3', $tag_values_array)){
|
||||
$detail['tag3'] = 1;
|
||||
}
|
||||
if(in_array('4', $tag_values_array)){
|
||||
$detail['tag4'] = 1;
|
||||
}
|
||||
if(in_array('5', $tag_values_array)){
|
||||
$detail['tag5'] = 1;
|
||||
}
|
||||
if(in_array('6', $tag_values_array)){
|
||||
$detail['tag6'] = 1;
|
||||
}
|
||||
}
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$type = isset($param['type']) ? $param['type'] : 0;
|
||||
|
||||
$this->model->delGoodsById($id,$type);
|
||||
}
|
||||
}
|
@ -1,143 +0,0 @@
|
||||
<?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\GoodsCate as GoodsCateModel;
|
||||
use app\admin\validate\GoodsCateValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class GoodsCate extends BaseController
|
||||
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new GoodsCateModel();
|
||||
}
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$list = $this->model->where('delete_time',0)->order('sort asc')->select();
|
||||
return to_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//获取子分类id.$is_self=1包含自己
|
||||
public function get_cate_son($id = 0, $is_self = 1)
|
||||
{
|
||||
$cates = $this->model->where('delete_time',0)->order('sort asc')->select()->toArray();
|
||||
$cates_list = get_data_node($cates, $id);
|
||||
$cates_array = array_column($cates_list, 'id');
|
||||
if ($is_self == 1) {
|
||||
//包括自己在内
|
||||
$cates_array[] = $id;
|
||||
}
|
||||
return $cates_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(GoodsCateValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
|
||||
$this->model->addGoodsCate($param);
|
||||
}else{
|
||||
$pid = isset($param['pid']) ? $param['pid'] : 0;
|
||||
View::assign('pid', $pid);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$param = get_params();
|
||||
|
||||
if (request()->isAjax()) {
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(GoodsCateValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$cate_array = $this->get_cate_son($param['id']);
|
||||
if (in_array($param['pid'], $cate_array)) {
|
||||
return to_assign(1, '上级分类不能是该分类本身或其子分类');
|
||||
}
|
||||
$this->model->editGoodsCate($param);
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getGoodsCateById($id);
|
||||
if (!empty($detail)) {
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看信息
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getGoodsCateById($id);
|
||||
if (!empty($detail)) {
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$type = isset($param['type']) ? $param['type'] : 0;
|
||||
|
||||
$this->model->delGoodsCateById($id,$type);
|
||||
}
|
||||
}
|
@ -72,11 +72,10 @@ class Index extends BaseController
|
||||
$nation_s_num = Db::table('fa_szxc_information_usermsg')->where($where)->whereBetween('nation', [13, 68])->count();
|
||||
// 汉族
|
||||
$nation_h_num = Db::table('fa_szxc_information_usermsg')->where($where)->where('nation', 12)->count();
|
||||
// 土地性质
|
||||
|
||||
foreach ($where as $key =>$value){
|
||||
$where[$key][0] = 'm.'.$value[0];
|
||||
}
|
||||
// foreach ($where as $key =>$value){
|
||||
// $where[$key][0] = 'm.'.$value[0];
|
||||
// }
|
||||
// 残疾人数
|
||||
$whether_disabled_num = Db::table('fa_szxc_information_usermsg')
|
||||
->alias('m')
|
||||
@ -101,6 +100,39 @@ class Index extends BaseController
|
||||
->where('u.group_id',3)
|
||||
->join(['fa_szxc_information_usermsg'=>'m'],'u.id = m.user_id')->count();
|
||||
}
|
||||
//土地
|
||||
$land_area_num = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.land_area');
|
||||
$sum_218 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=218')->sum('p.land_area');
|
||||
$sum_217 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=217')->sum('p.land_area');
|
||||
$sum_216 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=216')->sum('p.land_area');
|
||||
$sum_215 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=215')->sum('p.land_area');
|
||||
$sum_214 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=214')->sum('p.land_area');
|
||||
$sum_70 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=70')->sum('p.land_area');
|
||||
$sum_69 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.land_area');
|
||||
View::assign(
|
||||
[
|
||||
'totaluser' => $num,//User::where($whe)->count(),// 总用户数
|
||||
@ -113,6 +145,14 @@ class Index extends BaseController
|
||||
'nation_s_num' => $nation_s_num,
|
||||
'nation_h_num' => $nation_h_num,
|
||||
'work_num' => $work_num,
|
||||
'land_area_num' => $land_area_num,
|
||||
'sum_218' => $sum_218,
|
||||
'sum_217' => $sum_217,
|
||||
'sum_216' => $sum_216,
|
||||
'sum_215' => $sum_215,
|
||||
'sum_214' => $sum_214,
|
||||
'sum_70' => $sum_70,
|
||||
'sum_69' => $sum_69,
|
||||
]
|
||||
);
|
||||
return View();
|
||||
|
@ -1,100 +0,0 @@
|
||||
<?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\validate\KeywordsCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Keywords extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$where[] = ['status', '>=', 0];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$content = Db::name('Keywords')
|
||||
->order('create_time desc')
|
||||
->where($where)
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
return table_assign(0, '', $content);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//添加
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(KeywordsCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('Keywords')->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
}
|
||||
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(KeywordsCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$insertId = Db::name('Keywords')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($insertId) {
|
||||
add_log('add', $insertId, $param);
|
||||
}
|
||||
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id > 0) {
|
||||
$keywords = Db::name('Keywords')->where(['id' => $id])->find();
|
||||
View::assign('keywords', $keywords);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$data['status'] = '-1';
|
||||
$data['id'] = $id;
|
||||
$data['update_time'] = time();
|
||||
if (Db::name('Keywords')->update($data) !== false) {
|
||||
add_log('delete', $id, $data);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://blog.gougucms.com
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\BaseController;
|
||||
use app\admin\model\Links as linksList;
|
||||
use app\admin\validate\linksCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class links extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|name', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$where[] = ['status', '=', 1];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$links = linksList::where($where)
|
||||
->order('sort desc, id desc')
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
return table_assign(0, '', $links);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//添加
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(linksCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$res = linksList::where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
}
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(linksCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$sid = linksList::strict(false)->field(true)->insertGetId($param);
|
||||
if ($sid) {
|
||||
add_log('add', $sid, $param);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$id = empty($param['id']) ? 0 : $param['id'];
|
||||
if ($id > 0) {
|
||||
$links = Db::name('Links')->where(['id' => $id])->find();
|
||||
View::assign('links', $links);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$data['status'] = '-1';
|
||||
$data['id'] = $id;
|
||||
$data['update_time'] = time();
|
||||
if (Db::name('Links')->update($data) !== false) {
|
||||
add_log('delete', $id);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,181 +0,0 @@
|
||||
<?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\Nav as NavList;
|
||||
use app\admin\model\NavInfo;
|
||||
use app\admin\validate\NavCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Nav extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|name|title|desc', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$nav = NavList::where($where)
|
||||
->order('create_time asc')
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
return table_assign(0, '', $nav);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//添加
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(NavCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
NavList::where(['id' => $param['id']])
|
||||
->strict(false)
|
||||
->field(true)
|
||||
->update($param);
|
||||
// 删除导航缓存
|
||||
clear_cache('homeNav');
|
||||
add_log('edit', $param['id'], $param);
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(NavCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$nid = NavList::strict(false)->field(true)->insertGetId($param);
|
||||
// 删除导航缓存
|
||||
clear_cache('homeNav');
|
||||
add_log('add', $nid, $param);
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id > 0) {
|
||||
$nav = Db::name('Nav')->where(['id' => $id])->find();
|
||||
View::assign('nav', $nav);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
$id = get_params('id');
|
||||
$count = Db::name('NavInfo')->where(['nav_id' => $id])->count();
|
||||
if ($count > 0) {
|
||||
return to_assign(1, '该组下还有导航,无法删除');
|
||||
}
|
||||
if (Db::name('Nav')->delete($id) !== false) {
|
||||
return to_assign(0, '删除成功');
|
||||
// 删除导航缓存
|
||||
clear_cache('homeNav');
|
||||
add_log('delete', $id, []);
|
||||
} else {
|
||||
return to_assign(1, '删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
//管理导航
|
||||
public function nav_info()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$id = $param['id'];
|
||||
$navInfoList = Db::name('NavInfo')
|
||||
->where(['nav_id' => $id])
|
||||
->order('sort asc')
|
||||
->select();
|
||||
return to_assign(0, '', $navInfoList);
|
||||
} else {
|
||||
return view('', [
|
||||
'nav_id' => $param['id'],
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//添加导航
|
||||
public function nav_info_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(NavCheck::class)->scene('editInfo')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
NavInfo::strict(false)->field(true)->update($param);
|
||||
// 删除导航缓存
|
||||
clear_cache('homeNav');
|
||||
add_log('edit', $param['id'], $param);
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(NavCheck::class)->scene('addInfo')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$nid = NavInfo::strict(false)->field(true)->insertGetId($param);
|
||||
// 删除导航缓存
|
||||
clear_cache('homeNav');
|
||||
add_log('add', $nid, $param);
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$nid = isset($param['nid']) ? $param['nid'] : 0;
|
||||
$pid = isset($param['pid']) ? $param['pid'] : 0;
|
||||
if ($id > 0) {
|
||||
$nav = Db::name('NavInfo')->where(['id' => $id])->find();
|
||||
View::assign('nav', $nav);
|
||||
$nid = $nav['nav_id'];
|
||||
$pid = $nav['pid'];
|
||||
}
|
||||
View::assign('id', $id);
|
||||
View::assign('nav_id', $nid);
|
||||
View::assign('pid', $pid);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
public function nav_info_delete()
|
||||
{
|
||||
$id = get_params('id');
|
||||
if (Db::name('NavInfo')->delete($id) !== false) {
|
||||
//清除导航缓存
|
||||
clear_cache('homeNav');
|
||||
add_log('delete', $id, []);
|
||||
return to_assign(0, '删除成功');
|
||||
} else {
|
||||
return to_assign(1, '删除失败');
|
||||
}
|
||||
}
|
||||
}
|
@ -1,169 +0,0 @@
|
||||
<?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 PagesModel;
|
||||
use app\admin\validate\PagesValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Pages extends BaseController
|
||||
|
||||
{
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new PagesModel();
|
||||
$this->uid = get_login_admin('id');
|
||||
}
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
public function datalist()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = [];
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['a.id|a.title|a.desc|a.content', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$where[] = ['a.delete_time', '=', 0];
|
||||
$list = $this->model->getPagesList($where, $param);
|
||||
return table_assign(0, '', $list);
|
||||
}
|
||||
else{
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(PagesValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['admin_id'] = $this->uid;
|
||||
$this->model->addPages($param);
|
||||
}else{
|
||||
$templates = get_file_list(CMS_ROOT . '/app/home/view/pages/');
|
||||
View::assign('templates', $templates);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$param = get_params();
|
||||
|
||||
if (request()->isAjax()) {
|
||||
// 检验完整性
|
||||
try {
|
||||
validate(PagesValidate::class)->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$this->model->editPages($param);
|
||||
}else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getPagesById($id);
|
||||
if (!empty($detail)) {
|
||||
//轮播图
|
||||
if(!empty($detail['banner'])) {
|
||||
$detail['banner_array'] = explode(',',$detail['banner']);
|
||||
}
|
||||
//关键字
|
||||
$keyword_array = 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;
|
||||
|
||||
$templates = get_file_list(CMS_ROOT . '/app/home/view/pages/');
|
||||
View::assign('templates', $templates);
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看信息
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = $this->model->getPagesById($id);
|
||||
if (!empty($detail)) {
|
||||
//轮播图
|
||||
if(!empty($detail['banner'])) {
|
||||
$detail['banner_array'] = explode(',',$detail['banner']);
|
||||
}
|
||||
//关键字
|
||||
$keyword_array = 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;
|
||||
View::assign('detail', $detail);
|
||||
return view();
|
||||
}
|
||||
else{
|
||||
throw new \think\exception\HttpException(404, '找不到页面');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del()
|
||||
{
|
||||
$param = get_params();
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$type = isset($param['type']) ? $param['type'] : 0;
|
||||
|
||||
$this->model->delPagesById($id,$type);
|
||||
}
|
||||
}
|
@ -1,201 +0,0 @@
|
||||
<?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\Sitemap as SitemapInfo;
|
||||
use app\admin\model\SitemapCate;
|
||||
use app\admin\validate\SitemapCateCheck;
|
||||
use app\admin\validate\SitemapCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Sitemap extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|name', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$where[] = ['status', '=', 1];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$SitemapCate = SitemapCate::where($where)
|
||||
->order('sort desc, id desc')
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
return table_assign(0, '', $SitemapCate);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//添加
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(SitemapCateCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$res = SitemapCate::where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
}
|
||||
|
||||
// 删除菜单缓存
|
||||
clear_cache('homeSitemap');
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(SitemapCateCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$sid = SitemapCate::strict(false)->field(true)->insertGetId($param);
|
||||
if ($sid) {
|
||||
add_log('add', $sid, $param);
|
||||
}
|
||||
|
||||
// 删除菜单缓存
|
||||
clear_cache('homeSitemap');
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id > 0) {
|
||||
$cate = Db::name('SitemapCate')->where(['id' => $id])->find();
|
||||
View::assign('cate', $cate);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$where[] = ['sitemap_cate_id', '=', $id];
|
||||
$where[] = ['status', '>=', 0];
|
||||
$count = Db::name('Sitemap')->where($where)->count();
|
||||
if ($count > 0) {
|
||||
return to_assign(1, '该分类下还有数据,无法删除');
|
||||
}
|
||||
$data['status'] = '-1';
|
||||
$data['id'] = $id;
|
||||
$data['update_time'] = time();
|
||||
if (Db::name('SitemapCate')->update($data) !== false) {
|
||||
add_log('delete', $id);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
//管理网站地图
|
||||
public function sitemap_info()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$where = array();
|
||||
$where[] = ['sitemap_cate_id', '=', $param['id']];
|
||||
$where[] = ['status', '>=', 0];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$sitemap = SitemapInfo::where($where)
|
||||
->order('sort desc, id desc')
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
return table_assign(0, '', $sitemap);
|
||||
} else {
|
||||
return view('', [
|
||||
'sitemap_cate_id' => $param['id'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
//添加网站地图
|
||||
public function sitemap_info_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(SitemapCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$param['name'] = htmlspecialchars($param['name']);
|
||||
$res = SitemapInfo::where(['id' => $param['id']])->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
}
|
||||
|
||||
// 删除导航缓存
|
||||
clear_cache('homeSitemap');
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(SitemapCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['name'] = htmlspecialchars($param['name']);
|
||||
$param['create_time'] = time();
|
||||
$sid = SitemapInfo::strict(false)->field(true)->insertGetId($param);
|
||||
if ($sid) {
|
||||
add_log('add', $sid, $param);
|
||||
}
|
||||
|
||||
// 删除导航缓存
|
||||
clear_cache('homeSitemap');
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$sitemap_cate_id = isset($param['cid']) ? $param['cid'] : 0;
|
||||
if ($id > 0) {
|
||||
$sitemap = Db::name('Sitemap')->where(['id' => $id])->find();
|
||||
View::assign('sitemap', $sitemap);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
View::assign('sitemap_cate_id', $sitemap_cate_id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//删除网站地图
|
||||
public function sitemap_info_delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$data['status'] = '-1';
|
||||
$data['id'] = $id;
|
||||
$data['update_time'] = time();
|
||||
if (Db::name('Sitemap')->update($data) !== false) {
|
||||
add_log('delete', $id);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,211 +0,0 @@
|
||||
<?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\Slide as SlideList;
|
||||
use app\admin\model\SlideInfo;
|
||||
use app\admin\validate\SlideCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Slide extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['id|name|title|desc', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$slide = SlideList::where($where)
|
||||
->order('create_time asc')
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
return table_assign(0, '', $slide);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//添加
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(SlideCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$res = SlideList::where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
}
|
||||
|
||||
clear_cache('homeSlide');
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(SlideCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$sid = SlideList::strict(false)->field(true)->insertGetId($param);
|
||||
if ($sid) {
|
||||
add_log('add', $sid, $param);
|
||||
}
|
||||
|
||||
// 删除banner缓存
|
||||
clear_cache('homeSlide');
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id > 0) {
|
||||
$slide = Db::name('Slide')->where(['id' => $id])->find();
|
||||
View::assign('slide', $slide);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$count = Db::name('SlideInfo')->where([
|
||||
'slide_id' => $id,
|
||||
])->count();
|
||||
if ($count > 0) {
|
||||
return to_assign(1, '该组下还有Banner,无法删除');
|
||||
}
|
||||
if (Db::name('Slide')->delete($id) !== false) {
|
||||
add_log('delete', $id);
|
||||
clear_cache('homeSlide');
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
//管理幻灯片
|
||||
public function slide_info()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$where = array();
|
||||
$where[] = ['s.slide_id', '=', $param['id']];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$slideInfoList = SlideInfo::where($where)
|
||||
->alias('s')
|
||||
->join('File f', 's.img=f.id', 'LEFT')
|
||||
->field('s.*,f.filepath')
|
||||
->order('s.sort desc, s.id desc')
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
return table_assign(0, '', $slideInfoList);
|
||||
} else {
|
||||
return view('', [
|
||||
'slide_id' => $param['id'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
//幻灯片列表
|
||||
public function slide_info_list()
|
||||
{
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
$where[] = ['s.slide_id', '=', $param['id']];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$slideInfoList = SlideInfo::where($where)
|
||||
->alias('s')
|
||||
->join('File f', 's.img=f.id', 'LEFT')
|
||||
->field('s.*,f.filepath')
|
||||
->order('s.sort desc, s.id desc')
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
return table_assign(0, '', $slideInfoList);
|
||||
}
|
||||
|
||||
//添加幻灯片
|
||||
public function slide_info_add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
try {
|
||||
validate(SlideCheck::class)->scene('editInfo')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$res = SlideInfo::where(['id' => $param['id']])->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
}
|
||||
|
||||
// 删除缓存
|
||||
clear_cache('homeSlide');
|
||||
return to_assign();
|
||||
} else {
|
||||
try {
|
||||
validate(SlideCheck::class)->scene('addInfo')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$sid = SlideInfo::strict(false)->field(true)->insertGetId($param);
|
||||
if ($sid) {
|
||||
add_log('add', $sid, $param);
|
||||
}
|
||||
|
||||
// 删除缓存
|
||||
clear_cache('homeSlide');
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$slide_id = isset($param['sid']) ? $param['sid'] : 0;
|
||||
if ($id > 0) {
|
||||
$slide_info = Db::name('SlideInfo')->where(['id' => $id])->find();
|
||||
View::assign('slide_info', $slide_info);
|
||||
$slide_id = $slide_info['slide_id'];
|
||||
}
|
||||
View::assign('id', $id);
|
||||
View::assign('slide_id', $slide_id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//删除幻灯片
|
||||
public function slide_info_delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
if (Db::name('SlideInfo')->delete($id) !== false) {
|
||||
add_log('delete', $id);
|
||||
clear_cache('homeSlide');
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,193 +0,0 @@
|
||||
<?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\User as UserList;
|
||||
use dateset\Dateset;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class User extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['nickname|username|name|mobile|province|city', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
|
||||
//按时间检索
|
||||
$start_time = isset($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0;
|
||||
$end_time = isset($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0;
|
||||
|
||||
if ($start_time > 0 && $end_time > 0) {
|
||||
if ($start_time === $end_time) {
|
||||
$where[] = ['register_time', '=', $start_time];
|
||||
} else {
|
||||
$where[] = ['register_time', '>=', $start_time];
|
||||
$where[] = ['register_time', '<=', $end_time];
|
||||
}
|
||||
} elseif ($start_time > 0 && $end_time == 0) {
|
||||
$where[] = ['register_time', '>=', $start_time];
|
||||
} elseif ($start_time == 0 && $end_time > 0) {
|
||||
$where[] = ['register_time', '<=', $end_time];
|
||||
}
|
||||
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$content = UserList::where($where)
|
||||
->order('id desc')
|
||||
->paginate($rows, false, ['query' => $param])
|
||||
->each(function ($item, $key) {
|
||||
$item->register_time = empty($item->register_time) ? '-' : date('Y-m-d H:i', $item->register_time);
|
||||
$item->level_name = Db::name('UserLevel')->where(['id' => $item->level])->value('title');
|
||||
});
|
||||
return table_assign(0, '', $content);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//编辑
|
||||
public function edit()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$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);
|
||||
return to_assign();
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
//查看
|
||||
public function view()
|
||||
{
|
||||
$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');
|
||||
add_log('view', get_params('id'));
|
||||
View::assign('user', $user);
|
||||
return view();
|
||||
}
|
||||
//禁用/启用
|
||||
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) {
|
||||
if ($data['status'] == 0) {
|
||||
add_log('disable', $id, $data);
|
||||
} else if ($data['status'] == 1) {
|
||||
add_log('recovery', $id, $data);
|
||||
}
|
||||
return to_assign();
|
||||
} else {
|
||||
return to_assign(1, "操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
//日志
|
||||
public function log()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['nickname|content|param_id', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['action'])) {
|
||||
$where[] = ['title', '=', $param['action']];
|
||||
}
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$content = DB::name('UserLog')
|
||||
->field("id,uid,nickname,title,content,ip,param_id,param,FROM_UNIXTIME(create_time,'%Y-%m-%d %H:%i:%s') create_time")
|
||||
->order('create_time desc')
|
||||
->where($where)
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
|
||||
$content->toArray();
|
||||
foreach ($content as $k => $v) {
|
||||
$data = $v;
|
||||
$param_array = json_decode($v['param'], true);
|
||||
$param_value = '';
|
||||
foreach ($param_array as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$value = array_to_string($value);
|
||||
}
|
||||
$param_value .= $key . ':' . $value . ' | ';
|
||||
}
|
||||
$data['param'] = $param_value;
|
||||
$content->offsetSet($k, $data);
|
||||
}
|
||||
return table_assign(0, '', $content);
|
||||
} else {
|
||||
$type_action = get_config('log.user_action');
|
||||
View::assign('type_action', $type_action);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//记录
|
||||
public function record()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['nickname|title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$content = Db::name('UserLog')
|
||||
->field("id,uid,nickname,title,content,ip,param,create_time")
|
||||
->order('create_time desc')
|
||||
->where($where)
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
|
||||
$content->toArray();
|
||||
$date_set = new Dateset();
|
||||
foreach ($content as $k => $v) {
|
||||
$data = $v;
|
||||
$param_array = json_decode($v['param'], true);
|
||||
$name = '';
|
||||
if (!empty($param_array['name'])) {
|
||||
$name = ':' . $param_array['name'];
|
||||
}
|
||||
if (!empty($param_array['title'])) {
|
||||
$name = ':' . $param_array['title'];
|
||||
}
|
||||
$data['content'] = $v['content'] . $name;
|
||||
$data['times'] = $date_set->time_trans($v['create_time']);
|
||||
$content->offsetSet($k, $data);
|
||||
}
|
||||
return table_assign(0, '', $content);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -119,7 +119,7 @@ class User extends BaseController
|
||||
} else {
|
||||
$user_address['area_id'] = '';
|
||||
$user_address['street_id'] = '';
|
||||
$user_address['village_code'] = '';
|
||||
$user_address['village_id'] = '';
|
||||
$user_address['auth_range'] = '1';
|
||||
$select = Db::table('fa_geo_area')->where('city_code', '510500')->select();
|
||||
View::assign('row', $user_address);
|
||||
@ -129,7 +129,7 @@ class User extends BaseController
|
||||
} else {
|
||||
$user_address['area_id'] = '';
|
||||
$user_address['street_id'] = '';
|
||||
$user_address['village_code'] = '';
|
||||
$user_address['village_id'] = '';
|
||||
$user_address['auth_range'] = '';
|
||||
$select = Db::table('fa_geo_area')->where('city_code', '510500')->select();
|
||||
View::assign('row', $user_address);
|
||||
@ -745,13 +745,13 @@ class User extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
if ($post['village_id'] != '') {
|
||||
if (!empty($post['village_id'])) {
|
||||
$where['village_id'] = $post['village_id'];
|
||||
}
|
||||
if ($post['brigade_id'] != '') {
|
||||
if (!empty($post['brigade_id'])) {
|
||||
$where['brigade_id'] = $post['brigade_id'];
|
||||
}
|
||||
if ($post['street_id'] != '') {
|
||||
if (!empty($post['street_id'])) {
|
||||
$where['street_id'] = $post['street_id'];
|
||||
}
|
||||
$where['area_id'] = $post['area_id'];
|
||||
|
@ -1,140 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
use think\model;
|
||||
use app\admin\model\Keywords;
|
||||
use think\facade\Db;
|
||||
class Article extends Model
|
||||
{
|
||||
|
||||
public static $Type = ['普通','精华','热门','推荐'];
|
||||
|
||||
//插入关键字
|
||||
public function insertKeyword($keywordArray = [], $aid = 0)
|
||||
{
|
||||
$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 = Db::name('ArticleKeywords')->strict(false)->field(true)->insertAll($insert);
|
||||
}
|
||||
/**
|
||||
* 获取分页列表
|
||||
* @param $where
|
||||
* @param $param
|
||||
*/
|
||||
public function getArticleList($where, $param)
|
||||
{
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$order = empty($param['order']) ? 'a.id desc' : $param['order'];
|
||||
$list = self::where($where)
|
||||
->field('a.*,c.id as cate_id,c.title as cate_title,u.nickname as admin_name')
|
||||
->alias('a')
|
||||
->join('ArticleCate c', 'a.cate_id = c.id')
|
||||
->join('Admin u', 'a.admin_id = u.id')
|
||||
->order($order)
|
||||
->paginate($rows, false, ['query' => $param])
|
||||
->each(function ($item, $key) {
|
||||
$type = (int)$item->type;
|
||||
$item->type_str = self::$Type[$type];
|
||||
});
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
* @param $param
|
||||
*/
|
||||
public function addArticle($param)
|
||||
{
|
||||
$insertId = 0;
|
||||
try {
|
||||
$param['create_time'] = time();
|
||||
$insertId = $this->strict(false)->field(true)->insertGetId($param);
|
||||
//关联关键字
|
||||
if (isset($param['keyword_names']) && $param['keyword_names']) {
|
||||
$keywordArray = explode(',', $param['keyword_names']);
|
||||
$res_keyword = $this->insertKeyword($keywordArray,$insertId);
|
||||
}
|
||||
add_log('add', $insertId, $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign(0,'操作成功',['aid'=>$insertId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑信息
|
||||
* @param $param
|
||||
*/
|
||||
public function editArticle($param)
|
||||
{
|
||||
try {
|
||||
$param['update_time'] = time();
|
||||
$this->where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
//关联关键字
|
||||
if (isset($param['keyword_names']) && $param['keyword_names']) {
|
||||
\think\facade\Db::name('ArticleKeywords')->where(['aid'=>$param['id']])->delete();
|
||||
$keywordArray = explode(',', $param['keyword_names']);
|
||||
$res_keyword = $this->insertKeyword($keywordArray,$param['id']);
|
||||
}
|
||||
add_log('edit', $param['id'], $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取信息
|
||||
* @param $id
|
||||
*/
|
||||
public function getArticleById($id)
|
||||
{
|
||||
$info = $this->where('id', $id)->find();
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
* @param $id
|
||||
* @return array
|
||||
*/
|
||||
public function delArticleById($id,$type=0)
|
||||
{
|
||||
if($type==0){
|
||||
//逻辑删除
|
||||
try {
|
||||
$param['delete_time'] = time();
|
||||
$this->where('id', $id)->update(['delete_time'=>time()]);
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
else{
|
||||
//物理删除
|
||||
try {
|
||||
$this->where('id', $id)->delete();
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
|
@ -1,100 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
use think\model;
|
||||
class ArticleCate extends Model
|
||||
{
|
||||
/**
|
||||
* 获取分页列表
|
||||
* @param $where
|
||||
* @param $param
|
||||
*/
|
||||
public function getArticleCateList($where, $param)
|
||||
{
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$order = empty($param['order']) ? 'id desc' : $param['order'];
|
||||
try {
|
||||
$list = $this->where($where)->order($order)->paginate($rows, false, ['query' => $param]);
|
||||
return table_assign(0, '', $list);
|
||||
} catch(\Exception $e) {
|
||||
return ['code' => 1, 'data' => [], 'msg' => $e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
* @param $param
|
||||
*/
|
||||
public function addArticleCate($param)
|
||||
{
|
||||
$insertId = 0;
|
||||
try {
|
||||
$param['create_time'] = time();
|
||||
$insertId = $this->insertGetId($param);
|
||||
add_log('add', $insertId, $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign(0,'操作成功',['aid'=>$insertId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑信息
|
||||
* @param $param
|
||||
*/
|
||||
public function editArticleCate($param)
|
||||
{
|
||||
try {
|
||||
$param['update_time'] = time();
|
||||
$this->where('id', $param['id'])->update($param);
|
||||
add_log('edit', $param['id'], $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取信息
|
||||
* @param $id
|
||||
*/
|
||||
public function getArticleCateById($id)
|
||||
{
|
||||
$info = $this->where('id', $id)->find();
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
* @param $id
|
||||
* @param $type
|
||||
*/
|
||||
public function delArticleCateById($id,$type=0)
|
||||
{
|
||||
if($type==0){
|
||||
//逻辑删除
|
||||
try {
|
||||
$this->where('id', $id)->update(['delete_time'=>time()]);
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
else{
|
||||
//物理删除
|
||||
try {
|
||||
$this->where('id', $id)->delete();
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
|
@ -1,203 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
use think\model;
|
||||
use app\admin\model\Keywords;
|
||||
use think\facade\Db;
|
||||
class Gallery extends Model
|
||||
{
|
||||
public static $Type = ['普通','精华','热门','推荐'];
|
||||
|
||||
//插入关键字
|
||||
public function insertKeyword($keywordArray = [], $aid = 0)
|
||||
{
|
||||
$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 = Db::name('GalleryKeywords')->strict(false)->field(true)->insertAll($insert);
|
||||
}
|
||||
/**
|
||||
* 获取分页列表
|
||||
* @param $where
|
||||
* @param $param
|
||||
*/
|
||||
public function getGalleryList($where, $param)
|
||||
{
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$order = empty($param['order']) ? 'a.id desc' : $param['order'];
|
||||
$list = self::where($where)
|
||||
->field('a.*,c.title as cate_title,u.nickname as admin_name')
|
||||
->alias('a')
|
||||
->join('ArticleCate c', 'a.cate_id = c.id')
|
||||
->join('Admin u', 'a.admin_id = u.id')
|
||||
->order($order)
|
||||
->paginate($rows, false, ['query' => $param])
|
||||
->each(function ($item, $key) {
|
||||
$type = (int)$item->type;
|
||||
$item->type_str = self::$Type[$type];
|
||||
$item->count = Db::name('GalleryFile')->where(array('aid'=>$item->id))->count();
|
||||
});
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
* @param $param
|
||||
*/
|
||||
public function addGallery($param)
|
||||
{
|
||||
$insertId = 0;
|
||||
try {
|
||||
$param['create_time'] = time();
|
||||
$insertId = $this->strict(false)->field(true)->insertGetId($param);
|
||||
//关联关键字
|
||||
if (isset($param['keyword_names']) && $param['keyword_names']) {
|
||||
$keywordArray = explode(',', $param['keyword_names']);
|
||||
$res_keyword = $this->insertKeyword($keywordArray,$insertId);
|
||||
}
|
||||
|
||||
//图集数据
|
||||
$filepathData = isset($param['img_filepath']) ? $param['img_filepath'] : '';
|
||||
$titleData = isset($param['img_title']) ? $param['img_title'] : '';
|
||||
$idData = isset($param['img_id']) ? $param['img_id'] : 0;
|
||||
$nameData = isset($param['img_name']) ? $param['img_name'] : '';
|
||||
$descData = isset($param['img_desc']) ? $param['img_desc'] : '';
|
||||
$linkData = isset($param['img_link']) ? $param['img_link'] : '';
|
||||
$sortData = isset($param['img_sort']) ? $param['img_sort'] : 0;
|
||||
$fileData = isset($param['img_file']) ? $param['img_file'] : 0;
|
||||
//插入图集数据
|
||||
$insertData = [];
|
||||
if(is_array($filepathData)){
|
||||
foreach ($filepathData as $key => $value) {
|
||||
if (!$value) {
|
||||
continue;
|
||||
}
|
||||
$file = [];
|
||||
$file['aid'] = $insertId;
|
||||
$file['title'] = $titleData[$key];
|
||||
$file['desc'] = $descData[$key];
|
||||
$file['link'] = $linkData[$key];
|
||||
$file['sort'] = $sortData[$key];
|
||||
$file['file_id'] = $fileData[$key];
|
||||
$file['filepath'] = $filepathData[$key];
|
||||
$file['name'] = $nameData[$key];
|
||||
$file['create_time'] = time();
|
||||
$insertData[] = $file;
|
||||
}
|
||||
Db::name('GalleryFile')->strict(false)->field(true)->insertAll($insertData);
|
||||
}
|
||||
add_log('add', $insertId, $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign(0,'操作成功',['aid'=>$insertId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑信息
|
||||
* @param $param
|
||||
*/
|
||||
public function editGallery($param)
|
||||
{
|
||||
try {
|
||||
$param['update_time'] = time();
|
||||
$this->where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
//关联关键字
|
||||
if (isset($param['keyword_names']) && $param['keyword_names']) {
|
||||
Db::name('GalleryKeywords')->where(['aid'=>$param['id']])->delete();
|
||||
$keywordArray = explode(',', $param['keyword_names']);
|
||||
$res_keyword = $this->insertKeyword($keywordArray,$param['id']);
|
||||
}
|
||||
|
||||
//图集数据
|
||||
$filepathData = isset($param['img_filepath']) ? $param['img_filepath'] : '';
|
||||
$titleData = isset($param['img_title']) ? $param['img_title'] : '';
|
||||
$idData = isset($param['img_id']) ? $param['img_id'] : 0;
|
||||
$nameData = isset($param['img_name']) ? $param['img_name'] : '';
|
||||
$descData = isset($param['img_desc']) ? $param['img_desc'] : '';
|
||||
$linkData = isset($param['img_link']) ? $param['img_link'] : 0;
|
||||
$sortData = isset($param['img_sort']) ? $param['img_sort'] : 0;
|
||||
$fileData = isset($param['img_file']) ? $param['img_file'] : 0;
|
||||
//插入图集数据
|
||||
if ($filepathData) {
|
||||
Db::name('GalleryFile')->where(['aid'=>$param['id']])->delete();
|
||||
$insertData = [];
|
||||
foreach ($filepathData as $key => $value) {
|
||||
if (!$value) {
|
||||
continue;
|
||||
}
|
||||
$file = [];
|
||||
$file['aid'] = $param['id'];
|
||||
$file['title'] = $titleData[$key];
|
||||
$file['desc'] = $descData[$key];
|
||||
$file['link'] = $linkData[$key];
|
||||
$file['sort'] = $sortData[$key];
|
||||
$file['file_id'] = $fileData[$key];
|
||||
$file['filepath'] = $filepathData[$key];
|
||||
$file['name'] = $nameData[$key];
|
||||
$file['create_time'] = time();
|
||||
$insertData[] = $file;
|
||||
}
|
||||
$res = Db::name('GalleryFile')->strict(false)->field(true)->insertAll($insertData);
|
||||
}
|
||||
add_log('edit', $param['id'], $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取信息
|
||||
* @param $id
|
||||
*/
|
||||
public function getGalleryById($id)
|
||||
{
|
||||
$info = $this->where('id', $id)->find();
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
* @param $id
|
||||
* @return array
|
||||
*/
|
||||
public function delGalleryById($id,$type=0)
|
||||
{
|
||||
if($type==0){
|
||||
//逻辑删除
|
||||
try {
|
||||
$param['delete_time'] = time();
|
||||
$this->where('id', $id)->update(['delete_time'=>time()]);
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
else{
|
||||
//物理删除
|
||||
try {
|
||||
$this->where('id', $id)->delete();
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
|
@ -1,101 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
use think\model;
|
||||
class GalleryCate extends Model
|
||||
{
|
||||
/**
|
||||
* 获取分页列表
|
||||
* @param $where
|
||||
* @param $param
|
||||
*/
|
||||
public function getGalleryCateList($where, $param)
|
||||
{
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$order = empty($param['order']) ? 'id desc' : $param['order'];
|
||||
try {
|
||||
$list = $this->where($where)->order($order)->paginate($rows, false, ['query' => $param]);
|
||||
return $list;
|
||||
} catch(\Exception $e) {
|
||||
return ['code' => 1, 'data' => [], 'msg' => $e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
* @param $param
|
||||
*/
|
||||
public function addGalleryCate($param)
|
||||
{
|
||||
$insertId = 0;
|
||||
try {
|
||||
$param['create_time'] = time();
|
||||
$insertId = $this->strict(false)->field(true)->insertGetId($param);
|
||||
add_log('add', $insertId, $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign(0,'操作成功',['aid'=>$insertId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑信息
|
||||
* @param $param
|
||||
*/
|
||||
public function editGalleryCate($param)
|
||||
{
|
||||
try {
|
||||
$param['update_time'] = time();
|
||||
$this->where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
add_log('edit', $param['id'], $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取信息
|
||||
* @param $id
|
||||
*/
|
||||
public function getGalleryCateById($id)
|
||||
{
|
||||
$info = $this->where('id', $id)->find();
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
* @param $id
|
||||
* @return array
|
||||
*/
|
||||
public function delGalleryCateById($id,$type=0)
|
||||
{
|
||||
if($type==0){
|
||||
//逻辑删除
|
||||
try {
|
||||
$param['delete_time'] = time();
|
||||
$this->where('id', $id)->update(['delete_time'=>time()]);
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
else{
|
||||
//物理删除
|
||||
try {
|
||||
$this->where('id', $id)->delete();
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
|
@ -1,138 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
use think\model;
|
||||
class Goods extends Model
|
||||
{
|
||||
public static $Type = ['普通','精华','热门','推荐'];
|
||||
|
||||
//插入关键字
|
||||
public function insertKeyword($keywordArray = [], $aid = 0)
|
||||
{
|
||||
$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('GoodsKeywords')->strict(false)->field(true)->insertAll($insert);
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* 获取分页列表
|
||||
* @param $where
|
||||
* @param $param
|
||||
*/
|
||||
public function getGoodsList($where, $param)
|
||||
{
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$order = empty($param['order']) ? 'a.id desc' : $param['order'];
|
||||
$list = self::where($where)
|
||||
->field('a.*,c.title as cate_title,u.nickname as admin_name')
|
||||
->alias('a')
|
||||
->join('GoodsCate c', 'a.cate_id = c.id')
|
||||
->join('Admin u', 'a.admin_id = u.id')
|
||||
->order($order)
|
||||
->paginate($rows, false, ['query' => $param])
|
||||
->each(function ($item, $key) {
|
||||
$type = (int)$item->type;
|
||||
$item->type_str = self::$Type[$type];
|
||||
});
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
* @param $param
|
||||
*/
|
||||
public function addGoods($param)
|
||||
{
|
||||
$insertId = 0;
|
||||
try {
|
||||
$param['create_time'] = time();
|
||||
$insertId = $this->strict(false)->field(true)->insertGetId($param);
|
||||
//关联关键字
|
||||
if (isset($param['keyword_names']) && $param['keyword_names']) {
|
||||
$keywordArray = explode(',', $param['keyword_names']);
|
||||
$res_keyword = $this->insertKeyword($keywordArray,$insertId);
|
||||
}
|
||||
add_log('add', $insertId, $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign(0,'操作成功',['aid'=>$insertId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑信息
|
||||
* @param $param
|
||||
*/
|
||||
public function editGoods($param)
|
||||
{
|
||||
try {
|
||||
$param['update_time'] = time();
|
||||
$this->where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
//关联关键字
|
||||
if (isset($param['keyword_names']) && $param['keyword_names']) {
|
||||
\think\facade\Db::name('GoodsKeywords')->where(['aid'=>$param['id']])->delete();
|
||||
$keywordArray = explode(',', $param['keyword_names']);
|
||||
$res_keyword = $this->insertKeyword($keywordArray,$param['id']);
|
||||
}
|
||||
add_log('edit', $param['id'], $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取信息
|
||||
* @param $id
|
||||
*/
|
||||
public function getGoodsById($id)
|
||||
{
|
||||
$info = $this->where('id', $id)->find();
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
* @param $id
|
||||
* @return array
|
||||
*/
|
||||
public function delGoodsById($id,$type=0)
|
||||
{
|
||||
if($type==0){
|
||||
//逻辑删除
|
||||
try {
|
||||
$param['delete_time'] = time();
|
||||
$this->where('id', $id)->update(['delete_time'=>time()]);
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
else{
|
||||
//物理删除
|
||||
try {
|
||||
$this->where('id', $id)->delete();
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
|
@ -1,101 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
use think\model;
|
||||
class GoodsCate extends Model
|
||||
{
|
||||
/**
|
||||
* 获取分页列表
|
||||
* @param $where
|
||||
* @param $param
|
||||
*/
|
||||
public function getGoodsCateList($where, $param)
|
||||
{
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$order = empty($param['order']) ? 'id desc' : $param['order'];
|
||||
try {
|
||||
$list = $this->where($where)->order($order)->paginate($rows, false, ['query' => $param]);
|
||||
return $list;
|
||||
} catch(\Exception $e) {
|
||||
return ['code' => 1, 'data' => [], 'msg' => $e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
* @param $param
|
||||
*/
|
||||
public function addGoodsCate($param)
|
||||
{
|
||||
$insertId = 0;
|
||||
try {
|
||||
$param['create_time'] = time();
|
||||
$insertId = $this->strict(false)->field(true)->insertGetId($param);
|
||||
add_log('add', $insertId, $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign(0,'操作成功',['aid'=>$insertId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑信息
|
||||
* @param $param
|
||||
*/
|
||||
public function editGoodsCate($param)
|
||||
{
|
||||
try {
|
||||
$param['update_time'] = time();
|
||||
$this->where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
add_log('edit', $param['id'], $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取信息
|
||||
* @param $id
|
||||
*/
|
||||
public function getGoodsCateById($id)
|
||||
{
|
||||
$info = $this->where('id', $id)->find();
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
* @param $id
|
||||
* @return array
|
||||
*/
|
||||
public function delGoodsCateById($id,$type=0)
|
||||
{
|
||||
if($type==0){
|
||||
//逻辑删除
|
||||
try {
|
||||
$param['delete_time'] = time();
|
||||
$this->where('id', $id)->update(['delete_time'=>time()]);
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
else{
|
||||
//物理删除
|
||||
try {
|
||||
$this->where('id', $id)->delete();
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
// 关键字模型
|
||||
class Keywords extends Model
|
||||
{
|
||||
// 关联关键字
|
||||
public function increase($keywords)
|
||||
{
|
||||
$is_exist = $this->where('title', $keywords)->find();
|
||||
if ($is_exist) {
|
||||
$res = $is_exist['id'];
|
||||
} else {
|
||||
$res = $this->strict(false)->field(true)->insertGetId(['title' => $keywords, 'create_time' => time()]);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://blog.gougucms.com
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Links extends Model
|
||||
{
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Nav extends Model
|
||||
{
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class NavInfo extends Model
|
||||
{
|
||||
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
namespace app\admin\model;
|
||||
use think\model;
|
||||
class Pages extends Model
|
||||
{
|
||||
//插入关键字
|
||||
public function insertKeyword($keywordArray = [], $aid = 0)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
/**
|
||||
* 获取分页列表
|
||||
* @param $where
|
||||
* @param $param
|
||||
*/
|
||||
public function getPagesList($where, $param)
|
||||
{
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$order = empty($param['order']) ? 'id desc' : $param['order'];
|
||||
$list = $this->where($where)
|
||||
->field('a.*,u.nickname as admin_name')
|
||||
->alias('a')
|
||||
->leftJoin('Admin u', 'a.admin_id = u.id')
|
||||
->order($order)
|
||||
->paginate($rows, false, ['query' => $param]);
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
* @param $param
|
||||
*/
|
||||
public function addPages($param)
|
||||
{
|
||||
$insertId = 0;
|
||||
try {
|
||||
$param['create_time'] = time();
|
||||
$insertId = $this->strict(false)->field(true)->insertGetId($param);
|
||||
//关联关键字
|
||||
if (isset($param['keyword_names']) && $param['keyword_names']) {
|
||||
$keywordArray = explode(',', $param['keyword_names']);
|
||||
$res_keyword = $this->insertKeyword($keywordArray,$insertId);
|
||||
}
|
||||
add_log('add', $insertId, $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign(0,'操作成功',['aid'=>$insertId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑信息
|
||||
* @param $param
|
||||
*/
|
||||
public function editPages($param)
|
||||
{
|
||||
try {
|
||||
$param['update_time'] = time();
|
||||
$this->where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
//关联关键字
|
||||
if (isset($param['keyword_names']) && $param['keyword_names']) {
|
||||
\think\facade\Db::name('PagesKeywords')->where(['aid'=>$param['id']])->delete();
|
||||
$keywordArray = explode(',', $param['keyword_names']);
|
||||
$res_keyword = $this->insertKeyword($keywordArray,$param['id']);
|
||||
}
|
||||
add_log('edit', $param['id'], $param);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取信息
|
||||
* @param $id
|
||||
*/
|
||||
public function getPagesById($id)
|
||||
{
|
||||
$info = $this->where('id', $id)->find();
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信息
|
||||
* @param $id
|
||||
* @return array
|
||||
*/
|
||||
public function delPagesById($id,$type=0)
|
||||
{
|
||||
if($type==0){
|
||||
//逻辑删除
|
||||
try {
|
||||
$param['delete_time'] = time();
|
||||
$this->where('id', $id)->update(['delete_time'=>time()]);
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
else{
|
||||
//物理删除
|
||||
try {
|
||||
$this->where('id', $id)->delete();
|
||||
add_log('delete', $id);
|
||||
} catch(\Exception $e) {
|
||||
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Sitemap extends Model
|
||||
{
|
||||
protected $append = ['pc_img_url', 'mobile_img_url'];
|
||||
protected $resultSetType = 'collection';
|
||||
/**
|
||||
* 获取pc图片链接
|
||||
* @param string $pc_img_url 转换pc图片链接
|
||||
*/
|
||||
public function getPcImgUrlAttr($value, $data)
|
||||
{
|
||||
return get_file($data['pc_img']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获mobile图片链接
|
||||
* @param string mobile_img_url 转mobile图片链接
|
||||
*/
|
||||
public function getMobileImgUrlAttr($value, $data)
|
||||
{
|
||||
return get_file($data['mobile_img']);
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class SitemapCate extends Model
|
||||
{
|
||||
/**
|
||||
* 关联网站地图
|
||||
* @param [type] $value [description]
|
||||
*/
|
||||
public function sitemap()
|
||||
{
|
||||
return $this->hasMany('sitemap', 'sitemap_cate_id', 'id')->order('sort desc, id desc');
|
||||
}
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Slide extends Model
|
||||
{
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class SlideInfo extends Model
|
||||
{
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?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;
|
||||
use think\facade\Db;
|
||||
|
||||
class ArticleCateValidate extends Validate
|
||||
{
|
||||
// 自定义验证规则
|
||||
protected function checkOne($value,$rule,$data=[])
|
||||
{
|
||||
$count = Db::name('ArticleCate')->where([['title','=',$data['title']],['id','<>',$data['id']],['delete_time','=',0]])->count();
|
||||
return $count == 0 ? true : false;
|
||||
}
|
||||
|
||||
protected $rule = [
|
||||
'title' => 'require|checkOne',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '分类名称不能为空',
|
||||
'title.checkOne' => '同样的分类名称已经存在',
|
||||
];
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?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 ArticleValidate extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'cate_id' => 'require',
|
||||
'title' => 'require',
|
||||
'thumb' => 'require',
|
||||
'content' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'cate_id.require' => '所属分类不能为空',
|
||||
'title.require' => '文章标题不能为空',
|
||||
'thumb.require' => '缩略图不能为空',
|
||||
'content.require' => '文章内容不能为空',
|
||||
];
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?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;
|
||||
use think\facade\Db;
|
||||
|
||||
class GalleryCateValidate extends Validate
|
||||
{
|
||||
// 自定义验证规则
|
||||
protected function checkOne($value,$rule,$data=[])
|
||||
{
|
||||
$count = Db::name('GalleryCate')->where([['title','=',$data['title']],['id','<>',$data['id']],['delete_time','=',0]])->count();
|
||||
return $count == 0 ? true : false;
|
||||
}
|
||||
|
||||
protected $rule = [
|
||||
'title' => 'require|checkOne',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '分类名称不能为空',
|
||||
'title.checkOne' => '同样的分类名称已经存在',
|
||||
];
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<?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 GalleryValidate extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'cate_id' => 'require',
|
||||
'title' => 'require',
|
||||
'thumb' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'cate_id.require' => '所属分类不能为空',
|
||||
'title.require' => '图集名称不能为空',
|
||||
'thumb.require' => '缩略图不能为空',
|
||||
];
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
<?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 GoodsCateValidate extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '分类名称不能为空',
|
||||
];
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
<?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 GoodsValidate extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'cate_id' => 'require',
|
||||
'title' => 'require',
|
||||
'thumb' => 'require',
|
||||
'content' => 'require',
|
||||
'base_price' => 'require',
|
||||
'price' => 'require',
|
||||
'stocks' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'cate_id.require' => '所属分类不能为空',
|
||||
'title.require' => '商品名称不能为空',
|
||||
'thumb.require' => '缩略图不能为空',
|
||||
'content.require' => '商品描述不能为空',
|
||||
'base_price.require' => '市场价格不能为空',
|
||||
'price.require' => '实际价格不能为空',
|
||||
'stocks.require' => '商品库存不能为空',
|
||||
];
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\facade\Db;
|
||||
use think\Validate;
|
||||
|
||||
class KeywordsCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:keywords',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '关键字名称不能为空',
|
||||
'title.unique' => '同样的关键字名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title'],
|
||||
'edit' => ['id', 'title'],
|
||||
];
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
<?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 NavCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:nav',
|
||||
'name' => 'require|unique:nav',
|
||||
'id' => 'require',
|
||||
'status' => 'require',
|
||||
'slide_id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '标题不能为空',
|
||||
'title.unique' => '同样的标题已经存在',
|
||||
'name.require' => '标识不能为空',
|
||||
'name.unique' => '同样的标识已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
'status.require' => '状态为必选',
|
||||
'slide_id.require' => '缺少导航组ID',
|
||||
'filed.require' => '缺少要更新的字段名',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'name', 'status'],
|
||||
'edit' => ['id', 'title', 'name', 'status'],
|
||||
'addInfo' => ['title', 'nav_id'],
|
||||
'editInfo' => ['id', 'title'],
|
||||
];
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?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 PagesValidate extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'content' => 'require',
|
||||
'name' => 'lower|min:3|unique:pages',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '页面名称不能为空',
|
||||
'content.require' => '页面内容不能为空',
|
||||
'name.lower' => 'URL文件名称只能是小写字符',
|
||||
'name.min' => 'URL文件名称至少需要3个小写字符',
|
||||
'name.unique' => '同样的URL文件名称已经存在',
|
||||
];
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?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 SitemapCateCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'name' => 'require|unique:sitemap_cate',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '名称不能为空',
|
||||
'name.unique' => '同样的名称已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['name'],
|
||||
'edit' => ['id', 'name'],
|
||||
];
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<?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 SitemapCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'name' => 'require',
|
||||
'id' => 'require',
|
||||
'sitemap_cate_id' => 'require',
|
||||
'pc_img' => 'require',
|
||||
'pc_src' => 'require|url',
|
||||
'mobile_img' => 'require',
|
||||
'mobile_src' => 'require|url',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '名称不能为空',
|
||||
'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' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['sitemap_cate_id', 'name', 'pc_src', 'mobile_src'],
|
||||
'edit' => ['id', 'name', 'pc_src', 'mobile_src'],
|
||||
];
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<?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 SlideCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'title' => 'require|unique:slide',
|
||||
'name' => 'require|unique:slide',
|
||||
'id' => 'require',
|
||||
'status' => 'require',
|
||||
'img' => 'require',
|
||||
'slide_id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'title.require' => '标题不能为空',
|
||||
'title.unique' => '同样的标题已经存在',
|
||||
'name.require' => '标识不能为空',
|
||||
'name.unique' => '同样的标识已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
'status.require' => '状态为必选',
|
||||
'img.require' => '请上传图片',
|
||||
'slide_id.require' => '缺少换灯组ID',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['title', 'name', 'status'],
|
||||
'edit' => ['id', 'title', 'name', 'status'],
|
||||
'addInfo' => ['title', 'img', 'status', 'slide_id'],
|
||||
'editInfo' => ['title', 'img', 'status', 'id'],
|
||||
];
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?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 UserCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'username' => 'require',
|
||||
'password' => 'require',
|
||||
'captcha' => 'require|captcha',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'username.require' => '用户名不能为空',
|
||||
'password.require' => '密码不能为空',
|
||||
'captcha.require' => '验证码不能为空',
|
||||
'captcha.captcha' => '验证码不正确',
|
||||
];
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/Apache-2.0
|
||||
* @link https://blog.gougucms.com
|
||||
*/
|
||||
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class linksCheck extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'name' => 'require|unique:links',
|
||||
'src' => 'require|url|unique:links',
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require' => '网站名称不能为空',
|
||||
'name.unique' => '同样的网站名称已经存在',
|
||||
'src' => '网站链接不能为空',
|
||||
'src.url' => '网站链接不是有效的URL地址',
|
||||
'src.unique' => '同样的网站链接已经存在',
|
||||
'id.require' => '缺少更新条件',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'add' => ['name', 'src'],
|
||||
'edit' => ['id', 'name', 'src'],
|
||||
];
|
||||
}
|
@ -1,210 +0,0 @@
|
||||
{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"}
|
||||
<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 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">文章分类<font>*</font></td>
|
||||
<td>
|
||||
<select name="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">关键字<font>*</font></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">状态<font>*</font></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-sm" id="upload_btn_thumb">上传缩略图(尺寸:640x360)</button>
|
||||
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
|
||||
<img src="" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" 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">文章内容<font>*</font><span class="ml-4 red">当前为TinyMCE富文本编辑器,可在【系统管理->系统配置->其他配置】中切换为mardown编辑器</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<textarea class="layui-textarea" id="container_content"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
{else/}
|
||||
<tr>
|
||||
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<font>*</font><span class="ml-4 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="pt-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}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
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;
|
||||
|
||||
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 upload_thumb = layui.upload.render({
|
||||
elem: '#upload_btn_thumb',
|
||||
url: '/admin/api/upload',
|
||||
done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code == 1) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
//上传成功
|
||||
$('#upload_box_thumb input').attr('value', res.data.id);
|
||||
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||
}
|
||||
});
|
||||
|
||||
if (editorType == 1) {
|
||||
var editor = layui.tinymce;
|
||||
var edit = editor.render({
|
||||
selector: "#container_content",
|
||||
height: 500
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||
if (data.field.content == '') {
|
||||
layer.msg('请先完善文章内容');
|
||||
return false;
|
||||
}
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(71);
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
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) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(71);
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/article/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,173 +0,0 @@
|
||||
{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">
|
||||
<select name="cate_id">
|
||||
<option value="">请选择文章分类</option>
|
||||
{volist name=":set_recursion(get_article_cate())" id="v"}
|
||||
<option value="{$v.id}">{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<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="searchform">提交搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="article" lay-filter="article"></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="is_home">
|
||||
<i class="layui-icon {{# if(d.is_home == 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-sm" lay-event="add" data-title="添加文章表">+ 添加文章表</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a><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: '#article',
|
||||
title: '文章表列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/article/datalist',
|
||||
page: true,
|
||||
limit: 20,
|
||||
cellMinWidth: 300,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
fixed: 'left',
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'cate_title',
|
||||
title: '文章分类',
|
||||
align: 'center',
|
||||
width: 120
|
||||
},{
|
||||
field: 'title',
|
||||
title: '文章标题',
|
||||
},{
|
||||
field: 'read',
|
||||
title: '阅读量',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'type_str',
|
||||
title: '文章属性',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'is_home',
|
||||
title: '是否首页显示',
|
||||
toolbar: '#is_home',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
toolbar: '#status',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'admin_name',
|
||||
title: '创建人',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
width: 160
|
||||
},{
|
||||
fixed: 'right',
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 136,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听表头工具栏事件
|
||||
table.on('toolbar(article)', function(obj){
|
||||
if (obj.event === 'add') {
|
||||
tool.side("/admin/article/add");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//监听表格行工具事件
|
||||
table.on('tool(article)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'read') {
|
||||
tool.side('/admin/article/read?id='+obj.data.id);
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
tool.side('/admin/article/edit?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/article/del", { id: data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(searchform)', function(data) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords,
|
||||
cate_id: data.field.cate_id
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,222 +0,0 @@
|
||||
{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"}
|
||||
<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 colspan="7"> <input type="text" name="title" lay-verify="required" lay-reqText="请输入文章标题"
|
||||
autocomplete="off" placeholder="请输入文章标题" class="layui-input" value="{$detail.title}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">文章分类<font>*</font></td>
|
||||
<td>
|
||||
<select name="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="$detail.cate_id" value="$v.id" }selected{/eq}>{$v.title}
|
||||
</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray">关键字<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" id="keyword_name" name="keyword_names" autocomplete="off" lay-verify="required"
|
||||
lay-reqText="请选择关键字" placeholder="请选择关键字" class="layui-input" value="{$detail.keyword_names}"
|
||||
readonly>
|
||||
<input type="hidden" id="keyword_id" name="keywords_id" autocomplete="off"
|
||||
value="{$detail.keyword_ids}">
|
||||
</td>
|
||||
<td class="layui-td-gray">状态<font>*</font></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>
|
||||
<tr>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input"
|
||||
value="{$detail.sort}">
|
||||
</td>
|
||||
<td class="layui-td-gray">首页显示</td>
|
||||
<td>
|
||||
<input type="radio" name="is_home" value="1" title="是" {eq name="$detail.is_home" value="1"
|
||||
}checked{/eq}>
|
||||
<input type="radio" name="is_home" value="0" title="否" {eq name="$detail.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="$detail.type" value="1" }selected{/eq}>精华</option>
|
||||
<option value="2" {eq name="$detail.type" value="2" }selected{/eq}>热门</option>
|
||||
<option value="3" {eq name="$detail.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="$detail.original" value="1"
|
||||
}checked{/eq}>
|
||||
<input type="radio" name="original" value="0" title="否" {eq name="$detail.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="{$detail.origin}">
|
||||
</td>
|
||||
<td class="layui-td-gray">来源链接</td>
|
||||
<td>
|
||||
<input type="text" name="origin_url" class="layui-input" autocomplete="off" placeholder="请输入来源链接"
|
||||
value="{$detail.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">{$detail.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-sm" id="upload_btn_thumb">上传缩略图(尺寸:640x360)</button>
|
||||
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
|
||||
<img src="{:get_file($detail.thumb)}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" style="max-width: 100%; height:66px;" />
|
||||
<input type="hidden" name="thumb" value="{$detail.thumb}">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{eq name="$editor" value="1"}
|
||||
<tr>
|
||||
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<font>*</font><span class="ml-4 red">当前为TinyMCE富文本编辑器,可在【系统管理->系统配置->其他配置】中切换为mardown编辑器</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<textarea placeholder="请输入内容" class="layui-textarea" id="container_content">{$detail.content}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
{else/}
|
||||
<tr>
|
||||
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容<font>*</font><span class="ml-4 red">当前为mardown编辑器,可在【系统管理->系统配置->其他配置】中切换为TinyMCE富文本编辑器</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<div style="margin-top:-2px; margin-right:2px">
|
||||
<textarea id="mdContent" style="display:none;">{$detail.md_content|raw}</textarea>
|
||||
<div id="docContent"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/eq}
|
||||
</table>
|
||||
<div class="pt-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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
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,tagpicker = layui.tagpicker;
|
||||
|
||||
var tags = new tagpicker({
|
||||
'url': '/admin/api/get_keyword_cate',
|
||||
'target': 'keyword_name',
|
||||
'tag_ids': 'keyword_id',
|
||||
'tag_tags': 'keyword_name',
|
||||
'height': 500,
|
||||
'isDiy': 1
|
||||
});
|
||||
|
||||
//上传缩略图
|
||||
var upload_thumb = layui.upload.render({
|
||||
elem: '#upload_btn_thumb',
|
||||
url: '/admin/api/upload',
|
||||
done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code == 1) {
|
||||
layer.msg('上传失败');
|
||||
return false;
|
||||
}
|
||||
//上传成功
|
||||
$('#upload_box_thumb input').attr('value', res.data.id);
|
||||
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||
}
|
||||
});
|
||||
|
||||
if (editorType == 1) {
|
||||
var editor = layui.tinymce;
|
||||
var edit = editor.render({
|
||||
selector: "#container_content",
|
||||
height: 500
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||
if (data.field.content == '') {
|
||||
layer.msg('请先完善文章内容');
|
||||
return false;
|
||||
}
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/article/edit", 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) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/article/edit", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,78 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
{block name="style"}
|
||||
<style>
|
||||
.content-article img{max-width:88%!important; height:auto!important; margin:6px 0!important; border-radius:4px;}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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>
|
||||
<td colspan="3">{$detail.title}</td>
|
||||
<td class="layui-td-gray">所属分类</td>
|
||||
<td>
|
||||
{volist name=":set_recursion(get_article_cate())" id="v"}
|
||||
{eq name="$detail.cate_id" value="$v.id" }{$v.title}{/eq}
|
||||
{/volist}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">关键字</td>
|
||||
<td colspan="3">{$detail.keyword_names}</td>
|
||||
<td class="layui-td-gray">文章属性</td>
|
||||
<td>
|
||||
{eq name="$detail.type" value="1"}精华{/eq}
|
||||
{eq name="$detail.type" value="2"}热门{/eq}
|
||||
{eq name="$detail.type" value="3"}推荐{/eq}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">是否原创</td>
|
||||
<td>
|
||||
{eq name="$detail.original" value="1"}是{/eq}
|
||||
{eq name="$detail.original" value="0"}否{/eq}
|
||||
</td>
|
||||
<td class="layui-td-gray-2">来源或作者</td>
|
||||
<td>{$detail.origin}</td>
|
||||
<td class="layui-td-gray">来源地址</td>
|
||||
<td>{$detail.origin_url}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>{$detail.sort}</td>
|
||||
<td class="layui-td-gray-2">是否首页显示</td>
|
||||
<td>
|
||||
{eq name="$detail.is_home" value="1"}是{/eq}
|
||||
{eq name="$detail.is_home" value="0"}否{/eq}
|
||||
</td>
|
||||
<td rowspan="3" class="layui-td-gray-2">缩略图</td>
|
||||
<td rowspan="3">
|
||||
<img src="{$detail.thumb}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" style="width:200px; max-width:200px" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">创建时间</td>
|
||||
<td>{$detail.create_time}</td>
|
||||
<td class="layui-td-gray">状态</td>
|
||||
<td>
|
||||
{eq name="$detail.status" value="1"}正常{/eq}
|
||||
{eq name="$detail.status" value="0"}下架{/eq}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">文章摘要</td>
|
||||
<td colspan="3">{$detail.desc}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">文章内容</td>
|
||||
<td colspan="5" class="content-article">
|
||||
{$detail.content|raw}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
@ -1,70 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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>
|
||||
<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}
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" placeholder="请输入排序,数字" value="0" autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">分类名称<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" autocomplete="off" value="" placeholder="请输入分类名称" lay-reqText="请输入分类名称" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">关键词</td>
|
||||
<td>
|
||||
<input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" value="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">描述</td>
|
||||
<td colspan="3">
|
||||
<textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="py-3">
|
||||
<input type="hidden" name="id" value="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>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<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>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,77 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="p-3">
|
||||
<div class="gg-form-bar border-t border-x">
|
||||
<button class="layui-btn layui-btn-sm add-menu">+ 添加分类</button>
|
||||
</div>
|
||||
<div>
|
||||
<table class="layui-hide" id="treeTable" lay-filter="treeTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool', 'treeGrid'];
|
||||
function gouguInit() {
|
||||
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
|
||||
var pageTable = treeGrid.render({
|
||||
id:'treeTable'
|
||||
,elem: '#treeTable'
|
||||
,idField:'id'
|
||||
,url:'/admin/article_cate/datalist'
|
||||
,cellMinWidth: 300
|
||||
,treeId:'id'//树形id字段名称
|
||||
,treeUpId:'pid'//树形父id字段名称
|
||||
,treeShowName:'title'//以树形式显示的字段
|
||||
,page:false
|
||||
,cols: [[
|
||||
{field:'id',width:80, title: 'ID号', align:'center'}
|
||||
,{field: 'sort', title: '排序', align:'center', width:80}
|
||||
,{field:'title',width:240, title: '分类名称'}
|
||||
,{field:'pid', title: '父级ID',width:80, align:'center'}
|
||||
,{field:'keywords', title: '关键词', width:200,}
|
||||
,{field:'desc', title: '描述'}
|
||||
,{width:160,title: '操作', align:'center',templet: function(d){
|
||||
var html = '<span class="layui-btn-group"><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="add">添加子分类</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></span>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
]]
|
||||
});
|
||||
//表头工具栏事件
|
||||
$('.add-menu').on('click', function(){
|
||||
tool.side("/admin/article_cate/add");
|
||||
return;
|
||||
});
|
||||
|
||||
//操作按钮
|
||||
treeGrid.on('tool(treeTable)',function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
tool.side("/admin/article_cate/add?pid="+obj.data.id);
|
||||
return;
|
||||
}
|
||||
if (obj.event === 'edit') {
|
||||
tool.side("/admin/article_cate/edit?id="+obj.data.id);
|
||||
return;
|
||||
}
|
||||
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/article_cate/del", { id: obj.data.id}, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,70 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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>
|
||||
<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="$detail.pid" value="$v.id" }selected="" {/eq}>{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" value="{$detail.sort}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">分类名称<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入分类名称" class="layui-input" value="{$detail.title}">
|
||||
</td>
|
||||
<td class="layui-td-gray">关键词</td>
|
||||
<td>
|
||||
<input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" value="{$detail.keywords}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">描述</td>
|
||||
<td colspan="3">
|
||||
<textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea">{$detail.desc}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<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/edit", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,405 +0,0 @@
|
||||
{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; }
|
||||
|
||||
.layui-upload-add {
|
||||
position: relative;
|
||||
margin:12px 0;
|
||||
padding:16px 0;
|
||||
font-size:14px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #eee;
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: #999;
|
||||
}
|
||||
.layui-upload-add .layui-icon{font-size:52px; color:#3c9cff}
|
||||
.gallery-item{background-color:#fff; padding:12px 12px 0; margin:12px 0; box-sizing: border-box;border: 1px solid #eee;}
|
||||
.img-filepath{max-width: 200px;max-height: 150px;}
|
||||
.list-text{font-size:12px; padding:12px 12px 0 0;color:#969696;}
|
||||
.list-text span{color:#646464;}
|
||||
|
||||
.gougu-upload-files{background-color: #ffffff; border:1px solid #e4e7ed;color: #c0c4cc;cursor: not-allowed; padding:0 12px; box-sizing: border-box; display: inline-block; font-size: inherit; height: 38px; line-height: 35px; margin-right:8px; border-radius:2px;}
|
||||
.gougu-upload-tips{color:#969696}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-3">
|
||||
<div class="layui-row layui-col-space12">
|
||||
<div class="layui-col-md8">
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">图集标题<font>*</font></td>
|
||||
<td><input type="text" name="title" lay-verify="required" lay-reqText="请输入图集标题" placeholder="请输入图集标题" class="layui-input"></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>
|
||||
</table>
|
||||
|
||||
<div id="imgList"></div>
|
||||
|
||||
<div class="layui-upload-add" style="width:100% background-color:#F5FAFF">
|
||||
<i class="layui-icon"></i>
|
||||
<p>添加图片</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">图集分类<font>*</font></td>
|
||||
<td>
|
||||
<select name="cate_id" lay-verify="required" lay-reqText="请选择图集分类">
|
||||
<option value="">请选择图集分类</option>
|
||||
{volist name=":set_recursion(get_gallery_cate())" id="v"}
|
||||
<option value="{$v.id}">{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">状态<font>*</font></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">关键字<font>*</font></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">封面图</td>
|
||||
<td style="vertical-align:top">
|
||||
<div class="layui-upload" style="text-align:center;">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn">上传图集封面图(尺寸:640x360)</button>
|
||||
<div class="layui-upload-list" id="demo1">
|
||||
<img src="" width="100" style="width:200px;max-width:200px" />
|
||||
<input type="hidden" name="thumb" value="">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">作者/来源</td>
|
||||
<td>
|
||||
<input type="text" name="origin" class="layui-input" autocomplete="off" placeholder="请输入来源" value="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">来源链接</td>
|
||||
<td>
|
||||
<input type="text" name="origin_url" class="layui-input" autocomplete="off" placeholder="请输入来源链接" value="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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="is_home" value="1" title="是" checked>
|
||||
<input type="radio" name="is_home" value="0" title="否">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" value="0" lay-verify="number" placeholder="请输入排序,数字" class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="py-3">
|
||||
<input type="hidden" name="id" value="0">
|
||||
<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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
var moduleInit = ['tool', 'tagpicker'];
|
||||
function gouguInit() {
|
||||
var form = layui.form, tool = layui.tool,element = layui.element, 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);
|
||||
}
|
||||
});
|
||||
|
||||
//监听返回
|
||||
$('body').on('click', '[lay-event="back"]', function () {
|
||||
tool.tabClose();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
let callback = function (e) {
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(94);
|
||||
layer.confirm('保存成功,关闭当前页面吗?', { icon: 3, title: '提示' }, function (index) {
|
||||
tool.tabClose();
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/gallery/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.layui-upload-add').on('click',function(){
|
||||
uploadImg(0);
|
||||
})
|
||||
|
||||
function uploadImg(id){
|
||||
layer.open({
|
||||
'title':'上传资源',
|
||||
'type':1,
|
||||
'area': ['640px', '360px'],
|
||||
'content':`<div class="layui-form p-3">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">来源:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="uploadtype" lay-filter="type" value="1" title="本地上传" checked>
|
||||
<input type="radio" name="uploadtype" lay-filter="type" value="2" title="网络图片">
|
||||
</div>
|
||||
</div>
|
||||
<div id="uploadType1">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">文件:</label>
|
||||
<div class="layui-input-block">
|
||||
<span class="gougu-upload-files">.jpg、.jpeg、.gif、.png、.bmp</span><button type="button" class="layui-btn layui-btn-normal" id="uploadSelect">选择文件</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
<span class="gougu-upload-tips">只能上传 .jpg、.jpeg、.gif、.png、.bmp 文件</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block" id="gougu-upload-choosed"></div>
|
||||
</div>
|
||||
<div class="layui-progress upload-progress" lay-showpercent="yes" lay-filter="upload-progress" style="margin-bottom:12px; margin-left:90px; width:320px; display:none;">
|
||||
<div class="layui-progress-bar layui-bg-blue" lay-percent=""><span class="layui-progress-text"></span></div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-item-sm">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn" id="uploadAjax">开始上传</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="uploadType2" style="display:none; width:480px;">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">URL地址:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_url" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图片名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_name" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-item-sm">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
<span class="layui-btn" id="saveAjax">确定保存</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
success: function(layero, index){
|
||||
form.render();
|
||||
|
||||
form.on('radio(type)', function(data){
|
||||
if(data.value==1){
|
||||
$('#uploadType1').show();
|
||||
$('#uploadType2').hide();
|
||||
}
|
||||
else{
|
||||
$('#uploadType1').hide();
|
||||
$('#uploadType2').show();
|
||||
}
|
||||
});
|
||||
|
||||
//选文件
|
||||
upload.render({
|
||||
elem: '#uploadSelect'
|
||||
,url: '/admin/api/upload'
|
||||
,auto: false
|
||||
,accept: 'file' //普通文件
|
||||
,exts: 'png|jpg|gif|jpeg|bmp' //只允许上传文件格式
|
||||
,bindAction: '#uploadAjax'
|
||||
,choose: function(obj){
|
||||
obj.preview(function(index, file, result){
|
||||
$('#gougu-upload-choosed').html('已选择:'+file.name);
|
||||
});
|
||||
}
|
||||
,before: function(obj){
|
||||
$('.upload-progress').show();
|
||||
element.progress('upload-progress', '0%');
|
||||
}
|
||||
,progress: function(n, elem, e){
|
||||
element.progress('upload-progress', n + '%');
|
||||
}
|
||||
,done: function(res){
|
||||
layer.msg(res.msg);
|
||||
if(res.code==0){
|
||||
appendImg(res.data,id);
|
||||
layer.close(index);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#saveAjax').on('click',function(){
|
||||
let url=$('[name="img_url"]').val();
|
||||
let name=$('[name="img_name"]').val();
|
||||
if(url == ''){
|
||||
layer.msg('请输入图片URL');
|
||||
return false;
|
||||
}
|
||||
if(name == ''){
|
||||
layer.msg('请输入图片名称');
|
||||
return false;
|
||||
}
|
||||
let res={
|
||||
filepath:url,
|
||||
name:name,
|
||||
id:0
|
||||
}
|
||||
layer.close(index);
|
||||
appendImg(res,id);
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function appendImg(res,id){
|
||||
if(id == 0){
|
||||
id = Date.now();
|
||||
$('#imgList').append(`<div class="layui-row gallery-item" id="item_${id}">
|
||||
<div class="layui-col-md3">
|
||||
<img src="${res.filepath}" class="img-filepath">
|
||||
<p class="list-text">原名称:<span class="img-name">${res.name}</span></p>
|
||||
</div>
|
||||
<div class="layui-col-md9">
|
||||
<div class="layui-form-item layui-form-item-sm">
|
||||
<label class="layui-form-label">标题:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_title[]" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-item-sm">
|
||||
<label class="layui-form-label">摘要:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="img_desc[]" placeholder="" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space12 layui-form-item layui-form-item-sm">
|
||||
<div class="layui-col-lg6">
|
||||
<label class="layui-form-label">链接:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_link[]" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-lg3">
|
||||
<label class="layui-form-label">排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_sort[]" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-lg3" style="text-align:right;">
|
||||
<div class="layui-btn-group">
|
||||
<input type="hidden" name="img_file[]" class="img-file-input" value="${res.id}">
|
||||
<input type="hidden" name="img_filepath[]" class="img-filepath-input" value="${res.filepath}">
|
||||
<input type="hidden" name="img_name[]" class="img-name-input" value="${res.name}">
|
||||
<span class="layui-btn layui-btn-sm item-edit" title="编辑" data-id="${id}">编辑</span>
|
||||
<span class="layui-btn layui-btn-sm layui-btn-danger item-del" data-id="${id}" title="删除">删除</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`);
|
||||
}
|
||||
else{
|
||||
$('#item_'+id).find('.img-filepath').attr('src',res.filepath);
|
||||
$('#item_'+id).find('.img-name').html(res.name);
|
||||
$('#item_'+id).find('.img-filepath-input').val(res.filepath);
|
||||
$('#item_'+id).find('.img-name-input').val(res.name);
|
||||
$('#item_'+id).find('.img-file-input').val(res.id);
|
||||
}
|
||||
}
|
||||
$('#imgList').on('click','.item-edit',function(){
|
||||
let id=$(this).data('id');
|
||||
uploadImg(id);
|
||||
});
|
||||
$('#imgList').on('click','.item-del',function(){
|
||||
let id=$(this).data('id');
|
||||
$('#item_'+id).remove();
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,151 +0,0 @@
|
||||
{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">
|
||||
<select name="cate_id">
|
||||
<option value="">请选择图集分类</option>
|
||||
{volist name=":set_recursion(get_gallery_cate())" id="v"}
|
||||
<option value="{$v.id}">{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<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="gallery" lay-filter="gallery"></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="is_home">
|
||||
<i class="layui-icon {{# if(d.is_home == 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-sm tab-a" data-title="添加图集" data-href="/admin/gallery/add">+ 添加图集</span>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">查看</a><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: '#gallery',
|
||||
title: '图集列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/gallery/datalist', //数据接口
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[ //表头
|
||||
{
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'cate_title',
|
||||
title: '分类',
|
||||
width: 200
|
||||
}, {
|
||||
field: 'title',
|
||||
title: '标题'
|
||||
},{
|
||||
field: 'count',
|
||||
title: '图片数',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
toolbar: '#status',
|
||||
align: 'center',
|
||||
width: 66
|
||||
}, {
|
||||
field: 'is_home',
|
||||
title: '首页显示',
|
||||
toolbar: '#is_home',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'admin_name',
|
||||
title: '创建人',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
width: 150
|
||||
}, {
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 150,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听行工具事件
|
||||
table.on('tool(gallery)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'view') {
|
||||
tool.side('/admin/gallery/read?id='+obj.data.id);
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
tool.tabAdd('/admin/gallery/edit?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/gallery/del", { id: data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(webform)', function(data) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords,
|
||||
cate_id: data.field.cate_id
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,454 +0,0 @@
|
||||
{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;}
|
||||
|
||||
.layui-upload-add {
|
||||
position: relative;
|
||||
margin:12px 0;
|
||||
padding:16px 0;
|
||||
font-size:14px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #eee;
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: #999;
|
||||
}
|
||||
.layui-upload-add .layui-icon{font-size:52px; color:#3c9cff}
|
||||
.gallery-item{background-color:#fff; padding:12px 12px 0; margin:12px 0; box-sizing: border-box;border: 1px solid #eee;}
|
||||
.img-filepath{max-width: 200px;max-height: 150px;}
|
||||
.list-text{font-size:12px; padding:12px 12px 0 0;color:#969696;}
|
||||
.list-text span{color:#646464;}
|
||||
|
||||
.gougu-upload-files{background-color: #ffffff; border:1px solid #e4e7ed;color: #c0c4cc;cursor: not-allowed; padding:0 12px; box-sizing: border-box; display: inline-block; font-size: inherit; height: 38px; line-height: 35px; margin-right:8px; border-radius:2px;}
|
||||
.gougu-upload-tips{color:#969696}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-3">
|
||||
<div class="layui-row layui-col-space12">
|
||||
<div class="layui-col-md8">
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">图集标题<font>*</font></td>
|
||||
<td><input type="text" name="title" value="{$detail.title}" lay-verify="required" lay-reqText="请输入图集标题" placeholder="请输入图集标题" class="layui-input"></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>
|
||||
</table>
|
||||
|
||||
<div id="imgList">
|
||||
{volist name="$detail.gallery_array" id="vo"}
|
||||
<div class="layui-row gallery-item" id="item_{$vo.id}">
|
||||
<div class="layui-col-md3">
|
||||
<img src="{$vo.filepath}" class="img-filepath">
|
||||
<p class="list-text">原名称:<span class="img-name">{$vo.name}</span></p>
|
||||
</div>
|
||||
<div class="layui-col-md9">
|
||||
<div class="layui-form-item layui-form-item-sm">
|
||||
<label class="layui-form-label">标题:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_title[]" value="{$vo.title}" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-item-sm">
|
||||
<label class="layui-form-label">摘要:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="img_desc[]" value="{$vo.desc}" placeholder="" class="layui-textarea">{$vo.desc}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space12 layui-form-item layui-form-item-sm">
|
||||
<div class="layui-col-lg6">
|
||||
<label class="layui-form-label">链接:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_link[]" value="{$vo.link}" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-lg3">
|
||||
<label class="layui-form-label">排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_sort[]" value="{$vo.sort}" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-lg3" style="text-align:right;">
|
||||
<div class="layui-btn-group">
|
||||
<input type="hidden" name="img_file[]" class="img-file-input" value="{$vo.file_id}">
|
||||
<input type="hidden" name="img_filepath[]" class="img-filepath-input" value="{$vo.filepath}">
|
||||
<input type="hidden" name="img_name[]" class="img-name-input" value="{$vo.name}">
|
||||
<span class="layui-btn layui-btn-sm item-edit" title="编辑" data-id="{$vo.id}">编辑</span>
|
||||
<span class="layui-btn layui-btn-sm layui-btn-danger item-del" data-id="{$vo.id}" title="删除">删除</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="layui-upload-add" style="width:100%; background-color:#F5FAFF">
|
||||
<i class="layui-icon"></i>
|
||||
<p>添加图片</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">图集分类<font>*</font></td>
|
||||
<td>
|
||||
<select name="cate_id" lay-verify="required" lay-reqText="请选择图集分类">
|
||||
<option value="">请选择图集分类</option>
|
||||
{volist name=":set_recursion(get_gallery_cate())" id="v"}
|
||||
<option value="{$v.id}" {eq name="$detail.cate_id" value="$v.id" }selected{/eq}>{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">状态<font>*</font></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>
|
||||
<tr>
|
||||
<td class="layui-td-gray">关键字<font>*</font></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">封面图</td>
|
||||
<td style="vertical-align:top">
|
||||
<div class="layui-upload" style="text-align:center;">
|
||||
<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn">上传图集封面图(尺寸:640x360)</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">作者/来源</td>
|
||||
<td>
|
||||
<input type="text" name="origin" class="layui-input" autocomplete="off" placeholder="请输入来源" value="{$detail.origin}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">来源链接</td>
|
||||
<td>
|
||||
<input type="text" name="origin_url" class="layui-input" autocomplete="off" placeholder="请输入来源链接" value="{$detail.origin_url}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">属性</td>
|
||||
<td>
|
||||
<select name="type">
|
||||
<option value="">请选择属性</option>
|
||||
<option value="1" {eq name="$detail.type" value="1" }selected{/eq}>精华</option>
|
||||
<option value="2" {eq name="$detail.type" value="2" }selected{/eq}>热门</option>
|
||||
<option value="3" {eq name="$detail.type" value="3" }selected{/eq}>推荐</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">首页显示</td>
|
||||
<td>
|
||||
<input type="radio" name="is_home" value="1" title="是" {eq name="$detail.is_home" value="1"
|
||||
}checked{/eq}>
|
||||
<input type="radio" name="is_home" value="0" title="否" {eq name="$detail.is_home" value="0"
|
||||
}checked{/eq}>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" value="{$detail.sort}" lay-verify="number" placeholder="请输入排序,数字" class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
var moduleInit = ['tool', 'tagpicker'];
|
||||
function gouguInit() {
|
||||
var form = layui.form, tool = layui.tool,element = layui.element, 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);
|
||||
}
|
||||
});
|
||||
|
||||
//监听返回
|
||||
$('body').on('click', '[lay-event="back"]', function () {
|
||||
tool.tabClose();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
let callback = function (e) {
|
||||
if (e.code == 0) {
|
||||
tool.tabRefresh(94);
|
||||
layer.confirm('保存成功,关闭当前页面吗?', { icon: 3, title: '提示' }, function (index) {
|
||||
tool.tabClose();
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/gallery/edit", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.layui-upload-add').on('click',function(){
|
||||
uploadImg(0);
|
||||
})
|
||||
|
||||
function uploadImg(id){
|
||||
layer.open({
|
||||
'title':'上传资源',
|
||||
'type':1,
|
||||
'area': ['600px', '360px'],
|
||||
'content':`<div class="layui-form p-3">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">来源:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="uploadtype" lay-filter="type" value="1" title="本地上传" checked>
|
||||
<input type="radio" name="uploadtype" lay-filter="type" value="2" title="网络图片">
|
||||
</div>
|
||||
</div>
|
||||
<div id="uploadType1">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">文件:</label>
|
||||
<div class="layui-input-block">
|
||||
<span class="gougu-upload-files">.jpg、.jpeg、.gif、.png、.bmp</span><button type="button" class="layui-btn layui-btn-normal" id="uploadSelect">选择文件</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
<span class="gougu-upload-tips">只能上传 .jpg、.jpeg、.gif、.png、.bmp 文件</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block" id="gougu-upload-choosed"></div>
|
||||
</div>
|
||||
<div class="layui-progress upload-progress" lay-showpercent="yes" lay-filter="upload-progress" style="margin-bottom:12px; margin-left:90px; width:320px; display:none;">
|
||||
<div class="layui-progress-bar layui-bg-blue" lay-percent=""><span class="layui-progress-text"></span></div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-item-sm">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn" id="uploadAjax">开始上传</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="uploadType2" style="display:none; width:480px;">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">URL地址:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_url" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图片名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_name" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-item-sm">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
<span class="layui-btn" id="saveAjax">确定保存</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
success: function(layero, index){
|
||||
form.render();
|
||||
|
||||
form.on('radio(type)', function(data){
|
||||
if(data.value==1){
|
||||
$('#uploadType1').show();
|
||||
$('#uploadType2').hide();
|
||||
}
|
||||
else{
|
||||
$('#uploadType1').hide();
|
||||
$('#uploadType2').show();
|
||||
}
|
||||
});
|
||||
|
||||
//选文件
|
||||
upload.render({
|
||||
elem: '#uploadSelect'
|
||||
,url: '/admin/api/upload'
|
||||
,auto: false
|
||||
,accept: 'file' //普通文件
|
||||
,exts: 'png|jpg|gif|jpeg|bmp' //只允许上传文件格式
|
||||
,bindAction: '#uploadAjax'
|
||||
,choose: function(obj){
|
||||
obj.preview(function(index, file, result){
|
||||
$('#gougu-upload-choosed').html('已选择:'+file.name);
|
||||
});
|
||||
}
|
||||
,before: function(obj){
|
||||
$('.upload-progress').show();
|
||||
element.progress('upload-progress', '0%');
|
||||
}
|
||||
,progress: function(n, elem, e){
|
||||
element.progress('upload-progress', n + '%');
|
||||
}
|
||||
,done: function(res){
|
||||
layer.msg(res.msg);
|
||||
if(res.code==0){
|
||||
appendImg(res.data,id);
|
||||
layer.close(index);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#saveAjax').on('click',function(){
|
||||
let url=$('[name="img_url"]').val();
|
||||
let name=$('[name="img_name"]').val();
|
||||
if(url == ''){
|
||||
layer.msg('请输入图片URL');
|
||||
return false;
|
||||
}
|
||||
if(name == ''){
|
||||
layer.msg('请输入图片名称');
|
||||
return false;
|
||||
}
|
||||
let res={
|
||||
filepath:url,
|
||||
name:name,
|
||||
id:0
|
||||
}
|
||||
layer.close(index);
|
||||
appendImg(res,id);
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function appendImg(res,id){
|
||||
if(id == 0){
|
||||
id = Date.now();
|
||||
$('#imgList').append(`<div class="layui-row gallery-item" id="item_${id}">
|
||||
<div class="layui-col-md3">
|
||||
<img src="${res.filepath}" class="img-filepath">
|
||||
<p class="list-text">原名称:<span class="img-name">${res.name}</span></p>
|
||||
</div>
|
||||
<div class="layui-col-md9">
|
||||
<div class="layui-form-item layui-form-item-sm">
|
||||
<label class="layui-form-label">标题:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_title[]" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-item-sm">
|
||||
<label class="layui-form-label">摘要:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="img_desc[]" placeholder="" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space12 layui-form-item layui-form-item-sm">
|
||||
<div class="layui-col-lg6">
|
||||
<label class="layui-form-label">链接:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_link[]" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-lg3">
|
||||
<label class="layui-form-label">排序:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="img_sort[]" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-lg3" style="text-align:right;">
|
||||
<div class="layui-btn-group">
|
||||
<input type="hidden" name="img_file[]" class="img-file-input" value="${res.id}">
|
||||
<input type="hidden" name="img_filepath[]" class="img-filepath-input" value="${res.filepath}">
|
||||
<input type="hidden" name="img_name[]" class="img-name-input" value="${res.name}">
|
||||
<span class="layui-btn layui-btn-sm item-edit" title="编辑" data-id="${id}">编辑</span>
|
||||
<span class="layui-btn layui-btn-sm layui-btn-danger item-del" data-id="${id}" title="删除">删除</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`);
|
||||
}
|
||||
else{
|
||||
$('#item_'+id).find('.img-filepath').attr('src',res.filepath);
|
||||
$('#item_'+id).find('.img-name').html(res.name);
|
||||
$('#item_'+id).find('.img-filepath-input').val(res.filepath);
|
||||
$('#item_'+id).find('.img-name-input').val(res.name);
|
||||
$('#item_'+id).find('.img-file-input').val(res.id);
|
||||
}
|
||||
}
|
||||
$('#imgList').on('click','.item-edit',function(){
|
||||
let id=$(this).data('id');
|
||||
uploadImg(id);
|
||||
});
|
||||
$('#imgList').on('click','.item-del',function(){
|
||||
let id=$(this).data('id');
|
||||
$('#item_'+id).remove();
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,138 +0,0 @@
|
||||
{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;
|
||||
}
|
||||
|
||||
.layui-upload-add {
|
||||
position: relative;
|
||||
margin:12px 0;
|
||||
padding:16px 0;
|
||||
font-size:14px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #eee;
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: #999;
|
||||
}
|
||||
.layui-upload-add .layui-icon{font-size:52px; color:#3c9cff}
|
||||
.gallery-item{background-color:#fff; padding:12px 12px 0; margin:12px 0; box-sizing: border-box;border: 1px solid #eee;}
|
||||
.img-filepath{max-width: 200px;max-height: 150px;}
|
||||
.list-text{font-size:12px; padding:12px 12px 0 0;color:#969696;}
|
||||
.list-text span{color:#646464;}
|
||||
|
||||
.gougu-upload-files{background-color: #ffffff; border:1px solid #e4e7ed;color: #c0c4cc;cursor: not-allowed; padding:0 12px; box-sizing: border-box; display: inline-block; font-size: inherit; height: 38px; line-height: 35px; margin-right:8px; border-radius:2px;}
|
||||
.gougu-upload-tips{color:#969696}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-3">
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">图集标题</td>
|
||||
<td>{$detail.title}</td>
|
||||
<td class="layui-td-gray">所属分类</td>
|
||||
<td>
|
||||
{volist name=":set_recursion(get_gallery_cate())" id="v"}
|
||||
{eq name="$detail.cate_id" value="$v.id" }{$v.title}{/eq}
|
||||
{/volist}
|
||||
</td>
|
||||
<td class="layui-td-gray">图集状态</td>
|
||||
<td>
|
||||
{eq name="$detail.status" value="1" }正常{/eq}
|
||||
{eq name="$detail.status" value="0" }下架{/eq}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">关键字</td>
|
||||
<td>
|
||||
{$detail.keyword_names}
|
||||
</td>
|
||||
<td class="layui-td-gray">属性</td>
|
||||
<td>
|
||||
{eq name="$detail.type" value="1" }精华{/eq}
|
||||
{eq name="$detail.type" value="2" }热门{/eq}
|
||||
{eq name="$detail.type" value="3" }推荐{/eq}
|
||||
</td>
|
||||
<td class="layui-td-gray">首页显示</td>
|
||||
<td>
|
||||
{eq name="$detail.is_home" value="1"}是{/eq}
|
||||
{eq name="$detail.is_home" value="0"}否{/eq}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">作者/来源</td>
|
||||
<td>{$detail.origin}</td>
|
||||
<td class="layui-td-gray">来源链接</td>
|
||||
<td>{$detail.origin_url}</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>{$detail.sort}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">图集简介</td>
|
||||
<td colspan="3">{$detail.desc}</td>
|
||||
<td class="layui-td-gray">封面图</td>
|
||||
<td>
|
||||
<img src="{$detail.thumb|get_file}" style="width:200px;max-width:200px" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="imgList">
|
||||
{volist name="$detail.gallery_array" id="vo"}
|
||||
<div class="layui-row gallery-item" id="item_{$vo.id}">
|
||||
<div class="layui-col-md3">
|
||||
<img src="{$vo.filepath}" class="img-filepath">
|
||||
<p class="py-2">名称:{$vo.name}</p>
|
||||
</div>
|
||||
<div class="layui-col-md9">
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">标题</td>
|
||||
<td colspan="3">{$vo.title}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">摘要</td>
|
||||
<td colspan="3">{$vo.desc}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">链接</td>
|
||||
<td>{$vo.link}</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>{$vo.sort}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
var moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,71 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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>
|
||||
<select name="pid" lay-verify="required" lay-reqText="请选择父级分类">
|
||||
<option value="0">作为顶级分类</option>
|
||||
{volist name=":set_recursion(get_gallery_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">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" placeholder="请输入排序,数字" value="0" autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">分类名称<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" autocomplete="off" value="" placeholder="请输入分类名称" lay-reqText="请输入分类名称" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">关键词</td>
|
||||
<td>
|
||||
<input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" value="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">描述</td>
|
||||
<td colspan="3">
|
||||
<textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="py-3">
|
||||
<input type="hidden" name="id" value="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>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
var 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/gallery_cate/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,104 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
|
||||
<div class="p-3">
|
||||
<div class="gg-form-bar border-t border-x">
|
||||
<button class="layui-btn layui-btn-sm add-menu">+ 添加图集分类</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="gallery_cate" lay-filter="gallery_cate"></table>
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool', 'treeGrid'];
|
||||
function gouguInit() {
|
||||
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
|
||||
var pageTable = treeGrid.render({
|
||||
id:'gallery_cate'
|
||||
,elem: '#gallery_cate'
|
||||
,idField:'id'
|
||||
,url:'/admin/gallery_cate/datalist'
|
||||
,cellMinWidth: 300
|
||||
,treeId:'id'//树形id字段名称
|
||||
,treeUpId:'pid'//树形父id字段名称
|
||||
,treeShowName:'title'//以树形式显示的字段
|
||||
,page:false
|
||||
,cols: [
|
||||
[
|
||||
{
|
||||
fixed: 'left',
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'title',
|
||||
title: '分类名称',
|
||||
width: 200
|
||||
},{
|
||||
field: 'pid',
|
||||
title: '父级ID',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'keywords',
|
||||
title: '关键字',
|
||||
width: 200
|
||||
},{
|
||||
field: 'desc',
|
||||
title: '分类描述'
|
||||
},
|
||||
{width:160,title: '操作', align:'center',templet: function(d){
|
||||
var html = '<span class="layui-btn-group"><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="add">添加子分类</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></span>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听表头工具栏事件
|
||||
$('.add-menu').on('click', function(){
|
||||
tool.side("/admin/gallery_cate/add");
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听表格行工具事件
|
||||
treeGrid.on('tool(gallery_cate)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'add') {
|
||||
tool.side('/admin/gallery_cate/add?pid='+obj.data.id);
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
tool.side('/admin/gallery_cate/edit?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/gallery_cate/del", { id: data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,71 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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>
|
||||
<select name="pid" lay-verify="required" lay-reqText="请选择父级分类">
|
||||
<option value="0">作为顶级分类</option>
|
||||
{volist name=":set_recursion(get_gallery_cate())" id="v"}
|
||||
<option value="{$v.id}" {eq name="$detail.pid" value="$v.id" }selected="" {/eq}>{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" value="{$detail.sort}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">分类名称<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入分类名称" class="layui-input" value="{$detail.title}">
|
||||
</td>
|
||||
<td class="layui-td-gray">关键词</td>
|
||||
<td>
|
||||
<input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" value="{$detail.keywords}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">描述</td>
|
||||
<td colspan="3">
|
||||
<textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea">{$detail.desc}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
var 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/gallery_cate/edit", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,285 +0,0 @@
|
||||
{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;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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 colspan="5"><input type="text" name="title" lay-verify="required" lay-reqText="请输入商品标题" placeholder="请输入商品标题" class="layui-input"></td>
|
||||
<td class="layui-td-gray">商品分类<font>*</font></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">关键字<font>*</font></td>
|
||||
<td colspan="5">
|
||||
<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" 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" id="upload_btn_thumb">上传商品封面图(尺寸:750x560)</button>
|
||||
<div class="layui-upload-list" id="upload_box_thumb">
|
||||
<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">商品卖点<font>*</font></td>
|
||||
<td colspan="5">
|
||||
<input type="text" name="tips" lay-verify="required" lay-reqText="请输入商品卖点" placeholder="一句话描述商品卖点,30字以内" class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray" style="vertical-align:top;">商品简介</td>
|
||||
<td colspan="5">
|
||||
<textarea name="desc" placeholder="请输入商品简介,200字以内" class="layui-textarea"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">商品标签<font>*</font></td>
|
||||
<td colspan="7">
|
||||
<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">市场价格<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="base_price" lay-verify="required|number" lay-reqText="请输入市场价格" placeholder="请输入市场价格" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">实际价格<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="price" lay-verify="required|number" lay-reqText="请输入实际价格" placeholder="请输入实际价格" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">商品库存<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="stocks" lay-verify="required|number" lay-reqText="请输入商品库存" placeholder="请输入商品库存" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">是否包邮<font>*</font></td>
|
||||
<td>
|
||||
<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>
|
||||
<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>
|
||||
<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">状态<font>*</font></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 colspan="7">
|
||||
<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 colspan="8" class="layui-td-gray" style="text-align:left">商品介绍<font>*</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
<textarea class="layui-textarea" id="container_content"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pt-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}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{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);
|
||||
}
|
||||
};
|
||||
var moduleInit = ['tool','tagpicker','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
var form = layui.form, tool = layui.tool,tagpicker = layui.tagpicker;
|
||||
|
||||
//上传缩略图
|
||||
var upload_thumb = layui.upload.render({
|
||||
elem: '#upload_btn_thumb',
|
||||
url: '/admin/api/upload',
|
||||
done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code == 1) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
//上传成功
|
||||
$('#upload_box_thumb input').attr('value', res.data.id);
|
||||
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||
}
|
||||
});
|
||||
|
||||
//banner图上传
|
||||
var uploadInst2 = layui.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();
|
||||
})
|
||||
|
||||
var tags = new tagpicker({
|
||||
'url': '/admin/api/get_keyword_cate',
|
||||
'target': 'keyword_name',
|
||||
'tag_ids': 'keyword_id',
|
||||
'tag_tags': 'keyword_name',
|
||||
'height': 500,
|
||||
'isDiy': 1
|
||||
});
|
||||
|
||||
//商品描述富文本编辑器
|
||||
var edit = layui.tinymce.render({
|
||||
selector: '#container_content',
|
||||
height: 500
|
||||
});
|
||||
|
||||
//自定义验证规则
|
||||
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 '必填项不能为空';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||
if (data.field.content == '') {
|
||||
layer.msg('请先完善商品描述内容');
|
||||
return false;
|
||||
}
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/goods/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,192 +0,0 @@
|
||||
{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">
|
||||
<select name="cate_id">
|
||||
<option value="">请选择商品分类</option>
|
||||
{volist name=":set_recursion(get_goods_cate())" id="v"}
|
||||
<option value="{$v.id}">{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<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="searchform">提交搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="goods" lay-filter="goods"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加商品">+ 添加商品</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="status">
|
||||
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok green{{# } else { }}layui-icon-close red{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="is_home">
|
||||
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok green{{# } else { }}layui-icon-close red{{# } }}"></i>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a><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: '#goods',
|
||||
title: '商品列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/goods/datalist',
|
||||
page: true,
|
||||
limit: 20,
|
||||
cellMinWidth: 300,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
fixed: 'left',
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'cate_title',
|
||||
title: '所属分类',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'type_str',
|
||||
title: '属性',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'title',
|
||||
title: '商品名称',
|
||||
},{
|
||||
field: 'base_price',
|
||||
title: '市场价格',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'price',
|
||||
title: '实际价格',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'stocks',
|
||||
title: '商品库存',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'sales',
|
||||
title: '商品销量',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'read',
|
||||
title: '阅读量',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'is_home',
|
||||
title: '首页显示',
|
||||
toolbar: '#is_home',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},{
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'status',
|
||||
title: '上下架',
|
||||
toolbar: '#status',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'admin_name',
|
||||
title: '创建人',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
width: 160
|
||||
},{
|
||||
fixed: 'right',
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 136,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听表头工具栏事件
|
||||
table.on('toolbar(goods)', function(obj){
|
||||
if (obj.event === 'add') {
|
||||
tool.side("/admin/goods/add");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//监听表格行工具事件
|
||||
table.on('tool(goods)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'read') {
|
||||
tool.side('/admin/goods/read?id='+obj.data.id);
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
tool.side('/admin/goods/edit?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/goods/del", { id: data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(searchform)', function(data) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,305 +0,0 @@
|
||||
{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;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-3">
|
||||
<h3 class="pb-3">编辑商品</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">商品标题<font>*</font></td>
|
||||
<td colspan="5"><input type="text" name="title" lay-verify="required" lay-reqText="请输入商品标题" placeholder="请输入商品标题" class="layui-input" value="{$detail.title}"></td>
|
||||
<td class="layui-td-gray">商品分类<font>*</font></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="$detail.cate_id" value="$v.id" }selected{/eq}>{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">关键字<font>*</font></td>
|
||||
<td colspan="5">
|
||||
<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>
|
||||
<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" id="upload_btn_thumb">上传商品封面图(尺寸:750x560)</button>
|
||||
<div class="layui-upload-list" id="upload_box_thumb">
|
||||
<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">商品卖点<font>*</font></td>
|
||||
<td colspan="5">
|
||||
<input type="text" name="tips" lay-verify="required" lay-reqText="请输入商品卖点" placeholder="一句话描述商品卖点,30字以内" value="{$detail.tips}" class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray" style="vertical-align:top;">商品简介</td>
|
||||
<td colspan="5">
|
||||
<textarea name="desc" placeholder="请输入商品简介,200字以内" class="layui-textarea">{$detail.desc}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">商品标签<font>*</font></td>
|
||||
<td colspan="8">
|
||||
<input type="checkbox" name="tag_values[]" title="正品保证" lay-skin="primary" value="1" {eq
|
||||
name="$detail.tag1" value="1" }checked{/eq} />
|
||||
<input type="checkbox" name="tag_values[]" title="一年保修" lay-skin="primary" value="2" {eq
|
||||
name="$detail.tag2" value="1" }checked{/eq} />
|
||||
<input type="checkbox" name="tag_values[]" title="七天退换(拆封后不支持)" lay-skin="primary" value="3" {eq
|
||||
name="$detail.tag3" value="1" }checked{/eq} />
|
||||
<input type="checkbox" name="tag_values[]" title="赠运费险" lay-skin="primary" value="4" {eq
|
||||
name="$detail.tag4" value="1" }checked{/eq} />
|
||||
<input type="checkbox" name="tag_values[]" title="闪电发货" lay-skin="primary" value="5" {eq
|
||||
name="$detail.tag5" value="1" }checked{/eq} />
|
||||
<input type="checkbox" name="tag_values[]" title="售后无忧" lay-skin="primary" value="6" {eq
|
||||
name="$detail.tag6" value="1" }checked{/eq} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">市场价格<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="base_price" lay-verify="required|number" lay-reqText="请输入市场价格"
|
||||
placeholder="请输入市场价格" class="layui-input" value="{$detail.base_price}">
|
||||
</td>
|
||||
<td class="layui-td-gray">实际价格<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="price" lay-verify="required|number" lay-reqText="请输入实际价格" placeholder="请输入实际价格"
|
||||
class="layui-input" value="{$detail.price}">
|
||||
</td>
|
||||
<td class="layui-td-gray">商品库存<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="stocks" value="{$detail.stocks}" lay-verify="required|number" lay-reqText="请输入商品库存" placeholder="请输入商品库存" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">是否包邮<font>*</font></td>
|
||||
<td>
|
||||
<input type="radio" name="is_mail" value="1" title="是" {eq name="$detail.is_mail" value="1"
|
||||
}checked{/eq}>
|
||||
<input type="radio" name="is_mail" value="0" title="否" {eq name="$detail.is_mail" value="0"
|
||||
}checked{/eq}>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">商品属性</td>
|
||||
<td>
|
||||
<select name="type">
|
||||
<option value="">请选择属性</option>
|
||||
<option value="1" {eq name="$detail.type" value="1" }selected{/eq}>精华</option>
|
||||
<option value="2" {eq name="$detail.type" value="2" }selected{/eq}>热门</option>
|
||||
<option value="3" {eq name="$detail.type" value="3" }selected{/eq}>推荐</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray">首页显示</td>
|
||||
<td>
|
||||
<input type="radio" name="is_home" value="1" title="是" {eq name="$detail.is_home" value="1"
|
||||
}checked{/eq}>
|
||||
<input type="radio" name="is_home" value="0" title="否" {eq name="$detail.is_home" value="0"
|
||||
}checked{/eq}>
|
||||
</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" placeholder="请输入排序,数字" lay-verify="number" class="layui-input" value="{$detail.sort}">
|
||||
</td>
|
||||
<td class="layui-td-gray">状态<font>*</font></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>
|
||||
<tr>
|
||||
<td class="layui-td-gray">商品图集</td>
|
||||
<td colspan="7">
|
||||
<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 colspan="8" class="layui-td-gray" style="text-align:left">商品介绍<font>*</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
<textarea class="layui-textarea" id="container_content">{$detail.content}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pt-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);
|
||||
}
|
||||
};
|
||||
var moduleInit = ['tool','tagpicker','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
var form = layui.form, tool = layui.tool,tagpicker = layui.tagpicker;
|
||||
|
||||
//上传缩略图
|
||||
var upload_thumb = layui.upload.render({
|
||||
elem: '#upload_btn_thumb',
|
||||
url: '/admin/api/upload',
|
||||
done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code == 1) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
//上传成功
|
||||
$('#upload_box_thumb input').attr('value', res.data.id);
|
||||
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||
}
|
||||
});
|
||||
|
||||
//banner图上传
|
||||
var uploadInst2 = layui.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();
|
||||
})
|
||||
|
||||
var tags = new tagpicker({
|
||||
'url': '/admin/api/get_keyword_cate',
|
||||
'target': 'keyword_name',
|
||||
'tag_ids': 'keyword_id',
|
||||
'tag_tags': 'keyword_name',
|
||||
'height': 500,
|
||||
'isDiy': 1
|
||||
});
|
||||
|
||||
//商品描述富文本编辑器
|
||||
var edit = layui.tinymce.render({
|
||||
selector: '#container_content',
|
||||
height: 500
|
||||
});
|
||||
|
||||
//自定义验证规则
|
||||
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 '必填项不能为空';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||
if (data.field.content == '') {
|
||||
layer.msg('请先完善商品描述内容');
|
||||
return false;
|
||||
}
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/goods/edit", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,122 +0,0 @@
|
||||
{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;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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>
|
||||
<td colspan="5">{$detail.title}</td>
|
||||
<td class="layui-td-gray">商品分类</td>
|
||||
<td>{$detail.cate_name}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">关键字</td>
|
||||
<td colspan="5">{$detail.keyword_names}</td>
|
||||
<td class="layui-td-gray" rowspan="3">缩略图<font>*</font></td>
|
||||
<td rowspan="3" style="vertical-align:top">
|
||||
<img src="{$detail.thumb|get_file}" style="width:200px;max-width:200px" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">商品卖点</td>
|
||||
<td colspan="5">{$detail.tips}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray" style="vertical-align:top;">商品简介</td>
|
||||
<td colspan="5">{$detail.desc}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">商品标签</td>
|
||||
<td colspan="8">
|
||||
<input type="checkbox" name="tag_values[]" title="正品保证" lay-skin="primary" disabled value="1" {eq
|
||||
name="$detail.tag1" value="1" }checked{/eq} />
|
||||
<input type="checkbox" name="tag_values[]" title="一年保修" lay-skin="primary" disabled value="2" {eq
|
||||
name="$detail.tag2" value="1" }checked{/eq} />
|
||||
<input type="checkbox" name="tag_values[]" title="七天退换(拆封后不支持)" lay-skin="primary" disabled value="3" {eq
|
||||
name="$detail.tag3" value="1" }checked{/eq} />
|
||||
<input type="checkbox" name="tag_values[]" title="赠运费险" lay-skin="primary" disabled value="4" {eq
|
||||
name="$detail.tag4" value="1" }checked{/eq} />
|
||||
<input type="checkbox" name="tag_values[]" title="闪电发货" lay-skin="primary" disabled value="5" {eq
|
||||
name="$detail.tag5" value="1" }checked{/eq} />
|
||||
<input type="checkbox" name="tag_values[]" title="售后无忧" lay-skin="primary" disabled value="6" {eq
|
||||
name="$detail.tag6" value="1" }checked{/eq} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">市场价格</td>
|
||||
<td>{$detail.base_price}</td>
|
||||
<td class="layui-td-gray">实际价格</td>
|
||||
<td>{$detail.price}</td>
|
||||
<td class="layui-td-gray">商品库存</td>
|
||||
<td>{$detail.stocks}</td>
|
||||
<td class="layui-td-gray">是否包邮</td>
|
||||
<td>
|
||||
{eq name="$detail.is_mail" value="1"}是{/eq}
|
||||
{eq name="$detail.is_mail" value="0"}否{/eq}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">商品属性</td>
|
||||
<td>
|
||||
{eq name="$detail.type" value="1" }精华{/eq}
|
||||
{eq name="$detail.type" value="2" }热门{/eq}
|
||||
{eq name="$detail.type" value="3" }推荐{/eq}
|
||||
</td>
|
||||
<td class="layui-td-gray">首页显示</td>
|
||||
<td>
|
||||
{eq name="$detail.is_home" value="1"}是{/eq}
|
||||
{eq name="$detail.is_home" value="0"}否{/eq}
|
||||
</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>{$detail.sort}</td>
|
||||
<td class="layui-td-gray">状态</td>
|
||||
<td>
|
||||
{eq name="$detail.status" value="1" }正常{/eq}
|
||||
{eq name="$detail.status" value="0" }下架{/eq}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">商品图集</td>
|
||||
<td colspan="7">
|
||||
<div class="layui-upload">
|
||||
<div class="layui-upload-list">
|
||||
{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></div>
|
||||
{/volist}
|
||||
{/notempty}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">商品介绍</td>
|
||||
<td colspan="7">
|
||||
{$detail.content|raw}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
@ -1,72 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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>
|
||||
<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}
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" placeholder="请输入排序,数字" value="0" autocomplete="off" class="layui-input">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">分类名称<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入分类名称" value="" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">关键词</td>
|
||||
<td>
|
||||
<input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" value="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">描述</td>
|
||||
<td colspan="3"><textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea"></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pt-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}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
var 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>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,84 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
|
||||
<div class="p-3">
|
||||
<div class="gg-form-bar border-t border-x">
|
||||
<button class="layui-btn layui-btn-sm add-menu">+ 添加商品分类</button>
|
||||
</div>
|
||||
<div>
|
||||
<table class="layui-hide" id="treeTable" lay-filter="treeTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a><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', 'treeGrid'];
|
||||
function gouguInit() {
|
||||
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
|
||||
var pageTable = treeGrid.render({
|
||||
id:'treeTable'
|
||||
,elem: '#treeTable'
|
||||
,idField:'id'
|
||||
,url:'/admin/goods_cate/datalist'
|
||||
,cellMinWidth: 100
|
||||
,treeId:'id'//树形id字段名称
|
||||
,treeUpId:'pid'//树形父id字段名称
|
||||
,treeShowName:'title'//以树形式显示的字段
|
||||
,cols: [[
|
||||
{field:'id',width:80, title: 'ID号', align:'center'}
|
||||
,{field: 'sort', title: '排序', align:'center', width:80}
|
||||
,{field:'title',width:240, title: '分类名称'}
|
||||
,{field:'pid', title: '父级ID',width:80, align:'center'}
|
||||
,{field:'keywords', title: '关键词', width:200,}
|
||||
,{field:'desc', title: '描述'}
|
||||
,{width:160,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></span>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
]]
|
||||
,page:false
|
||||
//,skin:'line'
|
||||
});
|
||||
//表头工具栏事件
|
||||
$('.add-menu').on('click', function(){
|
||||
tool.side("/admin/goods_cate/add");
|
||||
return;
|
||||
});
|
||||
|
||||
//操作按钮
|
||||
treeGrid.on('tool(treeTable)',function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
tool.side('/admin/goods_cate/add?pid='+obj.data.id);
|
||||
return;
|
||||
}
|
||||
if (obj.event === 'edit') {
|
||||
tool.side('/admin/goods_cate/edit?id='+obj.data.id);
|
||||
return;
|
||||
}
|
||||
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/goods_cate/del", { id: obj.data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,72 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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>
|
||||
<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="$detail.pid" value="$v.id" }selected="" {/eq}>{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" value="{$detail.sort}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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" value="{$detail.title}">
|
||||
</td>
|
||||
<td class="layui-td-gray">关键词</td>
|
||||
<td>
|
||||
<input type="text" name="keywords" placeholder="请输入关键词,用“,”隔开,可空" autocomplete="off" class="layui-input" value="{$detail.keywords}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">描述</td>
|
||||
<td colspan="3"><textarea name="desc" placeholder="请输入描述,可空" class="layui-textarea">{$detail.desc}</textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pt-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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
var 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/edit", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -78,9 +78,45 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-card">
|
||||
<div id="chartView" style="width: 100%;height:300px;"></div>
|
||||
<div class="layui-card dashboard-num">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="num-title">土地总面积</div>
|
||||
<div class="blue">{$land_area_num}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="num-title">农田水利</div>
|
||||
<div class="blue">{$sum_218}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="num-title">坑塘</div>
|
||||
<div class="blue">{$sum_217}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="num-title">养殖</div>
|
||||
<div class="blue">{$sum_216}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="num-title">牧草地</div>
|
||||
<div class="blue">{$sum_215}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="num-title">林地</div>
|
||||
<div class="blue">{$sum_214}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="num-title">耕地</div>
|
||||
<div class="blue">{$sum_70}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="num-title">园地</div>
|
||||
<div class="blue">{$sum_69}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div id="chartYear" style="width: 100%;height:240px;"></div>
|
||||
@ -133,7 +169,7 @@
|
||||
content:'<img src="'+src+'" style="width:100%" align=center />',
|
||||
});
|
||||
})
|
||||
getLogs();
|
||||
// getLogs();
|
||||
//注册用户
|
||||
table.render({
|
||||
elem: '#UserList'
|
||||
@ -174,7 +210,7 @@
|
||||
, { field: 'create_time', title: '发布时间', align: 'center','width': 168}
|
||||
]]
|
||||
});
|
||||
get_view_data();
|
||||
// get_view_data();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,63 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
<h3 class="pb-3">关键字</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<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" {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" {notempty name="$keywords.sort" }value="{$keywords.sort}" {/notempty}>
|
||||
</td>
|
||||
<td class="layui-td-gray">状态
|
||||
</td>
|
||||
<td>
|
||||
{if condition="$id eq 0"}
|
||||
<input type="radio" name="status" value="1" title="正常" checked>
|
||||
<input type="radio" name="status" value="0" title="禁用">
|
||||
{else/}
|
||||
<input type="radio" name="status" value="1" title="正常" {eq name="$keywords.status" value="1"
|
||||
}checked{/eq}>
|
||||
<input type="radio" name="status" value="0" title="禁用" {eq name="$keywords.status" value="0"
|
||||
}checked{/eq}>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<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) {
|
||||
parent.layui.tool.close(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/keywords/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,122 +0,0 @@
|
||||
{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="关键字名称" 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="keywords" lay-filter="keywords"></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">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="add">+ 添加关键字</button>
|
||||
</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: '#keywords',
|
||||
title: '关键字列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/keywords/index',
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[{
|
||||
field: 'id',
|
||||
width: 80,
|
||||
title: 'ID编号',
|
||||
align: 'center'
|
||||
}, {
|
||||
field: 'sort',
|
||||
width: 80,
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
edit: "text"
|
||||
}, {
|
||||
field: 'title',
|
||||
title: '关键字名称',
|
||||
edit: "text"
|
||||
}, {
|
||||
field: 'status',
|
||||
width: 80,
|
||||
title: '状态',
|
||||
templet: '#status',
|
||||
align: 'center'
|
||||
}, {
|
||||
width: 100,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
templet: function (d) {
|
||||
var html = '<div class="layui-btn-group"><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></div>';
|
||||
return html;
|
||||
}
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
if (data.field.keywords) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//表头工具栏事件
|
||||
table.on('toolbar(keywords)', function(obj){
|
||||
if (obj.event === 'add') {
|
||||
tool.side("/admin/keywords/add");
|
||||
return;
|
||||
}
|
||||
});
|
||||
//监听行工具事件
|
||||
table.on('tool(keywords)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'edit') {
|
||||
tool.side('/admin/keywords/add?id='+obj.data.id);
|
||||
return;
|
||||
}
|
||||
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/keywords/delete", { id: data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,97 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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="name" lay-verify="required" autocomplete="off" placeholder="请输入网站名称" lay-reqText="请输入网站名称" class="layui-input" {notempty name="$links.name" }value="{$links.name}" {/notempty}>
|
||||
</td>
|
||||
<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="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}>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">网站链接<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="src" lay-verify="required" autocomplete="off" placeholder="请输入网站链接" lay-reqText="请输入网站链接" class="layui-input" {notempty name="$links.src" }value="{$links.src}" {/notempty}>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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}>
|
||||
<input type="radio" name="target" value="0" title="否" {eq name="$links.target" value="0" }checked{/eq}>
|
||||
{else/}
|
||||
<input type="radio" name="target" value="1" title="是" checked>
|
||||
<input type="radio" name="target" value="0" title="否">
|
||||
{/notempty}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
{notempty name="$links.target" }
|
||||
<input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" value="{$links.sort}">
|
||||
{else/}
|
||||
<input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" value="0">
|
||||
{/notempty}
|
||||
</td>
|
||||
</tr>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var form = layui.form,tool=layui.tool,upload = layui.upload;
|
||||
//pc端图片
|
||||
var uploadInst = upload.render({
|
||||
elem: '#uploadBtn',
|
||||
url: '/admin/api/upload',
|
||||
done: function (e) {
|
||||
//如果上传失败
|
||||
if (e.code == 1) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
//上传成功
|
||||
$('#demo1 input').attr('value', e.data.id);
|
||||
$('#demo1 img').attr('src', e.data.filepath);
|
||||
}
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
parent.layui.tool.close(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/links/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,118 +0,0 @@
|
||||
{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" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="link" lay-filter="link"></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">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="add">+ 添加友情链接</button>
|
||||
</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: '#link',
|
||||
title: '友情链接列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/links/index', //数据接口
|
||||
page: false, //开启分页
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'name',
|
||||
title: '网站名称',
|
||||
width: 240
|
||||
}, {
|
||||
field: 'src',
|
||||
title: '网站链接'
|
||||
}, {
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
width: 80,
|
||||
align: 'center'
|
||||
}, {
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 100,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//表头工具栏事件
|
||||
table.on('toolbar(link)', function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
tool.side("/admin/links/add");
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
//监听行工具事件
|
||||
table.on('tool(link)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'edit') {
|
||||
tool.side('/admin/links/add?id=' + obj.data.id);
|
||||
return;
|
||||
}
|
||||
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/links/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}
|
||||
<!-- /脚本 -->
|
@ -1,63 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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="$nav.title" }value="{$nav.title}" {/notempty}>
|
||||
</td>
|
||||
<td class="layui-td-gray">标识<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入标识" lay-reqText="请输入标识" class="layui-input" {notempty name="$nav.name" }value="{$nav.name}" {/notempty}>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">状态<font>*</font></td>
|
||||
<td colspan="3">
|
||||
{if condition="$id eq 0"}
|
||||
<input type="radio" name="status" value="1" title="正常" checked>
|
||||
<input type="radio" name="status" value="-1" title="禁用">
|
||||
{else/}
|
||||
<input type="radio" name="status" value="1" title="正常" {eq name="$nav.status" value="1" }checked{/eq}>
|
||||
<input type="radio" name="status" value="-1" title="禁用" {eq name="$nav.status" value="-1" }checked{/eq}>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">备注</td>
|
||||
<td colspan="3"><textarea name="desc" placeholder="请输入备注" class="layui-textarea">{notempty name="$nav.desc" }{$nav.desc}{/notempty}</textarea></td>
|
||||
</tr>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<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) {
|
||||
parent.layui.tool.close(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/nav/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,118 +0,0 @@
|
||||
{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" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="nav" lay-filter="nav"></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">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="add">+ 添加导航组</button>
|
||||
</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-xs layui-btn-normal" href="/admin/nav/nav_info?id={{d.id}}">管理导航</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: '#nav',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/nav/index', //数据接口
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[ //表头
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID号',
|
||||
align: 'center',
|
||||
width: 90
|
||||
}, {
|
||||
field: 'title',
|
||||
title: '标题',
|
||||
width: 300
|
||||
}, {
|
||||
field: 'name',
|
||||
title: '标识',
|
||||
align: 'center',
|
||||
width: 150
|
||||
}, {
|
||||
field: 'desc',
|
||||
title: '备注',
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
toolbar: '#status',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 160,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//表头工具栏事件
|
||||
table.on('toolbar(nav)', function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
tool.side("/admin/nav/add");
|
||||
return;
|
||||
}
|
||||
});
|
||||
//监听行工具事件
|
||||
table.on('tool(nav)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'edit') {
|
||||
tool.side('/admin/nav/add?id=' + obj.data.id);
|
||||
return;
|
||||
}
|
||||
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/nav/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}
|
||||
<!-- /脚本 -->
|
@ -1,132 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="p-3">
|
||||
<div class="gg-form-bar border-t border-x">
|
||||
<button class="layui-btn layui-btn-sm add-menu">+ 添加导航</button>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-sm add-back">返回</button>
|
||||
</div>
|
||||
<div>
|
||||
<table class="layui-hide" id="treeTable" lay-filter="treeTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/html" id="target">
|
||||
<i class="layui-icon {{# if(d.target == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="status">
|
||||
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
var nid = {$nav_id};
|
||||
const moduleInit = ['tool', 'treeGrid'];
|
||||
function gouguInit() {
|
||||
var treeGrid = layui.treeGrid,table = layui.table, tool = layui.tool;
|
||||
var pageTable = treeGrid.render({
|
||||
id: 'treeTable',
|
||||
elem: '#treeTable',
|
||||
idField: 'id',
|
||||
url: '/admin/nav/nav_info', //数据接口
|
||||
where: {
|
||||
id:nid
|
||||
},
|
||||
cellMinWidth: 100,
|
||||
treeId: 'id', //树形id字段名称
|
||||
treeUpId: 'pid', //树形父id字段名称
|
||||
treeShowName: 'title', //以树形式显示的字段
|
||||
cols: [
|
||||
[{
|
||||
field: 'sort',
|
||||
width: 80,
|
||||
title: '排序',
|
||||
align: 'center'
|
||||
}, {
|
||||
field: 'id',
|
||||
width: 80,
|
||||
title: 'ID号',
|
||||
align: 'center'
|
||||
}, {
|
||||
field: 'title',
|
||||
width: 220,
|
||||
title: '名称',
|
||||
}, {
|
||||
field: 'pid',
|
||||
title: '父级ID',
|
||||
width: 80,
|
||||
align: 'center'
|
||||
}, {
|
||||
field: 'src',
|
||||
title: '链接'
|
||||
},{
|
||||
field: 'target',
|
||||
title: '新窗口打开',
|
||||
toolbar: '#target',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
toolbar: '#status',
|
||||
align: 'center',
|
||||
width: 60
|
||||
}, {
|
||||
width: 160,
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
templet: function (d) {
|
||||
var html = '';
|
||||
var addBtn =
|
||||
'<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></span>';
|
||||
return addBtn;
|
||||
}
|
||||
}]
|
||||
],
|
||||
page: false
|
||||
});
|
||||
|
||||
//表头工具栏事件
|
||||
$('.add-menu').on('click',function(){
|
||||
tool.side("/admin/nav/nav_info_add?nid="+nid);
|
||||
return;
|
||||
});
|
||||
|
||||
//监听返回
|
||||
$('.add-back').on('click',function () {
|
||||
history.back(-1);
|
||||
return false;
|
||||
});
|
||||
|
||||
//删除
|
||||
treeGrid.on('tool(treeTable)', function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
tool.side('/admin/nav/nav_info_add?nid='+nid+'&pid='+obj.data.id);
|
||||
return;
|
||||
}
|
||||
if (obj.event === 'edit') {
|
||||
tool.side('/admin/nav/nav_info_add?nid='+nid+'&id='+obj.data.id);
|
||||
return;
|
||||
}
|
||||
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/nav/nav_info_delete", { id: obj.data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,99 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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="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>
|
||||
{/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>
|
||||
<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}>
|
||||
</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>
|
||||
<input type="radio" name="target" value="1" title="是">
|
||||
{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}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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="禁用">
|
||||
{else/}
|
||||
<input type="radio" name="status" value="1" title="正常" {eq name="$nav.status" value="1" }checked{/eq}>
|
||||
<input type="radio" name="status" value="-1" title="禁用" {eq name="$nav.status" value="-1" }checked{/eq}>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<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/nav/nav_info_add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,210 +0,0 @@
|
||||
{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;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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 colspan="3"><input type="text" name="title" lay-verify="required" lay-reqText="请输入页面标题" placeholder="请输入页面标题" class="layui-input"></td>
|
||||
<td class="layui-td-gray" rowspan="3">缩略图</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="upload_btn_thumb">上传封面图(尺寸:750x560)</button>
|
||||
<div class="layui-upload-list" id="upload_box_thumb">
|
||||
<img src="" style="width:200px;max-width:200px" />
|
||||
<input type="hidden" name="thumb" value="">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">关键字<font>*</font></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>
|
||||
</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">图集相册</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">
|
||||
<img src="" width="100" style="width:200px;max-width:200px" />
|
||||
<input type="hidden" name="banner" value="" >
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">展示模板<font>*</font></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-2">URL文件名称</td>
|
||||
<td>
|
||||
<input type="text" name="name" placeholder="请输入URL文件名称" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">状态</td>
|
||||
<td>
|
||||
<input type="radio" name="status" value="1" title="正常" checked>
|
||||
<input type="radio" name="status" value="0" title="下架">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" class="layui-td-gray" style="text-align:left">页面内容<font>*</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<textarea class="layui-textarea" id="container_content"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pt-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}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{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);
|
||||
}
|
||||
};
|
||||
var moduleInit = ['tool','tagpicker','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
var form = layui.form, tool = layui.tool,tagpicker = layui.tagpicker;
|
||||
|
||||
//上传缩略图
|
||||
var upload_thumb = layui.upload.render({
|
||||
elem: '#upload_btn_thumb',
|
||||
url: '/admin/api/upload',
|
||||
done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code == 1) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
//上传成功
|
||||
$('#upload_box_thumb input').attr('value', res.data.id);
|
||||
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||
}
|
||||
});
|
||||
|
||||
var tags = new tagpicker({
|
||||
'url': '/admin/api/get_keyword_cate',
|
||||
'target': 'keyword_name',
|
||||
'tag_ids': 'keyword_id',
|
||||
'tag_tags': 'keyword_name',
|
||||
'height': 500,
|
||||
'isDiy': 1
|
||||
});
|
||||
|
||||
//banner图上传
|
||||
var uploadInst2 = layui.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();
|
||||
})
|
||||
|
||||
//内容描述富文本编辑器
|
||||
var edit = layui.tinymce.render({
|
||||
selector: '#container_content',
|
||||
height: 500
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||
if (data.field.content == '') {
|
||||
layer.msg('请先完善内容描述内容');
|
||||
return false;
|
||||
}
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/pages/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,151 +0,0 @@
|
||||
{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="请输入关键字" class="layui-input" autocomplete="off" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">提交搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="pages" lay-filter="pages"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加单页面">+ 添加单页面</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="status">
|
||||
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok green{{# } else { }}layui-icon-close red{{# } }}"></i>
|
||||
</script>
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" href="/home/pages/detail/id/{{d.id}}.html" target="_blank">查看</a><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/datalist',
|
||||
page: true,
|
||||
limit: 20,
|
||||
cellMinWidth: 300,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
fixed: 'left',
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},{
|
||||
field: 'title',
|
||||
title: '页面名称',
|
||||
},{
|
||||
field: 'read',
|
||||
title: '阅读量',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'name',
|
||||
title: 'URL文件名',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'template',
|
||||
title: '前端模板',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'admin_name',
|
||||
title: '创建人',
|
||||
align: 'center',
|
||||
width: 100
|
||||
},{
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '上下架',
|
||||
toolbar: '#status',
|
||||
align: 'center',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
fixed: 'right',
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 136,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听表头工具栏事件
|
||||
table.on('toolbar(pages)', function(obj){
|
||||
if (obj.event === 'add') {
|
||||
tool.side("/admin/pages/add");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//监听表格行工具事件
|
||||
table.on('tool(pages)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'read') {
|
||||
tool.side('/admin/pages/read?id='+obj.data.id);
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
tool.side('/admin/pages/edit?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/del", { id: data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(searchform)', function(data) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,215 +0,0 @@
|
||||
{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;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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 colspan="3"><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">缩略图</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="upload_btn_thumb">上传封面图(尺寸:750x560)</button>
|
||||
<div class="layui-upload-list" id="upload_box_thumb">
|
||||
<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">关键字<font>*</font></td>
|
||||
<td colspan="3">
|
||||
<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 colspan="3">
|
||||
<textarea name="desc" placeholder="请输入页面摘要,200字以内" class="layui-textarea">{$detail.desc}</textarea>
|
||||
</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="{$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">展示模板<font>*</font></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-2">URL文件名称</td>
|
||||
<td>
|
||||
<input type="text" name="name" value="{$detail.name}" placeholder="请输入URL文件名称" class="layui-input">
|
||||
</td>
|
||||
<td class="layui-td-gray">状态<font>*</font></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>
|
||||
<tr>
|
||||
<td colspan="6" class="layui-td-gray" style="text-align:left">页面内容<font>*</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<textarea placeholder="请输入内容" class="layui-textarea" id="container_content">{$detail.content}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pt-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>
|
||||
</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);
|
||||
}
|
||||
};
|
||||
var moduleInit = ['tool','tagpicker','tinymce'];
|
||||
|
||||
function gouguInit() {
|
||||
var form = layui.form, tool = layui.tool,tagpicker = layui.tagpicker;
|
||||
|
||||
//上传缩略图
|
||||
var upload_thumb = layui.upload.render({
|
||||
elem: '#upload_btn_thumb',
|
||||
url: '/admin/api/upload',
|
||||
done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code == 1) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
//上传成功
|
||||
$('#upload_box_thumb input').attr('value', res.data.id);
|
||||
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||
}
|
||||
});
|
||||
|
||||
var tags = new tagpicker({
|
||||
'url': '/admin/api/get_keyword_cate',
|
||||
'target': 'keyword_name',
|
||||
'tag_ids': 'keyword_id',
|
||||
'tag_tags': 'keyword_name',
|
||||
'height': 500,
|
||||
'isDiy': 1
|
||||
});
|
||||
|
||||
//banner图上传
|
||||
var uploadInst2 = layui.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();
|
||||
})
|
||||
|
||||
//内容描述富文本编辑器
|
||||
var edit = layui.tinymce.render({
|
||||
selector: '#container_content',
|
||||
height: 500
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||
if (data.field.content == '') {
|
||||
layer.msg('请先完善内容描述内容');
|
||||
return false;
|
||||
}
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.sideClose(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/pages/edit", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,39 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="layui-form p-4">
|
||||
<h3 class="pb-3">单页面详情</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr><td class="layui-td-gray-2">页面名称</td>
|
||||
<td>{$detail.title}</td><td class="layui-td-gray-2">图集相册</td>
|
||||
<td>{$detail.banner}</td><td class="layui-td-gray-2">阅读量</td>
|
||||
<td>{$detail.read}</td>
|
||||
</tr><tr><td class="layui-td-gray-2">排序</td>
|
||||
<td>{$detail.sort}</td><td class="layui-td-gray-2">URL文件名</td>
|
||||
<td>{$detail.name}</td><td class="layui-td-gray-2">前端模板</td>
|
||||
<td>
|
||||
{eq name="$detail.template" value="1"}选项一{/eq}
|
||||
{eq name="$detail.template" value="2"}选项二{/eq}
|
||||
</td>
|
||||
</tr><tr><td class="layui-td-gray-2">创建人</td>
|
||||
<td>{$detail.admin_id}</td><td class="layui-td-gray-2">创建时间</td>
|
||||
<td>{$detail.create_time}</td><td colspan='2'></td>
|
||||
</tr><tr><td class="layui-td-gray-2">页面摘要</td>
|
||||
<td colspan="5">{$detail.desc}</td>
|
||||
</tr><tr><td class="layui-td-gray-2">缩略图</td>
|
||||
<td colspan="5" style="vertical-align:top">
|
||||
<div class="layui-upload" style="text-align:center;">
|
||||
<div class="layui-upload-list">
|
||||
<img src="{$detail.thumb}" width="100" style="width:200px; max-width:200px" />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr><tr><td class="layui-td-gray-2">内容描述</td>
|
||||
<td colspan="5">
|
||||
{$detail.content}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
@ -1,47 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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="name" lay-verify="required" autocomplete="off" placeholder="请输入分类名" lay-reqText="请输入分类名" class="layui-input" {notempty name="$cate.name" }value="{$cate.name}" {/notempty}>
|
||||
</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td>
|
||||
<input type="text" name="sort" autocomplete="off" placeholder="请输入排序" class="layui-input" {notempty name="$cate.sort" }value="{$cate.sort}" {else/} value="0"{/notempty}>
|
||||
</td>
|
||||
</tr>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<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) {
|
||||
parent.layui.tool.close(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/sitemap/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,112 +0,0 @@
|
||||
{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" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
|
||||
</form>
|
||||
<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>
|
||||
</script>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="add">+ 添加网站地图分类</button>
|
||||
</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-xs layui-btn-normal" href="/admin/sitemap/sitemap_info?id={{d.id}}">网站地图详情</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: '#sitemap',
|
||||
title: '网站地图分类列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/sitemap/index', //数据接口
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[ //表头
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'name',
|
||||
title: '网站地图分类名称'
|
||||
}, {
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
align: 'center',
|
||||
width: 200
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//表头工具栏事件
|
||||
table.on('toolbar(sitemap)', function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
tool.side("/admin/sitemap/add", "900px");
|
||||
return;
|
||||
}
|
||||
});
|
||||
//监听行工具事件
|
||||
table.on('tool(sitemap)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'edit') {
|
||||
tool.side('/admin/sitemap/add?id=' + obj.data.id, "900px");
|
||||
return;
|
||||
}
|
||||
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/sitemap/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}
|
||||
<!-- /脚本 -->
|
@ -1,108 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm add-menu">+ 添加网站地图</button>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-sm add-back">返回</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><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></div>
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
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', //数据接口
|
||||
where: {
|
||||
id: sitemap_cate_id
|
||||
},
|
||||
page: false, //开启分页
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
width: 80,
|
||||
align: 'center'
|
||||
}, {
|
||||
field: 'name',
|
||||
title: '标题',
|
||||
width: 200
|
||||
}, {
|
||||
field: 'pc_src',
|
||||
title: 'pc端链接'
|
||||
}, {
|
||||
field: 'mobile_src',
|
||||
title: '移动端链接'
|
||||
}, {
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 100,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//表头工具栏事件
|
||||
$('body').on('click','.add-menu',function(){
|
||||
tool.side("/admin/sitemap/sitemap_info_add?cid="+sitemap_cate_id);
|
||||
return;
|
||||
});
|
||||
|
||||
//监听返回
|
||||
$('body').on('click','.add-back',function () {
|
||||
history.back(-1);
|
||||
return false;
|
||||
});
|
||||
//监听行工具事件
|
||||
table.on('tool(sitemap_cate)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'edit') {
|
||||
tool.side('/admin/sitemap/sitemap_info_add?id='+obj.data.id);
|
||||
return;
|
||||
}
|
||||
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/sitemap/sitemap_info_delete", { id: data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,112 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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="name" lay-verify="required" autocomplete="off" placeholder="请输入标题" lay-reqText="请输入标题" class="layui-input" {notempty name="$sitemap.name" }value="{$sitemap.name}" {/notempty}>
|
||||
</td>
|
||||
<td class="layui-td-gray">排序</td>
|
||||
<td><input type="text" name="sort" placeholder="请输入排序,数字" autocomplete="off" class="layui-input" {notempty name="$sitemap.sort" }value="{$sitemap.sort}" {/notempty}></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">PC端链接<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="pc_src" lay-verify="required" autocomplete="off" placeholder="请输入PC端链接" lay-reqText="请输入PC端链接" class="layui-input" {notempty name="$sitemap.pc_src"}value="{$sitemap.pc_src}" {/notempty}>
|
||||
</td>
|
||||
<td class="layui-td-gray">移动端链接<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="mobile_src" lay-verify="required" autocomplete="off" placeholder="请输入移动端链接" lay-reqText="请输入移动端链接" class="layui-input" {notempty name="$sitemap.mobile_src"}value="{$sitemap.mobile_src}" {/notempty}>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">PC端图片</td>
|
||||
<td>
|
||||
<div class="layui-upload">
|
||||
<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-2">移动端图片</td>
|
||||
<td>
|
||||
<div class="layui-upload">
|
||||
<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}>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="py-3">
|
||||
{notempty name="$sitemap.sitemap_cate_id" }
|
||||
<input type="hidden" name="sitemap_cate_id" value="{$sitemap.sitemap_cate_id}" />
|
||||
{else/}
|
||||
<input type="hidden" name="sitemap_cate_id" value="{$sitemap_cate_id}" />
|
||||
{/notempty}
|
||||
<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}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var form = layui.form,tool=layui.tool,upload = layui.upload;
|
||||
//pc端图片
|
||||
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('上传失败');
|
||||
}
|
||||
//上传成功
|
||||
$('#demo2 input').attr('value', res.data.id);
|
||||
$('#demo2 img').attr('src', res.data.filepath);
|
||||
}
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
parent.layui.tool.close(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/sitemap/sitemap_info_add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,64 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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" lay-reqText="请输入标题" autocomplete="off" placeholder="请输入标题" class="layui-input" {notempty name="$slide.title" }value="{$slide.title}" {/notempty}>
|
||||
</td>
|
||||
<td class="layui-td-gray">标识</td>
|
||||
<td><input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入标识" lay-reqText="请输入标识" class="layui-input" {notempty name="$slide.name" }value="{$slide.name}" {/notempty}></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">状态<font>*</font></td>
|
||||
<td colspan="3">
|
||||
{if condition="$id eq 0"}
|
||||
<input type="radio" name="status" value="1" title="正常" checked>
|
||||
<input type="radio" name="status" value="-1" title="禁用">
|
||||
{else/}
|
||||
<input type="radio" name="status" value="1" title="正常" {eq name="$slide.status" value="1" }checked{/eq}>
|
||||
<input type="radio" name="status" value="-1" title="禁用" {eq name="$slide.status" value="-1"
|
||||
}checked{/eq}>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">备注</td>
|
||||
<td colspan="3">
|
||||
<textarea name="desc" placeholder="请输入备注" class="layui-textarea">{notempty name="$slide.desc" }{$slide.desc}{/notempty}</textarea>
|
||||
</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>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<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) {
|
||||
parent.layui.tool.close(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/slide/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,123 +0,0 @@
|
||||
{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" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="slide" lay-filter="slide"></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">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="add">+ 添加轮播组</button>
|
||||
</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-xs layui-btn-normal" href="/admin/slide/slide_info?id={{d.id}}">管理轮播</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: '#slide',
|
||||
title: '轮播组列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/slide/index', //数据接口
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'title',
|
||||
title: '标题',
|
||||
width: 240
|
||||
}, {
|
||||
field: 'name',
|
||||
title: '标识',
|
||||
align: 'center',
|
||||
width: 160
|
||||
}, {
|
||||
field: 'desc',
|
||||
title: '备注'
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
toolbar: '#status',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 160,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//表头工具栏事件
|
||||
table.on('toolbar(slide)', function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
tool.side("/admin/slide/add");
|
||||
return;
|
||||
}
|
||||
});
|
||||
//监听行工具事件
|
||||
table.on('tool(slide)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'edit') {
|
||||
tool.side('/admin/slide/add?id=' + obj.data.id);
|
||||
return;
|
||||
}
|
||||
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/slide/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}
|
||||
<!-- /脚本 -->
|
@ -1,121 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="p-3">
|
||||
<table class="layui-hide" id="slide_info" lay-filter="slide_info"></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">
|
||||
<button class="layui-btn layui-btn-sm add-menu">+ 添加轮播</button>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-sm add-back">返回</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><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></a>
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
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', //数据接口
|
||||
where: {
|
||||
id: slide_id
|
||||
},
|
||||
page: false, //开启分页
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'sort',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'title',
|
||||
title: '标题',
|
||||
width: 300
|
||||
}, {
|
||||
field: 'img',
|
||||
title: '图片',
|
||||
width: 136,
|
||||
align: 'center',
|
||||
templet: function (d) {
|
||||
var html = '<img src="' + d.filepath + '" style="max-width: 100px;" />';
|
||||
return html;
|
||||
}
|
||||
}, {
|
||||
field: 'desc',
|
||||
title: '描述'
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
toolbar: '#status',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'right',
|
||||
title: '操作',
|
||||
toolbar: '#barDemo',
|
||||
width: 100,
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//表头工具栏事件
|
||||
$('body').on('click', '.add-menu', function () {
|
||||
tool.side("/admin/slide/slide_info_add?sid=" + slide_id);
|
||||
return;
|
||||
});
|
||||
|
||||
//监听返回
|
||||
$('body').on('click', '.add-back', function () {
|
||||
history.back(-1);
|
||||
return false;
|
||||
});
|
||||
//监听行工具事件
|
||||
table.on('tool(slide_info)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'edit') {
|
||||
tool.side('/admin/slide/slide_info_add?id=' + obj.data.id);
|
||||
return;
|
||||
}
|
||||
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/slide/slide_info_delete", { id: data.id }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,106 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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 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}>
|
||||
</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="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}>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">链接</td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="src" autocomplete="off" placeholder="请输入链接" class="layui-input" {notempty
|
||||
name="$slide_info.src" }value="{$slide_info.src}" {/notempty}>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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="禁用">
|
||||
{else/}
|
||||
<input type="radio" name="status" value="1" title="正常" {eq name="$slide_info.status" value="1" }checked{/eq}>
|
||||
<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><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>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="padding: 10px 0">
|
||||
<input type="hidden" name="slide_id" value="{$slide_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>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var form = layui.form, tool = layui.tool, upload = layui.upload;
|
||||
//头像上传
|
||||
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) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
parent.layui.tool.close(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/slide/slide_info_add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,98 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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="{$user.id}">
|
||||
<select name="level" lay-verify="required" lay-reqText="请选择用户等级">
|
||||
<option value="">请选择用户等级</option>
|
||||
{volist name="levels" id="v"}
|
||||
<option value="{$v.id}" {eq name="$user.level" value="$v.id"}selected{/eq}>{$v.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
<td class="layui-td-gray">用户昵称<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="nickname" placeholder="请输入用户昵称" autocomplete="off" class="layui-input" value="{$user.nickname}" lay-verify="required" lay-reqText="请输入用户昵称">
|
||||
</td>
|
||||
<td class="layui-td-gray">真实姓名</td>
|
||||
<td>
|
||||
<input type="text" name="name" placeholder="请输入真实姓名" autocomplete="off" class="layui-input" value="{$user.name}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">性别</td>
|
||||
<td>
|
||||
<input type="radio" name="sex" value="1" title="男" {eq name="$user.sex" value="1" }checked{/eq}>
|
||||
<input type="radio" name="sex" value="2" title="女" {eq name="$user.sex" value="2" }checked{/eq}>
|
||||
</td>
|
||||
<td class="layui-td-gray">手机号码</td>
|
||||
<td>
|
||||
<input type="text" name="mobile" placeholder="请输入手机" autocomplete="off" class="layui-input" value="{$user.mobile}">
|
||||
</td>
|
||||
<td class="layui-td-gray">电子邮箱</td>
|
||||
<td>
|
||||
<input type="text" name="email" placeholder="请输入电子邮箱" autocomplete="off" class="layui-input" value="{$user.email}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">个人简介</td>
|
||||
<td colspan="5">
|
||||
<textarea name="desc" placeholder="请输入个人简介" class="layui-textarea">{$user.desc}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">所在企业</td>
|
||||
<td>
|
||||
<input type="text" name="company" placeholder="请输入所在企业" autocomplete="off" class="layui-input" value="{$user.company}">
|
||||
</td>
|
||||
<td class="layui-td-gray">所在部门</td>
|
||||
<td>
|
||||
<input type="text" name="depament" placeholder="请输入所在部门" autocomplete="off" class="layui-input" value="{$user.depament}">
|
||||
</td>
|
||||
<td class="layui-td-gray">所在职位</td>
|
||||
<td>
|
||||
<input type="text" name="position" placeholder="请输入所在职位" autocomplete="off" class="layui-input" value="{$user.position}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">企业地址</td>
|
||||
<td colspan="5">
|
||||
<input type="text" name="address" placeholder="请输入企业地址" autocomplete="off" class="layui-input" value="{$user.address}">
|
||||
</td>
|
||||
</tr>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var tool = layui.tool, form = layui.form;
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
parent.layui.tool.close(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/admin/user/edit", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,203 +0,0 @@
|
||||
{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="昵称/真实姓名/手机号" 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">
|
||||
</div>
|
||||
~
|
||||
<div class="layui-input-inline" style="width:120px;">
|
||||
<input type="text" class="layui-input" id="end_time" readonly placeholder="注册结束时间" name="end_time">
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
|
||||
</form>
|
||||
<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>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
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'
|
||||
});
|
||||
|
||||
laydate.render({
|
||||
elem: '#end_time',
|
||||
type: 'date'
|
||||
});
|
||||
|
||||
layui.pageTable = table.render({
|
||||
elem: '#user',
|
||||
title: '用户列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/user/index', //数据接口
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[ //表头
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID号',
|
||||
align: 'center',
|
||||
width: 90
|
||||
}, {
|
||||
field: 'headimgurl',
|
||||
title: '头像',
|
||||
align: 'center',
|
||||
width: 60,
|
||||
templet: function (d) {
|
||||
var html = '';
|
||||
var delBtn = '<img src="' + d.headimgurl + '" width="28" height="28"/>';
|
||||
return delBtn;
|
||||
}
|
||||
}, {
|
||||
field: 'username',
|
||||
title: '用户名',
|
||||
align: 'center',
|
||||
width: 100
|
||||
}, {
|
||||
field: 'level_name',
|
||||
title: '会员等级',
|
||||
align: 'center',
|
||||
width: 90
|
||||
}, {
|
||||
field: 'sex',
|
||||
title: '性别',
|
||||
align: 'center',
|
||||
width: 60,
|
||||
templet: function (d) {
|
||||
var html = '-';
|
||||
if (d.sex == 1) {
|
||||
html = '男'
|
||||
} else if (d.sex == 2) {
|
||||
html = '女'
|
||||
}
|
||||
return html;
|
||||
}
|
||||
}, {
|
||||
field: 'nickname',
|
||||
title: '昵称',
|
||||
align: 'center',
|
||||
width: 100
|
||||
}, {
|
||||
field: 'name',
|
||||
title: '真实姓名',
|
||||
align: 'center',
|
||||
width: 100
|
||||
}, {
|
||||
field: 'mobile',
|
||||
title: '手机号码',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
field: 'email',
|
||||
title: '电子邮箱',
|
||||
align: 'center',
|
||||
minWidth: 150
|
||||
}, {
|
||||
field: 'register_time',
|
||||
title: '注册时间',
|
||||
align: 'center',
|
||||
width: 150
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
toolbar: '#status',
|
||||
align: 'center',
|
||||
width: 60
|
||||
}, {
|
||||
field: 'right',
|
||||
fixed: 'right',
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
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(user)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'view') {
|
||||
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') {
|
||||
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/user/disable", { id: data.id, status: 0 }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
} else 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/user/disable", { id: data.id, status: 1 }, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
//监听搜索提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
layui.pageTable.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords,
|
||||
attach: data.field.attach,
|
||||
start_time: data.field.start_time,
|
||||
end_time: data.field.end_time
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,97 +0,0 @@
|
||||
{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>
|
||||
<div class="layui-input-inline">
|
||||
<select name="action">
|
||||
<option value="">请选择类型</option>
|
||||
{volist name="$type_action" id="vo"}
|
||||
<option value="{$vo}">{$vo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
|
||||
</form>
|
||||
<table class="layui-hide" id="log" lay-filter="log"></table>
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var table = layui.table, form = layui.form;
|
||||
var tableIns = table.render({
|
||||
elem: '#log',
|
||||
title: '用户操作日志列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: '/admin/user/log', //数据接口
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID号',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'title',
|
||||
title: '操作类型',
|
||||
align: 'center',
|
||||
width: 80
|
||||
}, {
|
||||
field: 'content',
|
||||
title: '操作描述',
|
||||
width: 300
|
||||
},{
|
||||
field: 'param_id',
|
||||
title: '操作数据ID',
|
||||
align: 'center',
|
||||
width: 100
|
||||
}, {
|
||||
field: 'param',
|
||||
title: '操作数据'
|
||||
}, {
|
||||
field: 'nickname',
|
||||
title: '昵称',
|
||||
align: 'center',
|
||||
width: 90
|
||||
}, {
|
||||
field: 'ip',
|
||||
title: 'IP地址',
|
||||
align: 'center',
|
||||
width: 130
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '操作时间',
|
||||
align: 'center',
|
||||
width: 160
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
tableIns.reload({
|
||||
where: {
|
||||
keywords: data.field.keywords,
|
||||
action: data.field.action
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,88 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
{block name="style"}
|
||||
<style type="text/css">
|
||||
.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="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}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
var page=1,limit=20;
|
||||
function getLogs() {
|
||||
$.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();
|
||||
})
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
@ -1,113 +0,0 @@
|
||||
{extend name="common/base"/}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<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>
|
||||
<td>
|
||||
{$user.username}
|
||||
</td>
|
||||
<td class="layui-td-gray">会员等级</td>
|
||||
<td>
|
||||
{$user.level_name}
|
||||
</td>
|
||||
<td rowspan="4" class="layui-td-gray">头像</td>
|
||||
<td rowspan="4" valign="top" style="width: 150px;">
|
||||
<div class="layui-upload">
|
||||
<img src="{$user.headimgurl}" width="150" height="150" style="max-width: 100%;" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">注册时间</td>
|
||||
<td>
|
||||
{$user.register_time | date='Y-m-d H:i:s'}
|
||||
</td>
|
||||
<td class="layui-td-gray">注册IP</td>
|
||||
<td>
|
||||
{$user.register_ip}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">真实姓名</td>
|
||||
<td>
|
||||
{$user.name}
|
||||
</td>
|
||||
<td class="layui-td-gray">状态</td>
|
||||
<td>
|
||||
{eq name="$user.status" value="1" }正常{/eq}
|
||||
{eq name="$user.status" value="0" }禁止登录{/eq}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">手机号码</td>
|
||||
<td>
|
||||
{$user.mobile}
|
||||
</td>
|
||||
<td class="layui-td-gray">电子邮箱</td>
|
||||
<td>
|
||||
{$user.email}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">昵称</td>
|
||||
<td>
|
||||
{$user.nickname}
|
||||
</td>
|
||||
<td class="layui-td-gray">性别</td>
|
||||
<td>
|
||||
{eq name="$user.sex" value="1" }男{/eq}
|
||||
{eq name="$user.sex" value="2" }女{/eq}
|
||||
{eq name="$user.sex" value="0" }未知{/eq}
|
||||
</td>
|
||||
<td class="layui-td-gray">生日</td>
|
||||
<td>
|
||||
{$user.birthday | date='Y-m-d'}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">个人简介</td>
|
||||
<td colspan="5">
|
||||
{$user.desc}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">所在企业</td>
|
||||
<td>
|
||||
{$user.company}
|
||||
</td>
|
||||
<td class="layui-td-gray">所在部门</td>
|
||||
<td>
|
||||
{$user.depament}
|
||||
</td>
|
||||
<td class="layui-td-gray">所在职位</td>
|
||||
<td>
|
||||
{$user.position}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray">企业地址</td>
|
||||
<td colspan="5">
|
||||
{$user.address}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">最后登录IP</td>
|
||||
<td>
|
||||
{$user.last_login_ip}
|
||||
</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-gray">累计登录</td>
|
||||
<td>
|
||||
{$user.login_num}次
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
Loading…
x
Reference in New Issue
Block a user