diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..919ce1f
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
new file mode 100644
index 0000000..c206429
--- /dev/null
+++ b/.idea/dataSources.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ mysql.8
+ true
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://localhost:3306
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index 2054f91..0000000
--- a/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# ShoppingCart
-
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..df57d2c
--- /dev/null
+++ b/index.html
@@ -0,0 +1,35 @@
+
+
+
+
+ 购物车
+
+
+购物车
+
+
+添加商品到购物车
+
+
+从购物车中移除商品
+
+
+
+
+
\ No newline at end of file
diff --git a/main.js b/main.js
new file mode 100644
index 0000000..699d952
--- /dev/null
+++ b/main.js
@@ -0,0 +1,36 @@
+function fetchCartProducts() {
+ fetch('http://localhost:8080/products/cart')
+ .then(response => response.json())
+ .then(products => {
+ const cartDiv = document.getElementById('cart');
+ cartDiv.innerHTML = '';
+ products.forEach(product => {
+ const productDiv = document.createElement('div');
+ productDiv.textContent = `商品ID:${product.id},名称:${product.name},数量:${product.quantity}`;
+ cartDiv.appendChild(productDiv);
+ });
+ });
+}
+
+document.getElementById('add-to-cart-form').addEventListener('submit', event => {
+ event.preventDefault();
+ const productId = document.getElementById('add-product-id').value;
+ const quantity = document.getElementById('add-quantity').value;
+ fetch(`http://localhost:8080/products/addToCart/${productId}?quantity=${quantity}`, {
+ method: 'POST'
+ }).then(() => {
+ fetchCartProducts();
+ });
+});
+
+document.getElementById('remove-from-cart-form').addEventListener('submit', event => {
+ event.preventDefault();
+ const productId = document.getElementById('remove-product-id').value;
+ fetch(`http://localhost:8080/products/removeFromCart/${productId}`, {
+ method: 'POST'
+ }).then(() => {
+ fetchCartProducts();
+ });
+});
+
+fetchCartProducts();
diff --git a/shppingcart-backend/src/main/resources/application.yml b/shppingcart-backend/src/main/resources/application.yml
index 92082d2..f2ab8b1 100644
--- a/shppingcart-backend/src/main/resources/application.yml
+++ b/shppingcart-backend/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
datasource:
- url: jdbc:mysql://localhost:3306/shopping_cart?useSSL=false&serverTimezone=UTC
+ url: jdbc:mysql://localhost:3306/huas-project-yangwp?useSSL=false&serverTimezone=UTC
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver