<template>
  <div class="user">
    <basic-container>
      <p class="newsDynamic">
        <span>消息动态</span>
        <span></span>
        <el-button type="primary" class="more">更多</el-button>
      </p>
      <div class="news">
        <ul class="newsCont">
          <li v-for="(item, index) in newsList" :key="index">
            <span class="msgCont">{{ item.msgCont }}</span>
            <span class="newsTime">{{ item.newsTime }}</span>
          </li>
        </ul>
      </div>
      <p class="newsDynamic">
        <span style="margin-right:20px;">待办事项</span>
      </p>
      <div class="news">
        <ul class="newsCont">
          <li>
            <span>调查信息审核 </span>
            <span><el-button type="primary" class="more">详情</el-button></span>
          </li>
          <li>
            <span>积分包接包审核</span>
            <span><el-button type="primary" class="more">详情</el-button></span>
          </li>
          <li>
            <span>积分包提交</span>
            <span><el-button type="primary" class="more">详情</el-button></span>
          </li>
        </ul>
      </div>
    </basic-container>
  </div>
</template>

<script>
import {
  toDoList,
  integralPackage,
  getWmScorePackagePageTask
} from "@/api/newLogin";
import { mapGetters } from "vuex";
export default {
  data() {
    return {
      newsList: [],
      toDolist: [],
      auditTasktypeval: []
    };
  },
  computed: {
    ...mapGetters(["permissions", "userInfo", "roles"])
  },
  mounted() {
    if (this.permissions["db_dc"] == true) {
      this.firstData();
      console.log("立刻");
    } else if (this.permissions["db_jf"] == true) {
      this.secondData();
      console.log("稍等");
    } else if (this.permissions["db_jfbtj"] == true) {
      this.thirdData();
      console.log("现在");
    } else {
      this.firstData();
      this.secondData();
      this.thirdData();
      console.log("1111");
    }
  },
  methods: {
    firstData() {
      let args = {
        current: 1, // 当前页数
        size: 10 // 每页显示多少条
      };
      toDoList(args)
        .then(response => {
          if (response.data.code == "0") {
            this.toDolist = response.data.data.records;
          } else {
            this.$message.error(response.data.msg);
          }
        })
        .catch(() => {
          this.$message.error(response.data.msg);
        });
    },
    secondData() {
      let args = {
        current: 1, // 当前页数
        size: 10 // 每页显示多少条
      };
      integralPackage(args)
        .then(response => {
          if (response.data.code == "0") {
            console.log(response.data, "111");
            this.toDolist = response.data.data.records;
          } else {
            this.$message.error(response.data.msg);
          }
        })
        .catch(() => {
          this.$message.error(response.data.msg);
        });
    },
    thirdData() {
      let args = {
        current: 1, // 当前页数
        size: 10 // 每页显示多少条
      };
      getWmScorePackagePageTask(args)
        .then(response => {
          if (response.data.code == "0") {
            this.toDolist = response.data.data.records;
          } else {
            this.$message.error(response.data.msg);
          }
        })
        .catch(() => {
          this.$message.error(response.data.msg);
        });
    }
  }
};
</script>

<style lang="scss">
.user {
  height: 100%;

  &__tree {
    padding-top: 3px;
    padding-right: 20px;
  }

  &__main {
    .el-card__body {
      padding-top: 0;
    }
  }
}
.news {
  width: 100%;
  height: 300px;
}

.newsDynamic {
  width: 100%;
  height: 30px;
  line-height: 30px;
  font-size: 20px;
  font-weight: 800;
  border-bottom: 1px solid black;
  margin-bottom: 10px;
}
.more {
  width: 90px;
  height: 20px;
  padding: 5px 15px;
  float: right;
}

.newsCont {
  height: 280px;
  margin-left: 15px;
  line-height: 28px;
}

.msgCont {
  width: 80%;
  display: inline-block;
  height: 20px;
}
.msgCont:nth-child(2),
.msgCont:nth-child(3) {
  text-align: center;
}
.msgCont:nth-child(4) {
  text-align: right;
}
.newsTime {
  display: inline-block;
  height: 20px;
}
</style>
