<template>
	<view style="background-color:#F7F7F7;letter-spacing: 1rpx;min-height: 100vh;">
		<tn-nav-bar :isBack="false" :bottomShadow="false" backgroundColor="#FE6E25">
			<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-center">
				<view style="color: #ffffff;;text-align: left;font-size: 36rpx;font-weight: 600;">
					<text>企业圈</text>
				</view>
			</view>
		</tn-nav-bar>
		<view style="background-color: #FE6E25;height: 350rpx;">
			<!-- <view style="padding:0rpx 20rpx">
				<view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin"
					style="background-color: #ffffff;"> -->
			<!-- <view class="justify-content-item align-content-item" style="width: 100%;">
						<view class="tn-flex tn-flex-col-center"
							style="border-radius: 100rpx;padding: 15rpx 20rpx;width: 100%;background-color:#F1F2F8;">
							<text
								class="tn-icon-search justify-content-item tn-padding-right-xs tn-color-gray tn-text-lg"></text>
							<input @confirm="onsubmit()" confirm-type="search" v-model="content"
								class="justify-content-item" placeholder="请输入协会名称进行搜索" name="input"
								placeholder-style="color:#AAAAAA" style="width: 90%;"></input>
						</view>
					</view> -->

			<!-- <view>
						<view class="justify-content-item tn-text-center">
							<tn-button backgroundColor="#3668fc" shape="round" padding="20rpx 20rpx" width="150rpx"
								@click="onsubmit()">
								<text class="tn-color-white">搜 索</text>
							</tn-button>
						</view>
					</view> -->
			<!-- 	</view>
			</view> -->

			<!--			<view class="tn-flex tn-flex-row-around tn-flex-center tn-flex-col-center" style="padding: 30rpx;">-->
			<!--				<view style="color: #E15033;">-->
			<!--					<text class="tn-icon-sequence-vertical" style="vertical-align: middle;"></text>-->
			<!--					<text style="margin-left: 15rpx;vertical-align: middle;">全部排序</text>-->
			<!--				</view>-->
			<!--				<view style="height: 25rpx;width: 2rpx;background-color: #808080;"></view>-->
			<!--				<view>-->
			<!--					<text class="tn-icon-first" style="vertical-align: middle;"></text>-->
			<!--					<text style="margin-left: 15rpx;vertical-align: middle;">人气榜</text>-->
			<!--				</view>-->
			<!--				<view style="height: 25rpx;width: 2rpx;background-color: #808080;"></view>-->
			<!--				<view>-->
			<!--					<text class="tn-icon-light" style="vertical-align: middle;"></text>-->
			<!--					<text style="margin-left: 15rpx;vertical-align: middle;">最新入驻</text>-->
			<!--				</view>-->
			<!--			</view>-->
		</view>
		<!--		<view class="tn-flex tn-flex-row-between tn-flex-center tn-flex-col-center" style="padding: 30rpx;">-->
		<!--			<view style="text-align: center;background-color: #FFF;padding:10rpx 30rpx;width: 48%;border-radius: 5rpx;">-->
		<!--				<text>省协会</text>-->
		<!--				<text class="tn-icon-down-triangle"></text>-->
		<!--			</view>-->
		<!--			<view style="text-align: center;background-color: #FFF;padding:10rpx 30rpx;width: 48%;border-radius: 5rpx;">-->
		<!--				<text>市协会</text>-->
		<!--				<text class="tn-icon-down-triangle"></text>-->
		<!--			</view>-->
		<!--		</view>-->
		<scroll-view :scroll-y="true" @scrolltolower="ReachBottom" style="padding:0rpx 30rpx 30rpx 30rpx;height: 80vh;position: absolute;z-index: 100;top: 150rpx;">
			<view style="position: relative;padding-top: 50rpx;" @click="switchTabbar(61)">
				<view class="tn-flex tn-flex-center tn-flex-col-center tn-flex-row-between" style="backdrop-filter: blur(10px);-webkit-backdrop-filter: blur(10px);border: 1px #FE6E25 solid;background: rgba(255,255,255,0.6);padding:40rpx 30rpx;border-radius: 30rpx;margin-bottom: 20rpx;">
					<view class="tn-flex tn-flex-center tn-flex-col-center">
						<view>
							<image :src="apiImgUrl+'/uploads/1/20240628/a78696e22b3cecbf678afbbcca617fca.png'"
								style="width: 100rpx;height: 100rpx;border-radius: 50%;"></image>
						</view>
						<view style="margin-left: 30rpx;">
							<view style="color:#3D3D3D;font-size: 32rpx;font-weight: 600;">洛阳市青年户外协会
							</view>
							<view style="font-size: 28rpx;color:#9B9B9B;margin-top: 15rpx;">成立时间：2024年8月13日
							</view>
						</view>
					</view>
					<view
						style="border-radius: 8rpx;font-size: 20rpx;color: #764508;background: linear-gradient( 180deg, #F4D6A2 0%, #E8AF51 100%);padding:10rpx 15rpx;">
						<text style="vertical-align: middle;margin-left: 5rpx;">已认证</text>
					</view>
				</view>
				<view class="triangle"></view>
			</view>
			<view v-for="(item,index) in list" style="position: relative;" @click="switchTabbar(item.id)">
				<view class="tn-flex tn-flex-center tn-flex-col-center tn-flex-row-between"
					style="backdrop-filter: blur(10px);-webkit-backdrop-filter: blur(10px);background: rgba(255,255,255,0.6);padding:40rpx 30rpx;border-radius: 30rpx;margin-bottom: 30rpx;">
					<view class="tn-flex tn-flex-center tn-flex-col-center">
						<view>
							<image :lazy-load="true" :src="apiImgUrl+item.association_image"
								style="width: 100rpx;height: 100rpx;border-radius: 50%;"></image>
						</view>
						<view style="margin-left: 30rpx;">
							<view style="font-size: 32rpx;font-weight: 600;">{{item.association_name}}
							</view>
							<view style="font-size: 28rpx;color: #888888;margin-top: 15rpx;">成立时间：{{item.createtime}}
							</view>
						</view>
					</view>
					<view style="width: 120rpx;">
						<view
							style="width: 110rpx;text-align: center;;border-radius: 8rpx;font-size: 20rpx;color: #764508;background: linear-gradient( 180deg, #F4D6A2 0%, #E8AF51 100%);padding:10rpx 15rpx;">
							<text style="vertical-align: middle;margin-left: 5rpx;">已认证</text>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
		<view
			style="padding:30rpx 30rpx 180rpx 30rpx;background-color: #F7F7F7;border-radius: 20rpx 20rpx 0rpx 0rpx;margin-top: -40rpx;">


		</view>
		<!--		<view style="position: fixed;bottom: 13%;width: 100%;">-->
		<!--			<view @click="tn('/pages/index/enter_in')"-->
		<!--				style="margin: 0 auto;color: #fff;letter-spacing: 10rpx;line-height: 70rpx;;text-align: center;width: 70%;height: 70rpx;background: linear-gradient(270deg, #EE7E45, #EE9657);border-radius: 50rpx;">-->
		<!--				快速入驻</view>-->
		<!--		</view>-->
	</view>
</template>

<script>
	import {
		associationIndex
	} from '@/util/api.js';
	import store from '@/store/index.js'
	export default {
		data() {
			return {
				topCurrent: 0,
				list: [],
				apiImgUrl: this.$store.state.imgUrl,
				content: '',
				page: 1,
			}
		},
		mounted() {
			this.getAssociationIndex();
		},
		onReachBottom() {
			console.log(1);
		},
		methods: {
			switchTabbar(d) {
				console.log(d);
				if (d == 0) {
					return;
				}
				store.commit('$tStore', {
					name: 'Gid',
					value: d
				})
				uni.setStorageSync('Gid', d);
				uni.$emit('getGid', {
					gid: d
				})
				uni.$emit('depId', {
					index: 0
				})
			},
			onsubmit() {
				this.page = 1;
				this.list = [];
				this.getAssociationIndex();
			},
			ReachBottom() {
				uni.showLoading({
					title: '加载中...'
				});
				this.page = this.page + 1;
				//this.getNewsList();
				this.getAssociationIndex();
			},
			getAssociationIndex() {
				associationIndex({
						association_name: this.content,
						page: this.page,
						size: 10,
					})
					.then(res => {
						console.log(res);
						if (res.code == 1) {
							this.list.push(...res.data);
						}
						uni.hideLoading();
					})
					.catch(error => {
						uni.showToast({
							title: error,
							icon: 'none',
							duration: 2000
						});
					})
			},
			tn(e) {
				uni.navigateTo({
					url: e
				})
			}
		}
	}
</script>

<style>
	.triangle {
		width: 0;
		height: 0;
		border-top: 10rpx solid #FE6E25;
		border-right: 10rpx solid transparent;
		border-left: 10rpx solid transparent;
		position: absolute;
		left: 0;
		right: 0;
		margin: 0 auto;
		bottom: -11rpx;
		z-index: 100;
	}
</style>