Commit 26afd946 authored by zhijie.xue's avatar zhijie.xue

修复webp ios加载异常

parent e9e43939
......@@ -40,7 +40,8 @@ wepy.app({
let that = this;
wx.getSystemInfo({
success: function (res) {
that.$options.globalData.statusBarHeight = res.statusBarHeight;
const {statusBarHeight} = res;
that.$options.globalData.statusBarHeight = statusBarHeight;
}
});
wx.setStorageSync('onNetworkStatusChange', true);
......@@ -49,8 +50,12 @@ wepy.app({
});
},
onError(e) {
console.log('onError', e);
console.log('app onError', e);
},
onUnhandledRejection(reason, promise) {
console.log('onUnhandledRejection', reason);
}
});
</script>
<config>
......
function isLuckiiResource(url) {
return url && (url.indexOf('luckiistatic.q-gp.com') !== -1)
}
function lottery(url) {
if (isLuckiiResource(url)) {
return url + '?imageMogr2/auto-orient/thumbnail/500x/gravity/Center/crop/x600/format/webp/blur/1x0/quality/75';
url += '?imageMogr2/auto-orient/thumbnail/500x/gravity/Center/crop/x600/format/webp/blur/1x0/quality/75';
}
return url;
}
function prize(url) {
if (isLuckiiResource(url)) {
return url + '?imageMogr2/format/webp/blur/1x0/quality/75';
url += '?imageMogr2/format/webp/blur/1x0/quality/75';
}
return url;
}
......
......@@ -28,7 +28,7 @@ function checkUpdateVersion() {
if (!updateManager) return;
// 检测版本更新
updateManager.onCheckForUpdate(function(res) {
console.log(res, '版本更新');
// console.log(res, '版本更新');
// 请求完新版本信息的回调
if (res.hasUpdate) {
// 监听小程序有版本更新事件
......
......@@ -51,7 +51,7 @@ function isLuckiiResource(url) {
export function compressShareImage(url) {
if (isLuckiiResource(url)) {
return url + '?imageMogr2/auto-orient/thumbnail/500x800!/gravity/Center/crop/x500/format/webp/blur/1x0/quality/75';
url += '?imageMogr2/auto-orient/thumbnail/500x800!/gravity/Center/crop/x500/blur/1x0/quality/75';
}
return url;
}
......
......@@ -71,11 +71,11 @@
innerAudioContext.autoplay = true;
innerAudioContext.src = '/static/audio/winning.mp3';
innerAudioContext.onPlay(() => {
console.log('开始播放');
// console.log('开始播放');
});
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
console.error(res.errMsg);
console.error(res.errCode);
});
this.showChest = false;
this.blur = true;
......
......@@ -176,7 +176,6 @@
this.$emit('sign-in', true);
},
getUserInfo: function(params) {
console.log(222, this.authmodal);
if (this.authmodal) {
this.$emit('getUserInfo', params, true);
} else {
......
......@@ -13,7 +13,7 @@
methods: {
onShareAppMessage: function(res) {
if (res.from === 'button') {
console.log('onShareAppMessage1', res.target);
// console.log('onShareAppMessage1', res.target);
}
}
}
......
......@@ -31,7 +31,7 @@
<van-loading type="spinner" size="40" v-if="videoLoading" custom-class="video-loading"/>
<!--<video-loading v-if="videoLoading" :snapshot="item.videoSnapUrl"/>-->
</video>
<van-image wx:if="{{item.showType && item.showType.value ==1}}" use-loading-slot src="{{ic.prize(item.photoUrl || item.videoSnapUrl)}}" class="images" radius="10rpx" fit="contain" width="100%" height="100%">
<van-image webp="{{true}}" wx:if="{{item.showType && item.showType.value ==1}}" use-loading-slot src="{{ic.prize(item.photoUrl || item.videoSnapUrl)}}" class="images" radius="10rpx" fit="contain" width="100%" height="100%">
<van-loading slot="loading" type="spinner" size="20" vertical/>
</van-image>
<view class="rightcont" v-show="item.id > 0">
......
......@@ -50,6 +50,10 @@ VantComponent({
type: Boolean,
value: true,
},
webp: {
type: Boolean,
value: false,
}
},
data: {
error: false,
......
......@@ -14,6 +14,7 @@
show-menu-by-longpress="{{ showMenuByLongpress }}"
bind:load="onLoad"
bind:error="onError"
webp="{{ webp }}"
/>
<view
......
......@@ -307,7 +307,7 @@
});
await wepy.wx.openSetting();
} catch (e) {
console.log(e || e.message);
console.error(e || e.message);
}
return;
}
......@@ -319,7 +319,6 @@
wx.requestSubscribeMessage({
tmplIds,
success (res) {
console.log('requestSubscribeMessage success', res);
if (res.errMsg === 'requestSubscribeMessage:ok') {
// 兼容写法,有时响应中的模板id不是3个
const rs = tmplIds.every(v => res[v] === undefined || res[v] === 'accept');
......@@ -331,8 +330,8 @@
innerAudioContext.src = '/static/audio/supermarie.mp3';
innerAudioContext.onPlay(() => {});
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
console.error(res.errMsg);
console.error(res.errCode);
});
const { coins } = await signIn();
wepy.wx.hideLoading();
......@@ -347,7 +346,7 @@
}
},
fail (res) {
console.log('requestSubscribeMessage fail', res);
console.error('requestSubscribeMessage fail', res);
wepy.wx.hideLoading();
}
});
......@@ -398,26 +397,28 @@
}, 1000);
},
getMainInfo: async function() {
this.mainInfo = await getMainInfo();
this.sign = this.mainInfo && this.mainInfo.signin;
wx.setStorageSync('hasPhone', this.mainInfo.phone);
const info = await getMainInfo();
if (!info) return;
this.mainInfo = info;
this.sign = info && info.signin;
wx.setStorageSync('hasPhone', info.phone);
const activityId = wx.getStorageSync('activityId');
if (this.mainInfo && this.mainInfo.innerActivity) {
wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);
if (info && info.innerActivity) {
wx.setStorageSync('innerActivity', info.innerActivity);
} else {
wx.setStorageSync('innerActivity', '');
}
// 弹窗有多个,展示顺序 活动弹窗->邀请好友->购买获得克币->开奖宝箱
if (this.mainInfo.activity && this.mainInfo.activity.id && this.mainInfo.activity.id !== +activityId) {
if (info.activity && info.activity.id && info.activity.id !== +activityId) {
// 活动弹窗
this.avtivityModal = true;
} else if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {
} else if (info.inviteRecord && info.inviteRecord.length) {
// 邀请好友
this.showModal = 1;
} else if (this.mainInfo.buyRecord && this.mainInfo.buyRecord.length) {
} else if (info.buyRecord && info.buyRecord.length) {
// 购买获得金币
this.showModal = 4;
} else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
} else if (info.joinRecord && info.joinRecord.id) {
// 开奖宝箱
this.showModal = 2;
}
......@@ -441,19 +442,27 @@
},
getOpenId() {
return new Promise((resolve, reject) => {
let reLogin = false;
wx.checkSession({
success() {
if (!wx.getStorageSync('openId')) {
reLogin = true;
}
resolve();
},
async fail() {
reLogin = true;
},
async complete() {
if (reLogin) {
const { code } = await wepy.wx.login();
let loginInfo = await login(code);
loginInfo = loginInfo || {};
wx.setStorageSync('openId', loginInfo.openid);
wx.setStorageSync('isRegister', loginInfo.register);
}
resolve();
},
complete() {}
}
});
});
},
......
......@@ -212,7 +212,7 @@
<view class="raffle-wrapper">
<view class="raffle-content">
<van-image use-loading-slot src="{{ic.lottery(photoUrl)}}" class="img" width="610rpx" height="610rpx" radius="10rpx" fit="widthFix">
<van-image webp="{{true}}" use-loading-slot src="{{ic.lottery(photoUrl)}}" class="img" width="610rpx" height="610rpx" radius="10rpx" fit="widthFix">
<van-loading slot="loading" type="spinner" size="20" vertical />
</van-image>
<view class="goodsinfo">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment