Browse Source

优化后台离线上传

Karson 4 years ago
parent
commit
a58a147143
1 changed files with 16 additions and 5 deletions
  1. 16 5
      public/assets/js/backend/addon.js

+ 16 - 5
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);