cc.loader.load 跟wx-downloader.js 冲突的问题

  • Creator 版本:1.8.1

  • 目标平台: 微信小游戏

  • 详细报错信息,包含调用堆栈:

0:1 GET https://test.xxxxx.cn/wx-res//https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83eq…PVicmt8usScicKNHTmxuQF9JLiaS5vnkq8hGfkngWoiayHjibpbgC8icrdJFZnV6ZWxME3Dw/0 404 (Not Found)
Image (async)

(anonymous)@cocos2d-js-min.d70e3.js:1
n@cocos2d-js-min.d70e3.js:1
115.v.handle@cocos2d-js-min.d70e3.js:1
n@cocos2d-js-min.d70e3.js:1
(anonymous)@cocos2d-js-min.d70e3.js:1
fail@wx-downloader.js:222
(anonymous)@WAGame.js:3
(anonymous)@WAGame.js:4
function.setTimeout@gamePage.html:1
(anonymous)@WAGame.js:3
(anonymous)@WAGame.js:13
ontimeout@timers.js:469
tryOnTimeout@timers.js:304
listOnTimeout@timers.js:264

  • 重现方式:

  • 之前哪个版本是正常的 :

  • 手机型号 :

  • 手机浏览器 :

  • 编辑器操作系统 :

  • 编辑器之前是否有其它报错 :

  • 出现概率:必现

  • 额外线索:

1赞

补充细节:
为了避免包过大做了资源远程加载,按照指引在main.js里面加了如下代码:
require(‘libs/wx-downloader.js’);
wxDownloader.REMOTE_SERVER_ROOT = ‘https://test.xxxxxx.cn/wx-res/’;
代码后,访问微信头像就报错了,看上去像是加上这两行后访问 所有网络资源都会加上这个地址前缀,有无办法避免或改进?
使用如下代码加载微信头像的,以前一直运行正常:
cc.loader.load({url:url, type: ‘jpg’},function (err,tex) {
var spriteFrame = new cc.SpriteFrame(tex, cc.Rect(0, 0, tex.width, tex.height));
callback(code,spriteFrame);
});

上传中…
wx-downloader.js里面这个地方加个判断吧,如果是http开头就不用加地址前缀了,不能一棍子都打死撒