Commit cc931467 authored by 付清曌's avatar 付清曌

Merge branch 'feature/corn2' into 'master'

Feature/corn2

See merge request !55
parents aec3a247 2b4b7b8d
This diff is collapsed.
......@@ -53,5 +53,5 @@ module.exports = {
},
checkCornCode(params) {
return http.post('/api/user/addCoins', params);
},
}
};
......@@ -16,7 +16,7 @@ function getProbability (quantity, coinQuantity) {
var value2 = coinQuantity / divisor;
// 如果分子比分母大说明中奖概率是100%,那么返回中奖概率
if (value >= value2) {
return coinQuantity + '/' + coinQuantity;
return '100%';
} else {
return value + '/' + value2;
}
......
......@@ -4,7 +4,7 @@
<swiper
class="list-wrapper"
vertical="{{true}}"
circular="{{true}}"
circular="{{false}}"
display-multiple-items="{{activityDisplayItems}}"
bindchange="onActivityChange"
autoplay="{{isAuto}}"
......@@ -45,10 +45,13 @@
onActivityChange(e) {
const lastIndex = this.list.length - this.activityDisplayItems;
if (e.$wx.detail.current === lastIndex) {
this.isAuto = false;
// 当最后一个出来的时候等一秒再消失
setTimeout(() => {
this.isActiveDone = 'anima';
setTimeout(() => {
this.isActiveDone = 'anima hide';
this.isAuto = false;
}, 2000);
}, 2000);
}
}
......
......@@ -54,17 +54,17 @@
watch: {
goodsList(val) {
/* let list = val || [];
this.list = list;*/
this.list = list; */
}
},
created() {
//获取推荐的商品列表
// 获取推荐的商品列表
this.list = [{value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
{value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'},
{value: 13, text: '白色条纹马克杯,马克吐温同款13', imgsrc: '/static/images/peo1.jpg', price: '¥39.08', people: 2200, sku: '100004549235'},
{value: 14, text: '白色条纹马克杯,马克吐温同款14', imgsrc: '/static/images/peo2.jpg', price: '¥599.20', people: 2200, sku: '100004549235'},
{value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'},{value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
{value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'},
{value: 15, text: '白色条纹马克杯,马克吐温同款15', imgsrc: '/static/images/peo3.jpg', price: '¥2399.01', people: 2200, sku: '100004549235'}, {value: 11, text: '白色条纹马克杯,马克吐温同款11', imgsrc: '/static/images/test1.jpg', price: '¥9.89', people: 2200, sku: '100004549235'},
{value: 12, text: '白色条纹马克杯,马克吐温同款12', imgsrc: '/static/images/test2.png', price: '¥19.20', people: '2200', sku: '100004549235'}
];
},
methods: {
......@@ -116,9 +116,8 @@
that.lastPage += 1;
if (that.lastPage + that.topPage >= totalPage) {
that.circular = true;
return;
}
// that.list = [...that.list, ...nextlist];
that.list = [...that.list, ...nextlist];
}, 1000), 500);
}
}
......@@ -200,22 +199,22 @@
if (list.length <= 4) {
this.circular = false;
}
console.log(current.itemid,this.currentIndex,this.current,111)
console.log(current.itemid, this.currentIndex, this.current, 111);
if (current.itemid >= list.length - 1) {
this.current = this.currentIndex - 1;
}
setTimeout(function() {
let newlist = that.list.filter((item, index) => index !== +current.itemid);
// 正常情况下,current.itemid都会比current大一个,当相等或小于的时候就有问题,要重新设置current,最小不能超过0
if(newlist.length <= that.swiperItem) {
if (newlist.length <= that.swiperItem) {
that.swiperItem = newlist.length;
}
that.list = newlist;
if (current.itemid - that.current !==1 ) {
if (current.itemid - that.current !== 1) {
that.current = Math.max(that.current - 1, 0);
}
//删除完成之后
console.log(current.itemid,that.currentIndex,that.current,222)
// 删除完成之后
console.log(current.itemid, that.currentIndex, that.current, 222);
}, 500);
}
}
......
......@@ -62,7 +62,7 @@
created() {
let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
statusHeight && (this.popupStyle = 'top:' + (statusHeight + 56) + 'px');
},
}
});
</script>
<style lang="less">
......
......@@ -161,8 +161,8 @@
let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {};
if (detail.join > detail.quantity) detail.join = detail.quantity;
const progressFloat = detail.join / detail.quantity;
let progress = Math.round(progressFloat * 100) + '%';
const progressFloat = detail.join / detail.quantity * 100;
let progress = Math.round(progressFloat) + '%';
if (progressFloat > 0 && progressFloat < 1) progress = '1%';
this.curQueue.forEach(v => {
......
......@@ -99,7 +99,7 @@
authmodal: {
type: Boolean,
default: false
},
}
},
computed: {
...mapState(['safeAreaStyle']),
......@@ -185,7 +185,7 @@
showCornModal() {
this.$emit('showCorn');
}
},
}
});
</script>
<style lang="less">
......
......@@ -205,6 +205,7 @@
import Notify from '../components/vant/notify/notify';
import Dialog from '../components/vant/dialog/dialog';
import { login, register, getMainInfo, addGold, getPrizeList, signIn, getActivityFeed, checkCornCode } from '../common/api.js';
let flag = false;
wepy.page({
store,
data: {
......@@ -218,18 +219,18 @@
showModal: 0, // 1: 展示领取金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗
awardsInfo: {},
isReceive: false, // 是否显示领取克币动画
cornModal:false,
cornCode: '', //克币充值码
cornText:'',
cornTextShow: false,
cornModal: false,
cornCode: '', // 克币充值码
cornText: '',
cornTextShow: false
},
computed: {
...mapState([ 'isConnected', 'userInfo', 'safeAreaStyle' ])
},
watch: {
cornCode(val,oldval) {
if (val!==oldval && this.cornTextShow) {
cornCode(val, oldval) {
if (val !== oldval && this.cornTextShow) {
this.cornTextShow = false;
}
}
......@@ -410,25 +411,24 @@
this.cornModal = false;
},
checkCode() {
if(this.cornCode == '') {
if (this.cornCode === '') {
this.cornText = '请输入克币充值码';
this.cornTextShow = true;
return;
}
const msg = ['充值码无效,请重新输入','该充值码已被使用,请重新输入'];
checkCornCode({code:this.cornCode}).then(data=>{
if(data.code === 0){
//充值成功
const msg = ['充值码无效,请重新输入', '该充值码已被使用,请重新输入'];
checkCornCode({code: this.cornCode}).then(data => {
if (data.code === 0) {
// 充值成功
this.cornModal = false;
this.mainInfo.account.quantity = data.accountCoins;
this.isReceive = true;
} else {
const msgindex = data.code+2;
const msgindex = data.code + 2;
this.cornText = msg[msgindex];
this.cornTextShow = true;
}
});
},
resetAddGold() {
this.isReceive = false;
......@@ -447,6 +447,8 @@
// 获取openid
await this.getOpenId();
this.getMainInfo();
flag = true;
// 获取用户信息并注册
if (this.userInfo.nickName) {
......@@ -462,18 +464,20 @@
}
}
// 获取主页信息
this.getMainInfo();
// 获取活动信息
this.showActivity();
// 获取奖品列表
this.videoList = await getPrizeList(options.prizeId);
},
async onShow() {
// 获取主页信息
if(flag) {
this.getMainInfo();
}
let join = wx.getStorageSync('userJoin');
if (join === 1) {
wx.removeStorageSync('userJoin');
this.getMainInfo();
this.showActivity();
}
}
......
......@@ -44,6 +44,7 @@
position: fixed;
bottom:0;
left:0;
z-index: 9;
.getprize{
position: absolute;
width:160rpx;
......@@ -58,6 +59,9 @@
font-size: @font-large;
}
}
.addtitle{
color:#c8c9cc
}
.van-picker .van-picker__cancel,.van-picker .van-picker__confirm{
color:@maincolor;
}
......@@ -78,9 +82,9 @@
<view class="address-title">添加收货地址</view>
<view class="address-cont">
<van-field value="{{name}}" data-form="name" placeholder="收货人" bind:input ="setValue"></van-field>
<van-field value="{{phone}}" data-form="phone" placeholder="手机号码" bind:input ="setValue"></van-field>
<van-field value="{{idNumber}}" data-form="idNumber" placeholder="收货人身份证号" bind:input ="setValue"></van-field>
<van-field value="{{cityValue}}" placeholder="所在地区" bindtap="onClose" is-link readonly></van-field>
<van-field value="{{phone}}" data-form="phone" placeholder="手机号码" bind:input ="setValue" maxlength="{{11}}"></van-field>
<van-field value="{{idNumber}}" data-form="idNumber" placeholder="收货人身份证号(应监管要求,必须填写)" bind:input ="setValue"></van-field>
<van-cell title="{{cityValue}}" is-link bindtap="onClose" title-class="{{!city?'addtitle':''}}"></van-cell>
<van-field value="{{address}}" data-form="address" placeholder="详细地址:如街道、小区、门牌号、楼栋号等" bind:input ="setValue"></van-field>
</view>
</view>
......@@ -112,7 +116,7 @@
province: '',
city: '',
county: '',
cityValue: '',
cityValue: '所在地区',
areaList: [],
showAddress: false,
joinRecordId: null,
......
......@@ -319,6 +319,10 @@
await register(store.state.userInfo);
wx.setStorageSync('isRegister', true);
}
if (!this.batchId) {
Notify({message: '数据加载中,请稍后重试!'});
return;
}
this.btnfont = '参与中...';
confirmRaffle({batchId: this.batchId}).then(data => {
this.btnfont = '立即参与';
......@@ -358,8 +362,8 @@
this.batchId = detail.id;
if (detail.quantity) {
if (detail.join > detail.quantity) detail.join = detail.quantity;
const progressFloat = detail.join / detail.quantity;
this.progress = Math.round(progressFloat * 100) + '%';
const progressFloat = detail.join / detail.quantity * 100;
this.progress = Math.round(progressFloat) + '%';
// 当进度介于0 - 1之间时显示1
if (progressFloat > 0 && progressFloat < 1) this.progress = '1%';
this.progressStyle = 'width:' + this.progress;
......
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