Commit 19da0a95 authored by 付清曌's avatar 付清曌

Merge branch 'feature/beta' into 'master'

Feature/beta

See merge request !39
parents 7d63281b 8fc54288
......@@ -46,5 +46,8 @@ module.exports = {
},
getPrize(params) {
return http.post('/api/user/prize/receive', params, { 'content-type': 'application/json' });
},
checkInnerCode(params) {
return http.post('/api/user/inviteCode', params);
}
};
function computClass (current,index,length) {
var allclass = "";
// 无限循环当current为最后一个的时候,select就应该是0 例如长度为10,当current为9时,select就应该是0
// if(current+1==index || (current==length-1 && index==0) ) allclass = "select";
// 无限循环当current为最后一个/两个的时候的时候,例如长度为10,当current为8/9时,select就应该是1/0
//if(current+2 == index|| (current>=length-2 && index==current-length+2))
//allclass='subright';
if(current-1 == index||(current == 0&&index==length-1))
allclass='subleft';
if(current==index)
allclass='select';
if(current+1==index || (current==length-1 && index==0) )
allclass = "subright";
return allclass;
};
function getClass (status) {
var cls=['','green','grey','','red','red'];
var index = status.value || 0;
console.log(status)
return cls[index]
};
module.exports = {
computClass:computClass,
getClass:getClass
}
......@@ -134,7 +134,7 @@
videoList () {
const newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
this._videoListChanged(newVal);
this.compute(this.userAccount);
// this.compute(this.userAccount);
},
userAccount(newVal) {
this.compute(newVal);
......@@ -172,6 +172,7 @@
item.time = 0;
return item;
});
this.compute(this.userAccount);
this.playCurrent(0);
},
async bindanimationfinish(e) {
......
......@@ -181,27 +181,7 @@
}
}
</style>
<wxs module="tools">
// 无限循环当current为最后一个的时候,select就应该是0 例如长度为10,当current为9时,select就应该是0
// if(current+1==index || (current==length-1 && index==0) ) allclass = "select";
// 无限循环当current为最后一个/两个的时候的时候,例如长度为10,当current为8/9时,select就应该是1/0
//if(current+2 == index|| (current>=length-2 && index==current-length+2))
//allclass='subright';
function computClass (current,index,length) {
var allclass = "";
if(current-1 == index||(current == 0&&index==length-1))
allclass='subleft';
if(current==index)
allclass='select';
if(current+1==index || (current==length-1 && index==0) )
allclass = "subright";
return allclass;
};
module.exports = {
computClass:computClass
}
</wxs>
<wxs module="tools" src="../common/common.wxs"></wxs>
<template>
<view class="video-wrapper">
<view id="myvideo">
......@@ -300,17 +280,13 @@
current: 5, // 商品列表初次展示第几个
swiperItem: 2,
videoList: [],
length: 4,
circular: false, // 商品是否无限循环
topPage: 0,
lastPage: 0,
currentIndex: 5, // 商品当前滑动到第几个
authmodal: false,
sign: true,
showAnimation: false,
userImgStyle: '',
goldStyle: '',
goldNum: 50000,
awards: false,
showMenus: false,
inviter: '',
......@@ -386,7 +362,6 @@
},
toViewPage(e) {
let item = e.$wx.currentTarget.dataset.item;
// 解决长按触发tap事件的bug
wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74',
path: 'pages/item/detail/detail?sku=' + item.sku, // 跳转小程序的路径
......@@ -396,9 +371,6 @@
// console.log('跳转成功');
}
});
/* wx.navigateTo({
url: '/pages/auth'
}); */
},
touchStart (event) {
touchDotX = event.touches[0].pageX; // 获取触摸时的原点
......@@ -461,11 +433,6 @@
},
changeVideo(e) {
this.setIsConnected();
// if (this.length - e.activeId === 1) {
// this.videoList = [{id: e.activeId + 2, url: 'https://ip1707952229.mobgslb.tbcache.com/youku/6974c3708c0337150e1743b1c/03000801005EA2A6C8FB4C2003E8807282A547-8207-4F52-9663-969096765248.mp4?sid=158960247500010009412_00_Bac09720260d484f23ac2ccebe5206930&sign=b76f4099e108fc306d3db993d1bec0a8&ctype=50&ali_redirect_domain=vali.cp31.ott.cibntv.net&ali_redirect_ex_ftag=5898cd25832bbff232de6d9fa668e8ddf8bacc5fef3f2e7b&ali_redirect_ex_tmining_ts=1589602477&ali_redirect_ex_tmining_expire=3600&ali_redirect_ex_hot=111'}];
// this.length += 1;
// console.log('add video');
// }
},
deleteAnimation (current) {
if (current && current.itemid !== undefined) {
......@@ -615,6 +582,11 @@
this.mainInfo = await getUserInfo(wx.getStorageSync('openId'));
this.sign = this.mainInfo && this.mainInfo.signin;
wx.setStorageSync('hasPhone', this.mainInfo.phone);
if(this.mainInfo&&this.mainInfo.innerActivity) {
wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);
} else {
wx.setStorageSync('innerActivity','')
}
if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {
this.showShareModal = true;
} else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
......@@ -676,32 +648,6 @@
}
this.getMainInfo();
this.videoList = await getPrizeList();
// let urls = [
// {type: 'video', url: 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4', snapshot: 'http://img3.imgtn.bdimg.com/it/u=246328798,659513921&fm=26&gp=0.jpg'},
// {type: 'image', url: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590151556813&di=44964ab823b5fb5f3fadcf9ceb87553b&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201503%2F07%2F20150307113019_FSEFE.thumb.700_0.png'},
// {type: 'video', url: 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4', snapshot: 'http://img3.imgtn.bdimg.com/it/u=246328798,659513921&fm=26&gp=0.jpg'},
// {type: 'image', url: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2944016076,351466175&fm=26&gp=0.jpg'},
// {type: 'video', url: 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4', snapshot: 'http://img3.imgtn.bdimg.com/it/u=246328798,659513921&fm=26&gp=0.jpg'},
// {type: 'image', url: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590151520979&di=beba310e6bc314f7dd7ede841d068f68&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201610%2F05%2F20161005092600_jCmSx.thumb.700_0.jpeg'}
// ];
// this.videoList = urls.map((url, idx) => {
// return {
// cash: false,
// coinQuantity: 29900,
// createdAt: 1590645948000,
// id: idx,
// name: '蓝牙音箱',
// photoUrl: url.type === 'image' ? url.url : null,
// price: 299,
// status: {name: '上架', value: 1},
// stock: 1,
// totalStock: 1,
// updatedAt: 1590741775000,
// videoUrl: url.type === 'video' ? url.url : null,
// snapshot: url.type === 'video' ? url.snapshot : null
// };
// });
this.showActivity();
},
async onShow() {
......
......@@ -70,17 +70,7 @@
}
}
</style>
<wxs module="prize">
function computClass (status) {
var cls=['','green','grey','','red','red'];
var index = status.value || 0;
console.log(status)
return cls[index]
};
module.exports = {
computClass:computClass
}
</wxs>
<wxs module="prize" src="../common/common.wxs"></wxs>
<template>
<view class="raffles-list">
<view class="raffle-item" wx:for="{{list}}" wx:key="index">
......@@ -93,7 +83,7 @@
<view class="item-corn">花费: {{item.quantity}}克币</view>
<view class="item-status">
<button data-id="{{item.id}}" class="item-button" bindtap="goprize" v-if="item.status.value==3">领取</button>
<text class="{{prize.computClass(item.status)}}" v-else>{{fonts[item.status.value]}}</text>
<text class="{{prize.getClass(item.status)}}" v-else>{{fonts[item.status.value]}}</text>
</view>
</view>
</view>
......
......@@ -123,6 +123,87 @@
font-size: 34rpx;
color:@whitecolor;
}
.innerActivity {
width:100%;
height:100%;
background-color: rgba(0,0,0,0.7);
position: fixed;
top:0;left:0;
animation:fadein .3s linear forwards;
&.anima {
animation:fadeout .3s linear forwards;
}
&.hide {
display: none;
}
.inner-content {
width: 70%;
position: absolute;
top:30%;
height:360rpx;
left:15%;
background-color: @whiteback;
box-shadow:0 2rpx 20rpx 0 rgba(144, 144, 144, 0.35);
border-radius:20rpx;
}
.inner-title {
text-align: center;
font-size: 34rpx;
padding-top:50rpx;
}
.inner-input {
background-color: #ddd;
height:70rpx;
width:330rpx;
margin:0 auto;
line-height:70rpx;
font-size: 32rpx;
border-radius:35rpx;
padding:0 30rpx;
margin-top:30rpx;
}
.error-text {
color:@redcolor;
font-size: 22rpx;
width:390rpx;
margin:0 auto;
padding:20rpx 0;
}
.inner-footer {
width:100%;
height:88rpx;
position: absolute;
bottom:0;
left:0;
border-top: 1rpx solid #E6E6E6;
overflow: hidden;
.button {
width:50%;
float: left;
text-align: center;
line-height:88rpx;
}
.cancel {
color:@lightgrey;
font-size: @font-middle;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border-right: 1rpx solid #E6E6E6;
}
.confirm {
color: @maincolor;
font-size: 34rpx;
}
}
}
@-webkit-keyframes fadeout {
from { background: rgba(0, 0, 0, 0.7); opacity: 1;}
to { background: rgba(0, 0, 0, 0); opacity: 0;}
}
@-webkit-keyframes fadein {
from { background: rgba(0, 0, 0, 0); opacity: 0;}
to { background: rgba(0, 0, 0, 0.7); opacity: 1;}
}
</style>
<template>
<view class="raffle-wrapper">
......@@ -151,13 +232,26 @@
<button class="joinin" open-type="{{opentype}}" bindtap="joinin" bindgetphonenumber="getPhoneNumber">{{btnfont}}</button>
<van-notify id="van-notify" />
<van-dialog id="van-dialog"/>
<view class="innerActivity {{isInnerDone}}">
<view class="inner-content">
<view class="inner-title">请输入邀请码</view>
<view>
<input type="text" class="inner-input" v-model="code">
</view>
<view class="error-text" v-show="isError">邀请码错误,请重新输入</view>
<view class="inner-footer">
<view class="cancel button" bindtap="closeModal">内测结束再抽</view>
<view class="confirm button" bindtap="checkCode">确定</view>
</view>
</view>
</view>
</view>
</template>
<script>
import wepy from '@wepy/core';
import Notify from '../components/vant/notify/notify';
import Dialog from '../components/vant/dialog/dialog';
import { updateUserPhone, confirmRaffle, register, login, getAwardsDetail } from '../common/api';
import { updateUserPhone, confirmRaffle, register, login, getAwardsDetail, checkInnerCode } from '../common/api';
import store from '../store';
wepy.page({
store,
......@@ -171,7 +265,11 @@
chance: '',
photoUrl: '',
btnfont: '立即参与',
hasPhone: false
hasPhone: false,
isInnerDone:'hide',
innerActivity:'',
isError:false,
code:'',
},
methods: {
check() {
......@@ -191,7 +289,7 @@
});
}
if (detail.encryptedData) {
this.btnfont = '提交中...';
this.btnfont = '参与中...';
const { code } = await wepy.wx.login();
await login(code);
goprize();
......@@ -208,7 +306,7 @@
await register(store.state.userInfo);
wx.setStorageSync('isRegister', true);
}
this.btnfont = '提交中...';
this.btnfont = '参与中...';
confirmRaffle({batchId: this.batchId}).then(data => {
this.btnfont = '立即参与';
let code = data.joinCode;
......@@ -229,7 +327,12 @@
return;
}
if (this.hasPhone) {
this.confirmRaff();
//当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal
if(this.innerActivity && !this.innerActivity.haveCode && !this.innerActivity.vip) {
this.showModal();
}else {
this.confirmRaff();
}
}
},
async getProgress(id) {
......@@ -240,6 +343,27 @@
this.progress = Math.round((detail.join / detail.quantity) * 100) + '%';
this.progressStyle = 'width:' + this.progress;
}
},
closeModal() {
this.isInnerDone = 'anima';
setTimeout(() => {
this.isInnerDone = 'hide';
}, 300);
},
showModal() {
this.isInnerDone = '';
this.isError = false;
this.code = '';
},
checkCode () {
checkInnerCode({code:this.code}).then(data=>{
if(+data.checkCode === 0) {
this.closeModal();
this.confirmRaff();
}else{
this.isError = true;
}
})
}
},
computed: {
......@@ -251,6 +375,13 @@
}
}
},
watch: {
code(val) {
if(!val.length&&this.isError) {
this.isError = false;
}
}
},
onLoad (query) {
let {prizeId, quantity, name, chance, photoUrl} = query;
this.getProgress(prizeId);
......@@ -259,6 +390,7 @@
this.name = name;
this.chance = chance;
this.photoUrl = photoUrl;
this.innerActivity = wx.getStorageSync('innerActivity');
}
});
</script>
......
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