<style>
	.mynews {
		width: 100%;
		height: 100vh;
		background: #FFF;

	}

	.mynews .ftBox {
		width: 100%;
		padding: 0 15px;
		margin-top: 20px;
		display: flex;
		flex-direction: row;
		align-items: flex-start;
		justify-content: space-between;

	}

	.mynews .ftBox-left {
		margin-right: 15px;
	}

	.mynews .ftBox-center {
		width: 1;
		flex: 1;
		margin-right: 5px;
	}

	.mynews .ftBox-right {
		width: 80px;
		height: 80px;
		border-radius: 5px;
		overflow: hidden;
	}

	.mynews .ftBox-right-text {
		width: 100%;
		height: 100%;
		border-radius: 5px;
		font-size: 14px;
		color: #333333;
		background: #F5F5F5;


	}

	.mynews .text {
		font-size: 14px;
		color: #A68237;
	}
</style>
<template>
	<div class='mynews'>

		<u-empty v-if="g.length == 0" text="暂无动态" mode="list"></u-empty>
		<view v-if="g.length > 0" style="
			  height: 100vh ;width: calc(100vw)
		      overflow: hidden;
		      
		    ">
			<scroll-view :scroll-y="true" :enable-back-to-top="true" :enable-flex="true" @scrolltolower="lower" :style="{ height: '100%' }">
				<view class="ftBox" v-for="(x, i) in g" :key="i" @click="godetails(x)">
					<view class="ftBox-left">
						<u-avatar :src="x.crearteEmPhoto" size='80' mode="square"></u-avatar>
					</view>
					<view class="ftBox-center">
						<view class="text">
							{{x.createEmName}}
						</view>
						<view v-if="x.realtionType==1">
							<view>{{x.replyName!=''?'回复了':'评论了'}} <text class="text" style="margin-left: 3px;">{{x.replyName}}</text></view>
							<view style="">
								{{x.commentContent}}
							</view>
						</view>
						<view v-if="x.realtionType==2">
							<u-icon name="like-o" :size="30" color="#000000"></u-icon>
						</view>
						<view style="font-size: 11px;color: #B0B0B0;">{{x.createTime}}</view>
					</view>
					<view class="ftBox-right">
						<view class="ftBox-right-text" style="padding: 6px;overflow: hidden;width: 68px;height: 68px;text-overflow: ellipsis;display: -webkit-box;
							-webkit-line-clamp: 3;
							-webkit-box-orient: vertical;
						" v-if="x.fileType==0">	
							{{x.content}}
						</view>
						<view class="ftBox-right-text" v-if="x.fileType==1">
							<image :src="x.coverPhoto" mode='aspectFill' style="width: 100%;height: 100%;border-radius: 5px;"></image>
						</view>
						<view class="ftBox-right-text" v-if="x.fileType==2" style="position: relative;">

							<video id="myVideo" :src="x.coverPhoto" style="width: 100%;height: 100%;border-radius: 5px;" :controls='false'
							 :show-center-play-btn='false'></video>
							<view style="width: 100%;height: 100%;position: absolute;left: 0;top: 0;display: flex;align-items: center;justify-content: center;">
								<u-icon name="play-circle-o" :size="50" color="#FFF"></u-icon>
							</view>
						</view>
						<view class="ftBox-right-text" v-if="x.fileType==3" style="display: flex;align-items: center;justify-content: center;background: #BBA16B;">

							<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mic.png" mode='aspectFill' style="width: 27px;height: 40px;border-radius: 5px;"></image>

						</view>
					</view>

				</view>

				<u-loadmore :status="status" :load-text="loadText" :font-size="24" :margin-top="20" :margin-bottom="20" bg-color="#FFF" />
			</scroll-view>

		</view>


		</view>
	</div>
</template>

<script>
	const innerAudioContext = uni.createInnerAudioContext();
	export default {

		data() {
			return {
				pageTitle: "我的互动消息",
				showAuth: false,
				msg: {
					pageIndex: 1,
					pageSize: 10,
				},
				mainColor: "",
				secondary: '',
				pricecolor: '',
				page_count: 1,
				g: [],
				loading: false,
				status: "loadmore",
				count: 0,
				loadText: {
					loadmore: "轻轻上拉，加载更多",
					loading: "努力加载中",
					nomore: "没有更多了",
				},
				windowWidth: 0,

			}
		},
		created() {

			this.contentHeight = this.$utils.calcContentHeight(-40) + "px";
			this.mainColor = this.$uiConfig.mainColor;
			this.secondary = this.$uiConfig.secondary;
			this.pricecolor = this.$uiConfig.pricecolor;
			this.windowWidth = this.$utils.SystemInfo().windowWidth;
		},
		mounted() {
			let currentPages = getCurrentPages();
			let u = "/" + currentPages[currentPages.length - 1].route;
			let pages = wx.getStorageSync("basedata") ?
				wx.getStorageSync("basedata").bar_title : [];
			pages.forEach((x) => {
				if (x.value == u) {
					this.pageTitle = x.new_name ? x.new_name : x.name;
				}
			});
			uni.setNavigationBarTitle({
				title: this.pageTitle,
			});
			this.init()

		},
		onLoad() {

		},
		methods: {
			init() {
				this.loading = true;
				this.request2({
						url: '/api/AppletEducation/GetAboutMeDynamicList',
						data: this.msg
					},
					res => {
						if (res.resultCode == 1) {
							this.loading = false;
							this.count = res.data.count;
							this.g = this.g.concat(res.data.pageData);
							this.page_count = res.data.pageCount;
							if (this.page_count == 1) {
								this.status = "nomore";
							}
						}
					}
				);
			},


			lower(e) {
				console.log(2)
				if (this.msg.pageIndex < this.page_count) {
					this.msg.pageIndex++;
					this.status = "loading";
					this.init();
				} else {
					this.status = "nomore";
				}
			},
			godetails(x) {
				uni.navigateTo({
					url: '/pages/friendcircle/mydetails?ID=' + x.id + '&index=-1'
				})
			},
			getsplice(id) {
				let data = []
				this.g.forEach((x, i) => {
					if (id != x.id) {
						data.push(x)
					}
				})
				this.g = data
			}

		}
	}
</script>
