mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-06 05:30:05 +00:00
Web 服务
This commit is contained in:
BIN
resource/static/logo.png
Normal file
BIN
resource/static/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
57
resource/static/main.css
Normal file
57
resource/static/main.css
Normal file
@@ -0,0 +1,57 @@
|
||||
@media only screen and (min-width: 1200px) {
|
||||
.ui.container {
|
||||
width: 77%;
|
||||
}
|
||||
}
|
||||
|
||||
.login-form {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.login-form .column {
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
.login-form .grid {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.nb-container {
|
||||
margin-top: 75px;
|
||||
}
|
||||
|
||||
.avatar-list img {
|
||||
width: 2.6rem !important;
|
||||
height: 2.6rem !important;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.card-list {
|
||||
width: 100% !important;
|
||||
padding-right: unset !important;
|
||||
}
|
||||
|
||||
.card-list .card {
|
||||
width: calc(33.33333333% - 1.1em) !important;
|
||||
margin-right: unset !important;
|
||||
margin-top: unset !important;
|
||||
|
||||
}
|
||||
|
||||
.card-list .card:nth-child(1) {
|
||||
margin-top: 0.875em !important;
|
||||
}
|
||||
|
||||
.card-list .card:nth-child(2) {
|
||||
margin-top: 0.875em !important;
|
||||
}
|
||||
|
||||
.card-list .card:nth-child(3) {
|
||||
margin-top: 0.875em !important;
|
||||
}
|
||||
|
||||
.grid-list>.grid>.row {
|
||||
border-bottom: solid gainsboro 2px;
|
||||
padding-bottom: .6em;
|
||||
margin-bottom: .6em;
|
||||
}
|
||||
79
resource/static/main.js
Normal file
79
resource/static/main.js
Normal file
@@ -0,0 +1,79 @@
|
||||
$('.ui.checkbox').checkbox();
|
||||
$('.ui.dropdown').dropdown();
|
||||
|
||||
const confirmBtn = $('.mini.confirm.modal .positive.button')
|
||||
function showConfirm(title, content, callFn, extData) {
|
||||
const modal = $('.mini.confirm.modal')
|
||||
modal.children('.header').text(title)
|
||||
modal.children('.content').text(content)
|
||||
if (confirmBtn.hasClass('loading')) {
|
||||
return false
|
||||
}
|
||||
modal.modal({
|
||||
closable: true,
|
||||
onApprove: function () {
|
||||
confirmBtn.toggleClass('loading')
|
||||
callFn(extData)
|
||||
return false
|
||||
}
|
||||
}).modal('show')
|
||||
}
|
||||
|
||||
function showFormModal(modelSelector, formID, URL, getData) {
|
||||
$(modelSelector).modal({
|
||||
closable: true,
|
||||
onApprove: function () {
|
||||
let success = false
|
||||
const btn = $(modelSelector + ' .positive.button')
|
||||
const form = $(modelSelector + ' form')
|
||||
if (btn.hasClass('loading')) {
|
||||
return success
|
||||
}
|
||||
form.children('.message').remove()
|
||||
btn.toggleClass('loading')
|
||||
const data = getData ? getData() : $(formID).serializeArray().reduce(function (obj, item) {
|
||||
obj[item.name] = (item.name.endsWith('_id') || item.name === 'id' || item.name === 'permission') ? parseInt(item.value) : item.value;
|
||||
return obj;
|
||||
}, {});
|
||||
$.post(URL, JSON.stringify(data)).done(function (resp) {
|
||||
if (resp.code == 200) {
|
||||
if (resp.message) {
|
||||
alert(resp.message)
|
||||
}
|
||||
window.location.reload()
|
||||
} else {
|
||||
form.append(`<div class="ui negative message"><div class="header">操作失败</div><p>` + resp.message + `</p></div>`)
|
||||
}
|
||||
}).fail(function (err) {
|
||||
form.append(`<div class="ui negative message"><div class="header">网络错误</div><p>` + err.responseText + `</p></div>`)
|
||||
}).always(function () {
|
||||
btn.toggleClass('loading')
|
||||
});
|
||||
return success
|
||||
}
|
||||
}).modal('show')
|
||||
}
|
||||
|
||||
function logout(id) {
|
||||
$.post('/api/logout', JSON.stringify({ id: id })).done(function (resp) {
|
||||
if (resp.code == 200) {
|
||||
$.suiAlert({
|
||||
title: '注销成功',
|
||||
type: 'success',
|
||||
time: '3',
|
||||
position: 'top-center',
|
||||
});
|
||||
window.location.reload()
|
||||
} else {
|
||||
$.suiAlert({
|
||||
title: '注销失败',
|
||||
description: resp.code + ':' + resp.message,
|
||||
type: 'error',
|
||||
time: '3',
|
||||
position: 'top-center',
|
||||
});
|
||||
}
|
||||
}).fail(function (err) {
|
||||
alert('网络错误:' + err.responseText)
|
||||
})
|
||||
}
|
||||
1
resource/static/semantic-ui-alerts.min.css
vendored
Normal file
1
resource/static/semantic-ui-alerts.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.ui-alerts{position:fixed;z-index:2060;padding:23px}.ui-alerts.center{top:50%;left:50%;margin-top:-100px;margin-left:-222px}.ui-alerts.top-right{top:20px;right:20px}.ui-alerts.top-center{top:20px;margin-left:-222px;left:50%}.ui-alerts.top-left{top:20px;left:20px}.ui-alerts.bottom-right{bottom:0;right:20px}.ui-alerts.bottom-center{bottom:0;margin-left:-222px;left:50%}.ui-alerts.bottom-left{bottom:0;left:20px}.ui-alerts.ui-alerts>.message>.content>.header{padding-right:13px}@media (min-width:320px){.ui-alerts.top-center{margin-left:-163px}}
|
||||
1
resource/static/semantic-ui-alerts.min.js
vendored
Normal file
1
resource/static/semantic-ui-alerts.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
$.suiAlert=function(i){function t(){l=setTimeout(function(){c.transition({animation:e,duration:"2s",onComplete:function(){c.remove()}})},1e3*o.time)}var o=$.extend({title:"Semantic UI Alerts",description:"semantic ui alerts library",type:"error",time:5,position:"top-right",icon:!1},i);o.icon===!1&&("info"==o.type?o.icon="announcement":"success"==o.type?o.icon="checkmark":"error"==o.type?o.icon="remove":"warning"==o.type&&(o.icon="warning circle"));var e="drop";"top-right"==o.position?e="fly left":"top-center"==o.position?e="fly down":"top-left"==o.position?e="fly right":"bottom-right"==o.position?e="fly left":"bottom-center"==o.position?e="fly up":"bottom-left"==o.position&&(e="fly right");var n="",r=$(window).width();r<425&&(n="mini");var s="ui-alerts."+o.position;$("body > ."+s).length||$("body").append('<div class="ui-alerts '+o.position+'"></div>');var c=$('<div class="ui icon floating '+n+" message "+o.type+'" id="alert"> <i class="'+o.icon+' icon"></i> <i class="close icon" id="alertclose"></i> <div class="content"> <div class="header">'+o.title+"</div> <p>"+o.description+"</p> </div> </div>");$("."+s).prepend(c),c.transition("pulse"),$("#alertclose").on("click",function(){$(this).closest("#alert").transition({animation:e,onComplete:function(){c.remove()}})});var l=0;$(c).mouseenter(function(){clearTimeout(l)}).mouseleave(function(){t()}),t()};
|
||||
9
resource/template/common/footer.html
Normal file
9
resource/template/common/footer.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{{define "common/footer"}}
|
||||
<script src="https://cdnjs.loli.net/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.loli.net/ajax/libs/semantic-ui/2.4.1/semantic.min.js"></script>
|
||||
<script src="/static/semantic-ui-alerts.min.js"></script>
|
||||
<script src="/static/main.js?t_={{fs}}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
{{end}}
|
||||
17
resource/template/common/header.html
Normal file
17
resource/template/common/header.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{{define "common/header"}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>{{.Title}}</title>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.loli.net/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/semantic-ui-alerts.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/main.css?t_={{fs}}">
|
||||
<link rel="shortcut icon" type="image/png" href="/static/logo.png" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{end}}
|
||||
31
resource/template/common/menu.html
Normal file
31
resource/template/common/menu.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{{define "common/menu"}}
|
||||
<div class="ui large top fixed menu nb-menu">
|
||||
<div class="ui container">
|
||||
<div class="item">
|
||||
<img src="/static/logo.png">
|
||||
</div>
|
||||
<a class="item{{if eq .MatchedPath "/"}} active{{end}}" href="/">首页</a>
|
||||
<div class="right menu">
|
||||
<a class="item" href="https://github.com/p14yground/nezha/issues" target="_blank">反馈</a>
|
||||
<div class="item">
|
||||
{{if .Admin}}
|
||||
<div class="ui simple dropdown">
|
||||
<div class="text">
|
||||
<img class="ui avatar image" src="{{.Admin.AvatarURL}}"> {{.Admin.Name}}
|
||||
</div>
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<button class="item" onclick="showConfirm('确认注销?','注销后您必须重新登录才能使用',logout,{{.Admin.ID}})">
|
||||
<i class="logout icon"></i>注销登录
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<a href="/login" class="ui large teal button">登录</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "component/confirm" .}}
|
||||
{{end}}
|
||||
12
resource/template/component/confirm.html
Normal file
12
resource/template/component/confirm.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{define "component/confirm"}}
|
||||
<div class="ui mini confirm modal transition hidden">
|
||||
<div class="header"></div>
|
||||
<div class="content">
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="ui negative button">取消</div>
|
||||
<button class="ui positive right labeled icon button">确认<i class="checkmark icon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
22
resource/template/page/error.html
Normal file
22
resource/template/page/error.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{define "page/error"}}
|
||||
{{template "common/header" .}}
|
||||
<div class="login-form">
|
||||
<div class="ui middle aligned center aligned grid">
|
||||
<div class="column">
|
||||
<h2 class="ui teal image header">
|
||||
<img src="/static/logo.png" class="image">
|
||||
<div class="content">
|
||||
访问受限
|
||||
</div>
|
||||
</h2>
|
||||
<div class="ui message">
|
||||
<p>
|
||||
{{.Msg}}
|
||||
</p>
|
||||
<a href="{{.Link}}">{{.Btn}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "common/footer" .}}
|
||||
{{end}}
|
||||
10
resource/template/page/home.html
Normal file
10
resource/template/page/home.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{define "page/home"}}
|
||||
{{template "common/header" .}}
|
||||
{{template "common/menu" .}}
|
||||
<div class="nb-container">
|
||||
<div class="ui container">
|
||||
{{.Admin}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "common/footer" .}}
|
||||
{{end}}
|
||||
20
resource/template/page/login.html
Normal file
20
resource/template/page/login.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{{define "page/login"}}
|
||||
{{template "common/header" .}}
|
||||
<div class="login-form">
|
||||
<div class="ui middle aligned center aligned grid">
|
||||
<div class="column">
|
||||
<h2 class="ui teal image header">
|
||||
<img src="static/logo.png" class="image">
|
||||
<div class="content">
|
||||
使用 GitHub 账号登录
|
||||
</div>
|
||||
</h2>
|
||||
<a href="/oauth2/login" class="ui fluid large teal submit button">登录</a>
|
||||
<div class="ui message">
|
||||
没有账号? <a href="https://github.com/join" target="_blank">注册</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "common/footer" .}}
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user