Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
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
程默
mayi-mp-shop
Commits
b32c2621
Commit
b32c2621
authored
May 18, 2021
by
张卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
第三方页面扫码登录,商城点击登录兼容
parent
1f3e66a1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
9 deletions
+66
-9
src/api/login.js
+5
-0
src/pages/wxArticle/index.vue
+61
-9
No files found.
src/api/login.js
View file @
b32c2621
...
...
@@ -15,6 +15,10 @@ console.log(process.env,'-----------------config------')
//check unionid
checkUnionid
(
options
){
return
requestGET
(
`
${
process
.
env
.
OLSHOP_URL
}
/wx/mini_check_union_id`
,
options
)
},
// sso登录
getSsoBcakUrl
(
options
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/common/getSsoCallbackUrl`
,
options
)
}
}
\ No newline at end of file
src/pages/wxArticle/index.vue
View file @
b32c2621
...
...
@@ -13,13 +13,12 @@
</
template
>
<
script
>
let
forUrlAddKey
;
let
getUrlKey
;
if
(
process
.
browser
)
{
forUrlAddKey
=
require
(
"mayi-front-tools/forUrlAddKey"
).
default
getUrlKey
=
require
(
"mayi-front-tools/getUrlKey"
).
default
}
let
forUrlAddKey
=
require
(
"mayi-front-tools/forUrlAddKey"
).
default
;
let
getUrlKey
=
require
(
"mayi-front-tools/getUrlKey"
).
default
;
let
removeUrlKey
=
require
(
"mayi-front-tools/removeUrlKey"
).
default
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
import
login
from
"@/api/login"
;
import
indexApi
from
"@/api/index"
;
export
default
{
data
(){
return
{
...
...
@@ -29,9 +28,32 @@ export default {
newWindowHref
:
''
,
//分享页面url
}
},
onLoad
(
options
){
console
.
log
(
decodeURIComponent
(
options
.
link
),
'地址'
,
wx
.
getStorageSync
(
"sessionid"
),
forUrlAddKey
(
decodeURIComponent
(
options
.
link
),{
token
:
wx
.
getStorageSync
(
"sessionid"
),
jwt
:
1
}))
if
(
getUrlKey
(
decodeURIComponent
(
options
.
link
),
'login'
)
!=
'1'
)
{
async
onLoad
(
options
){
// this.link = 'https://www.baidu.com/?token=550e48f594414525a1bd0dfda431e370&scene=sso'
// return
if
(
options
.
scene
)
{
//扫码
let
data
=
await
this
.
getParams
(
options
.
scene
);
console
.
log
(
data
,
888999
,
wx
.
getStorageSync
(
"sessionid"
))
// debugger
if
(
data
.
sso
)
{
if
(
!
wx
.
getStorageSync
(
"sessionid"
))
{
wx
.
redirectTo
({
url
:
`../login/main?scene=sso&back=
${
data
.
link
}
`
,
});
}
else
{
this
.
getSsoBcakUrl
(
decodeURIComponent
(
data
.
link
))
// let link = decodeURIComponent(data.link).replace(
// "${token}",
// wx.getStorageSync("sessionid")
// );
// this.link = decodeURIComponent(link);
}
}
}
else
if
(
options
.
link
){
if
(
getUrlKey
(
decodeURIComponent
(
options
.
link
),
'scene'
)
==
'sso'
)
{
this
.
getSsoBcakUrl
(
decodeURIComponent
(
options
.
link
))
}
else
if
(
getUrlKey
(
decodeURIComponent
(
options
.
link
),
'login'
)
!=
'1'
)
{
this
.
link
=
decodeURIComponent
(
options
.
link
)
}
else
{
if
(
wx
.
getStorageSync
(
"sessionid"
))
{
...
...
@@ -49,6 +71,7 @@ export default {
})
}
}
}
},
async
onShareAppMessage
(
res
)
{
let
url
=
''
...
...
@@ -59,6 +82,7 @@ export default {
}
else
{
url
=
res
.
webViewUrl
;
}
url
=
removeUrlKey
(
url
,[
'token'
])
//分享页面去掉登录态
if
(
url
.
indexOf
(
"sessionid"
)
>
-
1
)
{
url
=
url
.
split
(
"?"
)[
0
]
+
"?mixid="
+
this
.
shopId
;
...
...
@@ -91,6 +115,34 @@ export default {
};
},
methods
:
{
getSsoBcakUrl
(
link
)
{
let
op
=
{
callbackUrl
:
link
,
email
:
""
,
fromAppid
:
"VsEOuDJqBnGNyXZJWCQS"
,
// mobilephone: '15821335747',hgFTLLhgnBmeOyCkcbyv
toAppid
:
'hgFTLLhgnBmeOyCkcbyv'
,
// toAppid: getUrlKey(link,'toAppid'),//道可
wxAvatarUrl
:
this
.
$store
.
state
.
userInfo
.
avatarUrl
,
};
login
.
getSsoBcakUrl
(
op
).
then
((
res
)
=>
{
this
.
link
=
res
.
data
.
data
;
console
.
log
(
res
,
this
.
link
,
555444
)
});
},
getParams
(
options
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
indexApi
.
getShareSceneRecord
(
options
)
.
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
"200"
)
{
let
scene
=
JSON
.
parse
(
res
.
data
.
data
.
scene
);
resolve
(
scene
);
}
})
.
catch
((
err
)
=>
{});
});
},
//加载成功
handleLoad
()
{
console
.
log
(
"网页加载成功"
);
...
...
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