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
f582a698
Commit
f582a698
authored
Jul 17, 2020
by
zhijie.xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品图片后端改为dpg;奖品图片使用webp
parent
0dbacc8c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
12 deletions
+43
-12
imageCompress.wxs
src/common/imageCompress.wxs
+22
-0
utils.js
src/common/utils.js
+11
-0
goodsList.wpy
src/components/custom/goodsList.wpy
+1
-4
video.wpy
src/components/custom/video.wpy
+3
-2
index.wpy
src/pages/index.wpy
+2
-4
raffle.wpy
src/pages/raffle.wpy
+4
-2
No files found.
src/common/imageCompress.wxs
0 → 100644
View file @
f582a698
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';
}
return url;
}
function prize(url) {
if (isLuckiiResource(url)) {
return url + '?imageMogr2/format/webp/blur/1x0/quality/75';
}
return url
module.exports = {
lottery: lottery,
prize: prize
}
\ No newline at end of file
src/common/utils.js
View file @
f582a698
...
@@ -44,3 +44,14 @@ export function debounce(func, wait, immediate) {
...
@@ -44,3 +44,14 @@ export function debounce(func, wait, immediate) {
return
result
;
return
result
;
};
};
}
}
function
isLuckiiResource
(
url
)
{
return
url
&&
url
.
indexOf
(
'
luckiistatic.q-gp.com
'
)
!==
-
1
;
}
export
function
compressShareImage
(
url
)
{
if
(
isLuckiiResource
(
url
))
{
return
url
+
'
?imageMogr2/auto-orient/thumbnail/500x800!/gravity/Center/crop/x500/format/webp/blur/1x0/quality/75
'
;
}
return
url
;
}
src/components/custom/goodsList.wpy
View file @
f582a698
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
<van-image use-loading-slot src="{{item.images}}" class="img" width="220rpx" height="210rpx" radius="10rpx" fit="cover">
<van-image use-loading-slot src="{{item.images}}" class="img" width="220rpx" height="210rpx" radius="10rpx" fit="cover">
<van-loading slot="loading" type="spinner" size="20" vertical />
<van-loading slot="loading" type="spinner" size="20" vertical />
</van-image>
</van-image>
<!--<image src="{{item.images}}" class="img"></image>-->
<view class="title">{{item.title}}</view>
<view class="title">{{item.title}}</view>
<p class="price">¥{{item.price}}</p>
<p class="price">¥{{item.price}}</p>
<p class="buy">{{item.saleCount}}人购买</p>
<p class="buy">{{item.saleCount}}人购买</p>
...
@@ -114,9 +113,7 @@
...
@@ -114,9 +113,7 @@
appId: 'wx91d27dbf599dff74',
appId: 'wx91d27dbf599dff74',
path: 'pages/union/proxy/proxy?spreadUrl=' + encodeURIComponent(data), // 跳转小程序的路径
path: 'pages/union/proxy/proxy?spreadUrl=' + encodeURIComponent(data), // 跳转小程序的路径
// 有效值 develop(开发版),trial(体验版),release(正式版)
// 有效值 develop(开发版),trial(体验版),release(正式版)
envVersion: 'release',
envVersion: 'release'
success(res) {
}
});
});
this.showLoading = false;
this.showLoading = false;
}).catch(() => {
}).catch(() => {
...
...
src/components/custom/video.wpy
View file @
f582a698
...
@@ -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="{{i
tem.photoUrl || item.videoSnapUrl
}}" class="images" radius="10rpx" fit="contain" width="100%" height="100%">
<van-image wx:if="{{item.showType && item.showType.value ==1}}" use-loading-slot src="{{i
c.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">
...
@@ -47,8 +47,9 @@
...
@@ -47,8 +47,9 @@
</swiper>
</swiper>
<van-popup show="{{showPopup}}" close-on-click-overlay="{{false}}" overlay-style="background-color:transparent"></van-popup>
<van-popup show="{{showPopup}}" close-on-click-overlay="{{false}}" overlay-style="background-color:transparent"></van-popup>
</view>
</view>
<wxs module="rp" src="../../common/raffleProbability.wxs"></wxs>
<wxs module="ic" src="../../common/imageCompress.wxs"></wxs>
</template>
</template>
<wxs module="rp" src="../../common/raffleProbability.wxs"></wxs>
<script>
<script>
import wepy from '@wepy/core';
import wepy from '@wepy/core';
import { getAwardsDetail, getPrizeList } from '../../common/api.js';
import { getAwardsDetail, getPrizeList } from '../../common/api.js';
...
...
src/pages/index.wpy
View file @
f582a698
...
@@ -229,12 +229,11 @@
...
@@ -229,12 +229,11 @@
</van-popup>
</van-popup>
</view>
</view>
</template>
</template>
<script>
<script>
import store from '../store';
import store from '../store';
import { mapState, mapActions } from '@wepy/x';
import { mapState, mapActions } from '@wepy/x';
import wepy from '@wepy/core';
import wepy from '@wepy/core';
import { debounce } from '../common/utils';
import { debounce
, compressShareImage
} from '../common/utils';
import Notify from '../components/vant/notify/notify';
import Notify from '../components/vant/notify/notify';
import Dialog from '../components/vant/dialog/dialog';
import Dialog from '../components/vant/dialog/dialog';
import { login, register, getMainInfo, addGold, getPrizeList, signIn, getActivityFeed, checkCornCode } from '../common/api.js';
import { login, register, getMainInfo, addGold, getPrizeList, signIn, getActivityFeed, checkCornCode } from '../common/api.js';
...
@@ -505,8 +504,7 @@
...
@@ -505,8 +504,7 @@
return {
return {
title: `${(this.$wepy.userInfo && this.$wepy.userInfo.nickName) || '您的好朋友'}邀请您来抽奖啦~`,
title: `${(this.$wepy.userInfo && this.$wepy.userInfo.nickName) || '您的好朋友'}邀请您来抽奖啦~`,
path: `/pages/index?openid=${openid}&prizeId=${this.$wepy.awardsInfo.id}`,
path: `/pages/index?openid=${openid}&prizeId=${this.$wepy.awardsInfo.id}`,
// todo: 图片大小减少了50%,但仍然偏大
imageUrl: compressShareImage(decodeURIComponent(this.$wepy.awardsInfo.photoUrl))
imageUrl: decodeURIComponent(this.$wepy.awardsInfo.photoUrl) + '?imageMogr2/auto-orient/thumbnail/500x800!/gravity/Center/crop/x500/blur/1x0/quality/75'
};
};
}
}
},
},
...
...
src/pages/raffle.wpy
View file @
f582a698
...
@@ -209,9 +209,10 @@
...
@@ -209,9 +209,10 @@
}
}
</style>
</style>
<template>
<template>
<view class="raffle-wrapper">
<view class="raffle-wrapper">
<view class="raffle-content">
<view class="raffle-content">
<van-image use-loading-slot src="{{
photoUrl
}}" class="img" width="610rpx" height="610rpx" radius="10rpx" fit="widthFix">
<van-image 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">
...
@@ -252,6 +253,7 @@
...
@@ -252,6 +253,7 @@
</view>
</view>
</view>
</view>
</template>
</template>
<wxs module="ic" src="../common/imageCompress.wxs"></wxs>
<script>
<script>
import wepy from '@wepy/core';
import wepy from '@wepy/core';
import Notify from '../components/vant/notify/notify';
import Notify from '../components/vant/notify/notify';
...
@@ -436,7 +438,7 @@
...
@@ -436,7 +438,7 @@
this.quantity = quantity || '';
this.quantity = quantity || '';
this.name = name;
this.name = name;
this.chance = chance;
this.chance = chance;
this.photoUrl = decodeURIComponent(photoUrl)
+ '?imageMogr2/auto-orient/thumbnail/500x/gravity/Center/crop/x600/blur/1x0/quality/75'
;
this.photoUrl = decodeURIComponent(photoUrl);
this.hasPhone = wx.getStorageSync('hasPhone');
this.hasPhone = wx.getStorageSync('hasPhone');
innerActivity = wx.getStorageSync('innerActivity');
innerActivity = wx.getStorageSync('innerActivity');
}
}
...
...
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