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