<template>
	<view class="page" :style="{'height':h+'px'}">
		<view class="left">
			<view class="item" :class="[(index===nIndex)?'active':'',index===(nIndex+1)?'rtb':'']" 
			v-for="(item,index) in navList" :key="index" @click="changeType(index)">
				{{item.name}}
			</view>
		</view>
		<view class="right">
			<block v-if="solutionList.length">
				<u-list class="ulist" @scrolltolower="scrolltolower">
					<u-list-item class="item" v-for="(item, index) in solutionList" :key="index" @click="toDetails(item)">
						<view class="top">
							<image :src="item.img"></image>
						</view>
						<view class="text">
							{{item.name}}
						</view>
					</u-list-item>
				</u-list>
			</block>
			<block v-else></block>
		</view>
		<tabbar :tabbarIndex="1"></tabbar>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				navList:[
					{name:'全部'},
					{name:'智慧楼宇'},
					{name:'总部园区'},
					{name:'产业园区'},
					{name:'工业园区'},
					{name:'智慧校园'},
					{name:'智慧场馆'},
					{name:'公共交通'},
					{name:'智慧文旅'},
					{name:'城市服务'},
					{name:'住宅社区'},
					{name:'3D可视化'},
					{name:'智慧运维'},
					{name:'智慧安防'},
					{name:'楼宇自控'},
					{name:'能耗管理'},
					{name:'智能照明'},
					{name:'智慧通行'},
					{name:'智能环卫'},
					{name:'智慧电梯'},
					{name:'应急指挥'},
					{name:'资产管理'}
				],
				nIndex:0,
				solutionList:[],
				isOver:false
			}
		},
		onLoad() {
			this.getList();
		},
		methods:{
			changeType(index){
				this.nIndex = index;
			},
			scrolltolower() {
				if (this.isOver) return;
				this.getList();
			},
			getList(){
				this.solutionList = [
					{
						img:'../../static/imgs/home_default.png',
						name:'智慧园商业解决方案'
					},
					{
						img:'../../static/imgs/home_default.png',
						name:'智慧园商业解决方案'
					},
					{
						img:'../../static/imgs/home_default.png',
						name:'智慧园商业解决方案'
					},
					{
						img:'../../static/imgs/home_default.png',
						name:'智慧园商业解决方案'
					},
					{
						img:'../../static/imgs/home_default.png',
						name:'智慧园商业解决方案'
					},
					{
						img:'../../static/imgs/home_default.png',
						name:'智慧园商业解决方案'
					},
					{
						img:'../../static/imgs/home_default.png',
						name:'智慧园商业解决方案'
					},
					{
						img:'../../static/imgs/home_default.png',
						name:'智慧园商业解决方案'
					}
				];
			}
		}
	}
</script>

<style scoped lang="less">
	.page{
		background: #FFFFFF;
		box-sizing: border-box;
		display: flex;
		
		.left{
			width: 168rpx;
			height: 100%;
			overflow-y: auto;
			background: #F3F4F8;
			.item{
				width: 100%;
				height: 98rpx;
				background: #F3F4F8;
				display: flex;
				align-items: center;
				justify-content: center;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 26rpx;
				color: #9D9DA0;
				line-height: 37rpx;
				&.active{
					background: #FFFFFF;
					font-weight: bold;
					color: #1460CA;
				}
				&.rtb{
					border-top-right-radius: 16rpx;
				}
			}
		}
		
		.right{
			width: calc(100% - 168rpx);
			padding: 0 24rpx 20rpx;
			box-sizing: border-box;
			
			.ulist{
				height: 100% !important;
				::v-deep .uni-scroll-view-content>uni-view{
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					flex-wrap: wrap;
				}
				.item{
					width: calc(50% - 13rpx);
					margin-top: 20rpx;
					border-radius: 12rpx 12rpx 0rpx 0rpx;
					background: #FFFFFF;
					.top{
						width: 100%;
						height: 186rpx;
						background: #D8D8D8;
						border-radius: 12rpx 12rpx 0rpx 0rpx;
						image{
							width: 100%;
							height: 100%;
							border-radius: 12rpx 12rpx 0rpx 0rpx;
						}
					}
					.text{
						width: 100%;
						padding: 16rpx 10rpx;
						box-sizing: border-box;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						font-family: PingFang-SC, PingFang-SC;
						font-weight: bold;
						font-size: 24rpx;
						color: #111111;
						line-height: 24rpx;
					}
				}
			}
		}
	}
</style>