<template>
    <section class="modules">
        <section class="m-head">
            <MOSTY.Assort :title="'其他'" />
        </section>
        <section class="content">
            <div class="aqjs-card aqlt" style="background-color: #E0FAE8;"
                @click="handleGoToPage('/dutyBook/qycy/SafetyDiscussion', '安全大讨论')">
                <div class="aqjs-title-container">
                    <span>安全论坛</span>
                    <span></span>
                </div>
                <div class="aqjs-content">
                    <div v-for="(item, index) in aqltArr" class="content-text">
                        <span>{{ index + 1 }}.</span>
                        <span style="margin-left: 4px;" :title="item.title">{{ item.title }}</span>
                    </div>
                </div>
            </div>
            <div class="aqjs-card" style="background-color: #E3F2FD;"
                @click="handleGoToPage('/dutyBook/qycy/safetySuggest', '安全建议')">
                <div class="aqjs-title-container">
                    <span>安全建议</span>
                    <span></span>
                </div>
                <div class="aqjs-content">
                    <div v-for="(item, index) in aqjyArr" class="content-text">
                        <span>{{ index + 1 }}.</span>
                        <span style="margin-left: 4px;" :title="item.jycontent">{{ item.jycontent }}</span>
                    </div>
                </div>
            </div>
        </section>
    </section>
</template>

<script setup>
import { getApi, postApi } from "@/api/tobAcco_api.js";
import { ref, reactive, onMounted, getCurrentInstance } from 'vue'
import * as MOSTY from "@/components/MyComponents/index";
import { useRouter } from "vue-router";
const router = useRouter();
const { proxy } = getCurrentInstance();
/** 安全论坛 */
const aqltArr = ref([])
/** 安全建议 */
const aqjyArr = ref([])
const handleGoToPage = (_url, _title) => {
    router.push(_url)
}
/** 设置-安全论坛 */
const setAqdtl = () => {
    const params = {
        pageSize: 3,
        pageCurrent: 1,
    }
    getApi(params, "/mosty-jcgl/discuss/getPageList").then((res) => {
        aqltArr.value = Array.isArray(res?.records) ? res.records : [];
    })
}
/** 设置-安全建议 */
const setAqjy = () => {
    const params = {
        pageSize: 3,
        pageCurrent: 1,
    }
    postApi(params, `/mosty-jcgl/suggest/querySuggestList`).then((res) => {
        aqjyArr.value = Array.isArray(res?.records) ? res.records : [];

    })
}
onMounted(() => {
    setAqdtl()
    setAqjy()
});
</script>
<style scoped lang="scss">
// @import '../style/index.scss';
.modules {
    height: 127px;
    background: #fff;
    padding: 0 16px;
    box-sizing: border-box;

    .m-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background-color: #fff;
    }

    .content {
        display: flex;
        justify-content: space-around;
        height: 100px;
        margin-top: -10px;

        .aqjs-card {
            width: 46%;
            height: 75px;
            padding: 5px 8px;
            box-sizing: border-box;
            /* margin: 5px; */
            border-radius: 4px;
            color: black;
            cursor: pointer;

            // text-align: center;
            &:first-child {
                margin-left: 0;
            }

            &:last-child {
                margin-right: 0;
            }

            &.aqlt {
                background-color: #29cae0;

            }

            .aqjs-title-container {
                display: flex;
                justify-content: space-between;
                border-bottom: 1px solid #cccccc22;
            }

            .aqjs-content {
                min-height: 62px;
            }

            .content-text {
                width: 100%;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }

        /* 可选：为h3标签添加一些样式 */
        .aqjs-card h3 {
            margin-top: 0;
            /* 去除顶部外边距 */
        }
    }
}
</style>