<template>
  <div>
    <div>
      <el-card style="font-family: 'Microsoft YaHei'; font-weight: 600">
        <div slot="header" style="font-size: 18px">
          <span>公告栏</span>
          <el-button style="float: right; padding: 3px 0; font-weight: 600" type="text" @click="inPage"
            >更多公告</el-button
          >
        </div>
        <div v-for="item in data" :key="item.id" style="font-size: 14px">
          <el-link style="cursor: pointer;font-weight: 600;font-size: 14px" @click="rowEdit(item)">
            {{ item.title }}
          </el-link>
        </div>
        <div v-if="data.length == 0" style="font-size: 14px; color: #c0c4cc">
          <div>暂无公告</div>
        </div>
      </el-card>
    </div>
  </div>
</template>

<script>
// @ts-nocheck
import { getList } from "@/api/wel/bulletin.js";
export default {
  data() {
    return {
      data: [],
    };
  },
  created() {
    this.getData();
  },
  components: {},
  methods: {
    getData() {
      let obj = {
        visibleRoles: 2,
      };
      getList(obj)
        .then((res) => {
          this.data = res.data.data;
        })
        .finally(() => {
          this.loading = false;
        });
    },
    inPage() {
      this.$router.push("/bulletin/index");
    },
    rowEdit(row) {
      this.$router.push({
        path: `/bulletin/details`,
        query: {
          id: row.id,
        },
      });
    },
  },
};
</script>
<style lang="scss" scoped></style>
