Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
GaoQuYingJiH5-ASD
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
xinzhedeai
GaoQuYingJiH5-ASD
Commits
c960751d
Commit
c960751d
authored
Jan 22, 2025
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
票据 请求头
parent
f0a91113
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
1 deletion
+46
-1
http.js
sdk/http.js
+3
-0
index.js
sdk/jssdk2/index.js
+43
-1
No files found.
sdk/http.js
View file @
c960751d
...
...
@@ -28,6 +28,9 @@ var http2 = {
// // Authorization: localStorage.getItem('token')
// Authorization: gemhoUtil.getCookie('token')
// },
verificationHeaders
:
{
// 二次核验请求头
interfaceTicket
:
gemhoUtil
.
getCookie
(
'
ticket
'
),
}
}
if
(
gemhoUtil
.
getCookie
(
'
token
'
)){
extraData
.
header
=
{
...
...
sdk/jssdk2/index.js
View file @
c960751d
...
...
@@ -21,9 +21,20 @@ function getUserInfo() {
});
lightAppJssdk
.
user
.
getUserInfoWithEncryptedParamByAppId
({
appId
:
"
whsdsjzxsfrzdjqwsczptsr
"
,
//"gqyjglptxiefn", // 接入方在成功创建应用后自动生成
success
:
function
(
data
)
{
success
:
async
(
data
)
=>
{
if
(
data
==
'
未登录
'
)
onLoginApp
()
else
{
// 2025-1-14 新增逻辑:获取用户票据,用于后续接口传参使用
const
ticketInfo
=
await
getTicket
()
if
(
ticketInfo
.
ticket
){
gemhoUtil
.
setCookie
(
'
ticket
'
,
ticketInfo
.
ticket
)
}
else
{
vant
.
Dialog
.
alert
({
title
:
'
信息提示
'
,
message
:
'
未获取到用户票据信息
'
})
return
}
if
(
typeof
data
==
'
string
'
)
data
=
JSON
.
parse
(
data
)
...
...
@@ -83,6 +94,37 @@ function getUserInfo() {
});
}
/**
* 获取用户票据
*/
function
getTicket
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
lightAppJssdk
.
user
.
getTicketWithoutDialog
({
success
:
function
(
res
)
{
//成功回调
console
.
log
(
JSON
.
stringify
(
res
)
+
1
)
var
jsonData
=
JSON
.
parse
(
res
)
if
(
jsonData
.
retcode
==
"
000000
"
)
{
var
dataValueObj
=
JSON
.
parse
(
jsonData
.
data
)
// var ticket = dataValueObj.ticket //解析出用户票据信息
// userType = dataValueObj.usertype //解析保存用户类型(个人法人)
// gemhoUtil.setCookie('ticket', ticket)
resolve
(
dataValueObj
);
// 成功时调用 外层直接通过.ticket拿到票据值
}
else
{
resolve
(
jsonData
);
// 未获取到票据时,则直接返回响应对象,外层做逻辑处理
}
},
fail
:
function
(
res
)
{
//错误返回
console
.
log
(
JSON
.
stringify
(
res
))
resolve
(
res
);
// 成功时调用
}
})
});
}
/**
* 使用jssdk调用登录页面
*/
...
...
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