<template>
	<view class="school-company">
		<view class="no-data" v-if="schoolCompanyList.length===0">
			暂无数据
		</view>
		<view class="u-radio-box" v-if="schoolCompanyList.length!==0">
			<view v-for="(item, index) in schoolCompanyList" :key="item.Id" class="radio-item"
				@click="goUrl(1,item.Id)">
				<view class="radio-item-imgbox">
					<image :src="item.CoverPhoto" mode="aspectFit"></image>
				</view>
				<view class="radio-item-name">
					{{item.ShoolName}}
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				schoolCompanyList: [],
				mainColor: "",
			}
		},
		created() {
			this.mainColor = this.$uiConfig.mainColor;
			uni.setNavigationBarTitle({
				title: '选择学校'
			});
		},
		mounted() {
			this.getSchoolCompanyList();
		},
		methods: {
			getSchoolCompanyList() {
				this.request2({
						url: '/api/AppletEducation/GetEduSchool',
						data: {}
					},
					(res) => {
						if (res.resultCode === 1) {
							this.schoolCompanyList = res.data
							if(this.schoolCompanyList.length===0){
								this.goUrl(1,0)
							}
						}
					}
				);
			},
			goUrl(type = 1, id) {
				uni.navigateTo({
					url: '/pages/share-qrcode/share-qrcode' + '?type=' + type + '&schoolId=' + id
				});
			},
		}
	}
</script>

<style scoped>
	.school-company {
		padding: 30rpx;
		background-color: #FFFFFF;
	}

	.u-radio-box {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: space-between;

	}

	.radio-item {
		width: 300rpx;
		/* height: 300rpx; */
		border-radius: 8rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		margin-bottom: 30rpx;
		box-shadow: 0px 4px 4px 0px #999999;

	}

	.radio-item-name {

		/* white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis; */
		font-size: 26rpx;
		color: #07090D;
		padding: 10rpx;
		background-color: #FFFFFF;
	}

	.radio-item-imgbox {
		width: 100%;
		height: 144rpx;
		overflow: hidden;
		background-color: #f3f4f6;
		/* box-shadow: 0px 4px 40px 0px rgba(2, 144, 66, 0.1); */
	}

	.radio-item-imgbox image {
		width: 100%;
		height: 100%;
	}

	.no-data {
		font-size: 26rpx;
		color: #07090D;
		text-align: center;
	}
</style>
