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
55553ae5
Commit
55553ae5
authored
Mar 04, 2021
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 登录返回
parent
67f4b43d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
11 deletions
+40
-11
src/pages/index/index.vue
+11
-3
src/pages/login/index.vue
+6
-8
src/utils/index.js
+23
-0
No files found.
src/pages/index/index.vue
View file @
55553ae5
...
...
@@ -11,7 +11,7 @@
import
spokesman
from
"@/api/spokesman.js"
;
import
shop
from
"@/api/shop.js"
;
import
indexApi
from
"@/api/index.js"
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
import
{
serialize
,
getQueryVariable
,
DFSImg
,
delUrlParam
}
from
"@/utils/index"
;
import
login
from
"@/api/login"
;
export
default
{
data
()
{
...
...
@@ -23,7 +23,7 @@ export default {
baseUrl
:
process
.
env
.
BASE_URL
,
link
:
this
.
baseUrl
,
page
:
"/"
,
location_obj
:
wx
.
getStorageSync
(
"location"
),
location_obj
:
encodeURIComponent
(
wx
.
getStorageSync
(
"location"
)
),
params
:
"?mixid="
+
this
.
shopId
+
`&location_obj=
${
this
.
location_obj
}
`
,
userInfo
:
{
...
...
@@ -100,7 +100,12 @@ export default {
})
},
})
// 移除重复参数
if
(
options
.
params
)
{
let
params
=
decodeURIComponent
(
options
.
params
)
let
location_obj
=
getQueryVariable
(
params
,
"location_obj"
)
location_obj
&&
(
options
.
params
=
params
.
split
(
'&location_obj='
+
location_obj
).
join
(
''
))
}
//检测登录态
this
.
checkLogin
();
this
.
options
=
options
;
...
...
@@ -158,6 +163,9 @@ export default {
//来自小程序登录页面
this
.
page
=
decodeURIComponent
(
options
.
backpath
);
this
.
params
+=
"&"
+
decodeURIComponent
(
options
.
params
);
console
.
log
(
this
.
pageUrl
,
'1644444444444'
,
this
.
params
,
'-----'
,
options
)
}
else
if
(
options
.
from
&&
options
.
from
==
"logout"
)
{
//来自用户登出
wx
.
removeStorage
({
...
...
src/pages/login/index.vue
View file @
55553ae5
...
...
@@ -97,7 +97,6 @@ export default {
})
},
onLoad
(
options
)
{
console
.
log
(
options
,
'login'
)
Object
.
assign
(
this
.
$data
,
this
.
$options
.
data
());
//mpvue 的混合周期 使用小程序生命周期数据未初始化
if
(
options
.
back
)
{
this
.
backPath
=
options
.
back
;
...
...
@@ -319,14 +318,13 @@ export default {
}
else
{
let
parseLink
=
decodeURIComponent
(
this
.
backPath
);
let
isTabbarIndex
=
checkTabbarPage
(
parseLink
)
console
.
log
(
'32111'
,
isTabbarIndex
,
parseLink
)
wx
.
navigateBack
()
return
console
.
log
(
'32111'
,
isTabbarIndex
,
parseLink
,
this
.
backParams
)
//
wx.navigateBack()
//
return
if
(
isTabbarIndex
>-
1
){
wx
.
navigateBack
()
// wx.switchTab({
// url: parseLink == '/' ? '/pages/home/main' : `/pages/tabBar${isTabbarIndex}/main`,
// })
wx
.
switchTab
({
url
:
parseLink
==
'/'
?
'/pages/home/main'
:
`/pages/tabBar
${
isTabbarIndex
}
/main`
,
})
}
else
{
wx
.
redirectTo
({
url
:
`../index/main?from=login&backpath=
${
...
...
src/utils/index.js
View file @
55553ae5
...
...
@@ -44,6 +44,29 @@ export function getQueryVariable(query,variable) {
}
return
(
false
);
}
// 删除
export
function
delUrlParam
(
url
,
key
)
{
let
baseUrl
=
url
.
split
(
'?'
)[
0
]
+
'?'
;
let
query
=
url
.
split
(
'?'
)[
1
];
if
(
query
.
indexOf
(
key
)
>
-
1
)
{
let
obj
=
{};
let
arr
=
query
.
split
(
'&'
);
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
arr
[
i
]
=
arr
[
i
].
split
(
'='
);
obj
[
arr
[
i
][
0
]]
=
arr
[
i
][
1
];
}
delete
obj
[
key
];
let
url
=
baseUrl
+
JSON
.
stringify
(
obj
)
.
replace
(
/
[\"\{\}]
/g
,
''
)
.
replace
(
/
\:
/g
,
'='
)
.
replace
(
/
\,
/g
,
'&'
);
return
url
;
}
else
{
return
url
;
}
}
//补全图片路径
export
function
DFSImg
(
path
,
w
,
h
,
type
=
0
)
{
//
...
...
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