<template>
	<view class="v-pages-bg bgcolor p-b-24">
		<image class="slide-image" :src="rootPath+info.imagelist[0]" mode="aspectFill"></image>
		<view class="v-card detail container-fluid m-t--80">
			<view class="v-detail-name"><text class="text">{{info.title}}</text></view>
			<view>
				<text class="new_adr">阅读 {{info.browsenum}}</text>
				<text class="new_adr" @click="dianzan(info.guid)" v-if="zan == true">
					<image src="/subPageA/images/icn_like.png" class="pic_zan"></image>{{info.upnum}} 赞
				</text>
				<text class="new_adr" v-if="zan == false">
					<image src="/subPageA/images/zan.png" class="pic_zan"></image>{{info.upnum}} 赞
				</text>
			</view>
		</view>

		<view class="v-card detail container-fluid m-t-24">
			<view class="info-box hoteven_inf">
				<view class="info-list">
					<view class="pic">
						<image src="../../images/icon_adr.png" class="pic_hd_icon"></image>
					</view>
					<view>
						<text class="address">活动类型：</text>
						<text class="txt">{{ info.sub_column1 ? info.sub_column1 :'--'}}</text>
					</view>
				</view>
				<view class="info-list">
					<view class="pic">
						<image src="../../images/icon_time.png" class="pic_hd_icon"></image>
					</view>
					<view>
						<text class="address">活动日期：</text>
						<text class="txt">{{info.jointime}}</text>
					</view>
				</view>
				<view class="info-list">
					<view class="pic">
						<image src="../../images/icon_time.png" class="pic_hd_icon"></image>
					</view>
					<view>
						<text class="address">报名日期：</text>
						<text class="txt">{{ info.sub_column3 ? info.sub_column3 :'--'}}</text>
					</view>
				</view>

				<view bindtap="callPhone" class="info-list lxidh" :data-mobile="info[this.$param.hoteventPhoneKey]">
					<view class="pic">
						<image src="../../images/icon_phe.png" class="pic_hd_icon"></image>
					</view>
					<view v-if="info.sub_column2">
						<text class="address">联系电话：</text>
						<text class="txt" @click="callPhone(info.sub_column2)">{{ info.sub_column2 }}</text>
					</view>
					<!-- <view class="more" :hidden="'暂无'==info[this.$param.hoteventPhoneKey]?true:false"></view> -->
				</view>
				<view class="info-list">
					<view class="pic">
						<image src="../../images/list-icon6_h.png" class="pic_hd_icon"></image>
					</view>
					<view>
						<text class="address">活动单位：</text>
						<text class="txt">{{info.subtitle}}</text>
					</view>
				</view>
			</view>
		</view>

		<view class="v-card detail container-fluid m-t-24">
			<view class="v-detail-title">
				<view class="text"><text>活动详情</text></view>
			</view>
			<view class="v-detail-content">
				<u-parse :content="info.content" :loading="loading" @preview="preview" @navigate="navigate" />
			</view>
		</view>
	</view>
</template>

<script>
	import uParse from '@/components/gaoyia-parse/parse.vue'

	export default {
		components: {
			uParse
		},
		data() {
			return {
				priceSymbol: "",
				indicatorDots: false,
				autoplay: true,
				interval: 3000,
				duration: 500,
				info: {},
				zan: true,
				rootPath: this.$config.ROOTPATH,
				netType: true

			}
		},
		onLoad: function(options) {
			var that = this;
			this.$util.getNetworkType(
				function(res) {
					if (res.networkType === 'none') {
						uni.showToast({
							title: that.$param.netMsg,
							icon: "none",
							duration: 2000
						})
						that.netType = false;
					}
				},
				function() {
					uni.showToast({
						title: that.$param.netMsg,
						icon: "none",
						duration: 2000
					})
					that.netType = false;
				}
			)
			if (!that.netType) {
				return;
			}
			this.$util.hideLoadingByTime();
			this.detailInfo(options.id);
			this.jilu(options.id);
			that.$util.saveOperatorLog(that, "HOTEVENT", options.id);
		},
		methods: {
			detailInfo: function(id) {
				var that = this;
				var data = {
					"userkey": this.$param.userkey,
					"type": this.$param.hotevent,
					"guid": id
				}
				this.$Request.post(this.$config.getMessgeInfoDetailFormId, data).then(res => {
					console.log(res);
					if (!that.$util.isSuccess(res)) {
						return;
					}
					this.info = res.data;
					this.info.logo = this.$config.ROOTPATH + this.info.logo;
				})
			},
			daohang: function() {
				// #ifdef H5

				if (this.$wechat.isWechat()) {
					var mapParam = {
						latitude: this.info.lat,
						longitude: this.info.lng,
						scale: 18,
						name: this.info.ename,
						address: this.info.eaddress
					};
					this.$util.openLocation(mapParam);
					return;
				}
				window.location.href = "https://uri.amap.com/navigation?from=" + this.$param.clng + "," + this.$param
					.clat + ",我的位置&to=" + this.info.lng + "," + this.info.lat + "," + this.info.eaddress +
					"&mode=walk&src=sjz_uniapp&callnative=1"
				// #endif
			},
			callPhone: function(tel) {
				if (tel == "暂无") {
					return;
				}
				uni.makePhoneCall({
					phoneNumber: tel
				})
			},
			jilu: function(id) {
				var that = this;
				var data = {
					guid: id,
					browsenum: "1"
				};
				this.$Request.post(this.$config.updateMessageInfoUBFeildFormId, data).then(res => {
					if (that.$util.isSuccess(res)) {
						console.log("已阅读");
					}
				});
			},
			dianzan: function(guid) {
				var that = this;
				var data = {
					guid: guid,
					upnum: "1"
				};
				this.$Request.post(this.$config.updateMessageInfoUBFeildFormId, data).then(res => {
					if (that.$util.isSuccess(res)) {
						this.zan = false;
						this.info.upnum += 1;
					}
				});
			}
		}
	}
</script>

<style>
	@import url("/static/css/common.css");
	@import url("hoteventdetail.css");
</style>