Compare commits

..

No commits in common. "67898cfc524fb2b1197095e1d39d0839d2a2fc78" and "c404534ea72f3a947e2dcec4c0b02b22ff219379" have entirely different histories.

17 changed files with 653 additions and 531 deletions

View File

@ -17,10 +17,12 @@
namespace app\admin\controller;
use think\admin\Controller;
use think\admin\extend\FaviconExtend;
use think\admin\service\AdminService;
use think\admin\service\ModuleService;
use think\admin\service\SystemService;
use think\admin\storage\AliossStorage;
use think\admin\storage\LocalStorage;
use think\admin\storage\QiniuStorage;
use think\admin\storage\TxcosStorage;

View File

@ -1,4 +1,4 @@
<form class="layui-form layui-card" data-table-id="RoleData" action="{:sysuri()}" data-auto="true" method="post">
<form class="layui-form layui-card" id="AuthForm" action="{:sysuri()}" data-auto="true" method="post" autocomplete="off">
<div class="layui-card-body padding-left-40">

View File

@ -1,4 +1,4 @@
<form class="layui-form layui-card" data-table-id="BaseData" action="{:sysuri()}" data-auto="true" method="post">
<form class="layui-form layui-card" action="{:sysuri()}" data-auto="true" method="post" autocomplete="off">
<div class="layui-card-body padding-left-40">

View File

@ -32,7 +32,7 @@
<div class="layui-form-item margin-bottom-5">
<div class="help-label"><b>登录背景图片</b>Background Image</div>
<div class="layui-textarea help-images">
<div class="layui-textarea think-bg-gray" style="min-height:unset;padding:10px 10px 3px 10px">
<input type="hidden" value="{:sysconf('login_image')}" name="login_image">
<script>$('[name=login_image]').uploadMultipleImage();</script>
</div>

View File

@ -1,4 +1,4 @@
<form class="layui-form layui-card" action="{:sysuri()}" data-table-id="UserData" data-auto="true" method="post">
<form class="layui-form layui-card" action="{:sysuri()}" id="UserForm" data-auto="true" method="post" autocomplete="off">
<div class="layui-card-body padding-left-40">
<fieldset>

View File

@ -53,9 +53,8 @@ window.tapiRoot = window.tapiRoot || window.appRoot + "admin";
layui.config({base: baseRoot + 'plugs/layui_exts/'});
/*! 挂载 layui & jquery 对象 */
window.form = layui.form, window.layer = layui.layer;
window.laytpl = layui.laytpl, window.laydate = layui.laydate;
window.jQuery = window.$ = window.jQuery || window.$ || layui.$;
if (typeof jQuery === 'undefined') window.$ = window.jQuery = layui.$;
window.form = layui.form, window.layer = layui.layer, window.laydate = layui.laydate;
/*! 配置 require 参数 */
require.config({
@ -118,7 +117,7 @@ $(function () {
temp = [], regx = new RegExp(/^{(.*?)}$/);
if (regx.test(rule[idx1]) && (field = rule[idx1].replace(regx, '$1'))) {
for (idx2 in json) if (json[idx2][field]) temp.push(json[idx2][field]);
if (temp.length < 1) return $.msg.tips('请选择需要更改的数据!'), false;
if (temp.length < 1) return $.msg.tips('请选择需要更改的数据!') , false;
data[idx1] = temp.join(',');
} else {
data[idx1] = rule[idx1];
@ -132,7 +131,7 @@ $(function () {
});
return array.length > 0 ? rule.replace('{key}', array.join(',')) : '';
})(elem.dataset.rule || '', []) || '';
if (value.length < 1) return $.msg.tips('请选择需要更改的数据!'), false;
if (value.length < 1) return $.msg.tips('请选择需要更改的数据!') , false;
return value.split(';').forEach(function (item) {
data[item.split('#')[0]] = item.split('#')[1];
}), data;
@ -220,14 +219,12 @@ $(function () {
this.selecter = '.layui-layout-admin>.layui-body>.think-page-body';
/*! 刷新当前页面 */
this.reload = function (force) {
if (force) top.location.reload();
else if (self !== top) location.reload();
else window.onhashchange.call(this);
force ? top.location.reload() : (self !== top ? location.reload() : window.onhashchange.call(this));
};
/*! 内容区域动态加载后初始化 */
this.reInit = function ($dom) {
layui.form.render(), layui.element.render();
$(window).trigger('scroll'), $.vali.listen(this), $dom = $dom || $(this.selecter);
layui.element.render(), layui.form.render();
$(window).trigger('scroll'), $.vali.listen(), $dom = $dom || $(this.selecter);
return $dom.find('[required]').map(function ($parent) {
if (($parent = $(this).parent()) && $parent.is('label')) {
$parent.addClass('label-required-prev');
@ -247,19 +244,15 @@ $(function () {
}
});
}), $dom.find('[data-lazy-src]:not([data-lazy-loaded])').each(function () {
if (this.dataset.lazyLoaded !== 'true') {
this.dataset.lazyLoaded = 'true';
if (this.nodeName === 'IMG') {
this.src = this.dataset.lazySrc;
} else {
this.style.backgroundImage = 'url(' + this.dataset.lazySrc + ')';
}
}
if (this.dataset.lazyLoaded === 'true') return;
this.dataset.lazyLoaded = 'true';
if (this.nodeName === 'IMG') this.src = this.dataset.lazySrc;
else this.style.backgroundImage = 'url(' + this.dataset.lazySrc + ')';
}), $dom;
};
/*! 在内容区显示视图 */
this.show = function (html) {
that.reInit($(this.selecter).html(html));
return that.reInit($(this.selecter).html(html));
};
/*! 异步加载的数据 */
this.load = function (url, data, method, callable, loading, tips, time, headers) {
@ -299,15 +292,15 @@ $(function () {
};
/*! 以 HASH 打开新网页 */
this.href = function (url, ele) {
// 重置表格页数缓存
if (ele && ele.dataset.menuNode) layui.sessionData('pages', null);
if (url !== '#') location.hash = $.menu.parseUri(url, ele);
else if (ele && ele.dataset.menuNode) $('[data-menu-node^="' + ele.dataset.menuNode + '-"]:first').trigger('click');
var isNode = ele && ele.dataset.menuNode;
isNode && layui.sessionData('pages', null);
if (url !== '#') return location.hash = $.menu.parseUri(url, ele);
isNode && $('[data-menu-node^="' + ele.dataset.menuNode + '-"]:first').trigger('click');
};
/*! 加载 HTML 到 BODY 位置 */
this.open = function (url, data, call, load, tips) {
this.load(url, data, 'get', function (ret) {
return (typeof ret === 'object' ? $.msg.auto(ret) : that.show(ret)), false;
return (typeof ret === 'object' ? $.msg.auto(ret) : that.show(ret)) , false;
}, load, tips);
};
/*! 打开 IFRAME 窗口 */
@ -317,7 +310,7 @@ $(function () {
/*! 加载 HTML 到弹出层 */
this.modal = function (url, data, name, call, load, tips, area, offset) {
this.load(url, data, 'GET', function (res) {
if (typeof res === 'object') return $.msg.auto(res), false;
if (typeof res === 'object') return $.msg.auto(res) , false;
return $.msg.mdx.push(layer.open({
type: 1, btn: false, area: area || "800px", resize: false, content: res, title: name || '', offset: offset || 'auto', success: function ($dom, idx) {
$.form.reInit($dom.off('click', '[data-close]').on('click', '[data-close]', function () {
@ -326,10 +319,9 @@ $(function () {
})(this.dataset.confirm, function () {
layer.close(idx);
});
}));
typeof call === 'function' && call.call(that, $dom);
})) && typeof call === 'function' && call.call(that, $dom);
}
})), false;
})) , false;
}, load, tips);
};
};
@ -431,7 +423,9 @@ $(function () {
window.onhashchange.call(this);
};
};
/*! 表单验证组件 */
/*! 注册对象到Jq */
$.vali = function (form, callable) {
return $(form).data('validate') || new Validate();
@ -470,13 +464,11 @@ $(function () {
return this.isRegex(input) ? (this.hideError(input), true) : this.remind(input);
}, this.remind = function (input) {
if (!$(input).is(':visible')) return true;
return this.showError(input, input.getAttribute('title') || input.getAttribute('placeholder') || '输入错误'), false;
return this.showError(input, input.getAttribute('title') || input.getAttribute('placeholder') || '输入错误') , false;
}, this.showError = function (ele, tip) {
$(ele).addClass('validate-error');
this.insertError(ele).addClass('layui-anim-fadein').css({width: 'auto'}).html(tip);
this.insertError($(ele).addClass('validate-error')).addClass('layui-anim-fadein').css({width: 'auto'}).html(tip);
}, this.hideError = function (ele) {
$(ele).removeClass('validate-error');
this.insertError(ele).removeClass('layui-anim-fadein').css({width: '30px'}).html('');
this.insertError($(ele).removeClass('validate-error')).removeClass('layui-anim-fadein').css({width: '30px'}).html('');
}, this.insertError = function (ele) {
if ($(ele).data('input-info')) return $(ele).data('input-info');
var $html = $('<span class="absolute block layui-anim text-center font-s12 notselect" style="color:#A44;z-index:2"></span>');
@ -485,7 +477,7 @@ $(function () {
return $(ele).data('input-info', $html.css(style).insertAfter(ele)), $html;
};
/*! 表单元素验证 */
this.form.attr({onsubmit: 'return false', novalidate: 'novalidate', autocomplete: 'off'});
this.form.attr({onsubmit: 'return false;', novalidate: 'novalidate', autocomplete: 'off'});
this.form.off(this.evts, this.tags).on(this.evts, this.tags, function () {
that.checkInput(this);
}).data('validate', this).bind("submit", function (evt) {
@ -502,7 +494,7 @@ $(function () {
that.form.removeAttr('submit-locked'), evt.button.removeClass('submit-button-loading');
}, 3000);
}
return evt.preventDefault(), false;
return evt.preventDefault() , false;
}).find('[data-form-loaded]').map(function () {
$(this).html(this.dataset.formLoaded || this.innerHTML);
$(this).removeAttr('data-form-loaded').removeClass('layui-disabled');
@ -510,7 +502,7 @@ $(function () {
}
};
/*! 自动监听表单 */
/*! 自动监听规则内表单 */
$.vali.listen = function () {
$('form[data-auto]').map(function (index, form) {
$(this).vali(function (data) {
@ -520,9 +512,9 @@ $(function () {
var call = window[form.dataset.callable || '_default_callable'] || (taid ? function (ret) {
if (typeof ret === 'object' && ret.code > 0 && $('#' + taid).size() > 0) {
return $.msg.success(ret.info, 3, function () {
(typeof ret.data === 'string' && ret.data) ? location.href = ret.data : $.layTable.reload(taid);
(typeof ret.data === 'string' && ret.data) ? location.href = ret.data : $('#' + taid).trigger('reload');
$.msg.close($.msg.mdx.length > 0 ? $.msg.mdx.pop() : null);
}), false;
}) , false;
}
} : undefined);
(function (confirm, callable) {
@ -659,74 +651,59 @@ $(function () {
}
this.focus();
});
};
}
/*! 组件 layui.table 封装 */
$.fn.layTable = function (params) {
return this.each(function () {
$.layTable.create(this, params);
});
};
$.layTable = new function () {
this.render = function (tabldId) {
return $('#' + tabldId).trigger('render');
}, this.reload = function (tabldId) {
return $('#' + tabldId).trigger('reload');
}, this.create = function (table, params) {
// 动态初始化表格
table.id = table.id || 't' + Math.random().toString().replace('.', '');
var $table = $(table).attr('lay-filter', table.dataset.id = table.getAttribute('lay-filter') || table.id);
return this.each(function (idx, elem) {
// 动态初始化数据表
this.id = this.id || 't' + Math.random().toString().replace('.', '');
this.setAttribute('lay-filter', this.dataset.id = this.getAttribute('lay-filter') || this.id);
// 插件初始化参数
var option = params || {}, data = option.where || {}, sort = option.initSort || option.sort || {};
option.id = table.id, option.elem = table, option.url = params.url || table.dataset.url || location.href;
option.page = params.page !== false ? (params.page || true) : false, option.limit = params.limit || 20;
option.loading = params.loading === true, option.autoSort = params.autoSort === true, option.cols = params.cols || [[]];
var opt = params || {}, data = opt.where || {}, sort = opt.initSort || opt.sort || {};
opt.id = elem.id, opt.elem = elem, opt.url = params.url || elem.dataset.url || location.href;
opt.page = params.page !== false ? (params.page || true) : false, opt.limit = params.limit || 20;
opt.loading = params.loading === true, opt.autoSort = params.autoSort === true, opt.cols = params.cols || [[]];
// 默认动态设置页数, 动态设置最大高度
if (option.page === true) option.page = {curr: layui.sessionData('pages')[option.id] || 1};
if (option.height === 'full') if ($table.parents('.iframe-pagination').size()) {
$table.parents('.iframe-pagination').addClass('not-footer');
option.height = $(window).height() - $table.removeClass('layui-hide').offset().top - 20;
if (opt.page === true) opt.page = {curr: layui.sessionData('pages')[opt.id] || 1}
if (opt.height === 'full') if ($(elem).parents('.iframe-pagination').size()) {
$(elem).parents('.iframe-pagination').addClass('not-footer');
opt.height = $(window).height() - $(elem).removeClass('layui-hide').offset().top - 20;
} else {
option.height = $(window).height() - $table.removeClass('layui-hide').offset().top - 35;
opt.height = $(window).height() - $(elem).removeClass('layui-hide').offset().top - 35;
}
// 动态计算最大页数
option.done = function () {
layui.sessionData('pages', {key: table.id, value: this.page.curr || 1}), (table.loading = true);
$table.next().find('[data-load],[data-queue],[data-action],[data-iframe]').not('[data-table-id]').attr('data-table-id', table.id);
}, option.parseData = function (res) {
var maxp = Math.ceil(res.count / table.limit), curp = layui.sessionData('pages')[option.id] || 1;
if (curp > maxp && curp > 1) table.elem.trigger('reload', {page: {curr: maxp}});
opt.done = function () {
layui.sessionData('pages', {key: elem.id, value: this.page.curr || 1}), (this.loading = true);
this.elem.next().find('[data-load],[data-queue],[data-action],[data-iframe]').not('[data-table-id]').attr('data-table-id', elem.id);
}, opt.parseData = function (res) {
var maxPage = Math.ceil(res.count / this.limit), curPage = layui.sessionData('pages')[opt.id] || 1;
if (curPage > maxPage && curPage > 1) this.elem.trigger('reload', {page: {curr: maxPage}});
};
// 实例并绑定的对象
$table.data('this', layui.table.render(bindData(option)));
$(this).data('this', layui.table.render(bindData(opt)));
// 绑定实例重载事件
$table.bind('reload render', function (evt, opts) {
$(this).bind('reload', function (evt, opts) {
opts = opts || {}, opts.loading = true;
data = $.extend({}, data, opts.where || {});
if (evt.type === 'render') {
layui.table.reload(table.id, bindData(opts || {}));
} else {
layui.table.reload(table.id, bindData(opts || {}));
// layui.table.reloadData(table.id, bindData(opts || {}));
}
layui.table.reload(elem.id, bindData(opts || {}));
}).bind('row sort tool edit radio toolbar checkbox rowDouble', function (evt, call) {
layui.table.on(evt.type + '(' + table.dataset.id + ')', call)
layui.table.on(evt.type + '(' + elem.dataset.id + ')', call)
}).bind('setFullHeight', function () {
$table.trigger('render', {height: $(window).height() - $table.next().offset().top - 35})
}).trigger('sort', function (rets) {
(sort = rets), $table.trigger('reload')
$(elem).trigger('reload', {height: $(window).height() - $(elem).next().offset().top - 35})
}).trigger('sort', function (object) {
(sort = object), $(elem).trigger('reload')
});
// 搜索表单关联对象
var search = params.search || table.dataset.targetSearch;
var search = params.search || this.dataset.targetSearch;
if (search) $body.find(search).map(function () {
$(this).attr('data-table-id', table.id);
$(this).attr('data-table-id', elem.id);
});
// 绑定选择项关联对象
var checked = params.checked || table.dataset.targetChecked;
var checked = params.checked || this.dataset.targetChecked;
if (checked) $body.find(checked).map(function () {
$(this).attr('data-table-id', table.id);
$(this).attr('data-table-id', elem.id);
});
return $table;
// 生成初始化参数
function bindData(options) {
@ -738,17 +715,17 @@ $(function () {
if (options.page === false) options.limit = '';
return (options['where'] = data), options;
}
};
};
});
}
/*! 弹出图片层 */
$.previewImage = function (src, area) {
var img = new Image(), defer = $.Deferred(), loaded = $.msg.loading();
img.style.background = '#FFF', img.referrerPolicy = 'no-referrer';
img.style.height = 'auto', img.style.width = area || '100%', img.style.display = 'none';
return document.body.appendChild(img), img.onerror = function () {
document.body.appendChild(img), img.onerror = function () {
$.msg.close(loaded), defer.reject();
}, img.src = src, img.onload = function () {
}, img.onload = function () {
layer.open({
type: 1, title: false, shadeClose: true, content: $(img), success: function ($elem, idx) {
$.msg.close(loaded), defer.notify($elem, idx);
@ -756,7 +733,8 @@ $(function () {
document.body.removeChild(img), defer.resolve()
}
});
}, defer.promise();
};
return (img.src = src), defer.resolve();
};
/*! 以手机模式显示内容 */
@ -768,12 +746,12 @@ $(function () {
/*! 显示任务进度消息 */
$.loadQueue = function (code, doScript, element) {
var doAjax = true, doReload = false;
layui.layer.open({
layer.open({
type: 1, title: false, area: ['560px', '315px'], anim: 2, shadeClose: false, end: function () {
doAjax = false;
if (doReload && doScript) {
if (element && element.dataset && element.dataset.tableId) {
$.layTable.reload(element.dataset.tableId);
$('#' + element.dataset.tableId).trigger('reload');
} else {
$.form.reload();
}
@ -827,7 +805,7 @@ $(function () {
that.$percent.attr('lay-percent', (parseFloat(ret.data.progress || '0.00').toFixed(2)) + '%'), layui.element.render();
that.$coder.html('<p class="layui-elip">' + lines.join('</p><p class="layui-elip">') + '</p>').animate({scrollTop: that.$coder[0].scrollHeight + 'px'}, 200);
return parseInt(ret.data.status) === 3 || parseInt(ret.data.status) === 4 || setTimeout(that.LoadProgress, Math.floor(Math.random() * 200)), false;
} else return setTimeout(that.LoadProgress, Math.floor(Math.random() * 500) + 200), false;
} else return setTimeout(that.LoadProgress, Math.floor(Math.random() * 500) + 200) , false;
}
}, false);
})();
@ -867,17 +845,17 @@ $(function () {
(function (confirm, callable) {
confirm ? $.msg.confirm(confirm, callable) : callable();
})(emap.confirm, function () {
$.form.load(emap.load, data, 'get', emap.tableId ? function (ret) {
$.form.load(emap.load, data, 'get', !emap.tableId ? false : function (ret) {
if (ret.code > 0) return $.msg.success(ret.info, 3, function () {
$.layTable.reload(emap.tableId);
}), false;
} : false, true, emap.tips, emap.time);
$('#' + emap.tableId).trigger('reload');
}) , false;
}, true, emap.tips, emap.time);
});
});
/*! 注册 data-reload 事件行为 */
onEvent('click', '[data-reload]', function () {
this.dataset.tableId ? $.layTable.reload(this.dataset.tableId) : $.form.reload();
this.dataset.tableId ? $('#' + this.dataset.tableId).trigger('reload') : $.form.reload();
});
/*! 注册 data-dbclick 事件行为 */
@ -911,7 +889,7 @@ $(function () {
confirm ? $.msg.confirm(confirm, callable) : callable();
})(emap.confirm, function () {
$.form.load(emap.actionBlur || emap.blurAction, data, emap.method || 'post', function (ret) {
return that.css('border', (ret && ret.code) ? '1px solid #e6e6e6' : '1px solid red'), false;
return that.css('border', (ret && ret.code) ? '1px solid #e6e6e6' : '1px solid red') , false;
}, emap.loading !== 'false', emap.loading, emap.time)
});
});
@ -940,11 +918,12 @@ $(function () {
(function (confirm, callable) {
confirm ? $.msg.confirm(confirm, callable) : callable();
})(emap.confirm, function () {
$.form.load(emap.action, data, emap.method || 'post', emap.tableId ? function (ret) {
var call = !emap.tableId ? false : function (ret) {
if (ret.code > 0) return $.msg.success(ret.info, 3, function () {
$.layTable.reload(emap.tableId);
}), false;
} : false, load, tips, emap.time)
$('#' + emap.tableId).trigger('reload');
}) , false;
}
$.form.load(emap.action, data, emap.method || 'post', call, load, tips, emap.time)
});
});
@ -963,7 +942,7 @@ $(function () {
var area = emap.area || [emap.width || '800px', emap.height || '580px'];
var frame = emap.iframe + (emap.iframe.indexOf('?') > -1 ? '&' : '?') + $.param(data);
$(this).attr('data-index', $.form.iframe(frame, name, area, emap.offset || 'auto', emap.tableId ? function () {
typeof emap.refresh !== 'undefined' && $.layTable.reload(emap.tableId);
typeof emap.refresh !== 'undefined' && $('#' + emap.tableId).trigger('reload');
} : function () {
typeof emap.refresh !== 'undefined' && $.form.reload();
}));
@ -980,8 +959,8 @@ $(function () {
(function (content, $textarea) {
$body.append($textarea.val(content)), $textarea.select();
document.execCommand('Copy') ? $.msg.tips('已复制到剪贴板!') : $.msg.tips('请使用鼠标操作复制!');
$textarea.remove();
})(this.dataset.copy, $('<textarea readonly style="position:fixed;top:-500px"></textarea>'));
$textarea.remove(), $textarea.unselect();
})(this.dataset.copy, $('<textarea style="position:fixed;top:-500px"></textarea>'));
});
/*! 异步任务状态监听与展示 */
@ -992,7 +971,7 @@ $(function () {
})(this.dataset.confirm, function () {
$.form.load(that.dataset.queue, {}, 'post', function (ret) {
if (typeof ret.data === 'string' && ret.data.indexOf('Q') === 0) {
return $.loadQueue(ret.data, true, that), false;
return $.loadQueue(ret.data, true, that) , false;
}
});
});
@ -1003,7 +982,7 @@ $(function () {
var opts = {tips: [$(this).attr('data-tips-type') || 3, '#78BA32'], time: 0};
var layidx = layer.tips($(this).attr('data-tips-text') || this.innerText, this, opts);
$(this).off('mouseleave').on('mouseleave', function () {
setTimeout("layui.layer.close('" + layidx + "')", 100);
setTimeout("layer.close('" + layidx + "')", 100);
});
});
@ -1014,7 +993,7 @@ $(function () {
img.layopt = {time: 0, skin: 'layui-layer-image', anim: 5, isOutAnim: false, scrollbar: false};
img.referrerPolicy = 'no-referrer', img.style.maxWidth = '260px', img.style.maxHeight = '260px';
ele.data('layidx', layer.tips(img.outerHTML, this, img.layopt)).off('mouseleave').on('mouseleave', function () {
layui.layer.close(ele.data('layidx'));
layer.close(ele.data('layidx'));
});
}
});

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

Before

Width:  |  Height:  |  Size: 309 KiB

After

Width:  |  Height:  |  Size: 299 KiB

File diff suppressed because one or more lines are too long

View File

@ -149,32 +149,6 @@ fieldset {
}
}
.layui-select {
appearance: revert;
-moz-appearance: revert;
-webkit-appearance: revert;
}
div.layui-textarea.help-images {
min-height: unset;
color: #333;
padding: 12px 0 1px 12px;
background: linear-gradient(-113deg, #EEEEEE, #EEEEEE) !important;
&:after {
clear: both;
content: '';
display: block;
}
> * {
float: left;
width: 78px;
height: 78px;
margin: 0 10px 10px 0;
}
}
.layui-disabled,
.layui-disabled:hover {
color: #333 !important;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long