@@ -1232,10 +1232,11 @@ export class WebMap extends Observable {
12321232 layerInfo . visibleScales = result . visibleScales ;
12331233 layerInfo . extent = [ result . bounds . left , result . bounds . bottom , result . bounds . right , result . bounds . top ] ;
12341234 layerInfo . projection = `EPSG:${ result . prjCoordSys . epsgCode } ` ;
1235- let token = layerInfo . credential ? layerInfo . credential . token : undefined ;
1236- let isSupprtWebp = await that . isSupportWebp ( layerInfo . url , token ) ;
1235+ // let token = layerInfo.credential ? layerInfo.credential.token : undefined;
1236+ // let isSupprtWebp = await that.isSupportWebp(layerInfo.url, token);
12371237 // eslint-disable-next-line require-atomic-updates
1238- layerInfo . format = isSupprtWebp ? 'webp' : 'png' ;
1238+ // layerInfo.format = isSupprtWebp ? 'webp' : 'png';
1239+ layerInfo . format = 'png' ;
12391240 callback ( layerInfo ) ;
12401241 } else {
12411242 layerInfo . projection = that . baseProjection ;
@@ -1276,10 +1277,11 @@ export class WebMap extends Observable {
12761277 }
12771278 layerInfo . maxZoom = result . maxZoom ;
12781279 layerInfo . maxZoom = result . minZoom ;
1279- let token = layerInfo . credential ? layerInfo . credential . token : undefined ;
1280- let isSupprtWebp = await that . isSupportWebp ( layerInfo . url , token ) ;
1280+ // let token = layerInfo.credential ? layerInfo.credential.token : undefined;
1281+ // let isSupprtWebp = await that.isSupportWebp(layerInfo.url, token);
12811282 // eslint-disable-next-line require-atomic-updates
1282- layerInfo . format = isSupprtWebp ? 'webp' : 'png' ;
1283+ // layerInfo.format = isSupprtWebp ? 'webp' : 'png';
1284+ layerInfo . format = 'png' ;
12831285 // 请求结果完成 继续添加图层
12841286 if ( mapInfo ) {
12851287 //todo 这个貌似没有用到,下次优化
@@ -4520,36 +4522,36 @@ export class WebMap extends Observable {
45204522 * @param {* } token 服务token
45214523 * @returns {boolean }
45224524 */
4523- isSupportWebp ( url , token ) {
4524- // 还需要判断浏览器
4525- let isIE = this . isIE ( ) ;
4526- if ( isIE || ( this . isFirefox ( ) && this . getFirefoxVersion ( ) < 65 ) ||
4527- ( this . isChrome ( ) && this . getChromeVersion ( ) < 32 ) ) {
4528- return false ;
4529- }
4530- url = token ? `${ url } /tileImage.webp?token=${ token } ` : `${ url } /tileImage.webp` ;
4531- let isSameDomain = CommonUtil . isInTheSameDomain ( url ) , excledeCreditial ;
4532- if ( isSameDomain && ! token ) {
4533- // online上服务域名一直,要用token值
4534- excledeCreditial = false ;
4535- } else {
4536- excledeCreditial = true ;
4537- }
4538- url = this . getRequestUrl ( url , excledeCreditial ) ;
4539- return FetchRequest . get ( url , null , {
4540- withCredentials : this . withCredentials ,
4541- withoutFormatSuffix : true
4542- } ) . then ( function ( response ) {
4543- if ( response . status !== 200 ) {
4544- throw response . status ;
4545- }
4546- return response ;
4547- } ) . then ( ( ) => {
4548- return true ;
4549- } ) . catch ( ( ) => {
4550- return false ;
4551- } )
4552- }
4525+ // isSupportWebp(url, token) {
4526+ // // 还需要判断浏览器
4527+ // let isIE = this.isIE();
4528+ // if (isIE || (this.isFirefox() && this.getFirefoxVersion() < 65) ||
4529+ // (this.isChrome() && this.getChromeVersion() < 32)) {
4530+ // return false;
4531+ // }
4532+ // url = token ? `${url}/tileImage.webp?token=${token}` : `${url}/tileImage.webp`;
4533+ // let isSameDomain = CommonUtil.isInTheSameDomain(url), excledeCreditial;
4534+ // if (isSameDomain && !token) {
4535+ // // online上服务域名一直,要用token值
4536+ // excledeCreditial = false;
4537+ // } else {
4538+ // excledeCreditial = true;
4539+ // }
4540+ // url = this.getRequestUrl(url, excledeCreditial);
4541+ // return FetchRequest.get(url, null, {
4542+ // withCredentials: this.withCredentials,
4543+ // withoutFormatSuffix: true
4544+ // }).then(function (response) {
4545+ // if (response.status !== 200) {
4546+ // throw response.status;
4547+ // }
4548+ // return response;
4549+ // }).then(() => {
4550+ // return true;
4551+ // }).catch(() => {
4552+ // return false;
4553+ // })
4554+ // }
45534555 /**
45544556 * @private
45554557 * @function ol.supermap.WebMap.prototype.isIE
0 commit comments