<template>
	<view class="message" @click="handleServiceChat" v-if="HomeContent.qyserviceurl">
		<image src="@/static/msg.png"></image>
	</view>
</template>

<script>
	import {
		mapState
	} from "vuex";
	export default {
		data() {
			return {
				data: {}
			}
		},
		computed: {
			...mapState(["HomeContent"]),
		},
		mounted() {},
		methods: {
			handleServiceChat() {
				let that = this
				if (!that.HomeContent.qyappid) {
					that.$tools.msg("小程序还未配置微信客服")
					return
				}
				wx.openCustomerServiceChat({
					extInfo: { //客服链接
						url: that.HomeContent.qyserviceurl
					},
					corpId: that.HomeContent.qyappid, //企业ID
					success(res) {}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.message {
		position: fixed;
		bottom: 130px;
		z-index: 9999;
		right: 10px;
		width: 45px;
		height: 40px;
		padding: 2px;
		border-radius: 50%;
		color: #fff;
		font-size: 12px;

		.info-msg {
			display: flex;
			justify-content: center;
			align-content: center;
			flex-wrap: wrap;
		}

		icon {
			font-size: 18px;
		}

		image {
			width: 100%;
			height: 100%;
		}

		text {
			width: 100%;
			display: inline-block;
			text-align: center;
		}
	}
</style>