Commit 2fee3ff7 authored by 付清曌's avatar 付清曌

Merge branch 'feature/optimize3' into 'master'

Feature/optimize3

See merge request !36
parents 8cf89b36 7e9f6105
This diff is collapsed.
import wepy from '@wepy/core';
import Notify from '../components/vant/notify/notify';
const baseUrl = 'https://luckii-qa.liangkebang.net';
const env = 'test'; // 每次上线手动切换成 prod/test
let baseUrl = 'https://api-luckii.q-gp.com';
if (env === 'test') {
baseUrl = 'https://luckii-qa.liangkebang.net';
}
const request = async (url, options) => {
const pages = getCurrentPages();
const safeAreaInsetTop = pages && pages.length > 0 ? pages[pages.length - 1].route === 'pages/index' : false;
......@@ -39,10 +42,10 @@ const request = async (url, options) => {
return res.data.data;
}
Notify({ message: '服务器异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop });
throw new Error(res.data.msg || '服务器异常,请稍后重试');
throw new Error(res.data.msg || '服务器异常,请求url:' + url);
}
Notify({ message: '服务器异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop });
throw new Error(res.data.msg || '服务器异常,请稍后重试');
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) {
......
......@@ -43,7 +43,7 @@
<view class="help-info">
<view>1.打卡:每次可获得1克币,每天仅限打卡一次;</view>
<view>2.分享:通过分享每次邀请1名新的好友参加,即可获得10克币;</view>
<!--<view>3.购买:通过在Luckii购买产品即可获得克币,克币数量根据购买产品价格而定。</view>-->
<view>3.购买:通过在Luckii购买产品即可获得克币,克币数量根据购买产品价格而定。</view>
</view>
<view class="help-title">如何使用克币?</view>
<view class="help-info">
......
......@@ -41,6 +41,14 @@
height: 80rpx;
border-radius: 50%;
}
@-webkit-keyframes fadeout {
0% {
opacity:1 ;
}
100% {
opacity: 0;
}
}
.content{
position: absolute;
z-index: 9;
......@@ -48,6 +56,12 @@
width: 100%;
color: white;
clear: both;
&.anima {
animation:fadeout 2s;
}
&.hide {
display: none;
}
}
.leftcont {
width: 44%;
......@@ -206,15 +220,15 @@
<video-lottery type="lottery" des="抽奖" @getAwards="getAwards" @getUserInfo="getUserInfo" :authmodal="authmodal"></video-lottery>
<video-share type="share" des="分享"></video-share>
</view>
<view class="content">
<view class="content {{isActiveDone}}" >
<view class="leftcont">
<swiper
class="list-wrapper"
vertical="{{true}}"
circular="{{false}}"
circular="{{true}}"
display-multiple-items="{{activityDisplayItems}}"
bindchange="onActivityChange"
autoplay="{{autoplayActivity}}"
autoplay="{{isAuto}}"
interval="1500">
<swiper-item wx:for="{{activityList}}" wx:key="index" catch:touchmove>
<view class="imgwrap">
......@@ -285,13 +299,10 @@
data: {
list: [], // 商品list
// 活动信息
activityList: [],
activityDisplayItems: 2,
current: 5, // 商品列表初次展示第几个
// userInfo: {},
swiperItem: 2,
videoList: [],
length: 4,
......@@ -314,7 +325,8 @@
showAwardsModal: false,
awardsInfo: {},
isReceive: false,
autoplayActivity: false
isActiveDone: '',
isAuto:true,
},
computed: {
......@@ -595,7 +607,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) {
......@@ -605,7 +619,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;
......@@ -627,12 +641,15 @@
// 1期方案先一次取50
const list = await getActivityFeed({ count: 50 });
this.activityList = list;
this.autoplayActivity = true;
},
onActivityChange(e) {
const lastIndex = this.activityList.length - this.activityDisplayItems;
if (e.$wx.detail.current === lastIndex) {
this.autoplayActivity = false;
this.isActiveDone = 'anima';
setTimeout(() => {
this.isActiveDone = 'anima hide';
this.isAuto = false;
}, 2000);
}
}
},
......@@ -648,7 +665,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;
......
......@@ -85,15 +85,32 @@
margin-top:25rpx;
height:50rpx;
line-height: 50rpx;
.checkimg {
.checkimg{
display: inline-block;
width:24rpx;
height:24rpx;
border:3rpx solid #aaa;
border-radius: 4rpx;
vertical-align: middle;
margin-right:10rpx;
position: relative;
&.checked{
background-color: #FF5D15;
border:3rpx solid #FF5D15;
}
}
.checkicon {
position: absolute;
top:0;
left:0;
right:0;bottom:0;margin:0 auto;
&.hide {
display: none;
}
}
.checktext{
top: 2rpx;
margin-left:10rpx;
position: relative;
top:3rpx;
}
}
.joinin {
......@@ -127,7 +144,9 @@
</view>
</view>
<view class="user-wish" bindtap="check">
<image src="{{imgsrc}}" class="checkimg"></image>
<view class="checkimg {{isCheck?'checked':''}}">
<van-icon name="success" color="#fff" size="24rpx" class="checkicon {{isCheck?'':'hide'}}"/>
</view>
<text class="checktext">我同意花费所有克币参与抽奖,并承诺商品不退货。</text>
</view>
<button class="joinin" open-type="{{opentype}}" bindtap="joinin" bindgetphonenumber="getPhoneNumber">{{btnfont}}</button>
......@@ -215,22 +234,16 @@
}
},
async getProgress(id) {
const detail = await getAwardsDetail({ prizeId: id });
let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {};
this.batchId = detail.id;
this.progress = Math.round((detail.join / detail.quantity) * 100) + '%';
this.progressStyle = 'width:' + this.progress;
},
if (detail.quantity) {
this.progress = Math.round((detail.join / detail.quantity) * 100) + '%';
this.progressStyle = 'width:' + this.progress;
}
}
},
computed: {
imgsrc() {
let imgsrc = '/static/images/selected.png';
if (this.isCheck) {
imgsrc = '/static/images/selected.png';
} else {
imgsrc = '/static/images/selectno.png';
}
return imgsrc;
},
opentype() {
if (this.isCheck && !this.hasPhone) {
return 'getPhoneNumber';
......@@ -242,10 +255,6 @@
onLoad (query) {
let {prizeId, quantity, name, chance, photoUrl} = query;
this.getProgress(prizeId);
/*if (progress) {
this.progress = progress;
this.progressStyle = 'width:' + progress;
}*/
this.hasPhone = wx.getStorageSync('hasPhone');
this.quantity = quantity || '';
this.name = name;
......@@ -262,6 +271,7 @@
"van-image": "../components/vant/image/index",
"van-loading": "../components/vant/loading/index",
"van-dialog": "../components/vant/dialog/index",
"van-icon": "../components/vant/icon/index",
}
}
</config>
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