فهرست منبع

feat:修改bug

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

+ 1 - 0
App.vue

@@ -19,6 +19,7 @@
 					success: async({code} ) => {
 					  const { data } = await USER.fetchLogin({code})
 					  uni.setStorageSync('userInfo', data);
+					  uni.setStorageSync('token', data.token);
 					  resolve(data)
 					},
 					fail: err => {

+ 3 - 3
api/tree.js

@@ -58,9 +58,9 @@ export default {
 	rankingList(data) {
 		return http.get('mini/z_farm_buy/rankingList',data)
 	},
-	//通过品类查询当前树
-	getLightTree(data) {
-		return http.get('mini/z_farm_buy/getLightTree',data)
+	//查询当前树
+	getLightTreeList() {
+		return http.get('mini/z_farm_buy/getLightTreeList')
 	},
 	//根据样点ID查询日记列表
 	getSampleDiary(data) {

+ 7 - 1
components/posterPopup/posterPopup.vue

@@ -133,7 +133,7 @@
 	};
 
 	const getPosterData = (farmBuyId) => {
-		TREE.getPoster({farmBuyId}).then(({data,code}) =>{
+		TREE.getPoster({farmBuyId}).then(({data,code,msg}) =>{
 			if (code === 0) {
 				showPopup.value = true;
 				treeObj.value = {
@@ -141,6 +141,12 @@
 					watermarkArr: data.watermarkMsg && data.watermarkMsg.split(","),
 					...formatDate(data.createDate)
 				};
+			}else{
+				uni.showToast({
+				  title: msg,
+				  icon: 'none',
+				  duration: 2000
+				})
 			}
 		})
 	};

+ 2 - 0
pages/tabBar/tree/components/blessingsPopup.vue

@@ -130,6 +130,8 @@
 					emit('clockinCallback')
 				}
 			});
+		}else{
+			sucessPopup.value = true;
 		}
 	};
 

+ 7 - 3
pages/tabBar/tree/components/memberLevel.vue

@@ -3,10 +3,11 @@
 		<!-- 用户会员信息 -->
 		<view class="user-wrap">
 			<view class="user-info">
-				<up-image class="avatar" :fade="false" :src="userLevel.icon" width="96rpx" height="96rpx"
+				<up-image class="avatar" :fade="false" :src="userInfo.tel?userLevel.icon:`${config.BASIC_IMG}img/treePage/defalut-logo.png`" width="96rpx" height="96rpx"
 					shape="circle"></up-image>
 				<view class="level-wrap">
-					<text class="name">V{{userLevel.id}} {{levelStr[userLevel.id]}}守护</text>
+					<text class="name" v-if="userInfo.tel">V{{userLevel.id}} {{levelStr[userLevel.id]}}守护</text>
+					<text class="name" v-else>飞鸟守护</text>
 					<view class="progress-wrap">
 						<view class="progress-value">
 							<view class="total" :style="{ width: calcWidth(userLevel.energy,userLevel.energyMax+1) }"></view>
@@ -45,7 +46,8 @@
 </template>
 
 <script setup>
-	import TREE from '@/api/tree.js'
+	import TREE from '@/api/tree.js'
+	import config from "@/api/config.js"
 	import {
 		ref,
 		watch
@@ -58,6 +60,8 @@
 		},
 	});
 	
+	const userInfo = uni.getStorageSync('userInfo')
+	
 	function calcWidth(energy,energyMax){
 	    let total = (energy / energyMax) * 100
 	    if(total>100){

+ 28 - 19
pages/tabBar/tree/tree.vue

@@ -26,7 +26,7 @@
 				</view>
 				<view class="tree-name">
 					<view>{{treeName}}</view>
-					<image @click="handleEditName" class="edit-icon" :src="`${config.BASIC_IMG}img/edit-icon.png`">
+					<image v-if="userInfo.tel" @click="handleEditName" class="edit-icon" :src="`${config.BASIC_IMG}img/edit-icon.png`">
 					</image>
 				</view>
 				<image class="drone-icon" :src="`${config.BASIC_IMG}img/treePage/drone-icon.png`"></image>
@@ -112,7 +112,8 @@
 
 	const name = ref('荔枝')
 	const showPicker = ref(false)
-	const columns = ref([]);
+	const columns = ref([]);
+	const speciesId = ref('')
 	const handleShow = () => {
 		showPicker.value = true
 	}
@@ -120,7 +121,8 @@
 		showPicker.value = false
 	}
 	const handleConfirm = (e) => {
-		name.value = e.value[0].name
+		name.value = e.value[0].name
+		speciesId.value = e.value[0].speciesId
 		handleCancel()
 	}
 
@@ -181,10 +183,9 @@
 	const userInfo = ref({})
 
 	onLoad(() => {
-		userInfo.value = uni.getStorageSync('userInfo')
+		userInfo.value = uni.getStorageSync('userInfo')
 		featchIsLookedGuide()
 		featchCategoryList()
-		featchLightTree()
 	})
 	
 	onShow(()=>{
@@ -192,7 +193,8 @@
 		if(isUpdateName === 'true'){
 			featchLightTree()
 			uni.setStorageSync('isUpdateName','false')
-		}
+		}
+		featchSessionStore()
 		// 页面显示时启动弹幕
 		startDanmaku()
 	})
@@ -212,7 +214,9 @@
 		TREE.categoryList().then(({
 			data
 		}) => {
-			columns.value[0] = data || []
+			columns.value[0] = data || []
+			speciesId.value = data[0].speciesId
+			featchLightTree()
 		})
 	}
 
@@ -244,18 +248,23 @@
 			if(data?.text === 'orderSuccess'){
 				clockinType.value = 4
 				showSuccess.value = !showSuccess.value
+				treeSetSessionStore()
 			}else{
 				if (data?.val == 0) {
-					showGuardSuccess.value = !showGuardSuccess.value
-					USER.setSessionStore({
-						key: 'successTree',
-						miniUserId: userInfo.value.id,
-						val:1,
-						text:''
-					})
+					showGuardSuccess.value = !showGuardSuccess.value
+					treeSetSessionStore()
 				}
-			}
+			}
 		}))
+	}
+	
+	const treeSetSessionStore = () =>{
+		USER.setSessionStore({
+			key: 'successTree',
+			miniUserId: userInfo.value.id,
+			val:1,
+			text:'1'
+		})
 	}
 	
 	const closedCheckPopup = () =>{
@@ -264,10 +273,10 @@
 	
 	const sampleId = ref('')
 	//通过品类查询当前树
-	const featchLightTree = () =>{
-		TREE.getLightTree({farmId:766}).then((res =>{
-			sampleId.value = res.data.id
-			getBySampleId()
+	const featchLightTree = () =>{
+		TREE.getLightTreeList().then((res =>{
+			sampleId.value = res.data[0].sampleId
+			getBySampleId()
 		}))
 	}
 

+ 5 - 5
utils/http.js

@@ -59,14 +59,14 @@ class HttpRequest {
 	  
 	  // 添加token
 	  // #ifdef H5
-	  const token = '6288d39b-ed8e-4e67-9dac-796ee30eb5e4'
-	  config.header.token = token
+	  const h5Token = '6288d39b-ed8e-4e67-9dac-796ee30eb5e4'
+	  config.header.token = h5Token
 	  // #endif
 	  
 	  // #ifdef MP-WEIXIN
-	  const userInfo = uni.getStorageSync('userInfo')
-      if (userInfo) {
-		config.header.token = userInfo.token
+	  const token = uni.getStorageSync('token')
+      if (token) {
+		config.header.token = token
       }
 	  // #endif