Kaynağa Gözat

登录页面

wushaodong 3 yıl önce
ebeveyn
işleme
17cd5a78e3

+ 1 - 1
apps/api/admin/views.py

@@ -38,4 +38,4 @@ class AdminUserRefreshTokenView(RefreshJSONWebToken):
             if ser.is_valid(raise_exception=True):
                 return response_ok({'token': ser.validated_data['token']})
         except ValidationError as e:
-            return response_error(u'登录状态失效,请重新登录[' + e.detail['error'][0] + ']')
+            return response_error(u'登录状态失效,请重新登录[' + e.detail['error'][0] + ']')

+ 21 - 0
uis/admin/dashboard/home.html

@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html style="height: 100%;">
+<head>
+  <meta charset="utf-8">
+  <title>首页</title>
+  <meta name="renderer" content="webkit">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
+  <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
+</head>
+<body style="height: 100%;">
+
+<div class="layui-card" style="height: 100%;display:flex;">
+  <div style="margin:auto;font-weight:bold;font-size: 32px;font-style: normal;color:#868686;">
+    欢迎使用人员能力评估后台管理系统
+  </div>
+</div>
+
+</body>
+</html>

+ 7 - 8
uis/admin/index.html

@@ -2,7 +2,7 @@
 <html>
 <head>
   <meta charset="utf-8">
-  <title>燎原管理系统</title>
+  <title>人员能力评估后台管理系统</title>
   <meta name="renderer" content="webkit">
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
   <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
@@ -10,7 +10,7 @@
   <link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all">
 </head>
 <body class="layui-layout-body">
-  
+
   <div id="LAY_app">
     <div class="layui-layout layui-layout-admin">
       <div class="layui-header">
@@ -52,12 +52,12 @@
           </li>
         </ul>
       </div>
-      
+
       <!-- 侧边菜单 -->
       <div class="layui-side layui-side-menu">
         <div class="layui-side-scroll">
           <div class="layui-logo">
-            <span>燎原管理系统</span>
+            <span>人员能力评估后台管理系统</span>
           </div>
 
           <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-muen" lay-filter="layadmin-system-side-menu">
@@ -107,15 +107,14 @@
           </ul>
         </div>
       </div>
-      
-      
+
       <!-- 主体内容 -->
       <div class="layui-body" id="LAY_app_body">
         <div class="layadmin-tabsbody-item layui-show">
-          <iframe src="dashboard/index.html" frameborder="0" class="layadmin-iframe"></iframe>
+          <iframe src="dashboard/home.html" frameborder="0" class="layadmin-iframe"></iframe>
         </div>
       </div>
-      
+
       <!-- 辅助元素,一般用于移动设备下遮罩 -->
       <div class="layadmin-body-shade" layadmin-event="shade"></div>
     </div>

+ 98 - 94
uis/admin/login/login.html

@@ -1,118 +1,122 @@
 <!DOCTYPE html>
 <html>
 <head>
-  <meta charset="utf-8">
-  <title>燎原管理系统</title>
-  <meta name="renderer" content="webkit">
-  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
-  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
-  <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
-  <link rel="stylesheet" href="../../layuiadmin/style/login.css" media="all">
+    <meta charset="utf-8">
+    <title>人员能力评估后台管理系统</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport"
+          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
+    <link rel="stylesheet" href="../../layuiadmin/style/login.css" media="all">
 </head>
 <body>
 
-  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
+<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
 
     <div class="layadmin-user-login-main">
-      <div class="layadmin-user-login-box layadmin-user-login-header">
-        <h2>燎原管理系统</h2>
-      </div>
-      <form class="layui-form" action="" lay-filter="component-form-element">
-      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
-        <div class="layui-form-item">
-          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
-          <input type="text" name="username" id="LAY-user-login-username" placeholder="用户名" autocomplete="off" class="layui-input">
+        <div class="layadmin-user-login-box layadmin-user-login-header">
+            <font style="font-size: 25px">人员能力评估后台管理系统</font>
         </div>
-        <div class="layui-form-item">
-          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
-          <input type="password" name="password" id="LAY-user-login-password" autocomplete="off" placeholder="密码" class="layui-input">
-        </div>
-        <div class="layui-form-item">
-          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="component-form-element">登 录</button>
-        </div>
-      </div>
-       </form>
+        <form class="layui-form" action="" lay-filter="component-form-element">
+            <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
+                <div class="layui-form-item">
+                    <label class="layadmin-user-login-icon layui-icon layui-icon-username"
+                           for="LAY-user-login-username"></label>
+                    <input type="text" name="username" id="LAY-user-login-username" placeholder="用户名" autocomplete="off"
+                           class="layui-input">
+                </div>
+                <div class="layui-form-item">
+                    <label class="layadmin-user-login-icon layui-icon layui-icon-password"
+                           for="LAY-user-login-password"></label>
+                    <input type="password" name="password" id="LAY-user-login-password" autocomplete="off"
+                           placeholder="密码" class="layui-input">
+                </div>
+                <div class="layui-form-item">
+                    <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="component-form-element">登 录
+                    </button>
+                </div>
+            </div>
+        </form>
     </div>
-    
+
     <div class="layui-trans layadmin-user-login-footer">
-      <p>© 2020 燎原管理系统 <a href="http://www.zzliaoyuan.com/" target="_blank">郑州燎原计算机技术有限公司</a></p>
     </div>
-    
-  </div>
 
-  <script src="../../layuiadmin/layui/layui.js"></script>
-  <script>
-  layui.config({
-    base: '../../layuiadmin/' //静态资源所在路径
-  }).extend({
-    index: 'lib/index' //主入口模块
-  }).use(['index', 'user'], function(){
-    var $ = layui.$
-    ,setter = layui.setter
-    ,admin = layui.admin
-    ,form = layui.form
-    ,router = layui.router()
-    ,search = router.search;
+</div>
 
-    if (layui.data(setter.tableName)[setter.request.tokenName]) {
-      admin.req({
-        url: '/admin/token_refresh/'
-        ,data: {token: layui.data(setter.tableName)[setter.request.tokenName].substr(4)}
-        ,type: 'post'
-        ,done: function(res){
+<script src="../../layuiadmin/layui/layui.js"></script>
+<script>
+    layui.config({
+        base: '../../layuiadmin/' //静态资源所在路径
+    }).extend({
+        index: 'lib/index' //主入口模块
+    }).use(['index', 'user'], function () {
+        var $ = layui.$
+            , setter = layui.setter
+            , admin = layui.admin
+            , form = layui.form
+            , router = layui.router()
+            , search = router.search;
 
-          //请求成功后,写入 access_token
-          layui.data(setter.tableName, {
-            key: setter.request.tokenName
-            ,value: 'JWT ' + res.data.token
-          });
+        if (layui.data(setter.tableName)[setter.request.tokenName]) {
+            admin.req({
+                url: '/admin/token_refresh/'
+                , data: {token: layui.data(setter.tableName)[setter.request.tokenName].substr(4)}
+                , type: 'post'
+                , done: function (res) {
+                    //请求成功后,写入 access_token
+                    layui.data(setter.tableName, {
+                        key: setter.request.tokenName
+                        , value: 'JWT ' + res.data.token
+                    });
 
-          location.href = '../index.html'; //后台主页
+                    location.href = '../index.html'; //后台主页
+                }
+            });
         }
-      });
-    }
 
-    form.render();
+        form.render();
 
-    //提交
-    form.on('submit(component-form-element)', function(obj){
+        //提交
+        form.on('submit(component-form-element)', function (obj) {
 
-      //请求登入接口
-      admin.req({
-        url: '/admin/token/obtain/'
-        ,data: obj.field
-        ,type: 'post'
-        ,done: function(res){
+            //请求登入接口
+            admin.req({
+                url: '/admin/token/obtain/'
+                , data: obj.field
+                , type: 'post'
+                , done: function (res) {
 
-          //请求成功后,写入 access_token
-          layui.data(setter.tableName, {
-            key: setter.request.tokenName
-            ,value: 'JWT ' + res.data.token
-          });
-          layui.data(setter.tableName, {
-            key: setter.request.userId
-            ,value: res.data.user_id
-          });
-          layui.data(setter.tableName, {
-            key: 'name'
-            ,value: res.data.name ? res.data.name: res.data.username
-          });
+                    //请求成功后,写入 access_token
+                    layui.data(setter.tableName, {
+                        key: setter.request.tokenName
+                        , value: 'JWT ' + res.data.token
+                    });
+                    layui.data(setter.tableName, {
+                        key: setter.request.userId
+                        , value: res.data.user_id
+                    });
+                    layui.data(setter.tableName, {
+                        key: 'name'
+                        , value: res.data.name ? res.data.name : res.data.username
+                    });
 
-          //登入成功的提示与跳转
-          layer.msg('登入成功', {
-            offset: '15px'
-            ,icon: 1
-            ,time: 1000
-          }, function(){
-            location.href = '../index.html'; //后台主页
-          });
-        }
-      });
-      return false;
-      
+                    //登入成功的提示与跳转
+                    layer.msg('登入成功', {
+                        offset: '15px'
+                        , icon: 1
+                        , time: 1000
+                    }, function () {
+                        location.href = '../index.html'; //后台主页
+                    });
+                }
+            });
+            return false;
+
+        });
     });
-  });
-  </script>
+</script>
 </body>
-</html>
+</html>

+ 63 - 63
uis/layuiadmin/lib/view.js

@@ -4,9 +4,9 @@
  @Author:贤心
  @Site:http://www.layui.com/admin/
  @License:LPPL
-    
+
  */
- 
+
 layui.define(['laytpl', 'layer'], function(exports){
   var $ = layui.jquery
   ,laytpl = layui.laytpl
@@ -14,32 +14,32 @@ layui.define(['laytpl', 'layer'], function(exports){
   ,setter = layui.setter
   ,device = layui.device()
   ,hint = layui.hint()
-  
+
   //对外接口
   ,view = function(id){
     return new Class(id);
   }
-  
+
   ,SHOW = 'layui-show', LAY_BODY = 'LAY_app_body'
-  
+
   //构造器
   ,Class = function(id){
     this.id = id;
     this.container = $('#'+(id || LAY_BODY));
   };
-  
+
   //加载中
   view.loading = function(elem){
     elem.append(
       this.elemLoad = $('<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon layui-icon-loading layadmin-loading"></i>')
     );
   };
-    
+
   //移除加载
   view.removeLoad = function(){
     this.elemLoad && this.elemLoad.remove();
   };
-  
+
   //清除 token,并跳转到登入页
   view.exit = function(callback){
     //清空本地记录的 token
@@ -47,12 +47,12 @@ layui.define(['laytpl', 'layer'], function(exports){
       key: setter.request.tokenName
       ,remove: true
     });
-    
+
     //跳转到登入页
-    parent.location.href = '/tenant/account/login.html';
+    parent.location.href = '/admin/login/login.html';
     callback && callback();
   };
-  
+
   //Ajax请求
   view.req = function(options){
     var that = this
@@ -61,27 +61,27 @@ layui.define(['laytpl', 'layer'], function(exports){
     ,request = setter.request
     ,response = setter.response
     ,debug = function(){
-      return setter.debug 
+      return setter.debug
         ? '<br><cite>URL:</cite>' + options.url
       : '';
     };
-    
+
     options.data = options.data || {};
     options.headers = options.headers || {};
 
     if(request.tokenName){
       /*
       //自动给参数传入默认 token
-      options.data[request.tokenName] = request.tokenName in options.data 
+      options.data[request.tokenName] = request.tokenName in options.data
         ?  options.data[request.tokenName]
       : (layui.data(setter.tableName)[request.tokenName] || '');
       */
       //自动给 Request Headers 传入 token
-      options.headers[request.tokenName] = request.tokenName in options.headers 
+      options.headers[request.tokenName] = request.tokenName in options.headers
         ?  options.headers[request.tokenName]
       : (layui.data(setter.tableName)[request.tokenName] || '');
     }
-    
+
     delete options.success;
     delete options.error;
 
@@ -90,17 +90,17 @@ layui.define(['laytpl', 'layer'], function(exports){
       ,dataType: 'json'
       ,success: function(res){
         var statusCode = response.statusCode;
-        
+
         //只有 response 的 code 一切正常才执行 done
         if(res[response.statusName] == statusCode.ok) {
-          typeof options.done === 'function' && options.done(res); 
-        } 
-        
+          typeof options.done === 'function' && options.done(res);
+        }
+
         //登录状态失效,清除本地 access_token,并强制跳转到登入页
         else if(res[response.statusName] == statusCode.logout){
           view.exit();
         }
-        
+
         //其它异常
         else {
           var error = [
@@ -109,17 +109,17 @@ layui.define(['laytpl', 'layer'], function(exports){
           ].join('');
           view.error(error);
         }
-        
+
         //只要 http 状态码正常,无论 response 的 code 是否正常都执行 success
         typeof success === 'function' && success(res);
       }
       ,error: function(e, code){
         var error = [
-          '请求异常,请重试<br><cite>错误信息:</cite>'+ code 
+          '请求异常,请重试<br><cite>错误信息:</cite>'+ code
           ,debug()
         ].join('');
         view.error(error);
-        
+
         typeof error === 'function' && error(res);
       }
     }, options));
@@ -128,15 +128,15 @@ layui.define(['laytpl', 'layer'], function(exports){
   view.download = function(url){
     $('<form action="'+url+'" method="GET"></form>').appendTo('body').submit().remove();
   };
-  
+
   //弹窗
   view.popup = function(options){
     var success = options.success
     ,skin = options.skin;
-    
+
     delete options.success;
     delete options.skin;
-    
+
     return layer.open($.extend({
       type: 1
       ,title: '提示'
@@ -155,7 +155,7 @@ layui.define(['laytpl', 'layer'], function(exports){
       }
     }, options))
   };
-  
+
   //异常提示
   view.error = function(content, options){
     return view.popup($.extend({
@@ -167,16 +167,16 @@ layui.define(['laytpl', 'layer'], function(exports){
       ,id: 'LAY_adminError'
     }, options))
   };
-  
-  
+
+
   //请求模板文件渲染
   Class.prototype.render = function(views, params){
     var that = this, router = layui.router();
     views = setter.views + views + setter.engine;
-    
+
     $('#'+ LAY_BODY).children('.layadmin-loading').remove();
     view.loading(that.container); //loading
-    
+
     //请求模板
     $.ajax({
       url: views
@@ -187,51 +187,51 @@ layui.define(['laytpl', 'layer'], function(exports){
       }
       ,success: function(html){
         html = '<div>' + html + '</div>';
-        
+
         var elemTitle = $(html).find('title')
         ,title = elemTitle.text() || (html.match(/\<title\>([\s\S]*)\<\/title>/)||[])[1];
-        
+
         var res = {
           title: title
           ,body: html
         };
-        
+
         elemTitle.remove();
         that.params = params || {}; //获取参数
-        
+
         if(that.then){
           that.then(res);
-          delete that.then; 
+          delete that.then;
         }
 
         that.parse(html);
         view.removeLoad();
-        
+
         if(that.done){
           that.done(res);
-          delete that.done; 
+          delete that.done;
         }
-        
+
       }
       ,error: function(e){
         view.removeLoad();
-        
+
         if(that.render.isError){
           return view.error('请求视图文件异常,状态:'+ e.status);
         };
-        
+
         if(e.status === 404){
           that.render('template/tips/404');
         } else {
           that.render('template/tips/error');
         }
-        
+
         that.render.isError = true;
       }
     });
     return that;
   };
-  
+
   //解析模板
   Class.prototype.parse = function(html, refresh, callback){
     var that = this
@@ -240,13 +240,13 @@ layui.define(['laytpl', 'layer'], function(exports){
     ,elemTemp = isScriptTpl ? html : elem.find('*[template]')
     ,fn = function(options){
       var tpl = laytpl(options.dataElem.html());
-      
+
       options.dataElem.after(tpl.render($.extend({
         params: router.params
       }, options.res)));
 
       typeof callback === 'function' && callback();
-      
+
       try {
         options.done && new Function('d', options.done)(options.res);
       } catch(e){
@@ -254,12 +254,12 @@ layui.define(['laytpl', 'layer'], function(exports){
       }
     }
     ,router = layui.router();
-    
+
     elem.find('title').remove();
     that.container[refresh ? 'after' : 'html'](elem.children());
-    
+
     router.params = that.params || {};
-    
+
     //遍历模板区块
     for(var i = elemTemp.length; i > 0; i--){
       (function(){
@@ -268,21 +268,21 @@ layui.define(['laytpl', 'layer'], function(exports){
         ,url = laytpl(dataElem.attr('lay-url')|| '').render(router) //接口 url
         ,data = laytpl(dataElem.attr('lay-data')|| '').render(router) //接口参数
         ,headers = laytpl(dataElem.attr('lay-headers')|| '').render(router); //接口请求的头信息
-        
+
         try {
           data = new Function('return '+ data + ';')();
         } catch(e) {
           hint.error('lay-data: ' + e.message);
           data = {};
         };
-        
+
         try {
           headers = new Function('return '+ headers + ';')();
         } catch(e) {
           hint.error('lay-headers: ' + e.message);
           headers = headers || {}
         };
-        
+
         if(url){
           view.req({
             type: dataElem.attr('lay-type') || 'get'
@@ -306,10 +306,10 @@ layui.define(['laytpl', 'layer'], function(exports){
         }
       }());
     }
-    
+
     return that;
   };
-  
+
   //自动渲染数据模板
   Class.prototype.autoRender = function(id, callback){
     var that = this;
@@ -319,36 +319,36 @@ layui.define(['laytpl', 'layer'], function(exports){
       that.parse(othis, 'refresh');
     });
   };
-  
+
   //直接渲染字符
   Class.prototype.send = function(views, data){
     var tpl = laytpl(views || this.container.html()).render(data || {});
     this.container.html(tpl);
     return this;
   };
-  
+
   //局部刷新模板
   Class.prototype.refresh = function(callback){
     var that = this
     ,next = that.container.next()
     ,templateid = next.attr('lay-templateid');
-    
+
     if(that.id != templateid) return that;
-    
+
     that.parse(that.container, 'refresh', function(){
       that.container.siblings('[lay-templateid="'+ that.id +'"]:last').remove();
       typeof callback === 'function' && callback();
     });
-    
+
     return that;
   };
-  
+
   //视图请求成功后的回调
   Class.prototype.then = function(callback){
     this.then = callback;
     return this;
   };
-  
+
   //视图渲染完毕后的回调
   Class.prototype.done = function(callback){
     this.done = callback;
@@ -386,7 +386,7 @@ layui.define(['laytpl', 'layer'], function(exports){
             results = regex.exec(location.search);
         return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
     }
-  
+
   //对外接口
   exports('view', view);
-});
+});

+ 10 - 10
uis/layuiadmin/modules/common.js

@@ -4,9 +4,9 @@
  @Author:贤心
  @Site:http://www.layui.com/admin/
  @License:LPPL
-    
+
  */
- 
+
 layui.define(function(exports){
   var $ = layui.$
   ,layer = layui.layer
@@ -14,12 +14,12 @@ layui.define(function(exports){
   ,setter = layui.setter
   ,view = layui.view
   ,admin = layui.admin
-  
+
   //公共业务的逻辑处理可以写在此处,切换任何页面都会执行
   //……
-  
-  
-  
+
+
+
   //退出
   admin.events.logout = function(){
     //执行退出接口
@@ -29,7 +29,7 @@ layui.define(function(exports){
       ,type: 'get'
       ,data: {}
       ,done: function(res){ //这里要说明一下:done 是只有 response 的 code 正常才会执行。而 succese 则是只要 http 为 200 就会执行
-        
+
         //清空本地记录的 token,并跳转到登入页
         admin.exit(function(){
           location.href = '/views/account/login.html';
@@ -38,11 +38,11 @@ layui.define(function(exports){
     });
     */
     admin.exit(function(){
-        location.href = '/tenant/account/login.html';
+        location.href = '/admin/login/login.html';
       });
   };
 
-  
+
   //对外暴露的接口
   exports('common', {});
-});
+});