<template>
	<view class="chargingPorts_body">
		<scroll-view v-if="list.length" style="height: 100%;" scroll-y="true" @scrolltolower='scrolltolower'>
			<port-item :item='item' :key="index" v-for="(item,index) in list"></port-item>
		</scroll-view>
		<image class="qx" v-else src="@/static/qs.png" mode=""></image>
	</view>
</template>

<script>
	import portItem from "../../components/portItem/index.vue"
	import station from '@/api/station.js'
	export default {
		components: {
			portItem
		},
		data() {
			return {
				list: []
			}
		},
		onLoad(e) {
			if (e.equipmentType && e.id) {
				this.getInterface(e.equipmentType, e.id)
			}
		},
		methods: {
			getInterface(equipmentType, id) {
				station.getConnectorList({
					equipmentType: equipmentType,
					id: id
				}).then(res => {
					this.list = res.data;
					this.list.forEach(item=>{
						item['color'] = equipmentType=='1'? '#48b8ba' : equipmentType=='2'? '#36658DFF': '#F67A22FF'
					})
				})
			},
			scrolltolower() {
				uni.showToast({
					title: '到底了',
					icon: 'none'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import 'index.scss';
</style>