Преглед изворни кода

Merge branch 'master' of http://39.108.133.138:3000/2001010134/RaoYing

Future пре 3 година
родитељ
комит
aec82b1f4c
2 измењених фајлова са 99 додато и 91 уклоњено
  1. 32 44
      src/main/webapp/ShoppingCart.html
  2. 67 47
      src/main/webapp/css/CartCss.css

+ 32 - 44
src/main/webapp/ShoppingCart.html

@@ -1,5 +1,6 @@
 <!DOCTYPE html>
 <html lang="en">
+
 <head>
     <meta charset="UTF-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -7,6 +8,7 @@
     <title>Document</title>
     <link rel="stylesheet" type="text/css" href="css/CartCss.css">
 </head>
+
 <body>
     <form action="ShoppingCart.html" method="get">
         <div class="Store">
@@ -34,8 +36,8 @@
                 </div>
             </div>
         </div>
-    
-    
+
+
         <div class="Store">
             <a id="lable">
                 <input type="checkbox">
@@ -78,90 +80,76 @@
             </div>
         </div>
         <div id="BottomBar">
-            <input type="submit" name="submit" value="Delete">
-            <input type="submit" name="submit" value="Settle">
+            <input type="submit" name="submit" value="删除商品">
+            <input type="submit" name="submit" value="结算">
+
         </div>
     </form>
 
     <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
     <script>
-        $("form>div.Store>div.goods>div#exp>div#count>div").click(function()
-        {
-            if(this.innerHTML == "-")
-            {
+        $("form>div.Store>div.goods>div#exp>div#count>div").click(function() {
+            if (this.innerHTML == "-") {
                 let text = $(this).next()[0];
                 let num = Number.parseInt(text.value);
                 // console.dir(num);
-                if(num.toString() == "NaN") num = 0;
-                else num = Math.max(0,--num);
+                if (num.toString() == "NaN") num = 0;
+                else num = Math.max(0, --num);
                 text.value = num;
-            }
-            else
-            if(this.innerHTML == "+")
-            {
+            } else
+            if (this.innerHTML == "+") {
                 let text = $(this).prev()[0];
                 let num = Number.parseInt(text.value);
                 // console.dir(num);
-                if(num.toString() == "NaN") num = 1;
-                else num = Math.max(0,++num);
+                if (num.toString() == "NaN") num = 1;
+                else num = Math.max(0, ++num);
                 text.value = num;
             }
         });
-        $("form>div.Store>a#lable>input").change(function()
-        {
+        $("form>div.Store>a#lable>input").change(function() {
             let items = $(this).parent().parent().children("div.goods").children("input");
             // console.dir(items);
-            for(let i = 0; i < items.length; ++i)
-            {
+            for (let i = 0; i < items.length; ++i) {
                 items[i].checked = this.checked;
             }
         });
-        $("form>div.Store>div.goods>input").change(function()
-        {
+        $("form>div.Store>div.goods>input").change(function() {
             let lableChecker = $(this).parent().parent().children("a#lable").children("input");
-            if(this.checked)
-            {
+            if (this.checked) {
                 let otherGoods = $(this).parent().parent().children("div.goods").children("input").not(this);
-                for(let i = 0; i < otherGoods.length; ++i)
-                {
+                for (let i = 0; i < otherGoods.length; ++i) {
                     // console.dir(otherGoods[i].checked);
-                    if(!otherGoods[i].checked)
-                    {
+                    if (!otherGoods[i].checked) {
                         return;
                     }
                 }
                 lableChecker.prop("checked", true);
-            }
-            else
-            {
+            } else {
                 lableChecker.prop("checked", false);
             }
         })
-        $("form>div.Store>div.goods>div#exp>div#count>input").focusout(function()
-        {
+        $("form>div.Store>div.goods>div#exp>div#count>input").focusout(function() {
             let num = Number.parseInt(this.value);
-            if(num.toString() == "NaN") num = 0;
+            if (num.toString() == "NaN") num = 0;
             this.value = num;
-        }).keyup(function()
-        {
+        }).keyup(function() {
             let num = Number.parseInt(this.value);
-            if(num.toString() == "NaN") num = 0;
+            if (num.toString() == "NaN") num = 0;
             this.value = num;
-        }).keydown(function()
-        {
+        }).keydown(function() {
             let num = Number.parseInt(this.value);
-            if(num.toString() == "NaN") num = 0;
+            if (num.toString() == "NaN") num = 0;
             this.value = num;
         });
-        $("form>div#BottomBar>input[type='submit']").click(function()
-        {
+        $("form>div#BottomBar>input[type='submit']").click(function() {
             let counts = $("form>div#Store>div.goods>div#exp>div#count>input");
             for (let index = 0; index < counts.length; index++) {
-                let num = Number.parseInt( counts[index].value);
-                if(num.toString() == "NaN") num = 0;
+                let num = Number.parseInt(counts[index].value);
+                if (num.toString() == "NaN") num = 0;
                 counts[index].value = num;
             }
         });
     </script>
 </body>
+
 </html>

+ 67 - 47
src/main/webapp/css/CartCss.css

@@ -1,5 +1,4 @@
-
-body{
+body {
     /* background-color: transparent; */
     position: relative;
     margin: 0;
@@ -8,16 +7,15 @@ body{
     background-color: whitesmoke;
 }
 
-form
-{
+form {
     border-radius: 10px;
     /* position: relative; */
     width: 100%;
     min-height: 100px;
     /* min-width: 500px; */
 }
-form>div.Store
-{
+
+form>div.Store {
     position: relative;
     margin-top: 10px;
     margin-left: 15px;
@@ -27,20 +25,22 @@ form>div.Store
     font-size: 16px;
     overflow: hidden;
 }
+
+
 /* div#Cartlist>div.Store:last-child
 {
     margin-bottom: 0;
 } */
-form>div.Store>*{
+
+form>div.Store>* {
     border-bottom: 1px solid gainsboro;
 }
 
-form>div.Store>*:last-child{
+form>div.Store>*:last-child {
     border-bottom: 0;
 }
 
-form>div.Store>a#lable
-{
+form>div.Store>a#lable {
     height: 48px;
     line-height: 48px;
     display: flex;
@@ -48,87 +48,90 @@ form>div.Store>a#lable
     overflow: hidden;
     background-color: transparent;
 }
-form>div.Store>a#lable>input
-{
+
+form>div.Store>a#lable>input {
     height: 24px;
     width: 24px;
     margin: 12px;
     margin-left: calc(1ch + 12px);
 }
-form>div.Store>a#lable>div#StoreIcon
-{
+
+form>div.Store>a#lable>div#StoreIcon {
     height: 40px;
     width: 40px;
     margin: 4px;
     margin-left: calc(1ch + 4px);
     text-align: center;
 }
-form>div.Store>a#lable>div#StoreIcon>img
-{
+
+form>div.Store>a#lable>div#StoreIcon>img {
     max-width: 100%;
     max-height: 100%;
 }
-form>div.Store>a#lable>h3
-{
+
+form>div.Store>a#lable>h3 {
     margin: 0;
 }
 
-form>div.Store>div.goods{
+form>div.Store>div.goods {
     height: 96px;
     display: flex;
     justify-items: center;
     overflow: hidden;
-    background-color:transparent;
+    background-color: transparent;
 }
-form>div.Store>div.goods>input{
+
+form>div.Store>div.goods>input {
     height: 24px;
     min-width: 24px;
     margin: 36px;
     margin-left: calc(1ch + 12px);
     margin-right: calc(1ch + 12px);
 }
-form>div.Store>div.goods>div#GoodsIcon
-{
+
+form>div.Store>div.goods>div#GoodsIcon {
     height: 88px;
     min-width: 88px;
     margin: 4px;
     margin-left: calc(1ch + 4px);
     text-align: center;
 }
-form>div.Store>div.goods>div#GoodsIcon>img
-{
+
+form>div.Store>div.goods>div#GoodsIcon>img {
     max-width: 100%;
     max-height: 100%;
 }
-form>div.Store>div.goods>div#exp
-{
+
+form>div.Store>div.goods>div#exp {
     position: relative;
     margin: 8px;
     height: 80px;
     width: 100%;
     min-width: 200px;
 }
-form>div.Store>div.goods>div#exp>*
-{
+
+form>div.Store>div.goods>div#exp>* {
     width: 100%;
     margin: 0;
 }
-form>div.Store>div.goods>div#exp>p{
-    color:gray;
 
+form>div.Store>div.goods>div#exp>p {
+    color: gray;
 }
-form>div.Store>div.goods>div#exp>h4{
-    color:#E33333;
+
+form>div.Store>div.goods>div#exp>h4 {
+    color: #E33333;
     position: absolute;
     bottom: 0;
     left: 0;
 }
-form>div.Store>div.goods>div#exp>h4::after{
+
+form>div.Store>div.goods>div#exp>h4::after {
     counter-reset: "$";
     color: #E33333;
 }
-form>div.Store>div.goods>div#exp>div#count
-{
+
+form>div.Store>div.goods>div#exp>div#count {
     position: absolute;
     width: 25%;
     min-width: 16ch;
@@ -141,7 +144,8 @@ form>div.Store>div.goods>div#exp>div#count
     display: flex;
     overflow: hidden;
 }
-form>div.Store>div.goods>div#exp>div#count>*{
+
+form>div.Store>div.goods>div#exp>div#count>* {
     width: 100%;
     height: 100%;
     margin: 0;
@@ -152,27 +156,43 @@ form>div.Store>div.goods>div#exp>div#count>*{
     background-color: white;
     user-select: none;
 }
-form>div.Store>div.goods>div#exp>div#count>*:hover
-{
+
+form>div.Store>div.goods>div#exp>div#count>*:hover {
     background-color: gainsboro;
 }
-form>div.Store>div.goods>div#exp>div#count>*:active
-{
+
+form>div.Store>div.goods>div#exp>div#count>*:active {
     background-color: gray;
 }
 
-form>div#BottomBar
-{
+form>div#BottomBar {
     position: fixed;
-    right: 0;
     bottom: 0;
-    width: 100%;
+    padding: 15px;
+}
 
+form>div#BottomBar input:nth-of-type(1) {
+    font-size: 15px;
+    padding: 10px;
+    color: #E33333;
+    background-color: rgb(236, 200, 200);
+    border: 2px solid #E33333;
 }
 
+form>div#BottomBar input:nth-of-type(2) {
+    font-size: 15px;
+    color: white;
+    padding: 10px 30px;
+    border: white;
+    background-color: rgb(92, 52, 235);
+}
 
-@font-face
-{
+
+/* form>div#BottomBar input:nth-of-type(1) {
+    float: right;
+} */
+
+@font-face {
     font-family: 'Harmony SC';
     src: url(../fonts/HarmonyOS_Sans_SC_Medium.ttf);
 }