<!-- 数据量 -->
<template>
	<div class="pricemoitorrecord">
		<a-card :bordered="false">
			<a-space class="search">
				<div class="silt-title">
					<span style="width: 10px; margin-right: 8px; text-align: right; display: block; line-height: 30px"> </span>
					<div class="title_back">门户网站背景设置</div>
					<a-switch
						:checked="status.mourningDaySwitch == 1 ? true : false"
						:checked-children="'一键置灰'"
						:un-checked-children="'关'"
						@change="handleSwitchChange(record)"
						size="default"
					/>
				</div>

				<div class="btnBox"></div>
			</a-space>
		</a-card>
	</div>
</template>
<script setup name="sharing">
	import business from '@/api/home/home.js'
	import { listPagination } from '@/hook/listlistPagination.js'
	import { reactive, ref, onMounted } from 'vue'
	import { useRouter } from 'vue-router'
	import { defineComponent } from 'vue'
	import { message } from 'ant-design-vue'
	import { enumMap } from '@/hook/enumMap.js'
	const { cocDLMXS } = enumMap()
	const router = useRouter()
	const handleSwitchChange = async (v) => {
		await BACKeditCode({
			id: status.value.id,
			mourningDaySwitch: status.value.mourningDaySwitch == 1 ? 0 : status.value.mourningDaySwitch == 0 ? 1 : ''
		})
		BACKdetailGet()
	}
	onMounted(() => {
		BACKdetailGet()
	})
	const status = ref({
		mourningDaySwitch: 1,
		id: ''
	})
	const BACKdetailGet = async () => {
		const res = await business.BACKdetail()
		status.value.mourningDaySwitch = res.records[0].mourningDaySwitch
		status.value.id = res.records[0].id
	}

	const BACKeditCode = async (v) => {
		const res = await business.BACKedit(v)
	}
</script>
<style lang="less" scoped>
	.search {
		padding-top: 20px;
		// padding-left: 50px;
		margin-bottom: 32px;
		.btnBox {
			width: 100%;
			display: inline-block;
			display: flex;
			justify-content: space-around;
			align-items: center;
			.primarySele {
				margin-left: 20px;
				margin-right: 20px;
			}
		}
	}
	.silt-title {
		display: flex;
		justify-content: center;
		align-items: center;
		.title_back {
			font-weight: 500;
			font-size: 18px;
			margin-right: 30px;
		}
	}
	.switch_del {
		height: 40px;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>
