<template>
	<view>
		<view style="height: 100rpx;"></view>
		<view class="tabbar_item_wrap" style="">
			<view class="tabbar_item tabbar_item01" @click="jumpto('/pages/index/index')"  style="">
				<view :class="[current==1?'tabbarYes':'tabbarNone']">
					<image :src="current==1?cssUrl+'tabbar_index_active.svg':cssUrl+'tabbar_index.svg'"></image>
					<view :class="[current==1?'tabbarYes':'tabbarNone']">{{leftButtonText}}</view>
				</view>
			</view>
			<view class="tabbar_item tabbar_item05"  style="" v-if="is_admin" @click="addArticle">
				<image :src="cssUrl+'add.svg'"></image>
			</view>
			<view class="tabbar_item tabbar_item04" @click="jumpto('/pages/user_center/user_center')"  style="">
				<view :class="[current==2?'tabbarYes':'tabbarNone']">
					<image :src="current==2?cssUrl+'tabbar_user_active.svg':cssUrl+'tabbar_user.svg'"></image>
					<view :class="[current==2?'tabbarYes':'tabbarNone']">我的</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		props:{
			current:{
				type: [String, Number],
				default: 1
			},
			is_admin:{
				type: Boolean,
				default: false
			},
			leftButtonText: {
				type: String,
				default: '文章'
			}
		},
		data() {
			return {
				cssUrl:this.cssUrl,
				isios:this.isIos,
			}
		},
		onLoad() {
		},
		methods: {
			addArticle() {
				this.$func.toPage('/pages/edit/edit');
			},
			jumpto(event) {
				if(event == '/pages/vip/vip' && this.isIos && this.xcxtype == 0){
					this.$http.req('get_aixcx_audit').then(data=>{
						if(data == -1) return;
						if(data.isopen) {
							uni.reLaunch({
								url:event
							})
							return;
						}
						this.$func.toPage('/pages/nonsupport/nonsupport');
					});
					return;
				}
				if(event == '/pages/vip/vip') uni.setStorageSync('pagetype', 'vip');
				uni.reLaunch({
					url:event
				})
			}
		}
	}
</script>
<style>
	.tabbar_item{
		width: 50%;
		height: 112rpx;
		display: flex;
		align-items: center;
		margin-top: 10rpx;
		text-align: center;
	}
	.tabbar_item:first-of-type{
		justify-content: flex-start;
	}
	.tabbar_item:last-of-type{
		justify-content: flex-end;
	}
	.tabbar_item_wrap{
		position: fixed;
		bottom: 0rpx;
		left: 0rpx;
		right: 0rpx;
		width: 404rpx;
		height: 119.43925233644859rpx;
		background-color: #ffffff;
		display: flex;
		box-sizing: border-box;
		padding-left: 173rpx;
		padding-right: 173rpx;
		justify-content: space-between;
		padding-bottom: constant(safe-area-inset-bottom);  
		padding-bottom: env(safe-area-inset-bottom); 
		box-sizing: content-box;
		z-index: 8;
		margin: 0 auto;
		box-shadow: 0rpx -2rpx 6rpx 0rpx rgba(181,181,181,0.13);
	}
	.tabbar_item01 image{
		width: 60rpx;
		height: 60rpx;
	}
	.tabbar_item02 image{
		width: 60rpx;
		height: 60rpx;
	}
	.tabbar_item05{
		position: relative;
	}
	.tabbar_item05 image{
		width: 120rpx;
		height: 120rpx;
		position: relative;
		top: -50rpx;
	}
	.tabbar_item03 image{
		width: 60rpx;
		height: 60rpx;
	}
	.tabbar_item04 image{
		width: 60rpx;
		height: 60rpx;
	}
	.tabbarNone{
		color: #888D9C;
		text-align: center;
		font-family: PingFang SC;
		font-size: 21.869158878504674rpx;
		font-style: normal;
		font-weight: 400;
		line-height: normal;
	}
	.tabbarYes{
		color: #00C160;
		text-align: center;
		font-family: PingFang SC;
		font-size: 21.869158878504674rpx;
		font-style: normal;
		font-weight: 600;
		line-height: normal;
	}
</style>