<template>
	<view class="container">
		<view class="container-name">
			{{data.title}}
		</view>
		<view class="container-top flex-box">
			<text>报送人：{{data.user.name}}</text>
			<text>发布部门：{{departmentList.find(v=>{
				return v.id === data.department
			}).name}}</text>
		</view>
		<view class="container-top">
			发布时间：{{data.daily_time.replace('T',' ')}}
		</view>
		<view class="container-content" v-for="(v,k) in data.content.split('\n')" :key="k">
			{{v}}
		</view>
		<button type="primary" class="roundBack" @click="onBack">
			<uni-icons type="arrow-left" size="12" color="#fff"></uni-icons>
		</button>
	</view>
</template>

<script>
	import {
		request
	} from 'common/request.js'
	export default {
		data() {
			return {
				data: {},
				departmentList: uni.getStorageSync("departmentList")
			}
		},
		onLoad(option) {
			request({
				url: "/api/daily/daily/daily_get",
				data: {
					id: option.id
				},
			}).then(res => {
				this.data = res
				uni.setNavigationBarTitle({
					title: "行业动态"
				})
			})
		},
		created() {

		},
		methods: {
			onBack() {
				uni.switchTab({
					url: "/pages/dynamic/index",
				})
			},
			open() {
				this.$refs.calendar.open();
			},
			confirm(e) {
				console.log(e);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		font-size: 12px;
		padding: 10px 20px;

		&-name {
			font-size: 18px;
			font-weight: 800;
			text-align: center;
		}

		&-top {
			padding: 15px 0px;
		}

		&-content {
			line-height: 30px;
			padding: 10px 0 0 0 !important;
		}
	}
	
	.roundBack {
		width: 30px;
		height: 30px;
		position: fixed;
		left: 20px;
		bottom: 20px;
		line-height: 25px;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		background-color: #4e9eeb;
		background-image: linear-gradient(45deg, #0081ff, #1cbbb4);
		color: #fff;
		cursor: pointer;
	}
</style>
