<template>
    <u-navbar :title="'查政策'" placeholder="true" bg-color="#F1F3F9" :auto-back="true" />
    <view class="container" v-if="xdbData.a_type === 1">
        <text class="title">{{ xdbData.title }}</text>
        <text class="fbr">发布人：{{ xdbData.publisher }}</text>
        <view class="readtime">
            <text class="time">{{ xdbData.create_time }}</text>
            <view class="readnum">
                阅读量：
                <text class="num">{{ xdbData.count }}</text>
            </view>
        </view>
        <view class="nrxq">
            <view class="icon"></view>
            <text class="nrtitle">内容详情</text>
        </view>
        <uvparse :content="xdbData.content"></uvparse>
    </view>
	<web-view v-else :src="xdbData.link_path"></web-view>
</template>

<script setup>
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { storeInfo } from '@/api/shop'
import uvparse from '@/uni_modules/uv-parse/components/uv-parse/uv-parse.vue'

const xdbData = ref({})

onLoad(async (param) => {
    await storeInfo(param.id).then((res) => {
        if (res.code === 1) {
            xdbData.value = res.data
        }
    })
})
</script>

<style scoped lang="scss">
.container {
    background-color: #ffffff;
    height: calc(100vh - 182rpx);
	overflow-y: auto;
    width: 100%;
    padding: 60rpx 40rpx 0 40rpx;
    box-sizing: border-box;

    .title {
        font-family: Source Han Sans;
        font-size: 36rpx;
        font-weight: normal;
        line-height: 48rpx;
        display: flex;
        align-items: center;
        letter-spacing: normal;
        color: #0c092a;
    }

    .fbr {
        margin-top: 28rpx;
        font-family: Source Han Sans;
        font-size: 28rpx;
        font-weight: 350;
        line-height: 48rpx;
        display: flex;
        align-items: center;
        letter-spacing: normal;
        color: #858494;
    }

    .readtime {
        margin-top: 28rpx;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .time {
            font-family: Source Han Sans;
            font-size: 28rpx;
            font-weight: 350;
            line-height: 48rpx;
            display: flex;
            align-items: center;
            letter-spacing: normal;
            color: #858494;
        }

        .readnum {
            display: flex;
            font-family: Source Han Sans;
            font-size: 28rpx;
            font-weight: 350;
            line-height: 48rpx;
            text-align: right;
            display: flex;
            align-items: center;
            letter-spacing: normal;
            /* 阅读量: */
            color: #858494;

            .num {
                font-family: Source Han Sans;
                font-size: 28rpx;
                font-weight: 350;
                line-height: 48rpx;
                text-align: right;
                display: flex;
                align-items: center;
                letter-spacing: normal;
                /* 2 */
                color: #007fff;
            }
        }
    }

    .nrxq {
        display: flex;
        align-items: center;
        margin-top: 60rpx;
        margin-bottom: 40rpx;

        .icon {
            width: 12rpx;
            height: 32rpx;
            border-radius: 0rpx 32rpx 32rpx 0rpx;
            /* 蓝色渐变 */
            background: linear-gradient(0deg, #007fff 0%, #99ccff 100%);
        }

        .nrtitle {
            margin-left: 20rpx;
            font-family: Source Han Sans;
            font-size: 30rpx;
            font-weight: 350;
            line-height: 32rpx;
            text-align: justify;
            /* 浏览器可能不支持 */
            display: flex;
            align-items: center;
            letter-spacing: normal;
            color: #0072ff;
        }
    }

    .message {
        margin-top: 40rpx;
    }
}
</style>
