Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
e718e4cb
Commit
e718e4cb
authored
Jun 09, 2020
by
ziyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 内测邀请码功能
parent
7d63281b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
146 additions
and
6 deletions
+146
-6
api.js
src/common/api.js
+3
-0
prizeList.wpy
src/components/custom/prizeList.wpy
+2
-1
index.wpy
src/pages/index.wpy
+5
-0
raffle.wpy
src/pages/raffle.wpy
+136
-5
No files found.
src/common/api.js
View file @
e718e4cb
...
@@ -46,5 +46,8 @@ module.exports = {
...
@@ -46,5 +46,8 @@ module.exports = {
},
},
getPrize
(
params
)
{
getPrize
(
params
)
{
return
http
.
post
(
'
/api/user/prize/receive
'
,
params
,
{
'
content-type
'
:
'
application/json
'
});
return
http
.
post
(
'
/api/user/prize/receive
'
,
params
,
{
'
content-type
'
:
'
application/json
'
});
},
checkInnerCode
(
params
)
{
return
http
.
post
(
'
/api/user/inviteCode
'
,
params
);
}
}
};
};
src/components/custom/prizeList.wpy
View file @
e718e4cb
...
@@ -134,7 +134,7 @@
...
@@ -134,7 +134,7 @@
videoList () {
videoList () {
const newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
const newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
this._videoListChanged(newVal);
this._videoListChanged(newVal);
this.compute(this.userAccount);
//
this.compute(this.userAccount);
},
},
userAccount(newVal) {
userAccount(newVal) {
this.compute(newVal);
this.compute(newVal);
...
@@ -172,6 +172,7 @@
...
@@ -172,6 +172,7 @@
item.time = 0;
item.time = 0;
return item;
return item;
});
});
this.compute(this.userAccount);
this.playCurrent(0);
this.playCurrent(0);
},
},
async bindanimationfinish(e) {
async bindanimationfinish(e) {
...
...
src/pages/index.wpy
View file @
e718e4cb
...
@@ -615,6 +615,11 @@
...
@@ -615,6 +615,11 @@
this.mainInfo = await getUserInfo(wx.getStorageSync('openId'));
this.mainInfo = await getUserInfo(wx.getStorageSync('openId'));
this.sign = this.mainInfo && 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&&this.mainInfo.innerActivity) {
wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);
} else {
wx.setStorageSync('innerActivity','')
}
if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {
if (this.mainInfo.inviteRecord && this.mainInfo.inviteRecord.length) {
this.showShareModal = true;
this.showShareModal = true;
} else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
} else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
...
...
src/pages/raffle.wpy
View file @
e718e4cb
...
@@ -123,6 +123,87 @@
...
@@ -123,6 +123,87 @@
font-size: 34rpx;
font-size: 34rpx;
color:@whitecolor;
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>
</style>
<template>
<template>
<view class="raffle-wrapper">
<view class="raffle-wrapper">
...
@@ -151,13 +232,26 @@
...
@@ -151,13 +232,26 @@
<button class="joinin" open-type="{{opentype}}" bindtap="joinin" bindgetphonenumber="getPhoneNumber">{{btnfont}}</button>
<button class="joinin" open-type="{{opentype}}" bindtap="joinin" bindgetphonenumber="getPhoneNumber">{{btnfont}}</button>
<van-notify id="van-notify" />
<van-notify id="van-notify" />
<van-dialog id="van-dialog"/>
<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>
</view>
</template>
</template>
<script>
<script>
import wepy from '@wepy/core';
import wepy from '@wepy/core';
import Notify from '../components/vant/notify/notify';
import Notify from '../components/vant/notify/notify';
import Dialog from '../components/vant/dialog/dialog';
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';
import store from '../store';
wepy.page({
wepy.page({
store,
store,
...
@@ -171,7 +265,11 @@
...
@@ -171,7 +265,11 @@
chance: '',
chance: '',
photoUrl: '',
photoUrl: '',
btnfont: '立即参与',
btnfont: '立即参与',
hasPhone: false
hasPhone: false,
isInnerDone:'hide',
innerActivity:'',
isError:false,
code:'',
},
},
methods: {
methods: {
check() {
check() {
...
@@ -191,7 +289,7 @@
...
@@ -191,7 +289,7 @@
});
});
}
}
if (detail.encryptedData) {
if (detail.encryptedData) {
this.btnfont = '
提交
中...';
this.btnfont = '
参与
中...';
const { code } = await wepy.wx.login();
const { code } = await wepy.wx.login();
await login(code);
await login(code);
goprize();
goprize();
...
@@ -208,7 +306,7 @@
...
@@ -208,7 +306,7 @@
await register(store.state.userInfo);
await register(store.state.userInfo);
wx.setStorageSync('isRegister', true);
wx.setStorageSync('isRegister', true);
}
}
this.btnfont = '
提交
中...';
this.btnfont = '
参与
中...';
confirmRaffle({batchId: this.batchId}).then(data => {
confirmRaffle({batchId: this.batchId}).then(data => {
this.btnfont = '立即参与';
this.btnfont = '立即参与';
let code = data.joinCode;
let code = data.joinCode;
...
@@ -229,7 +327,11 @@
...
@@ -229,7 +327,11 @@
return;
return;
}
}
if (this.hasPhone) {
if (this.hasPhone) {
this.confirmRaff();
if(this.innerActivity && !this.innerActivity.haveCode && !this.innerActivity.vip) {
this.showModal();
}else {
this.confirmRaff();
}
}
}
},
},
async getProgress(id) {
async getProgress(id) {
...
@@ -240,6 +342,27 @@
...
@@ -240,6 +342,27 @@
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;
}
}
},
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: {
computed: {
...
@@ -251,6 +374,13 @@
...
@@ -251,6 +374,13 @@
}
}
}
}
},
},
watch: {
code(val) {
if(!val.length&&this.isError) {
this.isError = false;
}
}
},
onLoad (query) {
onLoad (query) {
let {prizeId, quantity, name, chance, photoUrl} = query;
let {prizeId, quantity, name, chance, photoUrl} = query;
this.getProgress(prizeId);
this.getProgress(prizeId);
...
@@ -259,6 +389,7 @@
...
@@ -259,6 +389,7 @@
this.name = name;
this.name = name;
this.chance = chance;
this.chance = chance;
this.photoUrl = photoUrl;
this.photoUrl = photoUrl;
this.innerActivity = wx.getStorageSync('innerActivity');
}
}
});
});
</script>
</script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment