import wx from 'weixin-js-sdk'
import axios from 'axios'
function openTag(){
		var path = location.href.split('#')[0];
	var url = "";
	var appid = "";
	if (path.indexOf("//dev") > 1) {
		url = "https://dev-app.igandan.com/app/manager/getSignature4bing";
		appid = "wx68affaa9d23528f8";
	} else {
		url = "https://app.igandan.com/app/manager/getSignature4bing";
		appid = "wxa4132ef4701ac5e4";
	}

axios.get(url, {
		params: {
			path: encodeURIComponent(window.location.href.split('#')[0]),
			appid: appid
		}
	}).then(json => {
			wx.config({
				debug: false,
				appId: appid,
				timestamp: json.data.timestamp,
				nonceStr: json.data.nonceStr,
				signature: json.data.signature,
                jsApiList: ['wx-open-launch-weapp'],
				openTagList: ['wx-open-launch-weapp']
			});
	}).catch((e) => {
		console.log('获取数据失败');
	});
    wx.checkJsApi({
		jsApiList: ['wx-open-launch-weapp'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
		success: function (res) {
			console.log(res)
		}
	});
		wx.ready(function () {
            console.log('准备好了~~~');
		});
}


export  default openTag;