<template>
	<view class="flex-col forward">
		<u-navbar  title="转发" ></u-navbar>
		<view class="flex-col group1">
			<view>
				<u-input v-model="value" :type="type" :border="border" :height="height" :auto-height="autoHeight" placeholder="转发分享内容"/>
			</view>
			<view class="flex-col list-item">
			  <view class="flex-row group_8 view">
			    <image :src="$u.http.config.imgUrl+forwardData.userHead" class="image_3" />
			    <text class="text_8 text_43">{{forwardData.userName}}</text>
			    <text class="text_9">{{forwardData.creationTime}}</text>
			    <text class="text_11">{{forwardData.schoolName}}</text>
			  </view>
			  <view class="flex-col group_9">
			    <text class="text_14">{{forwardData.title}}</text>
			    <text class="text_15">
						{{forwardData.content}}
			    </text>
			    <view class="imgList flex-col" v-if="true">
			      <view class="flex-row group_10">
			       <!-- <image :src="$u.http.config.imgUrl + forwardData.imageUrl"
			          class="image_10" /> -->
					  <image v-for="(v, i) in forwardData.imageUrl.split(',')" @click="clickImg(v)" :key="i" :src="v?$u.http.config.imgUrl + v:''"
					    class="image_10" />
			      </view>
			    </view>
			  </view>
			</view>
		</view>
		<view class="flex-col items-center button" @click="onSend">
			<text>发送</text>
		</view>
		<view>
			<u-toast ref="uToast" />
			<u-top-tips :z-index='999999' ref="uTips" :navbar-height="0"></u-top-tips>
		</view>
		
	</view>
</template>

<script>
	export default {
		data(){
			return {
				value:'',
				type:'textarea',
				border: true,
				height: 150,
				autoHeight: true,
				forwardData:{},
			}
		},
		onLoad(e){
			this.forwardData = JSON.parse(e.data)
		},
		methods:{
			onSend(){
				if(this.value == ""){
					// return this.$tips("请输入标题", "error");
					return this.$refs.uToast.show({
					title: '请输入标题',
					type: 'warning',
				})
				}
				const data = {
					title:this.value,
					content:this.forwardData.content,
					sysSignStr:this.forwardData.sysSignStr,
					userId:this.vuex_user.id,
					path:this.forwardData.imageUrl,
					forwardId:this.forwardData.id
				}
				if(this.forwardData.schoolId){
					data.schoolId = this.forwardData.schoolId
				}
				 this.$u.apiList.ForwardHelpArticle(data).then((res)=>{
					 /* uni.showToast({
					 	title: "转发成功",
					 	duration: 2000,
					 }); */
					 this.$refs.uToast.show({
						title: '转发成功',
						type: 'success',
					})
           uni.$emit('echoList',{
              type:'forward',
              data:{}
            })
					 setTimeout(()=>{
						uni.switchTab({
							url: '../../AlumniCircle/alumnus/alumnus'
						});
					 },1000)
				 })
			},
			//图片预览
			clickImg(item){
				item = this.$u.http.config.imgUrl + item
				var images = [];
				images.push(item);
				uni.previewImage({  // 图片路径必须是一个数组 => ['']
					current: 0,
					 urls: images,
				});
			},
			//返回上一级
			router(){
				if(this.forwardData.route==2){
					this.$u.route({
						url:'pages/AlumniCircle/userDetail/userDetail?id='+this.forwardData.userId
					})
				}else{
					uni.switchTab({
						url: '../../AlumniCircle/alumnus/alumnus'
					});
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.forward{
		background-color: #ffffff;
		height: 100vh;
		.group1{
			padding: 0.2rem 0.15rem;
		}
		.list-item {
		  padding: 0.18rem 0 0.21rem 0.16rem;
		  background-color: #F2F2F2;
		  margin-bottom: 0.1rem;
		  .view {
		    margin-right: 0.051rem;
		  }
		  .group_9 {
		    margin-right: 0.13rem;
		    margin-top: 0.17rem;
		    .text_14 {
		      align-self: flex-start;
		      color: rgb(2, 2, 2);
		      font-size: 32rpx;
		      font-family: Adobe Heiti Std;
		      line-height: 0.17rem;
		    }
		    .text_15 {
		      margin-top: 0.11rem;
		      color: rgb(73, 76, 87);
		      font-size: 28rpx;
		      font-family: Adobe Heiti Std;
		      line-height: 0.24rem;
		      text-indent: 0.2rem;
		    }
		    .text_16 {
		      margin-left: 0.04rem;
		      margin-top: 0.12rem;
		      align-self: flex-start;
		      color: rgb(44, 109, 255);
		      font-size: 0.14rem;
		      font-family: PingFang;
		      line-height: 0.13rem;
		    }
		  }
		  .group_21 {
		    margin-top: 0.1rem;
		    justify-content: space-between;
		    width: 90%;
		    margin: 0.1rem auto 0;
		    .group_20 {
		      margin: 0.025rem 0;
		      .image_6 {
		        flex-shrink: 0;
		        width: 0.22rem;
		        height: 0.21rem;
		      }
		      .text_17 {
		        margin-left: 0.08rem;
		        margin-top: 0.065rem;
		        color: rgb(180, 182, 189);
		        font-size: 0.14rem;
		        font-family: PingFang;
		        line-height: 0.11rem;
		      }
		    }
		    .equal-division-item_1 {
		      padding: 0.03rem 0;
		      .image_8 {
		        width: 0.2rem;
		        height: 0.2rem;
		      }
		      .text_19 {
		        margin-left: 0.095rem;
		        margin-top: 0.06rem;
		        color: rgb(180, 182, 189);
		        font-size: 0.14rem;
		        font-family: PingFang;
		        line-height: 0.11rem;
		      }
		    }
		  }
		}
		.group_8 {
		  height: 0.32rem;
		  position: relative;
		  .image_3 {
		    width: 0.3rem;
		    height: 0.3rem;
		    position: absolute;
		    left: 0;
		    top: 50%;
		    transform: translateY(-50%);
		    border-radius: 50%;
		  }
		  .text_8 {
		    color: rgb(2, 2, 2);
		    font-size: 0.14rem;
		    font-family: PingFang;
		    line-height: 0.13rem;
		  }
		  .text_43 {
		    position: absolute;
		    left: 0.37rem;
		    top: 0.02rem;
		  }
		  .text_9 {
		    color: rgb(184, 184, 184);
		    font-size: 0.12rem;
		    font-family: PingFang;
		    line-height: 0.12rem;
		    position: absolute;
		    right: 15rpx;
		    top: 0.035rem;
		  }
		  .text_11 {
		    color: rgb(184, 184, 184);
		    font-size: 0.12rem;
		    font-family: PingFang;
		    line-height: 0.12rem;
		    position: absolute;
		    left: 0.37rem;
		    bottom: 0;
		  }
		  .text_20 {
		    position: absolute;
		    left: 0.36rem;
		    top: 0.02rem;
		  }
		}
		.button {
			margin-top: 0.18rem;
			padding: 0.13rem 0 0.12rem;
			align-self: center;
			color: rgb(255, 255, 255);
			font-size: 0.15rem;
			line-height: 0.16rem;
			letter-spacing: 0.03rem;
			white-space: nowrap;
			background-color: #3cb4fb;
			border-radius: 100rpx;
			width: 3.1rem;
			cursor: pointer;
		}
		.imgList {
		  image {
			// flex: 31%;
			width: 0.94rem;
		    height: 0.91rem;
		    margin: 0.01rem;
		  }
		  .group_10 {
			flex-wrap: wrap;			
		  }
		}
	}
</style>