<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>Title</title>
</head>
<script src="https://uedcdn.zto.com/static/zcat/release/zcat.browser.min.js"></script>
<script>
    (function(){
        // debugger
        if(window.zcat) window.zcat.init({ appKey: "portal-web-error", isProd:true});
        //后端生成参数
        var domain = decodeURIComponent("https%3A%2F%2Fwww.zt-express.com%2F");
        var originalMenus = 'e-original-menus'
        var microMenus = ["https:\/\/ssgreen.zt-express.com\/#\/","config\/goods","proofs\/proofListAll","system\/message","system\/view","rule\/decisionVar","config\/rolePower","config\/businessNature","system\/tag","config\/siteRolePower","bizStatis\/appealDetail","rule\/rule","config\/dicConfigEdit","config\/arbitrationDuty","rule\/tenant","system\/index","config\/monitorMaintain","system\/monitor","config\/allocation","system\/action","system\/group","basedata\/workOrderQuery?dispark=1","config\/appeal","basedata\/workOrderQuery","basedata\/donelist6","download\/exportBizStatis?dispark=1","basedata\/donelist5","basedata\/todolist3","bizMonitor\/index","ordernode\/allocationOrders","basedata\/newcreateWorkOrder","basedata\/todolist1_new","basedata\/todolist","basedata\/donelist2","basedata\/todolist4","basedata\/donelist","basedata\/donelist4","basedata\/donelist3","basedata\/myWorkOrder","myreport\/complaintPost","myreport\/complaintPunish","myreport\/complaintNetwork","myreport\/complaintCustomer","config\/workbenchConfig","myreport\/complaintOrder","myreport\/complaintMonitor","myreport\/complaintArbitration","myreport\/warningCustomer","myreport\/overtimeCustomer","basedata\/siteTodolist","basedata\/appealTodolist","basedata\/newWorkbenchCc","config\/templateConfig","basedata\/newWorkbenchDt","proofs\/proofList","myreport\/complaintTask","proofs\/addProof","configCC\/dutyPunishCC","configCC\/dutyPunish","configCC\/autoIssueSiteCC","configCC\/thirdConfig","configCC\/addedConfigCC","configCC\/autoIssueSite","configCC\/thirdReplyConfig","configCC\/ocOvertimeTab","configCC\/orderHandleConfig","configCC\/customerHandleConfig","configCC\/ccOvertimeTab","config\/scConfig","myreport\/monitoringPerformance","myreport\/netComplaintWork","configCC\/ccVerbalTricksConfig","myreport\/ccLiabilityReport","txworkbench\/ordertypesetting","txworkbench\/timesetting","txworkbench\/workorderHandle","txworkbench\/createworker","txworkbench\/workorderQuery","myreport\/waybillRecord","myreport\/waybillLabel","myreport\/waybillOutcall","system\/categoryList","system\/bpmnList","download\/exportBizStatis","operation\/siteBlackMark","system\/abnormalList","tel\/phoneRecord","tel\/phoneRecordList","operation\/notification","config\/showMe","myReport\/sumMonitoringPerformance","config\/sendMsgTool","configCC\/ccSourceSiteExemptConfig","basedata\/equityReliefQuery","bizStatis\/equityReliefRecords","configCC\/equityReliefConfig","configCC\/ccCustomerReviewConfig","configCC\/satisfactionConfig","config\/sendMsgTemp","welcome","myreport\/menuGhNoteSending","configCC\/equityReliefDutyConfig","basedata\/monitorTodolist","basedata\/workbenchNote","config\/nonstandardLoading","basedata\/donelist?dispark=1","basedata\/nonstandardLoadingTodoList?dispark=1","configCC\/orderControlConfig","basedata\/offlineControlImport","config\/msgSubscription","configCC\/byteHandleConfig","configCC\/byteReverseDutyConfig","myreport\/complaintFirstring","myreport\/complaintInner","import\/importList","myreport\/complaintTimeout","myreport\/complaintAppeal","configNote\/notepadMsgMapping","config\/taskOrderMsgMapping","configCC\/postalComplain","myreport\/postalReport","myreport\/complaintReduction","myreport\/orderPunish","configCC\/ccCustomerComplaintSupervisorConfig","operation\/noteManuals","configCC\/couponConfig","bizStatis\/couponSendDetail","createOrder","operation\/salesmanViolation","basedata\/serviceKBIFormTodoList","txworkbench\/bizMonitorList","config\/sopSettings","myreport\/manage","noviceGuid","configCC\/qualityStrategyConfig","config\/salesmanHandleConfig","txworkbench\/txPunishConfig","config\/workHub","myreport\/intelligenceOrder","configCC\/problemSceneConfig","config\/workHubLog","config\/serviceSiteConfig","\/information\/damageOccurrence","configCC\/ccTransferOrderConfig","configNote\/noteConfigurationIntentionStrategySet","config\/settleConfig","configCC\/ccWorkorderProgressContentConfig","system\/abnormalSettlement","configCC\/postalWebConfig","configNote\/noteConfigurationEventEnd2","configCC\/transshipmentWarehouseConfig","configCC\/postalPocConfig","system\/alarmNotice","configCC\/intelligentWorkorderProcessConfig","https:\/\/56-partner.pinduoduo.com","https:\/\/biaoju.cainiao.com","config\/orderUpRuleConfug","myreport\/noteHandleReport","basedata\/afterSalesDetail"]
        var ebizId = "a_561"
        var aliasId = "zt5KKDQDIuWUyBDHxk1J2MbQ"
        var microAppId = "work-order-front-gray"
        //白名单。优先使用业务自身的exx 参数，没有的使用白名单exx参数补
        // var whiteList = [{
        //     microAppId:'qt-front',
        //     path:'/taskManage/taskDetail/',   //菜单静态路径。注意，不包括path里的动态参数
        //     elabel:'菜单标题', //菜单默认标题
        //     eshareable:'y',//是否共享一个tab。共享 y ,不共享 n
        //     epathcount:'0',//path上的参数个数
        //     eaddroutes:'n',//是否使用到 mHelp.addPageDetail 方法。有 y ,无 n
        //     eiframe:'0' //门户是否用iframe打开这个详情页。是 1，否 0
        // }]
        var whiteList = []

        var isMobileModel = false // 是否移动设备（false：不是  true：是）
        var newTargetDomain = decodeURIComponent("https%3A%2F%2Fwww.zt-express.com%2F") //新加载域名（用于移动接入时跳转）
        var hasMobileUpgrade = true //是否接入移动并且升级，用于移动访问中转静态资源访问（false：未接入  true：已接入）

        //页面参数
        var originalMenusPath = domain + originalMenus + '?ebizId=' + ebizId
        var hash = window.location.hash
        // 如果是95需要特殊处理因新老路径不一样
        var hash95 = is95Hash()
        if(hash95) hash = hash95

        var hashOnline = isOnlineHash()
        if(hashOnline) {
            hash = hashOnline
            microAppId = 'online-web'
            aliasId = 'online-web'
        }
        var hasSmsWeb = isSmsWebHash()
        if(hasSmsWeb) {
            hash = hasSmsWeb === '/' ? hash : hasSmsWeb
            microAppId = 'smsManageWeb'
            aliasId = 'ztIkVM3daLVp22GXpjzf-MDw'
        }
        var hasWorkFolwWeb = isWorkFolwWeb()
        if (hasWorkFolwWeb) {
            microAppId = 'task-center-web'
            aliasId = 'task-center-web'
        }

        var hashGhWeb  = isGhWeb()
        if(hashGhWeb){
            hash = hashGhWeb
        }

        var hashProblemWeb = isProblemWeb()
        if(hashProblemWeb){
            hash = hashProblemWeb
        }

        var hashWelcomeWeb = isWelcomeWeb()
        if(hashWelcomeWeb){
            hash = ''
        }

        var hashZtraceWeb = isZtraceWeb()
        if(hashZtraceWeb){
            aliasId = 'zt2o1y_ydKVoqZVkJJv6bhaQ'
        }

        var hashPath = hash.replace('#','').split('?')[0]
        var pathname = window.location.pathname
        var search = window.location.search
        var isIframe = window.top !== window.self
        var originDomain = window.location.host
        var originFullPath = window.location.href
        var href=''
        var match=false

        var isMobileJump = isMobileModel && hasMobileUpgrade && newTargetDomain

        //被iframe引入时，重定向e-static资源路径。如果为history路由，自动转为hash
        if(isIframe || isMobileJump){
            var _domain = isMobileJump ? newTargetDomain : domain
            href = _domain + 'e-static/'+ microAppId + '/default'
            href += hash ? ('/' + hash) : ('/#'+ pathname + search)
            //慧眼huiyan-manage-static 与 huiyan-online-static 特殊处理
            if(microAppId==='huiyan-manage-static'&& href.includes('/online/')){
                href = href.replace('/huiyan-manage-static/','/huiyan-online-static/')
            }
            if (microAppId === 'billtracing-web') {
                if (href.includes('/#/prod/index.html')) {
                    href = href.replace('/#/prod/index.html', '/prod/index.html')
                } else if (href.includes('/#/prod/indexView.html')) {
                    href = href.replace('/#/prod/indexView.html', '/indexView/index.html')
                }
                href = search ? href + '&dataSource=bill-tracing-web' : href + '?dataSource=bill-tracing-web'
            }
            try{
                zcat.report({appKey: "portal-web-error", url: originDomain})
                zcat.trackEvent('Portal.Proxy', originDomain, originFullPath, href)
            }catch (e) {}
            window.location.href = href
            return
        }
        if(hash){
            //hash路由
            match = isMatchMenu(hashPath, microMenus)
            //匹配菜单成功，跳转门户路径。
            href = (domain + 'e/' + aliasId + hash).replace('#','')
            //慧眼huiyan-manage-static 与 huiyan-online-static 特殊处理
            if(microAppId==='huiyan-manage-static'&& href.includes('/online/')){
                href = href.replace('/huiyan-manage-static/','/huiyan-online-static/')
            }
            if(!match){
                //匹配失败，填充详情参数跳转或跳转门户全部菜单导航
                href = whiteHref(hashPath, microAppId, whiteList, href) || originalMenusPath
            }
        }else{
            //history路由
            match = isMatchMenu(pathname, microMenus)
            if(microAppId = "billtracing-web"){
                if(pathname.includes('prod/indexView.html')){
                    pathname = pathname.replace('prod/indexView.html','indexView/index.html')
                }
                search = search + (search ? '&' : '?') + 'esingle=y&esinglefull=y&eiframe=1'
            }
            //匹配菜单成功，跳转门户路径。
            href = (domain + 'e/'+ aliasId + pathname + search)
            if(!match){
                //匹配失败，填充详情参数跳转或跳转门户全部菜单导航
                href = whiteHref(pathname, microAppId, whiteList, href) || originalMenusPath
            }
        }
        try{
            console.log('Portal.Proxy')
            zcat.report({appKey: "portal-web-error", url: originDomain})
            zcat.trackEvent('Portal.Proxy', originDomain, originFullPath, href)
        }catch (e) {}
        window.location.href = href

        function fillSlash(path) {
            return path && path[0] === '/' ? path : ('/'+path)
        }
        function isMatchMenu(path, microMenus){
            //微应用菜单列表匹配
            var match = microMenus.some((item)=>{
                return path === fillSlash(item)
            })
            return match
        }
        //功能详情页路由处理
        function whiteHref(path, microAppId, whiteList, href){
            var obj = whiteList.find((item)=>{
                return microAppId===item.microAppId && path.startsWith(item.path)
            })
            //填query参数
            if(obj){
                var url = new URL(href);
                var searchParams = new URLSearchParams(url.search);
                var result= []

                if(!searchParams.has("edetail")) result.push('edetail=y')
                if(!searchParams.has("elabel")) result.push('elabel='+encodeURIComponent(obj.elabel))
                if(!searchParams.has("eshareable")) result.push('eshareable='+obj.eshareable)
                if(!searchParams.has("epathcount")) result.push('epathcount='+obj.epathcount)
                if(!searchParams.has("eaddroutes")) result.push('eaddroutes='+obj.eaddroutes)
                if(!searchParams.has("eiframe")) result.push('eiframe='+obj.eiframe)

                href+= result.length>0&&href.includes('?') ? '&':'?'
                href+= result.join('&')
                return href
            }
            return ''
        }
        //95工作台特殊处理
        function is95Hash(){
            if(microAppId !== 'web-95') return ''
            var newHash = ''
            var automap = [{
                oldHash:'#/serviceWorkbench/reception',
                newHash:'#/workbench-reception'
            },{
                oldHash:'#/serviceWorkbench/wiringTable',
                newHash:'#/workbench-wiring'
            },{
                oldHash:'#/serviceWorkbench/callRecords',
                newHash:'#/call-record'
            },{
                oldHash:'#/serviceWorkbench/notification',
                newHash:'#/notice-manage'
            }]

            automap.forEach((item,index)=>{
                if(hash.indexOf(item.oldHash) !== -1){
                    newHash = hash.replace(item.oldHash,item.newHash)
                }
            })

            if(newHash){
                return newHash
            }
        }
        //在线工作台特殊处理
        function isOnlineHash(){
            if(microAppId !== 'cs-web-sdk') return ''
            if(hash.indexOf('charsJs') !== -1){
                return '#/workbench'
            }
        }
        function isSmsWebHash(){
            if(microAppId !== 'sms-web') return ''
            var newHash = '/'
            var automap = [{
                oldHash:'#/mobileSms/sendMsm',
                newHash:'#/send/send-sms'
            },{
                oldHash:'#/mobileSms/sendBulk',
                newHash:'#/send/send-batch'
            },{
                oldHash:'#/sendMessageRecord/smsSendRecord',
                newHash:'#/records/records-message'
            },{
                oldHash:'#/sendMessageRecord/voiceMessageRecord',
                newHash:'#/records/records-voice'
            },{
                oldHash:'#/sendMessageRecord/phoneMessageRecord',
                newHash:'#/records/records-telephone'
            },{
                oldHash:'#/balancePackageManage/buyRecharge',
                newHash:'#/balance/balance-recharge'
            },{
                oldHash:'#/balancePackageManage/myOrder',
                newHash:'#/balance/balance-order'
            },{
                oldHash:'#/balancePackageManage/rechargeRecord',
                newHash:'#/balance/balance-record'
            },{
                oldHash:'#/smsManage/siteSmsBalance',
                newHash:'#/sms/sms-left'
            },{
                oldHash:'#/smsManage/smsNumber',
                newHash:'#/sms/sms-recycle'
            },{
                oldHash:'#/smsManage/exportRecord',
                newHash:'#/records/records-message'
            },{
                oldHash:'#/smsManage/recycleRecord',
                newHash:'#/sms/sms-modify'
            },{
                oldHash:'#/voiceManage/myAccount',
                newHash:'#/voice/voice-myAccount'
            },{
                oldHash:'#/voiceManage/accountAudit',
                newHash:'#/voice/voice-accountAudit'
            },{
                oldHash:'#/voiceManage/accountRecharge',
                newHash:'#/voice/voice-accountRecharge'
            },{
                oldHash:'#/voiceManage/siteVoiceAccount',
                newHash:'#/voice/voice-left'
            },{
                oldHash:'#/voiceManage/distributeRecycle',
                newHash:'#/voice/voice-distribute'
            },{
                oldHash:'#/voiceManage/accountFinancial',
                newHash:'#/voice/voice-accountFlow'
            },{
                oldHash:'#/serviceWorkbench/notification',
                newHash:'#/notice-manage'
            },{
                oldHash:'#/downloadCenter/index',
                newHash:'#/download/download-center'
            },{
                oldHash:'#/callbackBinding/binding',
                newHash:'#/voice/callbackBinding'
            }]

            automap.forEach((item,index)=>{
                if(hash.indexOf(item.oldHash) !== -1){
                    newHash = hash.replace(item.oldHash,item.newHash)
                }
            })

            return newHash
        }
        function isWorkFolwWeb(){
            if(microAppId !== 'workflow-web') return ''
            var replacehashData = [{
                path:'#/task-center',
            },
                {
                    path:'#/approve',
                }]
            var newHash = ''
            replacehashData.forEach((item,index)=> {
                if(hash.indexOf(item.path) !== -1){
                    newHash = true
                }
            })
            return newHash
        }
        function isGhWeb(){
            if(microAppId !== 'work-order-front-gray') return ''
            var newHash = ''
            if(hash === ''){
                newHash = '#/welcome'
            }
            return newHash
        }
        function isProblemWeb(){
            if(microAppId !== 'problem-front') return ''
            var newHash = ''
            if(hash === '' || hash === '#/index') {
                newHash = '#/expressCourier/expressNotFound'
            }
            return newHash
        }

        function isWelcomeWeb(){
            if(microAppId !== 'billing-mangement-system-vue' && microAppId !== 'zto_material_web') return ''
            return hash === '#/welcome' ? '/' : ''
        }
        function isZtraceWeb(){
            if(microAppId !== 'ztrace-web') return ''
            var newHash = ''
            if(hash === '#/home/ztoBillServiceApply') {
                newHash = '/'
            }
            return newHash
        }

    })();
</script>
<body></body>
</html>