You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
1.2 KiB

4 months ago
  1. import Log from"../constants/log";const navigateToEid=o=>{console.log("navigateToEid",uni.eidEnvVersion),reportStat({module:"showNavigateToEidDialog",action:"enter"}),(uni.enableEmbedded&&uni.openEmbeddedMiniProgram?uni.openEmbeddedMiniProgram:uni.navigateToMiniProgram)({appId:"wx0e2cb0b052a91c92",path:"pages/huiyan/index",envVersion:uni.eidEnvVersion,allowFullScreen:uni.allowFullScreen,extraData:{useHuiyan:!0,huiyanToken:o},success(e){console.log("success",e),uni.eidTokenToCallback=o,reportStat({module:"NavigateToEid",action:"confirm"}),reportStat({module:"showNavigateToEidDialog",action:"leave"})},fail(e){console.log("err",e),reportStat({module:"NavigateToEid",action:"cancel"})},complete(e){reportStat({module:"NavigateToEidDailog",action:"leave"}),uni.reportLogToEid({token:o,event:Log.navigateToEid,errMsg:e.errMsg})}})},reportStat=async({token:e=uni.VerifyEid_TOKEN,module:a,action:n})=>{if(console.log("reportStat",a,n),e)return console.log("上报埋点:",a,n),new Promise((o,i)=>{uni.request({url:uni.eidBaseUrl+"/api/report/EidEvents?token="+e,method:"POST",data:{token:e,eidSDKVersion:Log.version,enableEmbedded:uni.enableEmbedded,dataList:[{startTimestamp:Date.now(),module:a,action:n}]},success(e){o(e)},fail(e){i(e)}})})};export{navigateToEid,reportStat};