consultationDetails.vue 2.8 KB
<template>
	<view class="">
		<view class="mainBox">
			<view class="title">{{detail.title}}</view>
			<view class="timenev flexD">
				<view class="time">
					发布时间{{detail.publishtime}}
				</view>
				<image src="../../static/ic_fenxiang.png" mode="" @click="shareModel=true"></image>
			</view>
			<mp-html :content="detail.content" />
			<!-- <rich-text :nodes="detail.content"></rich-text> -->
		</view>
		<view class="share" v-if="shareModel" @click="shareModel=false">
			<image src="/static/detailShare.png" mode=""></image>
			<view class="">
				点击这里进行分享
			</view>
		</view>
	</view>
</template>

<script>
	import {
		arc_detail
	} from '@/api/index.js'

	export default {
		data() {
			return {
				id: "",
				detail: {
					title: "",
					publishtime: "",
					content: "",
				},
				shareModel: false,
				Images: "http://yuanjie.n.broing.cn/assets/img/share_logo.jpg",
				jssdk: {},
			}
		},

		onLoad(options) {
			this.id = options.id
			let title = uni.getStorageSync("deltitle")
			if(uni.getStorageSync("deltitle")){
				uni.setNavigationBarTitle({
					title: title //这是修改后的导航栏文字
				})
			}else{
				uni.setNavigationBarTitle({
					title: "资讯" //这是修改后的导航栏文字
				})
			}
			let URL=window.location.href
			this.$wxH5Share.get_jssdk(title,URL)
			this.arc_detail()
			// console.log(!(uni.getSystemInfoSync().platform == 'android'))
			// if (!(uni.getSystemInfoSync().platform == 'android')) {
			// 	if (location.href.indexOf("#reloaded") == -1) {
			// 		location.href = location.href + "#reloaded";
			// 		location.reload();
			// 	}
			// }
		},
		onUnload() {
			uni.removeStorageSync("deltitle")
		},
		methods: {
			//详情
			async arc_detail() {
				try {
					const res = await arc_detail(this.id, window.location.href)
					this.detail = res.detail
					this.jssdk = res.jssdk
					// this.share()
					console.log('arc_detail', res)
					// 保存数据
				} catch (err) {
					uni.showToast({
						title: err,
						icon: 'none'
					})
					console.log('arc_detail', err)
				}
			},
		}
	}
</script>

<style lang="less">
	.mainBox {
		padding: 24rpx 31rpx;

		.timenev {
			margin-top: 20rpx;
			color: rgba(179, 179, 179, 1);
			font-size: 24rpx;
			font-weight: 400;
			font-family: "PingFang SC";

			image {
				width: 40rpx;
				height: 40rpx;
			}
		}
	}

	.share {
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		background: rgba(0, 0, 0, .6);

		image {
			position: fixed;
			right: 80rpx;
			top: 4rpx;
			width: 188rpx;
			height: 262rpx;
		}

		view {
			position: fixed;
			right: 80rpx;
			top: 300rpx;
			color: rgba(255, 255, 255, 1);
			font-size: 36rpx;
			font-weight: 700;
		}
	}
</style>