short url web page v1

This commit is contained in:
kenneth
2023-12-25 17:04:22 +08:00
parent f27023c2ac
commit c1f4731669
45 changed files with 1637 additions and 93 deletions

7
web/static/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

100
web/static/css/index.css Normal file
View File

@@ -0,0 +1,100 @@
@charset "utf-8";
html,
body {
/* 禁用空格键的滚动 */
scroll-behavior: auto;
}
.flex {
display: flex;
}
.flex-row {
flex-direction: row;
}
.flex-column {
flex-direction: column;
}
.justify-content {
justify-content: center;
}
.align-items {
align-items: center;
}
.navbar-wh {
padding: 0.2rem 1.6rem;
border-bottom: 1px solid rgba(0, 0, 0, .12);
}
.navbar-brand-fs {
font-size: 1rem;
}
.logo {
width: 2.2rem;
height: 2.2rem;
fill: currentColor;
/* color: #f44336; */
color: #007bff;
}
.oauth {
align-items: center;
list-style-type: none;
height: 40px;
margin-bottom: 0;
}
.oauth li {
margin-left: 10px;
}
.main {
max-width: 1280px;
width: 100%;
padding-bottom: 60px;
}
.main .title {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 30px;
}
.main .title a {
height: 35px;
}
.tip-box {
width: 100%;
background-color: rgb(229, 246, 253);
padding: 1rem;
border-radius: 3px;
display: flex;
margin-top: 10px;
}
.tip-box .tip-icon {
width: 24px;
margin-right: 12px;
}
.tip-box .tip-icon svg {
fill: currentColor;
color: #007bff;
}
.tip-box .tip-info p {
letter-spacing: 0.00938em;
font-size: 13px;
font-weight: 400;
color: rgb(1, 67, 97);
margin-bottom: 0;
line-height: 24px;
}

7
web/static/js/bootstrap.bundle.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

7
web/static/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
web/static/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,20 @@
<!-- <!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="/statics/css/bootstrap.min.css" />
<title>HLS流媒体</title>
{{block "css" .}}{{end}}
</head>
<body>
<div class="wrapper"> -->
{{define "footer"}}
</div>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.bundle.min.js"></script>
{{block "js" .}}{{end}}
</body>
</html>
{{end}}

View File

@@ -0,0 +1,44 @@
{{define "header"}}
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="shortcut icon" href="/statics/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="/static/css/bootstrap.min.css" />
<link rel="stylesheet" href="/static/css/index.css" />
{{block "css" .}}{{end}}
<title>URL段地址服务</title>
</head>
<body>
<div class="wrapper">
<nav class="navbar navbar-light bg-light navbar-wh">
<a class="navbar-brand navbar-brand-fs" href="/">
URL段地址服务
</a>
<ul class="flex oauth">
{{if currentUser}}
<li style="font-size: 12px;">
欢迎您: {{ currentUser.Name }}
</li>
<li style="font-size: 12px;">
<a href="/logout" class="btn btn-primary btn-sm">退出</a>
</li>
{{else}}
<li>
<a href="/login" class="btn btn-outline-primary btn-sm">登录</a>
</li>
<li>
<a href="/register" class="btn btn-primary btn-sm">注册</a>
</li>
{{end}}
</ul>
</nav>
{{end}}
<!-- </div>
<script src="/statics/js/jquery.slim.min.js"></script>
<script src="/statics/js/bootstrap.bundle.min.js"></script>
</body>
</html> -->

View File

@@ -0,0 +1,56 @@
{{template "header" .}}
<div class="container-fluid flex justify-content">
<div class="main">
<h3 style="margin-top: 20px;margin-bottom: 10px;">短地址列表 <a class="btn btn-primary"
href="/create-short-url">添加</a></h3>
<table class="my_table" style="display: block;">
<tr>
<th width="600px">原地址</th>
<th width="320px">短地址</th>
<th width="80px">是否有效</th>
<th width="80px">删除</th>
</tr>
{{range .}}
<tr>
<td width="600px">{{.OriginUrl}}</td>
<td width="320px"><a target="_blank" href="{{.ShortUrl}}">{{.ShortUrl}}</a></td>
<td width="80px">
{{if eq .Status 0}}
<code>YES</code>
{{else}}
<code>NO</code>
{{end}}
</td>
<td width="80px">delete</td>
</tr>
{{end}}
</table>
</div>
</div>
{{define "css"}}
<style>
.my_table {
display: block;
max-width: 1280px;
}
.my_table tr {
display: inline-block;
width: 100%;
border: 1px solid #eee;
border-collapse: collapse;
}
.my_table tr td {
display: inline-block;
word-wrap: break-word;
padding: 2px 5px;
}
</style>
{{end}}
{{define "js"}}
<script>
</script>
{{end}}
{{template "footer" .}}

View File

@@ -0,0 +1,25 @@
{{template "header" .}}
<div class="container">
<div class="flex flex-column align-items row py-md-5 mt-md-5">
<h1>创建短路径</h1>
<div class="col-sm-4 py-md-5">
<form action="/create-short-url" method="post">
{{ csrfField }}
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">原路径</span>
</div>
<input type="text" name="long_url" class="form-control" required id="long_url">
</div>
</div>
<button type="submit" class="btn btn-primary btn-block">创建</button>
</form>
{{if .}}
<div class="py-md-5" style="color: #f44336;">
</div>
{{end}}
</div>
</div>
</div>
{{template "footer" .}}

View File

@@ -0,0 +1,42 @@
{{template "header" .}}
<div class="container">
<div class="flex flex-column align-items row py-md-5 mt-md-5">
<h1>登录</h1>
<div class="col-sm-4 py-md-5">
<form action="/login" method="post">
{{ csrfField }}
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">邮箱</span>
</div>
<input type="email" name="email" class="form-control" required id="email" value="{{.Email}}"
aria-describedby="emailValid">
</div>
{{if .EmailMsg}}
<small id="emailValid" style="color: #f44336;" class="form-text">{{.EmailMsg}}</small>
{{end}}
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">密码</span>
</div>
<input type="password" name="password" class="form-control" required id="password"
value="{{.Password}}" aria-describedby="passwordValid">
</div>
{{if .PasswordMsg}}
<small id="passwordValid" style="color: #f44336;" class="form-text">{{.PasswordMsg}}</small>
{{end}}
</div>
<button type="submit" class="btn btn-primary btn-block">提交</button>
</form>
{{if .Summary}}
<div class="py-md-5" style="color: #f44336;">
{{.Summary}}
</div>
{{end}}
</div>
</div>
</div>
{{template "footer" .}}

View File

@@ -0,0 +1,54 @@
{{template "header" .}}
<div class="container">
<div class="flex flex-column align-items row py-md-5 mt-md-5">
<h1>注册</h1>
<div class="col-sm-4 py-md-5">
<form action="/register" method="post">
{{ csrfField }}
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">邮箱</span>
</div>
<input type="email" name="email" class="form-control" required id="email" value="{{.Email}}"
aria-describedby="emailValid">
</div>
{{if .EmailMsg}}
<small id="emailValid" style="color: #f44336;" class="form-text">{{.EmailMsg}}</small>
{{end}}
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">名称</span>
</div>
<input type="text" name="username" class="form-control" required id="username"
value="{{.Username}}" aria-describedby="usernameValid">
</div>
{{if .UsernameMsg}}
<small id="usernameValid" style="color: #f44336;" class="form-text">{{.UsernameMsg}}</small>
{{end}}
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">密码</span>
</div>
<input type="password" name="password" class="form-control" required id="password"
value="{{.Password}}" aria-describedby="passwordValid">
</div>
{{if .PasswordMsg}}
<small id="passwordValid" style="color: #f44336;" class="form-text">{{.PasswordMsg}}</small>
{{end}}
</div>
<button type="submit" class="btn btn-primary btn-block">提交</button>
</form>
{{if .Summary}}
<div class="py-md-5" style="color: #f44336;">
{{.Summary}}
</div>
{{end}}
</div>
</div>
</div>
{{template "footer" .}}