# Conflicts:
#	app/admin/controller/Index.php
#	app/admin/view/index/main.html
This commit is contained in:
彭桃 2023-02-04 18:02:10 +08:00
commit e52e1fa1c3
8 changed files with 249 additions and 279 deletions

View File

@ -133,6 +133,7 @@ class Index extends BaseController
->alias('u') ->alias('u')
->where($where) ->where($where)
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.land_area'); ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.land_area');
// 荒地面积 // 荒地面积
$sum_waste_land_area = Db::table('fa_szxc_information_useraddress') $sum_waste_land_area = Db::table('fa_szxc_information_useraddress')
->alias('u') ->alias('u')
@ -145,6 +146,12 @@ class Index extends BaseController
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.breed_area'); ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.breed_area');
$hd_num = $sum_waste_land_area - $breed_area; $hd_num = $sum_waste_land_area - $breed_area;
$waste_land_area = Db::table('fa_szxc_information_useraddress')
->alias('u')
->where($where)
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.waste_land_area');
View::assign( View::assign(
[ [
'totaluser' => $num,//User::where($whe)->count(),// 总用户数 'totaluser' => $num,//User::where($whe)->count(),// 总用户数
@ -158,6 +165,7 @@ class Index extends BaseController
'nation_h_num' => $nation_h_num, 'nation_h_num' => $nation_h_num,
'work_num' => $work_num, 'work_num' => $work_num,
'land_area_num' => $land_area_num, 'land_area_num' => $land_area_num,
'waste_land_area' => $waste_land_area,
'sum_218' => $sum_218, 'sum_218' => $sum_218,
'sum_217' => $sum_217, 'sum_217' => $sum_217,
'sum_216' => $sum_216, 'sum_216' => $sum_216,

View File

@ -65,45 +65,35 @@ class Village extends BaseController
{ {
if (request()->isAjax()) { if (request()->isAjax()) {
$params= get_params(); $params= get_params();
if (isset($params['is_hot']) && $params['is_hot']=='on'){ if (!empty($params['is_hot'])&&$params['is_hot']=='on'){
$params['is_hot']=1; $params['is_hot']=1;
}else{ }else{
$params['is_hot']=0; $params['is_hot']=0;
} }
if (isset($params['is_tourism']) && $params['is_tourism']=='on'){ if (!empty($params['is_tourism'])&&$params['is_tourism']=='on'){
$params['is_tourism']=1; $params['is_tourism']=1;
}else{ }else{
$params['is_tourism']=0; $params['is_tourism']=0;
} }
$area_code=Db::table('fa_geo_area')->where('area_code',$params['area_id'])->value('area_name');
// 组装地址名 $street_code=Db::table('fa_geo_street')->where('street_code',$params['street_id'])->value('street_name');
if ($params['area_id'] != '') { $village_id=Db::table('fa_geo_village')->where('village_id',$params['village_id'])->value('village_name');
$area_name = Db::table('fa_geo_area')->where('area_code', $params['area_id'])->value('area_name'); $params['address']='泸州市'.$area_code.$street_code.$village_id;
} $params['createtime']=time();
if ($params['street_id'] != '') {
$street_name = Db::table('fa_geo_street')->where('street_code', $params['street_id'])->value('street_name');
}
if ($params['village_id'] != '') {
$village = Db::table('fa_geo_village')->where('village_code', $params['village_id'])->find();
$params['village_id']=$village['village_id'];
}
$address_name = $area_name . $street_name . $village['village_name'] ;
$params['address'] = $address_name;
$res=Db::table('fa_szxc_village')->strict(false)->field(true)->insertGetId($params); $res=Db::table('fa_szxc_village')->strict(false)->field(true)->insertGetId($params);
if ($res){ if ($res){
return to_assign(0,'操作成功',['aid'=>$res]); return to_assign(0,'操作成功',['aid'=>$res]);
} }
return to_assign(1, '操作失败,原因:'.$res); return to_assign(1, '操作失败,原因:'.$res);
}else{
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
return view();
} }
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name')
->select();
View::assign('street', $street);
View::assign('editor', get_system_config('other','editor'));
View::assign('url', $this->url);
return view();
} }
/** /**
* 修改 * 修改
@ -112,33 +102,20 @@ class Village extends BaseController
{ {
$params= get_params(); $params= get_params();
if (request()->isAjax()) { if (request()->isAjax()) {
if (!empty($params['is_hot'])&&$params['is_hot']=='on'){
if (isset($params['is_hot']) && $params['is_hot']=='on'){
$params['is_hot']=1; $params['is_hot']=1;
}else{ }else{
$params['is_hot']=0; $params['is_hot']=0;
} }
if (isset($params['is_tourism']) && $params['is_tourism']=='on'){ if (!empty($params['is_tourism'])&&$params['is_tourism']=='on'){
$params['is_tourism']=1; $params['is_tourism']=1;
}else{ }else{
$params['is_tourism']=0; $params['is_tourism']=0;
} }
$area_code=Db::table('fa_geo_area')->where('area_code',$params['area_id'])->value('area_name');
// 组装地址名 $street_code=Db::table('fa_geo_street')->where('street_code',$params['street_id'])->value('street_name');
if ($params['area_id'] != '') { $village_id=Db::table('fa_geo_village')->where('village_id',$params['village_id'])->value('village_name');
$area_name = Db::table('fa_geo_area')->where('area_code', $params['area_id'])->value('area_name'); $params['address']='泸州市'.$area_code.$street_code.$village_id;
}
if ($params['street_id'] != '') {
$street_name = Db::table('fa_geo_street')->where('street_code', $params['street_id'])->value('street_name');
}
if ($params['village_id'] != '') {
$village = Db::table('fa_geo_village')->where('village_code', $params['village_id'])->find();
$params['village_id']=$village['village_id'];
}
$address_name = $area_name . $street_name . $village['village_name'] ;
$params['address'] = $address_name;
$res=Db::table('fa_szxc_village')->where('id',$params['id'])->strict(false)->field(true)->update($params); $res=Db::table('fa_szxc_village')->where('id',$params['id'])->strict(false)->field(true)->update($params);
if ($res){ if ($res){
return to_assign(); return to_assign();
@ -147,13 +124,12 @@ class Village extends BaseController
} }
} }
$detail = Db::table('fa_szxc_village')->where('id',$params['id'])->find(); $detail = Db::table('fa_szxc_village')->where('id',$params['id'])->find();
$detail['village_code'] = Db::table('fa_geo_village')->where('village_id', $detail['village_id'])->value('village_code');
View::assign('detail', $detail);
View::assign('url', $this->url);
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500']) $street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
->field('area_id id,area_code code,area_name name') ->field('area_id id,area_code code,area_name name')
->select(); ->select();
View::assign('street', $street); View::assign('street', $street);
View::assign('detail', $detail);
View::assign('url', $this->url);
return view(); return view();
} }
/** /**
@ -176,7 +152,7 @@ class Village extends BaseController
$param= get_params(); $param= get_params();
$id = isset($param['id']) ? $param['id'] : 0; $id = isset($param['id']) ? $param['id'] : 0;
$type = isset($param['type']) ? $param['type'] : 0; $type = isset($param['type']) ? $param['type'] : 0;
$res = Db::table('fa_szxc_village')->where('id',$id)->delete(); $res = Db::table('fa_szxc_village')->where('id',$id)->update(['status'=>$type]);
if ($res){ if ($res){
return to_assign(); return to_assign();
}else{ }else{

View File

@ -1,17 +1,17 @@
{extend name="common/base"/} {extend name="common/base"/}
{block name="style"} {block name="style"}
<style type="text/css"> <style type="text/css">
.dashboard-num table {width: 100%;} .dashboard-num table {width: 100%;}
.dashboard-num td {text-align: center; padding: 16px 0; width: 20%;border-left: 1px solid #f1f1f1; position: relative;} .dashboard-num td {text-align: center; padding: 16px 0; width: 20%;border-left: 1px solid #f1f1f1; position: relative;}
.dashboard-num td:nth-child(1) { border-left: none} .dashboard-num td:nth-child(1) { border-left: none}
.dashboard-num .num-title { padding-bottom: 10px; color: #999;} .dashboard-num .num-title { padding-bottom: 10px; color: #999;}
.dashboard-num .blue {font-size: 20px; font-weight: 300;} .dashboard-num .blue {font-size: 20px; font-weight: 300;}
.dashboard-num td .badge {position: absolute;top: 0; right: 0;} .dashboard-num td .badge {position: absolute;top: 0; right: 0;}
.dashboard-num td .badge span { padding: 2px 4px; font-size: 12px; border-radius: 0 0 0 4px;} .dashboard-num td .badge span { padding: 2px 4px; font-size: 12px; border-radius: 0 0 0 4px;}
.dashboard-total td {border-top: 1px solid #f1f1f1} .dashboard-total td {border-top: 1px solid #f1f1f1}
.dashboard-logs .layui-timeline-item {padding-bottom: 1px;} .dashboard-logs .layui-timeline-item {padding-bottom: 1px;}
.info-td { width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;} .info-td { width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
.info-td {width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;} .info-td {width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
.layui-card-body .layui-timeline-title { .layui-card-body .layui-timeline-title {
padding-bottom: 0; padding-bottom: 0;
font-size: 14px; font-size: 14px;
@ -24,112 +24,113 @@
<!-- 主体 --> <!-- 主体 -->
{block name="body"} {block name="body"}
<div class="p-3"> <div class="p-3">
<div class="layui-row layui-col-space12"> <div class="layui-row layui-col-space12">
<div class=""> <div class="">
<div class="layui-row layui-col-space12"> <div class="layui-row layui-col-space12">
<div class="layui-col-md12"> <div class="layui-col-md12">
<div class="layui-card dashboard-num"> <div class="layui-card dashboard-num">
<table> <table>
<tr> <tr>
<td> <td>
<div class="num-title">总会员数</div> <div class="num-title">总会员数</div>
<div class="blue">{$totaluser}</div> <div class="blue">{$totaluser}</div>
</td> </td>
<td> <td>
<div class="num-title">老人人数</div> <div class="num-title">老人人数</div>
<div class="blue">{$old_num}</div> <div class="blue">{$old_num}</div>
</td> </td>
<td> <td>
<div class="num-title">儿童人数</div> <div class="num-title">儿童人数</div>
<div class="blue">{$children_num}</div> <div class="blue">{$children_num}</div>
</td> </td>
<td> <td>
<div class="num-title">未婚男</div> <div class="num-title">未婚男</div>
<div class="blue">{$unmarried_man_num}</div> <div class="blue">{$unmarried_man_num}</div>
</td> </td>
<td> <td>
<div class="num-title">未婚女</div> <div class="num-title">未婚女</div>
<div class="blue">{$unmarried_woman_num}</div> <div class="blue">{$unmarried_woman_num}</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<div class="num-title">残疾人数</div> <div class="num-title">残疾人数</div>
<div class="blue">{$whether_disabled_num}</div> <div class="blue">{$whether_disabled_num}</div>
</td> </td>
<td> <td>
<div class="num-title">参保人数</div> <div class="num-title">参保人数</div>
<div class="blue">{$insurance_type_num}</div> <div class="blue">{$insurance_type_num}</div>
</td> </td>
<td> <td>
<div class="num-title">少数名族人数</div> <div class="num-title">少数名族人数</div>
<div class="blue">{$nation_s_num}</div> <div class="blue">{$nation_s_num}</div>
</td> </td>
<td> <td>
<div class="num-title">汉族人数</div> <div class="num-title">汉族人数</div>
<div class="blue">{$nation_h_num}</div> <div class="blue">{$nation_h_num}</div>
</td> </td>
<td> <td>
<div class="num-title">工作人员数</div> <div class="num-title">工作人员数</div>
<div class="blue">{$work_num}</div> <div class="blue">{$work_num}</div>
</td> </td>
</tr> </tr>
</table> </table>
</div> </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">{$waste_land_area}</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>
</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>
<td>
<div class="num-title">荒地面积</div>
<div class="blue">{$sum_waste_land_area}</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>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
{/block} {/block}
<!-- /主体 --> <!-- /主体 -->

View File

@ -51,7 +51,7 @@
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传图片</button> <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;"> <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="150" style="max-width: 100%; height:66px;"/> <img src="" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="150" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="img" value="" lay-verify="required"> <input type="hidden" name="img" value="">
</div> </div>
</div> </div>
</td> </td>

View File

@ -51,7 +51,7 @@
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传图片</button> <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;"> <div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
<img src="{$detail.img}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="150" style="max-width: 100%; height:66px;"/> <img src="{$detail.img}" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="150" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="img" value="{$detail.img}" lay-verify="required"> <input type="hidden" name="img" value="{$detail.img}">
</div> </div>
</div> </div>
</td> </td>

View File

@ -15,43 +15,6 @@
<form class="layui-form p-4"> <form class="layui-form p-4">
<h3 class="pb-3">添加内容</h3> <h3 class="pb-3">添加内容</h3>
<table class="layui-table layui-table-form"> <table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">区域<font>*</font></td>
<td colspan="3">
<div class="layui-form-item">
<label class="layui-form-label">区县</label>
<div class="layui-input-block">
{if {:session('gougu_admin')['group_access']==1}
<select name="area_id" lay-filter="area_id" lay-verify="required">
{volist name='street' id='vo'}
<option value="{$vo.code}">{$vo.name}</option>
{/volist}
</select>
{else /}
{volist name='street' id='vo'}
{if $address.area_id==$vo.code}
<input type="text" value="{$vo.name}" autocomplete="off" class="layui-input" disabled>
{/if}
{/volist}
{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">村/社区</label>
<div class="layui-input-block">
<div id="demo2"></div>
</div>
</div>
</td>
</tr>
<tr> <tr>
<td class="layui-td-gray">标题<font>*</font></td> <td class="layui-td-gray">标题<font>*</font></td>
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题" <td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
@ -62,7 +25,7 @@
<td class="layui-td-gray">人数<font>*</font></td> <td class="layui-td-gray">人数<font>*</font></td>
<td colspan="3"> <td colspan="3">
<input type="text" name="people_num" lay-verify="required" lay-reqText="请输入人数" <input type="text" name="people_num" lay-verify="required" lay-reqText="请输入人数"
autocomplete="off" placeholder="请输入人数" class="layui-input"></td> autocomplete="off" placeholder="请输入人数" class="layui-input"></td>
<td class="layui-td-gray">标签(多选)<font>*</font></td> <td class="layui-td-gray">标签(多选)<font>*</font></td>
<td> <td>
<input type="checkbox" name="is_hot" title="热门"> <input type="checkbox" name="is_hot" title="热门">
@ -85,11 +48,43 @@
<img src="" <img src=""
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
width="100" style="max-width: 100%; height:66px;"/> width="100" style="max-width: 100%; height:66px;"/>
<input type="hidden" name="images" value="" lay-verify="required"> <input type="hidden" name="images" value="">
</div> </div>
</div> </div>
</td> </td>
</tr> </tr>
{if {:session('gougu_admin')['group_access']==1}
<tr>
<td style="width: 20%">
<div class="layui-form-item">
<label class="layui-form-label">区县</label>
<div class="layui-input-block">
<select name="area_id" lay-filter="area_id" lay-verify="required">
{volist name='street' id='vo'}
<option value="{$vo.code}">{$vo.name}</option>
{/volist}
</select>
</div>
</div>
</td>
<td >
<div class="layui-form-item">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
<td >
<div class="layui-form-item">
<label class="layui-form-label">村/社区</label>
<div class="layui-input-block">
<div id="demo2"></div>
</div>
</div>
</td>
</tr>
{/if}
<tr> <tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td> <td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td>
</tr> </tr>
@ -115,8 +110,7 @@
const editorType = '{$editor}'; const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce']; var moduleInit = ['tool', 'tagpicker', 'tinymce'];
var group_access = "{:session('gougu_admin')['group_access']}" var group_access = "{:session('gougu_admin')['group_access']}"
var area_id = ""
var street_id = ""
function gouguInit() { function gouguInit() {
var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker; var form = layui.form, tool = layui.tool, tagspicker = layui.tagpicker;
@ -134,19 +128,6 @@
$('#upload_box_thumb img').attr('src', res.data.filepath); $('#upload_box_thumb img').attr('src', res.data.filepath);
} }
}); });
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
if (area_id != 0) {
street(area_id)
}
if (street_id != 0) {
village(street_id)
}
form.on('select(area_id)', function (data) { form.on('select(area_id)', function (data) {
street(data.value) street(data.value)
}); });
@ -154,14 +135,13 @@
var demo1 = xmSelect.render({ var demo1 = xmSelect.render({
name: 'street_id', name: 'street_id',
el: '#demo1', el: '#demo1',
initValue: [street_id],
prop: { prop: {
name: 'name', name: 'name',
value: 'code', value: 'code',
}, },
data: [], data: [],
radio: true, radio: true,
disabled: group_access == 2 ? true : false,
on: function (data) { on: function (data) {
var arr = data.arr; var arr = data.arr;
village(arr[0]['code']) village(arr[0]['code'])
@ -177,14 +157,13 @@
var demo2 = xmSelect.render({ var demo2 = xmSelect.render({
name: 'village_id', name: 'village_id',
el: '#demo2', el: '#demo2',
initValue: [],
prop: { prop: {
name: 'name', name: 'name',
value: 'code', value: 'id',
}, },
data: [], data: [],
radio: true, radio: true,
disabled: group_access == 2 ? true : false,
}) })
$.get('/api/geo/village?pcode=' + id, function (result) { $.get('/api/geo/village?pcode=' + id, function (result) {
demo2.update({ demo2.update({
@ -192,7 +171,11 @@
}) })
}); });
} }
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//监听提交 //监听提交
form.on('submit(webform)', function (data) { form.on('submit(webform)', function (data) {
data.field.introduce = tinyMCE.editors['container_content'].getContent(); data.field.introduce = tinyMCE.editors['container_content'].getContent();

View File

@ -15,43 +15,6 @@
<form class="layui-form p-4"> <form class="layui-form p-4">
<h3 class="pb-3">编辑文章表</h3> <h3 class="pb-3">编辑文章表</h3>
<table class="layui-table layui-table-form"> <table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">区域<font>*</font></td>
<td colspan="3">
<div class="layui-form-item">
<label class="layui-form-label">区县</label>
<div class="layui-input-block">
{if {:session('gougu_admin')['group_access']==1}
<select name="area_id" lay-filter="area_id" lay-verify="required">
{volist name='street' id='vo'}
<option value="{$vo.code}">{$vo.name}</option>
{/volist}
</select>
{else /}
{volist name='street' id='vo'}
{if $address.area_id==$vo.code}
<input type="text" value="{$vo.name}" autocomplete="off" class="layui-input" disabled>
{/if}
{/volist}
{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">村/社区</label>
<div class="layui-input-block">
<div id="demo2"></div>
</div>
</div>
</td>
</tr>
<tr> <tr>
<td class="layui-td-gray">标题<font>*</font></td> <td class="layui-td-gray">标题<font>*</font></td>
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题" <td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入标题"
@ -90,6 +53,45 @@
</div> </div>
</td> </td>
</tr> </tr>
<tr>
<td style="width: 20%">
<div class="layui-form-item">
<label class="layui-form-label">区县</label>
<div class="layui-input-block">
{if {:session('gougu_admin')['group_access']==1}
<select name="area_id" lay-filter="area_id" lay-verify="required">
{volist name='street' id='vo'}
<option value="{$vo.code}">{$vo.name}</option>
{/volist}
</select>
{else /}
{volist name='street' id='vo'}
{if $address.area_id==$vo.code}
<input type="text" value="{$vo.name}" autocomplete="off" class="layui-input" disabled>
{/if}
{/volist}
{/if}
</div>
</div>
</td>
<td >
<div class="layui-form-item">
<label class="layui-form-label">街道/镇</label>
<div class="layui-input-block">
<div id="demo1"></div>
</div>
</div>
</td>
<td >
<div class="layui-form-item">
<label class="layui-form-label">村/社区</label>
<div class="layui-input-block">
<div id="demo2"></div>
</div>
</div>
</td>
</tr>
<tr> <tr>
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td> <td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td>
</tr> </tr>
@ -114,9 +116,10 @@
<script src="/static/assets/js/xm-select.js"></script> <script src="/static/assets/js/xm-select.js"></script>
<script> <script>
var moduleInit = ['tool', 'tagpicker', 'tinymce']; var moduleInit = ['tool', 'tagpicker', 'tinymce'];
var group_access = "{:session('gougu_admin')['group_access']}"
var area_id = "{$detail.area_id}" var area_id = "{$detail.area_id}"
var street_id = "{$detail.street_id}" var street_id = "{$detail.street_id}"
var group_access = "{:session('gougu_admin')['group_access']}"
function gouguInit() { function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker; var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker;
@ -135,18 +138,13 @@
$('#upload_box_thumb img').attr('src', res.data.filepath); $('#upload_box_thumb img').attr('src', res.data.filepath);
} }
}); });
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
if (area_id != 0) { if (area_id != 0) {
street(area_id) street(area_id)
} }
if (street_id != 0) { if (street_id != 0) {
village(street_id) village(street_id)
} }
form.on('select(area_id)', function (data) { form.on('select(area_id)', function (data) {
street(data.value) street(data.value)
}); });
@ -154,14 +152,14 @@
var demo1 = xmSelect.render({ var demo1 = xmSelect.render({
name: 'street_id', name: 'street_id',
el: '#demo1', el: '#demo1',
initValue: [street_id], initValue: ["{$detail.street_id}"],
prop: { prop: {
name: 'name', name: 'name',
value: 'code', value: 'code',
}, },
data: [], data: [],
radio: true, radio: true,
disabled: group_access == 2 ? true : false,
on: function (data) { on: function (data) {
var arr = data.arr; var arr = data.arr;
village(arr[0]['code']) village(arr[0]['code'])
@ -177,14 +175,14 @@
var demo2 = xmSelect.render({ var demo2 = xmSelect.render({
name: 'village_id', name: 'village_id',
el: '#demo2', el: '#demo2',
initValue: ["{$detail.village_code}"],
prop: { prop: {
name: 'name', name: 'name',
value: 'code', value: 'id',
}, },
data: [], data: [],
initValue: ["{$detail.village_id}"],
radio: true, radio: true,
disabled: group_access == 2 ? true : false,
}) })
$.get('/api/geo/village?pcode=' + id, function (result) { $.get('/api/geo/village?pcode=' + id, function (result) {
demo2.update({ demo2.update({
@ -192,11 +190,15 @@
}) })
}); });
} }
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//监听提交 //监听提交
form.on('submit(webform)', function (data) { form.on('submit(webform)', function (data) {
data.field.introduce = tinyMCE.editors['container_content'].getContent(); data.field.content = tinyMCE.editors['container_content'].getContent();
if (data.field.introduce == '') { if (data.field.content == '') {
layer.msg('请先完善文章内容'); layer.msg('请先完善文章内容');
return false; return false;
} }

View File

@ -142,13 +142,13 @@ class Userinfo extends BaseController
$post['address_name'] = $area_name.$street_name.$village.$brigade_name; $post['address_name'] = $area_name.$street_name.$village.$brigade_name;
// 更新用户表 // 更新用户表
$header = Request::header('x-Token'); // $header = Request::header('x-Token');
if(isset($header['x-token']) && !empty($header['x-token'])){ // if(isset($header['x-token']) && !empty($header['x-token'])){
$phone['mobile'] = $post['phone']??''; // $phone['mobile'] = $post['phone']??'';
Db::table('fa_user')->where($where)->update($phone); // Db::table('fa_user')->where($where)->update($phone);
}else{ // }else{
$post['phone'] = $user['mobile']??''; // $post['phone'] = $user['mobile']??'';
} // }
//写入用户信息表 //写入用户信息表
$data['user_id'] = $userid; $data['user_id'] = $userid;