commit a50db20eaaa7272a05a8cc392414711ce01a66ee
Author: jc <419690370@qq.com>
Date: Sun Mar 9 14:28:55 2025 +0800
first commit
diff --git a/app.py b/app.py
new file mode 100644
index 0000000..5073437
--- /dev/null
+++ b/app.py
@@ -0,0 +1,21 @@
+from flask import Flask, jsonify, send_from_directory
+app = Flask(__name__, static_folder="public", static_url_path="")
+@app.route("/")
+def serve_index():
+ return send_from_directory(app.static_folder, "index.html")
+@app.route("/api/data")
+def api_data():
+ data = {
+ "product_name": "古新枣木梳",
+ "description": "采用古新枣木手工打造,质地坚硬,纹理美观,传承千年工艺。",
+ "benefits": [
+ "天然材质,温和护发",
+ "手工雕刻,工艺精湛",
+ "传承文化,寓意吉祥"
+ ],
+ "price": "¥99",
+ "image_url": "/images/comb.jpg"
+ }
+ return jsonify(data)
+if __name__ == "__main__":
+ app.run(debug=True, port=80)
\ No newline at end of file
diff --git a/public/images/comb.jpg b/public/images/comb.jpg
new file mode 100644
index 0000000..9b13841
Binary files /dev/null and b/public/images/comb.jpg differ
diff --git a/public/index.html b/public/index.html
new file mode 100644
index 0000000..218f8f0
--- /dev/null
+++ b/public/index.html
@@ -0,0 +1,19 @@
+
+
+
+
+
+ 古新枣木梳
+
+
+
+
+
+
![古新枣木梳]()
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/script.js b/public/script.js
new file mode 100644
index 0000000..31f0a90
--- /dev/null
+++ b/public/script.js
@@ -0,0 +1,19 @@
+document.addEventListener("DOMContentLoaded", () => {
+ fetch("/api/data")
+ .then(response => response.json())
+ .then(data => {
+ document.getElementById("product-name").innerText = data.product_name;
+ document.getElementById("product-image").src = data.image_url;
+ document.getElementById("description").innerText = data.description;
+ const benefitsList = document.getElementById("benefits");
+ data.benefits.forEach(benefit => {
+ const li = document.createElement("li");
+ li.innerText = benefit;
+ benefitsList.appendChild(li);
+ });
+ document.getElementById("price").innerText = data.price;
+ })
+ .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..5831327
--- /dev/null
+++ b/public/style.css
@@ -0,0 +1,57 @@
+body {
+ font-family: Arial, sans-serif;
+ margin: 0;
+ padding: 0;
+ background-color: #f5f5f5;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 100vh;
+}
+
+.container {
+ background: white;
+ padding: 20px;
+ border-radius: 10px;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+ text-align: center;
+ width: 80%;
+ max-width: 600px;
+}
+
+h1 {
+ color: #333;
+}
+
+.product-image {
+ width: 100%;
+ height: auto;
+ border-radius: 10px;
+ margin: 20px 0;
+}
+
+p {
+ color: #666;
+ font-size: 16px;
+ line-height: 1.5;
+}
+
+.benefits {
+ list-style: none;
+ padding: 0;
+}
+
+.benefits li {
+ background: #e0e0e0;
+ margin: 10px 0;
+ padding: 10px;
+ border-radius: 5px;
+ color: #333;
+ font-size: 14px;
+}
+
+.price {
+ color: #ff5722;
+ font-size: 24px;
+ font-weight: bold;
+}
\ No newline at end of file