<template>
    <view class="container">
        <!-- 导航栏 -->
        <view class="nav-bar">
            <view class="nav-left" @click="navBack">
                <image class="back-icon" src="/static/icons/chevron_right_dark.svg" style="transform: rotate(180deg);"></image>
            </view>
            <text class="nav-title">消息详情</text>
            <view class="nav-right"></view>
        </view>
        <view class="nav-placeholder"></view>

        <view class="detail-content">
            <text class="detail-title">{{ notice.title }}</text>
            <text class="detail-time">{{ formatTime(notice.time) }}</text>
            
            <view class="detail-body">
                <text>{{ notice.content }}</text>
            </view>
            
            <view class="detail-footer">
                <view class="divider"></view>
                <text class="footer-text">如有疑问，请咨询在线客服。</text>
            </view>
        </view>

    </view>
</template>

<script>
import { formatTime } from '@/utils/index'

export default {
    data() {
        return {
            notice: {
                title: '消息详情',
                content: '',
                time: ''
            }
        }
    },
    onLoad(options) {
        if (options.title) this.notice.title = options.title;
        if (options.content) this.notice.content = options.content;
        if (options.time) this.notice.time = options.time;
    },
    methods: {
        formatTime,
        navBack() {
            uni.navigateBack();
        }
    }
}
</script>

<style>
page {
    background-color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 88rpx;
    padding-top: var(--status-bar-height);
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30rpx;
    box-sizing: border-box;
    z-index: 100;
    border-bottom: 1rpx solid #f5f5f5;
}
.nav-placeholder {
    height: calc(88rpx + var(--status-bar-height));
}
.back-icon {
    width: 40rpx;
    height: 40rpx;
}
.nav-title {
    font-size: 34rpx;
    font-weight: bold;
    color: #333;
}
.nav-right { width: 40rpx; }

.detail-content {
    padding: 40rpx 30rpx;
}
.detail-title {
    font-size: 40rpx;
    font-weight: bold;
    color: #333;
    display: block;
    margin-bottom: 20rpx;
}
.detail-time {
    font-size: 24rpx;
    color: #999;
    display: block;
    margin-bottom: 40rpx;
}
.detail-body {
    font-size: 30rpx;
    color: #333;
    line-height: 1.8;
}
.detail-footer {
    margin-top: 60rpx;
    text-align: center;
}
.divider {
    height: 1rpx;
    background-color: #eee;
    margin-bottom: 30rpx;
}
.footer-text {
    font-size: 26rpx;
    color: #ccc;
}
</style>
