<template>
	<view class="content">


		<view class="content-con">
			<view class="content-left">
				<view class="content-left-img">
					<image src="@/static/images/logo.png" mode=""></image>
				</view>
				<view class="content-left-one" v-for="(item, index) in list" :key="index" @click="getlist(index)">
					<view class="left-one" :class="{ 'lefcolor': num === index }">
						{{item.name}}
					</view>
				</view>
				<view class="content-left-bottom">
					<view class="left-bottom-left">
						<view class="left-bottom">
							<image :src="oaUserInfo.avatar" mode=""></image>
						</view>
						<view class="left-bottom1">
							{{oaUserInfo.nickname}}
						</view>
					</view>
					<view class="left-bottom-right">
						<view class="bottom-right1">
							<view class="bottom-right_a">

							</view>
							<view class="bottom-right_b">

								{{oaUserInfo.nickname ?'在线':'离线'}}

							</view>
						</view>
						<view class="bottom-right2" @click="logout">
							切换账号
						</view>
					</view>
				</view>
			</view>


			<view class="content-right">
				<index :type='type' v-if="num==0" />
				<index :type='type' v-if="num==0" />
				<index :type='type' v-if="num==0" />
			</view>

		</view>


	</view>
</template>

<script>
	import {
		getdatatotal,
		getDocumentListApi,
		projecttasklist,
		todosubjec,
		tasksubjec
	} from '@/api/oa.js'
	import {
		HTTP_REQUEST_URL
	} from '@/config/app.js'

	import index from '@/components/index/detaila.vue'


	export default {
		components: {
			index,


		},
		data() {
			return {
				title: 'Hello',
				statusBarHeight: 0,
				list: [{
						name: '待取货',
						id: 0
					},
					{
						name: '待配送',
						id: 1
					},
					{
						name: '已送达',
						id: 2
					},

				],
				num: 0,
				type: ''
			}
		},
		computed: {
			oaUserInfo() {
				return this.$store.state.app.userInfo
			},

		},

		onLoad(option) {
			this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
			this.type = option.id

		},
		onPullDownRefresh() {

			uni.stopPullDownRefresh()
		},
		methods: {
			login() {
				uni.reLaunch({
					url: '/pages/oaLogin/oaLogin'
				})
			},
			logout() {
				uni.redirectTo({
					url: '/pages/oaLogin/oaLogin'
				})
			},
			getlist(index) {
				this.num = index

				if (index == 1) {
					uni.navigateTo({
						url: '/pages/psong/index'
					})
				}

				if (this.num == 2) {
					uni.navigateTo({
						url: '/pages/sda/index'
					})
				}
			},
			//获取公告
			async getDtnote() {
				let res = await getDocumentListApi({
					page: 1,
					limit: 2
				})

				this.list5 = res.data.data
			},
			async getDtlist() {
				let res = await todosubjec()

				this.list6 = res.data
				// this.list5 = res.data.data
			},
			async getDtlist1() {
				let res = await tasksubjec()
				this.list2 = res.data
			},
			spclickItem(item) {
				console.log(item)
				uni.navigateTo({
					url: '/pages/leave_request/index?type=' + item.id
				})
			},
			//获取任务
			async getDocumentList2() {

				let res = await projecttasklist({
					page: 1,
					limit: 3,

				})

				this.list4 = res.data.data

			},

			//待办
			daiban() {
				uni.navigateTo({
					url: '/pages/waitlist/index'
				})
			},

			//任务
			geng() {
				uni.switchTab({
					url: '/pages/oaTask/oaTask'
				})
			},
			//获取部门
			async getList() {
				const res = await getdatatotal()
				this.list = res.data
			},
			//列表
			listbiao(item, i) {
				switch (item.type) {
					case "note":
						uni.navigateTo({
							url: '/pages/users/user_document/index'
						})
						break;
					case "approve":
						uni.switchTab({
							url: '/pages/examine/index'
						})

						break;
					case "expense":
						uni.navigateTo({
							url: '/pages/reimbursement/index'
						})
						break;
					case "invoice":
						uni.navigateTo({
							url: '/pages/invoice/index'
						})
						break;
					case "customer":
						uni.navigateTo({
							url: '/pages/personneltransfer/index'
						})
						break;

					case "project":

						uni.navigateTo({
							url: '/pages/project/index'
						})
						break;
					case "task":
						uni.switchTab({
							url: '/pages/oaTask/oaTask'
						})
						break;
					case "article":
						uni.navigateTo({
							url: '/pages/users/article/index'
						})
						break;
				}

			},
			//公告
			gongao() {
				uni.navigateTo({
					url: '/pages/users/user_document/index'
				})
			},
			//待办
			gongao1() {
				this.isshow1 = !this.isshow1
			},

			//应用中心
			appcenter(item, i) {
				switch (i) {
					case 0:
						uni.navigateTo({
							url: '/pages/leaveapplication/index?type=1'
						})
						break;
					case 1:
						uni.navigateTo({
							url: '/pages/leaveapplication/index?type=2'
						})
						break;
					case 2:
						uni.navigateTo({
							url: '/pages/leaveapplication/index?type=3'
						})
						break;
					case 3:
						uni.navigateTo({
							url: '/pages/leaveapplication/index?type=15'
						})
						break;
					case 4:
						uni.navigateTo({
							url: '/pages/leaveapplication/index?type=7'
						})
						break;

					case 5:
						uni.navigateTo({
							url: '/pages/invoice/add'
						})
						break;
					case 6:
						uni.navigateTo({
							url: '/pages/reimbursementapplication/index'
						})
						break;
					case 7:
						uni.navigateTo({
							url: '/pages/appcenter/index'
						})
						break;
				}

			}
		}
	}
</script>

<style lang="scss">
	page {

		// background: #Fff;
		// width: 1024px;
		// border: 1px solid red;
	}

	.content {
		position: relative;

		.content-con {
			display: flex;
		}

		.content-left {
			width: 136rpx;


			margin-left: 10rpx;
			margin-right: 10rpx;

			.content-left-img {
				width: 50rpx;
				height: 45rpx;
				margin: 0 auto;
				margin-bottom: 37rpx;
				margin-top: 40rpx;

				image {
					width: 50rpx;
					height: 45rpx;
				}
			}


			.content-left-one {
				text-align: center;
				margin-bottom: 30rpx;
			}

			.left-one {
				width: 136rpx;
				font-size: 13rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #333333;
				height: 29px;
				line-height: 29px;
				margin: 0 auto;


			}

			.lefcolor {
				background: #DDE9FE;
				font-size: 13rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #0022C7;
			}

			.content-left-bottom {
				position: absolute;
				width: 136rpx;
				bottom: 0rpx;
				height: 62rpx;


				background-color: #F5F8FE;

				.left-bottom-left {
					display: flex;

					.left-bottom1 {
						font-size: 12rpx;
						font-family: PingFang SC-Semibold, PingFang SC;
						font-weight: 600;
						color: #0022C7;
						margin-top: 10rpx;
					}

					.left-bottom {
						width: 26rpx;
						height: 26rpx;
						border-radius: 50%;
						margin-right: 10rpx;
						margin-left: 30rpx;

						image {
							width: 26rpx;
							height: 26rpx;
							border-radius: 50%;
						}


					}
				}

				.left-bottom-right {
					display: flex;
					justify-content: space-around;
					line-height: 25rpx;
					margin-top: 10rpx;

					.bottom-right1 {
						display: flex;


						.bottom-right_a {
							width: 10rpx;
							height: 10rpx;
							border-radius: 50%;
							background-color: #46BE61;
							margin-top: 8rpx;
							margin-right: 10rpx;
						}

						.bottom-right_b {
							font-size: 10rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #333333;
						}


					}

					.bottom-right2 {
						font-size: 10rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #333333;
					}

				}

			}


		}

		.content-right {
			background: linear-gradient(180deg, #D8E6FE 0%, rgba(228, 236, 251, 0.39) 16%, rgba(244, 246, 252, 0.61) 100%);
			border-radius: 15px 0px 0px 0px;
			padding-top: 22rpx;
			padding-left: 15rpx;
			padding-right: 15rpx;
			width: 600rpx;
		}

	}
</style>