<template>
  <view class="content">
    <view class="title"> 审核列表 </view>
    <view class="list">
      <view
        class="project"
        v-for="project in projectList"
        :key="project.id"
        @click="onClickProject(project)"
      >
        {{ `${project.project_name}(${project.project_full_code})` }}
      </view>
    </view>
  </view>
</template>

<script>
import { queryAuth } from "@/services/project";
import { mapState } from "vuex";
export default {
  computed: {
    ...mapState(["currentProject"]),
  },
  data() {
    return { projectList: [] };
  },
  onShow() {
    this.getProject();
  },
  methods: {
    async getProject() {
      let res = {};
      res = await queryAuth();
      this.projectList = res.data.list;
    },
    async onClickProject(project) {
      await this.$store.commit("setCurrentProject", project);
      uni.navigateTo({
        url: `./detail?id=${project.id}&auth=${true}`,
      });
    },
  },
};
</script>

<style lang="less" scoped>
.content {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

.title {
  width: 100%;
  padding: 0 20px 20px 20px;
  position: fixed;
  background: #f8f8f8;
  font: 24px bold;
}
.list {
  width: 90%;
  margin-top: 60px;
}
.project {
  border-top: 2px solid gray;
  padding: 20px 0px;
  font-size: 18px;
}
</style>
