let insProAppId= 'wx22cd68f2c1046f97'
let serverUrl = 'https://bms.cfpamf.org.cn'
// let frontPage = 'https://h5.yongtongbx.com/wx/#/proDetail/141'
let frontPage ='https://h5.yongtongbx.com/wx/#/index'
let openId ='o9F_Aw9smwdKl3UfkW8r5FAvkJMo'
// let testProAppId= 'wxffdc81bf67a9f8bd'
// let serverUrl = 'https://bmstest.cdfinance.com.cn'
// let frontPage = 'http://weixin.yongtongbx.com/#/proDetail/240'
// let openId ='osUxv1j9pCqL1JwUpwoS9pXtKO1g'
/**
* serverUrl:不带最后的/
*/
function generateWechatProductUrl(appId,serverUrl,frontPageUrl){
const pageUrlBase64 = window.btoa(frontPageUrl)
const encodeFrontPageUrl = encodeURIComponent(pageUrlBase64)
const encodeServerURL =encodeURIComponent(serverUrl)
return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${insProAppId}&redirect_uri=${encodeServerURL}%2fapi%2finsurance%2fmicro%2fwx%2findex%2fauthorize_redirect%3Frdl%3D${encodeFrontPageUrl}&response_type=code&scope=snsapi_userinfo&state=autoUserHome#wechat_redirect`
}
function generateShareUrl(bmsURL,curlink,openId){
curlink = encodeURIComponent(curlink)
return `${bmsURL}/api/insurance/micro/wx/index/share?openId=${openId}&rdl=${curlink}`
}
console.log(generateShareUrl(serverUrl,frontPage,openId))
// console.log(generateWechatProductUrl(insProAppId,serverUrl,frontPage))
console