Commit b86b4ff9 authored by 付清曌's avatar 付清曌

Merge branch 'feature/optimize' into 'master'

Feature/optimize

See merge request !56
parents cc931467 fcaabcd5
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
import wepy from '@wepy/core'; import wepy from '@wepy/core';
import { getProbability } from '../../common/raffleProbability'; import { getProbability } from '../../common/raffleProbability';
import { getAwardsDetail } from '../../common/api.js'; import { getAwardsDetail } from '../../common/api.js';
let _videoContexts = [], videoCurrent = 0;
wepy.component({ wepy.component({
props: { props: {
videoList: { videoList: {
...@@ -131,8 +131,6 @@ ...@@ -131,8 +131,6 @@
data: { data: {
pause: false, pause: false,
curQueue: [], curQueue: [],
_videoContexts: [],
current: 0
}, },
watch: { watch: {
videoList () { videoList () {
...@@ -154,7 +152,7 @@ ...@@ -154,7 +152,7 @@
v.probability = getProbability(+newVal, +v.coinQuantity); v.probability = getProbability(+newVal, +v.coinQuantity);
}); });
this.curQueue = [...this.curQueue]; this.curQueue = [...this.curQueue];
this.updateAwardsInfo(this.current); this.updateAwardsInfo(videoCurrent);
}, },
async getProgress(id) { async getProgress(id) {
if (id <= 0) return; if (id <= 0) return;
...@@ -177,7 +175,7 @@ ...@@ -177,7 +175,7 @@
}, },
_videoListChanged (newVal) { _videoListChanged (newVal) {
this.curQueue = newVal.map((item, index) => { this.curQueue = newVal.map((item, index) => {
this._videoContexts.push(item.videoUrl ? wx.createVideoContext(`video_${index}`, this.$wx) : null); _videoContexts.push(item.videoUrl ? wx.createVideoContext(`video_${index}`, this.$wx) : null);
item.time = 0; item.time = 0;
return item; return item;
}); });
...@@ -188,7 +186,7 @@ ...@@ -188,7 +186,7 @@
}, },
async bindanimationfinish(e) { async bindanimationfinish(e) {
const current = e.$wx.detail.current; const current = e.$wx.detail.current;
this.current = current; videoCurrent = current;
this.pause = false; this.pause = false;
this.playCurrent(current); this.playCurrent(current);
this.trigger(e, 'change'); this.trigger(e, 'change');
...@@ -220,7 +218,7 @@ ...@@ -220,7 +218,7 @@
playCurrent(current) { playCurrent(current) {
if (!this.curQueue || this.curQueue.length <= 1) return; if (!this.curQueue || this.curQueue.length <= 1) return;
// 播放当前视频 // 播放当前视频
this._videoContexts.forEach((ctx, index) => { _videoContexts.forEach((ctx, index) => {
if (index !== current) { if (index !== current) {
ctx && ctx.pause(); ctx && ctx.pause();
} else { } else {
...@@ -240,7 +238,7 @@ ...@@ -240,7 +238,7 @@
}, },
videoTap(e) { videoTap(e) {
const current = e.currentTarget.dataset.index; const current = e.currentTarget.dataset.index;
this._videoContexts.forEach((ctx, index) => { _videoContexts.forEach((ctx, index) => {
if (index === current) { if (index === current) {
this.pause ? ctx.play() : ctx.pause(); this.pause ? ctx.play() : ctx.pause();
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</div> </div>
<div class="show-gold"> <div class="show-gold">
<div class="sunshine" v-if="addsunshine"></div> <div class="sunshine" v-if="addsunshine"></div>
<image class="show-gold-image" :class="{'gold-scale': addsunshine}" :src="goldUrl"></image> <image class="show-gold-image" :class="{'gold-scale': addsunshine}" :src="goldUrl" mode="widthFix"></image>
<span class="show-gold-num"> <span class="show-gold-num">
{{des}} {{des}}
</span> </span>
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
share: '/static/images/share@2x.png', share: '/static/images/share@2x.png',
lottery: '/static/images/lottery@2x.png' lottery: '/static/images/lottery@2x.png'
}; };
let isFirst = true;
let addGoldTimer = null; let addGoldTimer = null;
wepy.component({ wepy.component({
store, store,
...@@ -73,7 +74,6 @@ ...@@ -73,7 +74,6 @@
lotteryUrl: '/static/images/lottery@2x.png', lotteryUrl: '/static/images/lottery@2x.png',
containerStyle: '', containerStyle: '',
flyAnimation: false, flyAnimation: false,
isFirst: true
}, },
props: { props: {
title: '', title: '',
...@@ -144,8 +144,8 @@ ...@@ -144,8 +144,8 @@
if (v) { if (v) {
this.addCount = 0; this.addCount = 0;
} }
if (this.isFirst) { if (isFirst) {
this.isFirst = false; isFirst = false;
return; return;
} }
setTimeout(() => { setTimeout(() => {
...@@ -153,11 +153,11 @@ ...@@ -153,11 +153,11 @@
}, 1500); }, 1500);
}, },
sign(v) { sign(v) {
if (this.isFirst) { if (isFirst) {
this.signComplete = false; this.signComplete = false;
this.flyAnimation = false; this.flyAnimation = false;
this.addsunshine = false; this.addsunshine = false;
this.isFirst = false; isFirst = false;
return; return;
} }
if (v) { if (v) {
...@@ -414,7 +414,7 @@ ...@@ -414,7 +414,7 @@
flex-direction: column; flex-direction: column;
.show-gold-image { .show-gold-image {
width: 60rpx; width: 60rpx;
height: 60rpx; /*height: 60rpx;*/
z-index: 2; z-index: 2;
} }
.show-gold-num { .show-gold-num {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</template> </template>
<script> <script>
import wepy from '@wepy/core'; import wepy from '@wepy/core';
wepy.component({ wepy.component({
methods: { methods: {
onShareAppMessage: function(res) { onShareAppMessage: function(res) {
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
// transform: scale(0.5); // transform: scale(0.5);
// top: calc(100% - 1px); // top: calc(100% - 1px);
// left: 100%; // left: 100%;
background: url('http://activitystatic.xyqb.com/sign@2x.png') 0 0/contain no-repeat; background: url('https://activitystatic.xyqb.com/sign@2x.png') 0 0/contain no-repeat;
// background: -webkit-linear-gradient(45deg,rgba(255,255,255,0),yellow,rgba(255,255,255,0)); // background: -webkit-linear-gradient(45deg,rgba(255,255,255,0),yellow,rgba(255,255,255,0));
/*此处为下一步的添加动画*/ /*此处为下一步的添加动画*/
// -webkit-animation: shining 3s ease-in-out infinite; // -webkit-animation: shining 3s ease-in-out infinite;
......
...@@ -206,6 +206,7 @@ ...@@ -206,6 +206,7 @@
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';
let flag = false; let flag = false;
let awardsInfo = {};
wepy.page({ wepy.page({
store, store,
data: { data: {
...@@ -217,7 +218,6 @@ ...@@ -217,7 +218,6 @@
inviter: '', inviter: '',
mainInfo: null, mainInfo: null,
showModal: 0, // 1: 展示领取金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗 showModal: 0, // 1: 展示领取金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗
awardsInfo: {},
isReceive: false, // 是否显示领取克币动画 isReceive: false, // 是否显示领取克币动画
cornModal: false, cornModal: false,
cornCode: '', // 克币充值码 cornCode: '', // 克币充值码
...@@ -315,8 +315,8 @@ ...@@ -315,8 +315,8 @@
const openid = wx.getStorageSync('openId'); const openid = wx.getStorageSync('openId');
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=${awardsInfo.id}`,
imageUrl: decodeURIComponent(this.$wepy.awardsInfo.photoUrl), imageUrl: decodeURIComponent(awardsInfo.photoUrl),
success: function(res) { success: function(res) {
let shareId = res.shareTickets[0]; let shareId = res.shareTickets[0];
console.log('shareId', shareId); console.log('shareId', shareId);
...@@ -327,7 +327,7 @@ ...@@ -327,7 +327,7 @@
}; };
}, },
getAwards: function() { getAwards: function() {
const { id, photoUrl, name, chance } = this.awardsInfo; const { id, photoUrl, name, chance } = awardsInfo;
if ((!id && id !== 0) || !this.mainInfo || !this.mainInfo.account) { if ((!id && id !== 0) || !this.mainInfo || !this.mainInfo.account) {
Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop: true }); Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop: true });
return; return;
...@@ -346,7 +346,7 @@ ...@@ -346,7 +346,7 @@
}); });
}, },
getAwardsInfo: function(v) { getAwardsInfo: function(v) {
this.awardsInfo = v; awardsInfo = v;
}, },
showMenu: function(v) { showMenu: function(v) {
this.showModal = v ? 3 : 0; this.showModal = v ? 3 : 0;
......
...@@ -253,21 +253,19 @@ ...@@ -253,21 +253,19 @@
import Dialog from '../components/vant/dialog/dialog'; import Dialog from '../components/vant/dialog/dialog';
import { updateUserPhone, confirmRaffle, register, login, getAwardsDetail, checkInnerCode } from '../common/api'; import { updateUserPhone, confirmRaffle, register, login, getAwardsDetail, checkInnerCode } from '../common/api';
import store from '../store'; import store from '../store';
let hasPhone = false, innerActivity= '', batchId = null;
wepy.page({ wepy.page({
store, store,
data: { data: {
progress: '0%', progress: '0%',
progressStyle: 'width:0%', progressStyle: 'width:0%',
isCheck: true, isCheck: true,
batchId: null,
quantity: '', quantity: '',
name: '', name: '',
chance: '', chance: '',
photoUrl: '', photoUrl: '',
btnfont: '立即参与', btnfont: '立即参与',
hasPhone: false,
isInnerDone: 'hide', isInnerDone: 'hide',
innerActivity: '',
isError: false, isError: false,
code: '', code: '',
errorText: '', errorText: '',
...@@ -285,8 +283,8 @@ ...@@ -285,8 +283,8 @@
function goprize() { function goprize() {
updateUserPhone(detail).then(() => { updateUserPhone(detail).then(() => {
wx.setStorageSync('hasPhone', true); wx.setStorageSync('hasPhone', true);
that.hasPhone = true;
that.btnfont = '立即参与'; that.btnfont = '立即参与';
hasPhone = true;
that.joinin(); that.joinin();
}).catch(() => { }).catch(() => {
that.btnfont = '立即参与'; that.btnfont = '立即参与';
...@@ -319,12 +317,12 @@ ...@@ -319,12 +317,12 @@
await register(store.state.userInfo); await register(store.state.userInfo);
wx.setStorageSync('isRegister', true); wx.setStorageSync('isRegister', true);
} }
if (!this.batchId) { if (!batchId) {
Notify({message: '数据加载中,请稍后重试!'}); Notify({message: '数据加载中,请稍后重试!'});
return; return;
} }
this.btnfont = '参与中...'; this.btnfont = '参与中...';
confirmRaffle({batchId: this.batchId}).then(data => { confirmRaffle({batchId: batchId}).then(data => {
this.btnfont = '立即参与'; this.btnfont = '立即参与';
let code = data.joinCode; let code = data.joinCode;
if (code === undefined) code = 3; if (code === undefined) code = 3;
...@@ -347,9 +345,9 @@ ...@@ -347,9 +345,9 @@
Notify({message: '勾选同意后才可以抽奖!'}); Notify({message: '勾选同意后才可以抽奖!'});
return; return;
} }
if (this.hasPhone) { if (hasPhone) {
// 当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal // 当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal
if (this.innerActivity && !this.innerActivity.haveCode && !this.innerActivity.vip) { if (innerActivity && !innerActivity.haveCode && !innerActivity.vip) {
this.showModal(); this.showModal();
} else { } else {
this.confirmRaff(); this.confirmRaff();
...@@ -359,7 +357,7 @@ ...@@ -359,7 +357,7 @@
async getProgress(id) { async getProgress(id) {
let detail = await getAwardsDetail({ prizeId: id }); let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {}; detail = detail || {};
this.batchId = detail.id; batchId = detail.id;
if (detail.quantity) { if (detail.quantity) {
if (detail.join > detail.quantity) detail.join = detail.quantity; if (detail.join > detail.quantity) detail.join = detail.quantity;
const progressFloat = detail.join / detail.quantity * 100; const progressFloat = detail.join / detail.quantity * 100;
...@@ -408,7 +406,7 @@ ...@@ -408,7 +406,7 @@
}, },
computed: { computed: {
opentype() { opentype() {
if (this.isCheck && !this.hasPhone) { if (this.isCheck && !hasPhone) {
return 'getPhoneNumber'; return 'getPhoneNumber';
} else { } else {
return ''; return '';
...@@ -425,12 +423,12 @@ ...@@ -425,12 +423,12 @@
onLoad (query) { onLoad (query) {
let {prizeId, quantity, name, chance, photoUrl} = query; let {prizeId, quantity, name, chance, photoUrl} = query;
this.getProgress(prizeId); this.getProgress(prizeId);
this.hasPhone = wx.getStorageSync('hasPhone');
this.quantity = quantity || ''; this.quantity = quantity || '';
this.name = name; this.name = name;
this.chance = chance; this.chance = chance;
this.photoUrl = decodeURIComponent(photoUrl); this.photoUrl = decodeURIComponent(photoUrl);
this.innerActivity = wx.getStorageSync('innerActivity'); hasPhone = wx.getStorageSync('hasPhone');
innerActivity = wx.getStorageSync('innerActivity');
} }
}); });
</script> </script>
......
static/images/awards@2x.png

793 Bytes | W: | H:

static/images/awards@2x.png

368 Bytes | W: | H:

static/images/awards@2x.png
static/images/awards@2x.png
static/images/awards@2x.png
static/images/awards@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/btn-shadow@2x.png

1.2 KB | W: | H:

static/images/btn-shadow@2x.png

639 Bytes | W: | H:

static/images/btn-shadow@2x.png
static/images/btn-shadow@2x.png
static/images/btn-shadow@2x.png
static/images/btn-shadow@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/feedback@2x.png

663 Bytes | W: | H:

static/images/feedback@2x.png

303 Bytes | W: | H:

static/images/feedback@2x.png
static/images/feedback@2x.png
static/images/feedback@2x.png
static/images/feedback@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/gold-1@2x.png

1.42 KB | W: | H:

static/images/gold-1@2x.png

547 Bytes | W: | H:

static/images/gold-1@2x.png
static/images/gold-1@2x.png
static/images/gold-1@2x.png
static/images/gold-1@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/gold-2@2x.png

1.8 KB | W: | H:

static/images/gold-2@2x.png

688 Bytes | W: | H:

static/images/gold-2@2x.png
static/images/gold-2@2x.png
static/images/gold-2@2x.png
static/images/gold-2@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/gold-3@2x.png

2.09 KB | W: | H:

static/images/gold-3@2x.png

739 Bytes | W: | H:

static/images/gold-3@2x.png
static/images/gold-3@2x.png
static/images/gold-3@2x.png
static/images/gold-3@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/gold-4@2x.png

2.95 KB | W: | H:

static/images/gold-4@2x.png

930 Bytes | W: | H:

static/images/gold-4@2x.png
static/images/gold-4@2x.png
static/images/gold-4@2x.png
static/images/gold-4@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/gold-5@2x.png

3.87 KB | W: | H:

static/images/gold-5@2x.png

1.11 KB | W: | H:

static/images/gold-5@2x.png
static/images/gold-5@2x.png
static/images/gold-5@2x.png
static/images/gold-5@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/gold-6@2x.png

4.35 KB | W: | H:

static/images/gold-6@2x.png

1.37 KB | W: | H:

static/images/gold-6@2x.png
static/images/gold-6@2x.png
static/images/gold-6@2x.png
static/images/gold-6@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/gold-bg@2x.png

10.4 KB | W: | H:

static/images/gold-bg@2x.png

3.92 KB | W: | H:

static/images/gold-bg@2x.png
static/images/gold-bg@2x.png
static/images/gold-bg@2x.png
static/images/gold-bg@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/gold@2x.png

24.7 KB | W: | H:

static/images/gold@2x.png

7.49 KB | W: | H:

static/images/gold@2x.png
static/images/gold@2x.png
static/images/gold@2x.png
static/images/gold@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/help@2x.png

2.08 KB | W: | H:

static/images/help@2x.png

804 Bytes | W: | H:

static/images/help@2x.png
static/images/help@2x.png
static/images/help@2x.png
static/images/help@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/light-1@2x.png

92.6 KB | W: | H:

static/images/light-1@2x.png

33 KB | W: | H:

static/images/light-1@2x.png
static/images/light-1@2x.png
static/images/light-1@2x.png
static/images/light-1@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/lottery@2x.png

5.85 KB | W: | H:

static/images/lottery@2x.png

2.09 KB | W: | H:

static/images/lottery@2x.png
static/images/lottery@2x.png
static/images/lottery@2x.png
static/images/lottery@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/share@2x.png

3.42 KB | W: | H:

static/images/share@2x.png

1.36 KB | W: | H:

static/images/share@2x.png
static/images/share@2x.png
static/images/share@2x.png
static/images/share@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/sign@2x.png

5.9 KB | W: | H:

static/images/sign@2x.png

2.57 KB | W: | H:

static/images/sign@2x.png
static/images/sign@2x.png
static/images/sign@2x.png
static/images/sign@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/star@2x.png

5.87 KB | W: | H:

static/images/star@2x.png

1.54 KB | W: | H:

static/images/star@2x.png
static/images/star@2x.png
static/images/star@2x.png
static/images/star@2x.png
  • 2-up
  • Swipe
  • Onion skin
static/images/user@2x.png

4.95 KB | W: | H:

static/images/user@2x.png

1.59 KB | W: | H:

static/images/user@2x.png
static/images/user@2x.png
static/images/user@2x.png
static/images/user@2x.png
  • 2-up
  • Swipe
  • Onion skin
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