Commit 44816998 authored by ziyu's avatar ziyu

feat:细节优化

parent bd9275d7
import wepy from '@wepy/core';
import Notify from '../components/vant/notify/notify';
const env = 'test'; //每次上线手动切换成 prod/test
const env = 'test'; // 每次上线手动切换成 prod/test
let baseUrl = 'https://api-luckii.q-gp.com';
if(env === 'test') {
baseUrl = 'https://luckii-qa.liangkebang.net'
if (env === 'test') {
baseUrl = 'https://luckii-qa.liangkebang.net';
}
const request = async (url, options) => {
const pages = getCurrentPages();
......@@ -42,10 +42,10 @@ const request = async (url, options) => {
return res.data.data;
}
Notify({ message: '服务器异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop });
throw new Error(res.data.msg || '服务器异常,请求url:'+url);
throw new Error(res.data.msg || '服务器异常,请求url:' + url);
}
Notify({ message: '服务器异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop });
throw new Error(res.data.msg || '服务器异常,请求url:'+url);
throw new Error(res.data.msg || '服务器异常,请求url:' + url);
});
};
......
......@@ -195,7 +195,8 @@
this.prevQueue = [...this.prevQueue];
},
async getProgress(id) {
const detail = await getAwardsDetail({ prizeId: id });
let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {};
const progress = Math.round((detail.join / detail.quantity) * 100) + '%';
this.nextQueue.forEach(v => {
if (v.id === id) {
......@@ -329,7 +330,7 @@
photoUrl,
quantity: this.userAccount,
name,
chance: probability,
chance: probability
});
// this._videoContexts.forEach((ctx, index) => {
// if (index !== current) {
......
......@@ -325,7 +325,7 @@
showAwardsModal: false,
awardsInfo: {},
isReceive: false,
isActiveDone:'',
isActiveDone: ''
},
computed: {
......@@ -606,7 +606,9 @@
getSharedGold: async function(v) {
this.showShareModal = false;
await addGold(v);
this.mainInfo.account.quantity += v.quantity;
let account = this.mainInfo.account || {};
let quantity = account.quantity || 0;
this.mainInfo.account.quantity = quantity + v.quantity;
this.isReceive = true;
setTimeout(() => {
if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
......@@ -616,7 +618,7 @@
},
getMainInfo: async function() {
this.mainInfo = await getUserInfo(wx.getStorageSync('openId'));
this.sign = this.mainInfo.signin;
this.sign = this.mainInfo && this.mainInfo.signin;
wx.setStorageSync('hasPhone', this.mainInfo.phone);
if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {
this.showShareModal = true;
......@@ -643,9 +645,9 @@
const lastIndex = this.activityList.length - this.activityDisplayItems;
if (e.$wx.detail.current === lastIndex) {
this.isActiveDone = 'anima';
setTimeout(()=>{
setTimeout(() => {
this.isActiveDone = 'anima hide';
},2000)
}, 2000);
}
}
},
......@@ -661,7 +663,8 @@
if (!wx.getStorageSync('openId')) {
const { code } = await wepy.wx.login();
const userInfo = await login(code);
let userInfo = await login(code);
userInfo = userInfo || {};
wx.setStorageSync('openId', userInfo.openid);
wx.setStorageSync('isRegister', userInfo.register);
}
......
......@@ -202,7 +202,6 @@
if (!joinRecordId) Notify({message: '缺少参数错误!', background: '#FF5D15'});
// 请求接口得到数据
getOneRaffle({joinRecordId: joinRecordId}).then(data => {
console.log(555, data);
let dat = data || {};
this.prize = dat.prize;
this.quantity = dat.quantity;
......
......@@ -234,11 +234,14 @@
}
},
async getProgress(id) {
const detail = await getAwardsDetail({ prizeId: id });
let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {};
this.batchId = detail.id;
if (detail.quantity) {
this.progress = Math.round((detail.join / detail.quantity) * 100) + '%';
this.progressStyle = 'width:' + this.progress;
},
}
}
},
computed: {
opentype() {
......
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