lxf 4 недель назад
Родитель
Сommit
828dadcd11

+ 2 - 2
App.vue

@@ -1,8 +1,8 @@
 <script>
 	import USER from '@/api/user.js'
 	export default {
-		onLaunch: function() {
-			this.handleWxLogin()
+		onLaunch: async function() {
+			await this.handleWxLogin()
 		},
 		onShow: function() {
 			console.log('App Show')

+ 7 - 1
api/home.js

@@ -18,5 +18,11 @@ export default {
   },
   fetchTypeList() {
 	  return http.get('mini/bur_category/list')
-  }
+  },
+  fetchHotList(data) {
+	  return http.get('mini/farm_buy_goods/top', data)
+  },
+  fetchGoodsList(data) {
+	  return http.get('mini/farm_buy_goods/list', data)
+  },
 }

+ 6 - 1
pages.json

@@ -35,7 +35,7 @@
 		{
 			"path": "pages/tabBar/home/subPages/gardenItem",
 			"style": {
-				"navigationBarTitleText": ""
+				"navigationBarTitleText": "有味果园"
 			}
 		},
 		{
@@ -90,6 +90,11 @@
 			"style": {
 				"navigationBarTitleText": "溯源报告"
 			}
+		}, {
+			"path": "pages/tabBar/home/subPages/gardenList",
+			"style": {
+				"navigationBarTitleText": "有味果园"
+			}
 		}
 	],
 	"globalStyle": {

+ 1 - 0
pages/login/index.vue

@@ -113,6 +113,7 @@
 	.login-container {
 		.base-container {
 			@include ossBg("login-bj.png");
+			height: 100vh;
 			
 			.tabbar {
 				width: 100%;

+ 72 - 78
pages/tabBar/discover/discover.vue

@@ -10,58 +10,17 @@
 			<view class="type-wrap">
 				<up-scroll-list indicatorColor="#FF770033" indicatorActiveColor="#FF7700" :indicatorWidth="30"
 					:indicatorBarWidth="13">
-					<view class="item-type" :class="{'active': activeType === 0}">
+					<view class="item-type" :class="{'active': activeType === 0}" @click="handleSelectType(null, 0)">
 						<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon.png`" alt="" />
 						<view class="type-text">
 							全部
 						</view>
 					</view>
-					<view class="item-type">
-						<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-2.png`" alt="" />
+					<view class="item-type" v-for="(item, index) in typeList"
+						:class="{'active': activeType === index+1}" :key="index" @click="handleSelectType(item.id, index+1)">
+						<image class="type-img" :src="item.image" alt="" />
 						<view class="type-text">
-							龙眼
-						</view>
-					</view>
-					<view class="item-type">
-						<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-3.png`" alt="" />
-						<view class="type-text">
-							葡萄
-						</view>
-					</view>
-					<view class="item-type">
-						<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon.png`" alt="" />
-						<view class="type-text">
-							水蜜桃
-						</view>
-					</view>
-					<view class="item-type">
-						<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-2.png`" alt="" />
-						<view class="type-text">
-							龙眼
-						</view>
-					</view>
-					<view class="item-type">
-						<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-3.png`" alt="" />
-						<view class="type-text">
-							葡萄
-						</view>
-					</view>
-					<view class="item-type">
-						<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-3.png`" alt="" />
-						<view class="type-text">
-							葡萄
-						</view>
-					</view>
-					<view class="item-type">
-						<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon.png`" alt="" />
-						<view class="type-text">
-							水蜜桃
-						</view>
-					</view>
-					<view class="item-type">
-						<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon-2.png`" alt="" />
-						<view class="type-text">
-							龙眼
+							{{item.name}}
 						</view>
 					</view>
 				</up-scroll-list>
@@ -86,7 +45,7 @@
 			<view class="discover-list">
 				<view class="list-line">
 					<view class="list-item" v-for="(item, index) in discoverData" :key="index">
-						<image class="item-img" :src="`${config.BASIC_IMG}home/fruit.png`" mode=""></image>
+						<image class="item-img" :src="item.img" mode="aspectFill"></image>
 						<view class="item-desc">
 							<view class="item-text">
 								{{item.name}}
@@ -95,13 +54,13 @@
 								<text class="subtext-text">坏单包退</text>
 								<text class="subtext-text">包邮</text>
 							</view>
-							
+
 							<view class="info-price">
 								<view class="price-text">
 									<text class="price-unit">¥</text>{{item.price}}
 								</view>
 								<view class="info-sold">
-									已售{{item.sold}}
+									已售{{item.salesVal}}
 								</view>
 							</view>
 						</view>
@@ -114,44 +73,65 @@
 
 <script setup>
 	import {
+		onMounted,
 		ref
 	} from "vue";
 	import config from "@/api/config.js"
+	import HOME from "@/api/home.js"
 
 	const typeSearch = ref(null)
 
 	const filterIndex = ref(0)
 	const activeType = ref(0)
-	
-	const discoverData = ref([
-		{
-			name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
-			text: "",
-			price: '107',
-			sold: "1250"
-		},
-		{
-			name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
-			text: "",
-			price: '107',
-			sold: "1250"
-		},
-		{
-			name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
-			text: "",
-			price: '107',
-			sold: "1250"
-		},
-		{
-			name: "海南妃子笑荔枝新鲜采摘新鲜采摘",
-			text: "",
-			price: '107',
-			sold: "1250"
-		}
-	])
+
+	const discoverData = ref([])
+	let sortObj = {
+		0: "id",
+		1: "price",
+		2: "salesVal"
+	}
 
 	function selectFilter(i) {
 		filterIndex.value = i
+		sort.value = sortObj[i]
+		getGoodsList()
+	}
+
+	onMounted(() => {
+		getTypeList()
+		getGoodsList()
+	})
+
+
+	const typeList = ref([])
+
+	function getTypeList() {
+		HOME.fetchTypeList().then(({
+			data
+		}) => {
+			typeList.value = data
+		})
+	}
+
+	const sort = ref("id")
+	function getGoodsList(param) {
+		let params = {...param, sort: sort.value}
+		HOME.fetchGoodsList(params).then(({
+			data
+		}) => {
+			discoverData.value = data
+		})
+	}
+	
+	function handleSelectType(id, index) {
+		activeType.value = index
+		let params = {}
+		if (id) {
+			params = {
+				categoryId: id
+			}
+		}
+		getGoodsList(params)
 	}
 </script>
 
@@ -228,9 +208,11 @@
 						width: 92rpx;
 						height: 92rpx;
 					}
+
 					.type-text {
 						line-height: 36rpx;
 					}
+
 					&.active {
 						.type-text {
 							background-color: #FFD95E;
@@ -263,25 +245,31 @@
 					}
 				}
 			}
+
 			.discover-list {
 				padding-top: 20rpx;
+
 				.list-line {
 					padding-bottom: 20rpx;
 					display: flex;
 					flex-wrap: wrap;
+
 					.list-item {
 						background-color: #FFFFFF;
 						border-radius: 10rpx;
 						width: calc(50% - 16rpx);
 						margin-bottom: 20rpx;
+
 						.item-img {
 							width: 100%;
 							height: 340rpx;
 							object-fit: cover;
 							border-radius: 10rpx 10rpx 0 0;
 						}
+
 						.item-desc {
 							padding: 0 10rpx 10rpx;
+
 							.item-text {
 								width: calc(100% - 22rpx);
 								overflow: hidden;
@@ -292,26 +280,31 @@
 								font-weight: 600;
 								white-space: nowrap;
 							}
+
 							.item-subtext {
 								color: #AFAFAF;
 								font-size: 24rpx;
 								line-height: 36rpx;
-								.subtext-text + .subtext-text {
+
+								.subtext-text+.subtext-text {
 									padding-left: 10rpx;
 								}
 							}
-							
+
 							.info-price {
 								display: flex;
 								align-items: baseline;
 								justify-content: space-between;
+
 								.price-text {
 									color: #FF7700;
 									font-size: 36rpx;
+
 									.price-unit {
 										font-size: 23rpx;
 									}
 								}
+
 								.info-sold {
 									font-size: 20rpx;
 									color: #C4C4C4;
@@ -319,6 +312,7 @@
 							}
 						}
 					}
+
 					.list-item:nth-child(2n) {
 						margin-left: 20rpx;
 					}

+ 47 - 29
pages/tabBar/home/home.vue

@@ -6,7 +6,7 @@
 					<up-search placeholder="搜索品种" v-model="typeSearch"></up-search>
 				</view>
 			</view>
-			<map
+			<!-- <map
 			    id="mapId"
 			    :latitude="latitude"
 			    :longitude="longitude"
@@ -22,7 +22,10 @@
 				:enable-building="false"
 			    show-location
 			    style="width: 100%; height: 280rpx;clip-path: inset(0rpx round 16rpx);"
-			  ></map>
+			  ></map> -->
+			  <video src="https://birdseye-img.sysuimars.com/temp/5-25lby.mp4" object-fit="cover" :show-fullscreen-btn="false"
+			  	:autoplay="true" class="map-video" loop muted :show-progress="false" :show-play-btn="false">
+			  </video>
 			<view class="map-tips" @click="toPage('allGardenMap')">
 				飞鸟入驻管理果场详情,点击查看
 			</view>
@@ -46,7 +49,7 @@
 		</view>
 		<!-- 好味热卖 -->
 		<view class="home-hot">
-			<hot-component-vue></hot-component-vue>
+			<hot-component-vue :farmId="766"></hot-component-vue>
 		</view>
 		
 		<!-- 有味果园 -->
@@ -67,12 +70,15 @@
 						:key="farm.farmId || farm.id"
 						@click="goGardenItem(farm)"
 					>
-						<view class="garden-l">
-							<image
-								class="garden-img"
-								:src="farm.img || `${config.BASIC_IMG}home/garden.png`"
-								mode=""
-							></image>
+						<view class="garden-l" v-if="farm.coverVideo">
+							<video :src="farm.coverVideo" :show-progress="false" :show-play-btn="false"
+								:show-center-play-btn="false" object-fit="cover" :show-fullscreen-btn="false"
+								 disablePictureInPicture :autoplay="true" class="video-dom"
+								loop muted>
+							</video>
+						</view>
+						<view class="garden-l" v-else>
+							<image class="garden-img" :src="`${config.BASIC_IMG}home/garden.png`" mode=""></image>
 							<text class="img-text">无人机实拍视频</text>
 						</view>
 						<view class="garden-r">
@@ -107,6 +113,7 @@ import { ref, onMounted } from 'vue'
 import config from "@/api/config.js"
 import HOME from '@/api/home'
 import hotComponentVue from './hotComponent.vue'
+import { onLoad } from "@dcloudio/uni-app"
 
 const typeSearch = ref(null)
  
@@ -140,19 +147,19 @@ const farmList = ref([]) // 新增果园列表数据
 const scale = ref(10)
 const gardenList = ref([])
 
-onMounted(async () => {
+onLoad(async () => {
   // #ifdef MP-WEIXIN
-  mapCtx.value = uni.createMapContext('mapId')
+  // mapCtx.value = uni.createMapContext('mapId')
   
-  mapCtx.value.on('markerClusterClick', res => {
-    console.log('markerClusterClick', res)
-  })
+  // mapCtx.value.on('markerClusterClick', res => {
+  //   console.log('markerClusterClick', res)
+  // })
   
   getTypeList()
   
   getFarmData()
   
-  bindEvent()
+  // bindEvent()
   // #endif
 })
 
@@ -165,21 +172,21 @@ function getTypeList() {
  
 function getFarmData() {
   HOME.getAllFarm().then(({data}) => {
-     farmList.value = (data || []).sort((a, b) => {
-	  // 优先排序:lighten为true的排前面,然后按recommend排序
-	  if (a.lighten !== b.lighten) return b.lighten ? 1 : -1
-	  return (b.recommend || 0) - (a.recommend || 0)
-	})
 	gardenList.value = data.filter(item => item.recommend !== null)
-    if(farmList.value.length > 0) {
-      // 设置地图中心点为第一个果园的位置
-      const firstPoint = parsePoint(farmList.value[0].point)
-      latitude.value = firstPoint.latitude
-      longitude.value = firstPoint.longitude
+ //     farmList.value = (data || []).sort((a, b) => {
+	//   // 优先排序:lighten为true的排前面,然后按recommend排序
+	//   if (a.lighten !== b.lighten) return b.lighten ? 1 : -1
+	//   return (b.recommend || 0) - (a.recommend || 0)
+	// })
+ //    if(farmList.value.length > 0) {
+ //      // 设置地图中心点为第一个果园的位置
+ //      const firstPoint = parsePoint(farmList.value[0].point)
+ //      latitude.value = firstPoint.latitude
+ //      longitude.value = firstPoint.longitude
       
-      // 生成标记点
-      generateMarkers(farmList.value)
-    }
+ //      // 生成标记点
+ //      generateMarkers(farmList.value)
+ //    }
   })
 }
 
@@ -352,9 +359,14 @@ const removeMarkers = () => {
 			background: linear-gradient(#FFFFFF, rgba(242, 243, 245, 0));
 			position: relative;
 		}
+		.map-video {
+			width: 100%;
+			height: 280rpx;
+			border-radius: 16rpx;
+		}
 		.map-tips {
 			position: absolute;
-			bottom: 0%;
+			bottom: 6rpx;
 			left: 24rpx;
 			height: 70rpx;
 			width: calc(100% - 48rpx);
@@ -449,6 +461,12 @@ const removeMarkers = () => {
 						display: flex;
 						.garden-l {
 							position: relative;
+							.video-dom {
+								width: 234rpx;
+								height: 200rpx;
+								object-fit: cover;
+								border-radius: 10rpx;
+							}
 							.garden-img {
 								width: 254rpx;
 								height: 200rpx;

+ 32 - 61
pages/tabBar/home/hotComponent.vue

@@ -16,75 +16,21 @@
 				<up-scroll-list indicatorColor="#FF770033" indicatorActiveColor="#FF7700" :indicatorWidth="30"
 					:indicatorBarWidth="13">
 					<view class="hot-panel">
-						<view class="hot-item">
-							<image class="hot-img" :src="`${config.BASIC_IMG}home/hot-1.png`" mode=""></image>
+						<view class="hot-item" v-for="(item, index) in hotList" :key="index">
+							<image class="hot-img" :src="item.img" mode=""></image>
 							<view class="item-info">
 								<view class="info-text">
 									<!-- <up-text :lines="2" color="#000000" size="12" text="海南妃子笑新鲜顺丰发货海南妃子笑海南妃子笑"></up-text> -->
 									<view class="ellipsis-l2">
-										海南妃子笑新鲜顺丰发货海南妃子笑海南妃子笑
+										{{ item.name }}
 									</view>
 								</view>
 								<view class="info-price">
 									<view class="price-text">
-										<text class="price-unit">¥</text>108
+										<text class="price-unit">¥</text>{{ item.price }}
 									</view>
 									<view class="info-sold">
-										已售1251
-									</view>
-								</view>
-							</view>
-						</view>
-						<view class="hot-item">
-							<image class="hot-img" :src="`${config.BASIC_IMG}home/hot-2.png`" mode=""></image>
-							<view class="item-info">
-								<view class="info-text">
-									<view class="ellipsis-l2">
-										海南妃子笑新鲜顺丰发货海南妃子笑海南妃子笑
-									</view>
-								</view>
-								<view class="info-price">
-									<view class="price-text">
-										<text class="price-unit">¥</text>108
-									</view>
-									<view class="info-sold">
-										已售1251
-									</view>
-								</view>
-							</view>
-						</view>
-						<view class="hot-item">
-							<image class="hot-img" :src="`${config.BASIC_IMG}home/hot-1.png`" mode=""></image>
-							<view class="item-info">
-								<view class="info-text">
-									<view class="ellipsis-l2">
-										海南妃子笑新鲜顺丰发货海南妃子笑海南妃子笑新鲜顺丰发货
-									</view>
-								</view>
-								<view class="info-price">
-									<view class="price-text">
-										<text class="price-unit">¥</text>108
-									</view>
-									<view class="info-sold">
-										已售1251
-									</view>
-								</view>
-							</view>
-						</view>
-						<view class="hot-item">
-							<image class="hot-img" :src="`${config.BASIC_IMG}home/hot-2.png`" mode=""></image>
-							<view class="item-info">
-								<view class="info-text">
-									<view class="ellipsis-l2">
-										海南妃子笑新鲜顺丰发货海南妃子笑海南妃子笑新鲜顺丰发货
-									</view>
-								</view>
-								<view class="info-price">
-									<view class="price-text">
-										<text class="price-unit">¥</text>108
-									</view>
-									<view class="info-sold">
-										已售1251
+										已售{{ item.salesVal }}
 									</view>
 								</view>
 							</view>
@@ -97,13 +43,36 @@
 </template>
 
 <script setup>
-	import config from "@/api/config.js"
+	import { watch, ref, onMounted } from 'vue'
+	import HOME from '@/api/home.js'
 	const props = defineProps({
 		isGardeItem: {
 			type: Boolean,
 			default: false
+		},
+		farmId: {
+			type: [String, Number],
+			default: null
 		}
 	})
+	const hotList = ref([])
+	watch(() => props.farmId, (newVal) => {
+		console.log('newVal', newVal)
+		getHotList()
+	})
+
+	onMounted(() => {
+		getHotList()
+	})
+
+	const getHotList = () => {
+		HOME.fetchHotList({
+			farmId: props.farmId
+		}).then(({data}) => {
+			console.log('data', data)
+			hotList.value = data
+		})
+	}
 </script>
 
 <style lang="scss" scoped>
@@ -152,7 +121,8 @@
 					display: flex;
 
 					.hot-item {
-						width: calc(50% - 10rpx);
+						// width: calc(50% - 10rpx);
+						// width: calc(100% - 20rpx);
 						display: flex;
 						white-space: nowrap;
 
@@ -174,6 +144,7 @@
 							}
 
 							.info-price {
+								padding-top: 10rpx;
 								display: flex;
 								align-items: baseline;
 								justify-content: space-between;

+ 1 - 1
pages/tabBar/home/subPages/allGardenMap.vue

@@ -15,7 +15,7 @@
 
 	onMounted(() => {
 		// webViewUrl.value =
-			// `https://feiniao-mini-h5-dev.sysuimars.cn/youwei/#/allGardenMap?userId=${userInfo.id}&token=${userInfo.token}`
+		// 	`https://feiniao-mini-h5-dev.sysuimars.cn/youwei/#/allGardenMap?userId=${userInfo.id}&token=${userInfo.token}`
 		webViewUrl.value = "http://localhost:8081/#/allGardenMap?userId=91754&token=034d7cf5-25fc-42d3-993e-460120419e5a"
 	})
 </script>

+ 0 - 8
pages/tabBar/home/subPages/gardenList.vue

@@ -92,14 +92,6 @@
 						height: 200rpx;
 						object-fit: cover;
 						border-radius: 10rpx;
-
-						&::-webkit-media-controls-volume-control-container {
-							display: none !important;
-						}
-
-						&::-internal-media-controls-overflow-button {
-							display: none !important;
-						}
 					}
 
 					.garden-img {