<template>
	<view>
		<view class="nav_area"></view>
		<view class="setPage">
			<view class="">
				<view style="" class="">
					<view class="input_box">
						<text>标题：</text>
						<input type="text" v-model="editInfo.title" placeholder="请输入内容" placeholder-style="color: #999;">
					</view>
					<!-- <view class="input_box">
						<text>排序：</text>
						<input type="text" v-model="editInfo.sort" placeholder="请输入轮播排序，数字越小，位置越前" placeholder-style="color: #999;">
					</view> -->
					<view class="input2_box">
						<text class="label">描述内容：</text>
						<textarea name="" id="" cols="30" rows="10" placeholder="请输入描述内容"
						 placeholder-style="color: #999;" v-model="editInfo.content"></textarea>
					</view>
				</view>
				<view class="submit" @click="confirm()">
					确定发布
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import API from '@/common/js/api.js'
	export default {
		data() {
			return {
				id: '',
				editInfo: {title:'',sort:'', content: ''},
				
			}
		},
		methods: {
			confirm(){
				let data = {
					id: this.id||'',
					title: this.editInfo.title,
					sort: this.editInfo.sort,
					content: this.editInfo.content
				};
				API.request('/notice/save', data, res=>{
					uni.showToast({
						title: res.msg
					})
					setTimeout(()=>{
						uni.navigateBack({
							delta: 1
						})
					}, 1500)
					
				})
			},
		},
		onLoad(e) {
			if(e){
				this.id = e.id;
				this.editInfo.title = e.title;
				this.editInfo.content = e.content;
				this.editInfo.sort = e.sort;
			}
			
		},
	}
</script>

<style lang="scss" scoped>
	.nav_area {
		position: fixed;
		top: 0px;
		left: 0px;
		z-index: 99;
		background-color: #fff;
		box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
		width: 700rpx;
		padding: 0px 25rpx;
		/*  #ifdef H5  */
		height: 88rpx;padding-top: var(--status-bar-height);
		/*  #endif  */
		/*  #ifdef APP-PLUS  */
		height: 2px;
		/*  #endif  */
		box-sizing: content-box;
		color: #b0b0b0;
		font-size: 14px;
	}
	.setPage{
		padding: 40rpx;
		font-size: 14px;
		color: #999;
	}
	.input_box{
		display: flex;
		justify-content: space-between;
		align-items: center;
		
		input{
			width: 572rpx;
			height: 80rpx;
			border: 1px solid #eee;
			border-radius: 5px;
			padding: 0px 10px;
			box-sizing: border-box;
			color: #444;
		}
	}
	.input2_box{
		.label{
			line-height: 40px;
		}
		textarea{
			width: 670rpx;
			height: 560rpx;
			border: 1px solid #eee;
			border-radius: 5px;
			padding: 10px 10px;
			box-sizing: border-box;
			color: #444;
		}
	}
	.submit{
		width: 670rpx;
		height: 88rpx;
		border-radius: 10px;
		font-size: 14px;
		text-align: center;
		line-height: 88rpx;
		color: #fff;
		background-color: #e33837;
		position: fixed;
		bottom: 40rpx;
	}

</style>
