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
798cee58
Commit
798cee58
authored
Jun 10, 2020
by
ziyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvement: 修改bug,优化
parent
8fc54288
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
20 deletions
+32
-20
.eslintcache
.eslintcache
+1
-1
wxRequest.js
src/common/wxRequest.js
+3
-2
index.wpy
src/pages/index.wpy
+2
-2
prize.wpy
src/pages/prize.wpy
+4
-0
raffle.wpy
src/pages/raffle.wpy
+22
-15
No files found.
.eslintcache
View file @
798cee58
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/common/wxRequest.js
View file @
798cee58
...
@@ -37,15 +37,16 @@ const request = async (url, options) => {
...
@@ -37,15 +37,16 @@ const request = async (url, options) => {
method
:
options
.
method
,
method
:
options
.
method
,
header
:
options
.
header
header
:
options
.
header
}).
then
(
res
=>
{
}).
then
(
res
=>
{
let
msg
=
res
.
data
.
msg
||
'
服务器异常
'
;
if
(
res
.
statusCode
===
200
)
{
if
(
res
.
statusCode
===
200
)
{
if
(
res
.
data
.
code
===
2000
)
{
if
(
res
.
data
.
code
===
2000
)
{
return
res
.
data
.
data
;
return
res
.
data
.
data
;
}
}
Notify
({
message
:
'
服务器异常,请稍后重试
'
,
safeAreaInsetTop
});
Notify
({
message
:
'
服务器异常,请稍后重试
'
,
safeAreaInsetTop
});
throw
new
Error
(
res
.
data
.
msg
||
'
服务器异常,请求url:
'
+
url
);
throw
new
Error
(
msg
+
'
,请求url:
'
+
url
+
'
请求返回:
'
+
res
.
data
);
}
}
Notify
({
message
:
'
服务器异常,请稍后重试
'
,
safeAreaInsetTop
});
Notify
({
message
:
'
服务器异常,请稍后重试
'
,
safeAreaInsetTop
});
throw
new
Error
(
res
.
data
.
msg
||
'
服务器异常,请求url:
'
+
url
);
throw
new
Error
(
msg
+
'
,请求url:
'
+
url
+
'
请求返回:
'
+
res
.
data
);
});
});
};
};
...
...
src/pages/index.wpy
View file @
798cee58
...
@@ -582,10 +582,10 @@
...
@@ -582,10 +582,10 @@
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) {
if
(this.mainInfo &&
this.mainInfo.innerActivity) {
wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);
wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);
} else {
} else {
wx.setStorageSync('innerActivity',
'')
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;
...
...
src/pages/prize.wpy
View file @
798cee58
...
@@ -140,6 +140,10 @@
...
@@ -140,6 +140,10 @@
Notify({message: '请填写身份证号'});
Notify({message: '请填写身份证号'});
return;
return;
}
}
if (!/^[0-9]+[Xx]?$/.test(this.idNumber)) {
Notify({message: '请填写正确的身份证号'});
return;
}
if (!this.city) {
if (!this.city) {
Notify({message: '请选择所在地区'});
Notify({message: '请选择所在地区'});
return;
return;
...
...
src/pages/raffle.wpy
View file @
798cee58
...
@@ -266,16 +266,17 @@
...
@@ -266,16 +266,17 @@
photoUrl: '',
photoUrl: '',
btnfont: '立即参与',
btnfont: '立即参与',
hasPhone: false,
hasPhone: false,
isInnerDone:'hide',
isInnerDone:
'hide',
innerActivity:'',
innerActivity:
'',
isError:false,
isError:
false,
code:
'',
code:
''
},
},
methods: {
methods: {
check() {
check() {
this.isCheck = !this.isCheck;
this.isCheck = !this.isCheck;
},
},
async getPhoneNumber(e) {
async getPhoneNumber(e) {
// 用户获取手机号之前一定要登录
if (this.btnfont !== '立即参与') { return; }
if (this.btnfont !== '立即参与') { return; }
let that = this;
let that = this;
let detail = e.$wx.detail || {};
let detail = e.$wx.detail || {};
...
@@ -290,9 +291,14 @@
...
@@ -290,9 +291,14 @@
}
}
if (detail.encryptedData) {
if (detail.encryptedData) {
this.btnfont = '参与中...';
this.btnfont = '参与中...';
wx.checkSession({
async fail () {
// session_key 已经失效,需要重新执行登录流程
const { code } = await wepy.wx.login();
const { code } = await wepy.wx.login();
await login(code);
await login(code);
goprize();
goprize();
}
});
} else {
} else {
Notify({message: '参与失败,请重新授权!'});
Notify({message: '参与失败,请重新授权!'});
}
}
...
@@ -301,6 +307,7 @@
...
@@ -301,6 +307,7 @@
let title = ['参与成功!', '参与失败!', '参与失败!'];
let title = ['参与成功!', '参与失败!', '参与失败!'];
let message = ['参与成功,坐等开奖。', '当前抽奖已结束。', '当前奖品已经没有库存了。'];
let message = ['参与成功,坐等开奖。', '当前抽奖已结束。', '当前奖品已经没有库存了。'];
// 如果用户还未注册
// 如果用户还未注册
// 用户抽奖之前一定要注册
let isRegister = wx.getStorageSync('isRegister');
let isRegister = wx.getStorageSync('isRegister');
if (isRegister === false) {
if (isRegister === false) {
await register(store.state.userInfo);
await register(store.state.userInfo);
...
@@ -327,10 +334,10 @@
...
@@ -327,10 +334,10 @@
return;
return;
}
}
if (this.hasPhone) {
if (this.hasPhone) {
//当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal
//
当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal
if(this.innerActivity && !this.innerActivity.haveCode && !this.innerActivity.vip) {
if
(this.innerActivity && !this.innerActivity.haveCode && !this.innerActivity.vip) {
this.showModal();
this.showModal();
}else {
}
else {
this.confirmRaff();
this.confirmRaff();
}
}
}
}
...
@@ -356,14 +363,14 @@
...
@@ -356,14 +363,14 @@
this.code = '';
this.code = '';
},
},
checkCode () {
checkCode () {
checkInnerCode({code:
this.code}).then(data=>
{
checkInnerCode({code:
this.code}).then(data =>
{
if(+data.checkCode === 0) {
if
(+data.checkCode === 0) {
this.closeModal();
this.closeModal();
this.confirmRaff();
this.confirmRaff();
}
else
{
}
else
{
this.isError = true;
this.isError = true;
}
}
})
})
;
}
}
},
},
computed: {
computed: {
...
@@ -377,7 +384,7 @@
...
@@ -377,7 +384,7 @@
},
},
watch: {
watch: {
code(val) {
code(val) {
if
(!val.length&&
this.isError) {
if
(!val.length &&
this.isError) {
this.isError = false;
this.isError = false;
}
}
}
}
...
...
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