<template>
	<view class="content">
		<view class="navBarBox" :style="{height:navBarBoxHeight+'px'}">
			<!-- 状态栏占位 -->
			<view class="statusBar" :style="{paddingTop: navBarTop+'px'}"></view>
			<!-- 真正的导航栏内容 -->
			<view class="navBar" :style="{'height':navBarHeight+'px','line-height':navBarHeight+'px'}">
				<view class="back" @click="goback">
					<u-icon name="arrow-left"></u-icon>
				</view>
				<view>{{menutitle}}</view>
			</view>
		</view>
		<view class='contop' :style="{'margin-top':(navBarBoxHeight)+'px'}">
			<view class='title'>{{info.title?info.title:''}}</view>
			<view v-if="info.source" class='time'><span>来源：{{info.source?info.source:''}}</span></view>
			
		</view>
	
		<view class='detail'>
			 <u-parse v-if='showContent' :content="info.text?info.text:' '"/>
		</view>
	</view>
</template>

<script>
	import uParse from '@/components/gaoyia-parse/parse.vue'
	import {
		shareInfo
	} from "@/common/util.js"
	export default {
		  components: {
			uParse,
		  },
		data() {
			return {
				navBarBoxHeight: 0,
				navBarHeight:0,
				navBarTop:0,
				menutitle: '',
				info: {},
				id: '',
				showContent:false
			}
		},
		onShareAppMessage() {
			return shareInfo
		},
		onShareTimeline(){
			return shareInfo
		},
		onLoad(options) {
			const MenuButton = uni.getMenuButtonBoundingClientRect()
			this.navBarTop = MenuButton.top //左侧文字与右侧胶囊对齐
			this.navBarHeight = MenuButton.height
			this.navBarBoxHeight = this.navBarTop + this.navBarHeight + 10
			console.log(options)
			this.id = options.id ? options.id : ''
			this.menutitle =  options.menuTitle?options.menuTitle:'冬训云课堂'
			this.loadDetail(this.id)
			this.enterAudios(this.id)
		},
		methods: {
			goback(){
				 uni.navigateBack({
				    delta: 1 // 返回的页面数，这里设置为1表示返回上一页
				 });
			},
			async enterAudios(id){
				await this.$u.api.enterAudios(id,{})
			},
			async loadDetail(id) {
				const res = await this.$u.api.showAudios(id,{})
				this.info = res
				this.showContent = true
			}
		}
	}
</script>
<style lang='scss'>
	.navBarBox {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 999;
		width: 100%;
	
		padding: 0 20rpx;
		background: linear-gradient(to right, #da212d, #f96666);
		margin-bottom:24rpx;
		.navBar {
			color: #fff;
			font-size: 32rpx;
			text-align: center;
	
			.back {
				position: absolute;
				left: 20rpx;
	
			}
		}
	}
</style>
<style>
	@import url("/components/gaoyia-parse/parse.css");
	.content {
		/* background-color: #fbf3ea; */
		/* padding-bottom:180rpx */
	}
	.contop{
		padding:0 30rpx;
		    padding-bottom: 30rpx;
		    border-radius: 0 0 30rpx 30rpx;
		    background: #fff;
	}
	.title {
		text-align: center;
		padding: 30rpx 0rpx;
		font-size: 36rpx;
		font-weight:bold;
	}

	.time {
		text-align: center;
		color: #6e6e6e;
		font-size: 28rpx;
		padding-bottom: 30rpx;
		border-bottom: 1px solid #fafaf9;
	}

	.time span {
		margin: 0 10rpx;
	}

	.head {
		margin:30rpx 0;
		margin-bottom:0;
	}

	.head img {
		width: 100%
	}
	.head_unit{
		background-color: #fcf8f3;
		border:8rpx solid #f8ebdb;
		border-radius: 20rpx;
		padding:35rpx;
		margin:30rpx 0;
		margin-bottom:0;
		font-size: 28rpx;
	}
	.head_unit>view{
		display: flex;
	}
	.head_unit>view>view:first-child{
		width:28%;
	}
	.head_unit>view>view:last-child{
		width:72%;
	}
	.head_unit>view>view:last-child view{
		margin-bottom: 20rpx;
	}
	.bg40{
		width:100%;
		height:40rpx;
		background-color: #fbf3ea;
	}
	.detail {
		padding:0 60rpx;
		background: #fff;
		/* padding-top: 30rpx; */
		border-radius: 30rpx 30rpx 0 0;
		padding-bottom:180rpx;
		font-size: 28rpx;
	}
	.detail img {
		width: 100%;
		margin:10rpx 0;
	}
	.wxParse{
		line-height: 2.3;
	}
</style>