Browse Source

修复bug,解决toast一闪而过

学习?学个屁 1 week ago
parent
commit
76f3f229c2

+ 4 - 4
src/pages/index/courseDetail/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<zzx-navbar :scrollable="true" :back="true" title="详情"></zzx-navbar>
 	<view class="detail-header">
-		<image class="header-bg" :src="bannerList[0]" mode="">
+		<image class="header-bg" :src="courseDetailInfo?.cover" mode="">
 		</image>
 		<view class="back-icon" :style="{ paddingTop: (statusBarHeight + 10) + 'px' }" @click="RouterUtils.back()">
 			<zzx-icon name="back"></zzx-icon>
@@ -319,9 +319,9 @@ const get_courseInfo = () => {
 		if (res.result && res.result.details) {
 			res.result.details = fixImgStyle(res.result.details);
 		}
-		const startIndex = res.result.cover ? res.result.cover.indexOf('"') + 1 : 0;
-		const endIndex = res.result.cover ? res.result.cover.lastIndexOf('') : 0;
-		bannerList.value = res.result.cover ? res.result.cover.slice(startIndex, endIndex).split(',') : [];
+		const startIndex = res.result.backgroundImage ? res.result.backgroundImage.indexOf('"') + 1 : 0;
+		const endIndex = res.result.backgroundImage ? res.result.backgroundImage.lastIndexOf('') : 0;
+		bannerList.value = res.result.backgroundImage ? res.result.backgroundImage.slice(startIndex, endIndex).split(',') : [];
 		let videoIndex = res.result.video ? res.result.video.indexOf('"') + 1 : 0;
 		let videoEndIndex = res.result.video ? res.result.video.lastIndexOf('') : 0;
 		videoList.value = res.result.video ? res.result.video.slice(videoIndex, videoEndIndex).split(',') : [];

+ 16 - 5
src/pages/index/detail/components/venue.vue

@@ -7,11 +7,11 @@
 				<view class="sales">年售{{ item.sales }}</view>
 			</view>
 			<view class="type">
-				<text v-for="(category, index) in item.category" :key="index">{{ category }}</text>
+				<view class="type-item" v-for="(category, index) in item.category" :key="index">{{ category }}</view>
 			</view>
 			<view class="price-info">
 				<view class="price">
-					<view class="">¥{{ item.sellingPrice||'0.00' }}</view>
+					<view class="">¥{{ item.sellingPrice || '0.00' }}</view>
 					<!-- <view class="">¥{{ item.originalPrice }}</view> -->
 				</view>
 				<view class="price-btn">免费预约</view>
@@ -73,9 +73,20 @@ const venuePreview = (item: any) => {
 		}
 
 		.type {
-			margin-top: 16rpx;
-			font-size: 24rpx;
-			color: #AAAAAA;
+			display: flex;
+			align-items: center;
+			gap: 12rpx;
+			flex-wrap: wrap;
+
+			.type-item {
+				margin-top: 16rpx;
+				font-size: 24rpx;
+				color: #AAAAAA;
+				background: #F5F5F5;
+				border-radius: 8rpx;
+				border: 2rpx solid #F5F5F5;
+				padding: 6rpx;
+			}
 		}
 
 		.price-info {

+ 21 - 6
src/pages/index/gymDetail/index.vue

@@ -19,13 +19,16 @@
 	<view :style="{ height: (statusBarHeight + 34) + 'px' }"></view>
 	<view class="header-info">
 		<view class="venue-name">
-			<view style="display: flex;gap: 20rpx;align-items: center;">
+			<view>
 				<view class="name">{{ detailInfo.name }}</view>
-				<view class="open-status">{{ detailInfo.runStatus ? '营业中' : '歇业中' }}</view>
+				<view class="open-status-info">
+					<view class="open-status">{{ detailInfo.runStatus ? '营业中' : '歇业中' }}</view>
+					<view class="open-time-info">{{ detailInfo?.startTime }}-{{ detailInfo?.endTime }}</view>
+				</view>
 			</view>
 			<view class="star">
 				<zzx-icon name="star" size="12"></zzx-icon>
-				<text>{{ detailInfo.goodRate||'0.0'}}</text>
+				<text>{{ detailInfo.goodRate || '0.0' }}</text>
 			</view>
 		</view>
 		<view class="open-time" v-if="teachingDay">
@@ -36,6 +39,7 @@
 						:key="index">{{ item.startTime + '-' + item.endTime || '--' }}</text></view>
 			</view>
 		</view>
+
 		<view class="venues-tags">
 			<view class="tags-box">
 				<view class="tags" v-for="(item, index) in detailInfo.facilityInfo" :key="index">{{ item }}</view>
@@ -589,9 +593,20 @@ const getFindByOrderPage = () => {
 		align-items: center;
 		justify-content: space-between;
 
-		.open-status {
-			font-size: 24rpx;
-			color: #4DD951;
+		.open-status-info {
+			margin-top: 20rpx;
+			display: flex;
+			align-items: center;
+			gap: 20rpx;
+			.open-status {
+				font-size: 24rpx;
+				color: #4DD951;
+			}
+
+			.open-time-info {
+				font-size: 24rpx;
+				color: #AAAAAA;
+			}
 		}
 
 		.name {

+ 10 - 10
src/pages/index/gymPay/index.vue

@@ -44,7 +44,7 @@
 				</view>
 			</view>
 			<view class="subtotal">小计 ¥
-				<text v-if="buyType == 1">0.00</text>
+				<text v-if="buyType == 1">{{ (0+ totalInsurePrice).toFixed(2) }}</text>
 				<text v-else>{{ previewCourseInfo?.originalPrice ? (previewCourseInfo?.sellingPrice *
 					countTotal).toFixed(2) :
 					(previewCourseInfo?.sellingPrice.toFixed(2) - (previewCourseInfo?.sellingPrice -
@@ -174,7 +174,7 @@
 			<view class="footer-btn" @click="submitOrder">
 				<button>
 					<view class="btn-price">
-						<text v-if="buyType == 1">0.00</text>
+						<text v-if="buyType == 1">{{ (0 + totalInsurePrice).toFixed(2) }}</text>
 						<text v-else>
 							¥{{ previewCourseInfo?.originalPrice ? (previewCourseInfo?.sellingPrice *
 								countTotal).toFixed(2) :
@@ -207,7 +207,7 @@
 <script lang="ts" setup>
 import { ref, onMounted, computed } from 'vue';
 import { onLoad, onShareAppMessage } from '@dcloudio/uni-app';
-import { RouterUtils, TipsUtils, idCardHide,debounce } from '@/utils/util';
+import { RouterUtils, TipsUtils, idCardHide, debounce } from '@/utils/util';
 import { http } from '@/utils/http'
 import { useCacheStore } from '@/stores/cache'
 const cache = useCacheStore()
@@ -228,7 +228,7 @@ onLoad((options) => {
 })
 
 onShareAppMessage((res) => {
-	if (res.from === 'button') {// 来自页面内分享按钮
+	if (res.from === 'button') {
 		console.log(res.target)
 	}
 	return {
@@ -265,7 +265,7 @@ const get_userData = () => {
 }
 
 const deleteUser = async (e) => {
-	let res = await TipsUtils.tips_alert('确定删除该用户吗?', true)
+	let res:any = await TipsUtils.tips_alert('确定删除该用户吗?', true)
 	if (res.confirm) {
 		userData.value = userData.value.filter(user => user.id !== e.id)
 	}
@@ -438,13 +438,13 @@ const submitOrderImpl = () => {
 		success(res) {
 			TipsUtils.tips_toast('订阅成功')
 			http.post('/order/createOrder', data, { loading: true }).then((res) => {
-				getOrderQuery(res.result.orderCode,res.result.orderId)
+				getOrderQuery(res.result.orderCode, res.result.orderId)
 			})
 		},
 		fail(err) {
 			console.log(err, '订阅消息失败')
 			http.post('/order/createOrder', data, { loading: true }).then((res) => {
-				getOrderQuery(res.result.orderCode,res.result.orderId)
+				getOrderQuery(res.result.orderCode, res.result.orderId)
 			})
 		}
 	})
@@ -453,13 +453,13 @@ const submitOrderImpl = () => {
 const submitOrder = debounce(submitOrderImpl, 500)
 
 // code编码 "100001支付成功";"100002查询失败"; "100003查询中 "; "100004支付失败"
-const getOrderQuery = (orderCode: string,orderId:string, retryCount = 0) => {
+const getOrderQuery = (orderCode: string, orderId: string, retryCount = 0) => {
 	http.get('/order/orderQuery', { data: { orderCode: orderCode }, loading: true }).then((res) => {
 		if (res.result == '100001') {
 			RouterUtils.to_page(`/pages/index/toBeUsed/index?orderId=${orderId}&orderType=${orderFormData.value.orderType}`)
 		} else if (retryCount <= 3) {
 			setTimeout(() => {
-				getOrderQuery(orderCode,orderId, retryCount + 1)
+				getOrderQuery(orderCode, orderId, retryCount + 1)
 			}, 1000)
 		} else {
 			if (res.result == '100003') {
@@ -475,7 +475,7 @@ const getOrderQuery = (orderCode: string,orderId:string, retryCount = 0) => {
 		console.error('查询订单失败:', error)
 		if (retryCount < 2) {
 			setTimeout(() => {
-				getOrderQuery(orderCode,orderId, retryCount + 1)
+				getOrderQuery(orderCode, orderId, retryCount + 1)
 			}, 1000)
 		}
 	})

+ 4 - 3
src/pages/index/instructorDetail/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<zzx-navbar :scrollable="true" :back="true" title="详情"></zzx-navbar>
 	<view class="detail-header" v-if="detailObj">
-		<image class="header-bg":src="detailObj.backgroundImg" mode="widthFix"></image>
+		<image class="header-bg":src="detailObj.backgroundImg" mode="aspectFill"></image>
 		<view class="back-icon" :style="{ paddingTop: (statusBarHeight + 10) + 'px' }" @click="RouterUtils.back()">
 			<zzx-icon name="back"></zzx-icon>
 		</view>
@@ -76,7 +76,7 @@
 						<view style="height: 24rpx;"></view>
 					</view>
 				</view>
-				<view class="not-data" v-if="detailObj.courseInfoVOList.length < 1">暂无课程数据</view>
+				<view class="not-data" v-if="detailObj.courseInfoVOList?.length < 1">暂无课程数据</view>
 			</view>
 		</view>
 		<view class="appraise-card">
@@ -111,7 +111,7 @@
 					</view>
 				</scroll-view>
 			</view>
-			<view class="not-data" v-if="!appraiseList.records.length">暂无评价数据</view>
+			<view class="not-data" v-if="!appraiseList.records?.length">暂无评价数据</view>
 		</view>
 	</view>
 </template>
@@ -183,6 +183,7 @@ const getFindByOrderPage = () => {
 		position: absolute;
 		width: 100%;
 		z-index: -100;
+		max-height: 432rpx;
 	}
 
 	.back-icon {

+ 2 - 2
src/pages/index/training/index.vue

@@ -11,7 +11,7 @@
 			<view :class="sel_btn===index?'distance':'score'" v-for="(item,index) in selectList" :key="index"
 				@click="select_btn(item,index)">{{item.text}}</view>
 		</view>
-		<block v-if="courseList.length>0">
+		<block v-if="courseList?.length>0">
 			<view class="t-card-list" v-for="item in courseList" :key="item.id" @click="RouterUtils.to_page(`/pages/index/courseDetail/index?id=${item.id}`)">
 				<view class="t-courseImg">
 					<image :src="item.cover" mode=""></image>
@@ -19,7 +19,7 @@
 				<view class="t-course">
 					<view class="c-title textHidden">{{item.name}}</view>
 					<view class="c-address" v-if="item.km">{{item.address}} | {{item.km.toFixed(2)}}km</view>
-					<view class="c-price" v-if="item.sellingPrice">¥{{ item.sellingPrice.toFixed(2) }}
+					<view class="c-price">¥{{ item?.sellingPrice.toFixed(2) }}
 						<text v-if="item.priceType==0&&item.originalPrice"
 							style="font-size: 22rpx;color: #AAAAAA;text-decoration: line-through;">¥{{ item.originalPrice.toFixed(2) }}</text>
 					</view>

+ 1 - 1
src/pages/index/venue/index.vue

@@ -13,7 +13,7 @@
 		<view v-if="!searchLoading">
 			<view class="venue-card" v-for="item in dataList" @click="gotoDetail(item)" :key="item.id">
 				<view class="venues-image">
-					<image :src="item.cover" mode=""></image>
+					<image :src="item.cover.split(',')[0]" mode=""></image>
 					<view class="e-badge">
 						<image src="/src/static/events-icon1.png" mode="widthFix"></image>
 						<view class="text">{{item.ticketWhether?'今日有票':'暂无余票'}}</view>

+ 11 - 7
src/utils/http/index.ts

@@ -100,7 +100,7 @@ export class HttpClient {
   async request<T = any>(config: RequestConfig): Promise<T> {
     let mergedConfig: RequestConfig = { ...this.defaults, ...config }
     const requestKey = this.createRequestKey(mergedConfig)
-    
+
     // 取消重复请求
     if (this.pendingRequests.has(requestKey)) {
       this.pendingRequests.get(requestKey)?.abort()
@@ -145,7 +145,7 @@ export class HttpClient {
             complete: () => {
               this.pendingRequests.delete(requestKey)
               if (mergedConfig.loading) {
-                uni.hideLoading()
+                uni.hideLoading({noConflict:true})
               }
             }
           }) as RequestTask
@@ -179,9 +179,9 @@ export class HttpClient {
 
 // 创建实例
 export const http = new HttpClient({
-  baseURL: 'http://192.168.1.34:8080/jeecg-boot/app',
+  // baseURL: 'http://192.168.1.34:8080/jeecg-boot/app',
   // baseURL: 'http://192.168.1.166:8080/jeecg-boot/app',
-  // baseURL: 'http://192.168.0.11:8080/jeecg-boot/app',
+  baseURL: 'http://192.168.0.11:8080/jeecg-boot/app',
   headers: {
     'Content-Type': 'application/json'
   }
@@ -194,7 +194,7 @@ uni.addInterceptor('request', {
     if (args.header && (args.header as any).skipAuth) return
     const tokenStorage = uni.getStorageSync('TOKEN')
     const tokenValue = HttpClient.checkTokenValidity(tokenStorage)
-    
+
     if (tokenValue) {
       args.header = args.header || {}
       args.header['x-access-token'] = tokenValue
@@ -208,6 +208,7 @@ uni.addInterceptor('request', {
 })
 
 //响应拦截器
+let isShowing = false;
 uni.addInterceptor('request', {
   success: (res) => {
     const data = res.data as HttpResponse
@@ -218,7 +219,7 @@ uni.addInterceptor('request', {
         duration: 2000
       })
       setTimeout(() => {
-       uni.clearStorage()
+        uni.clearStorage()
       }, 500)
       return {
         ...res,
@@ -226,9 +227,12 @@ uni.addInterceptor('request', {
         data: null
       }
     } else if (data.code !== 200) {
+      if (isShowing) return;
+      isShowing = true;
       uni.showToast({
         title: data.message,
-        icon: 'none'
+        icon: 'none',
+        duration: 3000
       })
       return {
         ...res,