<template>
  <div class="noticeListsj">
    <div
      v-for="item in list"
      class="list-row"
      @click="
        jumpPage(
          '/pages/subPackages/sj_history/detail?id=' + item.formId,
          item.id
        )
      "
    >
      <img src="./1.png" alt="" style="width: 80rpx; height: 80rpx" />
      <div class="lefttext">
        <div :class="item.bizReadStatus ? 'text ' : 'text fwbold'">
          {{ item.messageContent }}
        </div>
        <div class="text1">{{ item.createTime }}</div>
      </div>
    </div>
  </div>
</template>
<script>
import { bizMessageListPage, bizReadMessage } from "@/js_sdk/noticeList";
import { getUserLocalStorageInfo } from "@/js_sdk/localUserInfo.js";

export default {
  data() {
    return {
      searchData: {
        pageNum: 1,
        pageSize: 10,
      },
      list: [],
    };
  },
  onReachBottom() {
    // 触底加载更多
    this.searchData.pageNum += 1;
    this.bizMessageListPage();
  },
  onLoad() {
    this.searchData.bizId = getUserLocalStorageInfo().biz.id
      this.bizMessageListPage();
    // userId: getUserLocalStorageInfo().user.id,
  },
  onShow(){
    this.bizMessageListPage();

  },
  methods: {
    async jumpPage(path, id) {
      // console.log(id)
      // return
      let data = await bizReadMessage({ id });
      console.log(path);
      uni.navigateTo({
        url: path,
        fail: (fail) => {},
      });
    },
    async bizMessageListPage() {
      this.list=[]
      let { data } = await bizMessageListPage(this.searchData);
      if (this.list.length != data.total) {
        this.list.push(...data.list);
      }
    },
  },
};
</script>
<style lang="scss">
.noticeListsj {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  .fwbold {
    font-weight: bold!important;
  }
  .list-row {
    width: 606rpx;
    background: #ffffff;

    .lefttext {
      margin-left: 12rpx;
      .text {
        width: 500rpx;
        font-weight: 400;
        font-size: 32rpx;
        color: #222222;
      }
      .text1 {
        font-weight: 400;
        font-size: 28rpx;
        color: #888888;
        margin-top: 12rpx;
      }
    }
  }
}
</style>
