Commit 44816998 authored by ziyu's avatar ziyu

feat:细节优化

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