Browse Source

H5-商详选择:接口请求参数传递

panyong 3 years ago
parent
commit
ed9cafa9ab

+ 0 - 7
htmldev/dashboard/src/api/request.js

@@ -78,13 +78,6 @@ request.interceptors.request.use(request => {
     showLoading()
   }
 
-  if (/post/ig.test(request.method)) {
-    request.headers = {
-      ...request.headers,
-      'Content-Type': 'application/x-www-form-urlencoded'
-    }
-  }
-
   return request
 }, error => {
   // 判断当前请求是否设置了不显示Loading

+ 2 - 3
htmldev/dashboard/src/views/sell/goods/api/index.js

@@ -1,5 +1,4 @@
 import request from '@/api/request'
-import qs from 'qs'
 
 /**
  * 商品列表接口
@@ -61,7 +60,7 @@ export const apiCartClear = (id) => request({
 export const apiCartUpdate = (id, type) => request({
   method: 'POST',
   url: '/api/v1/user/cart/update',
-  data: qs.stringify({
+  data: JSON.stringify({
     id,
     type
   })
@@ -73,5 +72,5 @@ export const apiCartUpdate = (id, type) => request({
 export const apiCartAdd = (postData) => request({
   method: 'POST',
   url: '/api/v1/user/cart/add',
-  data: qs.stringify(postData)
+  data: JSON.stringify(postData)
 })

+ 16 - 9
htmldev/dashboard/src/views/sell/shopcart/shopcart.vue

@@ -1,8 +1,10 @@
 <template>
   <div>
     <div class="shopcart">
-      <div class="content"
-           @click="toggleList">
+      <!--底部栏:去购买-->
+      <div
+        class="content"
+        @click="toggleList">
         <div class="content-left">
           <div class="logo-wrapper">
             <div class="logo">
@@ -14,7 +16,7 @@
             </div>
           </div>
           <div
-            :class="{'highlight':totalPrice > 0}"
+            :class="{'highlight': totalPrice > 0}"
             class="price">¥{{ totalPrice | fen2Yuan }}
           </div>
         </div>
@@ -27,6 +29,7 @@
           </div>
         </div>
       </div>
+      <!--小球飞入动画-->
       <div class="ball-container">
         <div
           v-for="(ball, index) in balls"
@@ -44,8 +47,11 @@
           </transition>
         </div>
       </div>
+      <!--购物车列表-->
       <transition name="fold">
-        <div class="shopcart-list" v-show="listShow">
+        <div
+          v-show="listShow"
+          class="shopcart-list">
           <div class="list-header">
             <h1 class="title">购物车</h1>
             <p class="empty" @click="empty">
@@ -94,7 +100,10 @@
       </transition>
     </div>
     <transition name="fade">
-      <div class="list-mask" @click="hideList" v-show="listShow"></div>
+      <div
+        v-show="listShow"
+        class="list-mask"
+        @click="hideList"></div>
     </transition>
   </div>
 </template>
@@ -466,7 +475,7 @@ export default {
       width: 16px;
       height: 16px;
       border-radius: 50%;
-      background: rgb(0, 160, 220);
+      background: #D32323;
       transition: all 0.4s linear;
     }
   }
@@ -604,9 +613,7 @@ export default {
   width: 100%;
   height: 100%;
   z-index: 40;
-  backdrop-filter: blur(10px);
-  opacity: 1;
-  background: rgba(7, 17, 27, 0.6);
+  background: rgba(0, 0, 0, 0.8);
 
   &.fade-enter-active, &.fade-leave-active {
     transition: all 0.5s;