Kaynağa Gözat

增加广告

zaijin 1 yıl önce
ebeveyn
işleme
208a1fb16f

+ 8 - 1
common/apiurl.js

@@ -151,5 +151,12 @@ export const apiurl = {
   // 根据停车场编号和车牌查询订单
   getOrderInfoByParknoUrl: '/client/parking-orderinfo/advance/getOrderInfo',
   // 停车场支付
-  indoorPaymentUrl: '/client/payment/parking/gotoPay'
+  indoorPaymentUrl: '/client/payment/parking/gotoPay',
+  // 广告模块
+  adBannerModule: {
+    // 获取广告列表
+    getAdBannerListUrl: '/admin/advertInfo',
+    // 获取广告详情
+    getAdBannerDetailsUrl: '/admin/advertInfo'
+  }
 };

+ 6 - 1
common/http.api.js

@@ -129,6 +129,10 @@ const install = (Vue, vm) => {
   let getVehicleInquiryListApi = (params = {}) => vm.$u.post(apiurl.getVehicleInquiryListUrl, params);
   let getOrderInfoByParknoApi = (params = {}) => vm.$u.post(apiurl.getOrderInfoByParknoUrl, params);
   let indoorPaymentApi = (params = {}) => vm.$u.post(apiurl.indoorPaymentUrl, params);
+  let adBannerModuleApi = {
+    getAdBannerListApi: (params = {}) => vm.$u.get(apiurl.adBannerModule.getAdBannerListUrl, params),
+    getAdBannerDetailsApi: (params = {}) => vm.$u.get(apiurl.adBannerModule.getAdBannerDetailsUrl, params)
+  }
   // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
   vm.$u.api = {
     feedbackAdd,
@@ -199,7 +203,8 @@ const install = (Vue, vm) => {
     getCouponByOrderIdApi,
     getVehicleInquiryListApi,
     getOrderInfoByParknoApi,
-    indoorPaymentApi
+    indoorPaymentApi,
+    adBannerModuleApi
   };
 };
 

+ 1 - 1
common/http.interceptor.js

@@ -27,7 +27,7 @@ const install = (Vue, vm) => {
   Vue.prototype.$u.http.interceptor.response = (res) => {
     if (res.code == 200) {
       return res;
-    } else if (res.code == 401 || res.code == 400) {
+    } else if (res.code == 401 || (res.code == 400 && res.msg == '令牌不能为空') ) {
       const backUrl = location.href,
         openidPage = vm.config.onlyWxLogin, // 只需要传openid的页面集合
         needValidPage = openidPage.filter((item) => backUrl.indexOf(item) > -1); // 是否为需要验证的页面集合

+ 70 - 0
components/ad-banner/ad-banner.vue

@@ -0,0 +1,70 @@
+<!--
+ * @Description: 广告横幅
+ * @Author: 空白格
+ * @Date: 2023-05-24 09:23:58
+ * @LastEditors: 空白格
+ * @LastEditTime: 2023-05-24 10:14:25
+ * @FilePath: \parking_h5_all\components\ad-banner\ad-banner.vue
+ * @Copyright: Copyright (c) 2016~2023 by 空白格, All Rights Reserved. 
+-->
+<template>
+  <view class="ad-banner">
+    <u-swiper v-if="list.length" :list="list" @click="adBannerClick" height="300" />
+    <u-empty v-else text="暂无广告数据" mode="data" />
+  </view>
+</template>
+
+<script>
+export default {
+  name: 'AdBanner',
+  data() {
+    return {
+      list: []
+    };
+  },
+	created() {
+		this.getBannerList();
+	},
+  methods: {
+    /**
+     * @description: 获取轮播列表
+     * @return {*}
+     */
+    async getBannerList() {
+      const { code, rows } = await this.$u.api.adBannerModuleApi.getAdBannerListApi({ pageNum: 1, pageSize: 10 });
+      if (code === 200) {
+        this.list = rows.map(item => {
+					return { id: item.id, image: item.bannerUrl, type: item.contentType, link: item.jumpUrl, ...item }
+				});
+      }
+    },
+    /**
+     * @description: 轮播图点击
+     * @param {*} e
+     * @return {*}
+     */
+    adBannerClick(e) {
+      const listItem = this.list[e];
+      switch (Number(listItem.type)) {
+        case 0:
+          this.$u.route({
+            url: '/pages/adBannerDetails/adBannerDetails',
+            params: {
+              id: listItem.id
+            }
+          });
+          break;
+        case 1:
+          location.href = listItem.link;
+          break;
+      }
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.ad-banner {
+  padding: 0 30rpx;
+}
+</style>

+ 10 - 1
pages.json

@@ -293,7 +293,7 @@
       "style": {
         "navigationBarTitleText": "支付成功",
         "enablePullDownRefresh": false,
-				"navigationBarBackgroundColor": "#008CFF",
+        "navigationBarBackgroundColor": "#008CFF",
         "navigationBarTextStyle": "white"
       }
     },
@@ -304,6 +304,15 @@
         "enablePullDownRefresh": false,
         "navigationStyle": "custom"
       }
+    },
+    {
+      "path": "pages/adBannerDetails/adBannerDetails",
+      "style": {
+        "navigationBarTitleText": "广告详情",
+        "enablePullDownRefresh": false,
+        "navigationBarBackgroundColor": "#008CFF",
+        "navigationBarTextStyle": "white"
+      }
     }
   ],
   "globalStyle": {

+ 7 - 2
pages/OnsitePayment/OnsitePayment.scss

@@ -2,7 +2,7 @@
   min-height: calc(100vh - 88rpx);
   background-color: #f6f6ff;
   &-box {
-    padding: 40rpx 0 0;
+    padding: 20rpx 0 0;
   }
   &-title {
     font-size: 46rpx;
@@ -30,6 +30,11 @@
     &-item {
       display: flex;
       margin-bottom: 16rpx;
+
+      &:last-child {
+        margin-bottom: 0;
+      }
+
       view {
         font-size: 28rpx;
         &:first-child {
@@ -62,7 +67,7 @@
   }
   &-pay-attention {
     width: calc(100% - 100rpx);
-    margin: 50rpx auto;
+    margin: 30rpx auto;
     color: #777777;
   }
 }

+ 5 - 1
pages/OnsitePayment/OnsitePayment.vue

@@ -21,16 +21,20 @@
       <!-- 支付方式 -->
       <ChoosePayment ref="choosePayment" :curOrderList="orderList" :jumpUrl="jumpUrl" :isIndoor="true" />
     </view>
+    <!-- 广告轮播 -->
+    <ad-banner />
     <u-toast ref="uToast" />
   </view>
 </template>
 
 <script>
 import ChoosePayment from '@/pages/choosePayment/choosePayment.vue';
+import AdBanner from '@/components/ad-banner/ad-banner.vue';
 import { base64Decrypt } from '@/utils';
 export default {
   components: {
-    ChoosePayment
+    ChoosePayment,
+    AdBanner
   },
   data() {
     return {

+ 37 - 0
pages/adBannerDetails/adBannerDetails.vue

@@ -0,0 +1,37 @@
+<template>
+  <view class="details ql-editor">
+    <u-parse v-if="detailsInfo && detailsInfo.content" :html="detailsInfo.content" />
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      detailsInfo: {}
+    };
+  },
+  onLoad(options) {
+    const { id } = options;
+    if (id) {
+      this.getBannerDetails(id);
+    }
+  },
+  methods: {
+    /**
+     * @description: 获取广告详情
+     * @param {*} id
+     * @return {*}
+     */
+    async getBannerDetails(id) {
+      const { code, rows } = await this.$u.api.adBannerModuleApi.getAdBannerListApi({ pageNum: 1, pageSize: 10 });
+      if (code === 200) {
+        this.detailsInfo = rows.find(item => String(item.id) === id);
+				console.log(this.detailsInfo)
+      }
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped></style>

+ 8 - 3
pages/geomagnetismLock/geomagnetismLock.scss

@@ -1,7 +1,7 @@
 .parking-lock {
   height: calc(100vh - 88rpx);
   background-color: #f6f6ff;
-  padding-top: 133rpx;
+  padding-top: 50rpx;
   .parking-lock-title {
     font-size: 46rpx;
     color: #292929;
@@ -21,13 +21,18 @@
   }
   .parking-lock-info {
     width: calc(100% - 72rpx);
-    margin: 31rpx auto 54rpx;
+    margin: 30rpx auto;
     background-color: #fff;
     border-radius: 15rpx;
     padding: 39rpx 41rpx;
     .parking-lock-info-item {
       display: flex;
       margin-bottom: 16rpx;
+
+      &:last-child {
+        margin-bottom: 0;
+      }
+      
       view {
         font-size: 28rpx;
         &:first-child {
@@ -50,7 +55,7 @@
   }
   .parking-lock-pay-btn {
     width: calc(100% - 72rpx);
-    margin: 0 auto;
+    margin: 0 auto 30rpx;
     button {
       width: 100%;
       height: 100rpx;

+ 5 - 1
pages/geomagnetismLock/geomagnetismLock.vue

@@ -61,6 +61,8 @@
         <view class="parking-lock-tips">{{ tipsMsg }}</view>
       </view>
     </template>
+    <!-- 广告轮播 -->
+    <ad-banner />
     <!-- 支付方式 -->
     <ChoosePayment
       ref="choosePayment"
@@ -87,9 +89,11 @@
 
 <script>
 import ChoosePayment from '@/pages/choosePayment/choosePayment.vue';
+import AdBanner from '@/components/ad-banner/ad-banner.vue';
 export default {
   components: {
-    ChoosePayment
+    ChoosePayment,
+    AdBanner
   },
   data() {
     return {

+ 3 - 3
pages/parkexport/parkexport.scss

@@ -1,7 +1,7 @@
 .parking-lock {
   height: calc(100vh - 88rpx);
   background-color: #f6f6ff;
-  padding-top: 133rpx;
+  padding-top: 10rpx;
   .parking-lock-title {
     font-size: 46rpx;
     color: #292929;
@@ -21,7 +21,7 @@
   }
   .parking-lock-info {
     width: calc(100% - 72rpx);
-    margin: 31rpx auto 54rpx;
+    margin: 30rpx auto;
     background-color: #fff;
     border-radius: 15rpx;
     padding: 39rpx 41rpx;
@@ -176,7 +176,7 @@
 }
 .pay-way-close-btn {
   width: calc(100% - 34rpx);
-  margin: 0 auto 68rpx;
+  margin: 0 auto 30rpx;
   border: none;
   background-color: #3397fa;
   color: #fff;

+ 5 - 1
pages/parkexport/parkexport.vue

@@ -80,15 +80,19 @@
       :sanPay="true"
       @closePaymentMethod="closePaymentMethod"
     />
+    <!-- 广告轮播 -->
+    <ad-banner />
     <u-toast ref="uToast" />
   </view>
 </template>
 
 <script>
 import ChoosePayment from '@/pages/choosePayment/choosePayment.vue';
+import AdBanner from '@/components/ad-banner/ad-banner.vue';
 export default {
   components: {
-    ChoosePayment
+    ChoosePayment,
+    AdBanner
   },
   data() {
     return {

+ 6 - 6
pages/parkingLock/parkingLock.scss

@@ -1,14 +1,10 @@
 .parking-lock {
   min-height: calc(100vh - 88rpx);
   background-color: #f6f6ff;
-  &-box {
-    padding: 40rpx 0 0;
-  }
   .parking-lock-title {
     font-size: 46rpx;
     color: #292929;
     text-align: center;
-    padding-top: 31rpx;
     line-height: 65rpx;
     font-family: PingFangSC-Regular, PingFang SC;
     font-weight: 400;
@@ -23,13 +19,17 @@
   }
   .parking-lock-info {
     width: calc(100% - 72rpx);
-    margin: 31rpx auto 54rpx;
+    margin: 31rpx auto;
     background-color: #fff;
     border-radius: 15rpx;
     padding: 39rpx 41rpx;
     .parking-lock-info-item {
       display: flex;
       margin-bottom: 16rpx;
+
+      &:last-child {
+        margin-bottom: 0;
+      }
       view {
         font-size: 28rpx;
         &:first-child {
@@ -300,7 +300,7 @@
   margin: 40rpx 0;
 }
 .parking-lock-pay-attention {
-  margin: 50rpx;
+  margin: 20rpx 50rpx;
   line-height: 48rpx;
   color: #777777;
 }

+ 5 - 1
pages/parkingLock/parkingLock.vue

@@ -113,6 +113,8 @@
         </view>
       </u-popup>
     </view>
+    <!-- 广告轮播 -->
+    <ad-banner/>
     <u-toast ref="uToast" />
   </view>
 </template>
@@ -120,9 +122,11 @@
 <script>
 import getUrlParams from '@/utils/getUrlParams.js';
 import ChoosePayment from '@/pages/choosePayment/choosePayment.vue';
+import AdBanner from '@/components/ad-banner/ad-banner.vue';
 export default {
   components: {
-    ChoosePayment
+    ChoosePayment,
+    AdBanner
   },
   data() {
     return {

+ 11 - 2
pages/roadGateSystem/roadGateSystem.scss

@@ -2,7 +2,11 @@
 .parking-lock {
 	height: calc(100vh - 88rpx);
 	background-color: #F6F6FF;
-	padding-top: 133rpx;
+	padding-top: 10rpx;
+
+	&-pay {
+		margin-bottom: 30rpx;
+	}
 	.parking-lock-title {
 		font-size: 46rpx;
 		color: #292929;
@@ -22,13 +26,18 @@
 	}
 	.parking-lock-info {
 		width: calc(100% - 72rpx);
-		margin: 31rpx auto 54rpx;
+		margin: 30rpx auto;
 		background-color: #fff;
 		border-radius: 15rpx;
 		padding: 39rpx 41rpx;
 		.parking-lock-info-item {
 			display: flex;
 			margin-bottom: 16rpx;
+
+			&:last-child {
+				margin-bottom: 0;
+			}
+
 			view {
 				font-size: 28rpx;
 				&:first-child {

+ 7 - 1
pages/roadGateSystem/roadGateSystem.vue

@@ -82,15 +82,19 @@
         <view class="rect5"></view>
       </view>
     </u-popup>
+    <!-- 广告轮播 -->
+    <ad-banner />
     <u-toast ref="uToast" />
   </view>
 </template>
 
 <script>
 import ChoosePayment from '@/pages/choosePayment/choosePayment.vue';
+import AdBanner from '@/components/ad-banner/ad-banner.vue';
 export default {
   components: {
-    ChoosePayment
+    ChoosePayment,
+    AdBanner
   },
   data() {
     return {
@@ -117,6 +121,7 @@ export default {
       spaceId: '',
       payeeId: '',
       payeeName: '',
+      pursueType: '',
       is_pay: false
     };
   },
@@ -126,6 +131,7 @@ export default {
       this.spaceId = page?.spaceId;
       this.payeeId = page?.payeeId;
       this.polyOrderId = page?.polyOrderId;
+      this.pursueType = page?.pursueType;
       this.isBack = page?.isBack;
     } else {
       this.tipsMsg = page.msg || '参数丢失!';