Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wechat-common
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
wechat-common
Commits
526a6f30
Commit
526a6f30
authored
Apr 08, 2021
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:企微扫码登录
parent
9af5fa16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
154 additions
and
1 deletions
+154
-1
public/h5.html
+153
-0
public/jquery.min.js
+0
-0
src/index.tsx
+1
-1
No files found.
public/h5.html
0 → 100644
View file @
526a6f30
<!--
* @Author: zhangleyuan
* @Date: 2021-04-08 14:56:33
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-04-08 15:03:14
* @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
-->
<!--
* @Author: 吴文洁
* @Date: 2020-08-24 12:20:57
* @LastEditors: wufan
* @LastEditTime: 2021-01-09 11:18:27
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
-->
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
/>
<link
rel=
"icon"
href=
""
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<meta
name=
"theme-color"
content=
"#000000"
/>
<!-- <link rel="apple-touch-icon" href="../src/common/images/logo.png" /> -->
<link
rel=
"shortcut icon"
href=
"https://image.xiaomaiketang.com/xm/KGSYFEpcHT.png"
>
<title>
小麦企培
</title>
<script
type=
"text/javascript"
charset=
"utf-8"
src=
"./jquery.min.js"
></script>
<style
type=
"text/css"
>
.box
{
width
:
100%
;
height
:
100vh
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
background
:
rgba
(
244
,
246
,
250
,
1
);
}
p
{
font-size
:
17px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#333333
;
line-height
:
24px
;
margin-top
:
12px
;
}
.hide
{
display
:
none
;
text-align
:
center
;
}
</style>
</head>
<body>
<div
class=
"box"
>
<div
id=
'success'
class=
'hide'
>
<img
src=
"https://image.xiaomaiketang.com/xm/iRkcMHPHba.png"
style=
'width:60px'
alt=
""
>
<p>
扫码成功
</p>
</div>
<div
id=
"error"
class=
'hide'
>
<img
src=
"https://image.xiaomaiketang.com/xm/6kSAYFMm2r.png
"
style=
'width:60px'
alt=
""
>
<p
id=
'message'
>
</p>
</div>
</div>
</body>
<script>
$
(
document
).
ready
(
function
()
{
var
BASIC_HOST_MAP
=
{
dev
:
'https://dev-heimdall.xiaomai5.com/'
,
dev1
:
'https://dev1-heimdall.xiaomai5.com/'
,
rc
:
'https://rc-heimdall.xiaomai5.com/'
,
gray
:
'https://gray-heimdall.xiaomai5.com/'
,
prod
:
'https://gateway.xiaomai5.com/'
};
function
getParameterByName
(
name
)
{
name
=
name
.
replace
(
/
[\\
[
]
/
,
'
\\
['
).
replace
(
/
[\]]
/
,
'
\\
]'
)
const
regex
=
new
RegExp
(
'[
\\
?&]'
+
name
+
'=([^&#]*)'
)
const
results
=
regex
.
exec
(
window
.
location
.
href
)
return
results
===
null
?
''
:
decodeURIComponent
(
results
[
1
].
replace
(
/
\+
/g
,
' '
))
}
const
env
=
getParameterByName
(
'env'
);
const
code
=
getParameterByName
(
'code'
);
const
ticket
=
getParameterByName
(
'ticket'
);
const
storeId
=
getParameterByName
(
'storeId'
);
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
})
return
}
else
{
postJSON
(
"hades/anon/hades/wXWorkUserTicketLogin"
,
{
appTermEnum
:
'XIAOMAI_CLOUD_CLASS_PC_WEB_CUSTOMER'
,
code
:
code
,
ticket
:
ticket
,
storeId
:
storeId
},
(
res
)
=>
{
if
(
res
.
code
==
200
)
{
$
(
'#success'
).
show
()
}
else
{
$
(
'#error'
).
show
();
var
message
=
res
.
message
.
split
(
','
).
join
(
'<br />'
)
$
(
'#message'
).
html
(
message
)
}
})
}
function
postJSON
(
url
,
data
,
callback
)
{
const
ajaxOptions
=
{
data
:
JSON
.
stringify
(
data
),
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
)
}
});
</script>
</html>
\ No newline at end of file
public/jquery.min.js
0 → 100644
View file @
526a6f30
This diff is collapsed.
Click to expand it.
src/index.tsx
View file @
526a6f30
...
...
@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-04-27 20:35:34
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-0
3-31 16:30:47
* @LastEditTime: 2021-0
4-08 14:57:41
* @Description:
*/
...
...
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