export function openApp(url) {
	// #ifdef H5
	window.location.href = 'com.hnsiyao.duanju://'
	// #endif
}
export function isAndroid() {
	const systemInfo = uni.getSystemInfoSync();
	const isA = systemInfo.platform === 'android'
	// isAndroid=()=>{
	// 	return isA
	// }
	return isA
}
export function isIos() {
	const systemInfo = uni.getSystemInfoSync();
	const isIOS = /iOS/.test(systemInfo.platform);
	isIos = () => {
		return isIOS
	}
	return isIOS
}
export function isH5Android() {
	const token = uni.getStorageSync('token');
	console.log(isAndroid());
	if (isAndroid() && token) {
		uni.removeStorageSync('token')
		uni.navigateTo({
			url: '/pages/login/appEq'
		})
	}
}
export function returnIsSafari() {
	let res = uni.getSystemInfoSync();
	var ua = navigator.userAgent.toLowerCase();
	if (ua.indexOf('applewebkit') > -1 && ua.indexOf('mobile') > -1 && ua.indexOf('safari') > -1 &&
		ua.indexOf('linux') === -1 && ua.indexOf('android') === -1 && ua.indexOf('chrome') === -1 &&
		ua.indexOf('ios') === -1 && ua.indexOf('browser') === -1) {
		return true;
	} else {
		return false;
	}
}

/**
 * 路由跳转
 */
export function linkTo(path, isLogin = false) {
	if (isLogin) {
		let token = uni.getStorageSync('token')
		if (!token) {
			uni.showModal({
				title: '注意',
				content: '您还未登录，请登录后使用！',
				success: res => {
					if (res.confirm) {
						uni.navigateTo({
							url: '/pages/login/login'
						})
					}
				}
			})
		} else {
			uni.navigateTo({
				url: path
			})
		}
	} else {
		uni.navigateTo({
			url: path
		})
	}
}