增加 web_base_url 配置, 用于配置 web 后台可置于代理子路径下

This commit is contained in:
涵曦
2019-05-10 16:29:55 +00:00
parent 4b7b2f4c27
commit 383dbd1b7b
21 changed files with 124 additions and 73 deletions

View File

@@ -8,10 +8,10 @@
<title>nps admin login</title>
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="{{.web_base_url}}/static/css/bootstrap.min.css" rel="stylesheet">
<link href="{{.web_base_url}}/static/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/static/css/style.css" rel="stylesheet">
<link href="{{.web_base_url}}/static/css/style.css" rel="stylesheet">
</head>
@@ -49,7 +49,7 @@
</div>
<button onclick="login()" class="btn btn-primary block full-width m-b">login</button>
{{if eq true .register_allow}}
<a class="btn btn-sm btn-white btn-block" href="/login/register">register</a>
<a class="btn btn-sm btn-white btn-block" href="{{.web_base_url}}/login/register">register</a>
{{end}}
</form>
</div>
@@ -59,7 +59,7 @@
</div>
</body>
<script src="/static/js/jquery-2.1.1.js"></script>
<script src="{{.web_base_url}}/static/js/jquery-2.1.1.js"></script>
</html>
@@ -68,11 +68,11 @@
function login() {
$.ajax({
type: "POST",
url: "/login/verify",
url: "{{.web_base_url}}/login/verify",
data: $("form").serializeArray(),
success: function (res) {
if (res.status) {
window.location.href = "/index/index"
window.location.href = "{{.web_base_url}}/index/index"
} else {
alert(res.msg)
}