Commit fbc7b073 authored by 郝聪敏's avatar 郝聪敏

Merge branch 'feature/animation' into 'master'

优化

See merge request !42
parents b8b162ca b7eae932
...@@ -8,7 +8,7 @@ module.exports = { ...@@ -8,7 +8,7 @@ module.exports = {
register(params) { register(params) {
return http.post('/api/user/register', params, { 'content-type': 'application/json' }); return http.post('/api/user/register', params, { 'content-type': 'application/json' });
}, },
getUserInfo(params) { getMainInfo(params) {
return http.post('/api/user/main', params); return http.post('/api/user/main', params);
}, },
getAwardsInfo(params) { getAwardsInfo(params) {
......
...@@ -5,6 +5,7 @@ const env = 'test'; // 每次上线手动切换成 prod/test ...@@ -5,6 +5,7 @@ const env = 'test'; // 每次上线手动切换成 prod/test
let baseUrl = 'https://api-luckii.q-gp.com'; let baseUrl = 'https://api-luckii.q-gp.com';
if (env === 'test') { if (env === 'test') {
baseUrl = 'https://luckii-qa.liangkebang.net'; baseUrl = 'https://luckii-qa.liangkebang.net';
// baseUrl = 'https://luckiiapi.q-gp.com/yapi/mock/325';
} }
const request = async (url, options) => { const request = async (url, options) => {
const pages = getCurrentPages(); const pages = getCurrentPages();
......
...@@ -74,11 +74,11 @@ ...@@ -74,11 +74,11 @@
current="0" current="0"
bindanimationfinish="bindanimationfinish" bindanimationfinish="bindanimationfinish"
> >
<swiper-item class="{{item.photoUrl ? 'image-item' : 'video-item'}}" v-for="(item, idx) in curQueue" :key="item.id"> <swiper-item :class="{'image-item': item.showType && item.showType.value === 1}" v-for="(item, idx) in curQueue" :key="item.id">
<view class="video-wrapper"> <view class="video-wrapper">
<video <video
id="video_{{idx}}" id="video_{{idx}}"
class="video_item" class="video-item"
loop loop
show-center-play-btn="{{false}}" show-center-play-btn="{{false}}"
enable-progress-gesture="{{false}}" enable-progress-gesture="{{false}}"
...@@ -90,12 +90,12 @@ ...@@ -90,12 +90,12 @@
binderror="onError" binderror="onError"
bindtimeupdate="onTimeUpdate" bindtimeupdate="onTimeUpdate"
@tap="videoTap" @tap="videoTap"
v-if="!item.photoUrl" v-if="item.showType && item.showType.value === 2"
> >
<video-loading v-if="item.time === 0" :snapshot="item.snapshot"/> <video-loading v-if="item.time === 0" :snapshot="item.videoSnapUrl"/>
<video-pause :pause="pause"></video-pause> <video-pause :pause="pause"></video-pause>
</video> </video>
<image v-if="item.photoUrl" class="images" :src="item.photoUrl" mode="widthFix"></image> <image v-if="item.showType && item.showType.value === 1" class="images" :src="item.photoUrl" mode="widthFix"></image>
<view class="rightcont"> <view class="rightcont">
<view class="info">奖品库存: {{item.stock}}/{{item.totalStock}}</view> <view class="info">奖品库存: {{item.stock}}/{{item.totalStock}}</view>
<view class="info">中奖概率: {{item.probability}}</view> <view class="info">中奖概率: {{item.probability}}</view>
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
videoList () { videoList () {
const newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; const newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
this._videoListChanged(newVal); this._videoListChanged(newVal);
// this.compute(this.userAccount); this.compute(this.userAccount);
}, },
userAccount(newVal) { userAccount(newVal) {
this.compute(newVal); this.compute(newVal);
...@@ -154,6 +154,7 @@ ...@@ -154,6 +154,7 @@
async getProgress(id) { async getProgress(id) {
let detail = await getAwardsDetail({ prizeId: id }); let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {}; detail = detail || {};
if (detail.join > detail.quantity) detail.join = detail.quantity;
const progress = Math.round((detail.join / detail.quantity) * 100) + '%'; const progress = Math.round((detail.join / detail.quantity) * 100) + '%';
this.curQueue.forEach(v => { this.curQueue.forEach(v => {
...@@ -179,6 +180,7 @@ ...@@ -179,6 +180,7 @@
const current = e.$wx.detail.current; const current = e.$wx.detail.current;
this.pause = false; this.pause = false;
this.playCurrent(current); this.playCurrent(current);
this.trigger(e, 'change');
}, },
onError(e) { onError(e) {
this.trigger(e, 'error'); this.trigger(e, 'error');
...@@ -211,7 +213,6 @@ ...@@ -211,7 +213,6 @@
this.$emit('getAwardsInfo', { this.$emit('getAwardsInfo', {
id, id,
photoUrl, photoUrl,
quantity: this.userAccount,
name, name,
chance: probability chance: probability
}); });
...@@ -229,7 +230,11 @@ ...@@ -229,7 +230,11 @@
this.pause ? ctx.play() : ctx.pause(); this.pause ? ctx.play() : ctx.pause();
} }
}); });
this.pause = !this.pause; this.curQueue.forEach((item, index) => {
if (index === current && item.time !== 0) {
this.pause = !this.pause;
}
});
} }
} }
}); });
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
</template> </template>
<script> <script>
import wepy from '@wepy/core'; import wepy from '@wepy/core';
import store from '../../store';
import { mapState } from '@wepy/x';
const images = { const images = {
sign: { sign: {
notComplete: '/static/images/sign@2x.png', notComplete: '/static/images/sign@2x.png',
...@@ -56,6 +58,7 @@ ...@@ -56,6 +58,7 @@
lottery: '/static/images/lottery@2x.png' lottery: '/static/images/lottery@2x.png'
}; };
wepy.component({ wepy.component({
store,
data: { data: {
showAnimation: false, showAnimation: false,
addGold: false, addGold: false,
...@@ -98,6 +101,7 @@ ...@@ -98,6 +101,7 @@
} }
}, },
computed: { computed: {
...mapState(['safeAreaStyle']),
goldUrl() { goldUrl() {
let result = images['gold'].goldOne; let result = images['gold'].goldOne;
if (this.des === 2) { if (this.des === 2) {
...@@ -115,6 +119,9 @@ ...@@ -115,6 +119,9 @@
}, },
addGoldUrl: function() { addGoldUrl: function() {
return images['gold'].addGoldUrl; return images['gold'].addGoldUrl;
},
containerStyle() {
return 'position:relative; ' + this.safeAreaStyle;
} }
}, },
watch: { watch: {
...@@ -169,10 +176,6 @@ ...@@ -169,10 +176,6 @@
} }
} }
}, },
created() {
let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
statusHeight && (this.containerStyle = 'position:relative; top:' + statusHeight + 'px');
}
}); });
</script> </script>
<style lang="less"> <style lang="less">
......
This diff is collapsed.
...@@ -2,8 +2,11 @@ import Vuex from '@wepy/x'; ...@@ -2,8 +2,11 @@ import Vuex from '@wepy/x';
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
userInfo: '', userInfo: {
isConnected: true avatarUrl: '/static/images/user@2x.png'
},
isConnected: true,
safeAreaStyle: ''
}, },
mutations: { mutations: {
setInfo (state, info) { setInfo (state, info) {
...@@ -11,6 +14,9 @@ export default new Vuex.Store({ ...@@ -11,6 +14,9 @@ export default new Vuex.Store({
}, },
setIsConnected (state, isConnected) { setIsConnected (state, isConnected) {
state.isConnected = isConnected; state.isConnected = isConnected;
},
setSafeAreaStyle (state, safeAreaStyle) {
state.safeAreaStyle = safeAreaStyle;
} }
}, },
actions: { actions: {
...@@ -20,6 +26,9 @@ export default new Vuex.Store({ ...@@ -20,6 +26,9 @@ export default new Vuex.Store({
setIsConnected ({ commit }) { setIsConnected ({ commit }) {
const isConnected = wx.getStorageSync('onNetworkStatusChange'); const isConnected = wx.getStorageSync('onNetworkStatusChange');
commit('setIsConnected', isConnected); commit('setIsConnected', isConnected);
},
setSafeAreaStyle ({ commit }, safeAreaStyle) {
commit('setSafeAreaStyle', safeAreaStyle);
} }
} }
}); });
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