<template>
	<view class="content padding">
		<view class="tit">选择小区</view>
		<!-- <view class="searchBox">
			<searchRow placeholder="请输入小区名称"/>
		</view>
		<view class="poz flex-b">
			<view class="lab">当前定位城市</view>
			<view class="flex">
				<view class="icon">
					<image src="@/static/images/pozicon.png" mode=""></image>
				</view>
				<view class="city">杭州市</view>
			</view>
		</view> -->
		
		<!-- <view class="huicity">杭州市</view> -->
		
		<view class="ul">
			<view class="li" v-for="(item,index) in houseList" :key="index" @click="chooseItem(item)">{{ item.communityName }}</view>
		</view>
		
	</view>
</template>

<script setup>
	import { houseTree } from '@/config/api.js'
	import { ref } from 'vue'
	import {userStore} from '@/store/index.js';
	const counterStore = userStore();
	
	let houseList = ref([])
	
	async function houseTreeFn() {
		console.log('没有请求吗、')
		const {data: res} = await houseTree()
		res.forEach(item=>{
			houseList.value.push(item.root)
		})
		console.log(res)
		console.log(houseList.value)
	}
	
	function chooseItem(item) {
		counterStore.upDateHouse('communityId', item.communityId)
		counterStore.upDateHouse('communityName', item.communityName)
		
		uni.navigateTo({
			url: '/pages/subPage/authentication/comp/select2'
		})
	}
	
	houseTreeFn()
</script>

<style lang="scss" scoped>
	image {
		display: block;
		width: 100%;
		height: 100%;
	}
	.content {
	  .tit {
		font-size: 54rpx;
		color: #2E2E2E;
		padding: 40rpx 0 30rpx 0;
	  }
	
	  .searchBox {
		  height: 68rpx;
	  }
	
	  .poz {
		  height: 86rpx;
	    .lab {
			font-size: 28rpx;
	    }
	
	    .flex {
	      .icon {
			  width: 32rpx;
			  height: 32rpx;
	      }
	
	      .city {
			font-size: 28rpx;
			margin-left: 10rpx;
			color: $themC;
	      }
	    }
	  }
	
	  .huicity {
		width: 100%;
		height: 48rpx;
		background: #EFEFEF;
		border-radius: 10rpx;
		line-height: 48rpx;
		color: #9C9C9C;
		font-size: 28rpx;
		line-height: 48rpx;
		padding-left: 20rpx;
	  }
	
	  .ul {
		  width: 100%;
	    .li {
			width: 100%;
			height: 94rpx;
			line-height: 94rpx;
			font-size: 36rpx;
			border-bottom: 1px solid #EFEFEF;
	    }
	  }
	}
	
</style>