Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
zhiliang-light-mp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
7c29b254
authored
2019-12-30 11:40:46 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
默认提交
1 parent
ec3507b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
38 deletions
src/pages/index/index.js
src/pages/vip-login/vip-login.js
src/pages/index/index.js
View file @
7c29b25
...
...
@@ -19,6 +19,7 @@ Page({
code
:
""
,
// 手输入码 / 扫出的奖金码
memberCode
:
""
,
// 扫出的用户码
isVerify
:
true
,
// 是否已经认证
options
:
{}
},
onShareAppMessage
()
{},
showAuth
()
{
...
...
@@ -27,6 +28,17 @@ Page({
})
},
onLoad
(
options
)
{
this
.
setData
({
options
:
options
})
},
onShow
()
{
this
.
hideMask
();
let
options
=
this
.
data
.
options
;
let
q
=
decodeURIComponent
(
options
.
q
);
// 获取会员码
...
...
@@ -60,12 +72,7 @@ Page({
if
(
m
||
c
||
sessionId
)
{
this
.
initData
();
}
},
onShow
()
{
this
.
hideMask
();
// console.log("onShow memberCode:", this.data.memberCode);
// console.log("onShow code:", this.data.code);
console
.
log
(
"onLoad"
);
},
initData
()
{
...
...
src/pages/vip-login/vip-login.js
View file @
7c29b25
...
...
@@ -44,44 +44,96 @@ Page({
this
.
initData
();
},
initData
()
{
// this.queryMember().then((result) => {});
this
.
initOpenid
();
},
/**
* 初始化Openid
* 发红包用 该段代码参考自 user-center.js
*/
initOpenid
()
{
this
.
queryMember
().
then
((
result
)
=>
{
let
auditStatus
=
this
.
data
.
userInfo
&&
this
.
data
.
userInfo
.
auditStatus
||
""
;
// console.log("viplogin - auditStatus:", auditStatus);
let
isModify
=
this
.
data
.
isModify
;
// console.log("isModify:", isModify)
if
((
auditStatus
==
"authorization"
||
auditStatus
==
"unauthorized"
)
&&
!
isModify
)
{
// 未验证和待验证
app
.
router
.
push
({
openType
:
"redirect"
,
path
:
"vipVerify"
})
let
subscriptionOpenid
=
result
.
subscriptionOpenid
;
if
(
subscriptionOpenid
)
{
// member表 已有openid 继续流程
this
.
initVipLogin
();
// 原有业务
}
else
{
this
.
getProvince
();
this
.
getMemberType
().
then
((
result
)
=>
{
app
.
post
({
url
:
app
.
api
.
memberIdQuery
,
data
:
{},
}).
then
((
result
)
=>
{
let
verifyInfo
=
result
;
this
.
setData
({
name
:
verifyInfo
.
realName
,
mobile
:
verifyInfo
.
phone
,
province
:
verifyInfo
.
province
,
city
:
verifyInfo
.
city
,
memberTypeCode
:
verifyInfo
.
memberTypeCode
,
memberTypeName
:
verifyInfo
.
memberTypeName
,
files
:
[{
path
:
verifyInfo
.
images
}]
})
// member表无openid ,重h5授权回来的local拿,成功就继续往下走
this
.
querySaveOpenid
().
then
((
result
)
=>
{
this
.
queryMember
().
then
((
result
)
=>
{
this
.
initVipLogin
();
// 原有业务
})
})
}).
catch
((
err
)
=>
{
// 如果均没有,则去h5授权
app
.
router
.
push
({
path
:
"webview"
})
});
}
});
},
/**
* 初始化VipLogin 原initData内容
*/
initVipLogin
()
{
let
auditStatus
=
this
.
data
.
userInfo
&&
this
.
data
.
userInfo
.
auditStatus
||
""
;
let
isModify
=
this
.
data
.
isModify
;
if
((
auditStatus
==
"authorization"
||
auditStatus
==
"unauthorized"
)
&&
!
isModify
)
{
// 未验证和待验证
app
.
router
.
push
({
openType
:
"redirect"
,
path
:
"vipVerify"
})
}
else
{
this
.
getProvince
();
this
.
getMemberType
().
then
((
result
)
=>
{
app
.
post
({
url
:
app
.
api
.
memberIdQuery
,
data
:
{},
}).
then
((
result
)
=>
{
let
verifyInfo
=
result
;
this
.
setData
({
name
:
verifyInfo
.
realName
,
mobile
:
verifyInfo
.
phone
,
province
:
verifyInfo
.
province
,
city
:
verifyInfo
.
city
,
memberTypeCode
:
verifyInfo
.
memberTypeCode
,
memberTypeName
:
verifyInfo
.
memberTypeName
,
files
:
[{
path
:
verifyInfo
.
images
}]
})
})
})
}
},
})
/**
* 保存openid
*/
querySaveOpenid
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
openid
=
app
.
store
.
getItem
(
"openid"
);
if
(
openid
)
{
app
.
post
({
toast
:
false
,
url
:
app
.
api
.
saveOpenid
,
data
:
{
subscriptionOpenid
:
openid
}
}).
then
((
result
)
=>
{
console
.
log
(
"result:"
,
result
);
app
.
store
.
clear
(
"openid"
);
resolve
();
}).
catch
((
err
)
=>
{
reject
();
});
}
else
{
reject
();
}
});
},
/**
...
...
Please
register
or
sign in
to post a comment