Commit 8cf89b36 authored by 付清曌's avatar 付清曌

Merge branch 'feature/optimize2' into 'master'

feat: 改成测试环境,修改bug

See merge request !35
parents 13765a50 860d0e5c
<style> <style>
page { page {
font-family: 'PingFangSC-Regular'; font-family: 'PingFangSC-Regular',monospace;
width:100%; width:100%;
height:100%; height:100%;
background-color:#F1F1F1; background-color:#F1F1F1;
......
import wepy from '@wepy/core'; import wepy from '@wepy/core';
import Notify from '../components/vant/notify/notify'; import Notify from '../components/vant/notify/notify';
const baseUrl = 'https://api-luckii.q-gp.com'; const baseUrl = 'https://luckii-qa.liangkebang.net';
const request = async (url, options) => { const request = async (url, options) => {
const pages = getCurrentPages(); const pages = getCurrentPages();
......
...@@ -35,15 +35,15 @@ ...@@ -35,15 +35,15 @@
position: relative; position: relative;
.text { .text {
position: absolute; position: absolute;
top: 0; top:0;
left: 0; left:0;
width: 100%; width:100%;
height: 100%; height:100%;
z-index: 2; z-index: 2;
background-color: transparent;
text-align: center; text-align: center;
line-height:20rpx;
background-color: transparent;
font-size: 18rpx; font-size: 18rpx;
line-height: 20rpx;
} }
.orange { .orange {
width: 0; width: 0;
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
this.loading = false; this.loading = false;
if (!newVal.length) return; if (!newVal.length) return;
this._videoListChanged(newVal); this._videoListChanged(newVal);
this.compute(this.userAccount); // this.compute(this.userAccount);
}, },
userAccount(newVal) { userAccount(newVal) {
this.compute(newVal); this.compute(newVal);
...@@ -178,7 +178,6 @@ ...@@ -178,7 +178,6 @@
methods: { methods: {
compute (newVal) { compute (newVal) {
if (!this.curQueue.length) return; if (!this.curQueue.length) return;
this.nextQueue.forEach(v => { this.nextQueue.forEach(v => {
v.probability = getProbability(+newVal, +v.coinQuantity); v.probability = getProbability(+newVal, +v.coinQuantity);
}); });
...@@ -235,6 +234,7 @@ ...@@ -235,6 +234,7 @@
}); });
if (!this.curQueue.length) { if (!this.curQueue.length) {
this.curQueue = this.nextQueue.splice(0, 3); this.curQueue = this.nextQueue.splice(0, 3);
this.compute(this.userAccount);
this.playCurrent(1); this.playCurrent(1);
} }
}, },
...@@ -320,17 +320,16 @@ ...@@ -320,17 +320,16 @@
this.curQueue = [...this.curQueue]; this.curQueue = [...this.curQueue];
} }
}, },
async playCurrent(current) { playCurrent(current) {
if (!this.curQueue || this.curQueue.length <= 1) return; if (!this.curQueue || this.curQueue.length <= 1) return;
await this.getProgress(this.curQueue[current].id); this.getProgress(this.curQueue[current].id);
const { batchId, photoUrl, name, probability, progress } = this.curQueue[current]; const { id, photoUrl, name, probability } = this.curQueue[current];
this.$emit('getAwardsInfo', { this.$emit('getAwardsInfo', {
batchId, id,
photoUrl, photoUrl,
quantity: this.userAccount, quantity: this.userAccount,
name, name,
chance: probability, chance: probability,
progress: progress
}); });
// this._videoContexts.forEach((ctx, index) => { // this._videoContexts.forEach((ctx, index) => {
// if (index !== current) { // if (index !== current) {
......
...@@ -573,8 +573,8 @@ ...@@ -573,8 +573,8 @@
}; };
}, },
getAwards: function() { getAwards: function() {
const { batchId, photoUrl, quantity, name, chance, progress } = this.awardsInfo; const { id, photoUrl, quantity, name, chance } = this.awardsInfo;
if (!batchId || !this.mainInfo || !this.mainInfo.account) { if (!id || !this.mainInfo || !this.mainInfo.account) {
Notify({ message: '服务器异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop: true }); Notify({ message: '服务器异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop: true });
return; return;
} }
...@@ -583,7 +583,7 @@ ...@@ -583,7 +583,7 @@
return; return;
} }
wx.navigateTo({ wx.navigateTo({
url: `/pages/raffle?batchId=${batchId}&progress=${progress}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}` url: `/pages/raffle?prizeId=${id}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}`
}); });
}, },
getAwardsInfo: function(v) { getAwardsInfo: function(v) {
......
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
import wepy from '@wepy/core'; import wepy from '@wepy/core';
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 { updateUserPhone, confirmRaffle, register } from '../common/api'; import { updateUserPhone, confirmRaffle, register, login, getAwardsDetail } from '../common/api';
import store from '../store'; import store from '../store';
wepy.page({ wepy.page({
store, store,
...@@ -174,15 +174,9 @@ ...@@ -174,15 +174,9 @@
} }
if (detail.encryptedData) { if (detail.encryptedData) {
this.btnfont = '提交中...'; this.btnfont = '提交中...';
wx.checkSession({ const { code } = await wepy.wx.login();
success () { await login(code);
goprize(); goprize();
},
async fail () {
await wepy.wx.login();
goprize();
}
});
} else { } else {
Notify({message: '参与失败,请重新授权!', background: '#FF5D15'}); Notify({message: '参与失败,请重新授权!', background: '#FF5D15'});
} }
...@@ -219,7 +213,13 @@ ...@@ -219,7 +213,13 @@
if (this.hasPhone) { if (this.hasPhone) {
this.confirmRaff(); this.confirmRaff();
} }
} },
async getProgress(id) {
const detail = await getAwardsDetail({ prizeId: id });
this.batchId = detail.id;
this.progress = Math.round((detail.join / detail.quantity) * 100) + '%';
this.progressStyle = 'width:' + this.progress;
},
}, },
computed: { computed: {
imgsrc() { imgsrc() {
...@@ -240,13 +240,13 @@ ...@@ -240,13 +240,13 @@
} }
}, },
onLoad (query) { onLoad (query) {
let {batchId, quantity, name, chance, photoUrl, progress} = query; let {prizeId, quantity, name, chance, photoUrl} = query;
if (progress) { this.getProgress(prizeId);
/*if (progress) {
this.progress = progress; this.progress = progress;
this.progressStyle = 'width:' + progress; this.progressStyle = 'width:' + progress;
} }*/
this.hasPhone = wx.getStorageSync('hasPhone'); this.hasPhone = wx.getStorageSync('hasPhone');
this.batchId = batchId;
this.quantity = quantity || ''; this.quantity = quantity || '';
this.name = name; this.name = name;
this.chance = chance; this.chance = chance;
......
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