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
Hide 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";
import
{
themeColor
,
checkShowConditionIds
,
getStoreInfo
,
setStoreInfo
}
from
"@/utils/mayi"
;
import
{
query_isEntry
}
from
"@/utils/mayi_fenxiao"
;
import
{
serialize
}
from
"@/utils/index"
;
export
default
{
data
()
{
...
...
@@ -57,7 +58,8 @@ export default {
mode
:
process
.
env
.
NODE_ENV
,
gid
:
this
.
extConfig
.
groupId
,
mixid
:
this
.
extConfig
.
mixid
,
host
:
process
.
env
.
MANALYTICS_HOST
+
'?'
,
host
:
process
.
env
.
MANALYTICS_HOST
+
'?'
,
os
:
this
.
getOsJSON
(),
})
console
.
log
(
"1444444444"
,
this
.
extConfig
);
...
...
@@ -311,7 +313,9 @@ export default {
console
.
log
(
this
.
mpApp
,
"mmmmm74"
,
themeColor
);
// 强制登录
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
(
backUrl
)}
&hideBack=1`
;
...
...
@@ -332,12 +336,12 @@ export default {
}
})
},
async
getThemePage
({
mixid
,
shopid
})
{
async
getThemePage
({
mixid
,
shopid
,
offlineShopCode
})
{
console
.
log
(
"getThemePage--App.vue"
)
let
{
offlineShopCode
}
=
getStoreInfo
()
;
let
osCode
=
offlineShopCode
?
offlineShopCode
:
getStoreInfo
().
offlineShopCode
;
await
shop
.
themePagesInfo
({
shopMixId
:
o
fflineShopCode
?
offlineShopCode
:
mixid
,
shopMixId
:
o
sCode
?
osCode
:
mixid
,
homePageFlag
:
false
})
.
then
((
response
)
=>
{
...
...
@@ -365,7 +369,16 @@ export default {
})
.
catch
((
err
)
=>
{});
},
// ---
getOsJSON
()
{
let
obj
=
{
osName
:
''
,
// ios或安卓
osVersion
:
''
,
// 操作系统版本号
wxVersion
:
''
,
// 微信版本号
wxSDKVersion
:
''
,
// 微信小程序SDK版本
mpCodeVersion
:
''
,
// 小程序环境时, 我们内部小程序的版本信息
};
return
Obj
;
}
},
onError
(
data
)
{
console
.
log
(
data
,
"js异常捕获"
);
...
...
src/main.js
View file @
2e6ba997
...
...
@@ -157,12 +157,12 @@ mpApp.themeColor = {}
mpApp
.
log
=
log
mpApp
.
tool
=
tool
function
getThemePage
({
mixid
,
shopid
})
{
function
getThemePage
({
mixid
,
shopid
,
offlineShopCode
})
{
console
.
log
(
"getThemePage--main.js"
)
let
{
offlineShopCode
}
=
getStoreInfo
()
;
let
osCode
=
offlineShopCode
?
offlineShopCode
:
getStoreInfo
().
offlineShopCode
;
shop
.
themePagesInfo
({
shopMixId
:
o
fflineShopCode
?
offlineShopCode
:
mixid
,
shopMixId
:
o
sCode
?
osCode
:
mixid
,
homePageFlag
:
false
,
})
.
then
((
response
)
=>
{
...
...
@@ -206,9 +206,11 @@ wx.onAppRoute(res => {
const
url
=
`/pages/login/main?back=
${
encodeURIComponent
(
backUrl
)}
&hideBack=1`
;
wx
.
navigateTo
({
url
:
url
});
// TODO 暂时注释
// console.log('强制登录->', 2)
// wx.navigateTo({
// url: url
// });
}
new
Promise
((
resolve
)
=>
{
if
(
!
spokesmanId
)
{
...
...
src/pages/index/index.vue
View file @
2e6ba997
...
...
@@ -367,6 +367,7 @@ export default {
offlineShopCode
:
paramsObj
.
offlineShopCode
,
offlineShopName
:
paramsObj
.
offlineShopName
,
});
this
.
getThemePage
();
}
// 判断是否为导购分享进入
if
(
paramsObj
.
setGuideEmployeeId
)
{
...
...
@@ -529,7 +530,7 @@ export default {
init
()
{
console
.
log
(
'index-init'
,
this
.
mpApp
.
globalData
.
pageList
);
if
(
!
this
.
mpApp
.
globalData
.
pageList
)
{
app
.
getThemePage
(
this
.
$store
.
state
.
extConfig
);
this
.
getThemePage
(
);
}
// 获取小程序开启的订阅消息配置
shop
.
getWxMiniSubscribeMessageConfig
().
then
(
res
=>
{
...
...
@@ -549,6 +550,12 @@ export default {
}
});
},
// 每次更新缓存门店需要重新调用主题数据
getThemePage
()
{
let
{
offlineShopCode
}
=
getStoreInfo
();
console
.
log
(
'index-init-offlineShopCode->'
,
offlineShopCode
);
app
.
getThemePage
({...
this
.
$store
.
state
.
extConfig
,
offlineShopCode
});
},
checkLogin
()
{
let
getOpenid
=
wx
.
getStorageSync
(
"openid"
);
let
getSessionid
=
wx
.
getStorageSync
(
"sessionid"
);
...
...
src/pages/login/index.vue
View file @
2e6ba997
...
...
@@ -678,7 +678,8 @@ export default {
let
parseLink
=
decodeURIComponent
(
this
.
backPath
);
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"
)){
wx
.
reLaunch
({
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