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
a1a3a745
Commit
a1a3a745
authored
May 28, 2020
by
郝聪敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改登录流程
parent
469f16fa
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
58 additions
and
31 deletions
+58
-31
app.wpy
src/app.wpy
+0
-6
api.js
src/common/api.js
+1
-1
wxRequest.js
src/common/wxRequest.js
+1
-0
openAnimation.wpy
src/components/custom/openAnimation.wpy
+3
-1
sharedPopup.wpy
src/components/custom/sharedPopup.wpy
+0
-1
sign.wpy
src/components/custom/sign.wpy
+7
-6
videolist.wpy
src/components/custom/videolist.wpy
+12
-4
index.wpy
src/pages/index.wpy
+34
-12
No files found.
src/app.wpy
View file @
a1a3a745
...
@@ -32,12 +32,6 @@ wepy.app({
...
@@ -32,12 +32,6 @@ wepy.app({
}
}
});
});
wx.setStorageSync('onNetworkStatusChange', true);
wx.setStorageSync('onNetworkStatusChange', true);
if (!wx.getStorageSync('openId')) {
const { code } = await wepy.wx.login();
const userInfo = await login(code);
wx.setStorageSync('openId', userInfo.openid);
wx.setStorageSync('isRegister', userInfo.register);
}
// wx.checkSession({
// wx.checkSession({
// success () {
// success () {
// console.log('已登录');
// console.log('已登录');
...
...
src/common/api.js
View file @
a1a3a745
...
@@ -21,7 +21,7 @@ module.exports = {
...
@@ -21,7 +21,7 @@ module.exports = {
return
http
.
post
(
'
/api/prize/feed
'
,
qs
.
stringify
(
params
));
return
http
.
post
(
'
/api/prize/feed
'
,
qs
.
stringify
(
params
));
},
},
addGold
(
params
)
{
addGold
(
params
)
{
return
http
.
post
(
'
/api/user/book
'
,
params
);
return
http
.
post
(
'
/api/user/book
'
,
qs
.
stringify
(
params
)
);
},
},
signIn
(
params
)
{
signIn
(
params
)
{
return
http
.
post
(
'
/api/user/signin
'
,
params
,
{
'
content-type
'
:
'
application/json
'
});
return
http
.
post
(
'
/api/user/signin
'
,
params
,
{
'
content-type
'
:
'
application/json
'
});
...
...
src/common/wxRequest.js
View file @
a1a3a745
...
@@ -42,6 +42,7 @@ const request = async (url, options) => {
...
@@ -42,6 +42,7 @@ const request = async (url, options) => {
throw
new
Error
(
res
.
data
.
msg
||
'
服务器异常,请稍后重试
'
);
throw
new
Error
(
res
.
data
.
msg
||
'
服务器异常,请稍后重试
'
);
}
}
Notify
({
message
:
'
服务器异常,请稍后重试
'
,
background
:
'
#FF5D15
'
,
safeAreaInsetTop
});
Notify
({
message
:
'
服务器异常,请稍后重试
'
,
background
:
'
#FF5D15
'
,
safeAreaInsetTop
});
throw
new
Error
(
res
.
data
.
msg
||
'
服务器异常,请稍后重试
'
);
});
});
};
};
...
...
src/components/custom/openAnimation.wpy
View file @
a1a3a745
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
</div>
</div>
<div class="success-content" v-if="isWin">
<div class="success-content" v-if="isWin">
<div class="des">恭喜您中奖!</div>
<div class="des">恭喜您中奖!</div>
<image class="image" :src="joinRecord.prize.photoUrl"></image>
<image class="image" :src="joinRecord.prize.photoUrl"
mode="aspectFill"
></image>
<div class="name">{{joinRecord.prize.name}}</div>
<div class="name">{{joinRecord.prize.name}}</div>
</div>
</div>
<div class="dialog-footer">
<div class="dialog-footer">
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
},
},
computed: {
computed: {
isWin() {
isWin() {
if (!this.joinRecord.id) return false;
return +this.joinRecord.status.value === 3;
return +this.joinRecord.status.value === 3;
}
}
},
},
...
@@ -299,6 +300,7 @@
...
@@ -299,6 +300,7 @@
overflow: hidden;
overflow: hidden;
text-overflow: ellipsis;
text-overflow: ellipsis;
font-size: 24rpx;
font-size: 24rpx;
text-align: center;
}
}
}
}
.dialog-footer {
.dialog-footer {
...
...
src/components/custom/sharedPopup.wpy
View file @
a1a3a745
...
@@ -61,7 +61,6 @@
...
@@ -61,7 +61,6 @@
methods: {
methods: {
getGold: function() {
getGold: function() {
this.$emit('getSharedGold', {
this.$emit('getSharedGold', {
openid: wx.getStorageSync('openId'),
itemIdList: this.ids.join(','),
itemIdList: this.ids.join(','),
quantity: this.goldNum
quantity: this.goldNum
});
});
...
...
src/components/custom/sign.wpy
View file @
a1a3a745
...
@@ -85,6 +85,10 @@
...
@@ -85,6 +85,10 @@
type: String,
type: String,
default: ''
default: ''
},
},
isReceive: {
type: Boolean,
default: false
}
},
},
computed: {
computed: {
goldUrl() {
goldUrl() {
...
@@ -107,15 +111,12 @@
...
@@ -107,15 +111,12 @@
}
}
},
},
watch: {
watch: {
isReceive(newVal, oldVal) {
this.addGold = true;
},
des(newVal, oldVal) {
des(newVal, oldVal) {
if (this.type === 'gold') {
if (this.type === 'gold') {
if (this.addCount <= 1) {
this.addCount ++;
return;
}
this.addGold = true;
this.addGoldNum = newVal - oldVal;
this.addGoldNum = newVal - oldVal;
this.addCount ++;
}
}
},
},
gold(v) {
gold(v) {
...
...
src/components/custom/videolist.wpy
View file @
a1a3a745
...
@@ -3,11 +3,16 @@
...
@@ -3,11 +3,16 @@
width:100%;
width:100%;
height:100%;
height:100%;
}
}
.video
_
item{
.video
-
item{
height:100%;
height:100%;
width:100%;
width:100%;
position: absolute;
position: absolute;
z-index: 1;
z-index: 1;
display: flex;
align-items: center;
}
.video-wrapper {
width: 100%;
}
}
.rightcont {
.rightcont {
font-size: 24rpx;
font-size: 24rpx;
...
@@ -63,7 +68,7 @@
...
@@ -63,7 +68,7 @@
bindchange="cancelPause"
bindchange="cancelPause"
>
>
<!-- curQueue 循环会导致video重新插入,objectFit 不可变更 -->
<!-- curQueue 循环会导致video重新插入,objectFit 不可变更 -->
<swiper-item wx:for="{{curQueue}}" wx:key="index">
<swiper-item
class="video-item"
wx:for="{{curQueue}}" wx:key="index">
<view class="video-wrapper">
<view class="video-wrapper">
<!-- <video
<!-- <video
id="video_{{index}}"
id="video_{{index}}"
...
@@ -91,8 +96,9 @@
...
@@ -91,8 +96,9 @@
<view class="orange" style="{{item.progressStyle}}"></view>
<view class="orange" style="{{item.progressStyle}}"></view>
</view>
</view>
</view>
</view>
<!-- <v
ideo-loading v-if="item.time === 0"
/> -->
<!-- <v
an-image lazy-load custom-class="images" :src="item.photoUrl" mode="contain"
/> -->
<image class="images" :src="item.photoUrl" mode="widthFix"></image>
<image class="images" :src="item.photoUrl" mode="widthFix"></image>
<!-- <video-loading v-if="item.time === 0"/> -->
</view>
</view>
</swiper-item>
</swiper-item>
</swiper>
</swiper>
...
@@ -305,6 +311,7 @@
...
@@ -305,6 +311,7 @@
}
}
},
},
async playCurrent(current) {
async playCurrent(current) {
if (!this.curQueue || this.curQueue.length <= 1) return;
await this.getProgress(this.curQueue[current].id);
await this.getProgress(this.curQueue[current].id);
const { batchId, photoUrl, name, probability, progress } = this.curQueue[current];
const { batchId, photoUrl, name, probability, progress } = this.curQueue[current];
this.$emit('getAwardsInfo', {
this.$emit('getAwardsInfo', {
...
@@ -348,7 +355,8 @@
...
@@ -348,7 +355,8 @@
{
{
usingComponents: {
usingComponents: {
'video-pause': '~@/components/custom/videoPause',
'video-pause': '~@/components/custom/videoPause',
'video-loading': '~@/components/custom/loading'
'video-loading': '~@/components/custom/loading',
"van-image": "~@/components/vant/image/index"
}
}
}
}
</config>
</config>
src/pages/index.wpy
View file @
a1a3a745
<style lang="less">
<style lang="less">
page{
page{
height: 100%;
height: 100%;
background-color: #000;
}
}
.video-wrapper{
.video-wrapper{
width: 100%;
width: 100%;
...
@@ -35,7 +36,7 @@
...
@@ -35,7 +36,7 @@
.leftcont {
.leftcont {
width: 44%;
width: 44%;
float: left;
float: left;
font-size:
12
px;
font-size:
24r
px;
margin-left: 30rpx;
margin-left: 30rpx;
}
}
.list-wrapper {
.list-wrapper {
...
@@ -48,7 +49,11 @@
...
@@ -48,7 +49,11 @@
vertical-align: middle;
vertical-align: middle;
}
}
.leftcont .text {
.leftcont .text {
margin-left: 5px;
max-width: 200rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-left: 10rpx;
vertical-align: middle;
vertical-align: middle;
border-radius: 20rpx;
border-radius: 20rpx;
display: inline-block;
display: inline-block;
...
@@ -177,7 +182,7 @@
...
@@ -177,7 +182,7 @@
<image src="{{userInfo.avatarUrl || '/static/images/user@2x.png'}}" mode="cover" class="userimage"></image>
<image src="{{userInfo.avatarUrl || '/static/images/user@2x.png'}}" mode="cover" class="userimage"></image>
</view>
</view>
<view>
<view>
<video-gold type="gold" :des="mainInfo && mainInfo.account && mainInfo.account.quantity || 0" :gold="sign"></video-gold>
<video-gold type="gold" :des="mainInfo && mainInfo.account && mainInfo.account.quantity || 0" :gold="sign"
:isReceive="isReceive"
></video-gold>
<video-sign type="sign" des="签到" :sign="sign" @sign-in="signIn"></video-sign>
<video-sign type="sign" des="签到" :sign="sign" @sign-in="signIn"></video-sign>
<video-lottery type="lottery" des="抽奖" @tap="getAwards"></video-lottery>
<video-lottery type="lottery" des="抽奖" @tap="getAwards"></video-lottery>
<video-share type="share" des="分享"></video-share>
<video-share type="share" des="分享"></video-share>
...
@@ -223,7 +228,7 @@
...
@@ -223,7 +228,7 @@
</swiper-item>
</swiper-item>
</swiper>
</swiper>
</view> -->
</view> -->
<view class="authmodal" v-
if
="authmodal">
<view class="authmodal" v-
show
="authmodal">
<view class="wrap">
<view class="wrap">
<view class="text">来到lukii,再平凡的人,<br>也有幸运的权利!</view>
<view class="text">来到lukii,再平凡的人,<br>也有幸运的权利!</view>
<button open-type="getUserInfo" bindgetuserinfo="getUserInfo">授权并进入</button>
<button open-type="getUserInfo" bindgetuserinfo="getUserInfo">授权并进入</button>
...
@@ -242,7 +247,7 @@
...
@@ -242,7 +247,7 @@
import { mapState, mapActions } from '@wepy/x';
import { mapState, mapActions } from '@wepy/x';
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 { register, getUserInfo, addGold, getPrizeList, signIn, getActivityFeed } from '../common/api.js';
import {
login,
register, getUserInfo, addGold, getPrizeList, signIn, getActivityFeed } from '../common/api.js';
wepy.page({
wepy.page({
store,
store,
hooks: {
hooks: {
...
@@ -274,7 +279,8 @@
...
@@ -274,7 +279,8 @@
mainInfo: null,
mainInfo: null,
showShareModal: false,
showShareModal: false,
showAwardsModal: false,
showAwardsModal: false,
awardsInfo: {}
awardsInfo: {},
isReceive: false
},
},
computed: {
computed: {
...
@@ -465,7 +471,7 @@
...
@@ -465,7 +471,7 @@
if (rs) {
if (rs) {
that.sign = true;
that.sign = true;
setTimeout(() => {
setTimeout(
async
() => {
const innerAudioContext = wx.createInnerAudioContext();
const innerAudioContext = wx.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.autoplay = true;
innerAudioContext.src = '/static/audio/supermarie.mp3';
innerAudioContext.src = '/static/audio/supermarie.mp3';
...
@@ -476,8 +482,9 @@
...
@@ -476,8 +482,9 @@
console.log(res.errMsg);
console.log(res.errMsg);
console.log(res.errCode);
console.log(res.errCode);
});
});
that.mainInfo.account.quantity += 1;
const { coins } = await signIn();
signIn();
if (coins === 0) return;
that.mainInfo.account.quantity = coins;
}, 1500);
}, 1500);
} else {
} else {
Notify({ message: '签到必须同意推送授权!', background: '#FF5D15', safeAreaInsetTop: true });
Notify({ message: '签到必须同意推送授权!', background: '#FF5D15', safeAreaInsetTop: true });
...
@@ -512,9 +519,13 @@
...
@@ -512,9 +519,13 @@
},
},
getAwards: function() {
getAwards: function() {
const { batchId, photoUrl, quantity, name, chance, progress } = this.awardsInfo;
const { batchId, photoUrl, quantity, name, chance, progress } = this.awardsInfo;
if (!batchId) return;
if (!batchId || !this.mainInfo || !this.mainInfo.account) {
Notify({ message: '服务器异常,请稍后重试', background: '#FF5D15', safeAreaInsetTop: true});
return;
}
if (this.mainInfo && this.mainInfo.account && this.mainInfo.account.quantity === 0) {
if (this.mainInfo && this.mainInfo.account && this.mainInfo.account.quantity === 0) {
Notify({ message: '您的克币数为0, 无法参与抽奖', background: '#FF5D15', safeAreaInsetTop: true});
Notify({ message: '您的克币数为0, 无法参与抽奖', background: '#FF5D15', safeAreaInsetTop: true});
return;
}
}
wx.navigateTo({
wx.navigateTo({
url: `/pages/raffle?batchId=${batchId}&progress=${progress}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}`
url: `/pages/raffle?batchId=${batchId}&progress=${progress}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}`
...
@@ -530,6 +541,7 @@
...
@@ -530,6 +541,7 @@
this.showShareModal = false;
this.showShareModal = false;
await addGold(v);
await addGold(v);
this.mainInfo.account.quantity += v.quantity;
this.mainInfo.account.quantity += v.quantity;
this.isReceive = true;
setTimeout(() => {
setTimeout(() => {
if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
this.showAwardsModal = true;
this.showAwardsModal = true;
...
@@ -539,7 +551,7 @@
...
@@ -539,7 +551,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.signin;
wx.setStorageSync('hasPhone', this.mainInfo.phone
|| false
);
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;
} else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
} else if (this.mainInfo.joinRecord && this.mainInfo.joinRecord.id) {
...
@@ -560,6 +572,16 @@
...
@@ -560,6 +572,16 @@
async onLoad (options) {
async onLoad (options) {
if (options.openid) {
if (options.openid) {
this.inviter = options.openid;
this.inviter = options.openid;
Notify({ message: this.inviter, background: '#FF5D15', safeAreaInsetTop: true });
}
wx.setStorageSync('openId', false);
if (!wx.getStorageSync('openId')) {
const { code } = await wepy.wx.login();
const userInfo = await login(code);
wx.setStorageSync('openId', userInfo.openid);
wx.setStorageSync('isRegister', userInfo.register);
}
}
let self = this;
let self = this;
...
@@ -578,8 +600,8 @@
...
@@ -578,8 +600,8 @@
await this.getMainInfo();
await this.getMainInfo();
this.videoList = await getPrizeList();
this.videoList = await getPrizeList();
// 如果已经存在store里就不用再获取用户信息了
this.adlist = await getActivityFeed({ count: 50 });
this.adlist = await getActivityFeed({ count: 50 });
// 如果已经存在store里就不用再获取用户信息了
if (!this.userInfo) {
if (!this.userInfo) {
const setting = await wepy.wx.getSetting();
const setting = await wepy.wx.getSetting();
if (setting.authSetting['scope.userInfo']) {
if (setting.authSetting['scope.userInfo']) {
...
...
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