<script setup>
import user from '~/store/user';
import { child } from '~/store/child';

const oss = window.GLOBAL_CONFIG.oss

const props = defineProps({
  id: {
    type: String,
    default: undefined,
  },
})

const router = useRouter()
function handleNavLeftClick() {
  router.back()
}

let loading = $ref(true)
let detailInfo = $ref()
request({
  url: '/djzl/info/detail',
  data: {
    ni_id: props.id,
    token: user._role === 'jz' ? ( child ? child.token : user.token) : user.token
  }
}).then(res => {
  if (res.code === '1') {
    detailInfo = res.data.one_info
  } else {

  }
  loading = false
})

</script>

<template>

  <van-sticky>
    <van-nav-bar title="详情" left-arrow @click-left="handleNavLeftClick">
    </van-nav-bar>
  </van-sticky>

  <div class="p-2 w-full">
    <van-skeleton title :row="10" :loading="loading" class="flex">
      <div class="text-sm mb-4 flex-none">
        <div class="flex text-lg py-1">
          <div class="mr-4 font-bold">{{  detailInfo.name  }}</div>
        </div>

        <div class="flex py-1 justify-between">
          <van-tag type="primary">{{  detailInfo.nic_name  }}</van-tag>
          <div class="mr-4">{{  detailInfo.create_dateline_format  }}</div>
        </div>
      </div>

      <van-image :src="detailInfo.img" class="w-full"></van-image>


      <div v-html="detailInfo.content" class="my-2 text-sm min-h-32"> </div>
    </van-skeleton>
  </div>
</template>
