Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-app-customer-new-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-app-customer-new-master
Commits
36dd8d58
Commit
36dd8d58
authored
Aug 08, 2024
by
lizhan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
📝
【TASK-20240808-04】TASK:增加user个人信息节点
parent
0aa317a6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
user.js
src/store/modules/user.js
+19
-0
storage.js
src/utils/storage.js
+30
-0
No files found.
src/store/modules/user.js
0 → 100644
View file @
36dd8d58
import
storage
from
'
../../utils/storage
'
const
user
=
{
state
:
{
id
:
storage
.
get
(
'
vuex_id
'
),
areaCode
:
storage
.
get
(
'
vuex_areaCode
'
)
},
mutations
:
{
SET_ID
(
state
,
id
)
{
state
.
id
=
id
storage
.
set
(
'
vuex_id
'
,
id
)
},
SET_AREACODE
(
state
,
areaCode
)
{
state
.
areaCode
=
areaCode
storage
.
set
(
'
vuex_areaCode
'
,
areaCode
)
}
}
}
export
default
user
src/utils/storage.js
0 → 100644
View file @
36dd8d58
// 存储变量名
let
storageKey
=
'
storage_data
'
// 存储节点变量名
let
storageNodeKeys
=
[
'
vuex_id
'
,
'
vuex_areaCode
'
]
const
storage
=
{
set
:
function
(
key
,
value
)
{
if
(
storageNodeKeys
.
indexOf
(
key
)
!=
-
1
)
{
let
tmp
=
uni
.
getStorageSync
(
storageKey
)
tmp
=
tmp
?
tmp
:
{}
tmp
[
key
]
=
value
uni
.
setStorageSync
(
storageKey
,
tmp
)
}
},
get
:
function
(
key
)
{
let
storageData
=
uni
.
getStorageSync
(
storageKey
)
||
{}
return
storageData
[
key
]
||
''
},
remove
:
function
(
key
)
{
let
storageData
=
uni
.
getStorageSync
(
storageKey
)
||
{}
delete
storageData
[
key
]
uni
.
setStorageSync
(
storageKey
,
storageData
)
},
clean
:
function
()
{
uni
.
removeStorageSync
(
storageKey
)
}
}
export
default
storage
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