文章相关

This commit is contained in:
彭桃 2023-02-09 18:03:52 +08:00
parent c0e0b993de
commit 6b2f937ff1
30 changed files with 3390 additions and 0 deletions

View 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 Agrotechnical extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=354;
$this->url=[
'/admin/nk.agrotechnical/index?category_id='.$this->category_id,
'/admin/nk.agrotechnical/add',
'/admin/nk.agrotechnical/edit',
'/admin/nk.agrotechnical/del',
'/admin/nk.agrotechnical/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);
}
}

View 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 Policy extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=355;
$this->url=[
'/admin/nk.policy/index?category_id='.$this->category_id,
'/admin/nk.policy/add',
'/admin/nk.policy/edit',
'/admin/nk.policy/del',
'/admin/nk.policy/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);
}
}

View 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 Seekers extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=358;
$this->url=[
'/admin/nk.seekers/index?category_id='.$this->category_id,
'/admin/nk.seekers/add',
'/admin/nk.seekers/edit',
'/admin/nk.seekers/del',
'/admin/nk.seekers/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);
}
}

View 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 Skills extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=353;
$this->url=[
'/admin/nk.skills/index?category_id='.$this->category_id,
'/admin/nk.skills/add',
'/admin/nk.skills/edit',
'/admin/nk.skills/del',
'/admin/nk.skills/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);
}
}

View 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 Transaction extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=356;
$this->url=[
'/admin/nk.transaction/index?category_id='.$this->category_id,
'/admin/nk.transaction/add',
'/admin/nk.transaction/edit',
'/admin/nk.transaction/del',
'/admin/nk.transaction/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);
}
}

View 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 Welfare extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
$this->category_id=357;
$this->url=[
'/admin/nk.welfare/index?category_id='.$this->category_id,
'/admin/nk.welfare/add',
'/admin/nk.welfare/edit',
'/admin/nk.welfare/del',
'/admin/nk.welfare/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);
}
}

View File

@ -0,0 +1,124 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.farmers/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,132 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis">{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content">{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
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);
}
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.farmers/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 17,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,156 @@
{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="thumb">
</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: '{$url[0]}',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
field: 'area_id',
title: '区县',
align: 'center',
width:120,
},{
field: 'street_id',
title: '乡镇',
align: 'center',
width:120,
},{
field: 'village_id',
title: '街道/村',
align: 'center',
width:120,
},{
field: 'title',
title: '标题',
align: 'center',
width:150,
},{
field: 'synopsis',
title: '简介',
align: 'center',
width:150,
},{
field: 'add_time',
title: '添加时间',
align: 'center',
width:150,
},{
field: 'status',
title: '状态',
align: 'center',
width:100,
},{
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,67 @@
{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;}
.layui-td-gray{
width: 110px;
}
</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">标题<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}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis" readonly>{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content" readonly>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<p>经度:{$detail.lng}</p>
<p>纬度:{$detail.lat}</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">运输距离</td>
<td colspan="6">
{volist name='farmers' id='vo'}
<p>距离 {$vo.title} {$vo.juli} 公里</p>
{/volist}
</td>
</tr>
</table>
</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;
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,124 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.farmers/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,132 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis">{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content">{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
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);
}
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.farmers/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 17,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,156 @@
{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="thumb">
</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: '{$url[0]}',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
field: 'area_id',
title: '区县',
align: 'center',
width:120,
},{
field: 'street_id',
title: '乡镇',
align: 'center',
width:120,
},{
field: 'village_id',
title: '街道/村',
align: 'center',
width:120,
},{
field: 'title',
title: '标题',
align: 'center',
width:150,
},{
field: 'synopsis',
title: '简介',
align: 'center',
width:150,
},{
field: 'add_time',
title: '添加时间',
align: 'center',
width:150,
},{
field: 'status',
title: '状态',
align: 'center',
width:100,
},{
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,67 @@
{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;}
.layui-td-gray{
width: 110px;
}
</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">标题<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}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis" readonly>{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content" readonly>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<p>经度:{$detail.lng}</p>
<p>纬度:{$detail.lat}</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">运输距离</td>
<td colspan="6">
{volist name='farmers' id='vo'}
<p>距离 {$vo.title} {$vo.juli} 公里</p>
{/volist}
</td>
</tr>
</table>
</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;
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,124 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.farmers/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,132 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis">{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content">{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
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);
}
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.farmers/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 17,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,156 @@
{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="thumb">
</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: '{$url[0]}',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
field: 'area_id',
title: '区县',
align: 'center',
width:120,
},{
field: 'street_id',
title: '乡镇',
align: 'center',
width:120,
},{
field: 'village_id',
title: '街道/村',
align: 'center',
width:120,
},{
field: 'title',
title: '标题',
align: 'center',
width:150,
},{
field: 'synopsis',
title: '简介',
align: 'center',
width:150,
},{
field: 'add_time',
title: '添加时间',
align: 'center',
width:150,
},{
field: 'status',
title: '状态',
align: 'center',
width:100,
},{
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,67 @@
{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;}
.layui-td-gray{
width: 110px;
}
</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">标题<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}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis" readonly>{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content" readonly>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<p>经度:{$detail.lng}</p>
<p>纬度:{$detail.lat}</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">运输距离</td>
<td colspan="6">
{volist name='farmers' id='vo'}
<p>距离 {$vo.title} {$vo.juli} 公里</p>
{/volist}
</td>
</tr>
</table>
</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;
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,124 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.farmers/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,132 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis">{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content">{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
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);
}
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.farmers/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 17,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,156 @@
{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="thumb">
</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: '{$url[0]}',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
field: 'area_id',
title: '区县',
align: 'center',
width:120,
},{
field: 'street_id',
title: '乡镇',
align: 'center',
width:120,
},{
field: 'village_id',
title: '街道/村',
align: 'center',
width:120,
},{
field: 'title',
title: '标题',
align: 'center',
width:150,
},{
field: 'synopsis',
title: '简介',
align: 'center',
width:150,
},{
field: 'add_time',
title: '添加时间',
align: 'center',
width:150,
},{
field: 'status',
title: '状态',
align: 'center',
width:100,
},{
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,67 @@
{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;}
.layui-td-gray{
width: 110px;
}
</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">标题<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}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis" readonly>{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content" readonly>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<p>经度:{$detail.lng}</p>
<p>纬度:{$detail.lat}</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">运输距离</td>
<td colspan="6">
{volist name='farmers' id='vo'}
<p>距离 {$vo.title} {$vo.juli} 公里</p>
{/volist}
</td>
</tr>
</table>
</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;
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,124 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.farmers/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,132 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis">{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content">{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
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);
}
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.farmers/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 17,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,156 @@
{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="thumb">
</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: '{$url[0]}',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
field: 'area_id',
title: '区县',
align: 'center',
width:120,
},{
field: 'street_id',
title: '乡镇',
align: 'center',
width:120,
},{
field: 'village_id',
title: '街道/村',
align: 'center',
width:120,
},{
field: 'title',
title: '标题',
align: 'center',
width:150,
},{
field: 'synopsis',
title: '简介',
align: 'center',
width:150,
},{
field: 'add_time',
title: '添加时间',
align: 'center',
width:150,
},{
field: 'status',
title: '状态',
align: 'center',
width:100,
},{
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,67 @@
{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;}
.layui-td-gray{
width: 110px;
}
</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">标题<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}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis" readonly>{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content" readonly>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<p>经度:{$detail.lng}</p>
<p>纬度:{$detail.lat}</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">运输距离</td>
<td colspan="6">
{volist name='farmers' id='vo'}
<p>距离 {$vo.title} {$vo.juli} 公里</p>
{/volist}
</td>
</tr>
</table>
</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;
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,124 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content"></textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
const editorType = '{$editor}';
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
setTimeout(function () {
parent.location.reload();
}, 1000);
}
}
tool.post('/admin/nk.farmers/add', data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,132 @@
{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;
}
.addrhelper-ok-btn{
display: none;
}
</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 colspan="6">
<textarea class="layui-textarea" name="synopsis">{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content">{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<div id="map"></div>
</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/jquery.min.js"></script>
<script src="/static/assets/js/addrHelper.js"></script>
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
var editor = layui.tinymce;
var edit = editor.render({
selector: "#container_content",
height: 500
});
//上传缩略图
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);
}
});
// 打开坐标拾取器
addrHelper.render({
key: "QNXBZ-GUKEX-I5Q4Q-THKU6-233DK-7ZBG7", //必传腾讯地图api key 申请方法见https://lbs.qq.com/webApi/javascriptGL/glGuide/glBasic
el: '#map', //必选项,渲染容器
lat: 28.913318, //可选项,初始化纬度
lng: 105.437753, //可选项初始化经度28.913318,105.437753
zoom: 13, //可选项,地图缩放级别 默认值13
width: "80vw", //可选项,弹窗的宽度 默认80vw
height: "50vh", //可选项,弹窗的高度 默认80vh
toolbar: false, //可选项,显示工具栏 默认true
created: function () { //可选项,地图被创建后回调
},
});
//监听提交
form.on('submit(webform)', function (data) {
data.field.lng = $('.lng').text();
data.field.lat = $('.lat').text();
if (data.field.lng == '') {
layer.msg('请选择经纬度');
return false;
}
if (data.field.lat == '') {
layer.msg('请选择经纬度');
return false;
}
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.farmers/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 17,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -0,0 +1,156 @@
{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="thumb">
</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: '{$url[0]}',
page: true,
limit: 20,
cellMinWidth: 300,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
field: 'area_id',
title: '区县',
align: 'center',
width:120,
},{
field: 'street_id',
title: '乡镇',
align: 'center',
width:120,
},{
field: 'village_id',
title: '街道/村',
align: 'center',
width:120,
},{
field: 'title',
title: '标题',
align: 'center',
width:150,
},{
field: 'synopsis',
title: '简介',
align: 'center',
width:150,
},{
field: 'add_time',
title: '添加时间',
align: 'center',
width:150,
},{
field: 'status',
title: '状态',
align: 'center',
width:100,
},{
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,67 @@
{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;}
.layui-td-gray{
width: 110px;
}
</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">标题<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}" readonly></td>
</tr>
<tr>
<td class="layui-td-gray">简介<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="synopsis" readonly>{$detail.synopsis}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">内容</td>
<td colspan="6">
<textarea class="layui-textarea" name="content" readonly>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">坐标</td>
<td colspan="6">
<p>经度:{$detail.lng}</p>
<p>纬度:{$detail.lat}</p>
</td>
</tr>
<tr>
<td class="layui-td-gray">运输距离</td>
<td colspan="6">
{volist name='farmers' id='vo'}
<p>距离 {$vo.title} {$vo.juli} 公里</p>
{/volist}
</td>
</tr>
</table>
</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;
}
</script>
{/block}
<!-- /脚本 -->