<template>
    <div class="account_systemMessage">
		<div class="account_generalMessage_title modal_title_text">
			<span>系统消息</span>
			<div class="account_generalMessage_title_setting" @click="allRead">全部已读</div>
		</div>
		<div class="account_generalMessage_item modal_title_text" v-for="item in dataList" :key="item.id" @click="setRead(item)">
			<a-badge dot></a-badge>
			<div class="account_generalMessage_item_title">
				<div class="account_generalMessage_item_title_text" :title="item.content">{{ item.content.title }}</div>
				<div class="modal_title_text_intro">{{ item.createTime }}</div>
			</div>
			<div class="modal_title_text_intro">
				{{ item.content.content }}
				<span v-if="item.content.link" class="account_generalMessage_item_link">{{ item.content.link }}</span>
			</div>
		</div>
    </div>
</template>
<script lang="ts">
import { defineComponent,computed,ref,reactive,nextTick,toRefs,createVNode, onMounted} from 'vue'
import { Https } from "@/tool/https";
import { useRouter,useRoute } from 'vue-router'
import { Modal,message } from 'ant-design-vue';
import { useStore } from "vuex";
import { setCookie, getCookie, WriteCookie } from "@/tool/cookie";
import { useI18n } from 'vue-i18n'
export default defineComponent({
    components:{
    },
	emits:['setReadStatus','setAllmessage'],
    props:{
    },
    setup(prop,{emit}) {
		const router = useRouter()
        const store = useStore();
		let accountMessage = reactive({
			dataList: [],
		})
		let setmessageList = (data:any)=>{
			console.log(data);
			
			data.content.forEach((item:any) => {
				item.content = JSON.parse(item.content)
			});
			accountMessage.dataList = data.content
		}
		let setRead = (item:any)=>{
			emit('setReadStatus',item)
		}
		let allRead = ()=>{
			emit('setAllmessage')
		}
		// provide('exhibitionList',exhibitionList)
		
		onMounted (()=>{
		})
        return{
           ...toRefs(accountMessage),
		   setmessageList,
		   setRead,
		   allRead
        }
    },
    data(){
        return{
            
        }
    },
})
</script>
<style lang="less" scoped>
.account_systemMessage{
	width: 100%;
	.account_generalMessage_item{
		.account_generalMessage_item_title{
			display: flex;
			align-items: center;
			margin-bottom: 2rem;
			.account_generalMessage_item_title_text{
				max-width: 80%;
				white-space: nowrap;      
				overflow: hidden;          
				text-overflow: ellipsis;
			}
			.modal_title_text_intro{
				margin-left: 4rem;
			}
		}
	}
}
</style>
