diff --git a/application/admin/controller/User.php b/application/admin/controller/User.php index 33c9fa3..e22ca57 100644 --- a/application/admin/controller/User.php +++ b/application/admin/controller/User.php @@ -65,4 +65,8 @@ class User extends Base { return $this->fetch(); } } + + public function add(){ + + } } \ No newline at end of file diff --git a/application/admin/view/user/login.html b/application/admin/view/user/login.html index 9fb4370..549d853 100644 --- a/application/admin/view/user/login.html +++ b/application/admin/view/user/login.html @@ -21,7 +21,7 @@

请填写您的账号名和密码

-
+
@@ -32,7 +32,7 @@
- + 登 录
@@ -43,6 +43,10 @@ + + + + diff --git a/public/static/admin/dist/js/template.js b/public/static/admin/dist/js/template.js index ae7583b..4316d65 100644 --- a/public/static/admin/dist/js/template.js +++ b/public/static/admin/dist/js/template.js @@ -4,83 +4,111 @@ * You should not use this file in production. * This file is for demo purposes only. */ -$.AdminTemplate = {}; -/** - * 格式化时间戳(为了和PHP的date函数统一,这里的时间戳都是10位,不包含毫秒) - * @param timestamp - * @returns {string} - */ -var formatDate = function ( timestamp ) { - timestamp *= 1000; - var date = new Date(timestamp); - var Y = date.getFullYear() + '-'; - var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'; - var D = (date.getDate()+1 < 10 ? '0'+(date.getDate()+1) : date.getDate()+1) + ' '; - var h = date.getHours() + ':'; - var m = date.getMinutes() + ':'; - var s = date.getSeconds(); - return Y+M+D+h+m+s; -}; - -(function ($, AdminTemplate) { +(function ($) { "use strict"; + $(function() { + /** + * 格式化时间戳(为了和PHP的date函数统一,这里的时间戳都是10位,不包含毫秒) + * @param timestamp + * @returns {string} + */ + $.formatDate = function ( timestamp ) { + timestamp *= 1000; + var date = new Date(timestamp); + var Y = date.getFullYear() + '-'; + var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'; + var D = (date.getDate()+1 < 10 ? '0'+(date.getDate()+1) : date.getDate()+1) + ' '; + var h = date.getHours() + ':'; + var m = date.getMinutes() + ':'; + var s = date.getSeconds(); + return Y+M+D+h+m+s; + }; - AdminTemplate.buildDom = function ( jsonStr ) { + $.alertMsg = function( msg ){ + var dialog = bootbox.dialog({ + message: '

'+msg+'

', + closeButton: false + }); + setTimeout(function(){ + dialog.modal('hide'); + }, 2000); + }; - }; + $.buildDom = function ( jsonStr ) { - var emptyList = function() { + }; - }; + var emptyList = function() { - var easyList = function( listObj ) { + }; - }; + var easyList = function( listObj ) { - var topButton = function( topObj ) { + }; - }; + var topButton = function( topObj ) { - var rightButton = function( rightObj ) { + }; - }; + var rightButton = function( rightObj ) { - var easyForm = function( formObj ) { + }; - }; + var easyForm = function( formObj ) { - var input = function( inputObj ) { + }; - }; + var input = function( inputObj ) { - var select = function( selectObj ) { + }; - }; + var select = function( selectObj ) { - var button = function( buttonObj ) { + }; - }; + var button = function( buttonObj ) { - /** - * 面包屑 - */ - var breadcrumb = function( ) { + }; - }; + /** + * 面包屑 + */ + var breadcrumb = function( ) { - AdminTemplate.a = function () { + }; - }; + //ajax post submit请求 + $('body').on('click', '.ajax-post', function() { + var message,query,form,target; + var target_form = $(this).attr('target-form'); - AdminTemplate.alertMsg = function( msg ){ - var dialog = bootbox.dialog({ - message: '

'+msg+'

', - closeButton: false + if ( $(this).attr('type') == 'submit' ) { + form = $('#' + target_form); + query = form.serialize(); + target = form.attr('action'); + $.post(target, query).success(function(data) { + if (data.status == 1) { + if (data.url) { + message = data.msg + ' 页面即将自动跳转~'; + } else { + message = data.msg; + } + $.alertMsg(message); + setTimeout(function() { + if (data.url) { + location.href = data.url; + } else { + location.reload(); + } + }, 2000); + } else { + $.alertMsg(data.msg); + } + }); + } + return false; }); - setTimeout(function(){ - dialog.modal('hide'); - }, 3000); - } + }); -})(jQuery, $.AdminTemplate); +})(jQuery);