Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
db095df5
Commit
db095df5
authored
Jan 16, 2021
by
zhujian
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/wufan/20200109/work-weixin' into gray
parents
0fb90a58
7f3699f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
20 deletions
+47
-20
public/h5.html
+45
-18
src/modules/root/WechatLogin.tsx
+2
-2
No files found.
public/h5.html
View file @
db095df5
...
...
@@ -28,7 +28,7 @@
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
background
:
rgba
(
244
,
246
,
250
,
1
)
;
background
:
rgba
(
244
,
246
,
250
,
1
)
;
}
...
...
@@ -81,6 +81,14 @@
prod
:
'https://gateway-heimdall.xiaomai5.com/'
};
var
APPID_MAP
=
{
dev
:
'ww80fd6928a46cf33a'
,
dev1
:
'ww80fd6928a46cf33a'
,
rc
:
'ww2009937c82bc57bd'
,
gray
:
'ww2009937c82bc57bd'
,
prod
:
'ww2009937c82bc57bd'
};
function
getParameterByName
(
name
)
{
...
...
@@ -96,26 +104,22 @@
const
appTermEnum
=
getParameterByName
(
'appTermEnum'
);
const
code
=
getParameterByName
(
'code'
);
const
ticket
=
getParameterByName
(
'ticket'
);
console
.
log
(
appTermEnum
,
code
,
ticket
);
if
(
!
code
)
{
postJSON
(
'hades/anon/hades/getCorpTrainSuiteId'
,
{},
(
res
)
=>
{
const
url
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
res
.
result
}
&redirect_uri=
${
encodeURIComponent
(
location
.
href
)}
&response_type=code&scope=snsapi_privateinfo&state=STATE#wechat_redirect`
location
.
href
=
url
})
const
url
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww80fd6928a46cf33a&redirect_uri=
${
encodeURIComponent
(
location
.
href
)}
&response_type=code&scope=snsapi_privateinfo&state=STATE#wechat_redirect`
location
.
href
=
url
return
}
const
ajaxOptions
=
{
data
:
JSON
.
stringify
({
}
else
{
postJSON
(
"hades/anon/hades/wXWorkUserTicketLogin"
,
{
appTermEnum
:
appTermEnum
,
code
:
code
,
ticket
:
ticket
}),
type
:
'POST'
,
url
:
BASIC_HOST_MAP
[
env
]
+
"hades/anon/hades/wXWorkUserTicketLogin"
,
contentType
:
'application/json; charset=UTF-8'
,
timeout
:
20000
,
dataType
:
'json'
,
success
(
res
,
status
,
xhr
)
{
},
(
res
)
=>
{
if
(
res
.
code
==
200
)
{
$
(
'#success'
).
show
()
}
else
{
...
...
@@ -125,10 +129,33 @@
$
(
'#message'
).
html
(
message
)
}
},
};
})
}
function
postJSON
(
url
,
data
,
callback
)
{
const
ajaxOptions
=
{
data
:
JSON
.
stringify
(),
type
:
'POST'
,
url
:
BASIC_HOST_MAP
[
env
]
+
url
,
contentType
:
'application/json; charset=UTF-8'
,
timeout
:
20000
,
dataType
:
'json'
,
success
(
res
,
status
,
xhr
)
{
callback
(
res
)
},
};
$
.
ajax
(
ajaxOptions
)
}
$
.
ajax
(
ajaxOptions
)
});
</script>
...
...
src/modules/root/WechatLogin.tsx
View file @
db095df5
...
...
@@ -26,7 +26,7 @@ export default function WechatLogin(props: any) {
if
(
status
===
0
)
{
Service
.
Hades
(
"anon/hades/getTicket"
,
{}).
then
((
res
:
any
)
=>
{
setTicket
(
res
.
result
)
const
redirect
=
`
${
location
.
origin
+
location
.
pathname
.
replace
(
'index.html'
,
'
h5.html'
)
}
?ticket=
${
res
.
result
}
&appTermEnum=XIAOMAI_CLOUD_CLASS_PC_WEB_ADMIN&env=
${
process
.
env
.
DEPLOY_ENV
||
'dev'
}
`
const
redirect
=
`
${
location
.
origin
+
location
.
pathname
.
replace
(
'index.html'
,
'
'
)
+
'h5.html'
}
?ticket=
${
res
.
result
}
&appTermEnum=XIAOMAI_CLOUD_CLASS_PC_WEB_ADMIN&env=
${
process
.
env
.
DEPLOY_ENV
||
'dev'
}
`
// console.log(redirect)
// const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww409ccf9c6e31f19e&redirect_uri=${encodeURIComponent(redirect)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
// console.log(url)
...
...
@@ -73,7 +73,7 @@ export default function WechatLogin(props: any) {
User
.
setToken
(
_res
.
result
.
loginInfo
.
xmToken
);
window
.
RCHistory
.
push
({
pathname
:
`/switch-route`
,
})
})
})
}
...
...
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