<template>
	<view class="content">
	  <homenav :iStatusBarHeight="iStatusBarHeight" :title="'商品详情'"></homenav>
	  <view class="uni-margin-wrap">
			<swiper class="swiper" circular :indicator-dots="true" :autoplay="false" :interval="3000"
				:duration="duration" indicator-active-color="rgba(0, 0, 0, .3)" indicator-color="#EAEAEA">
				<swiper-item v-for="(item,index) in info.imgList">
					<view class="swiper-item">
						<image @click="showImgList(item.imgPath)" :src="item.imgPath" mode="aspectFit" class="swiper-itemImg"></image>
					</view>
				</swiper-item>
				
			</swiper>
	  	</view>
		<view class="msBox">
			<view class="name" v-if="loading">{{info.name}} </view>
			<view class="goodsMs"><span class="dian"></span>型号：{{info.specificationModel}}<span class="factoryNumber" v-if="info.factoryNumber">{{info.factoryNumber}}</span></view>
			<view class="goodsMs"><span class="dian"></span>
			  <view class="carmodelremark ">适用车型：{{info.carmodelremark}}</view> 
			</view>
		</view>
		
		<view style="height: 30rpx;background: #F4F5F7;" v-if="html"></view>
		<view class="detail" v-if="html">
			<view class="datailTitle" v-if="html">商品详情</view>
			
		   <!-- <video style="width:750rpx;" class="edui-faked-video twtcs" src="https://66km.oss-cn-beijing.aliyuncs.com/yanghuziliao/shachepan/%E6%AC%A7%E6%B4%B2%E7%BB%B4%E4%BF%AE%E5%88%B9%E8%BD%A6%E7%9B%98%E7%89%87%E6%A0%87%E5%87%86%E6%9B%B4%E6%8D%A2SOP%E6%B5%81%E7%A8%8B.mp4" width="420" height="280" enable-danmu danmu-btn controls></video> -->
			<!-- <player-component vid="f3310d4pktb"></player-component> -->
			<!-- <rich-text :nodes="html"></rich-text> -->
		    <u-parse :content="html"  ></u-parse> 
			<!-- <view v-html="html"></view> -->
		</view>
	  
	</view>
</template>

<script>
	import homenav from "../../components/homenav/nav.vue"
	import uParse from '@/components/u-parse/u-parse.vue'
	export default {
		components: {
			homenav,uParse
		},
		data() {
			return {
				id:'',
				info:'',
				iStatusBarHeight:'',
				html:'',
				loading:false,
				
			}
		},
		onLoad(opt) {
			this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
            this.id=opt.id;
			this.queryPartDetail()
		},
		methods: {
           queryPartDetail(){
			   uni.showLoading({ title: '加载中'});
			   this.loading=false;
			   this.$http('partsByOpen/queryPartDetail', {
			     id:this.id,
			    },'POST').then(res => {
					this.loading=true;
					uni.hideLoading();
					 this.info=res.data;
					this.html = this.info.ozContent
					this.html = this.html.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
					this.html = this.html.replace(/\<iframe/gi, '<video style="width:750rpx;" ');
					this.html = this.html.replace(/\<\/iframe/gi, '</video');
					console.log(this.html) 
			   })
		   },
		   showImgList(img){
		   	var arr=[]
		   	arr.push(img)
		   	uni.previewImage({
		   		urls: arr,
		   		longPressActions: {
		   			itemList: ['发送给朋友', '保存图片'],
		   			success: function(data) {
		   				console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
		   			},
		   			fail: function(err) {
		   				console.log(err.errMsg);
		   			}
		   		}
		   	});
		   }
		},
		
	}
</script>

<style scoped>
.swiper-itemImg{
	width: 750rpx;
	height: 750rpx;
}
.uni-margin-wrap{
	height: 750rpx;
}
.swiper{
	height: 750rpx;
}
.datailTitle{
	font-weight: 500;
	color: #1A1A1A;
	line-height: 40rpx;
	padding: 32rpx 24rpx;
	font-size: 28rpx;
}
.name{
	font-weight: 500;
	color: #222;
	line-height: 40rpx;
	font-size: 32rpx;
	padding: 30rpx 24rpx;
	padding-bottom: 10rpx;
}

.detail img{
  width: 750rpx;
		
}
.detail image{
 width: 750rpx;
}
/deep/ video{
	 width: 750rpx;
}
.goodsMs{
		font-size: 26rpx;
		color: #3C3C3C;
		line-height: 33rpx;
		padding: 8rpx 24rpx;
		display: flex;
		
	}

	.msBox{
		background: #F8F8F8;
		    padding-bottom: 10rpx;
	
	}
	.dian{
		display: inline-block;
		width: 10rpx;
		height: 10rpx;
		background: #A3A3A3;
		border-radius: 6rpx;
		margin-top: 14rpx;
		margin-right: 6rpx;
	}
	.factoryNumber{
		 padding: 0 10rpx;
		 border-radius: 8rpx;
		/*  border:1px solid #E60006; */
		 margin-left: 10rpx;
		 display: inline-block;
		 background: #E60006; 
		 font-size: 26rpx;
		 color: #FFF;
	}
	.carmodelremark{
		width: 680rpx;line-height: 44rpx;
	}
</style>
