<template>
	<view>
	    <!-- 建议列表 -->
	    <view class="suggestContainer">
	        <view class="suggest" @click="toSuggestDetail(item)" v-for="(item, index) in suggestion" :key="index">
	            <view class="suggestion">
	                <view class="suggestHead">
	                    <view>标题</view>
	                    <view class="suggestTitle">{{item.adviseTitle}}</view>
	                </view>
	                <view class="suggestBody">
	                    <view>摘要</view>
	                    <view class="suggestContent">{{item.adviseDetail}}</view>
	                </view>
	            </view>
	            <view>
	                <view class="dispose">{{item.status}}</view>
	            </view>
			</view>
	    </view>
	    <!-- 开始写建议按钮 -->
	    <view class="b-button-wrapper">
	        <view class="b-button" @click="toWriteSuggestion()">
	            <text>写建议</text>
	        </view>
	    </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				suggestion: []				
			};
		},
		onShow(){
			this.init();
		},
		methods:{
			async init(){
				const { data: result } =await uni.$http.get('/education/my-suggestion/findPersonAdvise')
				this.suggestion = result.data.data;
			},
			// 点击建议列表，跳转到对应的建议详情页
			toSuggestDetail(item){
				let suggestion = JSON.stringify(item)
				uni.navigateTo({
					url: '/subpkg/my/suggestion/my_suggestion_detail?item=' + encodeURIComponent(suggestion) 
				})
			},
			// 跳转到写建议页面
			toWriteSuggestion(){
			   uni.navigateTo({
			   	url: '/subpkg/my/suggestion/my_suggestion_write'
			   })
			}
		}
	}
</script>

<!-- 设置页面背景 -->
<style lang="scss">
	page{
		height: 100%;
		// background-color: #FFF;
	}
</style>

<style lang="scss" scoped>
	/* 页面背景 */
	// page{
	//     /* height: 100%; */
	//     /* height: auto !important; */
	//     background-color: #E2F0D9;
	// }
	
	/* 建议列表区 */
	.suggestContainer{
	    height: 100%;
	    padding-bottom: 120rpx;
		font-size: 30rpx;
	}
	
	/* 单条建议的背景 */
	.suggest{
	    display: flex;
	    padding: 20rpx;
	    margin: 30rpx;
	    height: 100rpx;
	    border-radius: 30rpx;
	    background-color: #FFF;
		align-items: center;
		justify-content: center;

	}
	
	/* 单条建议左侧标题和内容摘要 */
	.suggestion{
	    width: 75%;
	}
	
	/* 标题和内容摘要布局 */
	.suggestHead,
	.suggestBody{
	    display: flex;
	}
	
	/* 摘要 */
	.suggestBody{
	    margin-top: 10rpx;
	}
	
	/* 标题详情和内容详情左边距 */
	.suggestTitle,
	.suggestContent{
	    margin-left: 20rpx;
	}
	
	/* 标题内容详情 */
	.suggestTitle{
	    width: 65%;
	    white-space: nowrap;
	    overflow: hidden;
	    text-overflow: ellipsis;
	}
	
	/* 内容摘要详情 */
	.suggestContent{
	    width: 65%;
	    overflow: hidden;
	    text-overflow: ellipsis;
	    display: -webkit-box;
	    -webkit-box-orient: vertical;
	    -webkit-line-clamp: 2;
	}
	
	/* 处理状态 */
	.dispose{
	    font-weight: bold;
	    color: red;
	    margin-left: 30rpx;
	}
	
	// 底部按钮
	.b-button-wrapper{
		display: flex;//要加上，否则，剧中无效
		position: absolute;
		bottom: 60rpx;
		height: 140rpx;
		width: 100%;
		align-items: center;
		justify-content: center;
		
	}	
	.b-button {
		width: 300rpx;
		border-radius: 50rpx;
		// margin-bottom: 40rpx;
		background-color: #35b882;
		height: 85rpx;
		font-size: 30rpx;
		color:#fff;
		display: flex;//要加上，否则，剧中无效
		align-items: center;
		justify-content: center;
	}

</style>