<template>
	<div id="app" class="font">
		<el-dialog title="温馨提示" top="30vh" :visible.sync="tipShow" width="30%" center>
			<span>为保护个人隐私信息，系统自动对敏感数据进行脱敏。如需编辑、查看完整信息，可通过“用户隐私二次认证”功能进行验证，验证通过之后，24小时内可查看完整信息。</span>
			<span slot="footer" class="dialog-footer">
				<el-button @click="tipShow = false">关闭</el-button>
			</span>
		</el-dialog>
		<router-view />
	</div>
</template>

<script>
	import {
		getPrivacySwitch
	} from "@/api/privacy";
	import {
		encrypt
	} from "@/utils/jiami";
	import axios from "axios";
	import vuex from "vuex";
	import {
		authenticate
	} from "@/api/getCode";
	const JM = require("@/utils/rsaEncrypt.js");
	export default {
		name: "App",
		data() {
			return {
				tipShow: false,
			};
		},
		created() {
			// this.handleLogin();
			// this.fetchData()
			if (this.$store.state.user.token) {
				this.getPrivacySwitch();
			} else {
				this.handleLogin();
			}
			this.yanzheng()



		},
		mounted() {

			// this.extractParamsAndHandleToken()

		},
		methods: {
			yanzheng() {
				const code = localStorage.getItem("code");
				if (code == null) {

					window.location.href = 'https://admin-uat.028wlkj.com:1020/login';

				} else {
					authenticate({
						needOpinion: code
					}).then(res => {
						if (res.data.code != '200') {

							window.location.href = 'https://admin-uat.028wlkj.com:1020/login';
						}
					})
				}
			},
			extractParamsAndHandleToken() {
				let urlPart = window.location.href
				const queryIndex = urlPart.indexOf('?');
				if (queryIndex === -1) {
					return null;
				}
				const queryString = urlPart.slice(queryIndex + 1);
				const paramPairs = queryString.split('&');
				let idValue = null;
				let tokenValue = null;

				paramPairs.forEach(pair => {
					const [key, value] = pair.split('=');
					if (key === 'code') {
						idValue = value;
					}
				});
				console.log(idValue, 'idValueidValueidValueidValue')
				// localStorage.setItem("code", idValue);
				this.yanzheng(idValue)
			},
			handleLogin() {
				const data = {
					username: JM.encrypt("admin"),
					password: JM.encrypt("ILoveChina@666"),
					// username: encrypt("admin"),
					// password: encrypt("ILoveChina@666"),
					rememberMe: false,
				};
				this.$store.dispatch("user/login", data).then(() => {
					// this.$router.push({ path: "/investigation/index" });

				});
			},

			getPrivacySwitch() {
				getPrivacySwitch().then((res) => {
					var IsTipshow = localStorage.getItem("IsTipshow");
					localStorage.setItem("privacyTime", res.data);
					if (this.$store.state.user.token && !IsTipshow && res.data === 0) {
						this.tipShow = true;
						localStorage.setItem("IsTipshow", true);
					}
				});
			},
		},
	};
</script>
<style>
	.font {
		font-family: "Alibaba-PuHuiTi-Regular";
	}

	.el-submenu__title {
		font-family: "Alibaba-PuHuiTi-Bold";
	}

	.el-dialog__header {
		background-color: #3f9b6a;
		text-align: left;
	}

	.el-dialog__title {
		color: #ffffff;
	}

	.el-select-dropdown__item.selected {
		color: #3f9b6a;
	}

	.el-pagination__sizes .el-input .el-input__inner:hover {
		border-color: #3f9b6a;
	}

	::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
		background-color: #3f9b6a;
	}

	.el-input__inner:focus {
		border: #3f9b6a 1px solid;
	}

	.el-input__inner:hover {
		border: #3f9b6a 1px solid;
	}

	::v-deep .el-select .el-input.is-focus .el-input__inner {
		border-color: #3f9b6a;
	}

	.el-form-item__label {
		font-weight: 100;
		font-size: 14px;
		color: #000000e6;
	}

	.el-tabs__item:hover {
		color: #3f9b6a;
	}

	.el-radio__input.is-checked+.el-radio__label {
		color: #3f9b6a;
	}

	.el-dialog__headerbtn:focus .el-dialog__close,
	.el-dialog__headerbtn:hover .el-dialog__close {
		color: #3f9b6a;
	}

	.custom-message {
		background-color: #fff;
		/* 设置背景颜色 */
		border: 0px;
	}

	.custom-message .el-message__icon {
		color: #3f9b6a;
	}

	.el-checkbox__input.is-checked .el-checkbox__inner,
	.el-checkbox__input.is-indeterminate .el-checkbox__inner {
		background-color: #3f9b6a;
		border-color: #3f9b6a;
	}

	.el-checkbox__inner:hover {
		border-color: #3f9b6a;
	}

	.el-textarea__inner:focus {
		border-color: #3f9b6a;
	}

	.el-select .el-input__inner:focus {
		border-color: #3f9b6a;
	}

	.el-button:focus,
	.el-button:hover {
		color: #606266;
		border-color: #dcdfe6;
		background-color: #fff;
	}

	.el-button--primary {
		background-color: #3f9b6a;
		border-color: #3f9b6a;
	}

	.el-button--primary:focus,
	.el-button--primary:hover {
		color: #fff;
		background: #3f9b6a;
		border-color: #3f9b6a;
	}

	.el-checkbox__input.is-focus .el-checkbox__inner {
		border-color: #3f9b6a;
	}

	.el-date-table td.end-date span,
	.el-date-table td.start-date span {
		background-color: #3f9b6a;
	}

	.el-date-table td.in-range div {
		background-color: #d3e6cc;
	}

	.el-date-table td.available:hover {
		color: #3f9b6a;
		background-color: #d3e6cc;
	}

	.el-date-table td.today span {
		color: #3f9b6a;
	}

	.el-picker-panel__footer .el-button--text {
		color: #3f9b6a;
	}

	.el-button.is-plain:focus,
	.el-button.is-plain:hover {
		color: #3f9b6a;
		border-color: #3f9b6a;
		background-color: #fff;
	}

	.el-picker-panel__icon-btn:hover {
		color: #3f9b6a;
	}

	.el-time-panel__btn.confirm {
		color: #3f9b6a;
	}

	.el-table .descending .sort-caret.descending {
		border-top-color: #3f9b6a;
	}

	.el-table .ascending .sort-caret.ascending {
		border-bottom-color: #3f9b6a;
	}

	.el-range-editor.is-active,
	.el-range-editor.is-active:hover,
	.el-select .el-input.is-focus .el-input__inner {
		border-color: #3f9b6a;
	}

	.el-radio-button__inner:hover {
		color: #3f9b6a;
	}

	.el-radio-button__orig-radio:checked+.el-radio-button__inner {
		background-color: #3f9b6a;
		border-color: #3f9b6a;
		-webkit-box-shadow: none;
		box-shadow: none;
	}

	.el-button {
		min-width: 88px;
		font-size: 14px;
		height: 32px;
		padding: 8px 15px;
		font-weight: 400;
	}

	.el-button:hover {
		color: #ffffff;
		border-color: #79b997;
		background-color: #79b997 !important;
		outline: none;
	}

	.el-upload--picture-card:hover,
	.el-upload:focus {
		border-color: #3f9b6a;
		color: #3f9b6a;
	}

	.el-cascader .el-input .el-input__inner:focus,
	.el-cascader .el-input.is-focus .el-input__inner {
		border-color: #3f9b6a;
	}

	.el-cascader-node.in-active-path,
	.el-cascader-node.is-active,
	.el-cascader-node.is-selectable.in-checked-path {
		color: #3f9b6a;
	}

	.el-radio__input.is-checked .el-radio__inner {
		border-color: #3f9b6a;
		background-color: #3f9b6a;
	}

	.el-radio__inner:hover {
		border-color: #3f9b6a;
	}

	.app-breadcrumb.el-breadcrumb .no-redirect {
		font-size: 14px;
		color: #0006 !important;
	}

	.el-input__inner::placeholder {
		color: #999999;
	}

	.el-table .el-table__cell {
		padding: 9px 0;
		text-align: left !important;
	}

	.el-table tr:hover {
		background-color: #f0f7f3 !important;
	}

	.el-form-item__label {
		font-weight: 100;
		font-size: 14px;
		color: #000000e6;
	}

	.el-input__inner {
		height: 32px;
		line-height: 32px;
		margin-top: 3px;
	}

	.el-input__icon {
		line-height: 32px;
	}

	.el-form-item {
		margin-bottom: 16px;
	}

	.el-upload--picture-card {
		width: 240px !important;
		height: 150px !important;
	}

	.el-upload-list--picture-card .el-upload-list__item {
		width: 240px !important;
		height: 150px !important;
	}
</style>
<style lang="scss">
	.XDD_css {
		margin-top: 10vh;
		margin-left: 20%;
		max-height: 550px;
		overflow-y: auto;

		.el-dialog__body {
			padding: 0px;
			background-color: #fff;
		}

		.el-dialog__header {
			background-color: #fff;
			padding: 10px 20px 10px 20px;
			border-bottom: 1px solid #efefef;
		}

		.el-dialog__title {
			font-size: 14px;
			color: #000000e6;
		}
	}

	.xiaoguo_css {
		margin-top: 30vh !important;
		margin-left: 25%;

		.el-dialog__header {
			padding: 0;
		}

		.el-tabs--border-card {
			border: none;
			-webkit-box-shadow: none;
			box-shadow: none;

			.el-tabs__content {
				border: 1px solid #e4e7ed;
				padding: 0;
			}

			.el-tabs__header {
				background-color: #fff;
				border-bottom: none;
			}

			.el-tabs__content {
				border: none;
			}

			.el-tabs__header .el-tabs__item {
				border: none;
				margin-right: 10px;
				background-color: #f2f2f2;
				font-size: 12px;
				border-top-left-radius: 8px;
				border-top-right-radius: 8px;
				padding: 0 15px;
			}

			.el-tabs__header .el-tabs__item.is-active {
				color: #fff;
				background-color: #3f9b6a;
			}

			.el-tabs__header .el-tabs__item:not(.is-disabled):hover {
				color: #3f9b6a;
			}
		}
	}

	.yaunXin_css {
		margin-top: 30vh !important;
		margin-left: 25%;

		.el-dialog__header {
			padding: 0;
		}

		.el-tabs--border-card {
			border: none;
			-webkit-box-shadow: none;
			box-shadow: none;

			.el-tabs__content {
				border: 1px solid #e4e7ed;
				padding: 0;
			}

			.el-tabs__header {
				background-color: #fff;
				border-bottom: none;
			}

			.el-tabs__content {
				border: none;
			}

			.el-tabs__header .el-tabs__item {
				border: none;
				margin-right: 10px;
				background-color: #f2f2f2;
				font-size: 12px;
				border-top-left-radius: 8px;
				border-top-right-radius: 8px;
				padding: 0 15px;
			}

			.el-tabs__header .el-tabs__item.is-active {
				color: #fff;
				background-color: #3f9b6a;
			}

			.el-tabs__header .el-tabs__item:not(.is-disabled):hover {
				color: #3f9b6a;
			}
		}
	}

	.fenxi_css {
		margin-top: 9vh !important;
		margin-left: 15% !important;

		.el-dialog__header {
			padding: 0;
		}

		.el-tabs--border-card {
			border: none;
			-webkit-box-shadow: none;
			box-shadow: none;

			.el-tabs__content {
				border: 1px solid #e4e7ed;
				padding: 0;
			}

			.el-tabs__header {
				background-color: #fff;
				border-bottom: none;
			}

			.el-tabs__content {
				border: none;
			}

			.el-tabs__header .el-tabs__item {
				border: none;
				margin-right: 10px;
				background-color: #f2f2f2;
				font-size: 12px;
				border-top-left-radius: 8px;
				border-top-right-radius: 8px;
				padding: 0 15px;
			}

			.el-tabs__header .el-tabs__item.is-active {
				color: #fff;
				background-color: #3f9b6a;
			}

			.el-tabs__header .el-tabs__item:not(.is-disabled):hover {
				color: #3f9b6a;
			}
		}
	}

	.el-tree-node__label {
		color: #000000e6;
	}

	.bian_css {
		margin-top: 9vh !important;
		margin-left: 20%;
		max-height: 600px;
		overflow-y: auto;

		.el-dialog__body {
			padding: 0px;
			background-color: #fff;
		}

		.el-dialog__header {
			background-color: #fff;
			padding: 10px 20px 10px 20px;
			border-bottom: 1px solid #efefef;
		}

		.el-dialog__title {
			font-size: 14px;
			color: #000000e6;
		}

		.el-date-table td.available:hover {
			background-color: #3f9b6a;
		}

		.el-date-table td.start-date span {
			background-color: #3f9b6a;
		}
	}

	.tongyong_css {
		margin-top: 9vh !important;
		margin-left: 20%;
		max-height: 800px;
		overflow-y: auto;

		.el-dialog__body {
			padding: 0px;
			background-color: #fff;
		}

		.el-dialog__header {
			background-color: #fff;
			padding: 0;
		}

		.el-dialog__title {
			font-size: 14px;
			color: #000000e6;
		}

		.el-date-table td.available:hover {
			background-color: #3f9b6a;
		}

		.el-date-table td.start-date span {
			background-color: #3f9b6a;
		}
	}

	.Xintongyong_css {
		margin-top: 9vh !important;
		margin-left: 20%;
		overflow-y: auto;

		.el-dialog__body {
			padding: 0px;
			background-color: #fff;
		}

		.el-dialog__header {
			background-color: #fff;
			padding: 0;
		}

		.el-dialog__title {
			font-size: 14px;
			color: #000000e6;
		}

		.el-date-table td.available:hover {
			background-color: #3f9b6a;
		}

		.el-date-table td.start-date span {
			background-color: #3f9b6a;
		}
	}

	.el-descriptions__body .el-descriptions__table .el-descriptions-item__cell {
		line-height: 1;
	}

	.el-tabs__item.is-active {
		color: #3f9b6a;
	}

	.el-tabs__active-bar {
		background-color: #3f9b6a;
	}

	.el-step__title.is-process {
		font-weight: 100;
	}

	.el-pagination.is-background .el-pager li:not(.disabled):hover {
		color: #3f9b6a;
	}

	.el-table__row {
		font-size: 14px;
		color: #000000e6;
	}

	.el-upload-list__item.is-success .el-upload-list__item-name:focus,
	.el-upload-list__item.is-success .el-upload-list__item-name:hover {
		color: #3f9b6a;
		cursor: pointer;
	}

	.actSpye_dialog {
		.el-dialog__header {
			padding: 0px;
		}

		.el-dialog__body {
			padding: 0px;
		}
	}

	.liucheng_css {
		.el-dialog__header {
			padding: 10px 20px;
			border-bottom: 1px solid #efefef;
			background-color: #fff;
		}

		.el-dialog__title {
			color: #000;
			font-size: 14px;
		}

		.el-dialog__body {
			padding: 0px;
		}
	}

	.el-table__body tr.current-row>td.el-table__cell,
	.el-table__body tr.selection-row>td.el-table__cell {
		background-color: #deebe2 !important;
	}

	.el-checkbox__input.is-checked+.el-checkbox__label {
		color: #3f9b6a;
	}

	.el-checkbox__input.is-disabled+span.el-checkbox__label {
		color: #606266;
	}

	.el-radio__input.is-disabled+span.el-radio__label {
		color: #606266;
	}

	.el-date-table td.current:not(.disabled) span {
		background-color: #3f9b6a;
		color: #fff;
	}

	.el-pager li.active {
		color: #3f9b6a;
	}

	.el-pager li:hover {
		color: #3f9b6a;
	}

	.stepsColor .one_class {
		background: #3f9b6a;
	}

	.stepsColor .two_class {
		color: #3f9b6a;
	}
</style>