Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
26afd946
Commit
26afd946
authored
Jul 23, 2020
by
zhijie.xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复webp ios加载异常
parent
e9e43939
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
53 additions
and
34 deletions
+53
-34
app.wpy
src/app.wpy
+7
-2
imageCompress.wxs
src/common/imageCompress.wxs
+3
-2
raffleProbability.js
src/common/raffleProbability.js
+1
-1
utils.js
src/common/utils.js
+1
-1
openAnimation.wpy
src/components/custom/openAnimation.wpy
+3
-3
sign.wpy
src/components/custom/sign.wpy
+0
-1
starAnimation.wpy
src/components/custom/starAnimation.wpy
+1
-1
video.wpy
src/components/custom/video.wpy
+1
-1
index.js
src/components/vant/image/index.js
+4
-0
index.wxml
src/components/vant/image/index.wxml
+1
-0
index.wpy
src/pages/index.wpy
+30
-21
raffle.wpy
src/pages/raffle.wpy
+1
-1
No files found.
src/app.wpy
View file @
26afd946
...
@@ -40,7 +40,8 @@ wepy.app({
...
@@ -40,7 +40,8 @@ wepy.app({
let that = this;
let that = this;
wx.getSystemInfo({
wx.getSystemInfo({
success: function (res) {
success: function (res) {
that.$options.globalData.statusBarHeight = res.statusBarHeight;
const {statusBarHeight} = res;
that.$options.globalData.statusBarHeight = statusBarHeight;
}
}
});
});
wx.setStorageSync('onNetworkStatusChange', true);
wx.setStorageSync('onNetworkStatusChange', true);
...
@@ -49,8 +50,12 @@ wepy.app({
...
@@ -49,8 +50,12 @@ wepy.app({
});
});
},
},
onError(e) {
onError(e) {
console.log('onError', e);
console.log('app onError', e);
},
onUnhandledRejection(reason, promise) {
console.log('onUnhandledRejection', reason);
}
}
});
});
</script>
</script>
<config>
<config>
...
...
src/common/imageCompress.wxs
View file @
26afd946
function isLuckiiResource(url) {
function isLuckiiResource(url) {
return url && (url.indexOf('luckiistatic.q-gp.com') !== -1)
return url && (url.indexOf('luckiistatic.q-gp.com') !== -1)
}
}
function lottery(url) {
function lottery(url) {
if (isLuckiiResource(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;
return url;
}
}
function prize(url) {
function prize(url) {
if (isLuckiiResource(url)) {
if (isLuckiiResource(url)) {
return url +
'?imageMogr2/format/webp/blur/1x0/quality/75';
url +=
'?imageMogr2/format/webp/blur/1x0/quality/75';
}
}
return url;
return url;
}
}
...
...
src/common/raffleProbability.js
View file @
26afd946
...
@@ -28,7 +28,7 @@ function checkUpdateVersion() {
...
@@ -28,7 +28,7 @@ function checkUpdateVersion() {
if
(
!
updateManager
)
return
;
if
(
!
updateManager
)
return
;
// 检测版本更新
// 检测版本更新
updateManager
.
onCheckForUpdate
(
function
(
res
)
{
updateManager
.
onCheckForUpdate
(
function
(
res
)
{
console
.
log
(
res
,
'
版本更新
'
);
//
console.log(res, '版本更新');
// 请求完新版本信息的回调
// 请求完新版本信息的回调
if
(
res
.
hasUpdate
)
{
if
(
res
.
hasUpdate
)
{
// 监听小程序有版本更新事件
// 监听小程序有版本更新事件
...
...
src/common/utils.js
View file @
26afd946
...
@@ -51,7 +51,7 @@ function isLuckiiResource(url) {
...
@@ -51,7 +51,7 @@ function isLuckiiResource(url) {
export
function
compressShareImage
(
url
)
{
export
function
compressShareImage
(
url
)
{
if
(
isLuckiiResource
(
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
;
return
url
;
}
}
...
...
src/components/custom/openAnimation.wpy
View file @
26afd946
...
@@ -71,11 +71,11 @@
...
@@ -71,11 +71,11 @@
innerAudioContext.autoplay = true;
innerAudioContext.autoplay = true;
innerAudioContext.src = '/static/audio/winning.mp3';
innerAudioContext.src = '/static/audio/winning.mp3';
innerAudioContext.onPlay(() => {
innerAudioContext.onPlay(() => {
console.log('开始播放');
//
console.log('开始播放');
});
});
innerAudioContext.onError((res) => {
innerAudioContext.onError((res) => {
console.
log
(res.errMsg);
console.
error
(res.errMsg);
console.
log
(res.errCode);
console.
error
(res.errCode);
});
});
this.showChest = false;
this.showChest = false;
this.blur = true;
this.blur = true;
...
...
src/components/custom/sign.wpy
View file @
26afd946
...
@@ -176,7 +176,6 @@
...
@@ -176,7 +176,6 @@
this.$emit('sign-in', true);
this.$emit('sign-in', true);
},
},
getUserInfo: function(params) {
getUserInfo: function(params) {
console.log(222, this.authmodal);
if (this.authmodal) {
if (this.authmodal) {
this.$emit('getUserInfo', params, true);
this.$emit('getUserInfo', params, true);
} else {
} else {
...
...
src/components/custom/starAnimation.wpy
View file @
26afd946
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
methods: {
methods: {
onShareAppMessage: function(res) {
onShareAppMessage: function(res) {
if (res.from === 'button') {
if (res.from === 'button') {
console.log('onShareAppMessage1', res.target);
//
console.log('onShareAppMessage1', res.target);
}
}
}
}
}
}
...
...
src/components/custom/video.wpy
View file @
26afd946
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
<van-loading type="spinner" size="40" v-if="videoLoading" custom-class="video-loading"/>
<van-loading type="spinner" size="40" v-if="videoLoading" custom-class="video-loading"/>
<!--<video-loading v-if="videoLoading" :snapshot="item.videoSnapUrl"/>-->
<!--<video-loading v-if="videoLoading" :snapshot="item.videoSnapUrl"/>-->
</video>
</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 w
ebp="{{true}}" w
x: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-loading slot="loading" type="spinner" size="20" vertical/>
</van-image>
</van-image>
<view class="rightcont" v-show="item.id > 0">
<view class="rightcont" v-show="item.id > 0">
...
...
src/components/vant/image/index.js
View file @
26afd946
...
@@ -50,6 +50,10 @@ VantComponent({
...
@@ -50,6 +50,10 @@ VantComponent({
type
:
Boolean
,
type
:
Boolean
,
value
:
true
,
value
:
true
,
},
},
webp
:
{
type
:
Boolean
,
value
:
false
,
}
},
},
data
:
{
data
:
{
error
:
false
,
error
:
false
,
...
...
src/components/vant/image/index.wxml
View file @
26afd946
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
show-menu-by-longpress="{{ showMenuByLongpress }}"
show-menu-by-longpress="{{ showMenuByLongpress }}"
bind:load="onLoad"
bind:load="onLoad"
bind:error="onError"
bind:error="onError"
webp="{{ webp }}"
/>
/>
<view
<view
...
...
src/pages/index.wpy
View file @
26afd946
...
@@ -307,7 +307,7 @@
...
@@ -307,7 +307,7 @@
});
});
await wepy.wx.openSetting();
await wepy.wx.openSetting();
} catch (e) {
} catch (e) {
console.
log
(e || e.message);
console.
error
(e || e.message);
}
}
return;
return;
}
}
...
@@ -319,7 +319,6 @@
...
@@ -319,7 +319,6 @@
wx.requestSubscribeMessage({
wx.requestSubscribeMessage({
tmplIds,
tmplIds,
success (res) {
success (res) {
console.log('requestSubscribeMessage success', res);
if (res.errMsg === 'requestSubscribeMessage:ok') {
if (res.errMsg === 'requestSubscribeMessage:ok') {
// 兼容写法,有时响应中的模板id不是3个
// 兼容写法,有时响应中的模板id不是3个
const rs = tmplIds.every(v => res[v] === undefined || res[v] === 'accept');
const rs = tmplIds.every(v => res[v] === undefined || res[v] === 'accept');
...
@@ -331,8 +330,8 @@
...
@@ -331,8 +330,8 @@
innerAudioContext.src = '/static/audio/supermarie.mp3';
innerAudioContext.src = '/static/audio/supermarie.mp3';
innerAudioContext.onPlay(() => {});
innerAudioContext.onPlay(() => {});
innerAudioContext.onError((res) => {
innerAudioContext.onError((res) => {
console.
log
(res.errMsg);
console.
error
(res.errMsg);
console.
log
(res.errCode);
console.
error
(res.errCode);
});
});
const { coins } = await signIn();
const { coins } = await signIn();
wepy.wx.hideLoading();
wepy.wx.hideLoading();
...
@@ -347,7 +346,7 @@
...
@@ -347,7 +346,7 @@
}
}
},
},
fail (res) {
fail (res) {
console.
log
('requestSubscribeMessage fail', res);
console.
error
('requestSubscribeMessage fail', res);
wepy.wx.hideLoading();
wepy.wx.hideLoading();
}
}
});
});
...
@@ -398,26 +397,28 @@
...
@@ -398,26 +397,28 @@
}, 1000);
}, 1000);
},
},
getMainInfo: async function() {
getMainInfo: async function() {
this.mainInfo = await getMainInfo();
const info = await getMainInfo();
this.sign = this.mainInfo && this.mainInfo.signin;
if (!info) return;
wx.setStorageSync('hasPhone', this.mainInfo.phone);
this.mainInfo = info;
this.sign = info && info.signin;
wx.setStorageSync('hasPhone', info.phone);
const activityId = wx.getStorageSync('activityId');
const activityId = wx.getStorageSync('activityId');
if (
this.mainInfo && this.mainI
nfo.innerActivity) {
if (
info && i
nfo.innerActivity) {
wx.setStorageSync('innerActivity',
this.mainI
nfo.innerActivity);
wx.setStorageSync('innerActivity',
i
nfo.innerActivity);
} else {
} else {
wx.setStorageSync('innerActivity', '');
wx.setStorageSync('innerActivity', '');
}
}
// 弹窗有多个,展示顺序 活动弹窗->邀请好友->购买获得克币->开奖宝箱
// 弹窗有多个,展示顺序 活动弹窗->邀请好友->购买获得克币->开奖宝箱
if (
this.mainInfo.activity && this.mainInfo.activity.id && this.mainI
nfo.activity.id !== +activityId) {
if (
info.activity && info.activity.id && i
nfo.activity.id !== +activityId) {
// 活动弹窗
// 活动弹窗
this.avtivityModal = true;
this.avtivityModal = true;
} else if (
this.mainInfo.inviteRecord && this.mainI
nfo.inviteRecord.length) {
} else if (
info.inviteRecord && i
nfo.inviteRecord.length) {
// 邀请好友
// 邀请好友
this.showModal = 1;
this.showModal = 1;
} else if (
this.mainInfo.buyRecord && this.mainI
nfo.buyRecord.length) {
} else if (
info.buyRecord && i
nfo.buyRecord.length) {
// 购买获得金币
// 购买获得金币
this.showModal = 4;
this.showModal = 4;
} else if (
this.mainInfo.joinRecord && this.mainI
nfo.joinRecord.id) {
} else if (
info.joinRecord && i
nfo.joinRecord.id) {
// 开奖宝箱
// 开奖宝箱
this.showModal = 2;
this.showModal = 2;
}
}
...
@@ -441,19 +442,27 @@
...
@@ -441,19 +442,27 @@
},
},
getOpenId() {
getOpenId() {
return new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
let reLogin = false;
wx.checkSession({
wx.checkSession({
success() {
success() {
if (!wx.getStorageSync('openId')) {
reLogin = true;
}
resolve();
resolve();
},
},
async fail() {
async fail() {
const { code } = await wepy.wx.login();
reLogin = true;
let loginInfo = await login(code);
loginInfo = loginInfo || {};
wx.setStorageSync('openId', loginInfo.openid);
wx.setStorageSync('isRegister', loginInfo.register);
resolve();
},
},
complete() {}
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();
}
});
});
});
});
},
},
...
...
src/pages/raffle.wpy
View file @
26afd946
...
@@ -212,7 +212,7 @@
...
@@ -212,7 +212,7 @@
<view class="raffle-wrapper">
<view class="raffle-wrapper">
<view class="raffle-content">
<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-loading slot="loading" type="spinner" size="20" vertical />
</van-image>
</van-image>
<view class="goodsinfo">
<view class="goodsinfo">
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment