<template>
	<div class="p-merchantManagement-container">
		<!-- <u-navbar
			:is-back="true"
			backIconColor="#000000"
			:title="pageTitle"
			:autoBack="true"
			title-size="36"
			title-color="#000000"
			:title-bold="false"
		>
		</u-navbar> -->
		<div v-show="currentPage === 0" class="">
			<workbench :hasNewResume="hasNewResume"></workbench>
		</div>
		<div v-show="currentPage === 1">
			<jobList :show="showJob"></jobList>
		</div>
		<div v-show="currentPage === 2">
			<resumeNew />
		</div>
		<div v-show="currentPage === 3">
			<tools :firstLoad="firstLoad"></tools>
		</div>
		<u-tabbar :iconSize="48" v-model="currentPage" :hideTabBar="false" :list="list" :active-color="appid != 'wxb0c590fd696b79be' ? '#3578f6' : '#ff4400'" :before-switch="handleTab" class="test-0bj"></u-tabbar>
	</div>
</template>

<script>
import workbench from "./child/workbench.vue";
import jobList from "./child/jobList.vue";
import tools from "./child/tools.vue";
import resumeNew from "./child/resumeNew.vue";

export default {
	onLoad() {},
	onShow() {
		this.getResumeInfo();
	},
	data() {
		return {
			hasNewResume: 0,
			cdnBaseImg: this.G.store().cdnBaseImg,
			showJob: false,
			currentPage: 0,
			list: [],
			pageTitle: "工作台",
			firstLoad: false,
			appid: uni.getAccountInfoSync().miniProgram.appId,
		};
	},
	components: {
		workbench,
		jobList,
		tools,
		resumeNew,
	},
	watch: {
		showJob(val) {
			console.log(val);
		},
		currentPage(val) {
			console.log(val);
			// if (val === 3) {
			// 	this.firstLoad = true;
			// }
		},
	},
	created() {
		this.list = [
			{
				iconPath: this.cdnBaseImg + "home.png",
				selectedIconPath: this.cdnBaseImg + "homeActive0925.png",
				text: "工作台",
				customIcon: true,
				// pagePath: "/pages/home/index",
			},
			{
				iconPath: this.cdnBaseImg + "bill.png",
				selectedIconPath: this.cdnBaseImg + "billActive0925.png",
				text: "我的职位",
				customIcon: false,
				// pagePath: "/pages/bill/index",
			},
			{
				iconPath: this.cdnBaseImg + "apply.png",
				selectedIconPath: this.cdnBaseImg + "applyActive0925.png",
				text: "简历工单",
				customIcon: false,
				// pagePath: "/pages/bill/index",
			},
			// {
			// 	iconPath: this.cdnBaseImg + "apply.png",
			// 	selectedIconPath: this.cdnBaseImg + "applyActive0925.png",
			// 	text: "工具",
			// 	customIcon: false,
			// 	// pagePath: "/pages/apply/index",
			// },
		];
	},

	methods: {
		getResumeInfo() {
			let that = this;
			that.G.Get(`/yishoudan/order/helper/check/neworder`, {}, (res) => {
				console.log("res", res);
				if (res > 0) {
					that.hasNewResume = res;
				}
				console.log("that.hasNewResume", that.hasNewResume);
				that.$forceUpdate();
			});
		},
		leftClick() {
			console.log("leftClick");
		},
		handleTab(e) {
			console.log(e);
			this.pageTitle = this.list[e].text;
			// if(this.currentPage == 0){
			// 	uni.setNavigationBarTitle({
			// 		title : '工作台'
			// 	})
			// }else if(this.currentPage == 1){
			// 	uni.setNavigationBarTitle({
			// 		title : '职位'
			// 	})
			// }else if(this.currentPage == 2){
			// 	uni.setNavigationBarTitle({
			// 		title : '工单'
			// 	})
			// }else if(this.currentPage == 3){
			// 	uni.setNavigationBarTitle({
			// 		title : '工具'
			// 	})
			// }
			uni.setNavigationBarTitle({
				title: this.list[e].text,
			});
			return true;
		},
		goBack() {
			uni.navigateBack({
				delta: 1,
			});
		},
	},
};
</script>

<style>
.p-merchantManagement-container {
}
page {
	background-color: #f5f5f5;
}
</style>
