<template>
	<view class="center">
		<view style="background: linear-gradient( 180deg, #1FCA7C 0%, #F2F2F2 100%);">
			<view class="h-300 flex flex-row-between mt-200">
				<view class="flex ml-25 mt-70 v-center h-95">
					<image class="w-95 h-95 br-50" :src="userInfo.avatar"></image>
					<view class="flex-column ml-10" style="color: #FFFFFF;text-align: left;" @click="onClick(3)">
						<text class="fs-32 fw-700">{{userInfo.nickName}}</text>
						<text class="fs-24 mt-10">{{userInfo.mobile}}</text>
					</view>
				</view>
				<image class="w-344 h-266" src="/static/icon_my_bg.png"></image>
			</view>
		</view>
		<view class="mlr-25 br-12" style="background: white;margin-top: -60rpx;">
			<view class="flex-column mar-25" @click="onClick(4)">
				<text class="fs-32 fw-700 mb-30" style="text-align: left;">房屋信息</text>
				<view class="flex-column br-12 pad-25" style="background: #F3FEF9;">
					<view class="flex">
						<image class="h-42 w-42" src="/static/icon_my_fw.png"></image>
						<text class="fs-28">{{userInfo.communityName}}</text>
					</view>
					<text class="fs-24 h-54 lh-54 mt-30"
						style="background: linear-gradient( 90deg, #CAF6E2 0%, #FFFFFF 100%);">
						{{userInfo.room}}
					</text>
				</view>
			</view>
		</view>
		<view class="mlr-25 br-12 mt-30" style="background: white;">
			<view class="flex-column mar-25">
				<text class="fs-32 fw-700 mb-30" style="text-align: left;">常用功能</text>
				<view class="flex mtb-50">
					<view @click="onClick(0)" class="flex-column vh-center  fs-24" style="flex: 1;">
						<image class="h-68 w-64 mtb-10" src="/static/icon_my_wdfw.png"></image>
						<text>我的房屋</text>
					</view>
					<view @click="onClick(1)" class="flex-column vh-center fs-24" style="flex: 1;">
						<image class="h-68 w-64 mtb-10" src="/static/icon_my_wdgd.png"></image>
						<text>我的工单</text>
					</view>
					<view @click="onClick(2)" class="flex-column vh-center  fs-24" style="flex: 1;">
						<image class="h-68 w-64  mtb-10" src="/static/icon_my_ygrk.png"></image>
						<text>员工入口</text>
					</view>
				</view>
			</view>
		</view>
		<view class="mlr-25 mt-30">
			<image style="height: 160rpx;width: 100%;" src="/static/icon_my_img.png"></image>
		</view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {},

			};
		},
		onShow() {
			this.getUserInfo()
		},
		methods: {
			getUserInfo() {
				const params = {
					url: '/api/login/userInfo',
					method: 'GET',
					data: {}
				}
				this.$request(params).then(res => {
					uni.setStorageSync('userInfo', res.data)
					this.userInfo = res.data

				})
			},
			onClick(index) {
				if (index == 3) {
					this.$wskj.to("/pagesMine/pages/zlbj")
					return
				}
				if (index == 4) {
					this.$wskj.to("/pagesMine/pages/fwxx")
					return
				}
				if (index == 0) {
					this.$wskj.to("/pagesMine/pages/wdfw")
					return
				}
				if (index == 1) {
					this.$wskj.to("/pagesMain/pages/bxbs_lsgd")
					return
				}
				if (index == 2) {
					if (this.$wskj.isNull(uni.getStorageSync('userInfo_yg'))) {
						this.$wskj.to("/pagesMine/pages/yg_login")
					} else {
						this.$wskj.to("/pagesMine/pages/ygzy")
					}
					return
				}
			}
		}
	};
</script>

<style>
	.center {
		height: 100vh;
		display: flex;
		flex-direction: column;
		background: #F2F2F2;
	}

	.item {
		width: 100%;
		height: 200rpx;
		margin-top: 20rpx;
	}
</style>