<template>
	<div class="hui-detail">
		<div class="hui-detail-title">基础信息</div>
		<div class="hui-detail-content">
			<div class="hui-detail-item">
				<div class="hui-detail-label">项目名称</div>
				<div class="hui-detail-value">{{detail.name}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">项目区域</div>
				<div class="hui-detail-value">{{detail.address.join('-')}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">具体地点</div>
				<div class="hui-detail-value">{{detail.specific}}</div>
			</div>
			<div class="hui-detail-item">
				<div class="hui-detail-label">项目描述</div>
				<div class="hui-detail-value">{{detail.comment}}</div>
			</div>
		</div>
		<div class="hui-detail-title">项目标签</div>
		<div class="hui-detail-content hui-detail-image">
			<tag ref="tag" type="look" :tagType="1" :tagActive="detail.tagIds ? detail.tagIds.split(',') : []">
			</tag>
		</div>
		<div class="hui-detail-title">项目图片</div>
		<div class="hui-detail-content hui-detail-image">
			<upload ref="upload" :list="detail.picture ? JSON.parse(detail.picture) : []" type="preview">
			</upload>
		</div>
	</div>
</template>

<script>
	import {
		getProjectDetailById
	} from '@/httpApi/space'
	import upload from '@/components/common/upload'
	import tag from '@/components/common/tag'
	export default {
		props: ['detailId'],
		data() {
			return {
				detail: {
					name: '', //项目名称
					address: [],
					comment: '',
					data: '',
					organizationId: '',
					picture: '',
					tagIds: ''
				}
			}
		},
		created() {
			if (this.detailId) this.init();
		},
		components: {
			upload,
			tag
		},
		methods: {
			init() {
				getProjectDetailById(this.detailId).then(res => {
					if (res.state) {
						let obj = res.data;
						let data = {};
						if (obj.data) data = JSON.parse(obj.data);
						obj.address = JSON.parse(obj.address);
						this.detail = Object.assign(obj, data);
					}
				})
			}
		},
	}
</script>
<style lang="scss">

</style>