修复一个 ios 6.6.6 上的兼容性 bug

This commit is contained in:
CPPAlien 2018-07-16 15:59:18 +08:00
parent 83195e6cad
commit c17b06dcd4

View File

@ -63,10 +63,9 @@ Component({
return; return;
} }
if (!getApp().painterScreenRatio) { if (!(getApp().systemInfo && getApp().systemInfo.screenWidth)) {
try { try {
const systemInfo = wx.getSystemInfoSync(); getApp().systemInfo = wx.getSystemInfoSync();
getApp().painterScreenRatio = systemInfo.screenWidth / 750;
} catch (e) { } catch (e) {
const error = `Painter get system info failed, ${JSON.stringify(e)}`; const error = `Painter get system info failed, ${JSON.stringify(e)}`;
that.triggerEvent('imgErr', { error: error }); that.triggerEvent('imgErr', { error: error });
@ -74,7 +73,7 @@ Component({
return; return;
} }
} }
screenK = getApp().painterScreenRatio; screenK = getApp().systemInfo.screenWidth / 750;
this.downloadImages().then((palette) => { this.downloadImages().then((palette) => {
const { width, height } = palette; const { width, height } = palette;