简化js
This commit is contained in:
parent
6cd94d2f3f
commit
aee27eb132
|
@ -16,9 +16,6 @@
|
|||
</@shiro.hasPermission>
|
||||
</div>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn layui-btn-sm" style="float: right;margin-right:30px" onclick="javascript:location.replace(location.href);">刷新</button>
|
||||
<#-- <button class="layui-btn layui-btn-sm icon-position-no-button" id="refresh" style="float: right;" onclick="javascript:location.replace(location.href);">
|
||||
<i class="layui-icon i-icon" style="font-size: 21px">ဂ</i>
|
||||
</button>-->
|
||||
</div>
|
||||
<div id="menuTree"></div>
|
||||
</body>
|
||||
|
|
|
@ -8,256 +8,285 @@ To change this template use File | Settings | File Templates.-->
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>菜单管理</title>
|
||||
<meta charset="UTF-8">
|
||||
<title>菜单管理</title>
|
||||
<#include "/system/base/header.ftl">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="x-body">
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div style="width:100%;height:500px;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">基础信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div style="margin-left:25%">
|
||||
<div class="layui-form-item">
|
||||
<label for="menuType" class="layui-form-label">
|
||||
<span class="x-red">*</span>类型
|
||||
</label>
|
||||
<div class="layui-input-block" style="width:190px;">
|
||||
<select disabled id="menuType" lay-verify="menuType" lay-filter="menuType">
|
||||
<option value=""></option>
|
||||
<option <#if (sysMenu.PId)??==null>selected</#if> value="2">一级菜单</option>
|
||||
<option <#if sysMenu.menuType='0'&&(sysMenu.PId)??>selected</#if> value="0">二级菜单</option>
|
||||
<option <#if sysMenu.menuType=='1'>selected</#if> value="1">按钮</option>
|
||||
</select>
|
||||
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
|
||||
<div style="width:100%;height:500px;overflow: auto;">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
|
||||
<legend style="font-size:16px;">基础信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="pDiv">
|
||||
<label for="pName" class="layui-form-label">
|
||||
父级菜单
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<#-- <input type="hidden" id="pId" value="${sysMenu.PId}">-->
|
||||
<#--保留 但不做更新-->
|
||||
<input type="text" id="pName" disabled value="${pName}" onclick="showTree();" lay-verify="pName"
|
||||
class="layui-input">
|
||||
</div>
|
||||
<div id="treeNode" style="display:none; position: absolute;z-index:1000;background-color: white;">
|
||||
<div id="tree"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="name" class="layui-form-label">
|
||||
<span class="x-red">*</span>名称
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${sysMenu.name}" id="name" name="name" lay-verify="name"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div id="ms" class="layui-form-mid layui-word-aux">
|
||||
<span class="x-red">*</span><span id="ums">必须填写</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="url" class="layui-form-label">
|
||||
url
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${sysMenu.url}" id="url" name="url" lay-verify="url" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div style="margin-left:25%">
|
||||
<div class="layui-form-item">
|
||||
<label for="menuType" class="layui-form-label">
|
||||
<span class="x-red">*</span>类型
|
||||
</label>
|
||||
<div class="layui-input-block" style="width:190px;">
|
||||
<select disabled id="menuType" lay-verify="menuType" lay-filter="menuType">
|
||||
<option value=""></option>
|
||||
<option <#if (sysMenu.PId)??==null>selected</#if> value="2">一级菜单</option>
|
||||
<option <#if sysMenu.menuType='0'&&(sysMenu.PId)??>selected</#if> value="0">
|
||||
二级菜单</option>
|
||||
<option <#if sysMenu.menuType=='1'>selected</#if> value="1">按钮</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="pDiv">
|
||||
<label for="pName" class="layui-form-label">
|
||||
父级菜单
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<#-- <input type="hidden" id="pId" value="${sysMenu.PId}">-->
|
||||
<#--保留 但不做更新-->
|
||||
<input type="text" id="pName" disabled value="${pName}" onclick="showTree();" lay-verify="pName"
|
||||
class="layui-input">
|
||||
</div>
|
||||
<div id="treeNode" style="display:none; position: absolute;z-index:1000;background-color: white;">
|
||||
<div id="tree"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="name" class="layui-form-label">
|
||||
<span class="x-red">*</span>名称
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${sysMenu.name}" id="name" name="name" lay-verify="name"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div id="ms" class="layui-form-mid layui-word-aux">
|
||||
<span class="x-red">*</span><span id="ums">必须填写</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="url" class="layui-form-label">
|
||||
url
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${sysMenu.url}" id="url" name="url" lay-verify="url"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
|
||||
<label for="permission" class="layui-form-label">
|
||||
<span class="x-red">*</span>权限
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${sysMenu.permission}" id="permission" name="permission" lay-verify="permission"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="icon" class="layui-form-label">
|
||||
<span class="x-red">*</span>图标
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<div style="margin-left: 20px;margin-top:5px">
|
||||
<ul>
|
||||
<li style="display: inline-block;width: 50px;" id="menu-icon"><i class="layui-icon" id="icon" style="font-size: 25px;">${sysMenu.icon}</i></li>
|
||||
<li style="display: inline-block;"><i class="layui-btn layui-btn-primary layui-btn-sm" id="select_icon">选择图标</i></li>
|
||||
</ul>
|
||||
</div>
|
||||
<label for="permission" class="layui-form-label">
|
||||
<span class="x-red">*</span>权限
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" value="${sysMenu.permission}" id="permission" name="permission"
|
||||
lay-verify="permission"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="icon" class="layui-form-label">
|
||||
<span class="x-red">*</span>图标
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<div style="margin-left: 20px;margin-top:5px">
|
||||
<ul>
|
||||
<li style="display: inline-block;width: 50px;" id="menu-icon"><i class="layui-icon"
|
||||
id="icon"
|
||||
style="font-size: 25px;">${sysMenu.icon}</i>
|
||||
</li>
|
||||
<li style="display: inline-block;"><i class="layui-btn layui-btn-primary layui-btn-sm"
|
||||
id="select_icon">选择图标</i></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="orderNum" class="layui-form-label">
|
||||
<span class="x-red">*</span>序号
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="orderNum" value="${sysMenu.orderNum}" name="orderNum"
|
||||
lay-verify="orderNum"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 60px"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="orderNum" class="layui-form-label">
|
||||
<span class="x-red">*</span>序号
|
||||
</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="orderNum" value="${sysMenu.orderNum}" name="orderNum" lay-verify="orderNum"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 60px"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;
|
||||
<div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;
|
||||
position: fixed;bottom: 1px;margin-left:-20px;">
|
||||
<div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
|
||||
<button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>
|
||||
更新
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary" id="close">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
|
||||
<button class="layui-btn layui-btn-normal" lay-filter="add" lay-submit>
|
||||
更新
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary" id="close">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['form','layer'], function(){
|
||||
$ = layui.jquery;
|
||||
var form = layui.form
|
||||
,layer = layui.layer;
|
||||
layui.tree({
|
||||
elem:'#tree',
|
||||
nodes:${menus}
|
||||
,click: function(node){
|
||||
if(node.menuType=='1'){
|
||||
layer.msg('请勿选择按钮', {icon: 5,anim:6});
|
||||
return false;
|
||||
layui.use(['form', 'layer', 'tree'], function () {
|
||||
$ = layui.jquery;
|
||||
var form = layui.form
|
||||
, layer = layui.layer, tree = layui.tree;
|
||||
var menus =${menus};
|
||||
/*过滤掉按钮和兼容新版layui*/
|
||||
var convert = function (menus) {
|
||||
menus.find(function (v) {
|
||||
v['title'] = v.name;
|
||||
if (v.children.length > 0) {
|
||||
var isButton = v.children[0].menuType === 1;
|
||||
if (isButton) {
|
||||
v.children = [];
|
||||
} else {
|
||||
convert(v.children);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
convert(menus);
|
||||
tree.render({
|
||||
elem: '#tree',
|
||||
nodes: menus
|
||||
, click: function (node) {
|
||||
var data = node.data;
|
||||
$('#pId').val(data.id);
|
||||
$('#pName').val(data.name);
|
||||
}
|
||||
$('#pId').val(node.id);
|
||||
$('#pName').val(node.name);
|
||||
}
|
||||
});
|
||||
$('#select_icon').click(function(){
|
||||
parent.layer.open({
|
||||
id:'icon',
|
||||
type: 2,
|
||||
area: ['800px','600px'],
|
||||
shade: 0.4,
|
||||
zIndex: layer.zIndex,
|
||||
title: '图标',
|
||||
content: '../plugin/html/icon.html'
|
||||
});
|
||||
});
|
||||
});
|
||||
$('#select_icon').click(function () {
|
||||
parent.layer.open({
|
||||
id: 'icon',
|
||||
type: 2,
|
||||
area: ['800px', '600px'],
|
||||
shade: 0.4,
|
||||
zIndex: layer.zIndex,
|
||||
title: '图标',
|
||||
content: '../plugin/html/icon.html'
|
||||
});
|
||||
});
|
||||
|
||||
//自定义验证规则
|
||||
var type=$('#menuType');
|
||||
form.verify({
|
||||
menuType:function(v){
|
||||
console.info(v=='')
|
||||
if(v==''){
|
||||
return '类型不能为空';
|
||||
}
|
||||
}
|
||||
,pName:function(v){
|
||||
if(type.val()!='2'&&v.trim()==''){
|
||||
return '父菜单不能为空';
|
||||
}
|
||||
}
|
||||
,name:function(v){
|
||||
if(v.trim()==''){
|
||||
return '名称不能为空';
|
||||
}
|
||||
}
|
||||
,url:function(v){
|
||||
if(type.val()=='1'){
|
||||
$('#url').val('');
|
||||
//自定义验证规则
|
||||
var type = $('#menuType');
|
||||
form.verify({
|
||||
menuType: function (v) {
|
||||
console.info(v == '')
|
||||
if (v == '') {
|
||||
return '类型不能为空';
|
||||
}
|
||||
}
|
||||
if(type.val()=='0'&&v.trim()==''){
|
||||
return 'url不能为空';
|
||||
, pName: function (v) {
|
||||
if (type.val() != '2' && v.trim() == '') {
|
||||
return '父菜单不能为空';
|
||||
}
|
||||
}
|
||||
}
|
||||
,permission:function(v){
|
||||
if((type.val()=='1'||type.val()=='0')&&v.trim()==''){
|
||||
return '权限不能为空';
|
||||
, name: function (v) {
|
||||
if (v.trim() == '') {
|
||||
return '名称不能为空';
|
||||
}
|
||||
}
|
||||
}
|
||||
,orderNum: [/^[0-9]*[1-9][0-9]*$/, '请填写序号(正整数)']
|
||||
});
|
||||
, url: function (v) {
|
||||
if (type.val() == '1') {
|
||||
$('#url').val('');
|
||||
}
|
||||
if (type.val() == '0' && v.trim() == '') {
|
||||
return 'url不能为空';
|
||||
}
|
||||
}
|
||||
, permission: function (v) {
|
||||
if ((type.val() == '1' || type.val() == '0') && v.trim() == '') {
|
||||
return '权限不能为空';
|
||||
}
|
||||
}
|
||||
, orderNum: [/^[0-9]*[1-9][0-9]*$/, '请填写序号(正整数)']
|
||||
});
|
||||
|
||||
form.on('select(menuType)', function(data){
|
||||
if(data.value=='2'){
|
||||
$('#pId').val('');
|
||||
dOs('pName',true);dOs('permission',true);dOs('url',false);
|
||||
}else if(data.value=='1'){//按钮
|
||||
dOs('url',true);dOs('pName',false);dOs('permission',false);
|
||||
}else if(data.value=='0'){
|
||||
dOs('url',false);dOs('pName',false);dOs('permission',false);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* id :元素id
|
||||
* flag true:禁止输入,false 允许输入
|
||||
*/
|
||||
function dOs(id,flag){
|
||||
var $id= $("#"+id);
|
||||
if(flag){
|
||||
$id.val('');
|
||||
$id.attr('disabled','disabled').css('background','#e6e6e6');
|
||||
}
|
||||
else
|
||||
$id.removeAttr('disabled').css('background','white')
|
||||
}
|
||||
form.on('select(menuType)', function (data) {
|
||||
if (data.value == '2') {
|
||||
$('#pId').val('');
|
||||
dOs('pName', true);
|
||||
dOs('permission', true);
|
||||
dOs('url', false);
|
||||
} else if (data.value == '1') {//按钮
|
||||
dOs('url', true);
|
||||
dOs('pName', false);
|
||||
dOs('permission', false);
|
||||
} else if (data.value == '0') {
|
||||
dOs('url', false);
|
||||
dOs('pName', false);
|
||||
dOs('permission', false);
|
||||
}
|
||||
});
|
||||
|
||||
$('#close').click(function(){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(add)', function(data){
|
||||
data.field['icon']=$('#icon').text();
|
||||
data.field['id']='${sysMenu.id}';
|
||||
$.ajax({
|
||||
url:'updateMenu',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false, dataType: "json", traditional: true,
|
||||
success:function(data){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
window.top.layer.msg(data.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
parent.layer.close(index);
|
||||
parent.location.replace(parent.location.href);
|
||||
},error:function(){
|
||||
/**
|
||||
* id :元素id
|
||||
* flag true:禁止输入,false 允许输入
|
||||
*/
|
||||
function dOs(id, flag) {
|
||||
var $id = $("#" + id);
|
||||
if (flag) {
|
||||
$id.val('');
|
||||
$id.attr('disabled', 'disabled').css('background', '#e6e6e6');
|
||||
} else
|
||||
$id.removeAttr('disabled').css('background', 'white')
|
||||
}
|
||||
|
||||
$('#close').click(function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
window.top.layer.msg('请求失败',{icon:5,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
parent.layer.close(index);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
parent.layer.close(index);
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(add)', function (data) {
|
||||
data.field['icon'] = $('#icon').text();
|
||||
data.field['id'] = '${sysMenu.id}';
|
||||
$.ajax({
|
||||
url: 'updateMenu',
|
||||
type: 'post',
|
||||
data: data.field,
|
||||
async: false, dataType: "json", traditional: true,
|
||||
success: function (data) {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
window.top.layer.msg(data.msg, {icon: 6, offset: 'rb', area: ['120px', '80px'], anim: 2});
|
||||
parent.layer.close(index);
|
||||
parent.location.replace(parent.location.href);
|
||||
}, error: function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
window.top.layer.msg('请求失败', {icon: 5, offset: 'rb', area: ['120px', '80px'], anim: 2});
|
||||
parent.layer.close(index);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
form.render();
|
||||
});
|
||||
form.render();
|
||||
});
|
||||
|
||||
function showTree(){
|
||||
var p=$('#pName');
|
||||
var cityObj = p;
|
||||
var cityOffset =p.offset();
|
||||
var width=p.css('width');
|
||||
$('#treeNode').css({
|
||||
left: cityOffset.left + 'px',
|
||||
top: cityOffset.top + cityObj.outerHeight() + 'px',
|
||||
width:width,
|
||||
border:'1px solid #e6e6e6'
|
||||
}).slideDown('fast');
|
||||
$('body').bind('mousedown', onBodyDown);
|
||||
$('#treeNode').css('display','inline');
|
||||
}
|
||||
function hideMenu() {
|
||||
$('#treeNode').fadeOut('fast');
|
||||
$('body').unbind('blur', onBodyDown);
|
||||
}
|
||||
function onBodyDown(event) {
|
||||
if (! ( event.target.id == 'treeNode' || $(event.target).parents('#treeNode').length > 0)) {
|
||||
hideMenu();
|
||||
}
|
||||
}
|
||||
function showTree() {
|
||||
var p = $('#pName');
|
||||
var cityObj = p;
|
||||
var cityOffset = p.offset();
|
||||
var width = p.css('width');
|
||||
$('#treeNode').css({
|
||||
left: cityOffset.left + 'px',
|
||||
top: cityOffset.top + cityObj.outerHeight() + 'px',
|
||||
width: width,
|
||||
border: '1px solid #e6e6e6'
|
||||
}).slideDown('fast');
|
||||
$('body').bind('mousedown', onBodyDown);
|
||||
$('#treeNode').css('display', 'inline');
|
||||
}
|
||||
|
||||
function hideMenu() {
|
||||
$('#treeNode').fadeOut('fast');
|
||||
$('body').unbind('blur', onBodyDown);
|
||||
}
|
||||
|
||||
function onBodyDown(event) {
|
||||
if (!(event.target.id == 'treeNode' || $(event.target).parents('#treeNode').length > 0)) {
|
||||
hideMenu();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
|||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['<button class="layui-icon '+u+'" lay-type="sub">'+("updown"===n.anim?"":"")+"</button>",'<button class="layui-icon '+u+'" lay-type="add">'+("updown"===n.anim?"":"")+"</button>"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['<div class="'+c+'"><ul>',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("<li"+(n.index===e?' class="layui-this"':"")+"></li>")}),i.join("")}(),"</ul></div>"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a<n.index&&e.slide("sub",n.index-a)})},m.prototype.slide=function(e,i){var n=this,l=n.elemItem,u=n.config,c=u.index,m=u.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),l.eq(u.index).addClass(d),setTimeout(function(){l.eq(c).addClass(r),l.eq(u.index).addClass(r)},50)):(n.addIndex(i),l.eq(u.index).addClass(s),setTimeout(function(){l.eq(c).addClass(o),l.eq(u.index).addClass(o)},50)),setTimeout(function(){l.removeClass(a+" "+d+" "+s+" "+o+" "+r),l.eq(u.index).addClass(a),n.haveSlide=!1},300),n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a),n.haveSlide=!0,layui.event.call(this,t,"change("+m+")",{index:u.index,prevIndex:c,item:l.eq(u.index)}))},m.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){var i=new m(e);return i},e(t,n)});
|
|
@ -1,2 +0,0 @@
|
|||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('<ol class="layui-code-ol"><li>'+o.replace(/[\r\t\n]+/g,"</li><li>")+"</li></ol>"),c.find(">.layui-code-h3")[0]||c.prepend('<h3 class="layui-code-h3">'+(c.attr("lay-title")||e.title||"code")+(e.about?'<a href="'+l+'" target="_blank">layui.code</a>':"")+"</h3>");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss");
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
|||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon "></i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
|||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?'<a href="javascript:;" class="layui-laypage-prev'+(1==a.curr?" "+r:"")+'" data-page="'+(a.curr-1)+'">'+a.prev+"</a>":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push('<a href="javascript:;" class="layui-laypage-first" data-page="1" title="首页">'+(a.first||1)+"</a>");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r<t-1&&(r=u-t+1),a.first!==!1&&r>2&&e.push('<span class="layui-laypage-spr">…</span>');r<=u;r++)r===a.curr?e.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+(/^#/.test(a.theme)?'style="background-color:'+a.theme+';"':"")+"></em><em>"+r+"</em></span>"):e.push('<a href="javascript:;" data-page="'+r+'">'+r+"</a>");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1<a.pages&&e.push('<span class="layui-laypage-spr">…</span>'),0!==t&&e.push('<a href="javascript:;" class="layui-laypage-last" title="尾页" data-page="'+a.pages+'">'+(a.last||a.pages)+"</a>")),e.join("")}(),next:function(){return a.next?'<a href="javascript:;" class="layui-laypage-next'+(a.curr==a.pages?" "+r:"")+'" data-page="'+(a.curr+1)+'">'+a.next+"</a>":""}(),count:'<span class="layui-laypage-count">共 '+a.count+" 条</span>",limit:function(){var e=['<span class="layui-laypage-limits"><select lay-ignore>'];return layui.each(a.limits,function(t,n){e.push('<option value="'+n+'"'+(n===a.limit?"selected":"")+">"+n+" 条/页</option>")}),e.join("")+"</select></span>"}(),skip:function(){return['<span class="layui-laypage-skip">到第','<input type="text" min="1" value="'+a.curr+'" class="layui-input">','页<button type="button" class="layui-laypage-btn">确定</button>',"</span>"].join("")}()};return['<div class="layui-box layui-laypage layui-laypage-'+(a.theme?/^#/.test(a.theme)?"molv":a.theme:"default")+'" id="layui-laypage-'+a.index+'">',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"</div>"].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;o<y;o++)"a"===r[o].nodeName.toLowerCase()&&s.on(r[o],"click",function(){var e=0|this.getAttribute("data-page");e<1||e>i.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
!function(){"use strict";function e(r){var n="laypagecss";e.dir="dir"in e?e.dir:s.getpath+"/skin/laypage.css",new s(r),e.dir&&!t[a](n)&&s.use(e.dir,n)}e.v="1.3";var t=document,a="getElementById",r="getElementsByTagName",n=0,s=function(e){var t=this,a=t.config=e||{};a.item=n++,t.render(!0)};s.on=function(e,t,a){return e.attachEvent?e.attachEvent("on"+t,function(){a.call(e,window.even)}):e.addEventListener(t,a,!1),s},s.getpath=function(){var e=document.scripts,t=e[e.length-1].src;return t.substring(0,t.lastIndexOf("/")+1)}(),s.use=function(a,n){var s=t.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=e.dir,n&&(s.id=n),t[r]("head")[0].appendChild(s),s=null},s.prototype.type=function(){var e=this.config;return"object"==typeof e.cont?void 0===e.cont.length?2:3:void 0},s.prototype.view=function(){var t=this,a=t.config,r=[],n={};if(a.pages=0|a.pages,a.curr=0|a.curr||1,a.groups="groups"in a?0|a.groups:5,a.first="first"in a?a.first:"首页",a.last="last"in a?a.last:"尾页",a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页",a.pages<=1)return"";for(a.groups>a.pages&&(a.groups=a.pages),n.index=Math.ceil((a.curr+(a.groups>1&&a.groups!==a.pages?1:0))/(0===a.groups?1:a.groups)),a.curr>1&&a.prev&&r.push('<a href="javascript:;" class="laypage_prev" data-page="'+(a.curr-1)+'">'+a.prev+"</a>"),n.index>1&&a.first&&0!==a.groups&&r.push('<a href="javascript:;" class="laypage_first" data-page="1" title="首页">'+a.first+"</a><span>…</span>"),n.poor=Math.floor((a.groups-1)/2),n.start=n.index>1?a.curr-n.poor:1,n.end=n.index>1?function(){var e=a.curr+(a.groups-n.poor-1);return e>a.pages?a.pages:e}():a.groups,n.end-n.start<a.groups-1&&(n.start=n.end-a.groups+1);n.start<=n.end;n.start++)r.push(n.start===a.curr?'<span class="laypage_curr" '+(/^#/.test(a.skin)?'style="background-color:'+a.skin+'"':"")+">"+n.start+"</span>":'<a href="javascript:;" data-page="'+n.start+'">'+n.start+"</a>");return a.pages>a.groups&&n.end<a.pages&&a.last&&0!==a.groups&&r.push('<span>…</span><a href="javascript:;" class="laypage_last" title="尾页" data-page="'+a.pages+'">'+a.last+"</a>"),n.flow=!a.prev&&0===a.groups,(a.curr!==a.pages&&a.next||n.flow)&&r.push(function(){return n.flow&&a.curr===a.pages?'<span class="page_nomore" title="已没有更多">'+a.next+"</span>":'<a href="javascript:;" class="laypage_next" data-page="'+(a.curr+1)+'">'+a.next+"</a>"}()),'<div name="laypage'+e.v+'" class="laypage_main laypageskin_'+(a.skin?function(e){return/^#/.test(e)?"molv":e}(a.skin):"default")+'" id="laypage_'+t.config.item+'">'+r.join("")+function(){return a.skip?'<span class="laypage_total"><label>到第</label><input type="number" min="1" onkeyup="this.value=this.value.replace(/\\D/, \'\');" class="laypage_skip"><label>页</label><button type="button" class="laypage_btn">确定</button></span>':""}()+"</div>"},s.prototype.jump=function(e){if(e){for(var t=this,a=t.config,n=e.children,p=e[r]("button")[0],i=e[r]("input")[0],o=0,u=n.length;u>o;o++)"a"===n[o].nodeName.toLowerCase()&&s.on(n[o],"click",function(){var e=0|this.getAttribute("data-page");a.curr=e,t.render()});p&&s.on(p,"click",function(){var e=0|i.value.replace(/\s|\D/g,"");e&&e<=a.pages&&(a.curr=e,t.render())})}},s.prototype.render=function(e){var r=this,n=r.config,s=r.type(),p=r.view();2===s?n.cont.innerHTML=p:3===s?n.cont.html(p):t[a](n.cont).innerHTML=p,n.jump&&n.jump(n,e),r.jump(t[a]("laypage_"+n.item)),n.hash&&!e&&(location.hash="!"+n.hash+"="+n.curr)},"function"==typeof define?define(function(){return e}):"undefined"!=typeof exports?module.exports=e:window.laypage=e}();
|
|
@ -1 +0,0 @@
|
|||
layui.define(["layer","laypage","laytpl"],function(e){"use strict";function r(e){throw new Error(e)}var t=layui.jquery,a=void 0===parent.layui.layer?layui.layer:parent.layui.layer,n=layui.laytpl,i=function(){this.config={url:void 0,type:"POST",elem:void 0,params:{},openWait:!1,tempElem:void 0,tempType:0,paged:!0,pageConfig:{elem:void 0,pageSize:15},success:void 0,fail:function(e){a.msg(e,{icon:2})},complate:void 0,serverError:function(e){r("错误提示: "+e.status+" "+e.statusText)}}};i.prototype.v="1.0.2",i.prototype.set=function(e){var r=this;return t.extend(!0,r.config,e),r},i.prototype.init=function(e){var a=this;t.extend(!0,a.config,e);var n=a.config;if(void 0===n.url&&r("Paging Error:请配置远程URL!"),void 0===n.elem&&r("Paging Error:请配置参数elem!"),0===t(n.elem).length&&r("Paging Error:找不到配置的容器elem!"),0===n.tempType&&(void 0===n.tempElem&&r("Paging Error:请配置参数tempElem!"),0===t(n.tempElem).length&&r("Paging Error:找不到配置的容器tempElem!")),n.paged){var i=n.pageConfig;void 0===i.elem&&r("Paging Error:请配置参数pageConfig.elem!")}return"GET"!==n.type.toUpperCase()&&"POST"!==n.type.toUpperCase()&&r("Paging Error:type参数配置出错,只支持GET或都POST"),a.get({pageIndex:1,pageSize:n.pageConfig.pageSize}),a},i.prototype.get=function(e){var i=this,o=i.config,p=void 0;o.openWait&&(p=a.load(2));var g={pageIndex:1,pageSize:o.pageConfig.pageSize};t.extend(!0,o.params,g,e),t.ajax({type:o.type,url:o.url,data:o.params,dataType:"json",success:function(e){if(e.rel){var g=0===o.tempType?t(o.tempElem).html():o.tempElem;if(n(g).render(e,function(e){o.renderBefore?o.renderBefore(e,function(e){t(o.elem).html(e)}):t(o.elem).html(e)}),o.paged){if(null===e.count||0===e.count)return void r("Paging Error:请返回数据总数!");var l=o.pageConfig,u=l.pageSize,c=e.count%u==0?e.count/u:e.count/u+1,m={cont:t(l.elem),curr:o.params.pageIndex,pages:c,jump:function(e,r){var t=e.curr;r||i.get({pageIndex:t,pageSize:u})}};t.extend(m,l),layui.laypage(m)}o.success&&o.success()}else o.fail&&o.fail(e);o.complate&&o.complate(),void 0!==p&&a.close(p)},error:function(e,r,t){void 0!==p&&a.close(p),o.serverError(e,r,t)}})};var o=new i;e("paging",function(e){return o.set(e)})});
|
|
@ -1,3 +0,0 @@
|
|||
/*!
|
||||
laypage默认样式
|
||||
*/.laypage_main a,.laypage_main input,.laypage_main span{height:26px;line-height:26px}.laypage_main button,.laypage_main input,.laypageskin_default a{border:1px solid #ccc;background-color:#fff}.laypage_main{font-size:0;clear:both;color:#666}.laypage_main *{display:inline-block;vertical-align:top;font-size:12px}.laypage_main a{text-decoration:none;color:#666}.laypage_main a,.laypage_main span{margin:0 3px 6px;padding:0 10px}.laypage_main input{width:40px;margin:0 5px;padding:0 5px}.laypage_main button{height:28px;line-height:28px;margin-left:5px;padding:0 10px;color:#666}.laypageskin_default span{height:28px;line-height:28px;color:#999}.laypageskin_default .laypage_curr{font-weight:700;color:#666}.laypageskin_molv a,.laypageskin_molv span{padding:0 12px;border-radius:2px}.laypageskin_molv a{background-color:#f1eff0}.laypageskin_molv .laypage_curr{background-color:#00AA91;color:#fff}.laypageskin_molv input{height:24px;line-height:24px}.laypageskin_molv button{height:26px;line-height:26px}.laypageskin_yahei{color:#333}.laypageskin_yahei a,.laypageskin_yahei span{padding:0 13px;border-radius:2px;color:#333}.laypageskin_yahei .laypage_curr{background-color:#333;color:#fff}.laypageskin_flow{text-align:center}.laypageskin_flow .page_nomore{color:#999}
|
Loading…
Reference in New Issue