From 8e5fb21a2bf621291c1ceee396c01e3d42553511 Mon Sep 17 00:00:00 2001
From: web <candymxq888@outlook.com>
Date: 星期四, 03 七月 2025 17:23:23 +0800
Subject: [PATCH] 修改首页,添加记录

---
 pages/user/index.vue |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/pages/user/index.vue b/pages/user/index.vue
index d8afa7c..3bdda58 100644
--- a/pages/user/index.vue
+++ b/pages/user/index.vue
@@ -1,18 +1,26 @@
 <template>
 	<view class="user" :style="{paddingTop:topHeight + 'rpx'}">
 		<view class="content">
-			<view class="user">
+			<view class="user" @click="setUser">
 				<view class="userImg">
-					<image src="/static/images/login/wx.png" mode="widthFix"></image>
+					<image :src="userInfo?.headImg" mode="widthFix"></image>
 				</view>
 				<view class="info">
-					<text class="name">张三</text>
+					<text class="name">{{userInfo?.nickName}}</text>
 				</view>
 			</view>
 			<view class="typeList">
 				<view class="typeItem">
 					<view class="name">剩余水量</view>
-					<view class="val">750m³</view>
+					<view class="val">{{userInfo?.balance}}m³</view>
+				</view>
+				<view class="typeItem">
+					<view class="name">总购水量</view>
+					<view class="val">{{userInfo?.sumBuyCount}}m³</view>
+				</view>
+				<view class="typeItem">
+					<view class="name">累计水量</view>
+					<view class="val">{{userInfo?.sumUseCount}}m³</view>
 				</view>
 			</view>
 			<view class="loginOut">
@@ -26,12 +34,19 @@
 	import { onMounted, ref } from "vue";
 	
 	const topHeight = ref(0)
+	const userInfo = ref()
 	
 	// 获取状态栏高度
 	const getTopHeight = () => {
 		if(uni.getMenuButtonBoundingClientRect){
 			topHeight.value = uni.getMenuButtonBoundingClientRect().bottom * 2
 		}
+	}
+	
+	const setUser = () => {
+		uni.navigateTo({
+			url: '/pages/userSet/index'
+		})
 	}
 	
 	// 退出登录
@@ -53,6 +68,7 @@
 	
 	onMounted(() => {
 		getTopHeight()
+		userInfo.value = JSON.parse(uni.getStorageSync('userInfo'))
 	})
 </script>
 

--
Gitblit v1.9.3