master
parent
4b45f9d748
commit
043818eafa
@ -0,0 +1,25 @@ |
||||
<?php |
||||
class Admin_RemindController extends Ctrl_Admin{ |
||||
public function indexAction(){ |
||||
|
||||
} |
||||
public function getlistAction(){ |
||||
$RemindModel = new RemindModel(); |
||||
$p = $_REQUEST; |
||||
$page = $p['page']; |
||||
$limit = $p['limit']; |
||||
$offset = ($page-1)*$limit; |
||||
$sql = "select * from {$RemindModel->table} where is_delete=0"; |
||||
$count = $RemindModel->query($sql); |
||||
$sql = "select * from {$RemindModel->table} where is_delete=0 order by id desc limit {$offset},{$limit} "; |
||||
$data = $RemindModel->query($sql); |
||||
foreach($data as $key => &$val){ |
||||
$val['sex'] = $val['sex']==1?'公':'母'; |
||||
} |
||||
$return['code'] = 0; |
||||
$return['count'] = count($count); |
||||
$return['data'] = $data; |
||||
$return['msg'] = "成功"; |
||||
echo json_encode($return);die; |
||||
} |
||||
} |
@ -0,0 +1,22 @@ |
||||
<?php |
||||
class Admin_StrainsController extends Ctrl_Admin{ |
||||
public function indexAction(){ |
||||
|
||||
} |
||||
public function getlistAction(){ |
||||
$StrainsModel = new StrainsModel(); |
||||
$p = $_REQUEST; |
||||
$page = $p['page']; |
||||
$limit = $p['limit']; |
||||
$offset = ($page-1)*$limit; |
||||
$sql = "select * from {$StrainsModel->table} where is_delete=0"; |
||||
$count = $StrainsModel->query($sql); |
||||
$sql = "select * from {$StrainsModel->table} where is_delete=0 order by id desc limit {$offset},{$limit} "; |
||||
$data = $StrainsModel->query($sql); |
||||
$return['code'] = 0; |
||||
$return['count'] = count($count); |
||||
$return['data'] = $data; |
||||
$return['msg'] = "成功"; |
||||
echo json_encode($return);die; |
||||
} |
||||
} |
@ -0,0 +1,219 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>待办信息</title> |
||||
<meta name="renderer" content="webkit"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
<link rel="stylesheet" href="/public/layui/css/layui.css" media="all"> |
||||
<link rel="stylesheet" href="/public/style/edit.css" media="all"> |
||||
<!-- 注意:如果你直接复制所有代码到本地,上述css路径需要改成你本地的 --> |
||||
</head> |
||||
<body> |
||||
<style> |
||||
#editor—wrapper { |
||||
border: 1px solid #ccc; |
||||
z-index: 100; /* 按需定义 */ |
||||
} |
||||
#toolbar-container { border-bottom: 1px solid #ccc; } |
||||
#editor-container { height: 400px; } |
||||
</style> |
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
||||
<ul class="layui-tab-title"> |
||||
<li class="layui-this">待办信息</li> |
||||
</ul> |
||||
<div class="layui-tab-content" style="height: 100px;"> |
||||
<div class="layui-tab-item layui-show"><table class="layui-hide" id="classClass" style="padding:25px;" lay-filter="classClass"></table></div> |
||||
</div> |
||||
</div> |
||||
|
||||
<script src="/public/layui/layui.js" charset="utf-8"></script> |
||||
<script src="/public/style/edit.js" charset="utf-8"></script> |
||||
<!-- 注意:如果你直接复制所有代码到本地,上述 JS 路径需要改成你本地的 --> |
||||
<script type="text/html" id="imgshow"> |
||||
<!-- 这里的 checked 的状态只是演示 --> |
||||
<img src="/{{d.img}}"> |
||||
</script> |
||||
<script type="text/html" id="tool"> |
||||
<!-- 这里的 checked 的状态只是演示 --> |
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a> |
||||
</script> |
||||
<script> |
||||
const { createEditor, createToolbar } = window.wangEditor |
||||
|
||||
const editorConfig = { |
||||
placeholder: '请编辑公司介绍', |
||||
onChange(editor) { |
||||
const html = editor.getHtml() |
||||
console.log('editor content', html) |
||||
// 也可以同步到 <textarea> |
||||
} |
||||
} |
||||
|
||||
|
||||
const toolbarConfig = {} |
||||
|
||||
|
||||
layui.use(['layedit','table','upload','element','form','layer'], function(){ |
||||
var layedit = layui.layedit |
||||
,table = layui.table |
||||
,form = layui.form |
||||
,layer = layui.layer |
||||
,upload = layui.upload |
||||
,element = layui.element |
||||
,$ = layui.jquery; |
||||
|
||||
table.render({ |
||||
elem: '#classClass' |
||||
,url: '/admin_remind/getlist' |
||||
,toolbar: '#toolbarDemo' |
||||
,cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增 |
||||
,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可 |
||||
title: '提示' |
||||
,layEvent: 'LAYTABLE_TIPS' |
||||
,icon: 'layui-icon-tips' |
||||
}] |
||||
,page: true |
||||
,cols: [[ |
||||
{field:'id', width:80, title: '序号'} |
||||
,{field:'user_id',width:180, title: '用户'} |
||||
,{field:'content',title: '待办'} |
||||
,{field:'status', width:180, title: '状态'} |
||||
,{field:'created',width:180, title: '添加时间'} |
||||
,{toolbar: '#tool',width:200, title: '操作'} |
||||
]] |
||||
}); |
||||
table.on('tool(classClass)', function(obj){ |
||||
console.log(obj) |
||||
var data = obj.data; |
||||
if(obj.event === 'del'){ |
||||
layer.confirm('确定要删除数据嘛', function(index){ |
||||
$.post('/admin_index/delete',{tablename:'company',id:data.id},function(obj){ |
||||
if(obj.status != 1){ |
||||
return layer.msg(obj.msg); |
||||
}else{ |
||||
//示范一个公告层 |
||||
layer.open({ |
||||
type: 1 |
||||
,title: false //不显示标题栏 |
||||
,closeBtn: false |
||||
,area: '300px;' |
||||
,shade: 0.8 |
||||
,id: 'LAY_layuipro' //设定一个id,防止重复弹出 |
||||
,btn: '返回列表' |
||||
,btnAlign: 'c' |
||||
,moveType: 1 //拖拽模式,0或者1 |
||||
,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: bold;font-size: 20px;text-align: center;">删除成功</div>' |
||||
,yes: function(){ |
||||
history.go(0) |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
$('.site-demo-layedit').on('click', function(){ |
||||
var type = $(this).data('type'); |
||||
active[type] ? active[type].call(this) : ''; |
||||
}); |
||||
//监听提交 |
||||
form.on('submit(subdata)', function(data){ |
||||
var datas = data.field |
||||
datas.content = editor.getHtml() |
||||
$.post('/admin_index/companysave',datas,function(obj){ |
||||
if(obj.status != 1){ |
||||
return layer.msg(obj.msg); |
||||
}else{ |
||||
//示范一个公告层 |
||||
layer.open({ |
||||
type: 1 |
||||
,title: false //不显示标题栏 |
||||
,closeBtn: false |
||||
,area: '300px;' |
||||
,shade: 0.8 |
||||
,id: 'LAY_layuipro' //设定一个id,防止重复弹出 |
||||
,btn: '返回列表' |
||||
,btnAlign: 'c' |
||||
,moveType: 1 //拖拽模式,0或者1 |
||||
,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: bold;font-size: 20px;text-align: center;">添加成功</div>' |
||||
,yes: function(){ |
||||
history.go(0) |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
return false; |
||||
}); |
||||
//常规使用 - 普通图片上传 |
||||
var uploadInst = upload.render({ |
||||
elem: '#test1' |
||||
,url: '/admin_index/upload' //此处用的是第三方的 http 请求演示,实际使用时改成您自己的上传接口即可。 |
||||
,before: function(obj){ |
||||
//预读本地文件示例,不支持ie8 |
||||
obj.preview(function(index, file, result){ |
||||
$('#demo1').attr('src', result); //图片链接(base64) |
||||
}); |
||||
|
||||
element.progress('demo', '0%'); //进度条复位 |
||||
layer.msg('上传中', {icon: 16, time: 0}); |
||||
} |
||||
,done: function(res){ |
||||
//如果上传失败 |
||||
if(res.status != 1){ |
||||
return layer.msg('上传失败'); |
||||
} |
||||
$('#img').val(res.data); //置空上传失败的状态 |
||||
//上传成功的一些操作 |
||||
//…… |
||||
$('#demoText').html(''); //置空上传失败的状态 |
||||
} |
||||
,error: function(){ |
||||
//演示失败状态,并实现重传 |
||||
var demoText = $('#demoText'); |
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>'); |
||||
demoText.find('.demo-reload').on('click', function(){ |
||||
uploadInst.upload(); |
||||
}); |
||||
} |
||||
//进度条 |
||||
,progress: function(n, elem, e){ |
||||
element.progress('demo', n + '%'); //可配合 layui 进度条元素使用 |
||||
if(n == 100){ |
||||
layer.msg('上传完毕', {icon: 1}); |
||||
} |
||||
} |
||||
}); |
||||
// function deletet(tablename,id){ |
||||
// $.post('/admin_index/delete',{tablename:tablename,id:id},function(obj){ |
||||
// if(obj.status != 1){ |
||||
// return layer.msg(obj.msg); |
||||
// }else{ |
||||
// //示范一个公告层 |
||||
// layer.open({ |
||||
// type: 1 |
||||
// ,title: false //不显示标题栏 |
||||
// ,closeBtn: false |
||||
// ,area: '300px;' |
||||
// ,shade: 0.8 |
||||
// ,id: 'LAY_layuipro' //设定一个id,防止重复弹出 |
||||
// ,btn: '返回列表' |
||||
// ,btnAlign: 'c' |
||||
// ,moveType: 1 //拖拽模式,0或者1 |
||||
// ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: bold;font-size: 20px;text-align: center;">添加成功</div>' |
||||
// ,yes: function(){ |
||||
// history.go(0) |
||||
// } |
||||
// }); |
||||
// } |
||||
// }); |
||||
// } |
||||
|
||||
}); |
||||
|
||||
</script> |
||||
|
||||
</body> |
||||
</html> |
@ -0,0 +1,219 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>待办信息</title> |
||||
<meta name="renderer" content="webkit"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
<link rel="stylesheet" href="/public/layui/css/layui.css" media="all"> |
||||
<link rel="stylesheet" href="/public/style/edit.css" media="all"> |
||||
<!-- 注意:如果你直接复制所有代码到本地,上述css路径需要改成你本地的 --> |
||||
</head> |
||||
<body> |
||||
<style> |
||||
#editor—wrapper { |
||||
border: 1px solid #ccc; |
||||
z-index: 100; /* 按需定义 */ |
||||
} |
||||
#toolbar-container { border-bottom: 1px solid #ccc; } |
||||
#editor-container { height: 400px; } |
||||
</style> |
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
||||
<ul class="layui-tab-title"> |
||||
<li class="layui-this">待办信息</li> |
||||
</ul> |
||||
<div class="layui-tab-content" style="height: 100px;"> |
||||
<div class="layui-tab-item layui-show"><table class="layui-hide" id="classClass" style="padding:25px;" lay-filter="classClass"></table></div> |
||||
</div> |
||||
</div> |
||||
|
||||
<script src="/public/layui/layui.js" charset="utf-8"></script> |
||||
<script src="/public/style/edit.js" charset="utf-8"></script> |
||||
<!-- 注意:如果你直接复制所有代码到本地,上述 JS 路径需要改成你本地的 --> |
||||
<script type="text/html" id="imgshow"> |
||||
<!-- 这里的 checked 的状态只是演示 --> |
||||
<img src="/{{d.img}}"> |
||||
</script> |
||||
<script type="text/html" id="tool"> |
||||
<!-- 这里的 checked 的状态只是演示 --> |
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a> |
||||
</script> |
||||
<script> |
||||
const { createEditor, createToolbar } = window.wangEditor |
||||
|
||||
const editorConfig = { |
||||
placeholder: '请编辑公司介绍', |
||||
onChange(editor) { |
||||
const html = editor.getHtml() |
||||
console.log('editor content', html) |
||||
// 也可以同步到 <textarea> |
||||
} |
||||
} |
||||
|
||||
|
||||
const toolbarConfig = {} |
||||
|
||||
|
||||
layui.use(['layedit','table','upload','element','form','layer'], function(){ |
||||
var layedit = layui.layedit |
||||
,table = layui.table |
||||
,form = layui.form |
||||
,layer = layui.layer |
||||
,upload = layui.upload |
||||
,element = layui.element |
||||
,$ = layui.jquery; |
||||
|
||||
table.render({ |
||||
elem: '#classClass' |
||||
,url: '/admin_remind/getlist' |
||||
,toolbar: '#toolbarDemo' |
||||
,cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增 |
||||
,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可 |
||||
title: '提示' |
||||
,layEvent: 'LAYTABLE_TIPS' |
||||
,icon: 'layui-icon-tips' |
||||
}] |
||||
,page: true |
||||
,cols: [[ |
||||
{field:'id', width:80, title: '序号'} |
||||
,{field:'user_id',width:180, title: '用户'} |
||||
,{field:'content',title: '待办'} |
||||
,{field:'status', width:180, title: '状态'} |
||||
,{field:'created',width:180, title: '添加时间'} |
||||
,{toolbar: '#tool',width:200, title: '操作'} |
||||
]] |
||||
}); |
||||
table.on('tool(classClass)', function(obj){ |
||||
console.log(obj) |
||||
var data = obj.data; |
||||
if(obj.event === 'del'){ |
||||
layer.confirm('确定要删除数据嘛', function(index){ |
||||
$.post('/admin_index/delete',{tablename:'company',id:data.id},function(obj){ |
||||
if(obj.status != 1){ |
||||
return layer.msg(obj.msg); |
||||
}else{ |
||||
//示范一个公告层 |
||||
layer.open({ |
||||
type: 1 |
||||
,title: false //不显示标题栏 |
||||
,closeBtn: false |
||||
,area: '300px;' |
||||
,shade: 0.8 |
||||
,id: 'LAY_layuipro' //设定一个id,防止重复弹出 |
||||
,btn: '返回列表' |
||||
,btnAlign: 'c' |
||||
,moveType: 1 //拖拽模式,0或者1 |
||||
,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: bold;font-size: 20px;text-align: center;">删除成功</div>' |
||||
,yes: function(){ |
||||
history.go(0) |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
$('.site-demo-layedit').on('click', function(){ |
||||
var type = $(this).data('type'); |
||||
active[type] ? active[type].call(this) : ''; |
||||
}); |
||||
//监听提交 |
||||
form.on('submit(subdata)', function(data){ |
||||
var datas = data.field |
||||
datas.content = editor.getHtml() |
||||
$.post('/admin_index/companysave',datas,function(obj){ |
||||
if(obj.status != 1){ |
||||
return layer.msg(obj.msg); |
||||
}else{ |
||||
//示范一个公告层 |
||||
layer.open({ |
||||
type: 1 |
||||
,title: false //不显示标题栏 |
||||
,closeBtn: false |
||||
,area: '300px;' |
||||
,shade: 0.8 |
||||
,id: 'LAY_layuipro' //设定一个id,防止重复弹出 |
||||
,btn: '返回列表' |
||||
,btnAlign: 'c' |
||||
,moveType: 1 //拖拽模式,0或者1 |
||||
,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: bold;font-size: 20px;text-align: center;">添加成功</div>' |
||||
,yes: function(){ |
||||
history.go(0) |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
return false; |
||||
}); |
||||
//常规使用 - 普通图片上传 |
||||
var uploadInst = upload.render({ |
||||
elem: '#test1' |
||||
,url: '/admin_index/upload' //此处用的是第三方的 http 请求演示,实际使用时改成您自己的上传接口即可。 |
||||
,before: function(obj){ |
||||
//预读本地文件示例,不支持ie8 |
||||
obj.preview(function(index, file, result){ |
||||
$('#demo1').attr('src', result); //图片链接(base64) |
||||
}); |
||||
|
||||
element.progress('demo', '0%'); //进度条复位 |
||||
layer.msg('上传中', {icon: 16, time: 0}); |
||||
} |
||||
,done: function(res){ |
||||
//如果上传失败 |
||||
if(res.status != 1){ |
||||
return layer.msg('上传失败'); |
||||
} |
||||
$('#img').val(res.data); //置空上传失败的状态 |
||||
//上传成功的一些操作 |
||||
//…… |
||||
$('#demoText').html(''); //置空上传失败的状态 |
||||
} |
||||
,error: function(){ |
||||
//演示失败状态,并实现重传 |
||||
var demoText = $('#demoText'); |
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>'); |
||||
demoText.find('.demo-reload').on('click', function(){ |
||||
uploadInst.upload(); |
||||
}); |
||||
} |
||||
//进度条 |
||||
,progress: function(n, elem, e){ |
||||
element.progress('demo', n + '%'); //可配合 layui 进度条元素使用 |
||||
if(n == 100){ |
||||
layer.msg('上传完毕', {icon: 1}); |
||||
} |
||||
} |
||||
}); |
||||
// function deletet(tablename,id){ |
||||
// $.post('/admin_index/delete',{tablename:tablename,id:id},function(obj){ |
||||
// if(obj.status != 1){ |
||||
// return layer.msg(obj.msg); |
||||
// }else{ |
||||
// //示范一个公告层 |
||||
// layer.open({ |
||||
// type: 1 |
||||
// ,title: false //不显示标题栏 |
||||
// ,closeBtn: false |
||||
// ,area: '300px;' |
||||
// ,shade: 0.8 |
||||
// ,id: 'LAY_layuipro' //设定一个id,防止重复弹出 |
||||
// ,btn: '返回列表' |
||||
// ,btnAlign: 'c' |
||||
// ,moveType: 1 //拖拽模式,0或者1 |
||||
// ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: bold;font-size: 20px;text-align: center;">添加成功</div>' |
||||
// ,yes: function(){ |
||||
// history.go(0) |
||||
// } |
||||
// }); |
||||
// } |
||||
// }); |
||||
// } |
||||
|
||||
}); |
||||
|
||||
</script> |
||||
|
||||
</body> |
||||
</html> |
@ -0,0 +1,219 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<title>待办信息</title> |
||||
<meta name="renderer" content="webkit"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
<link rel="stylesheet" href="/public/layui/css/layui.css" media="all"> |
||||
<link rel="stylesheet" href="/public/style/edit.css" media="all"> |
||||
<!-- 注意:如果你直接复制所有代码到本地,上述css路径需要改成你本地的 --> |
||||
</head> |
||||
<body> |
||||
<style> |
||||
#editor—wrapper { |
||||
border: 1px solid #ccc; |
||||
z-index: 100; /* 按需定义 */ |
||||
} |
||||
#toolbar-container { border-bottom: 1px solid #ccc; } |
||||
#editor-container { height: 400px; } |
||||
</style> |
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
||||
<ul class="layui-tab-title"> |
||||
<li class="layui-this">待办信息</li> |
||||
</ul> |
||||
<div class="layui-tab-content" style="height: 100px;"> |
||||
<div class="layui-tab-item layui-show"><table class="layui-hide" id="classClass" style="padding:25px;" lay-filter="classClass"></table></div> |
||||
</div> |
||||
</div> |
||||
|
||||
<script src="/public/layui/layui.js" charset="utf-8"></script> |
||||
<script src="/public/style/edit.js" charset="utf-8"></script> |
||||
<!-- 注意:如果你直接复制所有代码到本地,上述 JS 路径需要改成你本地的 --> |
||||
<script type="text/html" id="imgshow"> |
||||
<!-- 这里的 checked 的状态只是演示 --> |
||||
<img src="/{{d.img}}"> |
||||
</script> |
||||
<script type="text/html" id="tool"> |
||||
<!-- 这里的 checked 的状态只是演示 --> |
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a> |
||||
</script> |
||||
<script> |
||||
const { createEditor, createToolbar } = window.wangEditor |
||||
|
||||
const editorConfig = { |
||||
placeholder: '请编辑公司介绍', |
||||
onChange(editor) { |
||||
const html = editor.getHtml() |
||||
console.log('editor content', html) |
||||
// 也可以同步到 <textarea> |
||||
} |
||||
} |
||||
|
||||
|
||||
const toolbarConfig = {} |
||||
|
||||
|
||||
layui.use(['layedit','table','upload','element','form','layer'], function(){ |
||||
var layedit = layui.layedit |
||||
,table = layui.table |
||||
,form = layui.form |
||||
,layer = layui.layer |
||||
,upload = layui.upload |
||||
,element = layui.element |
||||
,$ = layui.jquery; |
||||
|
||||
table.render({ |
||||
elem: '#classClass' |
||||
,url: '/admin_remind/getlist' |
||||
,toolbar: '#toolbarDemo' |
||||
,cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增 |
||||
,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可 |
||||
title: '提示' |
||||
,layEvent: 'LAYTABLE_TIPS' |
||||
,icon: 'layui-icon-tips' |
||||
}] |
||||
,page: true |
||||
,cols: [[ |
||||
{field:'id', width:80, title: '序号'} |
||||
,{field:'user_id',width:180, title: '用户'} |
||||
,{field:'content',title: '待办'} |
||||
,{field:'status', width:180, title: '状态'} |
||||
,{field:'created',width:180, title: '添加时间'} |
||||
,{toolbar: '#tool',width:200, title: '操作'} |
||||
]] |
||||
}); |
||||
table.on('tool(classClass)', function(obj){ |
||||
console.log(obj) |
||||
var data = obj.data; |
||||
if(obj.event === 'del'){ |
||||
layer.confirm('确定要删除数据嘛', function(index){ |
||||
$.post('/admin_index/delete',{tablename:'company',id:data.id},function(obj){ |
||||
if(obj.status != 1){ |
||||
return layer.msg(obj.msg); |
||||
}else{ |
||||
//示范一个公告层 |
||||
layer.open({ |
||||
type: 1 |
||||
,title: false //不显示标题栏 |
||||
,closeBtn: false |
||||
,area: '300px;' |
||||
,shade: 0.8 |
||||
,id: 'LAY_layuipro' //设定一个id,防止重复弹出 |
||||
,btn: '返回列表' |
||||
,btnAlign: 'c' |
||||
,moveType: 1 //拖拽模式,0或者1 |
||||
,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: bold;font-size: 20px;text-align: center;">删除成功</div>' |
||||
,yes: function(){ |
||||
history.go(0) |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
$('.site-demo-layedit').on('click', function(){ |
||||
var type = $(this).data('type'); |
||||
active[type] ? active[type].call(this) : ''; |
||||
}); |
||||
//监听提交 |
||||
form.on('submit(subdata)', function(data){ |
||||
var datas = data.field |
||||
datas.content = editor.getHtml() |
||||
$.post('/admin_index/companysave',datas,function(obj){ |
||||
if(obj.status != 1){ |
||||
return layer.msg(obj.msg); |
||||
}else{ |
||||
//示范一个公告层 |
||||
layer.open({ |
||||
type: 1 |
||||
,title: false //不显示标题栏 |
||||
,closeBtn: false |
||||
,area: '300px;' |
||||
,shade: 0.8 |
||||
,id: 'LAY_layuipro' //设定一个id,防止重复弹出 |
||||
,btn: '返回列表' |
||||
,btnAlign: 'c' |
||||
,moveType: 1 //拖拽模式,0或者1 |
||||
,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: bold;font-size: 20px;text-align: center;">添加成功</div>' |
||||
,yes: function(){ |
||||
history.go(0) |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
return false; |
||||
}); |
||||
//常规使用 - 普通图片上传 |
||||
var uploadInst = upload.render({ |
||||
elem: '#test1' |
||||
,url: '/admin_index/upload' //此处用的是第三方的 http 请求演示,实际使用时改成您自己的上传接口即可。 |
||||
,before: function(obj){ |
||||
//预读本地文件示例,不支持ie8 |
||||
obj.preview(function(index, file, result){ |
||||
$('#demo1').attr('src', result); //图片链接(base64) |
||||
}); |
||||
|
||||
element.progress('demo', '0%'); //进度条复位 |
||||
layer.msg('上传中', {icon: 16, time: 0}); |
||||
} |
||||
,done: function(res){ |
||||
//如果上传失败 |
||||
if(res.status != 1){ |
||||
return layer.msg('上传失败'); |
||||
} |
||||
$('#img').val(res.data); //置空上传失败的状态 |
||||
//上传成功的一些操作 |
||||
//…… |
||||
$('#demoText').html(''); //置空上传失败的状态 |
||||
} |
||||
,error: function(){ |
||||
//演示失败状态,并实现重传 |
||||
var demoText = $('#demoText'); |
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>'); |
||||
demoText.find('.demo-reload').on('click', function(){ |
||||
uploadInst.upload(); |
||||
}); |
||||
} |
||||
//进度条 |
||||
,progress: function(n, elem, e){ |
||||
element.progress('demo', n + '%'); //可配合 layui 进度条元素使用 |
||||
if(n == 100){ |
||||
layer.msg('上传完毕', {icon: 1}); |
||||
} |
||||
} |
||||
}); |
||||
// function deletet(tablename,id){ |
||||
// $.post('/admin_index/delete',{tablename:tablename,id:id},function(obj){ |
||||
// if(obj.status != 1){ |
||||
// return layer.msg(obj.msg); |
||||
// }else{ |
||||
// //示范一个公告层 |
||||
// layer.open({ |
||||
// type: 1 |
||||
// ,title: false //不显示标题栏 |
||||
// ,closeBtn: false |
||||
// ,area: '300px;' |
||||
// ,shade: 0.8 |
||||
// ,id: 'LAY_layuipro' //设定一个id,防止重复弹出 |
||||
// ,btn: '返回列表' |
||||
// ,btnAlign: 'c' |
||||
// ,moveType: 1 //拖拽模式,0或者1 |
||||
// ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: bold;font-size: 20px;text-align: center;">添加成功</div>' |
||||
// ,yes: function(){ |
||||
// history.go(0) |
||||
// } |
||||
// }); |
||||
// } |
||||
// }); |
||||
// } |
||||
|
||||
}); |
||||
|
||||
</script> |
||||
|
||||
</body> |
||||
</html> |
Loading…
Reference in new issue