Compare commits

...

4 Commits

Author SHA1 Message Date
monanxiao
b430a4c162 开放字段验证 2023-03-23 11:09:52 +08:00
monanxiao
f09ba703ea 完善后台诉求列表 2023-03-22 13:35:41 +08:00
monanxiao
a22aea37e8 修复后台村民互动展示、审核等业务逻辑 2023-03-22 10:32:00 +08:00
monanxiao
0d9e8ddbc2 合并代码 2023-03-22 09:55:28 +08:00
15 changed files with 1094 additions and 25 deletions

View File

@ -23,7 +23,9 @@ class SupplyAccount extends BaseController
* 构造函数
*/
public function __construct()
{
{
$this->adminInfo = get_login_admin();
$this->model = new SupplyAccountModel();
$this->uid = get_login_admin('id');
}
@ -37,6 +39,11 @@ class SupplyAccount extends BaseController
$where = [];
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
if($this->adminInfo['group_access'] != 1){ //不是超级管理员
$where['fa_supply_team_id'] = $this->uid;
}
$list = SupplyAccountModel::with('team')->where($where)
->paginate($rows, false, ['query' => $param]);

View File

@ -24,6 +24,7 @@ class SupplyBrokerage extends BaseController
*/
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->model = new SupplyBrokerageModel();
$this->uid = get_login_admin('id');
}
@ -36,8 +37,35 @@ class SupplyBrokerage extends BaseController
$param = get_params();
$where = [];
$list = $this->model->with(['merchant', 'supplyChain', 'level'])->order('id desc')->select(); // 只读取来源为供应链小组的订单
if($this->adminInfo['group_access'] != 1){ // 不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')
->where($www)
->find();
if ($user_address){
if($user_address['auth_range'] == 1){
$where['village'] = $user_address['village_id'];
}elseif ($user_address['auth_range'] == 2){
$where['township'] = $user_address['street_id'];
}elseif ($user_address['auth_range'] == 3){
$where['county'] = $user_address['area_id'];
}else{
$where['village'] = $user_address['village_id'];
}
}else{
$where['village'] = '';
}
}
$list = $this->model->with(['merchant', 'supplyChain', 'level'])
->order('id desc')
->select(); // 只读取来源为供应链小组的订单
$total = $this->model->count();
foreach ($list as $k =>$v){
// $list[$k]['fa_supply_chain_id'] = Db::table('fa_supply_team')->where('id',$v['fa_supply_chain_id'])->value('name');

View File

@ -71,7 +71,7 @@ class Article extends BaseController
->page($params['page'])
->limit($params['limit'])
->order('id desc')
->field('id,title,user_id,county,township,village,image,view_time')
->field('id,title,user_id,content,county,township,village,image,view_time')
->select();
$result = ['total' => $total, 'data' => $list];

View File

@ -29,6 +29,8 @@ class Community extends BaseController
'/admin/nk.community/del',
'/admin/nk.community/read',
];
// 获取用户信息
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
}
/**
* 数据列表
@ -59,6 +61,7 @@ class Community extends BaseController
$total = Db::connect('shop')->name('community_address')
->where($where)
->count();
if ($total!=0){
$list = Db::connect('shop')->name('community_address')
->where($where)
@ -69,7 +72,7 @@ class Community extends BaseController
foreach ($list as $k=>$v){
$arr[]=$v['community_id'];
}
$list2=Db::connect('shop')->name('community')->where('community_id','in',$arr)->select();
$list2=Db::connect('shop')->name('community')->where('community_id','in',$arr)->order('community_id desc')->select();
}else{
$list2=[];
}
@ -83,6 +86,47 @@ class Community extends BaseController
}
public function edit(){
$param = get_params();
if (request()->isAjax()) {
$is_show = $param['status'] == 1 ? 1 : 0;
$data = [
'refusal' => $param['refusal'],
'status' => $param['status'],
'is_show' => $is_show,
];
$res = Db::connect('shop')->name('community')
->where('community_id', $param['id'])
->strict(false)
->update($data);
if ($res){
return to_assign(0, '操作成功');
}else{
return to_assign(1, '操作失败,原因:'.$res);
}
}else{
$id = isset($param['id']) ? $param['id'] : 0;
$detail = Db::connect('shop')->name('community')->where('community_id',$id)->find();
View::assign('editor', get_system_config('other','editor'));
if (!empty($detail)) {
View::assign('detail', $detail);
View::assign('users', $this->users);
return view();
}
else{
throw new \think\exception\HttpException(404, '找不到页面');
}
}
}
/**
* 查看信息
*/

View File

@ -34,11 +34,66 @@ class Feedback extends BaseController
public function index()
{
if (request()->isAjax()) {
$params= get_params();
$params['category_id']=$this->category_id;
(new Article())->index($params);
$params = get_params();
$where[]= ['status','=',1];
if (isset($params['keywords']) && !empty($params['keywords'])){
$where[]=['title','like','%'.$params['keywords'].'%'];
}
if($this->adminInfo['position_id'] != 1){ //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address) {
if ($user_address['auth_range'] == 1) {
$where[]= ['county','=',$user_address['area_id']];
$where[] =['township','=', $user_address['street_id']];
$where[] =['village','=', $user_address['village_id']];
} elseif ($user_address['auth_range'] == 2) {
$where[]= ['county','=',$user_address['area_id']];
$where[] =['township','=', $user_address['street_id']];
}
}
}
$category_id =$params['category_id'];
if($category_id){
$map[] = ['category_id','in',$category_id];
}else{
$map = [];
}
$total = Db::table('fa_article')
->where($where)
->where($map)
->count();
$list = Db::table('fa_article')
->withAttr('nickname',function ($value,$data){
return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('name');
})
->withAttr('area',function ($value,$data){
return Db::table('fa_geo_area')->where('area_code',$data['county'])->value('area_name');
})
->withAttr('street',function ($value,$data){
return Db::table('fa_geo_street')->where('street_code',$data['township'])->value('street_name');
})
->withAttr('village',function ($value,$data){
return Db::table('fa_geo_village')->where('village_id',$data['village'])->value('village_name');
})
->where($where)
->where($map)
->page($params['page'])
->limit($params['limit'])
->order('id desc')
->field('id,title,user_id,content,is_solve,county,township,village,image,view_time')
->select();
$result = ['total' => $total, 'data' => $list];
return table_assign(0, '', $result);
}
return view('nk/article/index',['url'=>$this->url]);
View::assign('url', $this->url);
return view();
}
/**
* 添加
@ -76,12 +131,30 @@ class Feedback extends BaseController
*/
public function read()
{
$params = get_params();
(new Article())->read($params);
$param= get_params();
$id = isset($param['id']) ? $param['id'] : 0;
return view('nk/article/read',['url'=>$this->url]);
$detail = Db::table('fa_article')->where('id',$id)->find();
if ($detail) {
$detail['comment'] = Db::table('fa_article_comment')
->where('vote_id',$id)
->withAttr('user_info',function ($value,$data){
return Db::table('fa_szxc_information_usermsg')->where('user_id', $data['user_id'])->value('name');
})
->select();
View::assign('detail', $detail);
View::assign('admin_id', $this->adminInfo['id']);
return view();
}else{
throw new \think\exception\HttpException(404, '找不到页面');
}
}
/**
* 修改
*/

View File

@ -28,10 +28,9 @@
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
{if {:session('gougu_admin')['group_access']==1}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
<a class="layui-btn layui-btn-normal layui-btn-xs {{# if(d.status != '待审核'){ }}{{# } else { }}layui-hide{{# } }}" lay-event="read">查看</a>
<a class="layui-btn layui-btn-xs {{# if(d.status == '待审核'){ }}{{# } else { }}layui-hide{{# } }}" lay-event="edit">审核</a>
</div>

View File

@ -0,0 +1,90 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
</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="6">
<textarea class="layui-textarea" name="title" disabled>{$detail.title}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">话题内容<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="content" disabled>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">状态<font>*</font></td>
<td colspan="6">
<input type="radio" name="status" value="1" title="通过" checked>
<input type="radio" name="status" value="-1" title="不通过" >
</td>
</tr>
<tr>
<td class="layui-td-gray">原因<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="refusal" placeholder="请输入不通过原因"></textarea>
</td>
</tr>
</table>
<div class="pt-3">
<input type="hidden" name="id" value="{$detail.community_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', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.community/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -21,12 +21,21 @@
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加内容">+ 添加内容</span>
<!-- <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-danger layui-btn-xs" lay-event="del">删除</a></div>
<div class="layui-btn-group">
<a class="layui-btn layui-btn-normal layui-btn-xs {{# if(d.status != 0){ }}{{# } else { }}layui-hide{{# } }}" lay-event="read">查看</a>
<a class="layui-btn layui-btn-xs {{# if(d.status == 0){ }}{{# } else { }}layui-hide{{# } }}" lay-event="edit">审核</a>
{if {:session('gougu_admin')['group_access']==1}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
@ -56,6 +65,44 @@
},{
field: 'title',
title: '标题',
},{
field: 'content',
title: '内容',
},{
field: 'status',
title: '状态',
templet: function (d)
{
switch (d.status) {
case 0:
return '待审核';
break;
case 1:
return '审核通过';
break;
case -1:
return '不通过,原因:' + d.refusal;
break;
}
}
},{
field: 'is_show',
title: '显示状态',
templet: function (d)
{
switch (d.is_show) {
case 0:
return '不显示';
break;
case 1:
return '显示';
break;
}
}
},{
fixed: 'right',
field: 'right',

View File

@ -0,0 +1,221 @@
{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>
{notempty name="is_vote"}
<tr>
<td class="layui-td-gray">结束时间<font>*</font></td>
<td colspan="7"> <input type="text" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" id="test1" name="end_time">
<input type="hidden" name="is_vote" value="1">
</td>
</tr>
{/notempty}
<tr>
<td class="layui-td-gray" style="vertical-align:top;">文章摘要</td>
<td colspan="3">
<textarea name="describe" 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="image" value="">
</div>
</div>
</td>
</tr>
{if {:session('gougu_admin')['group_access']==1}
<tr>
<td class="layui-td-gray" style="vertical-align:top;">区县</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<select name="county" lay-filter="area_id" >
{volist name='street' id='vo'}
<option value="{$vo.code}" >{$vo.name}</option>
{/volist}
</select>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">街道/镇</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<div id="demo1" ></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">村/社区</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<div id="demo2" ></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">用户<font>*</font></td>
<td colspan="3">
<div class="layui-col-md6">
<select name="user_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='users' id='vo'}
<option value="{$vo.user_id}" >{$vo.name}</option>
{/volist}
</select>
</div>
</td>
</tr>
{/if}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</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 src="/static/assets/js/xm-select.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
var group_access = "{:session('gougu_admin')['group_access']}"
function gouguInit() {
var form =layui.form, tool = layui.tool,tagspicker = layui.tagpicker,laydate=layui.laydate;
laydate.render({
elem: '#test1' //指定元素
});
//上传缩略图
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.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
street();
village();
form.on('select(area_id)', function (data) {
street(data.value)
});
function street (id) {
var demo1 = xmSelect.render({
name: 'township',
el: '#demo1',
initValue: [],
prop: {
name: 'name',
value: 'code',
},
data: [],
radio: true,
disabled: group_access == 2 ||group_access == 4? true : false,
on: function (data) {
var arr = data.arr;
if(arr.length > 0){
village(arr[0]['code']);
}else{
village();
}
},
})
$.get('/api/geo/street?pcode=' + id, function (result) {
demo1.update({
data: result.data
})
});
}
function village (id) {
var demo2 = xmSelect.render({
name: 'village',
el: '#demo2',
initValue: [],
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
disabled: group_access == 2 ? true : false,
})
$.get('/api/geo/village?pcode=' + id, function (result) {
demo2.update({
data: result.data
})
});
}
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('{$url[1]}', data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,240 @@
{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>
{notempty name="is_vote"}
<tr>
<td class="layui-td-gray">结束时间<font>*</font></td>
<td colspan="7"> <input type="text" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" id="test1" name="end_time">
<input type="hidden" name="is_vote" value="1">
</td>
</tr>
{/notempty}
<tr>
<td class="layui-td-gray" style="vertical-align:top;">摘要</td>
<td colspan="3">
<textarea name="describe" placeholder="请输入摘要不能超过200个字"
class="layui-textarea">{$detail.describe}</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="{$detail.image}"
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
style="max-width: 100%; height:66px;"/>
<input type="hidden" name="image" value="{$detail.image}">
</div>
</div>
</td>
</tr>
{if {:session('gougu_admin')['group_access']==1}
<tr>
<td class="layui-td-gray" style="vertical-align:top;">区县</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<select name="county" lay-filter="area_id">
{volist name='street' id='vo'}
<option value="{$vo.code}" {if $detail.county==$vo.code} selected {/if}>{$vo.name}</option>
{/volist}
</select>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">街道/镇</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<div id="demo1" ></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">村/社区</td>
<td colspan="3">
<div class="layui-col-md6">
<div >
<div id="demo2" ></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray">用户<font>*</font></td>
<td colspan="3">
<div class="layui-col-md6">
<select name="user_id" lay-verify="required" lay-search="">
<option value="" >请选择</option>
{volist name='users' id='vo'}
<option value="{$vo.user_id}" {if $detail.user_id==$vo.user_id} selected {/if}>{$vo.name}</option>
{/volist}
</select>
</div>
</td>
</tr>
{/if}
<tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</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 src="/static/assets/js/xm-select.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit;
if (editorType == 1) {
moduleInit = ['tool', 'tagpicker', 'tinymce'];
} else {
moduleInit = ['tool', 'tagpicker', 'editormd'];
}
var group_access = "{:session('gougu_admin')['group_access']}";
var area_id = "{$detail.county}";
var street_id = "{$detail.township}";
function gouguInit() {
var form =layui.form, tool = layui.tool,tagspicker = layui.tagpicker,laydate=layui.laydate;
laydate.render({
elem: '#test1' //指定元素
});
//上传缩略图
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.filepath);
$('#upload_box_thumb img').attr('src', res.data.filepath);
}
});
if (area_id != 0) {
street(area_id)
}
if (street_id != 0) {
village(street_id)
}
form.on('select(area_id)', function (data) {
street(data.value)
});
function street (id) {
var demo1 = xmSelect.render({
name: 'township',
el: '#demo1',
initValue: ["{$detail.township}"],
prop: {
name: 'name',
value: 'code',
},
data: [],
radio: true,
disabled: group_access == 2 ||group_access == 4? true : false,
on: function (data) {
var arr = data.arr;
if(arr.length > 0){
village(arr[0]['code']);
}else{
village();
}
},
})
$.get('/api/geo/street?pcode=' + id, function (result) {
demo1.update({
data: result.data
})
});
}
function village (id) {
var demo2 = xmSelect.render({
name: 'village',
el: '#demo2',
initValue: ["{$detail.village}"],
prop: {
name: 'name',
value: 'id',
},
data: [],
radio: true,
disabled: group_access == 2 ? true : false,
})
$.get('/api/geo/village?pcode=' + id, function (result) {
demo2.update({
data: result.data
})
});
}
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("{$url[2]}", data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,178 @@
{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="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 {{# if(d.is_solve == 0){ }}{{# } else { }}layui-hide{{# } }}" lay-event="read">回复</a>
<a class="layui-btn layui-btn-green layui-btn-xs {{# if(d.is_solve != 0){ }}{{# } else { }}layui-hide{{# } }}" lay-event="read">查看</a>
<!-- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a> -->
{if {:session('gougu_admin')['group_access']==1}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</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: '{$url[0]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:120,
},{
field: 'area',
title: '区县',
align: 'center',
width:120,
},{
field: 'street',
title: '乡镇',
align: 'center',
width:120,
},{
field: 'village',
title: '街道/村',
align: 'center',
width:120,
},{
field: 'is_solve',
title: '状态',
align: 'center',
width:120,
templet: function (d)
{
switch (d.is_solve) {
case 0:
return '待回复';
break;
case 1:
return '已回复';
break;
}
return ;
}
},{
field: 'title',
title: '文章标题',
},{
field: 'content',
title: '诉求内容',
templet: function (d)
{
return d.content;
}
},{
field: 'nickname',
title: '用户',
align: 'center',
},{
field: 'view_time',
title: '发布时间',
align: 'center',
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
align: 'center'
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(article)', function(obj){
if (obj.event === 'add') {
tool.side('{$url[1]}');
return false;
}
});
//监听表格行工具事件
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'read') {
tool.side('{$url[4]}?id='+obj.data.id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?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('{$url[3]}', { 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}
<!-- /脚本 -->

View File

@ -0,0 +1,87 @@
{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>
</tr>
<tr>
<td class="layui-td-gray">创建时间</td>
<td>{$detail.view_time}</td>
</tr>
<tr>
<td class="layui-td-gray">诉求内容</td>
<td colspan="5" class="content-article">
{$detail.content|raw}
</td>
</tr>
{if in_array($detail.category_id,[149,157,158,148,147,165]) }
<tr >
<td class="layui-td-gray">回复内容:</td>
<td colspan="6">
{volist name="$detail.comment" id="vo"}
{$vo.user_info}的回复:{$vo.content}<br>
{/volist}
</td>
</tr>
{/if}
{if $detail.is_solve == 0}
{if in_array($detail.category_id,[149,157,158,148,147,165]) }
<tr >
<td class="layui-td-gray">回复:</td>
<td colspan="6">
<textarea class="layui-textarea" name="reply" ></textarea>
</td>
</tr>
{/if}
</table>
{if in_array($detail.category_id,[149,157,158,148,147,165]) }
<div class="pt-3">
<input type="hidden" name="id" value="{$detail.id}"/>
<input type="hidden" name="admin_id" value="{$admin_id}"/>
<input type="hidden" name="content" value="{$detail.content}"/>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即回复</button>
</div>
{/if}
{/if}
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/api/reply", data.field, callback);
return false;
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -1483,11 +1483,11 @@ class Maintainentry extends BaseController
public function userEntry()
{
$post = get_params();
// try {
// validate('Maintainentry.myadd')->check($post);
// } catch (\Exception $e) {
// $this->apiError($e->getMessage());
// }
try {
validate('Maintainentry.myadd')->check($post);
} catch (\Exception $e) {
$this->apiError($e->getMessage());
}
if ($post) {
//// 验证验证码

View File

@ -95,11 +95,17 @@ class Userinfo extends BaseController
public function Binding()
{
$post = get_params();
if(!$post['idcard'] || !$post['area_id'] || !$post['street_id'] || !$post['village_id'] || !$post['name']){
$this->apiError('缺少参数');
}
if($post['phone'] == 'undefined'){
$this->apiError('手机号错误');
// if(!$post['idcard'] || !$post['area_id'] || !$post['street_id'] || !$post['village_id'] || !$post['name']){
// $this->apiError('缺少参数');
// }
// if($post['phone'] == 'undefined'){
// $this->apiError('手机号错误');
// }
try {
validate('UserInfo.myadd')->check($post);
} catch (\Exception $e) {
$this->apiError($e->getMessage());
}
// $where['id'] = $this->request->uid; // 废弃

View File

@ -0,0 +1,49 @@
<?php
namespace app\api\validate;
use think\Validate;
class UserInfo extends Validate
{
/**
* 验证规则.
*/
protected $rule = [
'name' => 'require',
'idcard' => 'require|idCard',
'area_id' => 'require',
'street_id' => 'require',
'village_id' => 'require',
];
/**
* 提示消息.
*/
protected $message = [
'name' => '请输入姓名',
'idcard' => '请输入身份证号',
'idcard.idCard' => '身份证号不正确',
'area_id' => '请选择村组信息',
'street_id' => '请选择村组信息',
'village_id' => '请选择村组信息',
];
/**
* 字段描述.
*/
protected $field = [
];
/**
* 验证场景.
*/
protected $scene = [
'add' => ['name', 'area_id', 'idcard', 'street_id', 'village_id'],
];
public function __construct()
{
parent::__construct();
}
}