<script>
	
import { getDictByKey, getAppVersion, getRealLinkDomainName,getAppPageConfig } from '@/api/common.js';
import { getUserInfo, getPushLogRead } from '@/api/user';
import { getUserLiveInfo } from '@/api/living.js'
import { mapGetters, mapActions } from 'vuex';
import { config } from '@/pages_im/common/config';

let pausing = false;
let innerAudioContext;
let connectStart=0;
// #ifdef APP-PLUS
import permision1 from '@/utils/permission.js';
// notification = uni.requireNativePlugin('Tuoyun-OpenIMSDK-Notification');
// #endif

import { qconfig } from './utils/config';
import { premissionCheck } from '@/js_sdk/wa-permission/permission.js';

let healthTimer = null;
let tSeconds = 0;
const healthSeconds = 180;
let offlineMsg=null;
let offlineHandleNewMsg=null;
let failImConnTime=0;
// #ifdef APP-PLUS
let complaintView = null;      // 悬浮窗视图（主图标）
let complaintCloseView = null; // 关闭按钮视图
let viewLeft = 0;
let viewTop = 0;
let complaintPositionTimer = null; // 位置检查定时器
let lastRoute = ''; // 上次的路由
// #endif
export default {
	globalData: {
		wsUrl: 'ws://doctor.ai.cdwjyyh.com',
		danmuWSUrl:'wss://websocket.cdwjyyh.com',
		aiWSUrl:'ws://doctor.ai.cdwjyyh.com',
		kfurl: 'https://work.weixin.qq.com/kfid/kfc3731c5008ebd8906', //企业微信客服链接
		corpId: 'ww70ac72e824957fc9', //客服企业id
		miniprogamId:"gh_feb7753a310b", //gh_7a6a32e5ef61 御君方互医
		shareCorpId: '', // 分享企业id
		shareSchema:"", // 应用跳转标识，显示在具体应用下的 Schema字段
		shareAgentid:"", // 企业微信管理后台 应用唯一标识。显示在具体应用下的 AgentId字段
		shareAppid_gh:"", // 必须是应用关联的小程序，注意要有@app后缀
	},
	onLaunch: function (options) {
	
		
	},
	onLoad() {
	},
	onShow() {
		this.getDictByKeyFun()
		// var that = this;
		// var args= plus.runtime.arguments;
		// uni.setStorageSync("appIsOnShow",1);
	},
	onHide() {
		
	},
	computed: {
	
	},
	methods: {
	
		async getDictByKeyFun() {
			let data = {
				key: 'app_pay_config'
			}
			const res = await getDictByKey(data)
			if (res.code == 200 && res.data && res.data.length > 0 && res.data[0].dictValue) {
				getApp().globalData.miniprogamId = res.data[0].dictValue
			}
		},
		getAppPageConfig() {
		    getAppPageConfig().then(res=>{
				if(res.code == 200) {
					uni.setStorageSync('appPageConfig',JSON.stringify(res.appPageConfig))
				}
			})
		},
		getUserInfo(healthButler) {
			getUserInfo().then((res) => {
					if (res.code == 200) {
						if (res.user != null) {
							let registrationID=uni.getStorageSync("registrationID");
							let userInfo = res.user;
							uni.setStorageSync('userInfo', JSON.stringify(res.user));
							if(!userInfo.jpushId || registrationID!=userInfo.jpushId){
								uni.setStorageSync("registrationID","");
							}
							if(!!healthButler){
								healthButler.isAddQw = userInfo.isAddQw;
								uni.setStorageSync('healthButler', JSON.stringify(healthButler));
							}
						}
					}else if(res.code == 500){
						uni.showToast({
							title:"当前用户被禁用",
							icon:"none",
							duration:5000
						});
						setTimeout(()=>{
							uni.$emit('loginOut');
						},5500);
					}
				},
				(rej) => {}
			);
		},

	
		geth5Path() {
			getRealLinkDomainName().then((res) => {
				if (res.code == 200) {
					uni.setStorageSync('h5Path', res.data);
				}
			});
		},
	},
	

};
</script>
<style lang="scss">
/*每个页面公共css */
@import '@/uni_modules/uview-plus/index.scss';

/*#ifndef APP-NVUE*/

view {
	box-sizing: border-box;
}

.ellipsis {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ellipsis2 {
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}
uni-modal {
	z-index: 1100;
}

// 猜你喜欢样式
.like-box {
	display: flex;
	align-items: center;
	justify-content: center;
	image {
		height: 40upx;
		width: 40upx;
	}
	.text {
		font-size: 28upx;
		color: #000;
		font-weight: bold;
		margin: 0 10upx;
	}
}

.no-data-box {
	height: 100%;
	width: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	image {
		width: 264upx;
		height: 212upx;
	}
	.empty-title {
		margin-top: 20rpx;
		font-size: 28rpx;
		color: gray;
	}
}

.doctor-box {
	margin-top: 15rpx;
	padding: 20rpx 0rpx 0rpx;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-start;
	.doctor {
		width: 100%;
		margin-bottom: 15rpx;
		background: #f9f8fe;
		padding: 15rpx;
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		justify-content: flex-start;
		&:last-child {
			margin-bottom: 0rpx;
		}
		.item {
			width: 100%;
			display: flex;
			align-items: flex-start;
			justify-content: flex-start;
			.left {
				.head-box {
					width: 92rpx;
					height: 92rpx;
					position: relative;
					.isline {
						width: 92rpx;
						height: 92rpx;
						border-radius: 50%;
						border: 2rpx solid #e69a22;
						display: flex;
						align-items: center;
						justify-content: center;
						position: absolute;
						bottom: 0rpx;
						.img {
							position: absolute;
							bottom: 1rpx;
							width: 75rpx;
							height: 35rpx;
							image {
								width: 75rpx;
								height: 35rpx;
							}
							.name {
								width: 75rpx;
								height: 35rpx;
								bottom: -3rpx;
								text-align: center;
								position: absolute;
								font-size: 16upx;
								font-family: PingFang SC;
								font-weight: bold;
								color: #ffffff;
							}
						}
					}
					.doc-img {
						border-radius: 50%;
						width: 100%;
						height: 100%;
					}
				}
			}

			.right {
				width: calc(100% - 100rpx);
				margin-left: 20rpx;
				display: flex;
				flex-direction: column;
				align-items: flex-start;
				justify-content: flex-start;
				.doc-box {
					display: flex;
					align-items: center;
					justify-content: space-between;
					.doc-name {
						font-size: 32upx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #111111;
					}
					.doc-position {
						margin-left: 16rpx;
						font-size: 26upx;
						font-weight: bold;
						font-family: PingFang SC;
						color: #2a2b2e;
					}
					.doc-dept {
						margin-left: 16rpx;
						font-size: 26upx;
						font-weight: bold;
						font-family: PingFang SC;
						color: #2a2b2e;
					}
				}
				.hospital-box {
					display: flex;
					align-items: center;
					justify-content: flex-start;
					margin-top: 10rpx;
					.tag {
						display: flex;
						align-items: center;
						justify-content: center;
						background-color: #4fc06b;
						border-radius: 10rpx;
						padding: 5rpx 10rpx;
						font-size: 20upx;
						font-weight: bold;
						font-family: PingFang SC;
						color: #ffffff;
					}
					.name {
						margin-left: 6rpx;
						font-size: 26upx;
						font-weight: bold;
						font-family: PingFang SC;
						color: #2a2b2e;
					}
				}
				.doc-spec {
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: flex-start;
					margin-top: 15rpx;
					.spec {
						font-size: 26upx;
						font-family: PingFang SC;
						color: #626468;
					}
				}
				.doc-count {
					margin-top: 15rpx;
					display: flex;
					align-items: center;
					justify-content: flex-start;
					.name {
						font-size: 24upx;
						font-family: PingFang SC;
						color: #9b9b9b;
					}
					.count {
						margin: 0rpx 5rpx;
						font-size: 24upx;
						font-family: PingFang SC;
						color: #2a2b2e;
					}
				}
				.doc-price {
					width: 100%;
					margin-top: 15rpx;
					display: flex;
					align-items: center;
					justify-content: flex-start;
					.btn {
						display: flex;
						align-items: center;
						justify-content: center;
						background-color: #feefd7;
						padding: 15rpx 30rpx;
						border-radius: 30rpx;
						font-size: 26upx;
						font-family: PingFang SC;
						color: #e69a22;
					}
				}
			}
		}
	}
}

/*#endif*/
</style>

<style lang="less">
/*每个页面公共css */
// @import './assets/iconfont/iconfont.css';
@import './assets/css/common.less';
/* 全局flex样式 */
@import './common/css/flexCommon.css';

/*引入全局补充样式*/
@import './assets/css/czy/es.1.base.css';
@import './assets/css/czy/es.2.color.css';
@import './assets/css/czy/es.3.icon.css';
@import './assets/css/czy/es.4.view.css';

.textOne {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.textTwo {
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}
</style>
