<template>
  <div>
    <LHeader text="签到记录"> </LHeader>
    <div>
      <van-cell v-for="item in list" :key="item.id">
        <template #label>
          <div class="tips">
            <div>用户：{{ item.userName }}</div>
            <div>备注：{{ item.remark }}</div>
            <div>
              照片：
              <div class="imgs">
                <div
                  v-for="file in item.files"
                  :key="file.fileId"
                  class="img-item"
                >
                  <img :src="file.filePath" alt="" />
                </div>
              </div>
            </div>
          </div>
        </template>
        <template #title>
          <div class="title">
            <div>{{ item.type ? "签到" : "签退" }}</div>
            <div>
              {{ moment(item.createTime).format("YYYY-MM-DD HH:mm:ss") }}
            </div>
          </div>
        </template>
      </van-cell>
    </div>
  </div>
</template>

<script>
import LHeader from "@/components/header.vue";
import { getFun } from "@/service/table.js";
import moment from "moment";
export default {
  components: { LHeader },
  data() {
    return {
      list: [],
      moment: moment,
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    getList() {
      getFun("/risk/plan/sign/list").then((res) => {
        if (res.code == 200) {
          this.list = res.rows;
        }
      });
    },
  },
};
</script>

<style lang="less" scoped>
.title {
  display: flex;
  justify-content: space-between;
}
.tips {
  line-height: 22px;

  .imgs {
    display: flex;
    flex-wrap: wrap;
    .img-item {
      width: 100px;
      height: 100px;
      margin-right: 10px;
      margin-top: 10px;
    }
    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}
</style>
