Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SURPRISED
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
华国豪
SURPRISED
Commits
ab2e936b
Commit
ab2e936b
authored
Nov 13, 2019
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增获取OPENID
parent
53e31ce8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
23 deletions
+26
-23
GT_activities.html
html/GT_activities.html
+26
-23
No files found.
html/GT_activities.html
View file @
ab2e936b
...
@@ -194,25 +194,10 @@
...
@@ -194,25 +194,10 @@
if
(
platform
==
'H5'
&&
ua
.
match
(
/MicroMessenger/i
)
!=
"micromessenger"
)
{
if
(
platform
==
'H5'
&&
ua
.
match
(
/MicroMessenger/i
)
!=
"micromessenger"
)
{
$
(
'.wx_bg'
).
css
(
'display'
,
"block"
);
$
(
'.wx_bg'
).
css
(
'display'
,
"block"
);
}
else
if
(
platform
==
'H5'
&&
!
userInfo
.
openid
&&
window
.
location
.
href
.
indexOf
(
'?'
)
==
-
1
)
{
}
else
if
(
platform
==
'H5'
)
{
let
reu
=
encodeURIComponent
(
window
.
location
.
href
);
this
.
initOpenid
()
location
.
href
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx44c35529819fc345&redirect_uri=
${
reu
}
&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
}
else
if
(
platform
==
'H5'
&&
!
userInfo
.
openid
&&
window
.
location
.
href
.
indexOf
(
'code'
)
!=
-
1
)
{
let
codes
=
href
.
split
(
'?'
)[
1
].
split
(
"&"
);
let
url_openid
=
`https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx44c35529819fc345&secret=2af0d735ab66341bec6c96d97bca2e4e&code=
${
codes
[
0
].
split
(
"="
)[
1
]}
&grant_type=authorization_code`
$
.
getJSON
(
"http://query.yahooapis.com/v1/public/yql"
,
{
q
:
`select * from json where url="
${
url_openid
}
"`
,
format
:
"json"
},
function
(
data
)
{
console
.
log
(
data
)
if
(
data
.
query
.
results
)
{
console
.
log
(
data
)
}
else
{
//$content.text('no such code: ' + code);
}
});
}
}
var
end
=
''
;
var
end
=
''
;
var
currentTime
=
''
;
var
currentTime
=
''
;
localStorage
.
userInfo
=
JSON
.
stringify
(
userInfo
)
localStorage
.
userInfo
=
JSON
.
stringify
(
userInfo
)
...
@@ -236,10 +221,6 @@
...
@@ -236,10 +221,6 @@
$
(
'.use_o'
).
html
(
res
.
data
.
contact
);
$
(
'.use_o'
).
html
(
res
.
data
.
contact
);
$
(
'.use_t'
).
html
(
res
.
data
.
customerName
);
$
(
'.use_t'
).
html
(
res
.
data
.
customerName
);
$
(
'.dataStatistics'
).
dataStatistics
({
$
(
'.dataStatistics'
).
dataStatistics
({
max
:
num
,
max
:
num
,
min
:
num
,
min
:
num
,
...
@@ -451,7 +432,29 @@
...
@@ -451,7 +432,29 @@
}
}
function
initOpenid
()
{
if
(
!
localStorage
.
openid
&&
window
.
location
.
href
.
indexOf
(
'?'
)
==
-
1
)
{
let
reu
=
encodeURIComponent
(
window
.
location
.
href
);
location
.
href
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx44c35529819fc345&redirect_uri=
${
reu
}
&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
}
else
if
(
!
localStorage
.
openid
&&
window
.
location
.
href
.
indexOf
(
'code'
)
!=
-
1
)
{
let
codes
=
href
.
split
(
'?'
)[
1
].
split
(
"&"
);
let
url_openid
=
`https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx44c35529819fc345&secret=2af0d735ab66341bec6c96d97bca2e4e&code=
${
codes
[
0
].
split
(
"="
)[
1
]}
&grant_type=authorization_code`
url_openid
=
encodeURIComponent
(
url_openid
);
$
.
ajax
({
type
:
"GET"
,
url
:
'http://reborn.oytour.com/api/test/GetHtmlByUrl?urlStr='
+
url_openid
,
async
:
false
,
success
:
function
(
res
)
{
if
(
res
)
{
let
r
=
JSON
.
parse
(
res
);
if
(
r
.
openid
)
{
localStorage
.
openid
=
r
.
openid
}
}
}
});
}
}
$
(
'.c_close'
).
click
(
function
()
{
$
(
'.c_close'
).
click
(
function
()
{
$
(
'#notice'
).
css
(
'display'
,
"none"
);
$
(
'#notice'
).
css
(
'display'
,
"none"
);
...
...
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