commit 485e54b06b36de54e71373287115f077563d453b Author: jc <419690370@qq.com> Date: Sun Mar 23 22:23:56 2025 +0800 first commit diff --git a/app.py b/app.py new file mode 100644 index 0000000..85c0222 --- /dev/null +++ b/app.py @@ -0,0 +1,33 @@ +from flask import Flask, jsonify + +app = Flask(__name__, static_folder="public", static_url_path="") + +# WPS表格处理知识点数据 +wps_table_data = { + "introduction": "WPS表格是一款功能强大的电子表格软件,适用于数据分析和报告。", + "functions": [ + "数据排序:快速对数据进行升序或降序排列。", + "数据筛选:根据特定条件筛选数据。", + "公式计算:支持多种数学和统计公式。", + "图表制作:轻松创建各种图表,如柱状图、饼图等。", + "数据透视表:对大量数据进行快速汇总和分析。" + ], + "tips": [ + "使用快捷键可以提高工作效率。", + "定期保存工作,避免数据丢失。", + "利用模板可以快速创建表格。" + ] +} + +# 根路径返回 index.html +@app.route("/") +def serve_index(): + return app.send_static_file("index.html") + +# API 子路径,提供WPS表格处理知识点数据 +@app.route("/api/wps-table") +def api_wps_table(): + return jsonify(wps_table_data) + +if __name__ == "__main__": + app.run(debug=True, port=81) \ No newline at end of file diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..790b66d --- /dev/null +++ b/public/index.html @@ -0,0 +1,29 @@ + + + + + + WPS Table Knowledge + + + +
+

WPS Table Knowledge

+
+
+
+

Introduction

+

+
+
+

Functions

+ +
+
+

Tips

+ +
+
+ + + \ No newline at end of file diff --git a/public/script.js b/public/script.js new file mode 100644 index 0000000..438cfe3 --- /dev/null +++ b/public/script.js @@ -0,0 +1,20 @@ +document.addEventListener('DOMContentLoaded', function() { + fetch('/api/wps-table') + .then(response => response.json()) + .then(data => { + document.getElementById('intro-text').textContent = data.introduction; + const functionsList = document.getElementById('functions-list'); + data.functions.forEach(functionItem => { + const li = document.createElement('li'); + li.textContent = functionItem; + functionsList.appendChild(li); + }); + const tipsList = document.getElementById('tips-list'); + data.tips.forEach(tip => { + const li = document.createElement('li'); + li.textContent = tip; + tipsList.appendChild(li); + }); + }) + .catch(error => console.error('Error fetching data:', error)); +}); \ No newline at end of file diff --git a/public/style.css b/public/style.css new file mode 100644 index 0000000..9cc14fc --- /dev/null +++ b/public/style.css @@ -0,0 +1,37 @@ +body { + font-family: Arial, sans-serif; + background-color: #f0f0f0; + margin: 0; + padding: 0; +} + +header { + background-color: #333; + color: white; + padding: 10px 0; + text-align: center; +} + +main { + padding: 20px; + background-color: white; + margin: 20px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); +} + +h1, h2 { + color: #333; +} + +section { + margin-bottom: 20px; +} + +ul { + list-style-type: none; + padding: 0; +} + +li { + margin: 5px 0; +} \ No newline at end of file