更换 alert 为 bootstrap 的 modal
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
define("login", ["jquery", "validation"], function($){
|
define("login", ["jquery", "bs_alert", "validation"], function($, bs_alert){
|
||||||
$("#login-form")
|
$("#login-form")
|
||||||
.formValidation({
|
.formValidation({
|
||||||
framework: "bootstrap",
|
framework: "bootstrap",
|
||||||
@@ -33,12 +33,10 @@ define("login", ["jquery", "validation"], function($){
|
|||||||
window.location.href="/";
|
window.location.href="/";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
alert(data.data);
|
bs_alert(data.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
require(["../config"], function(){
|
require(["../config"], function(){
|
||||||
require(["login"])
|
require(["bootstrap", "login"])
|
||||||
});
|
});
|
||||||
@@ -13,6 +13,8 @@ require.config({
|
|||||||
code_mirror: "../utils/code_mirror",
|
code_mirror: "../utils/code_mirror",
|
||||||
login: "../app/account/login",
|
login: "../app/account/login",
|
||||||
oj: "../app/oj",
|
oj: "../app/oj",
|
||||||
|
"bs_alert": "../utils/bs_alert",
|
||||||
|
|
||||||
|
|
||||||
//formValidation 不要在代码中单独使用,而是使用和修改utils/validation
|
//formValidation 不要在代码中单独使用,而是使用和修改utils/validation
|
||||||
base: "formValidation/base",
|
base: "formValidation/base",
|
||||||
@@ -33,7 +35,13 @@ require.config({
|
|||||||
|
|
||||||
//code mirroe 代码编辑器
|
//code mirroe 代码编辑器
|
||||||
_code_mirror: "codeMirror/codemirror",
|
_code_mirror: "codeMirror/codemirror",
|
||||||
code_mirror_clang: "codeMirror/language/clike"
|
code_mirror_clang: "codeMirror/language/clike",
|
||||||
|
|
||||||
|
//bootstrap
|
||||||
|
bootstrap: "bootstrap/bootstrap"
|
||||||
|
|
||||||
|
},
|
||||||
|
shim: {
|
||||||
|
"bootstrap": {"deps": ['jquery']}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
7
static/src/js/utils/bs_alert.js
Normal file
7
static/src/js/utils/bs_alert.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
define("bs_alert", ["jquery", "bootstrap"], function($){
|
||||||
|
function bs_alert(content){
|
||||||
|
$("#modal-text").html(content);
|
||||||
|
$("#modal").modal();
|
||||||
|
}
|
||||||
|
return bs_alert;
|
||||||
|
});
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<!-- custom css end -->
|
<!-- custom css end -->
|
||||||
|
|
||||||
<!-- global css begin -->
|
<!-- global css begin -->
|
||||||
<link href="/static/css/app.css" rel="stylesheet">
|
<link href="/static/css/oj.css" rel="stylesheet">
|
||||||
<!-- global css end -->
|
<!-- global css end -->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -75,6 +75,24 @@
|
|||||||
|
|
||||||
<!-- custom body begin -->
|
<!-- custom body begin -->
|
||||||
{% block body %}{% endblock %}
|
{% block body %}{% endblock %}
|
||||||
|
<div class="modal fade" id="modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-sm">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||||
|
aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title">提示</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p id="modal-text"></p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- custom body end -->
|
<!-- custom body end -->
|
||||||
<script src="/static/js/require.js" data-main="/static/js/app/oj.js"></script>
|
<script src="/static/js/require.js" data-main="/static/js/app/oj.js"></script>
|
||||||
<!-- footer begin -->
|
<!-- footer begin -->
|
||||||
|
|||||||
Reference in New Issue
Block a user