if (!window.returnCitySN) { window.returnCitySN = { cip: '', cname: '' }; } var _yhtCasUrl = "https://euc.yonyoucloud.com" || '' // 专属化场景域名使用当前访问的域名,确保双域名场景能支持 if(false === 'true' || false === true) { _yhtCasUrl = window.location.origin } var yht_user_server_url = _yhtCasUrl + '/iuap-uuas-user' function removeTrailingSlash(str) { if (typeof str !== 'string') { return str }; if (str.length === 0) { return str; } if (str.charAt(str.length - 1) === '/') { return str.slice(0, -1); } return str; } function convertDomain(domain, sourceHost) { // 去除可能的"http://"或"https://"前缀 domain = domain.replace(/(^\w+:|^)\/\//, ''); sourceHost = sourceHost.replace(/(^\w+:|^)\/\//, ''); const replacements = { c2: "c2." + "yonyoucloud." + "com", yonbip: "yonbip" + ".diwork" + ".com", corex: "corex." + "yonyoucloud." + "com", "c2." : "yonbip" + ".diwork" + ".com", "yonbip.": "c2." + "yonyoucloud." + "com" }; if (domain.toLowerCase().includes("bip-daily") || domain.toLowerCase().includes("bip-test")) { // 判断是否包含bip-daily或bip-test if (domain.includes("yonyoucloud")) { return domain.replace(/yonyoucloud/gi, "yyuap"); } else if (domain.includes("yyuap")) { return domain.replace(/yyuap/gi, "yonyoucloud"); } } else if (domain.includes("diwork")) { // 将diwork转换成yonyoucloud const regex = new RegExp("^(yonbip-core\d*\.|yonbip-core\d+\.|yonbip-core\d*\.\w+\.|yonbip.)?diwork\.com"); const match = domain.match(regex); if (match) { const subDomain = match[1] || ''; if (subDomain in replacements) { return replacements[subDomain]; } return 'c' + subDomain.replace("yonbip-core", "") + 'yonyoucloud.com'; } else { return sourceHost } } else if (domain.includes("yonyoucloud")) { // 将yonyoucloud转换成diwork const regex = new RegExp("^c([1]|[1-9][0-9]|[3-9]).yonyoucloud.com"); const match = domain.match(regex); if (match) { const subDomain = match[1] || ''; if (subDomain === 'cx.') { return replacements.corex; } if (subDomain in replacements) { return replacements[subDomain]; } return 'yonbip-core' + subDomain.replace("c", "") + '.diwork.com'; } else { // 对于不在corex和cx范围内的yonyoucloud域名,直接返回原域名 return sourceHost } } // 如果无法匹配,返回原始输入的域名 return domain; } // 获取顶级域名 function getTopLevelDomain(domain) { domain = removeTrailingSlash(domain) const domainRegex = /^(https?:\/\/)?(?:[^./]+\.)?([^.]+\.[^.]+)(?:\/|$)/i const matches = domain.match(domainRegex); // 提取根域名 if (matches && matches.length >= 3) { return matches[2]; } else { return null; // 如果无法提取根域名,返回null或者抛出错误 } } var getTargetHost = (curHost, targetHost) => { if (curHost.indexOf('.yonyou.') >= 0) { return targetHost } if (getTopLevelDomain(curHost) !== getTopLevelDomain(targetHost)) { return window.location.protocol + '//' + convertDomain(removeTrailingSlash(targetHost), removeTrailingSlash(curHost)) } else { return targetHost } } var __host__ = window.location.origin var yb_url = __host__ + '/iuap-apcom-workflownew/approve-component/init/loadWebJs' var FILE_STORAGE_TYPE = 'obs' var WB_HOST = getTargetHost(__host__, "https://c2.yonyoucloud.com" || __host__) // 原始的yms配置里的domain.url var YMS_WB_HOST = "https://c2.yonyoucloud.com" || __host__ var YC_HOST = __host__ var YHT_HOST = _yhtCasUrl || __host__ var YHT_IMG_HOST = yht_user_server_url var health_YHT_IMG_HOST = yht_user_server_url // 兼容医疗门户 日常环境增加变量供测试使用 以防health工程别人会上线 生产也增加一下路径 也以防YHT_IMG_HOST有别处使用所以新增一个地址 var SUPPLY_HOST = _yhtCasUrl var isProdReg = /https:\/\/c\d+\.yonyoucloud\.com/ var langurl = "/iuap-apcom-i18n" if (__host__.indexOf('-pre.diwork') >= 0 || __host__.indexOf('-pre.yonyoucloud') >= 0) { // 预发 FILE_STORAGE_TYPE = 'fastdfs' YC_HOST = "https://pur-pre.diwork.com" } else if ( __host__.indexOf('daily-dedicated.') >= 0) { // 日常多数据库 FILE_STORAGE_TYPE = 'fastdfs' YC_HOST = __host__.replace('bip-daily-dedicated.', 'pur-daily.') YHT_HOST = "https://yht-daily" + ".yonyoucloud" + ".com" } else if (__host__.indexOf('-daily') >= 0) { // 日常 FILE_STORAGE_TYPE = 'fastdfs' YC_HOST = __host__ } else if (__host__.indexOf('www.diwork') >= 0 || __host__.indexOf('yonsuite.diwork') >= 0 || __host__.indexOf('yonbip.diwork') >= 0 || __host__.indexOf('yonbip-core1') >= 0 || __host__.indexOf('yonbip-core3') >= 0 || __host__.indexOf('yonbip-core4') >= 0 || __host__.indexOf('dbox.') >= 0 || isProdReg.test(__host__)){ //正式环境 YC_HOST = "https://pur.yonyou." + "com" } else if (__host__.indexOf('pur.yonyou.com') >= 0 || __host__.indexOf('pur.diwork.com') >= 0) { // 如果还是老的域名访问,pur.yonyou.com和pur.diwork.com两种 yb_url = WB_HOST + '/iuap-apcom-workflownew/approve-component/init/loadWebJs' YC_HOST = "https://pur.yonyou." + "com" } else { // 专属化 FILE_STORAGE_TYPE = 'fastdfs' // 专属化使用外网域名 WB_HOST = "https://c2.yonyoucloud.com" || __host__ YMS_WB_HOST = "https://c2.yonyoucloud.com" || __host__ } window.configObject = { YMS_WB_HOST: YMS_WB_HOST, YHT_IMG_HOST: YHT_IMG_HOST, YHT_HOST: YHT_HOST, // 友互通host YC_HOST: YC_HOST, // 云采host IS_ONLINE: false, // 是否是正式环境 FILE_STORAGE_TYPE: FILE_STORAGE_TYPE, // 可选 obs,oss,fastdfs APP_SOURCE: 'YC', DAILY_HOST: __host__, // daily环境地址 SUPPLY_HOST: SUPPLY_HOST, WB_HOST: WB_HOST, PRE_HOST: __host__, MSG_PUSHER_HOST: __host__ + '/yonbip-cpu-sourcing/bidtrade/msgpusher/eventbus', MDF_RESOURCE: __host__ + "/mdf-node/mdf/resource?mdfrefer=true&prefix=''", YB_URL: yb_url, INTELLID_HOST: __host__, ENABLE_LAWBID: true, MDF_NODE_HOST: __host__ + '/mdf-node', //统一node服务地址iuap-yonbuilder-mobile // node端prefix prefix: '/yonbip-cpu-nodesvr', langurl: langurl, // 兼容医疗门户 日常环境增加变量供测试使用 以防health工程别人会上线 生产也增加一下路径 也以防YHT_IMG_HOST有别处使用所以新增一个地址 health_YHT_IMG_HOST:health_YHT_IMG_HOST }; if (window._configObject) { window.configObject = window._configObject } window.configObject.yhtVerifyUrl = "https://euc.yonyoucloud.com/diuser" // 社会化地址 window.configObject.xtDomainUrl = "https://c2.yonyoucloud.com" || window.location.origin window.configObject.publicHost = "https://c2.yonyoucloud.com" window.configObject.isPremises = false window.configObject.IUAP_YONBUILDER_MOBILE = "https://c2.yonyoucloud.com/iuap-yonbuilder-mobile" // 私有门户兼容新老域名localstore问题增加iframe 设置localstore 兼容统一nginx var ____isprivateportal = window.location.href.indexOf('/home.html') > 0 && (window.location.href.indexOf('pur-daily.yyuap.com') > -1 || window.location.href.indexOf('pur.diwork.com') > -1 || window.location.href.indexOf('pur-pre.diwork.com') > -1) if(____isprivateportal) { var ____isprivateportal_portaltype = window.localStorage.getItem("portaltype"); var ____isprivateportal_iframe = document.createElement('iframe') ____isprivateportal_iframe.src = '/cpu-cdn/setloca.html?portaltype=' + ____isprivateportal_portaltype document.head.appendChild(____isprivateportal_iframe) } var inHeader = '__inHeader' var inTable = '__inTable' // key为groupName 升级附件的groupName window.allUpdateCooFile = { 'purorder_list_file':inHeader, 'buyoffer_material':inTable, 'ycdop': inHeader, 'purorder_agree_file': inHeader, 'saleorder_list_file': inHeader, 'supplySealFile': inHeader, 'deliveryorder': inHeader, 'arriveorder': inHeader, 'deliveryorderChildTableFile': inTable, 'sup_checkbill': inHeader, 'pu_checkbill': inHeader, 'certificate_file': inHeader, 'invoice_other_file': inHeader, 'single': inHeader, 'talksEnclosure': inHeader, 'custompaper_yy': inHeader, 'custompaper_sw': inHeader, 'custompaper_ty': inHeader, 'custompaper_yh': inHeader, 'custompaper_jy': inHeader, 'no_commercial_bribe': inHeader, 'seal_quotation': inHeader, 'pdResult_useSuggestion': inHeader, 'pdResult_checkPriceMemo': inHeader, 'quotation_info': inHeader, 'supply_doc': inHeader, 'supplydoc_yy': inHeader, 'supplydoc_sw': inHeader, 'supplydoc_zz': inHeader, 'custompaper_zz': inHeader, 'quotation_material': inTable, 'quotation_inner': inHeader, 'supply_certification': inTable, 'evalution_file': inHeader, 'evaluation_report_feedback': inTable, 'evaluation_report_coordination': inTable, 'feedback_attachment': inHeader, 'greenchannel_attachment': inHeader, 'hierarchicalcert_qualify': inHeader, 'hierarchicalcert_product': inHeader, 'hierarchicalcert_field': inHeader, 'hierarchicalcert': inHeader, 'rewardpunish_attachment': inHeader, 'supply_HCApproval': inHeader, 'supply_HCTep': inTable, 'mall_goodsView_file': inHeader, } // 废旧拍卖相关 groupname var bidauction_groupname = { "bidtrade_editor": inHeader, "bidtrade_one": inHeader, "bidtrade_two": inHeader, "bidtrade_three": inHeader, "bidtrade_four": inHeader, "bidtrade_five": inHeader, "bidtrade_six": inHeader, "bidtrade_seven": inHeader, "bidtrade_eight": inHeader, "bidtrade_editor": inHeader, } var cpu_fe = { "bidOpenSheet": inHeader, "scdy": inHeader, "gysxz": inHeader, "zbjgyc": inHeader, "clearify_issue": inHeader, "reply_clearify_issue": inHeader, "bid_commerce": inHeader, "bid_tech": inHeader, "bid_techcommerce": inHeader, "bid_special": inHeader, "bid_material": inHeader, "biding_bidnotice": inHeader, "flow_mark_file": inHeader, "bidsup_credit": inHeader, "bidsup_economic": inHeader, "bidsup_technical": inHeader, "bid_notice": inHeader, "bid_newissue": inHeader, "clearify_issue": inHeader, "flow_mark_file": inHeader, "zbsc": inHeader, "supnotice_hetong": inHeader, } // Object.assign兼容 if(typeof Object.assign != 'function') { (function() { Object.assign = function(target) { 'use strict'; if(target === undefined || target === null) { throw new TypeError('Cannot convert undefined or null to object'); } var output = Object(target); for(var index = 1; index < arguments.length; index++) { var source = arguments[index]; if(source !== undefined && source !== null) { for(var nextKey in source) { if(source.hasOwnProperty(nextKey)) { output[nextKey] = source[nextKey]; } } } } return output; }; })(); }; window.allUpdateCooFile = Object.assign({}, window.allUpdateCooFile, bidauction_groupname, cpu_fe) //老私有门户apiLinks转换 window.transformDetails = function(linkConfig,tenantid){ var config = linkConfig //抽出需要单独处理的属性值 var handledSeparatelyArr = [] var details = config.details for(var key in details){ if(details[key].indexOf('?') > -1){ details[key] = details[key].replace('?', '?buyerTenant='+ tenantid + '&ycCrossTenantBuyerTenant=' + tenantid + '&') }else{ handledSeparatelyArr.push(key) } } console.warn('apiLinks details详情需要单独处理的属性:' + handledSeparatelyArr.join(';')) return config }