|
|
@@ -1,3 +1,5 @@
|
|
|
+# 需求
|
|
|
+
|
|
|
统一 UTF-8 编码,中文支持。
|
|
|
前端使用 HTML(尽量兼容老旧浏览器(NetSurf)且不使用JS)。
|
|
|
服务端使用 python(尽量不引入第三方库),搭建最小轻量化独立聊天室。慢慢来,实现以下功能:
|
|
|
@@ -17,6 +19,8 @@
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<title>聊天室</title>
|
|
|
+ <link type="text/css" rel="stylesheet" href="html-chat.css">
|
|
|
+ <meta name="viewport" content="width=192, initial-scale=1.0">
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
@@ -52,32 +56,30 @@
|
|
|
```html chat.html
|
|
|
<!DOCTYPE html>
|
|
|
<html lang="zh-Hans">
|
|
|
-
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
- <title>聊天室 - {{ roomid }}</title>
|
|
|
- <link type="text/css" rel="stylesheet" href="html-chat.css">
|
|
|
+ <title>聊天室 - {roomid}</title>
|
|
|
<meta http-equiv="refresh" content="60">
|
|
|
+ <link type="text/css" rel="stylesheet" href="html-chat.css">
|
|
|
+ <meta name="viewport" content="width=192, initial-scale=1.0">
|
|
|
</head>
|
|
|
-
|
|
|
<body>
|
|
|
<div class="container">
|
|
|
<form action="/send_message" method="post">
|
|
|
<fieldset>
|
|
|
- <legend>聊天室 - {{ roomid }}</legend>
|
|
|
- <textarea id="chatLog" rows="10" cols="50" readonly></textarea>
|
|
|
+ <legend>聊天室 - {roomid}</legend>
|
|
|
+ <textarea id="chatLog" rows="10" cols="50" readonly>{chat_log}</textarea>
|
|
|
<br>
|
|
|
- <label for="messageInput">{{ nickname }}说:</label>
|
|
|
+ <label for="messageInput">{nickname}说:</label>
|
|
|
<input type="text" id="messageInput" name="messageInput">
|
|
|
<button type="submit">发送</button>
|
|
|
<a href="."><button type="button">退出</button></a>
|
|
|
</fieldset>
|
|
|
- <input type="text" id="nickname" name="nickname" value="{{ nickname }}" style="display: none;">
|
|
|
- <input type="text" id="roomid" name="roomid" value="{{ roomid }}" style="display: none;">
|
|
|
+ <input type="text" id="nickname" name="nickname" value="{nickname}" style="display: none;">
|
|
|
+ <input type="text" id="roomid" name="roomid" value="{roomid}" style="display: none;">
|
|
|
</form>
|
|
|
</div>
|
|
|
</body>
|
|
|
-
|
|
|
</html>
|
|
|
```
|
|
|
|