style formatting
This commit is contained in:
parent
2556570fc9
commit
0f62a418ec
@ -1,52 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta name="description" content="web-gpt"/>
|
||||
<meta name="keywords" content="web-gpt"/>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Flask</title>
|
||||
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css" />
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css"/>
|
||||
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
|
||||
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-default" role="navigation">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse"
|
||||
data-target="#account-navbar-collapse">
|
||||
<span class="sr-only">切换导航</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{{ url_for('main.index') }}">主页</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" style="float: right;" id="account-navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li id="navbar-profile"><a href="{{ url_for('main.profile') }}">账户</a></li>
|
||||
<li id="navbar-login"><a href="{{ url_for('auth.login') }}">登录</a></li>
|
||||
<li id="navbar-signup"><a href="{{ url_for('auth.signup') }}">注册</a></li>
|
||||
<li id="navbar-logout"><a href="{{ url_for('auth.logout') }}">退出</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button"
|
||||
class="navbar-toggle"
|
||||
data-toggle="collapse"
|
||||
data-target="#account-navbar-collapse">
|
||||
<span class="sr-only">切换导航</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{{ url_for('main.index') }}">主页</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse"
|
||||
style="float: right"
|
||||
id="account-navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li id="navbar-profile">
|
||||
<a href="{{ url_for('main.profile') }}">账户</a>
|
||||
</li>
|
||||
<li id="navbar-login">
|
||||
<a href="{{ url_for('auth.login') }}">登录</a>
|
||||
</li>
|
||||
<li id="navbar-signup">
|
||||
<a href="{{ url_for('auth.signup') }}">注册</a>
|
||||
</li>
|
||||
<li id="navbar-logout">
|
||||
<a href="{{ url_for('auth.logout') }}">退出</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="hero-body">
|
||||
<div class="container has-text-centered">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class="container has-text-centered">
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
{% if user and user.is_authenticated %}
|
||||
var navbar_hide_element = ["navbar-login", "navbar-signup"];
|
||||
{% else%}
|
||||
{% else %}
|
||||
var navbar_hide_element = ["navbar-profile", "navbar-logout"];
|
||||
{% endif %}
|
||||
navbar_hide_element.forEach(element => {
|
||||
@ -56,6 +68,5 @@
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,34 +1,30 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2 class="subtitle">
|
||||
<h2 class="subtitle">
|
||||
{% if user and user.is_authenticated %}
|
||||
你好,{{ user.name }}!
|
||||
{% else %}
|
||||
你好,游客!
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% if user and user.is_authenticated %}
|
||||
你好,{{ user.name }}!
|
||||
{% else%}
|
||||
你好,游客!
|
||||
{% if user.isActivated %}
|
||||
<a href="{{ url_for('main.chat') }}">
|
||||
<button type="button" class="btn btn-primary">开始聊天</button>
|
||||
</a>
|
||||
{% else %}
|
||||
<p class="text-warning">您的账号暂未激活,请等待管理员激活此账号。</p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<a href="{{ url_for('auth.login') }}">
|
||||
<button type="button" class="btn btn-primary">登录</button>
|
||||
</a>
|
||||
或
|
||||
<a href="{{ url_for('auth.signup') }}">
|
||||
<button type="button" class="btn btn-default">注册</button>
|
||||
</a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
|
||||
{% if user and user.is_authenticated %}
|
||||
{% if user.isActivated %}
|
||||
<a href="{{ url_for('main.chat') }}"><button type="button" class="btn btn-primary">开始聊天</button></a>
|
||||
{% else%}
|
||||
<p class="text-warning">您的账号暂未激活,请等待管理员激活此账号。</p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<a href="{{ url_for('auth.login') }}"><button type="button" class="btn btn-primary">登录</button></a>
|
||||
或
|
||||
<a href="{{ url_for('auth.signup') }}"><button type="button" class="btn btn-default">注册</button></a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="notification is-danger">
|
||||
{{ messages[0] }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% endblock %}
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}<div class="notification is-danger">{{ messages[0] }}</div>{% endif %}
|
||||
{% endwith %}
|
||||
{% endblock content %}
|
||||
|
@ -1,36 +1,37 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="column is-4 is-offset-4">
|
||||
<div class="column is-4 is-offset-4">
|
||||
<h3 class="title">登录</h3>
|
||||
<div class="box">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="notification is-danger">
|
||||
{{ messages[0] }}
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}<div class="notification is-danger">{{ messages[0] }}</div>{% endif %}
|
||||
{% endwith %}
|
||||
<form method="post" action="{{ url_for('auth.login') }}">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large"
|
||||
type="email"
|
||||
name="email"
|
||||
placeholder="邮箱"
|
||||
autofocus=""/>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<form method="POST" action="/login">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="email" name="email" placeholder="Your Email" autofocus="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="password" name="password" placeholder="Your Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="remember">
|
||||
记住我
|
||||
</label>
|
||||
</div>
|
||||
<button class="button is-block is-info is-large is-fullwidth">登录</button>
|
||||
</form>
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large"
|
||||
type="password"
|
||||
name="password"
|
||||
placeholder="密码"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="remember"/>
|
||||
记住我
|
||||
</label>
|
||||
</div>
|
||||
<button class="button is-block is-info is-large is-fullwidth">登录</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
@ -1,53 +1,56 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2 class="subtitle">
|
||||
{% if user.is_authenticated and user.role == "admin" %}
|
||||
<h3 class="subtitle" style="text-align: left;">注册账户列表:</h3>
|
||||
<table class="table" id="account-list-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th abbr="id" scope="col">id</th>
|
||||
<th abbr="email" scope="col">邮箱</th>
|
||||
<th abbr="name" scope="col">用户名</th>
|
||||
<th abbr="role" scope="col">角色</th>
|
||||
<th abbr="isActivated" scope="col">已激活</th>
|
||||
<th abbr="btn-submit" style="display:none" scope="col">提交</th>
|
||||
<th abbr="btn-delete" style="display:none" scope="col">删除</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for account in accounts %}
|
||||
<tr id="{{ 'account-%d'|format(account.id) }}">
|
||||
<td scope="row">{{ account.id }}</td>
|
||||
<td>{{ account.email }}</td>
|
||||
<td>{{ account.name }}</td>
|
||||
<td>
|
||||
<select>
|
||||
<option value="admin" {% if account.role=="admin" %}selected{% endif %}>admin</option>
|
||||
<option value="user" {% if account.role=="user" %}selected{% endif %}>user</option>
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="checkbox" {% if account.isActivated %}checked{% else %}unchecked{% endif %}></td>
|
||||
<td><button class="btn btn-info" onclick="submit_account(this)">提交</button></td>
|
||||
<td><button class="btn btn-danger" onclick="delete_account(this)">删除</button></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</h2>
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="notification is-danger">
|
||||
{{ messages[0] }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<script>
|
||||
<h2 class="subtitle">
|
||||
{% if user.is_authenticated and user.role == "admin" %}
|
||||
<h3 class="subtitle text-left">注册账户列表:</h3>
|
||||
<table class="table" id="account-list-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th abbr="id" scope="col">id</th>
|
||||
<th abbr="email" scope="col">邮箱</th>
|
||||
<th abbr="name" scope="col">用户名</th>
|
||||
<th abbr="role" scope="col">角色</th>
|
||||
<th abbr="isActivated" scope="col">已激活</th>
|
||||
<th abbr="btn-submit" class="d-none" scope="col">提交</th>
|
||||
<th abbr="btn-delete" class="d-none" scope="col">删除</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for account in accounts %}
|
||||
<tr id="{{ 'account-%d'|format(account.id) }}">
|
||||
<td scope="row">{{ account.id }}</td>
|
||||
<td>{{ account.email }}</td>
|
||||
<td>{{ account.name }}</td>
|
||||
<td>
|
||||
<select>
|
||||
<option value="admin" {% if account.role=="admin" %}selected{% endif %}>
|
||||
admin
|
||||
</option>
|
||||
<option value="user" {% if account.role=="user" %}selected{% endif %}>
|
||||
user
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox"
|
||||
{% if account.isActivated %}checked{% else %}unchecked{% endif %}/>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-info" onclick="submit_account(this)">提交</button>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-danger" onclick="delete_account(this)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}<div class="notification is-danger">{{ messages[0] }}</div>{% endif %}
|
||||
{% endwith %}
|
||||
<script>
|
||||
var account_list = document.getElementById("account-{{ user.id }}");
|
||||
account_list.style.backgroundColor = "lightblue";
|
||||
Array.from(account_list.getElementsByTagName("*")).forEach(element => {
|
||||
@ -56,9 +59,8 @@
|
||||
} catch (error) {
|
||||
}
|
||||
});;
|
||||
</script>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
<script>
|
||||
function submit_account(obj) {
|
||||
var account = obj.parentElement.parentElement
|
||||
var data = {
|
||||
@ -110,14 +112,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="notification is-danger">
|
||||
{{ messages[0] }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% endblock %}
|
||||
</script>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}<div class="notification is-danger">{{ messages[0] }}</div>{% endif %}
|
||||
{% endwith %}
|
||||
{% endblock content %}
|
||||
|
@ -1,57 +1,58 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">
|
||||
欢迎回来,{{ user.name }}!
|
||||
</h1>
|
||||
{% if user.isActivated %}
|
||||
<h3 class="subtitle" style="text-align: left;">账户状态:</h3>
|
||||
<!-- <h3 class="subtitle" style="text-align: left;">服务状态:</h3> -->
|
||||
{% if user.role=='admin' %}
|
||||
<!-- admin -->
|
||||
<h3 class="subtitle" style="text-align: left;">注册账户列表:</h3>
|
||||
<table class="table" id="account-list-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">id</th>
|
||||
<th scope="col"><a href="{{ url_for('main.manage') }}">管理</a></th>
|
||||
<th scope="col">邮箱</th>
|
||||
<th scope="col">用户名</th>
|
||||
<th scope="col">角色</th>
|
||||
<th scope="col">已激活</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for account in accounts %}
|
||||
<tr id="{{ 'account-%d'|format(account.id) }}">
|
||||
<td scope="row">{{ account.id }}</td>
|
||||
<td><a href="{{ url_for('main.manage', id=account.id) }}">管理</a></td>
|
||||
<td>{{ account.email }}</td>
|
||||
<td>{{ account.name }}</td>
|
||||
<td>{{ account.role }}</td>
|
||||
<td>{% if account.isActivated %}是{% else %}否{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
<h1 class="title">欢迎回来,{{ user.name }}!</h1>
|
||||
{% if user.isActivated %}
|
||||
<h3 class="subtitle text-left">账户状态:</h3>
|
||||
<!-- <h3 class="subtitle" style="text-align: left;">服务状态:</h3> -->
|
||||
{% if user.role=='admin' %}
|
||||
<!-- admin -->
|
||||
<h3 class="subtitle text-left">注册账户列表:</h3>
|
||||
<table class="table" id="account-list-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">id</th>
|
||||
<th scope="col">
|
||||
<a href="{{ url_for('main.manage') }}">管理</a>
|
||||
</th>
|
||||
<th scope="col">邮箱</th>
|
||||
<th scope="col">用户名</th>
|
||||
<th scope="col">角色</th>
|
||||
<th scope="col">已激活</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for account in accounts %}
|
||||
<tr id="{{ 'account-%d'|format(account.id) }}">
|
||||
<td scope="row">{{ account.id }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('main.manage', id=account.id) }}">管理</a>
|
||||
</td>
|
||||
<td>{{ account.email }}</td>
|
||||
<td>{{ account.name }}</td>
|
||||
<td>{{ account.role }}</td>
|
||||
<td>
|
||||
{% if account.isActivated %}
|
||||
是
|
||||
{% else %}
|
||||
否
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var account_list = document.getElementById("account-{{ user.id }}");
|
||||
account_list.style.backgroundColor = "lightblue";
|
||||
</script>
|
||||
{% else %}
|
||||
<!-- user -->
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<!-- 未激活 -->
|
||||
<p class="text-warning">您的账号暂未激活,请等待管理员激活此账号。</p>
|
||||
{% endif %}
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="notification is-danger">
|
||||
{{ messages[0] }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% endblock %}
|
||||
</script>
|
||||
{% else %}
|
||||
<!-- user -->
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<!-- 未激活 -->
|
||||
<p class="text-warning">您的账号暂未激活,请等待管理员激活此账号。</p>
|
||||
{% endif %}
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}<div class="notification is-danger">{{ messages[0] }}</div>{% endif %}
|
||||
{% endwith %}
|
||||
{% endblock content %}
|
||||
|
@ -1,41 +1,47 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="column is-4 is-offset-4">
|
||||
<div class="column is-4 is-offset-4">
|
||||
<h3 class="title">注册</h3>
|
||||
<div class="box">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="notification is-danger">
|
||||
<div class="notification is-danger">
|
||||
{{ messages[0] }}
|
||||
{% if messages[0] == '此邮箱已注册!' %}
|
||||
<a href="{{ url_for('auth.login') }}">点此登录</a>.
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if messages[0] == '此邮箱已注册!' %}<a href="{{ url_for('auth.login') }}">点此登录</a>.{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<form method="POST" action="/signup">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="email" name="email" placeholder="邮箱" autofocus=""
|
||||
required="required">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="password" name="password" placeholder="密码" required="required">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large" type="text" name="name" placeholder="昵称(可选)" autofocus="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="button is-block is-info is-large is-fullwidth">提交注册</button>
|
||||
</form>
|
||||
{% endwith %}
|
||||
<form method="post" action="{{ url_for('auth.signup') }}">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large"
|
||||
type="email"
|
||||
name="email"
|
||||
placeholder="邮箱"
|
||||
autofocus=""
|
||||
required="required"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large"
|
||||
type="password"
|
||||
name="password"
|
||||
placeholder="密码"
|
||||
required="required"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input is-large"
|
||||
type="text"
|
||||
name="name"
|
||||
placeholder="昵称(可选)"
|
||||
autofocus=""/>
|
||||
</div>
|
||||
</div>
|
||||
<button class="button is-block is-info is-large is-fullwidth">提交注册</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
Reference in New Issue
Block a user