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
5babe6db
Commit
5babe6db
authored
Apr 29, 2021
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sso
parent
de7b8371
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
24 deletions
+48
-24
src/pages/wxArticle/index.vue
+48
-24
No files found.
src/pages/wxArticle/index.vue
View file @
5babe6db
...
@@ -18,33 +18,57 @@
...
@@ -18,33 +18,57 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
indexApi
from
"@/api/index.js"
;
export
default
{
export
default
{
data
(){
data
()
{
return
{
return
{
link
:
''
link
:
""
,
}
};
},
async
onLoad
(
options
)
{
if
(
options
.
link
)
{
this
.
link
=
decodeURIComponent
(
options
.
link
);
}
else
if
(
options
.
scene
)
{
//扫码
let
data
=
await
this
.
getParams
(
options
.
scene
||
"959ce6ac97cf4f43a1759eb41ec12798"
);
if
(
data
.
sso
==
"sso"
&&
!
wx
.
getStorageSync
(
"sessionid"
))
{
let
link
=
decodeURIComponent
(
data
.
link
).
replace
(
"${token}"
,
wx
.
getStorageSync
(
"sessionid"
)
);
wx
.
redirectTo
({
url
:
`../login/main?scene=sso&back=
${
link
}
`
,
});
}
else
{
this
.
link
=
data
.
link
;
}
}
},
methods
:
{
getParams
(
options
)
{
return
indexApi
.
getShareSceneRecord
(
options
)
.
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
"200"
)
{
console
.
log
(
"5666666"
,
res
);
let
scene
=
JSON
.
parse
(
res
.
data
.
data
.
scene
);
resolve
(
scene
.
link
);
}
})
.
catch
((
err
)
=>
{});
},
},
onLoad
(
options
){
//加载成功
if
(
options
.
scene
==
'sso'
&&
!
wx
.
getStorageSync
(
"sessionid"
))
{
handleLoad
()
{
wx
.
redirectTo
({
console
.
log
(
"网页加载成功"
);
url
:
`../login/main?scene=sso&back=
${
link
}
`
});
}
else
{
console
.
log
(
decodeURIComponent
(
options
.
link
),
'地址'
)
this
.
link
=
decodeURIComponent
(
options
.
link
)
}
},
},
methods
:
{
handleError
(
data
)
{
//加载成功
wx
.
showLoading
({
handleLoad
()
{
title
:
"网页加载失败 请右上角刷新"
,
console
.
log
(
"网页加载成功"
);
});
},
},
handleError
(
data
)
{
},
wx
.
showLoading
({
title
:
"网页加载失败 请右上角刷新"
,
});
},
}
};
};
</
script
>
</
script
>
...
...
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