<template>
	<view class="at-my-com">
		<view class="at-my-index" v-for="at in items">
			<view class="at-who">
				<view class="who-img">
					<author-img :avatar="at.authorInfo.avatar" :sex="at.authorInfo.sex"></author-img>
				</view>
				<view class="who-name">
					<view class="name-info">
						{{at.sysCreateBy}}	<view class="who-time">{{at.sysCreateTime.split(' ')[0]}}</view>
					</view>
					<view class="info-text">
						<text class="name-text-at">@我</text>
						{{filterObjType(at.objType)}}不错，你也来看看吧
					</view>
				</view>
			
			</view>
			<view class="at-title-box" @click="toArticleDetail(at)">
				<view class="at-name">《{{at.title}}》</view> 
			</view>
		</view>
		
	</view>
</template>

<script>
	import apiQa from '@/api/modules/qa.js'
	import apiComments from '../../api/modules/comments.js';
	export default {
		props:{
			items:{
				type:Array,
			}
		},
		data() {
			return {
				// data:[],//拿到的数据
				// total:0,//总条数
				// loadStatus:'more',//more,loading,noMore
				// query:{
				// 	pageIndex:1,//当前页
				// 	type:null,//当前只限于文章
				// 	pageSize:10,//条数
				// },//查询条件
			}
		},
		// onLoad() {
		// 	this.findData(true);
		// },
		// onPullDownRefresh() {
		// 	this.onReachBottom();
		// },
		// onReachBottom() {
		// 	console.log('111111')
		// 	this.loadStatus='loading';//more,loading,noMore
		// 	if(this.data.length<this.total){
		// 		this.query.pageIndex++;
		// 		this.findData(false);
		// 		this.loadStatus='more'
		// 	}else{
		// 		this.loadStatus='noMore'
		// 	}
		// },
		mounted() {
			// this.findData(true);
		},
		methods: {
			filterObjType(objType){
			    switch(objType){
			      case 1:{
			        return '课程'
			      }
			      case 2:{
			        return '文章'
			      }
			      case 3:{
			        return '案例'
			      }
			      case 4:{
			        return '问答'
			      }
			    }
			  },
			toArticleDetail(item) {
				if(item.objType == 2){
					uni.navigateTo({
						url: '/pages/resource/articeDetail?id=' + item.objId
					});
				}else if(item.objType == 1){
					uni.navigateTo({
						url: '/pages/resource/courseDetail?id=' + item.objId
					});
				}else if(item.objType == 4){
					uni.navigateTo({
						url: '/pages/resource/qaDetail?id=' + item.objId
					});
				}
				
			},
			
		}
	}
</script>

<style scoped lang="scss">
.at-my-com{
	padding: 0 32upx;
	.at-my-index{
		padding: 60upx 0 50upx 0;
		border-bottom: 2upx solid rgba(153,153,153,0.1);
		.at-who{
			display: flex;
			.who-img{
				margin-right: 20upx;
			}
			.who-name{
				width: 100%;
				font-size: 28upx;
				.name-info{
					font-weight: 600;
					color: #333333;
				}
				.who-time{
					float: right;
					font-weight: 400;
					font-size: 24upx;
					color: #999999;
				}
				.info-text{
					margin-top: 8upx;
					color: #333333;
					.name-text-at{
						margin-right: 20upx;
						color: #387DF7;
					}
				}
			}
		
		}
		.at-title-box{
			margin-top: 22upx;
			padding: 40upx 60upx;
			background: #F6F6F6;
			font-size: 32upx;
			font-weight: 600;
			color: #333333;
		}
		.at-name{
			
			word-break:break-all;
			overflow: hidden;
			text-overflow: ellipsis;
			-webkit-box-orient: vertical; 
			display: -webkit-box;-webkit-line-clamp: 1;
		}
		
	}
}
</style>
