后台分类管理、自治管理,接口修改
This commit is contained in:
parent
fedb471f5f
commit
25e2daafc0
@ -339,9 +339,18 @@ class Api extends BaseController
|
|||||||
|
|
||||||
public function getbytype(){
|
public function getbytype(){
|
||||||
$type = get_params("type");
|
$type = get_params("type");
|
||||||
|
$flag = get_params("flag");
|
||||||
$where['type'] = $type;
|
$where['type'] = $type;
|
||||||
$where['status'] = 'normal';
|
$where['status'] = 'normal';
|
||||||
$list = Db::table('fa_category')->where($where)->order('weigh asc,id asc')->select();
|
$list = Db::table('fa_category')->field('id,pid,type,name')->where($where)->where('pid','<>',0)->order('weigh asc,id asc')->select()->toArray();
|
||||||
|
|
||||||
|
// 添加无
|
||||||
|
$wu['id'] = 0;
|
||||||
|
$wu['pid'] = 0;
|
||||||
|
$wu['type'] = 0;
|
||||||
|
$wu['name'] = '无';
|
||||||
|
array_unshift ($list,$wu);
|
||||||
|
|
||||||
return to_assign(0, '', $list);
|
return to_assign(0, '', $list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
86
app/admin/controller/nk/Affairs.php
Normal file
86
app/admin/controller/nk/Affairs.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
use app\admin\BaseController;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\facade\Db;
|
||||||
|
use app\admin\controller\nk\Article;
|
||||||
|
use think\facade\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章
|
||||||
|
*
|
||||||
|
* @icon fa fa-circle-o
|
||||||
|
*/
|
||||||
|
class Affairs extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->adminInfo = get_login_admin();
|
||||||
|
$this->category_id=160;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.affairs/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.affairs/add',
|
||||||
|
'/admin/nk.affairs/edit',
|
||||||
|
'/admin/nk.affairs/del',
|
||||||
|
'/admin/nk.affairs/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查看
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
(new Article())->index($params);
|
||||||
|
}
|
||||||
|
return view('nk/article/index',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
(new Article())->add($params);
|
||||||
|
}else{
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
View::assign('url', $this->url);
|
||||||
|
return view('nk/article/add');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->edit($params);
|
||||||
|
return view('nk/article/edit',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查看信息
|
||||||
|
*/
|
||||||
|
public function read()
|
||||||
|
{
|
||||||
|
$params = get_params();
|
||||||
|
(new Article())->read($params);
|
||||||
|
|
||||||
|
return view('nk/article/read',['url'=>$this->url]);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public function del()
|
||||||
|
{
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->del($params);
|
||||||
|
}
|
||||||
|
}
|
@ -45,12 +45,46 @@ class Category extends BaseController
|
|||||||
$param = get_params();
|
$param = get_params();
|
||||||
if (request()->isAjax()) {
|
if (request()->isAjax()) {
|
||||||
|
|
||||||
return to_assign();
|
if($param['pid'] == 0){
|
||||||
|
$www['pid'] = 0;
|
||||||
|
$www['type'] = $param['type'];
|
||||||
|
$pid = Db::table('fa_category')->where($www)->value('id');
|
||||||
|
if($pid){
|
||||||
|
$param['pid'] = $pid;
|
||||||
|
}else{
|
||||||
|
return to_assign(1, '操作失败,请联系系统管理员');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($param['id'] > 0) {
|
||||||
|
$param['updatetime'] = time();
|
||||||
|
$res = Db::table('fa_category')->strict(false)->field(true)->where('id',$param['id'])->update($param);
|
||||||
|
if ($res){
|
||||||
|
add_log('edit', $param['id'], $param);
|
||||||
|
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||||
|
}
|
||||||
|
return to_assign(1, '操作失败,原因:'.$res);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$param['nickname'] = $param['name'];
|
||||||
|
$param['createtime'] = time();
|
||||||
|
unset($param['id']);
|
||||||
|
$res=Db::table('fa_category')->strict(false)->field(true)->insertGetId($param);
|
||||||
|
if ($res){
|
||||||
|
add_log('add', $res, $param);
|
||||||
|
return to_assign(0,'操作成功',['aid'=>$res]);
|
||||||
|
}
|
||||||
|
return to_assign(1, '操作失败,原因:'.$res);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$id = isset($param['id']) ? $param['id'] : 0;
|
$id = isset($param['id']) ? $param['id'] : 0;
|
||||||
$pid = isset($param['pid']) ? $param['pid'] : 0;
|
$pid = isset($param['pid']) ? $param['pid'] : 0;
|
||||||
if($id>0){
|
if($id>0){
|
||||||
$detail = Db::name('fa_category')->where('id',$id)->find();
|
$detail = Db::table('fa_category')->where('id',$id)->find();
|
||||||
|
View::assign('detail', $detail);
|
||||||
|
}else{
|
||||||
|
$detail['pid'] = '';
|
||||||
|
$detail['type'] = '';
|
||||||
View::assign('detail', $detail);
|
View::assign('detail', $detail);
|
||||||
}
|
}
|
||||||
View::assign('id', $id);
|
View::assign('id', $id);
|
||||||
|
86
app/admin/controller/nk/Finance.php
Normal file
86
app/admin/controller/nk/Finance.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
use app\admin\BaseController;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\facade\Db;
|
||||||
|
use app\admin\controller\nk\Article;
|
||||||
|
use think\facade\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章
|
||||||
|
*
|
||||||
|
* @icon fa fa-circle-o
|
||||||
|
*/
|
||||||
|
class Finance extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->adminInfo = get_login_admin();
|
||||||
|
$this->category_id=161;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.finance/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.finance/add',
|
||||||
|
'/admin/nk.finance/edit',
|
||||||
|
'/admin/nk.finance/del',
|
||||||
|
'/admin/nk.finance/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查看
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
(new Article())->index($params);
|
||||||
|
}
|
||||||
|
return view('nk/article/index',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
(new Article())->add($params);
|
||||||
|
}else{
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
View::assign('url', $this->url);
|
||||||
|
return view('nk/article/add');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->edit($params);
|
||||||
|
return view('nk/article/edit',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查看信息
|
||||||
|
*/
|
||||||
|
public function read()
|
||||||
|
{
|
||||||
|
$params = get_params();
|
||||||
|
(new Article())->read($params);
|
||||||
|
|
||||||
|
return view('nk/article/read',['url'=>$this->url]);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public function del()
|
||||||
|
{
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->del($params);
|
||||||
|
}
|
||||||
|
}
|
86
app/admin/controller/nk/Meeting.php
Normal file
86
app/admin/controller/nk/Meeting.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
use app\admin\BaseController;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\facade\Db;
|
||||||
|
use app\admin\controller\nk\Article;
|
||||||
|
use think\facade\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章
|
||||||
|
*
|
||||||
|
* @icon fa fa-circle-o
|
||||||
|
*/
|
||||||
|
class Meeting extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->adminInfo = get_login_admin();
|
||||||
|
$this->category_id=162;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.meeting/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.meeting/add',
|
||||||
|
'/admin/nk.meeting/edit',
|
||||||
|
'/admin/nk.meeting/del',
|
||||||
|
'/admin/nk.meeting/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查看
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
(new Article())->index($params);
|
||||||
|
}
|
||||||
|
return view('nk/article/index',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
(new Article())->add($params);
|
||||||
|
}else{
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
View::assign('url', $this->url);
|
||||||
|
return view('nk/article/add');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->edit($params);
|
||||||
|
return view('nk/article/edit',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查看信息
|
||||||
|
*/
|
||||||
|
public function read()
|
||||||
|
{
|
||||||
|
$params = get_params();
|
||||||
|
(new Article())->read($params);
|
||||||
|
|
||||||
|
return view('nk/article/read',['url'=>$this->url]);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public function del()
|
||||||
|
{
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->del($params);
|
||||||
|
}
|
||||||
|
}
|
86
app/admin/controller/nk/Party.php
Normal file
86
app/admin/controller/nk/Party.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
use app\admin\BaseController;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\facade\Db;
|
||||||
|
use app\admin\controller\nk\Article;
|
||||||
|
use think\facade\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章
|
||||||
|
*
|
||||||
|
* @icon fa fa-circle-o
|
||||||
|
*/
|
||||||
|
class Party extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->adminInfo = get_login_admin();
|
||||||
|
$this->category_id=176;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.party/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.party/add',
|
||||||
|
'/admin/nk.party/edit',
|
||||||
|
'/admin/nk.party/del',
|
||||||
|
'/admin/nk.party/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查看
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
(new Article())->index($params);
|
||||||
|
}
|
||||||
|
return view('nk/article/index',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
(new Article())->add($params);
|
||||||
|
}else{
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
View::assign('url', $this->url);
|
||||||
|
return view('nk/article/add');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->edit($params);
|
||||||
|
return view('nk/article/edit',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查看信息
|
||||||
|
*/
|
||||||
|
public function read()
|
||||||
|
{
|
||||||
|
$params = get_params();
|
||||||
|
(new Article())->read($params);
|
||||||
|
|
||||||
|
return view('nk/article/read',['url'=>$this->url]);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public function del()
|
||||||
|
{
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->del($params);
|
||||||
|
}
|
||||||
|
}
|
26
app/admin/validate/UserCheck.php
Normal file
26
app/admin/validate/UserCheck.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?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' => '验证码不正确',
|
||||||
|
];
|
||||||
|
}
|
@ -20,75 +20,88 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray-2">父级菜单/节点<font>*</font>
|
<td class="layui-td-gray-2">父级ID<font>*</font>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td id="pidoption">
|
||||||
<select name="pid" lay-verify="required" lay-filter="pid" id="pidoption">
|
|
||||||
<option value="0">无</option>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">名称<font>*</font></td>
|
||||||
|
<td colspan="7"><input type="text" name="name" lay-verify="required" lay-reqText="请输入名称"
|
||||||
|
autocomplete="off" placeholder="请输入名称" class="layui-input"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<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">上传缩略图</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="image" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">权重<font>*</font></td>
|
||||||
|
<td colspan="7"><input type="text" name="weigh" lay-verify="required" lay-reqText="请输入权重"
|
||||||
|
autocomplete="off" placeholder="请输入权重" class="layui-input" value="0"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
{else/}
|
{else/}
|
||||||
<table class="layui-table layui-table-form">
|
<table class="layui-table layui-table-form">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray-2">父级菜单/节点<font>*</font>
|
<td class="layui-td-gray-2">类型<font>*</font>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select name="pid" lay-verify="required" lay-reqText="请选择父级菜单/节点">
|
<select name="type" lay-verify="required" lay-filter="type" id="showpid" >
|
||||||
<option value="0">作为顶级节点</option>
|
<option value="0">请选择</option>
|
||||||
{volist name=":set_recursion(get_admin_rule())" id="v"}
|
{volist name="type" id="v"}
|
||||||
<option value="{$v.id}" {eq name="$detail.pid" value="$v.id" }selected="" {/eq}>{$v.title} </option>
|
<option value="{$v.type}" {eq name="$detail.type" value="$v.type" }selected="" {/eq}>{$v.name} </option>
|
||||||
{/volist}
|
{/volist}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td class="layui-td-gray-2">左侧菜单显示<font>*</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type="radio" name="menu" value="1" title="是" {eq name="$detail.menu" value="1" } checked{/eq}>
|
|
||||||
<input type="radio" name="menu" value="2" title="不是" {eq name="$detail.menu" value="2" } checked{/eq}>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray">菜单/节点名称<font>*</font>
|
<td class="layui-td-gray-2">父级ID<font>*</font>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td id="pidoption">
|
||||||
<input type="text" name="title" value="{$detail.title}" lay-verify="required" autocomplete="off"
|
|
||||||
placeholder="请输入菜单/节点名称" lay-reqText="请输入菜单/节点名称" class="layui-input">
|
|
||||||
</td>
|
|
||||||
<td class="layui-td-gray">操作日志名称<font>*</font>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" name="name" value="{$detail.name}" lay-verify="required" placeholder="请输入操作日志名称"
|
|
||||||
lay-reqText="请输入操作日志名称" autocomplete="off" class="layui-input">
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray">菜单/节点URL</td>
|
<td class="layui-td-gray">名称<font>*</font></td>
|
||||||
<td>
|
<td colspan="7"><input type="text" name="name" lay-verify="required" lay-reqText="请输入名称"
|
||||||
<input type="text" name="src" value="{$detail.src}" placeholder="请输入菜单/节点URL,可空" autocomplete="off"
|
autocomplete="off" placeholder="请输入名称" class="layui-input" value="{$detail.name}"></td>
|
||||||
class="layui-input">
|
|
||||||
</td>
|
|
||||||
<td class="layui-td-gray">菜单排序</td>
|
|
||||||
<td>
|
|
||||||
<input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off"
|
|
||||||
class="layui-input">
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray">菜单图标</td>
|
<td class="layui-td-gray" style="vertical-align:top;">图片</td>
|
||||||
<td colspan="3">
|
<td>
|
||||||
<input style="width:150px; display:inline" type="text" name="icon" value="{$detail.icon}" placeholder="请输入图标,可空" autocomplete="off" class="layui-input">
|
<div class="layui-upload">
|
||||||
<i class="bi {$detail.icon}"></i><a href="{__GOUGU__}/icon/index.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
|
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传缩略图</button>
|
||||||
|
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
|
||||||
|
<img src="{$detail.image}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
|
||||||
|
<input type="hidden" name="image" value="{$detail.image}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">权重<font>*</font></td>
|
||||||
|
<td colspan="7"><input type="text" name="weigh" lay-verify="required" lay-reqText="请输入权重"
|
||||||
|
autocomplete="off" placeholder="请输入权重" class="layui-input" value="{$detail.weigh}"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
<div style="padding: 10px 0">
|
<div style="padding: 10px 0">
|
||||||
@ -102,41 +115,60 @@
|
|||||||
|
|
||||||
<!-- 脚本 -->
|
<!-- 脚本 -->
|
||||||
{block name="script"}
|
{block name="script"}
|
||||||
|
<script src="/static/assets/js/xm-select.js"></script>
|
||||||
<script>
|
<script>
|
||||||
const moduleInit = ['tool'];
|
const moduleInit = ['tool'];
|
||||||
|
var pid = "{$detail.pid}";
|
||||||
|
var type = "{$detail.type}";
|
||||||
|
var idd = "{$id}";
|
||||||
function gouguInit() {
|
function gouguInit() {
|
||||||
|
if(idd > 0){
|
||||||
|
var flag = 'edit';
|
||||||
|
}else{
|
||||||
|
var flag = 'add';
|
||||||
|
}
|
||||||
var form = layui.form,tool=layui.tool;
|
var form = layui.form,tool=layui.tool;
|
||||||
|
//上传缩略图
|
||||||
form.on('select(type)',function(){
|
var upload_thumb = layui.upload.render({
|
||||||
$.ajax({
|
elem: '#upload_btn_thumb',
|
||||||
url: "/admin/api/getbytype",
|
url: '/admin/api/upload',
|
||||||
type: 'get',
|
done: function (res) {
|
||||||
data: {
|
//如果上传失败
|
||||||
type:$('#showpid').val(),
|
if (res.code == 1) {
|
||||||
},
|
return layer.msg('上传失败');
|
||||||
success: function(e) {
|
|
||||||
if (e.code == 0) {
|
|
||||||
var html = '';
|
|
||||||
if(e.data.length>0){
|
|
||||||
$.each(e.data, function(key, value) {
|
|
||||||
html += '<option value="'+value.id+'" >'+value.name+' </option>';
|
|
||||||
});
|
|
||||||
$('#pidoption').append(html);
|
|
||||||
}else{
|
|
||||||
layer.msg('暂无数据');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
//上传成功
|
||||||
|
$('#upload_box_thumb input').attr('value', res.data.filepath);
|
||||||
|
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
street(type)
|
||||||
|
|
||||||
|
form.on('select(type)', function (data) {
|
||||||
|
street(data.value)
|
||||||
|
});
|
||||||
|
function street (id) {
|
||||||
|
var demo1 = xmSelect.render({
|
||||||
|
name: 'pid',
|
||||||
|
el: '#pidoption',
|
||||||
|
initValue: [pid],
|
||||||
|
prop: {
|
||||||
|
name: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
radio: true,
|
||||||
|
})
|
||||||
|
$.get('/admin/api/getbytype?type=' + id + '&flag='+flag, function (result) {
|
||||||
|
demo1.update({
|
||||||
|
data: result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//监听提交
|
//监听提交
|
||||||
form.on('submit(webform)', function (data) {
|
form.on('submit(webform)', function (data) {
|
||||||
if (!data.field.menu || data.field.menu == '') {
|
|
||||||
layer.msg('请选择是否在左侧菜单显示');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
let callback = function (e) {
|
let callback = function (e) {
|
||||||
layer.msg(e.msg);
|
layer.msg(e.msg);
|
||||||
if (e.code == 0) {
|
if (e.code == 0) {
|
||||||
|
@ -52,6 +52,11 @@ class Article extends BaseController
|
|||||||
$where[] = ['county', '=', $find['area_id']];
|
$where[] = ['county', '=', $find['area_id']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 登录返回村名和村地址
|
||||||
|
$cun_arr['cun_name'] = Db::table('fa_geo_village')->where('village_id', $find['village_id'])->value('village_name');
|
||||||
|
$cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('address_name');
|
||||||
|
}else{
|
||||||
|
$cun_arr = [];
|
||||||
}
|
}
|
||||||
//总条数
|
//总条数
|
||||||
$count = Db::table('fa_article')->where($where)->count();
|
$count = Db::table('fa_article')->where($where)->count();
|
||||||
@ -154,7 +159,7 @@ class Article extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->apiSuccess('ok', ['list' => $select, 'count' => ['count' => $count, 'month_count' => $month_count]]);
|
$this->apiSuccess('ok', ['list' => $select, 'cun'=>$cun_arr, 'count' => ['count' => $count, 'month_count' => $month_count]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**首页推荐
|
/**首页推荐
|
||||||
@ -702,6 +707,11 @@ class Article extends BaseController
|
|||||||
$where[] = ['county', '=', $find['area_id']];
|
$where[] = ['county', '=', $find['area_id']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 登录返回村名和村地址
|
||||||
|
$cun_arr['cun_name'] = Db::table('fa_geo_village')->where('village_id', $find['village_id'])->value('village_name');
|
||||||
|
$cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('address_name');
|
||||||
|
}else{
|
||||||
|
$cun_arr = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// $village_id = get_params('village_id');
|
// $village_id = get_params('village_id');
|
||||||
@ -811,7 +821,7 @@ class Article extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->apiSuccess('ok', ['list' => $select, 'count' => ['count' => $count, 'month_count' => $month_count]]);
|
$this->apiSuccess('ok', ['list' => $select, 'cun'=>$cun_arr, 'count' => ['count' => $count, 'month_count' => $month_count]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user