更新文件

This commit is contained in:
2025-09-13 19:13:34 +08:00
parent 2e9be34b49
commit 9b791b5567
8 changed files with 292 additions and 138 deletions

View File

@@ -54,7 +54,7 @@ def main():
target=DBServices.DBStart, target=DBServices.DBStart,
daemon=True daemon=True
) )
dbServices_thread.start() #dbServices_thread.start()
# 启动Webview # 启动Webview
try: try:
WebViewWIndow.WebViewWIndow(#窗口配置 WebViewWIndow.WebViewWIndow(#窗口配置

View File

@@ -2,7 +2,7 @@ import requests
import json import json
from requests.exceptions import RequestException from requests.exceptions import RequestException
import platform import platform
from . import PyWebPageAPI from .. import PyWebPageAPI
UA = f"SolianForPythonApp/0.0.1(A) ({PyWebPageAPI.GetDeviceInfo()})" UA = f"SolianForPythonApp/0.0.1(A) ({PyWebPageAPI.GetDeviceInfo()})"

View File

@@ -1,6 +1,10 @@
import flask import flask
from flask import Flask
import os
app = flask.Flask(__name__, template_folder='../webfile', static_folder='../webfile/static') app = Flask(__name__)
app = flask.Flask(__name__, template_folder='../webfile', static_folder='../webfile/static', static_url_path='/static')
@app.errorhandler(500) @app.errorhandler(500)
def internal_server_error(error): def internal_server_error(error):
@@ -19,7 +23,20 @@ def forbidden(error):
@app.route('/') @app.route('/')
def index(): def index():
return flask.render_template('index.html') return flask.render_template('index.html',static_url_path='/static')
@app.route('/Account')
def Account():
return flask.render_template('Account.html')
@app.route('/Realm')
def Realm():
return flask.render_template('Realm.html')
@app.route('/Chat')
def Chat():
return flask.render_template('Chat.html')
def AppStart(host: str, port: int): def AppStart(host: str, port: int):
"""启动Flask应用""" """启动Flask应用"""

46
webfile/Account.html Normal file
View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>账户设置</title>
<link rel="stylesheet" href="static/styles.css">
</head>
<body>
<div class="title-bar">
<button class="menu-toggle" id="menuToggle"></button>
<h1>Solsynth network</h1>
</div>
<div class="main-container">
<div class="sidebar" id="sidebar">
<div class="sidebar-header">菜单</div>
<ul class="sidebar-menu">
<li onclick="window.location.href='/';" style="cursor: pointer;">首页</li>
<li onclick="window.location.href='/Chat';" style="cursor: pointer;">聊天</li>
<li onclick="window.location.href='/Realm';" style="cursor: pointer;">领域</li>
<li class="active" onclick="window.location.href='/Account';" style="cursor: pointer;">设置</li>
</ul>
</div>
<div class="content">
<h2>账户设置</h2>
<div class="card">
<h3>账户信息</h3>
<p>这里是账户设置界面。</p>
</div>
</div>
</div>
<script>
document.getElementById('menuToggle').addEventListener('click', function() {
document.getElementById('sidebar').classList.toggle('open');
});
// 为侧边栏菜单项添加悬停效果
document.querySelectorAll('.sidebar-menu li').forEach(item => {
item.style.cursor = 'pointer';
});
</script>
</body>
</html>

46
webfile/chat.html Normal file
View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>聊天管理</title>
<link rel="stylesheet" href="static/styles.css">
</head>
<body>
<div class="title-bar">
<button class="menu-toggle" id="menuToggle"></button>
<h1>Solsynth network</h1>
</div>
<div class="main-container">
<div class="sidebar" id="sidebar">
<div class="sidebar-header">菜单</div>
<ul class="sidebar-menu">
<li onclick="window.location.href='/';" style="cursor: pointer;">首页</li>
<li class="active" onclick="window.location.href='/Chat';" style="cursor: pointer;">聊天</li>
<li onclick="window.location.href='/Realm';" style="cursor: pointer;">领域</li>
<li onclick="window.location.href='/Account';" style="cursor: pointer;">设置</li>
</ul>
</div>
<div class="content">
<h2>聊天管理</h2>
<div class="card">
<h3>聊天功能</h3>
<p>这里是聊天管理界面。</p>
</div>
</div>
</div>
<script>
document.getElementById('menuToggle').addEventListener('click', function() {
document.getElementById('sidebar').classList.toggle('open');
});
// 为侧边栏菜单项添加悬停效果
document.querySelectorAll('.sidebar-menu li').forEach(item => {
item.style.cursor = 'pointer';
});
</script>
</body>
</html>

View File

@@ -4,134 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Solsynth network</title> <title>Solsynth network</title>
<style> <link rel="stylesheet" href="static/styles.css">
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
body {
display: flex;
flex-direction: column;
height: 100vh;
background-color: #f3f3f3;
color: #333;
}
/* 顶部导航栏 */
.title-bar {
height: 48px;
background-color: #0078d7;
color: white;
display: flex;
align-items: center;
padding: 0 16px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
z-index: 10;
}
.title-bar h1 {
font-size: 18px;
font-weight: 500;
}
.menu-toggle {
display: none;
background: none;
border: none;
color: white;
font-size: 20px;
margin-right: 16px;
cursor: pointer;
}
/* 主内容区域 */
.main-container {
display: flex;
flex: 1;
overflow: hidden;
}
/* 侧边栏 */
.sidebar {
width: 220px;
background-color: white;
border-right: 1px solid #e1e1e1;
transition: transform 0.3s ease;
overflow-y: auto;
z-index: 5;
}
.sidebar-header {
padding: 16px;
border-bottom: 1px solid #e1e1e1;
font-weight: 600;
}
.sidebar-menu {
list-style: none;
}
.sidebar-menu li {
padding: 12px 16px;
cursor: pointer;
transition: background-color 0.2s;
}
.sidebar-menu li:hover {
background-color: #f5f5f5;
}
.sidebar-menu li.active {
background-color: #e5f1fb;
color: #0078d7;
border-left: 3px solid #0078d7;
}
/* 主内容区 */
.content {
flex: 1;
padding: 24px;
overflow-y: auto;
background-color: white;
}
.content h2 {
margin-bottom: 16px;
font-weight: 500;
}
.card {
background-color: #f9f9f9;
border-radius: 4px;
padding: 16px;
margin-bottom: 16px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
/* 响应式设计 */
@media (max-width: 768px) {
.menu-toggle {
display: block;
}
.sidebar {
position: absolute;
height: calc(100vh - 48px);
transform: translateX(-100%);
}
.sidebar.open {
transform: translateX(0);
}
.content {
padding: 16px;
}
}
</style>
</head> </head>
<body> <body>
<div class="title-bar"> <div class="title-bar">
@@ -143,10 +16,10 @@
<div class="sidebar" id="sidebar"> <div class="sidebar" id="sidebar">
<div class="sidebar-header">菜单</div> <div class="sidebar-header">菜单</div>
<ul class="sidebar-menu"> <ul class="sidebar-menu">
<li class="active">首页</li> <li class="active" onclick="window.location.href='/';" style="cursor: pointer;">首页</li>
<li>聊天</li> <li onclick="window.location.href='/Chat';" style="cursor: pointer;">聊天</li>
<li>领域</li> <li onclick="window.location.href='/Realm';" style="cursor: pointer;">领域</li>
<li>设置</li> <li onclick="window.location.href='/Account';" style="cursor: pointer;">设置</li>
</ul> </ul>
</div> </div>
@@ -171,6 +44,11 @@
document.getElementById('menuToggle').addEventListener('click', function() { document.getElementById('menuToggle').addEventListener('click', function() {
document.getElementById('sidebar').classList.toggle('open'); document.getElementById('sidebar').classList.toggle('open');
}); });
// 为侧边栏菜单项添加悬停效果
document.querySelectorAll('.sidebar-menu li').forEach(item => {
item.style.cursor = 'pointer';
});
</script> </script>
</body> </body>
</html> </html>

46
webfile/realm.html Normal file
View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>领域管理</title>
<link rel="stylesheet" href="static/styles.css">
</head>
<body>
<div class="title-bar">
<button class="menu-toggle" id="menuToggle"></button>
<h1>Solsynth network</h1>
</div>
<div class="main-container">
<div class="sidebar" id="sidebar">
<div class="sidebar-header">菜单</div>
<ul class="sidebar-menu">
<li onclick="window.location.href='/';" style="cursor: pointer;">首页</li>
<li onclick="window.location.href='/Chat';" style="cursor: pointer;">聊天</li>
<li class="active" onclick="window.location.href='/Realm';" style="cursor: pointer;">领域</li>
<li onclick="window.location.href='/Account';" style="cursor: pointer;">设置</li>
</ul>
</div>
<div class="content">
<h2>领域管理</h2>
<div class="card">
<h3>领域功能</h3>
<p>这里是领域管理界面。</p>
</div>
</div>
</div>
<script>
document.getElementById('menuToggle').addEventListener('click', function() {
document.getElementById('sidebar').classList.toggle('open');
});
// 为侧边栏菜单项添加悬停效果
document.querySelectorAll('.sidebar-menu li').forEach(item => {
item.style.cursor = 'pointer';
});
</script>
</body>
</html>

121
webfile/static/styles.css Normal file
View File

@@ -0,0 +1,121 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
body {
display: flex;
flex-direction: column;
height: 100vh;
background-color: #f3f3f3;
color: #333;
}
.title-bar {
height: 48px;
background-color: #0078d7;
color: white;
display: flex;
align-items: center;
padding: 0 16px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
z-index: 10;
}
.title-bar h1 {
font-size: 18px;
font-weight: 500;
}
.menu-toggle {
display: none;
background: none;
border: none;
color: white;
font-size: 20px;
margin-right: 16px;
cursor: pointer;
}
.main-container {
display: flex;
flex: 1;
overflow: hidden;
}
.sidebar {
width: 220px;
background-color: white;
border-right: 1px solid #e1e1e1;
transition: transform 0.3s ease;
overflow-y: auto;
z-index: 5;
}
.sidebar-header {
padding: 16px;
border-bottom: 1px solid #e1e1e1;
font-weight: 600;
}
.sidebar-menu {
list-style: none;
}
.sidebar-menu li {
padding: 12px 16px;
cursor: pointer;
transition: background-color 0.2s;
}
.sidebar-menu li:hover {
background-color: #f5f5f5;
}
.sidebar-menu li.active {
background-color: #e5f1fb;
color: #0078d7;
border-left: 3px solid #0078d7;
}
.content {
flex: 1;
padding: 24px;
overflow-y: auto;
background-color: white;
}
.content h2 {
margin-bottom: 16px;
font-weight: 500;
}
.card {
background-color: #f9f9f9;
border-radius: 4px;
padding: 16px;
margin-bottom: 16px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
@media (max-width: 768px) {
.menu-toggle {
display: block;
}
.sidebar {
position: absolute;
height: calc(100vh - 48px);
transform: translateX(-100%);
}
.sidebar.open {
transform: translateX(0);
}
.content {
padding: 16px;
}
}