import getParameterByName from"../utils/getParameterByName";import Log from"../constants/log.js";import{$http}from"../utils/http";export default{data:()=>({token:"",appName:"test",isAgree:!1,redirectUri:"",isNavigating:!1,showWebView:!0}),onLoad(e){const{token:t}=e;this.token=t,this.redirectUri=`${uni.eidBaseUrl}/api/v1/Redirect?token=${t}`,this.getConfig(t)},methods:{changeAgree(e){const t=!this.isAgree;this.isAgree=t},getConfig(e){const t=this;$http({url:`/api/v1/GetConfig?token=${e}`,token:e,method:"GET",reTry:{tryCount:3}},o=>{if(0!==o.ErrorCode)uni.reportLogToEid({token:e,event:Log.getConfigFail,errCode:"",errMsg:o.ErrorMsg}),uni.showModal({title:"提示",content:"网络失败，请点击重新尝试",showCancel:!1,success(){uni.navigateBack()}});else{if(uni.reportLogToEid({token:e,event:Log.getConfig,errCode:o.ErrorCode,errMsg:o.ErrorMsg}),o.Data)return void(t.appName=o.Data.AppName);const i=o.ErrorMsg;uni.showModal({title:"提示",content:i,showCancel:!1,success(){uni.navigateBack()}})}})},handleWebViewLoad(e){const t=getParameterByName("success",e.detail.src);"true"===t&&(this.showWebView=!1),uni.reportLogToEid({token:this.token,event:Log.webViewResult,errMsg:`success参数为${t}`})},handleWebViewError(e){this.showWebView=!1,uni.reportLogToEid({token:this.token,event:Log.webViewError,errMsg:e.detail.src})},navigateToEid(){const e=this.token;this.isNavigating=!0;const t=this;uni.navigateToMiniProgram({appId:"wx0e2cb0b052a91c92",path:"pages/huiyan/index",envVersion:uni.eidEnvVersion,extraData:{useHuiyan:!0,huiyanToken:e},success(){uni.eidTokenToCallback=e},complete(o){t.isNavigating=!1,uni.reportLogToEid({token:e,event:Log.navigateToEid,errMsg:o.errMsg})}})}}};