diff --git a/app/admin/view/index/basecfg.html b/app/admin/view/index/basecfg.html index d717267..0c5c0ee 100644 --- a/app/admin/view/index/basecfg.html +++ b/app/admin/view/index/basecfg.html @@ -129,10 +129,11 @@
@@ -1805,32 +1806,34 @@ diff --git a/app/admin/view/index/console.html b/app/admin/view/index/console.html index f758d1f..2371887 100644 --- a/app/admin/view/index/console.html +++ b/app/admin/view/index/console.html @@ -33,22 +33,22 @@
- 文章数 + 通知
-
{$workplace.article|default=26}
+
{$workplace.notice|default=26}
- 待审核 + 待办项
-
{$workplace.check|default="12/56"}
+
{$todoList}/{$workplace.todo}
- 评论数 + 消息
-
{$workplace.comment|default="2,352"}
+
{$workplace.message|default="2,352"}
@@ -99,7 +99,7 @@
-
@@ -114,7 +114,7 @@
-
@@ -151,7 +151,7 @@
-
@@ -290,7 +290,6 @@
-
@@ -299,36 +298,11 @@
diff --git a/app/admin/view/login/index.html b/app/admin/view/login/index.html index 554020b..9dab91e 100644 --- a/app/admin/view/login/index.html +++ b/app/admin/view/login/index.html @@ -192,10 +192,11 @@ \ No newline at end of file diff --git a/app/admin/view/system/admin/center.html b/app/admin/view/system/admin/center.html index c23a9e3..143f394 100644 --- a/app/admin/view/system/admin/center.html +++ b/app/admin/view/system/admin/center.html @@ -297,7 +297,7 @@ layer.msg("{:__('上传成功')}"); }) } else { - layer.error(res.msg); + layui.show.error(res.msg); } } @@ -348,7 +348,7 @@ elem += ''; $('.layui-badge-list').append(elem); } else { - layer.error(res.msg); + layui.show.error(res.msg); } }) }) @@ -365,7 +365,7 @@ if (res.code === 200) { that.parent('span').remove(); } else { - layer.error(res.msg); + layui.show.error(res.msg); } }) }) diff --git a/app/admin/view/system/admin/group.html b/app/admin/view/system/admin/group.html index c029242..217c947 100644 --- a/app/admin/view/system/admin/group.html +++ b/app/admin/view/system/admin/group.html @@ -190,7 +190,7 @@ _pageUrl = _form.attr("action") || pageThat.data('url'); pageThat.attr("disabled",true); if (typeof(_pageUrl) === 'undefined') { - layer.msg('缺少URL属性','error'); + layer.msg('缺少URL属性'); return false; } @@ -211,7 +211,7 @@ // 关闭当前窗口 layer.close(colletction.index); }else{ - layer.error(res.msg); + layui.show.error(res.msg); } }, 'json'); @@ -263,7 +263,7 @@ _pageUrl = _form.attr("action") || pageThat.data('url'); pageThat.attr("disabled",true); if (typeof(_pageUrl) === 'undefined') { - layer.msg('缺少URL属性','error'); + layer.msg('缺少URL属性'); return false; } @@ -284,7 +284,7 @@ // 关闭当前窗口 layer.close(colletction.index); }else{ - layer.error(res.msg); + layui.show.error(res.msg); } }, 'json'); diff --git a/app/admin/view/system/admin/index.html b/app/admin/view/system/admin/index.html index 21efb49..d206277 100644 --- a/app/admin/view/system/admin/index.html +++ b/app/admin/view/system/admin/index.html @@ -186,9 +186,9 @@ - - + diff --git a/app/admin/view/system/admin/rules_edit.html b/app/admin/view/system/admin/rules_edit.html new file mode 100644 index 0000000..dc39865 --- /dev/null +++ b/app/admin/view/system/admin/rules_edit.html @@ -0,0 +1,164 @@ + +
+
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ + +
+ +
+ +
+ checked + lay-tips="* 菜单默认就是路由地址!"/> + checked + lay-tips="* 按钮不会当作菜单显示!" > + checked + lay-tips="* 接口用户上传等API场景!"/> +
+
+ +
+ + +
+ +
+ +
+ checked /> + checked /> +
+
+ +
+ +
+ +
+
+ + +
+
+ + + + diff --git a/app/admin/view/system/admin/theme.html b/app/admin/view/system/admin/theme.html index f85bf56..555685e 100644 --- a/app/admin/view/system/admin/theme.html +++ b/app/admin/view/system/admin/theme.html @@ -197,7 +197,7 @@ let layout = admin.getStorage('layout') if (layout === 'top' || layout === 'hybrid') { $(".moreLabel").prop("checked", true); - layer.msg('当前菜单布局不支持该操作!','error'); + layer.msg('当前菜单布局不支持该操作!'); form.render(); return false; } diff --git a/app/admin/view/system/admin_notice/bells.html b/app/admin/view/system/admin_notice/bells.html index 49afc28..a03d19c 100644 --- a/app/admin/view/system/admin_notice/bells.html +++ b/app/admin/view/system/admin_notice/bells.html @@ -230,7 +230,7 @@ if (res.code === 200) { layer.msg(res.msg); } else { - layer.error(res.msg); + layui.show.error(res.msg); } } }); @@ -249,7 +249,7 @@ layer.msg(res.msg); $('.layui-instant-list-item').removeClass('active_0').addClass('active_1'); } else { - layer.error(res.msg); + layui.show.error(res.msg); } } }); diff --git a/app/admin/view/system/attachment/choose.html b/app/admin/view/system/attachment/choose.html index a5d6003..ecd3180 100644 --- a/app/admin/view/system/attachment/choose.html +++ b/app/admin/view/system/attachment/choose.html @@ -44,56 +44,4 @@ {:__('选择')} - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/admin/view/system/department/index.html b/app/admin/view/system/department/index.html index 877f17e..14ad1f8 100644 --- a/app/admin/view/system/department/index.html +++ b/app/admin/view/system/department/index.html @@ -228,7 +228,7 @@ if (typeof(_pageUrl) === 'undefined') { - layer.msg('按钮缺少 url 属性','info'); + layer.msg('按钮缺少 url 属性'); return false; } @@ -242,7 +242,7 @@ layer.close(colletction.index); } else { - layer.error(res.msg); + layui.show.error(res.msg); } }, 'json'); diff --git a/app/admin/view/system/dictionary/index.html b/app/admin/view/system/dictionary/index.html index 40000a8..b313431 100644 --- a/app/admin/view/system/dictionary/index.html +++ b/app/admin/view/system/dictionary/index.html @@ -248,7 +248,7 @@ pageThat.attr("disabled",true); } else { - layer.error(res.msg,'error'); + layui.show.error(res.msg); } }, 'json'); diff --git a/app/admin/view/system/plugin/index.html b/app/admin/view/system/plugin/index.html index 511935d..57b1617 100644 --- a/app/admin/view/system/plugin/index.html +++ b/app/admin/view/system/plugin/index.html @@ -8,8 +8,7 @@
插件管理: 在线安装、卸载、禁用、启用、配置、升级插件,插件升级前请做好备份并确保服务器读写权限正确 - +
@@ -83,19 +82,20 @@ {{# } }} {{# if(d.version > item.version) { }} - {:__('升级')} -
-
+ {:__('升级')} +
+ {{# } }} {:__('卸载')} {{# } else { }} - {:__('安装')} - {{# if(d.demourl) { }} + + {:__('安装')} + {{# if(d.demo_url) { }}
- {:__('演示')} + {:__('演示')} {{# } }} {{# } }} @@ -104,11 +104,10 @@ - diff --git a/app/index/view/user/index.html b/app/index/view/user/index.html index bcbdad5..8b65f24 100644 --- a/app/index/view/user/index.html +++ b/app/index/view/user/index.html @@ -9,20 +9,23 @@
  • +
  • + +
  • - +
  • @@ -30,9 +33,9 @@
    - + - +
    @@ -68,14 +71,6 @@ let $ = layui.jquery; let upload = layui.upload; - // 默认展现首个菜单栏 - $('.layui-nav-tree .layui-nav-item').each(function (k,e) { - if ($(e).find('dl.layui-nav-child').length) { - $(e).addClass('layui-nav-itemed'); - return false; - } - }) - // 点击切换页面地址 $('body').on('click', '.layui-nav-tree a', function () { let href = $(this).attr('lay-href'); @@ -85,25 +80,6 @@ } }) - // 上传头像 - upload.render({ - elem: '.layui-user-avatar' - ,url: '/index/user/avatars' - ,method: 'post' - ,accept: 'file' - ,before: function(res) { - layer.msg('上传中'); - },done: function(res, index, upload) { - // 上传成功 - if (res.code === 200) { - layer.msg(res.msg); - $('#imgHead img').attr('src',res.url); - } else { - layer.msg(res.msg,'error'); - } - } - }) - let leftAnimate = function (action = true) { if (action) { $('.layui-side').animate({width: '0px'}); @@ -135,9 +111,11 @@ let skin = layui.data('skin').theme || undefined; if (skin === 'layui-bg-white') { $('.layui-side-body').removeClass('layui-bg-black').addClass(skin); - $('#skin').removeClass('fa-moon-o').addClass('fa-sun-o'); } + $('#refresh').click(function (e) { + $('#iframe').attr('src',$('#iframe').attr('src')); + }) bellMessage($('#unread').data('count')); }) diff --git a/app/index/view/user/login.html b/app/index/view/user/login.html index f1f6d38..3f1803e 100644 --- a/app/index/view/user/login.html +++ b/app/index/view/user/login.html @@ -35,7 +35,7 @@ - +
@@ -124,9 +124,9 @@
- - - + + + 下载 APP @@ -156,7 +156,7 @@ let name = $(item).attr('name'); let title = $(item).data('title'); if (!value) { - layer.msg(title + '不能为空', 'info'); + layer.msg(title + '不能为空', {icon: 5}); $(item).focus(); return false; } @@ -172,7 +172,9 @@ window.location.href = '/index/user/index'; }, 1000); } else { - layer.msg(res.msg, 'error') + layui.notice.error({ + message: res.msg + }); } }, 'json'); } @@ -183,10 +185,10 @@ let type = $('#pwd').attr('type'); if (type === 'password') { $('#pwd').attr('type', 'text'); - $(this).find('i.layui-icon').addClass('fa-eye').removeClass('fa-eye-slash'); + $(this).find('i.layui-icon').addClass('layui-icon-eye').removeClass('layui-icon-eye-invisible'); } else { $('#pwd').attr('type', 'password'); - $(this).find('i.layui-icon').addClass('fa-eye-slash').removeClass('fa-eye'); + $(this).find('i.layui-icon').addClass('layui-icon-eye-invisible').removeClass('layui-icon-eye'); } }); @@ -203,7 +205,9 @@ !queryTicket && queryRequest(res.data.ticket); $('#scanCover').attr('src', res.data.qrcode || '/static/images/qrcode.png'); } else { - layer.msg(res.msg, 'info'); + layui.notice.error({ + message: res.msg + }) } }) } else { diff --git a/app/index/view/user/message.html b/app/index/view/user/message.html index 101f4b9..d190f90 100644 --- a/app/index/view/user/message.html +++ b/app/index/view/user/message.html @@ -7,7 +7,7 @@
-
短消息是本站系统给您发送的提醒消息,请务必阅读。如因自身未阅读导致出现的相关问题后果自负!
+
短消息是本站系统给您发送的提醒消息,请务必阅读。如因自身未阅读导致出现的相关问题后果自负!
@@ -53,11 +53,6 @@ title += ' layui-table-text-red'; } title += '" lay-open data-title="查看消息" data-url="/index/user/viewMessage?id=' + e.id + '" data-area="600px, 390px" >'; - if (e.status === 0) { - title += ' '; - } else { - title += ' '; - } title += e.title; title += ''; return title; diff --git a/app/index/view/user/message_view.html b/app/index/view/user/message_view.html index 2d0b613..1bdcf35 100644 --- a/app/index/view/user/message_view.html +++ b/app/index/view/user/message_view.html @@ -39,7 +39,6 @@ let unread = $('#unread').data('count'); if (!unread) { top.layui.$('#notice').find('.layui-badge-dot').hide(); - top.layui.$('#notice').find('.fa-bell').removeClass('fa-bell').addClass('fa-bell-o'); } // 更新消息数量 diff --git a/app/index/view/user/profile.html b/app/index/view/user/profile.html index c82c4d6..d250024 100644 --- a/app/index/view/user/profile.html +++ b/app/index/view/user/profile.html @@ -1,29 +1,15 @@
@@ -130,7 +116,7 @@ $('.avatar').attr('src', res.url + '?' + parseInt(100 * Math.random())); return layer.msg(res.msg); } - layer.msg(res.msg, 'error'); + layer.msg(res.msg); } }) @@ -147,7 +133,7 @@ top.layer.msg(res.msg); } else { - top.layer.msg(res.msg,'error'); + top.layer.msg(res.msg); } } }); diff --git a/app/index/view/user/register.html b/app/index/view/user/register.html index 551296f..832da7d 100644 --- a/app/index/view/user/register.html +++ b/app/index/view/user/register.html @@ -19,7 +19,7 @@
- +
用户注册
@@ -32,13 +32,13 @@
- +
- +
@@ -84,9 +84,9 @@
- - - + + + 下载 APP @@ -114,13 +114,12 @@ let type = $(elem).attr('type'); if (type === 'password') { $(elem).attr('type','text'); - $(this).find('i.layui-icon').addClass('fa-eye').removeClass('fa-eye-slash'); + $(this).find('i.layui-icon').addClass('layui-icon-eye').removeClass('layui-icon-eye-invisible'); } else { $(elem).attr('type','password'); - $(this).find('i.layui-icon').addClass('fa-eye-slash').removeClass('fa-eye'); + $(this).find('i.layui-icon').addClass('layui-icon-eye-invisible').removeClass('layui-icon-eye'); } }); - }); \ No newline at end of file diff --git a/app/index/view/user/security.html b/app/index/view/user/security.html index 6fbd74d..5b37270 100644 --- a/app/index/view/user/security.html +++ b/app/index/view/user/security.html @@ -54,7 +54,7 @@
- + 修改密码 安全性高的密码可以使账户更安全;互联网账号存在被盗风险,建议您定期更换密码 @@ -68,9 +68,9 @@
- + - + 手机绑定 @@ -92,9 +92,9 @@
- + - + 邮箱绑定 @@ -116,9 +116,9 @@
- + - + 密保问题 @@ -133,7 +133,7 @@
- + 微信绑定 暂未绑定。 绑定认证后可用于快捷登录、接收微信通知 diff --git a/app/index/view/user/userNav.html b/app/index/view/user/userNav.html index 241dc10..a040ec0 100644 --- a/app/index/view/user/userNav.html +++ b/app/index/view/user/userNav.html @@ -1,7 +1,7 @@
    -
  • +
  • Dashboard
    控制台
    diff --git a/app/install/view/index/step1.html b/app/install/view/index/step1.html index 36e928f..29ca70d 100644 --- a/app/install/view/index/step1.html +++ b/app/install/view/index/step1.html @@ -170,7 +170,7 @@ location.href = res.url; } else { - layer.msg(res.msg,'error'); + layer.msg(res.msg); } }) }) diff --git a/app/install/view/index/step2.html b/app/install/view/index/step2.html index 8a93ea1..cbe34f2 100644 --- a/app/install/view/index/step2.html +++ b/app/install/view/index/step2.html @@ -147,7 +147,7 @@ location.href = res.url; } else { - layer.msg(res.msg,'error'); + layer.msg(res.msg); } },'json'); return false; diff --git a/app/install/view/index/step3.html b/app/install/view/index/step3.html index f2a2bf1..49d0ad9 100644 --- a/app/install/view/index/step3.html +++ b/app/install/view/index/step3.html @@ -104,7 +104,7 @@ jquery('.layui-complete').show(); jquery.get('/install/index/clear',{},function(res){}); } else { - layer.msg(res.msg,'error'); + layer.msg(res.msg); } }); }) diff --git a/public/static/css/center.css b/public/static/css/center.css index f1ee62a..d51451f 100644 --- a/public/static/css/center.css +++ b/public/static/css/center.css @@ -108,16 +108,20 @@ b.msg { background: 0!important; } -.layui-layout-admin .layui-header { +.layui-header { background-color: #fff!important; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 15%); } -.layui-layout-admin .layui-header .layui-nav-item a { +.layui-header .layui-layout-left .layui-nav-item { + margin: 0 10px; +} + +.layui-header .layui-nav-item a { color: #0C1021!important; } -.layui-layout-admin .layui-logo { +.layui-header .layui-logo { box-shadow: 0 0px 2px 0 rgb(0 0 0 / 15%); } @@ -126,7 +130,7 @@ b.msg { } .logo-text { - font-size: 20px; + font-size: 18px; } .layui-btn-primary { @@ -340,7 +344,7 @@ a[lay-event="del"] { background: #3464FF !important; } -.layui-layout-admin .layui-layout-left a.flexible-btn { +.layui-layout-left a.flexible-btn { float: left; margin: 18px 13px 0 0; color: rgba(255, 255, 255, .6); @@ -522,16 +526,16 @@ a[lay-event="del"] { } #content .setting-status i.layui-icon { - font-size: 30px; - margin-left: 20px; + font-size: 16px; + margin-left: 10px; color: #999; } -#content .setting-status i.fa-check { +#content .setting-status i.layui-icon-ok-circle { color: #0b8235; } -#content .setting-status i.fa-warning { +#content .setting-status i.layui-icon-question { color: #ffa200; } diff --git a/public/static/js/center.js b/public/static/js/center.js index 7847d49..c9a4427 100644 --- a/public/static/js/center.js +++ b/public/static/js/center.js @@ -1,5 +1,5 @@ /*! - * CommonJS For Home - v1.0.0 - 2022-10-10 + * center For Home - v1.0.0 - 2022-10-10 * https://github.com/meystack/swiftadmin * Copyright (c) meystack * Licensed Apache2.0 @@ -27,7 +27,6 @@ layui.use(['jquery', 'form', 'upload', 'table', 'dropdown'], function () { }], ready: function (elemPanel, elem) { } , click: function (data, index) { - console.log(data, index); let elem = $('.layui-nav-tree li [lay-href="/user/message"]'); $(elem).parents('.layui-nav-item').addClass('layui-nav-itemed'); $(elem).trigger('click'); @@ -107,6 +106,9 @@ layui.use(['jquery', 'form', 'upload', 'table', 'dropdown'], function () { // 开启节流 that.attr("disabled", true); + setTimeout(function () { + that.attr("disabled", false); + }, 2000); $.post(_url, data.field, function (res) { if (res.code === 200) { @@ -133,7 +135,7 @@ layui.use(['jquery', 'form', 'upload', 'table', 'dropdown'], function () { Home.event.closeDialog(that); } } else { - top.layui.layer.msg(res.msg, 'error'); + top.layui.layer.msg(res.msg, {icon: 5}); } try { @@ -144,9 +146,7 @@ layui.use(['jquery', 'form', 'upload', 'table', 'dropdown'], function () { if (typeof res.data.__token__ !== 'undefined') { $('input#__token__').val(res.data.__token__); } - } catch (e) { - } - that.attr("disabled", false); + } catch (e) {} }, 'json'); return false; @@ -232,7 +232,7 @@ layui.use(['jquery', 'form', 'upload', 'table', 'dropdown'], function () { uploadFiles[type](res, name); } else { // 错误消息 - layer.error(res.msg); + layer.msg(res.msg, {icon: 5}); } that.prop("disabled", false); } @@ -312,7 +312,7 @@ layui.use(['jquery', 'form', 'upload', 'table', 'dropdown'], function () { } layer.msg(res.msg); } else { - layer.msg(res.msg, 'error'); + layer.msg(res.msg, {icon: 5}); } that.attr('disabled', false); }, 'json'); @@ -340,7 +340,7 @@ layui.use(['jquery', 'form', 'upload', 'table', 'dropdown'], function () { } if (list.data.length === 0) { - layer.msg('请勾选数据', 'error'); + layer.msg('请勾选数据'); return false; } @@ -366,7 +366,7 @@ layui.use(['jquery', 'form', 'upload', 'table', 'dropdown'], function () { layer.msg(res.msg); table.reload(tableId); } else { - layer.msg(res.msg, 'error'); + layer.msg(res.msg, {icon: 5}); } } }) @@ -468,11 +468,11 @@ layui.use(['jquery', 'form', 'upload', 'table', 'dropdown'], function () { } } else { - layer.msg(res.msg, 'error'); + layer.msg(res.msg, {icon: 5}); } }, error: function (res) { - layer.msg('Access methods failure', 'error'); + layer.msg('Access methods failure', {icon: 5}); } }) } diff --git a/public/static/system/css/content.css b/public/static/system/css/content.css index 762e81f..0d35cd0 100644 --- a/public/static/system/css/content.css +++ b/public/static/system/css/content.css @@ -33,11 +33,6 @@ p.layui-clear { height: 10px; } -.layui-imagesbox { - width: 810px; - overflow: hidden; -} - .layui-imagesbox input { text-align: center; } diff --git a/public/static/system/layui/fonts/FontAwesome.otf b/public/static/system/layui/fonts/FontAwesome.otf deleted file mode 100644 index 401ec0f..0000000 Binary files a/public/static/system/layui/fonts/FontAwesome.otf and /dev/null differ diff --git a/public/static/system/module/admin.js b/public/static/system/module/admin.js index af69f5e..64e2c00 100644 --- a/public/static/system/module/admin.js +++ b/public/static/system/module/admin.js @@ -8,7 +8,7 @@ // | Author: meystack Apache 2.0 License Code // +---------------------------------------------------------------------- -layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'table', 'slider', 'upload', 'laydate', 'dropdown', 'colorpicker', 'cascader', 'content', 'tags'], function (exports) { +layui.define(['jquery', 'i18n', 'element', 'show','layer', 'form', 'rate', 'table', 'slider', 'cascader', 'content','dropdown','upload'], function (exports) { "use strict"; let $ = layui.jquery; @@ -19,22 +19,25 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta let table = layui.table; let slider = layui.slider; let element = layui.element; - let laydate = layui.laydate; let cascader = layui.cascader; - let upload = layui.upload; - let notice = layui.notice; let content = layui.content; - let colorpicker = layui.colorpicker; + let upload = layui.upload; + let dropdown = layui.dropdown; + + // 自定义消息通知 + let show = layui.show; + window.top.show = show; + // 系统常量 let TABFILTER = 'swiftadmin-tabs', BODY = '.layui-body', LAYOUTBODY = ".layui-layout-body", LAYOUTADMIN = ".layui-layout-admin" , TABS = BODY + ">.layui-tab", FLEXIBLEID = "flexible", MENUFILTER = "lay-side-menu", - LAYTOPMENU = "lay-top-menu", LAYSIDESHRINK = "layadmin-side-shrink" + LAYSIDESHRINK = "layadmin-side-shrink" , LAYSIDESPREAD = "layadmin-side-spread-sm", ICONSHRINKRIGHT = "layui-icon-shrink-right", ICONSPREADLEFT = "layui-icon-spread-left", STR_EMPTY = '' , BODYSHADE = "
    <\/div>", - BODYSHADECLASS = ".layadmin-body-shade", LAYERCONTENT = ".layui-layer-content"; + BODYSHADECLASS = ".layadmin-body-shade"; // 对象初始化 let admin = { @@ -376,6 +379,17 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta app.removeClass(LAYSIDESPREAD) $(LAYOUTADMIN).removeClass(BODYSHADE); } + }, + // 节流函数 + throttle: function(obj, time = 2000) { + try { + $(obj).attr('disabled', true); + setTimeout(function () { + $(obj).attr('disabled', false); + }, time); + } catch (e) { + console.log(e); + } } }; @@ -407,7 +421,6 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta admin.event.flowOpen({ id: "layer-msg", type: 2, - // title: "🔔 消息提醒", area: ["336px", "390px"], content: n }, that) @@ -423,8 +436,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta content: n }) }, - clear: function () { - } + clear: function () {} , logout: function (res) { var href = $(this).data("url"); layui.layer.confirm("确定要退出登录吗?", { @@ -434,11 +446,8 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta }) } , flowOpen: function (n, that) { - if (typeof that === "undefined") { - notice.info({ - message: i18n.prop('未定义') - }) + show.info(i18n.prop('未定义')); return false; } @@ -462,7 +471,6 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta n.resize = n.resize !== undefined ? n.resize : false; n.shade = n.shade !== undefined ? n.shade : 0.1; var top = client.height, - padding = (that.innerWidth() - that.width()) / 2, // 不用计算 padding left = client.left + (client.width / 2) - (elemWidth / 2); if (!n.offset) { n.offset = [top, left]; @@ -562,9 +570,8 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta let TabLists = admin.getConfig("TabLists"); for (const tabListsKey in TabLists) { let el = TabLists[tabListsKey]; - console.log(el) if (el.home && id === el.id) { - layer.info(i18n.prop('请不要关闭主页')); + show.info(i18n.prop('请不要关闭主页')); return false; } } @@ -609,7 +616,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta admin.event.closeDialog(this); } , ajax: function (url, data, async = false) { - var result = []; + let result = []; $.ajax({ url: url, type: "post", @@ -619,7 +626,6 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta result = res; } }); - try { return typeof (result) !== "object" ? JSON.parse(result) : result; } catch (error) { @@ -630,7 +636,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta , open: function (clickObject, tableThis, mergeOptions) { var options = { - url: admin._validauthURL(clickObject), + url: clickObject.data('url') || undefined, type: clickObject.data('type') || 2, area: clickObject.data('area') || "auto", title: clickObject.data('title') || false, @@ -724,11 +730,10 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta } if (typeof postUrl == 'undefined') { - postUrl = _global_.app + '/' + _global_.controller + '/' + action; + postUrl = app_Config.app + '/' + app_Config.controller + '/' + action; } - othat.attr("disabled", true); - + admin.throttle(othat, 2000); $.ajax({ url: postUrl, type: 'post', @@ -766,20 +771,16 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta * 如果使用第三方组件在table显示或元素为DIY数据结构 * 则在这里可能会出现错误,这里不做处理,如果有需求可自行在页面实现数据回显到table行的逻辑 */ - layer.info(error); + show.info(error); } - layer.msg(res.msg); + show.msg(res.msg); admin.event.closeDialog(othat); } else { - layer.error(res.msg) + show.error(res.msg) } - - othat.attr("disabled", false); }, error: function (res) { - notice.error({ - message: i18n.prop('访问方法失败') - }) + show.error(i18n.prop('访问方法失败')); return false; } }) @@ -793,7 +794,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta , request: function (clickObject, reqData, callback, merge) { let options = { - url: admin._validauthURL(clickObject), + url: clickObject.data('url'), type: clickObject.data('type') || 'post', dataType: clickObject.data('dataType') || 'json', timeout: clickObject.data('timeout') || '6000', @@ -805,6 +806,11 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta async: clickObject.data('async') || true // 默认异步调用 } + if (!options.url) { + show.info(i18n.prop('请求地址不能为空!')); + return false; + } + let reqSend = function (options) { if (typeof merge !== 'undefined') { options = $.extend({}, options, merge); @@ -863,20 +869,18 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta admin.event.closeDialog(clickObject); } - top.layer.msg(res.msg); + top.show.msg(res.msg); } else { if (typeof callback !== 'undefined' && typeof callback.error === 'function') { return callback.error(res); } - top.layer.error(res.msg); + top.show.error(res.msg); } }, error: function (res) { - notice.error({ - message: i18n.prop('访问方法失败') - }) + show.error(i18n.prop('访问方法失败')); return false; } }) @@ -918,80 +922,69 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta if (typeof eval(funcObj) === "function") { return eval(funcObj)(clickThis, collection); } else { - notice.error({ - message: i18n.prop('回调函数错误') - }) + show.error(i18n.prop('回调函数错误')); } } } /** - * 鉴权函数 - * @param {*} othis + * + * @param that + * @returns {boolean} */ - admin._validauthURL = function (othis) { + admin.hasPermission = function (that) { - var curl = $(othis).attr('data-url'); - if (typeof curl == 'undefined') { - notice.info({ - message: i18n.prop('URL未定义') - }) + let url = $(that).data('url'); + if (typeof url == 'undefined') { return false; } - if (curl.indexOf(_global_.app) !== -1) { - var route = curl.replace('.html', ''); - route = route.substring(1); - var main = route.substring(0, route.indexOf('/')); - if (route.indexOf('.php') !== -1) { - main = route.replace(main, '').substring(1); - main = main.substring(0, main.indexOf('/')); - } - - // 查找方法 - var action = route.substring(route.indexOf(main) + main.length + 1); - if (action.indexOf('/') !== -1) { - action = action.substring(0, action.indexOf('/')) - } else if (action.indexOf('?') !== -1) { - action = action.substring(0, action.indexOf('?')) - } - - route = main + ':' + action; - let status, recursive = function (elem) { - for (let i in elem) { - var n = elem[i]; - - if (route === n.alias) { - status = true; - } - - if (typeof n.children !== undefined) { - recursive(n.children); - } - } - - return status ? status : false; - } - - let router = admin.getConfig('router'); - try { - if (typeof router.supersAdmin !== undefined) { - if (router.supersAdmin === false - && curl.indexOf('://') === -1 && !recursive(router.authorities)) { - notice.error({ - message: i18n.prop('无权操作') - }) - return false; - } - } - } catch (e) { - - } + let router = admin.getConfig('router'); + if (typeof router == 'undefined') { + return false; } - return curl; + // noinspection JSUnresolvedVariable + if (url.substr(0, 1) === '#' || router.supersAdmin) { + return true; + } + + url = url.split('?')[0]; + let status, recursive = function (elem) { + for (let i in elem) { + let n = elem[i]; + if (url.toLowerCase() === n.router.toLowerCase()) { + status = true; + break; + } + if (typeof n.children !== undefined) { + recursive(n.children); + } + } + + return status ? status : false; + } + // noinspection JSUnresolvedVariable + return recursive(router.authorities); } + /** + * lay-auth校验权限 + */ + $(document).ready(function () { + $('*[lay-auth]').each(function (key, item) { + if (!admin.hasPermission(item)) { + let $this = $(this); + let type = $this.attr('lay-auth') || 'hide'; + let next = $this.next(); + if (next.hasClass('layui-divider')) { + type === 'hide' ? next.hide() : next.remove(); + } + type === 'hide' ? $this.hide() : $this.remove(); + } + }) + }); + /** * 全局渲染组件 */ @@ -1010,7 +1003,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta max = $(obj).data('maxvalue') || '2222-12-31', min = $(obj).data('minvalue') || '1930-01-01'; - laydate.render({ + layui.laydate.render({ elem: this , type: t , range: r @@ -1131,7 +1124,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta picker.each(function (index, elem) { var name = $(elem).attr("lay-colorpicker"); var color = $('.' + name).val() || $(name).data('value'); - colorpicker.render({ + layui.colorpicker.render({ elem: this , color: color , predefine: true @@ -1148,14 +1141,15 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta var that = $(this), name = $(elem).attr('lay-upload') || undefined, - url = $(elem).data('url') || _global_.app + '/Ajax/upload', + url = $(elem).data('url') || app_Config.app + '/Ajax/upload', type = $(elem).data('type') || 'normal', size = $(elem).data('size') || 102400, - accept = $(elem).data('accept') || 'images', + accept = $(elem).data('accept') || 'images/file/video/audio', chunk = $(elem).data('chunk') || false, multiple = $(elem).data('multiple') || false, - chunkSize = typeof _upload_chunkSize != 'undefined' ? _upload_chunkSize : '2097152', + chunkSize = typeof upload_chunkSize != 'undefined' ? upload_chunkSize : '2097152', callback = $(elem).attr('callback') || undefined, + postChunkId = undefined, blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice; let uploadFiles = { @@ -1187,13 +1181,13 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta } } - layui.upload.render({ + upload.render({ elem: elem , url: url , method: 'post' , size: size , auto: false - , accept: 'file' + , accept: accept , multiple: multiple , choose: function (obj) { @@ -1203,7 +1197,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta let file = files[index]; if ((file.size / 1024) > size) { delete files[index]; - layer.error('文件大小超过限制,最大不超过' + size + 'KB'); + show.error('文件大小超过限制,最大不超过' + size + 'KB'); return false; } // 使用data-chunk="close"关闭分片上传 @@ -1224,6 +1218,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta index: index }; + postChunkId = chunkId; var chunkList = layui.data(chunkId).chunkList; if (typeof chunkList == 'undefined') { chunkList = []; @@ -1257,7 +1252,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta if (progress === 'undefined') { layui.data(chunkId, null); - return layer.error('数据读取异常'); + return show.error('数据读取异常'); } that.data = chunkList[progress].data; var start = progress * chunkSize; @@ -1278,7 +1273,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta if (res.code !== 200) { layer.closeAll(); - return layer.error(res.msg); + return show.error(res.msg); } var index = res.index, @@ -1343,11 +1338,12 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta if (typeof callback != 'undefined') { return admin.callbackfunc(this.item, {res: res, index: indexObj, file: fileObj}); } else if (res.code === 200) { - layer.msg(res.msg); + show.msg(res.msg); // 执行默认上传成功回调 uploadFiles[type](res, name); } else { - layer.error(res.msg); + show.error(res.msg); + layui.data(postChunkId, null); that.prop("disabled", false); } } @@ -1376,7 +1372,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta if (listData.code === 200) { option_data = listData.data; } else { - layer.msg('字段 ' + name + ' 获取数据失败,网址返回错误信息 ' + listData.msg, { + show.msg('字段 ' + name + ' 获取数据失败,网址返回错误信息 ' + listData.msg, { icon: 3, time: 5000 }) @@ -1560,7 +1556,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta , callback = { error: function (res) { $(obj.elem).prop('checked', !obj.elem.checked); - layer.error(res.msg); + show.error(res.msg); form.render('checkbox'); } } @@ -1588,9 +1584,9 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta if (_url === false || _url === '') { try { - let app = _global_.app; - let action = _global_.action; - let controller = _global_.controller; + let app = app_Config.app; + let action = app_Config.action; + let controller = app_Config.controller; _url = app + '/' + controller + '/' + action; } catch (error) { console.warn(error); @@ -1598,19 +1594,16 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta } if (typeof _url === 'undefined') { - notice.error({ - message: i18n.prop('远程URL未定义') - }) + show.error(i18n.prop('远程URL未定义')); return false; } + admin.throttle(that, 3000); let _parent = that.data('reload') || false; - - that.attr("disabled", true); $.post(_url, data.field, function (res) { if (res.code === 200) { - top.layer.msg(res.msg); + top.show.msg(res.msg); if (_close === undefined) { admin.event.closeDialog(that); } @@ -1622,7 +1615,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta } } } else { - top.layer.error(res.msg); + top.show.error(res.msg); } try { @@ -1630,7 +1623,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta $('input#__token__').val(res.data.__token__); } } catch (e) {} - that.attr("disabled", false); + }, 'json'); return false; }); @@ -1668,10 +1661,10 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta table.reloadData("lay-tableList"); } - layer.msg(res.msg); + show.msg(res.msg); }, error: function (res) { - layer.error(res.msg); + show.error(res.msg); } } , othis = $(this) @@ -1807,9 +1800,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta , tips = '确定要批量操作'; if (tableId === null || tableId === undefined) { - notice.error({ - message: i18n.prop('表格ID未定义') - }) + show.error(i18n.prop('表格ID未定义')); return false; } @@ -1819,9 +1810,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta } if (list.data.length === 0) { - notice.info({ - message: i18n.prop('请勾选数据') - }) + show.info(i18n.prop('请勾选数据')); return false; } @@ -1848,26 +1837,6 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta admin.event.open($(this), undefined, {}); }) - /** - * 监听全局属性鉴权 - */ - $(document).on('click', "*[lay-noauth]", function () { - - var event = $(this).attr('lay-event'); - var router = admin.getConfig('router'); - try { - if (typeof router.supersAdmin !== undefined) { - if (router.supersAdmin === false && event === undefined) { - notice.error({ - message: i18n.prop('无权操作') - }) - throw '没有权限'; - } - } - } catch (e) { - } - }) - /** * 监听ajax属性操作 */ @@ -1914,7 +1883,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta type: 2, title: i18n.prop('文件选择'), area: ['62%', '65%'], - content: _global_.app + '/system/Attachment/index?choose=true', + content: app_Config.app + '/system/Attachment/index?choose=true', success: function (layero, index) { let body = layer.getChildFrame('body', index), html = ''; @@ -1926,7 +1895,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta }) // 清理系统缓存 - layui.dropdown.render({ + dropdown.render({ elem: '#clearCache' , data: [{ title: '一键清理缓存' @@ -2220,9 +2189,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta var options = this.options; if (!res.url) { - notice.error({ - message: i18n.prop('菜单的地址不能为空') - }) + show.error(i18n.prop('菜单的地址不能为空')); return; } @@ -2232,7 +2199,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta if (options.moreLabel) { if ((options.TabLists.length + 1) >= options.maxTabNum) { - layer.msg(i18n.prop('最大打开20个标签页')); + show.msg(i18n.prop('最大打开20个标签页')); return false } @@ -2408,7 +2375,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta let that = $(this); let id = $(this).attr("lay-id"); - layui.dropdown.render({ + dropdown.render({ elem: that , trigger: 'contextmenu' , style: 'width: 110px;text-align:center;' @@ -2537,7 +2504,7 @@ layui.define(['jquery', 'i18n', 'element', 'layer', 'form','notice', 'rate', 'ta }) }, }; - + // noinspection JSUnresolvedVariable BodyLayout[options.layout](router.authorities); var allowclose = '
    '; allowclose += '
      ';