Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李俊赕
self-support
Commits
ce3dbf48
Commit
ce3dbf48
authored
Jun 30, 2021
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
超级用户存到storage
parent
364faa82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
mine.vue
src/pages/index/mine.vue
+10
-7
index.js
src/store/index.js
+2
-1
No files found.
src/pages/index/mine.vue
View file @
ce3dbf48
...
...
@@ -17,7 +17,7 @@
<u-icon
class=
"tel-arrow-icon"
name=
"arrow-up-fill"
></u-icon>
</view>
</view>
<view
v-if=
"
showSuperButton
"
class=
"super-button"
><u-button
@
click=
"$u.throttle(handleSuperButton, 500)"
>
切换用户
</u-button></view>
<view
v-if=
"
isSuperuser
"
class=
"super-button"
><u-button
@
click=
"$u.throttle(handleSuperButton, 500)"
>
切换用户
</u-button></view>
</view>
<view
class=
"header-right-view"
@
click=
"$u.throttle(handleClickSetting, 500)"
>
<image
:src=
"shezhiImage"
class=
"right-image-view"
></image>
...
...
@@ -62,7 +62,7 @@
data
()
{
return
{
serviceTel
:
'18124099271'
,
showSuperButton
:
false
,
//
showSuperButton: false,
show
:
false
,
content
:
'是否确认退出该账户?'
,
wodebeijingImage
:
''
,
...
...
@@ -181,12 +181,15 @@
},
shezhiImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'shezhi.png'
},
isSuperuser
()
{
return
this
.
vuex_superuser
}
},
async
onLoad
()
{
onLoad
()
{
app
.
trackPage
(
'我的首页'
)
if
(
this
.
vuex_token
)
{
if
(
!
this
.
showSuperButton
)
{
if
(
!
this
.
isSuperuser
)
{
this
.
allowLogin
()
}
...
...
@@ -234,10 +237,10 @@
login
.
setUserData
({},
this
);
app
.
globalData
.
logout
=
true
},
async
allowLogin
()
{
async
allowLogin
()
{
// 超级用户,显示登录按钮
let
res
=
await
this
.
$u
.
api
.
allowLogin
()
if
(
res
&&
res
.
code
==
200
)
{
this
.
showSuperButton
=
res
.
data
===
true
if
(
res
&&
res
.
code
==
200
)
{
this
.
$u
.
vuex
(
'vuex_superuser'
,
res
.
data
);
}
},
...
...
src/store/index.js
View file @
ce3dbf48
...
...
@@ -12,7 +12,7 @@ try {
}
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
let
saveStateKeys
=
[
'vuex_user'
,
'vuex_wx_uid'
,
'vuex_token'
,
'vuex_cache'
,
'uploadTask'
];
let
saveStateKeys
=
[
'vuex_user'
,
'vuex_wx_uid'
,
'vuex_token'
,
'vuex_cache'
,
'uploadTask'
,
'vuex_superuser'
];
// 保存变量到本地存储中
const
saveLifeData
=
function
(
key
,
value
)
{
...
...
@@ -33,6 +33,7 @@ const store = new Vuex.Store({
vuex_user
:
lifeData
.
vuex_user
?
lifeData
.
vuex_user
:
{},
vuex_token
:
lifeData
.
vuex_token
?
lifeData
.
vuex_token
:
''
,
vuex_cache
:
lifeData
.
vuex_cache
?
lifeData
.
vuex_cache
:
{},
vuex_superuser
:
lifeData
.
vuex_superuser
||
false
,
vuex_version
:
'1.0.1'
,
vuex_config
:
{},
// 入驻信息
...
...
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