فهرست منبع

Merge branch 'master' of http://www.sysuimars.cn:3000/feiniao/feiniao-youwei-uniapp

wangsisi 3 هفته پیش
والد
کامیت
fecc12f4cb

+ 3 - 0
api/home.js

@@ -31,4 +31,7 @@ export default {
   fetchGardenDetail(data) {
 	  return http.get('mini/z_farm_buy_shop/get', data)
   },
+  fetchUserGarden(data) {
+	  return http.get('mini/z_farm_buy/getLightTree', data)
+  },
 }

+ 9 - 9
pages/tabBar/discover/discover.vue

@@ -10,7 +10,7 @@
 			<view class="type-wrap">
 				<up-scroll-list :indicator="typeList && typeList.length>5" indicatorColor="#FF770033" indicatorActiveColor="#FF7700" :indicatorWidth="30"
 					:indicatorBarWidth="15">
-					<view class="item-type" :class="{'active': activeType === 0}" @click="handleSelectType(0)">
+					<view class="item-type" :class="{'active': activeType === '0'}" @click="handleSelectType('0')">
 						<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon.png`" alt="" />
 						<view class="type-text">
 							全部
@@ -97,7 +97,7 @@
 	const typeSearch = ref(null)
 
 	const filterIndex = ref(0)
-	const activeType = ref(0)
+	const activeType = ref('0')
 	const orderType = ref(true)
 
 	const discoverData = ref([])
@@ -120,16 +120,16 @@
 	onShow(() => {
 		 const selectedType = uni.getStorageSync('selectedCategoryType');
 			if (selectedType) {
-				activeType.value = selectedType
-				uni.setStorageSync('selectedCategoryType', 0);
-				handleSelectType(selectedType||0)
+				uni.setStorageSync('selectedCategoryType', null);
+				handleSelectType(selectedType)
 			}
 	})
 
 	onMounted(() => {
-		console.log('onMounted')
 		getTypeList()
-		getGoodsList()
+		if (activeType.value === '0') {
+			getGoodsList()
+		}
 	})
 
 
@@ -162,7 +162,7 @@
 	function handleSelectType(id) {
 		activeType.value = id
 		let params = {}
-		if (id) {
+		if (id!=='0') {
 			params = {
 				categoryId: id
 			}
@@ -282,7 +282,7 @@
 
 		.discover-content {
 			padding: 0rpx 24rpx 24rpx;
-			height: calc(100% - 320rpx);
+			height: calc(100% - 338rpx);
 			overflow: auto;
 			background: #F2F3F5;
 			box-sizing: border-box;

+ 14 - 4
pages/tabBar/home/home.vue

@@ -3,7 +3,7 @@
 		<view class="home-top">
 			<view class="home-search">
 				<view class="search-wrap">
-					<up-search placeholder="搜索品种" v-model="typeSearch"></up-search>
+					<up-search placeholder="搜索农场名称" v-model="typeSearch"></up-search>
 				</view>
 			</view>
 			<div class="home-box" @click="toPage('allGardenMap')">
@@ -19,7 +19,7 @@
 		<view class="type-wrap">
 			<up-scroll-list :indicator="typeList && typeList.length>5" indicatorColor="#F3C11D33" indicatorActiveColor="#F3C11D"
 				:indicatorWidth="30" :indicatorBarWidth="13" ref="scrollListRef">
-				<view class="item-type" @click="toTabBar(0)">
+				<view class="item-type" @click="toTabBar('0')">
 					<image class="type-img" :src="`${config.BASIC_IMG}home/type-icon.png`" alt="" />
 					<view class="type-text">
 						全部
@@ -238,14 +238,14 @@
 	}
 
 	onLoad(async () => {
-		console.log('onLoad')
 		
 		try {
-			// 【核心修改】等待token准备就绪
+			// 等待token准备就绪
 			await userStore.getTokenSafe()
 			console.log('登录成功,token已就绪')
 			
 			// 现在可以安全地执行需要登录状态的请求
+			await getLightenTree()
 			await getTypeList()
 			await getFarmData()
 			
@@ -258,6 +258,16 @@
 			})
 		}
 	})
+	
+	async function getLightenTree() {
+		HOME.fetchUserGarden({speciesId: '1'}).then(({data}) => {
+			if (!data || !data?.id) {
+				uni.navigateTo({
+					url: "/pages/tabBar/home/subPages/gardenMap"
+				})
+			}
+		})
+	}
 
 	async function getTypeList() {
 		try {

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

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

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

@@ -177,7 +177,7 @@
 	const anchors = [
 		50,
 		Math.round(0.5 * windowHeight),
-		Math.round(0.92 * windowHeight),
+		Math.round(0.88 * windowHeight),
 	];
 	const panelHeight = ref(anchors[2]);