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

优化

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