<template>
  <view class="message_center">
    <view
      v-for="(i, index) in useModel?.items?.value"
      class="message_center_item"
      :key="`items_${index}`"
      @click="toList"
    >
      <view class="message_center_item_icon">
        <image
          :src="`/static/svg/${i?.icon}`"
          mode="heightFix"
          lazy-load="false"
          binderror=""
          bindload=""
        />
        <view v-if="i?.count" class="message_num">{{ i?.count }}</view>
      </view>
      <view class="message_center_item_content">
        <view class="label"
          >{{ i?.label }} <text>{{ i?.des?.created_at || '' }}</text></view
        >
        <view class="message_des" v-if="i?.des?.title">{{ i?.des?.title || '暂无消息' }}</view>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import useModel from './model'
import method from './method'
import { onLoad } from '@dcloudio/uni-app'
const toList = () => {
  uni.navigateTo({
    url: '/INDEX/message_center/list/index'
  })
}

onLoad(() => {
  method?.getList()
})
</script>

<style lang="scss">
@import './style.scss';
</style>
