<template>
  <view class="content">
    <view class="self-inf">
	  <view class="antu-box" v-if="isAuth">
		<view class="img-name-box">
		  <image :src="userHeadImg" class="heade-img" mode="aspectFill"></image>
		  <p class="nickname">{{ userNickName }}</p>
		  <p class="nickname">136****0648</p>
		</view>
		<view class="org-info-box">
		  <view class="org-info">浐灞一支部</view>
		  <view class="org-line"></view>
		  <view class="org-info">宣传委员</view>
		</view>	  
	  </view>
	  <view class="img-name-box" v-if="!isAuth" style="height: 180rpx;">
		<image src="/static/auth-icon.png" class="heade-img" mode="aspectFill" style="margin-left: 80rpx;"></image>
        <button @click="goAuthPage()" class="auth-btn">授权登录</button>
      </view>
    </view>
 
    <view>
		<view class="active-title-box">
			<uni-datetime-picker
			    class="time-select-box"
				type="date"
				:value="single"
				@change="change"
				:clear-icon="false"
			/>
		   <picker @change="bindPickerChange" :value="index" :range="array">
					<view class="uni-input">{{array[index]}}</view>
					<image src="/static/arrow_down.svg" mode="aspectFit"></image>
		   </picker>
		   <button @click="publish()">+发布活动</button>
		</view>
		
		
		<view class="active-box" v-for="(item,index) in activiList" :key="index" @click="goList()">
			<view class="active-type" :class="{'bg-yellow':item.typeNum == '1' ,'bg-red':item.typeNum == '2','bg-blue':item.typeNum == '3',}"  >
				{{item.type}}
			</view>
			<view class="active-content-box">
				<view class="active-content">
					<view class="active-name">{{item.activi_name}}</view>
					<view class="active-date">{{item.date}}</view>
				</view>
				<view class="active-content">
					<view style="margin-right:10rpx;">{{item.department}} | </view>
					<view>{{item.name}} | </view>
					<view style="margin-left:10rpx;">记录数:({{item.record_num}}/{{item.num}})</view>
				</view>
			</view>
			
			<view class="edit-icon-box">
				  <image src="/static/edit-icon.png" mode="aspectFit"></image>
				  <image src="/static/del-icon.png" mode="aspectFit"></image>
			</view>
			
		</view>
		
		
	</view>
    
 
  </view>
</template>

<script>
import md5 from "@/common/md5.js";
export default {
	components: {
	},
  data() {
    return {
      isAuth:getApp().globalData.globalAuth,
      userHeadImg: getApp().globalData.user_headUrl,
      userNickName:getApp().globalData.user_name,
	  array: ['全部', '浐灞一支部', '浐灞二支部'],
	  index: 0,
	  activiList:[
		  {
		     type:'组织建设',
			 typeNum:'1',
		     activi_name:'活动名称XXX',
		     date:'2022.01.22',
		     name:'路小路',
			 department:'浐灞一支部',
			 record_num:'22',
			 num:'9'
		  },
		  {
		     type:'学习培训',
			 typeNum:'2',
		     activi_name:'活动名称XXX',
		     date:'2022.01.15',
		     name:'陈伟',
			 department:'浐灞二支部',
			 record_num:'22',
			 num:'9'
		  },
		  {
		     type:'参政议政',
			 typeNum:'3',
		     activi_name:'活动名称XXX',
		     date:'2022.01.15',
		     name:'陈伟',
			 department:'浐灞二支部',
			 record_num:'22',
			 num:'9'
		  },
	  ]
    };
  },
  onShow() {
  },
  methods: {
		  bindPickerChange: function(e) {
			  console.log('picker发送选择改变，携带值为', e.target.value)
			  this.index = e.target.value
		  },
		  change(e) {
			  this.single = e;
			  console.log("-change事件:", e);
		  },
		  publish(){
			  uni.navigateTo({
			  	url:'./create1'
			  })
		  },
		  goList(){
			  uni.navigateTo({
			  	url:'./list'
			  })
		  }
  },
};
</script>

<style lang="scss" scoped>
.content {
  display: flex;
  flex-direction: column;
  .self-inf {
    // border-radius: 0rpx 0rpx 100% 100%;
    .img-name-box {
		height: 150rpx;
		margin-top: 20rpx;
		margin-bottom: 20rpx;
		display: flex;
		align-items: center;
		width: 85%;
      .auth-btn {
		margin-left: 30rpx;
		margin-top: 20rpx;
        font-size: 28rpx;
        background-color: #02a7f0;
        color: #fff;
      }
      .heade-img {
        z-index: 1;
        width: 100rpx;
        height: 100rpx;
        border-radius: 50%;
        // margin-left: 80rpx;
      }
    }
    .nickname {
      font-weight: 600;
      font-size: 28rpx;
      margin-left: 30rpx;
      margin-top: 20rpx;
      color: #555;
      letter-spacing: 1rpx;
    }
  }
}
.antu-box {
	display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    margin-left: 5%;
    margin-top: 50rpx;
    border-radius: 10rpx;
    width: 90%;
    color: #555;
    box-shadow: 0px 2px 16px rgba(0, 0, 0, 0.2);
}
.org-info-box {
    display: flex;
    justify-content: space-evenly;
    height: 80rpx;
    align-items: center;
    width: 100%;
    border-top: 1px solid #d4d4d4;
    color: #555;
    font-size: 28rpx;
    background: #fff;
} 
.org-line {
	width: 1px;
	height: 82rpx;
	background: #d4d4d4;
} 

.active-title-box {
	display: flex;
    align-items: center;
    margin-top: 10rpx;
    font-size: 26rpx;
    height: 100rpx;
    border-bottom: 1px solid #d7d7d7;
    margin-top: 10rpx;
		.time-select-box {
			width: 32%;
			margin-left: 5%;
		}
		picker {
		    width: 25%;
			border: 1px solid #d7d7d7;
			height: 60rpx;
			line-height: 60rpx;
			border-radius: 10rpx;
			margin-left: 20rpx;
			padding: 0 10rpx;
			position: relative;
			image {
				width: 20rpx;
				height: 20rpx;
				position: absolute;
				top: 11px;
				right: 5px;
			}
		}
		button {
			width: 24%;
			font-size: 25rpx;
			background: #4988fd;
			color: #fff;
			margin-left: 25rpx;
		}
	
	
}
.active-box {
	display: flex;
	align-items: center;
	position: relative;
	font-size: 28rpx;
	padding: 30rpx;
	border-bottom: 1px solid #d7d7d7;
	.active-type {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		background-color: yellow;
		text-align: center;
		display: flex;
		align-items: center;
		font-size: 26rpx;
		color: #fff;
	}
	.active-content-box {
		display: flex;
		flex-direction: column;
		margin-left: 20rpx;
	}
	.active-content {
		display: flex;
		align-items: center;
		height: 45rpx;
		font-size: 26rpx;	
		.active-name {
			font-size: 30rpx;
			margin-right: 10rpx;
		}
		.active-date {
			color: #ccc;
		}
	}
	.edit-icon-box {
		position: absolute;
		right: 10px;
		top: 10px;
		image {
			width: 35rpx;
			height: 35rpx;
			margin-right: 10rpx;	
		}
	}
	.bg-yellow {
		background-color: #ffdd40;
	}
	.bg-red {
		background-color: #ec808d;
	}
	.bg-blue {
		background-color: #81d3f8;
	}
}
</style>