From a58a14714316c24dcd66eb8d062759aca1b7180e Mon Sep 17 00:00:00 2001 From: Karson Date: Thu, 1 Apr 2021 17:35:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=8E=E5=8F=B0=E7=A6=BB?= =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/js/backend/addon.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/public/assets/js/backend/addon.js b/public/assets/js/backend/addon.js index 1079ed91..95b40710 100644 --- a/public/assets/js/backend/addon.js +++ b/public/assets/js/backend/addon.js @@ -191,6 +191,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function }); } }); + + //检测是否登录 + $(document).on("mousedown", "#faupload-addon", function (e) { + var userinfo = Controller.api.userinfo.get(); + var uid = userinfo ? userinfo.id : 0; + + if (parseInt(uid) === 0) { + $(".btn-userinfo").trigger("click"); + return false; + } + }); }); // 查看插件首页 @@ -240,7 +251,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function }); // 会员信息 - $(document).on("click", ".btn-userinfo", function () { + $(document).on("click", ".btn-userinfo", function (e, name, version) { var that = this; var area = [$(window).width() > 800 ? '500px' : '95%', $(window).height() > 600 ? '400px' : '95%']; var userinfo = Controller.api.userinfo.get(); @@ -272,8 +283,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function return false; }, success: function (layero, index) { - this.checkEnterKey = function(event){ - if(event.keyCode === 13){ + this.checkEnterKey = function (event) { + if (event.keyCode === 13) { $(".layui-layer-btn0").trigger("click"); return false; } @@ -281,7 +292,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function $(document).on('keydown', this.checkEnterKey); $(".layui-layer-btn1", layero).prop("href", "http://www.fastadmin.net/user/register.html").prop("target", "_blank"); }, - end: function(){ + end: function () { $(document).off('keydown', this.checkEnterKey); } }); @@ -498,7 +509,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function title: __('Warning'), btn: [__('Login now')], yes: function (index, layero) { - $(".btn-userinfo").trigger("click"); + $(".btn-userinfo").trigger("click", name, version); }, btn2: function () { install(name, version, false);