diff --git a/config/app.php b/config/app.php index 23312cf69..b41cbd72b 100644 --- a/config/app.php +++ b/config/app.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- @@ -31,9 +31,13 @@ return [ 'domain_bind' => [], // 禁止访问(自动多应用模式有效) 'deny_app_list' => [], - // CORS 自动配置跨域 - 'cors_auto' => true, - // CORS 配置跨域域名 + // RBAC 登录地址(填写登录地址) + 'rbac_login' => '', + // RBAC 忽略应用(填写应用名称) + 'rbac_ignore' => ['index'], + // CORS 启用状态(默认开启跨域) + 'cors_on' => true, + // CORS 配置跨域域名(仅需填写域名,留空则自适应域名) 'cors_host' => [], // CORS 授权请求方法 'cors_methods' => 'GET,PUT,POST,PATCH,DELETE', diff --git a/config/cache.php b/config/cache.php index 42eccd226..f8ba0ebcc 100644 --- a/config/cache.php +++ b/config/cache.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/config/cookie.php b/config/cookie.php index 36c286618..49b9ca0bd 100644 --- a/config/cookie.php +++ b/config/cookie.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/config/lang.php b/config/lang.php index 3922deeb4..5c6d5c636 100644 --- a/config/lang.php +++ b/config/lang.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/config/log.php b/config/log.php index 9f542f05c..01be75c29 100644 --- a/config/log.php +++ b/config/log.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/config/phinx.php b/config/phinx.php index a91394f61..58800922d 100644 --- a/config/phinx.php +++ b/config/phinx.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/config/route.php b/config/route.php index cde216b91..76e629b54 100644 --- a/config/route.php +++ b/config/route.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/config/session.php b/config/session.php index 6040541aa..1eb540994 100644 --- a/config/session.php +++ b/config/session.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/config/view.php b/config/view.php index 88847cada..1f432caa5 100644 --- a/config/view.php +++ b/config/view.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/index.php b/public/index.php index 7a996a840..4786f0050 100644 --- a/public/index.php +++ b/public/index.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/router.php b/public/router.php index 78e44847d..33e5b7517 100644 --- a/public/router.php +++ b/public/router.php @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/admin.js b/public/static/admin.js index 4b28aa325..902be0bc1 100644 --- a/public/static/admin.js +++ b/public/static/admin.js @@ -1,7 +1,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- @@ -84,8 +84,7 @@ define('ckeditor', (function (type) { return ckeditor; }); -/*! 注册 ThinkAdmin 组件 */ -define('ThinkAdmin', function (require) { +$(function () { window.$body = $('body'); @@ -173,7 +172,7 @@ define('ThinkAdmin', function (require) { this.close = function (idx) { if (idx !== null) return layer.close(idx); for (var i in this.idx) $.msg.close(this.idx[i]); - this.idx = []; + return (this.idx = []) !== false; }; /*! 弹出警告框 */ this.alert = function (msg, call) { @@ -258,8 +257,11 @@ define('ThinkAdmin', function (require) { }; /*! 内容区域动态加载后初始化 */ this.reInit = function ($dom) { + $dom = $dom || $(this.selecter); layui.form.render(), layui.element.render(), $(window).trigger('scroll'); - $.vali.listen($dom = $dom || $(this.selecter)), $body.trigger('reInit', $dom); + require(['ThinkAdmin'], function () { + $.vali.listen($dom) && $body.trigger('reInit', $dom); + }); return $dom.find('[required]').map(function () { this.$parent = $(this).parent(); if (this.$parent.is('label')) this.$parent.addClass('label-required-prev'); else this.$parent.prevAll('label.layui-form-label').addClass('label-required-next'); @@ -463,41 +465,6 @@ define('ThinkAdmin', function (require) { }; }; - /*! 表单验证组件 */ - $.vali = function (form, callable) { - return $(form).data('validate') || new (require('validate'))(form, callable, onConfirm); - }; - - /*! 自动监听表单 */ - $.vali.listen = function ($dom, $els) { - $els = $($dom || $body).find('form[data-auto]'); - $dom && $($dom).filter('form[data-auto]') && $els.add($dom); - $els.size() > 0 && $els.map(function (idx, form) { - $(this).vali(function (data) { - var dset = form.dataset, type = form.method || 'POST', href = form.action || location.href; - var tips = dset.tips || undefined, time = dset.time || undefined, taid = dset.tableId || false; - var call = window[dset.callable || '_default_callable'] || (taid ? function (ret) { - if (typeof ret === 'object' && ret.code > 0 && $('#' + taid).size() > 0) { - return $.msg.success(ret.info, 3, function () { - $.msg.closeLastModal(); - (typeof ret.data === 'string' && ret.data) ? $.form.goto(ret.data) : $.layTable.reload(taid); - }) && false; - } - } : undefined); - onConfirm(dset.confirm, function () { - $.form.load(href, data, type, call, true, tips, time); - }); - }); - }); - }; - - /*! 注册对象到JqFn */ - $.fn.vali = function (callable) { - return this.each(function () { - $.vali(this, callable); - }); - }; - /*! 表单转JSON */ $.fn.formToJson = function () { var self = this, data = {}, push = {}; @@ -754,13 +721,13 @@ define('ThinkAdmin', function (require) { 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 () { - $.msg.close(loaded), defer.reject(); + $.msg.close(loaded) && defer.reject(); }, img.src = src, img.onload = function () { layer.open({ type: 1, title: false, shadeClose: true, content: $(img), success: function ($elem, idx) { - $.msg.close(loaded), defer.notify($elem, idx); + $.msg.close(loaded) && defer.notify($elem, idx); }, area: area || '480px', skin: 'layui-layer-nobg', closeBtn: 1, end: function () { - document.body.removeChild(img), defer.resolve() + document.body.removeChild(img) && defer.resolve() } }); }, defer.promise(); @@ -772,226 +739,263 @@ define('ThinkAdmin', function (require) { layer.style(layer.open({type: true, resize: false, scrollbar: false, area: ['320px', '600px'], title: false, closeBtn: true, shadeClose: false, skin: 'layui-layer-nobg', content: laytpl(template).render({title: title || '公众号', url: href})}), {boxShadow: 'none'}); }; - /*! 显示任务进度消息 */ - $.loadQueue = function (code, doScript, element) { - require(['queue'], function (Queue) { - new Queue(code, doScript, element); + /*! 注册 ThinkAdmin 组件及标签行为 */ + define('ThinkAdmin', ['require', 'queue', 'validate'], function (require, Queue, Validate) { + + /*! 显示任务进度 */ + $.loadQueue = function (code, doScript, element) { + return new Queue(code, doScript, element); + }; + + /*! 创建表单验证 */ + $.vali = function (form, callable) { + return $(form).data('validate') || new Validate(form, callable, onConfirm); + }; + + /*! 自动监听表单 */ + $.vali.listen = function ($dom) { + var $els = $($dom || $body).find('form[data-auto]'); + $dom && $($dom).filter('form[data-auto]') && $els.add($dom); + return $els.map(function (idx, form) { + $(this).vali(function (data) { + var dset = form.dataset, type = form.method || 'POST', href = form.action || location.href; + var tips = dset.tips || undefined, time = dset.time || undefined, taid = dset.tableId || false; + var call = window[dset.callable || '_default_callable'] || (taid ? function (ret) { + if (typeof ret === 'object' && ret.code > 0 && $('#' + taid).size() > 0) { + return $.msg.success(ret.info, 3, function () { + $.msg.closeLastModal(); + (typeof ret.data === 'string' && ret.data) ? $.form.goto(ret.data) : $.layTable.reload(taid); + }) && false; + } + } : undefined); + onConfirm(dset.confirm, function () { + $.form.load(href, data, type, call, true, tips, time); + }); + }); + }); + }; + + /*! 注册对象到JqFn */ + $.fn.vali = function (callable) { + return this.each(function () { + $.vali(this, callable); + }); + }; + + /*! 注册 data-search 表单搜索行为 */ + onEvent('submit', 'form.form-search', function () { + if (this.dataset.tableId) return $('table#' + this.dataset.tableId).trigger('reload', { + page: {curr: 1}, where: $(this).formToJson() + }); + var url = $(this).attr('action').replace(/&?page=\d+/g, ''); + if ((this.method || 'get').toLowerCase() === 'get') { + var split = url.indexOf('?') > -1 ? '&' : '?', stype = location.href.indexOf('spm=') > -1 ? '#' : ''; + $.form.goto(stype + $.menu.parseUri(url + split + $(this).serialize().replace(/\+/g, ' '))); + } else { + $.form.load(url, this, 'post'); + } }); - }; - /*! 注册 data-search 表单搜索行为 */ - onEvent('submit', 'form.form-search', function () { - if (this.dataset.tableId) return $('table#' + this.dataset.tableId).trigger('reload', { - page: {curr: 1}, where: $(this).formToJson() + /*! 注册 data-file 事件行为 */ + onEvent('click', '[data-file]', function () { + this.id = this.dataset.id = this.id || (function (date) { + return (date + Math.random()).replace('0.', ''); + })(layui.util.toDateString(Date.now(), 'yyyyMMddHHmmss-')); + /*! 查找表单元素, 如果没有找到将不会自动写值 */ + if (!(this.$elem = $(this)).data('input') && this.$elem.data('field')) { + var $input = $('input[name="' + this.$elem.data('field') + '"]:not([type=file])'); + this.$elem.data('input', $input.size() > 0 ? $input.get(0) : null); + } + // 单图或多图选择器 ( image|images ) + if (typeof this.dataset.file === 'string' && /^images?$/.test(this.dataset.file)) { + return $.form.modal(tapiRoot + '/api.upload/image', this.dataset, '图片选择器') + } + // 其他文件上传处理 + this.dataset.inited || $(this).uploadFile(undefined, function () { + $(this).trigger('upload.start'); + }); }); - var url = $(this).attr('action').replace(/&?page=\d+/g, ''); - if ((this.method || 'get').toLowerCase() === 'get') { - var split = url.indexOf('?') > -1 ? '&' : '?', stype = location.href.indexOf('spm=') > -1 ? '#' : ''; - $.form.goto(stype + $.menu.parseUri(url + split + $(this).serialize().replace(/\+/g, ' '))); - } else { - $.form.load(url, this, 'post'); - } - }); - /*! 注册 data-file 事件行为 */ - onEvent('click', '[data-file]', function () { - this.id = this.dataset.id = this.id || (function (date) { - return (date + Math.random()).replace('0.', ''); - })(layui.util.toDateString(Date.now(), 'yyyyMMddHHmmss-')); - /*! 查找表单元素, 如果没有找到将不会自动写值 */ - if (!(this.$elem = $(this)).data('input') && this.$elem.data('field')) { - var $input = $('input[name="' + this.$elem.data('field') + '"]:not([type=file])'); - this.$elem.data('input', $input.size() > 0 ? $input.get(0) : null); - } - // 单图或多图选择器 ( image|images ) - if (typeof this.dataset.file === 'string' && /^images?$/.test(this.dataset.file)) { - return $.form.modal(tapiRoot + '/api.upload/image', this.dataset, '图片选择器') - } - // 其他文件上传处理 - this.dataset.inited || $(this).uploadFile(undefined, function () { - $(this).trigger('upload.start'); + /*! 注册 data-load 事件行为 */ + onEvent('click', '[data-load]', function () { + applyRuleValue(this, {}, function (data, elem, dset) { + $.form.load(dset.load, data, 'get', onConfirm.getLoadCallable(dset.tableId), true, dset.tips, dset.time); + }); }); - }); - /*! 注册 data-load 事件行为 */ - onEvent('click', '[data-load]', function () { - applyRuleValue(this, {}, function (data, elem, dset) { - $.form.load(dset.load, data, 'get', onConfirm.getLoadCallable(dset.tableId), true, dset.tips, dset.time); + /*! 注册 data-reload 事件行为 */ + onEvent('click', '[data-reload]', function () { + $.layTable.reload(this.dataset.tableId || true); }); - }); - /*! 注册 data-reload 事件行为 */ - onEvent('click', '[data-reload]', function () { - $.layTable.reload(this.dataset.tableId || true); - }); - - /*! 注册 data-dbclick 事件行为 */ - onEvent('dblclick', '[data-dbclick]', function () { - $(this).find(this.dataset.dbclick || '[data-dbclick]').trigger('click'); - }); - - /*! 注册 data-check 事件行为 */ - onEvent('click', '[data-check-target]', function () { - var target = this; - $(this.dataset.checkTarget).map(function () { - (this.checked = !!target.checked), $(this).trigger('change'); + /*! 注册 data-dbclick 事件行为 */ + onEvent('dblclick', '[data-dbclick]', function () { + $(this).find(this.dataset.dbclick || '[data-dbclick]').trigger('click'); }); - }); - /*! 表单元素失去焦点时数字 */ - onEvent('blur', '[data-blur-number]', function () { - var dset = this.dataset, min = dset.valueMin, max = dset.valueMax; - var value = parseFloat(this.value) || 0, fiexd = parseInt(dset.blurNumber || 0); - if (typeof min !== 'undefined' && value < min) value = min; - if (typeof max !== 'undefined' && value > max) value = max; - this.value = parseFloat(value).toFixed(fiexd); - }); - - /*! 表单元素失焦时提交 */ - onEvent('blur', '[data-action-blur],[data-blur-action]', function () { - var that = $(this), dset = this.dataset, data = {'_token_': dset.token || dset.csrf || '--'}; - var attrs = (dset.value || '').replace('{value}', that.val()).split(';'); - for (var i in attrs) data[attrs[i].split('#')[0]] = attrs[i].split('#')[1]; - onConfirm(dset.confirm, function () { - $.form.load(dset.actionBlur || dset.blurAction, data, dset.method || 'post', function (ret) { - return that.css('border', (ret && ret.code) ? '1px solid #e6e6e6' : '1px solid red') && false; - }, dset.loading !== 'false', dset.loading, dset.time); + /*! 注册 data-check 事件行为 */ + onEvent('click', '[data-check-target]', function () { + var target = this; + $(this.dataset.checkTarget).map(function () { + (this.checked = !!target.checked), $(this).trigger('change'); + }); }); - }); - /*! 注册 data-href 事件行为 */ - onEvent('click', '[data-href]', function () { - if (this.dataset.href && this.dataset.href.indexOf('#') !== 0) { - $.form.goto(this.dataset.href); - } - }); - - /*! 注册 data-open 事件行为 */ - onEvent('click', '[data-open]', function () { - if (this.dataset.open.match(/^https?:/)) { - $.form.goto(this.dataset.open); - } else { - $.form.href(this.dataset.open, this); - } - }); - - /*! 注册 data-action 事件行为 */ - onEvent('click', '[data-action]', function () { - applyRuleValue(this, {}, function (data, elem, dset) { - Object.assign(data, {'_token_': dset.token || dset.csrf || '--'}) - var load = dset.loading !== 'false', tips = typeof load === 'string' ? load : undefined; - $.form.load(dset.action, data, dset.method || 'post', onConfirm.getLoadCallable(dset.tableId), load, tips, dset.time) + /*! 表单元素失去焦点时数字 */ + onEvent('blur', '[data-blur-number]', function () { + var dset = this.dataset, min = dset.valueMin, max = dset.valueMax; + var value = parseFloat(this.value) || 0, fiexd = parseInt(dset.blurNumber || 0); + if (typeof min !== 'undefined' && value < min) value = min; + if (typeof max !== 'undefined' && value > max) value = max; + this.value = parseFloat(value).toFixed(fiexd); }); - }); - /*! 注册 data-modal 事件行为 */ - onEvent('click', '[data-modal]', function () { - applyRuleValue(this, {open_type: 'modal'}, function (data, elem, dset) { - return $.form.modal(dset.modal, data, dset.title || this.innerText || '编辑', undefined, undefined, undefined, dset.area || dset.width || '800px', dset.offset || 'auto', dset.full !== undefined); + /*! 表单元素失焦时提交 */ + onEvent('blur', '[data-action-blur],[data-blur-action]', function () { + var that = $(this), dset = this.dataset, data = {'_token_': dset.token || dset.csrf || '--'}; + var attrs = (dset.value || '').replace('{value}', that.val()).split(';'); + for (var i in attrs) data[attrs[i].split('#')[0]] = attrs[i].split('#')[1]; + onConfirm(dset.confirm, function () { + $.form.load(dset.actionBlur || dset.blurAction, data, dset.method || 'post', function (ret) { + return that.css('border', (ret && ret.code) ? '1px solid #e6e6e6' : '1px solid red') && false; + }, dset.loading !== 'false', dset.loading, dset.time); + }); }); - }); - /*! 注册 data-iframe 事件行为 */ - onEvent('click', '[data-iframe]', function () { - applyRuleValue(this, {open_type: 'iframe'}, function (data, elem, dset) { - var name = dset.title || this.innerText || 'IFRAME 窗口'; - var area = dset.area || [dset.width || '800px', dset.height || '580px']; - var frame = dset.iframe + (dset.iframe.indexOf('?') > -1 ? '&' : '?') + $.param(data); - $(this).attr('data-index', $.form.iframe(frame + '&' + $.param(data), name, area, dset.offset || 'auto', function () { - typeof dset.refresh !== 'undefined' && $.layTable.reload(dset.tableId || true); - }, undefined, dset.full !== undefined)); - }) - }); + /*! 注册 data-href 事件行为 */ + onEvent('click', '[data-href]', function () { + if (this.dataset.href && this.dataset.href.indexOf('#') !== 0) { + $.form.goto(this.dataset.href); + } + }); - /*! 注册 data-icon 事件行为 */ - onEvent('click', '[data-icon]', function () { - var location = tapiRoot + '/api.plugs/icon', field = this.dataset.icon || this.dataset.field || 'icon'; - $.form.iframe(location + (location.indexOf('?') > -1 ? '&' : '?') + 'field=' + field, '图标选择', ['900px', '700px']); - }); + /*! 注册 data-open 事件行为 */ + onEvent('click', '[data-open]', function () { + if (this.dataset.open.match(/^https?:/)) { + $.form.goto(this.dataset.open); + } else { + $.form.href(this.dataset.open, this); + } + }); - /*! 注册 data-copy 事件行为 */ - onEvent('click', '[data-copy]', function () { - var copy = this.dataset.copy || this.innerText; - if (window.clipboardData) { - window.clipboardData.setData('text', copy); - $.msg.tips('已复制到剪贴板!'); - } else { - var $input = $(''); - $input.css({position: 'fixed', top: '-500px'}).appendTo($body).val(copy).select(); - $.msg.tips(document.execCommand('Copy') ? '已复制到剪贴板!' : '请使用鼠标操作复制!') && $input.remove(); - } - }); + /*! 注册 data-action 事件行为 */ + onEvent('click', '[data-action]', function () { + applyRuleValue(this, {}, function (data, elem, dset) { + Object.assign(data, {'_token_': dset.token || dset.csrf || '--'}) + var load = dset.loading !== 'false', tips = typeof load === 'string' ? load : undefined; + $.form.load(dset.action, data, dset.method || 'post', onConfirm.getLoadCallable(dset.tableId), load, tips, dset.time) + }); + }); - /*! 异步任务状态监听与展示 */ - onEvent('click', '[data-queue]', function () { - applyRuleValue(this, {}, function (data, elem, dset) { - $.form.load(dset.queue, data, 'post', function (ret) { - if (typeof ret.data === 'string' && ret.data.indexOf('Q') === 0) { - return $.loadQueue(ret.data, true, elem), false; + /*! 注册 data-modal 事件行为 */ + onEvent('click', '[data-modal]', function () { + applyRuleValue(this, {open_type: 'modal'}, function (data, elem, dset) { + return $.form.modal(dset.modal, data, dset.title || this.innerText || '编辑', undefined, undefined, undefined, dset.area || dset.width || '800px', dset.offset || 'auto', dset.full !== undefined); + }); + }); + + /*! 注册 data-iframe 事件行为 */ + onEvent('click', '[data-iframe]', function () { + applyRuleValue(this, {open_type: 'iframe'}, function (data, elem, dset) { + var name = dset.title || this.innerText || 'IFRAME 窗口'; + var area = dset.area || [dset.width || '800px', dset.height || '580px']; + var frame = dset.iframe + (dset.iframe.indexOf('?') > -1 ? '&' : '?') + $.param(data); + $(this).attr('data-index', $.form.iframe(frame + '&' + $.param(data), name, area, dset.offset || 'auto', function () { + typeof dset.refresh !== 'undefined' && $.layTable.reload(dset.tableId || true); + }, undefined, dset.full !== undefined)); + }) + }); + + /*! 注册 data-icon 事件行为 */ + onEvent('click', '[data-icon]', function () { + var location = tapiRoot + '/api.plugs/icon', field = this.dataset.icon || this.dataset.field || 'icon'; + $.form.iframe(location + (location.indexOf('?') > -1 ? '&' : '?') + 'field=' + field, '图标选择', ['900px', '700px']); + }); + + /*! 注册 data-copy 事件行为 */ + onEvent('click', '[data-copy]', function () { + var copy = this.dataset.copy || this.innerText; + if (window.clipboardData) { + window.clipboardData.setData('text', copy); + $.msg.tips('已复制到剪贴板!'); + } else { + var $input = $(''); + $input.css({position: 'fixed', top: '-500px'}).appendTo($body).val(copy).select(); + $.msg.tips(document.execCommand('Copy') ? '已复制到剪贴板!' : '请使用鼠标操作复制!') && $input.remove(); + } + }); + + /*! 异步任务状态监听与展示 */ + onEvent('click', '[data-queue]', function () { + applyRuleValue(this, {}, function (data, elem, dset) { + $.form.load(dset.queue, data, 'post', function (ret) { + if (typeof ret.data === 'string' && ret.data.indexOf('Q') === 0) { + return $.loadQueue(ret.data, true, elem), false; + } + }); + }); + }); + + /*! 注册 data-tips-text 事件行为 */ + onEvent('mouseenter', '[data-tips-text]', 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("layer.close('" + layidx + "')", 100); + }); + }); + + /*! 注册 data-tips-hover 事件行为 */ + onEvent('mouseenter', '[data-tips-image][data-tips-hover]', function () { + var img = new Image(), ele = $(this); + if ((img.src = this.dataset.tipsImage || this.dataset.lazySrc || this.src)) { + img.layopt = {anim: 5, time: 0, skin: 'layui-layer-image', 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 () { + layer.close(ele.data('layidx')); + }); + } + }); + + /*! 注册 data-tips-image 事件行为 */ + onEvent('click', '[data-tips-image]', function (event) { + (event.items = [], event.$imgs = $(this).parent().find('[data-tips-image]')).map(function () { + event.items.push({src: this.dataset.tipsImage || this.dataset.lazySrc || this.src}); + }) && layer.photos({ + anim: 5, closeBtn: 1, photos: {start: event.$imgs.index(this), data: event.items}, tab: function (pic, $ele) { + $ele.find('img').attr('referrerpolicy', 'no-referrer'); + $ele.find('.layui-layer-close').css({top: '20px', right: '20px', position: 'fixed'}); } }); }); - }); - /*! 注册 data-tips-text 事件行为 */ - onEvent('mouseenter', '[data-tips-text]', 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("layer.close('" + layidx + "')", 100); + /*! 注册 data-phone-view 事件行为 */ + onEvent('click', '[data-phone-view]', function () { + $.previewPhonePage(this.dataset.phoneView || this.href); }); - }); - /*! 注册 data-tips-hover 事件行为 */ - onEvent('mouseenter', '[data-tips-image][data-tips-hover]', function () { - var img = new Image(), ele = $(this); - if ((img.src = this.dataset.tipsImage || this.dataset.lazySrc || this.src)) { - img.layopt = {anim: 5, time: 0, skin: 'layui-layer-image', 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 () { - layer.close(ele.data('layidx')); - }); - } - }); - - /*! 注册 data-tips-image 事件行为 */ - onEvent('click', '[data-tips-image]', function (event) { - (event.items = [], event.$imgs = $(this).parent().find('[data-tips-image]')).map(function () { - event.items.push({src: this.dataset.tipsImage || this.dataset.lazySrc || this.src}); - }) && layer.photos({ - anim: 5, closeBtn: 1, photos: {start: event.$imgs.index(this), data: event.items}, tab: function (pic, $ele) { - $ele.find('img').attr('referrerpolicy', 'no-referrer'); - $ele.find('.layui-layer-close').css({top: '20px', right: '20px', position: 'fixed'}); - } + /*! 注册 data-target-submit 事件行为 */ + onEvent('click', '[data-target-submit]', function () { + $(this.dataset.targetSubmit || this).submit(); }); + + /*! 表单编辑返回操作 */ + onEvent('click', '[data-history-back]', function () { + $.msg.confirm(this.dataset.historyBack || '确定要返回吗?', function () { + history.back(); + }) + }); + + /*! 图片加载异常处理 */ + document.addEventListener('error', function (event) { + if (event.target.nodeName !== 'IMG') return; + event.target.src = baseRoot + 'theme/img/404_icon.png'; + }, true); + }); - /*! 注册 data-phone-view 事件行为 */ - onEvent('click', '[data-phone-view]', function () { - $.previewPhonePage(this.dataset.phoneView || this.href); + /*! 系统菜单表单页面初始化 */ + require(['ThinkAdmin'], function () { + $.menu.listen() && $.form.reInit($body); }); - - /*! 注册 data-target-submit 事件行为 */ - onEvent('click', '[data-target-submit]', function () { - $(this.dataset.targetSubmit || this).submit(); - }); - - /*! 表单编辑返回操作 */ - onEvent('click', '[data-history-back]', function () { - $.msg.confirm(this.dataset.historyBack || '确定要返回吗?', function () { - history.back(); - }) - }); - - /*! 图片加载异常处理 */ - document.addEventListener('error', function (event) { - if (event.target.nodeName !== 'IMG') return; - event.target.src = baseRoot + 'theme/img/404_icon.png'; - }, true); - -}); - -/*! 系统菜单表单页面初始化 */ -require(['ThinkAdmin'], function () { - $.menu.listen() && $.form.reInit($body); }); \ No newline at end of file diff --git a/public/static/login.js b/public/static/login.js index edf4f58c1..2a5a9a09b 100644 --- a/public/static/login.js +++ b/public/static/login.js @@ -1,7 +1,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/plugs/admin/excel.js b/public/static/plugs/admin/excel.js index f64f089f5..a2bd5834c 100644 --- a/public/static/plugs/admin/excel.js +++ b/public/static/plugs/admin/excel.js @@ -1,7 +1,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/plugs/admin/queue.js b/public/static/plugs/admin/queue.js index fe64555f9..4521a2630 100644 --- a/public/static/plugs/admin/queue.js +++ b/public/static/plugs/admin/queue.js @@ -1,7 +1,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/plugs/admin/validate.js b/public/static/plugs/admin/validate.js index e7213f52b..44e7618b8 100644 --- a/public/static/plugs/admin/validate.js +++ b/public/static/plugs/admin/validate.js @@ -1,7 +1,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_config.less b/public/static/theme/css/_config.less index b94a833c0..931934bf2 100644 --- a/public/static/theme/css/_config.less +++ b/public/static/theme/css/_config.less @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_custom.less b/public/static/theme/css/_custom.less index a9412435b..fcbdb58e6 100644 --- a/public/static/theme/css/_custom.less +++ b/public/static/theme/css/_custom.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_display.less b/public/static/theme/css/_display.less index ab9d8476b..3fc1ca365 100644 --- a/public/static/theme/css/_display.less +++ b/public/static/theme/css/_display.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout.less b/public/static/theme/css/_layout.less index a8fa3bb78..43e617607 100644 --- a/public/static/theme/css/_layout.less +++ b/public/static/theme/css/_layout.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_1.less b/public/static/theme/css/_layout_1.less index dc67b33df..a7cf85b70 100644 --- a/public/static/theme/css/_layout_1.less +++ b/public/static/theme/css/_layout_1.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_1_black.less b/public/static/theme/css/_layout_1_black.less index f7ce9cd5f..a2d9997fa 100644 --- a/public/static/theme/css/_layout_1_black.less +++ b/public/static/theme/css/_layout_1_black.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_1_blue.less b/public/static/theme/css/_layout_1_blue.less index 02a497f5d..737e38909 100644 --- a/public/static/theme/css/_layout_1_blue.less +++ b/public/static/theme/css/_layout_1_blue.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_1_green.less b/public/static/theme/css/_layout_1_green.less index 9b4bf3046..8589d78cb 100644 --- a/public/static/theme/css/_layout_1_green.less +++ b/public/static/theme/css/_layout_1_green.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_1_red.less b/public/static/theme/css/_layout_1_red.less index fc2b17197..258afbf36 100644 --- a/public/static/theme/css/_layout_1_red.less +++ b/public/static/theme/css/_layout_1_red.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_2.less b/public/static/theme/css/_layout_2.less index becb87d1c..d0e4b5162 100644 --- a/public/static/theme/css/_layout_2.less +++ b/public/static/theme/css/_layout_2.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_2_black.less b/public/static/theme/css/_layout_2_black.less index b253ee96b..50e9c6373 100644 --- a/public/static/theme/css/_layout_2_black.less +++ b/public/static/theme/css/_layout_2_black.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_2_blue.less b/public/static/theme/css/_layout_2_blue.less index 31df50d4f..4ee300fed 100644 --- a/public/static/theme/css/_layout_2_blue.less +++ b/public/static/theme/css/_layout_2_blue.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_2_green.less b/public/static/theme/css/_layout_2_green.less index f298d98e9..02d092909 100644 --- a/public/static/theme/css/_layout_2_green.less +++ b/public/static/theme/css/_layout_2_green.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_2_red.less b/public/static/theme/css/_layout_2_red.less index e01e91d6b..3c68f4c6e 100644 --- a/public/static/theme/css/_layout_2_red.less +++ b/public/static/theme/css/_layout_2_red.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/_layout_white.less b/public/static/theme/css/_layout_white.less index 19578a95d..c001be71f 100644 --- a/public/static/theme/css/_layout_white.less +++ b/public/static/theme/css/_layout_white.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/console.less b/public/static/theme/css/console.less index 3f67c4f22..68e79da69 100644 --- a/public/static/theme/css/console.less +++ b/public/static/theme/css/console.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/iconfont.less b/public/static/theme/css/iconfont.less index 8234e34b7..0f5856eeb 100644 --- a/public/static/theme/css/iconfont.less +++ b/public/static/theme/css/iconfont.less @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/login.less b/public/static/theme/css/login.less index de06fcc7d..84b3b9ad0 100644 --- a/public/static/theme/css/login.less +++ b/public/static/theme/css/login.less @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/public/static/theme/css/mobile.less b/public/static/theme/css/mobile.less index cdc977e74..5fa8752d9 100644 --- a/public/static/theme/css/mobile.less +++ b/public/static/theme/css/mobile.less @@ -3,7 +3,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +---------------------------------------------------------------------- diff --git a/think b/think index a7f6b61fa..bb47f165f 100755 --- a/think +++ b/think @@ -4,7 +4,7 @@ // +---------------------------------------------------------------------- // | Static Plugin for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2023 Anyon +// | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ] // +---------------------------------------------------------------------- // | 官方网站: https://thinkadmin.top // +----------------------------------------------------------------------