<template>
	<div class="g_position_rela">
		<u-tabbar :list="tabbarInfo" :showDrawer="isShow" :mid-button="false" activeColor="#1980ff" 
							:before-switch="beforeSwitch" @change="uploadPage"
							 :iconSize="48"></u-tabbar>
	</div>
</template>

<script>
import { getMsgContentTipByType, setTabUnread } from "../pages/NEUIKit/utils/msg";
import { trackInit } from "../pages/NEUIKit/utils/reporter.ts";
export default {
	// created() {
	// 	let that = this;
	// 	this.isLogin = uni.getStorageSync("apply-userinfo") ? true : false;
	// 	console.log("createdcreatedcreated");
	// 	if (this.isLogin) {
	// 		if (uni.$UIKitStore) {
	// 			trackInit("ConversationUIKit");
	// 			setTimeout(() => {
	// 				// 获取未读信息数
	// 				setTabUnread();
	// 			}, 100);
	// 		} else {
	// 			setTimeout(() => {
	// 				// 初始化会话列表
	// 				trackInit("ConversationUIKit");
	// 				setTimeout(() => {
	// 					// 获取未读信息数
	// 					setTabUnread();
	// 				}, 2000);
	// 			}, 2000);
	// 		}
	// 	}
	// 	// 聊天会话通知触发小红点数量提示
	// 	uni.$on("newMessage", function (data) {
	// 		console.log("newMessage 接收", data);
	// 		that.setBadge(data);
	// 	});
	// 	// 用户身份认证权限改变触发
	// 	uni.$on("userAuthChange", function (data) {
	// 		console.log("newMessage 接收", data);
	// 		that.corpUserFlag = uni.getStorageSync("apply-userinfo").corpUserFlag;
	// 		this.checkUserAuth();
	// 	});
	// 	this.checkUserAuth();
	// 	this.setBadge();
	// },
	onShow() {
		console.log(123123123123);
	},
	data() {
		return {
			isShow: false,
			isLogin: false,
			corpUserFlag: uni.getStorageSync("apply-userinfo").corpUserFlag,
			tabbarInfo: [
				{
					iconPath: "/static/image/home.png",
					selectedIconPath: "/static/image/home-active.png",
					pagePath: "/pages/home/index",
					text: "首页",
					iconSize: 48,
				},
				{
					iconPath: "/static/image/apply.png",
					selectedIconPath: "/static/image/apply-active.png",
					pagePath: "/pages/workBench/index",
					text: "工单",
					iconSize: 48,
				},
				{
					iconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/add.svg",
					selectedIconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/add.svg",
					pagePath: "/pages/addJob/index",
					text: "",
					iconSize: 78,
					iconType: "custom",
				},
				{
					iconPath: "/static/image/message.png",
					selectedIconPath: "/static/image/message_active.png",
					pagePath: "/pages/message/index",
					text: "消息",
					iconSize: 48,
					count: 0,
				},
				{
					iconPath: "/static/image/person.png",
					selectedIconPath: "/static/image/person-active.png",
					pagePath: "/pages/person/index",
					text: "我的",
					iconSize: 48,
				},
			],
			messageCount: 0,
			noticeCount: 0,
			followCount: 0,
		};
	},
	methods: {
		beforeSwitch(index) {
			let that = this;
			console.log(index);
			this.isShow = false;
			return true;
		},
		uploadPage() {
			uni.vibrateShort();
		},
	// 	setBadge(data) {
	// 		let that = this;
	// 		// console.log("datadatadatadatadatadata", data);
	// 		for (var k in that.tabbarInfo) {
	// 			if (that.tabbarInfo[k].pagePath == "/pages/message/indexcopy") {
	// 				if (data) {
	// 					// console.log(that.messageCount + "+++++++++++++++++" + that.noticeCount);
	// 					if (data.type == "message") {
	// 						that.messageCount = data.count || 0;
	// 					} else if (data.type == "notice") {
	// 						that.noticeCount = data.count || 0;
	// 					}
	// 					// console.log(that.messageCount + "-------------------------" + that.noticeCount);
	// 				} else {
	// 					that.messageCount = uni.getStorageSync("chat_info").count || 0;
	// 					that.noticeCount = uni.getStorageSync("notice_info").count || 0;
	// 				}

	// 				that.tabbarInfo[k].count = that.messageCount + that.noticeCount;
	// 				// console.log("that.tabbarInfo[k].count", that.tabbarInfo[k].count);
	// 				// that.tabbarInfo[k].type = data.type;
	// 			} else if (that.tabbarInfo[k].pagePath == "/pages/workBench/index") {
	// 				if (data) {
	// 					// console.log(that.messageCount + "+++++++++++++++++" + that.noticeCount);
	// 					if (data.type == "follow") {
	// 						that.followCount = data.count || 0;
	// 					}

	// 					// console.log(that.messageCount + "-------------------------" + that.noticeCount);
	// 				} else {
	// 					that.followCount = uni.getStorageSync("follow_info").count || 0;
	// 				}
	// 				that.tabbarInfo[k].count = that.followCount;
	// 			}
	// 		}
	// 	},
	// 	checkUserAuth() {
	// 		this.tabbarInfo = [
	// 			{
	// 				iconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/home.png",
	// 				selectedIconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/home_active.png",
	// 				pagePath: "/pages/home/index",
	// 				text: "首页",
	// 				iconSize: 48,
	// 			},
	// 			{
	// 				iconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/unit.png",
	// 				selectedIconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/unit_active.png",
	// 				pagePath: "/pages/workBench/index",
	// 				text: "工单",
	// 				iconSize: 48,
	// 			},
	// 			{
	// 				iconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/add.svg",
	// 				selectedIconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/add.svg",
	// 				pagePath: "/pages/addJob/index",
	// 				text: "",
	// 				iconSize: 78,
	// 				iconType: "custom",
	// 			},
	// 			{
	// 				iconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/message.png",
	// 				selectedIconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/message_active.png",
	// 				pagePath: "/pages/message/index",
	// 				text: "消息",
	// 				iconSize: 48,
	// 				count: 0,
	// 			},
	// 			{
	// 				iconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/user.png",
	// 				selectedIconPath: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/dailibaoming/v3/user_active.png",
	// 				pagePath: "/pages/person/index",
	// 				text: "我的",
	// 				iconSize: 48,
	// 			},
	// 		]
	// 	},
	
	},
};
</script>

<style lang="less">
.triangle {
	position: absolute;
	display: flex;
	justify-content: center;
	align-items: center;
	top: calc(100%);
	left: 50%;
	padding-top: 20px;
	// background: linear-gradient(90deg, #fff4df, #ffdfa8);
	background: #f9f6ea;
	transform: translate(-50%, -36%);
	width: 70px;
	height: 77px;
	border-radius: 35px;
	box-shadow: 0px 11px 14px -5px #999;
	z-index: -1;
	// border: 8px solid transparent;
	// border-top: 12px solid #95ec69;
}
.biggerSize {
	position: relative;
}
.biggerSize::after {
	content: "";
	/* display: inline-block; */
	width: 150%;
	height: 140%;
	position: absolute;
	left: 50%;
	top: 50%;
	z-index: 99;
	transform: translate(-50%, -50%);
}
.close {
	position: absolute;
	right: 12px;
	top: 12px;
}
.bottom_drawer {
	position: absolute;
	bottom: calc(100% + 10rpx);
	left: 0;
	margin: 0 10px;
	box-shadow: 0px 11px 14px -5px #999;
	z-index: 9999;
	border-radius: 12px;

	.drawer_content {
		padding: 16px 0 0;
		background: linear-gradient(90deg, #fff4df, #ffdfa8);
		width: calc(100vw - 20px);
		border-radius: 12px;
	}
	.drawer_tips {
		border-top: 2px solid #fff;
		border-radius: 12px;
		background: #f9f6ea;
	}
}
</style>
