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
2e6ba997
Commit
2e6ba997
authored
Jul 02, 2024
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat: 强制登录优化
parent
1edb028a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
14 deletions
+37
-14
src/App.vue
+19
-6
src/main.js
+8
-6
src/pages/index/index.vue
+8
-1
src/pages/login/index.vue
+2
-1
No files found.
src/App.vue
View file @
2e6ba997
...
@@ -6,6 +6,7 @@ import spokesman from "@/api/spokesman";
...
@@ -6,6 +6,7 @@ import spokesman from "@/api/spokesman";
import
{
themeColor
,
checkShowConditionIds
,
getStoreInfo
,
setStoreInfo
}
from
"@/utils/mayi"
;
import
{
themeColor
,
checkShowConditionIds
,
getStoreInfo
,
setStoreInfo
}
from
"@/utils/mayi"
;
import
{
query_isEntry
}
from
"@/utils/mayi_fenxiao"
;
import
{
query_isEntry
}
from
"@/utils/mayi_fenxiao"
;
import
{
serialize
}
from
"@/utils/index"
;
export
default
{
export
default
{
data
()
{
data
()
{
...
@@ -57,7 +58,8 @@ export default {
...
@@ -57,7 +58,8 @@ export default {
mode
:
process
.
env
.
NODE_ENV
,
mode
:
process
.
env
.
NODE_ENV
,
gid
:
this
.
extConfig
.
groupId
,
gid
:
this
.
extConfig
.
groupId
,
mixid
:
this
.
extConfig
.
mixid
,
mixid
:
this
.
extConfig
.
mixid
,
host
:
process
.
env
.
MANALYTICS_HOST
+
'?'
,
host
:
process
.
env
.
MANALYTICS_HOST
+
'?'
,
os
:
this
.
getOsJSON
(),
})
})
console
.
log
(
"1444444444"
,
this
.
extConfig
);
console
.
log
(
"1444444444"
,
this
.
extConfig
);
...
@@ -311,7 +313,9 @@ export default {
...
@@ -311,7 +313,9 @@ export default {
console
.
log
(
this
.
mpApp
,
"mmmmm74"
,
themeColor
);
console
.
log
(
this
.
mpApp
,
"mmmmm74"
,
themeColor
);
// 强制登录
// 强制登录
if
(
res
.
data
.
data
.
whetherToForceLogin
==
1
&&
!
wx
.
getStorageSync
(
'sessionid'
))
{
if
(
res
.
data
.
data
.
whetherToForceLogin
==
1
&&
!
wx
.
getStorageSync
(
'sessionid'
))
{
let
backUrl
=
`/pages/home/main`
;
console
.
log
(
'强制登录->'
,
this
.
$mp
.
appOptions
);
let
backQuery
=
serialize
(
this
.
$mp
.
appOptions
.
query
);
let
backUrl
=
`/
${
this
.
$mp
.
appOptions
.
path
}
`
+
`
${
backQuery
?
`?
${
backQuery
}
`
:
''
}
`
;
const
url
=
`/pages/login/main?back=
${
encodeURIComponent
(
const
url
=
`/pages/login/main?back=
${
encodeURIComponent
(
backUrl
backUrl
)}
&hideBack=1`
;
)}
&hideBack=1`
;
...
@@ -332,12 +336,12 @@ export default {
...
@@ -332,12 +336,12 @@ export default {
}
}
})
})
},
},
async
getThemePage
({
mixid
,
shopid
})
{
async
getThemePage
({
mixid
,
shopid
,
offlineShopCode
})
{
console
.
log
(
"getThemePage--App.vue"
)
console
.
log
(
"getThemePage--App.vue"
)
let
{
offlineShopCode
}
=
getStoreInfo
()
;
let
osCode
=
offlineShopCode
?
offlineShopCode
:
getStoreInfo
().
offlineShopCode
;
await
shop
await
shop
.
themePagesInfo
({
.
themePagesInfo
({
shopMixId
:
o
fflineShopCode
?
offlineShopCode
:
mixid
,
shopMixId
:
o
sCode
?
osCode
:
mixid
,
homePageFlag
:
false
homePageFlag
:
false
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
...
@@ -365,7 +369,16 @@ export default {
...
@@ -365,7 +369,16 @@ export default {
})
})
.
catch
((
err
)
=>
{});
.
catch
((
err
)
=>
{});
},
},
// ---
getOsJSON
()
{
let
obj
=
{
osName
:
''
,
// ios或安卓
osVersion
:
''
,
// 操作系统版本号
wxVersion
:
''
,
// 微信版本号
wxSDKVersion
:
''
,
// 微信小程序SDK版本
mpCodeVersion
:
''
,
// 小程序环境时, 我们内部小程序的版本信息
};
return
Obj
;
}
},
},
onError
(
data
)
{
onError
(
data
)
{
console
.
log
(
data
,
"js异常捕获"
);
console
.
log
(
data
,
"js异常捕获"
);
...
...
src/main.js
View file @
2e6ba997
...
@@ -157,12 +157,12 @@ mpApp.themeColor = {}
...
@@ -157,12 +157,12 @@ mpApp.themeColor = {}
mpApp
.
log
=
log
mpApp
.
log
=
log
mpApp
.
tool
=
tool
mpApp
.
tool
=
tool
function
getThemePage
({
mixid
,
shopid
})
{
function
getThemePage
({
mixid
,
shopid
,
offlineShopCode
})
{
console
.
log
(
"getThemePage--main.js"
)
console
.
log
(
"getThemePage--main.js"
)
let
{
offlineShopCode
}
=
getStoreInfo
()
;
let
osCode
=
offlineShopCode
?
offlineShopCode
:
getStoreInfo
().
offlineShopCode
;
shop
shop
.
themePagesInfo
({
.
themePagesInfo
({
shopMixId
:
o
fflineShopCode
?
offlineShopCode
:
mixid
,
shopMixId
:
o
sCode
?
osCode
:
mixid
,
homePageFlag
:
false
,
homePageFlag
:
false
,
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
...
@@ -206,9 +206,11 @@ wx.onAppRoute(res => {
...
@@ -206,9 +206,11 @@ wx.onAppRoute(res => {
const
url
=
`/pages/login/main?back=
${
encodeURIComponent
(
const
url
=
`/pages/login/main?back=
${
encodeURIComponent
(
backUrl
backUrl
)}
&hideBack=1`
;
)}
&hideBack=1`
;
wx
.
navigateTo
({
// TODO 暂时注释
url
:
url
// console.log('强制登录->', 2)
});
// wx.navigateTo({
// url: url
// });
}
}
new
Promise
((
resolve
)
=>
{
new
Promise
((
resolve
)
=>
{
if
(
!
spokesmanId
)
{
if
(
!
spokesmanId
)
{
...
...
src/pages/index/index.vue
View file @
2e6ba997
...
@@ -367,6 +367,7 @@ export default {
...
@@ -367,6 +367,7 @@ export default {
offlineShopCode
:
paramsObj
.
offlineShopCode
,
offlineShopCode
:
paramsObj
.
offlineShopCode
,
offlineShopName
:
paramsObj
.
offlineShopName
,
offlineShopName
:
paramsObj
.
offlineShopName
,
});
});
this
.
getThemePage
();
}
}
// 判断是否为导购分享进入
// 判断是否为导购分享进入
if
(
paramsObj
.
setGuideEmployeeId
)
{
if
(
paramsObj
.
setGuideEmployeeId
)
{
...
@@ -529,7 +530,7 @@ export default {
...
@@ -529,7 +530,7 @@ export default {
init
()
{
init
()
{
console
.
log
(
'index-init'
,
this
.
mpApp
.
globalData
.
pageList
);
console
.
log
(
'index-init'
,
this
.
mpApp
.
globalData
.
pageList
);
if
(
!
this
.
mpApp
.
globalData
.
pageList
)
{
if
(
!
this
.
mpApp
.
globalData
.
pageList
)
{
app
.
getThemePage
(
this
.
$store
.
state
.
extConfig
);
this
.
getThemePage
(
);
}
}
// 获取小程序开启的订阅消息配置
// 获取小程序开启的订阅消息配置
shop
.
getWxMiniSubscribeMessageConfig
().
then
(
res
=>
{
shop
.
getWxMiniSubscribeMessageConfig
().
then
(
res
=>
{
...
@@ -549,6 +550,12 @@ export default {
...
@@ -549,6 +550,12 @@ export default {
}
}
});
});
},
},
// 每次更新缓存门店需要重新调用主题数据
getThemePage
()
{
let
{
offlineShopCode
}
=
getStoreInfo
();
console
.
log
(
'index-init-offlineShopCode->'
,
offlineShopCode
);
app
.
getThemePage
({...
this
.
$store
.
state
.
extConfig
,
offlineShopCode
});
},
checkLogin
()
{
checkLogin
()
{
let
getOpenid
=
wx
.
getStorageSync
(
"openid"
);
let
getOpenid
=
wx
.
getStorageSync
(
"openid"
);
let
getSessionid
=
wx
.
getStorageSync
(
"sessionid"
);
let
getSessionid
=
wx
.
getStorageSync
(
"sessionid"
);
...
...
src/pages/login/index.vue
View file @
2e6ba997
...
@@ -678,7 +678,8 @@ export default {
...
@@ -678,7 +678,8 @@ export default {
let
parseLink
=
decodeURIComponent
(
this
.
backPath
);
let
parseLink
=
decodeURIComponent
(
this
.
backPath
);
log
.
info
(
this
.
backPath
,
parseLink
,
'---------------------------325'
)
log
.
info
(
this
.
backPath
,
parseLink
,
'---------------------------325'
)
console
.
log
(
this
.
backPath
,
parseLink
,
this
.
ossLink
,
'---------------------------595'
)
console
.
log
(
this
.
backPath
,
parseLink
,
this
.
ossLink
,
'---------------------------595'
)
console
.
log
(
'login-pushPageType->parseLink'
,
parseLink
);
if
(
parseLink
.
includes
(
'/pages/'
)
&&
!
parseLink
.
startsWith
(
"http"
)){
if
(
parseLink
.
includes
(
'/pages/'
)
&&
!
parseLink
.
startsWith
(
"http"
)){
wx
.
reLaunch
({
wx
.
reLaunch
({
url
:
parseLink
url
:
parseLink
...
...
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