
<template>
	<view class="content">
		<view class="">
			<!-- 头部 -->
			<u-navbar :border-bottom="false" :custom-back="customBack" :background="background" :is-back="true" title-size="38" title-width="450" title-color="#fff" back-icon-color="#fff" :title="vuex_party_branch.branchName"></u-navbar>
			<!-- banner -->
			<swiper   class="screen-swiper square-dot "  :indicator-dots="true" :circular="true"
			 :autoplay="true" interval="5000" duration="500">
				<swiper-item v-for="(item,index) in bannerList" :key="index">
					<image   :src="item.banners" mode="aspectFill" ></image>
				</swiper-item>
			</swiper>
			<!-- 公告 -->
			<!-- <view v-if="!$isEmpty(meetinglist)" class="">
				<view class="bg-white" style="height: 10rpx;"></view>
				<hotConsult :title1="title1" :title2="title2"  @onTap="jump('/pages/index/notice/notice')" :swiperTexts="meetinglist"></hotConsult>
			</view> -->
			
			<!-- 园区信息 -->
			<view class="bg-white">
				<view class="flex"  style="padding:40rpx 30rpx 30rpx; ">
					<image style="width: 40rpx;height: 40rpx;display: block;padding-top: 5rpx;padding-right: 10rpx;" src="/party/static/icon/tag.png" mode=""></image>
					<text class="text-lg text-black">智慧党建</text>
				</view>
				
				<view class="cu-list grid col-3 no-border" :key="index">
					<view class="cu-item" @click="jump(item.url)"  v-for="(item,index) in statistical" :key="index">
						<view class="grid-icon" >
							<image  style="width: 75rpx;height: 75rpx;" :src="item.icon"/>
						</view>
						<text  style="color: #333333;font-size: 26rpx;" >{{item.title}}</text>
						<view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
					</view>
				</view>
			</view>
		
			<view class="bg-white padding-bottom-20" v-if="infoList">
				<view class="flex justify-between" style="padding: 30rpx;">
					<view class="flex">
						<image style="width: 40rpx;height: 40rpx;display: block;padding-top: 5rpx;padding-right: 10rpx;" src="/party/static/icon/tag.png" mode=""></image>
						<text class="text-lg text-black">党内资讯</text>
					</view>
					<view @click="jump('/party/pages/infomation/infomation')" style="padding-top: 6rpx;font-size: 26rpx;color: #676767;">
						<text style="font-size: 24rpx;color: #676767;margin-top: 5rpx;">查看更多</text>
						<text class="cuIcon-right "></text>
					</view>
				</view>
				<info-card :list="infoList" ></info-card>
			</view>
			<u-action-sheet @click="ganderChange" :list="ganderArray" v-model="ganderShow"></u-action-sheet>
		</view>
		 <u-tabbar
		 @change="tabChange"
		  v-model="tabbarCurr"
		  :icon-size="tabbar.iconSize" 
		  :active-color="tabbar.activeColor" 
		  :mid-button-size="tabbar.MinButtonSize" 
		  :list="tabbar.list" :mid-button="true">
		  </u-tabbar>
	</view>
</template>

<script>
import {tabbar} from "@/assets/js/party-tarbar.js"
import hotConsult from "@/components/hot-consult/hot-consult.vue"
import infoCard from "../infomation/comps/info-card.vue"
export default {
	components:{
		hotConsult,infoCard
	},
	data() {
		return {
			background:{
				backgroundColor:'#DE2910'
			},
			//tabbar
			tabbarCurr:0,
			tabbar:tabbar,
			
			//党建资讯
			title1:{
				text:'三会',
				color:'#DE2910'
			},
			title2:{
				text:'一课',
				color:''
			},
			
			//banner
			bannerList: [
				{
				  'banners': "/party/static/icon/banner.jpg"
				},
			],
			// 三会一课
			meetinglist:[],
			//智慧党建
			statistical:[],
			
			//园区动态
			infoList:[]
			
		};
	},
	onLoad() {
		this.fetchNoticeList()
		this.fetchStaticData()
		this.fetchInfoList()
		
		this.fetchBrandIdDetail()
		
		this.checkIsEnroll()
		
	},
	methods:{
		async checkIsEnroll(){
			let params={
				memberId:this.vuex_party_person.id
			}
			let res=await this.$api.party.checkIsEnroll(params)
			console.log(res);
		},
		fetchBrandIdDetail(){
			this.$api.party.branchDetail({id:1}).then(res=>{
				this.$u.vuex('vuex_party_branch',res.data)
			})
		},
		//自定义返回
		customBack(){
			uni.switchTab({
				url:"/pages/index/index"
			})
		},
		tabChange(index){
			if (index==1) {
				uni.redirectTo({
					url:"/party/pages/activity/activity"
				})
			}else if (index==2) {
				uni.redirectTo({
					url:"/party/pages/mine/mine"
				})
			}
		},
		/**
		 * 跳转
		 * @param {Object} url
		 */
		jump(url){
			if (!this.$isEmpty(url)) {
				uni.navigateTo({
					url:url
				})
			}
		},
		/**
		 * 加载通知列表
		 */
		fetchNoticeList(){
			let params={
				current:1,
				size:10,
				branchId:this.vuex_party_person.branchId
			}
			this.$api.party.meetinglist(params).then(res=>{
				this.meetinglist=res.data.records
			})
		},
		fetchInfoList(){
			let params={
				current:1,
				size:10,
				branchId:this.vuex_party_person.branchId
			}
			this.$api.party.partyInfoList(params).then(res=>{
				this.infoList=res.data.records
			})
		},
		/**
		 * 加载静态数据
		 */
		fetchStaticData(){
			this.statistical=[
				
				{
					title: '三会一课',
					icon:'/party/static/icon/sanhui.png',
					url:'/party/pages/party-meeting/party-meeting',
				},
				{
					title: '党内资讯',
					icon:'/party/static/icon/info.png',
					url:'/party/pages/infomation/infomation',
				},
				{
					title: '党内活动',
					icon:'/party/static/icon/activity.png',
					url:'/party/pages/activity/activity',
				},
			]
		}
	}
};
</script>

<style lang="scss" scoped>
	page,.content{
		background-color: #FFFFFF;
		min-height: 100vh;
	}
	//四宫格 begin
	.nav-list {
		display: flex;
		flex-wrap: wrap;
		justify-content: flex-start;
	}
	.nav-li {
		padding: 30upx 30rpx;
		border-radius: 12upx;
		width: 44%;
		margin: 10rpx 2% 10upx;
		background-size: cover;
		background-position: center;
		position: relative;
		z-index: 1;
	}
	.nav-li::after {
		content: "";
		position: absolute;
		z-index: -1;
		background-color: inherit;
		width: 100%;
		height: 100%;
		left: 0;
		bottom: -10%;
		border-radius: 10upx;
		opacity: 0.2;
		transform: scale(0.9, 0.9);
	}
	.nav-li.cur {
		color: #fff;
		background: rgb(94, 185, 94);
		box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
	}
	.nav-title {
		font-size: 32upx;
		font-weight: 300;
	}
	.nav-title::first-letter {
		font-size: 40upx;
		margin-right: 4upx;
	}
	.nav-name {
		font-size: 28upx;
		text-transform: Capitalize;
		margin-top: 20upx;
		position: relative;
	}
	.nav-name::before {
		content: "";
		position: absolute;
		display: block;
		width: 40upx;
		height: 6upx;
		background: #fff;
		bottom: 0;
		right: 0;
		opacity: 0.5;
	}
	.nav-name::after {
		content: "";
		position: absolute;
		display: block;
		width: 100upx;
		height: 1px;
		background: #fff;
		bottom: 0;
		right: 40upx;
		opacity: 0.3;
	}
	.nav-name::first-letter {
		font-weight: bold;
		font-size: 36upx;
		margin-right: 1px;
	}
	.nav-li image {
		position: absolute;
		right: 30upx;
		top: 22upx;
		width: 66upx;
		height: 66upx;
	}
	//四宫格 end
	
</style>