<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="name" v-if="loading"> {{info.specificationModel}} </view><!-- {{info.name}} | -->
		<view style="height: 30rpx;background: #F4F5F7;"></view>
		<view class="detail">
			<view class="datailTitle">商品详情</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> -->
	
			<!-- <view v-html="html"></view> -->
			<view class="contLine">
				出厂编码: {{ info.factoryNumber }}
			</view>
			<view class="contLine">
				包装规格: {{ info.packagingSpecification }}
			</view>
			
			<view class="contLine">
				单位: {{ info.measurementUnit }}
			</view>
			<view class="contLine">
				车型备注: {{ info.modelRemark }}
			</view>
			 <u-parse :content="html"  ></u-parse> 
		</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: #1A1A1A;
	line-height: 40rpx;
	font-size: 28rpx;
	padding: 30rpx 24rpx;
}

.detail img{
  width: 750rpx;
		
}
.detail image{
 width: 750rpx;
}
/deep/ video{
	 width: 750rpx;
}
.contLine{
	font-size: 26rpx;
	color: #666;
	padding: 10rpx 24rpx;
}
</style>
