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