
<template>
	<view>
		<image src="/static/icon/background.png" mode="" class="background"></image>
		<view style="padding-top: 40rpx;">
			<view style="margin: 20rpx;">
				<u-search placeholder="请输入小区名称" v-model="nameValue"  :action-style="{'font-size':'40rpx'}" :show-action="false" @search="getProjectList()"></u-search>
			</view>
			<view v-for="(item,index) in list" :key="index" >
				<view class="project-content houseList" @click="gotoindex(item)">
					<view class="font-forty-eight houseList_in">
						<span>{{item.name}}</span>
						<u-icon name="arrow-right"></u-icon>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import service from '@/api/index.js'
	export default {
		data() {
			return {
				list:[],
				value:'',
				nameValue:'',
				civilPower:'',
				userId:''
			}
		},
		onLoad(e) {
			console.log(e)
			this.value = e.value
			this.getUserName();
			 //this.getProjectList();
			uni.setNavigationBarTitle({
					title: '选择小区',
			});
			uni.setNavigationBarColor({
			    frontColor: '#ffffff',
			    backgroundColor: '#2d95f4',
			})
		},
		methods: {
			gotoindex(item){
				console.log(item)
				if(this.value==2)
				{
					uni.navigateTo({
						url:`/pages/noLogin/PressureRegulatingBox/PressureRegulatingBox?community=${item.id}&communityName=${item.name}`
					})
				}else if(this.value==3)
				{
					uni.navigateTo({
						url:`/pages/noLogin/CourtyardNetworkManagement/CourtyardNetworkManagement?community=${item.id}&communityName=${item.name}`
					})
				}else
				{
					uni.navigateTo({
						url:`/pages/noLogin/buildinglist?value=${this.value}&community=${item.id}`
					})
				}
				
			},
			topage(url){
				uni.navigateTo({
					url
				})
			},
			getProjectList() {
				this.list=[]
				service.getArea({name:this.nameValue,userId:this.userId}).then(res=>{
					console.log('getProjectType', res)
					if(res.length == 0){
						this.$UTILS.showPrompt('暂无项目!')
					}
					this.list = res;
				})
			},
			getUserName(){
				service.getUserName().then(res=>{
					this.civilPower = res.civilPower;
					this.userId=res.id
					this.getProjectList()
				})
			},
		},
	}
</script>

<style lang="scss" scoped>
	.background {
		z-index: -1;
		position: fixed;
		width: 100%;
		height: 100%;
		background-size: 100% 100%;
	}

	.project {
		border-radius: 72rpx;
		padding: 25rpx 0;
		text-align: center;
		margin: 170rpx 55rpx 0;
	}

	.project-content {
		width: 90%;
		margin: 40rpx auto;
		padding: 30rpx 20rpx;
		border-radius: 20rpx;
		background: #edf5ff;
		box-shadow: 0rpx 6rpx 8rpx #d3e6ff;
	}
	.houseList_in{
		display: flex;
		justify-content:space-between;
		align-items:center;
		color: #cbcbcb;
		font-size: 38rpx;
	}
	.houseList_in span{
		font-size: 36rpx;
		color: #333;
	}
	.position{
		position: absolute;
		bottom: 100rpx;
		right: 50rpx;
		.arrow{
			width: 152rpx;
			height: 152rpx;
			border-radius: 50%;
			padding: 25rpx;
			margin-left: 20rpx;
		}
	}
	// 小区列表
	
</style>
