Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小刘28
xz-uniapp
提交
80049ce5
xz-uniapp
项目概览
小刘28
/
xz-uniapp
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
xz-uniapp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
80049ce5
编写于
9月 01, 2022
作者:
小刘28
💬
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'lxl'
上级
403da0a1
47d6bca9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
50 addition
and
16 deletion
+50
-16
pages.json
pages.json
+15
-11
pages/tabbar-a/tabbar-a.vue
pages/tabbar-a/tabbar-a.vue
+21
-2
static/normal.png
static/normal.png
+0
-0
static/selected.png
static/selected.png
+0
-0
store/index.js
store/index.js
+14
-3
未找到文件。
pages.json
浏览文件 @
80049ce5
{
"pages"
:
[
{
"path"
:
"pages/template/template-2-web"
,
"style"
:
{
"navigationBarTitleText"
:
"template-2-web"
}
},
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path"
:
"pages/tabbar-a/tabbar-a"
,
...
...
@@ -138,23 +132,33 @@
"list"
:
[
{
"pagePath"
:
"pages/tabbar-a/tabbar-a"
,
"text"
:
"页面A"
"text"
:
"页面A"
,
"iconPath"
:
"static/normal.png"
,
"selectedIconPath"
:
"static/selected.png"
},
{
"pagePath"
:
"pages/tabbar-b/tabbar-b"
,
"text"
:
"页面B"
"text"
:
"页面B"
,
"iconPath"
:
"static/normal.png"
,
"selectedIconPath"
:
"static/selected.png"
},
{
"pagePath"
:
"pages/tabbar-c/tabbar-c"
,
"text"
:
"页面C"
"text"
:
"页面C"
,
"iconPath"
:
"static/normal.png"
,
"selectedIconPath"
:
"static/selected.png"
},
{
"pagePath"
:
"pages/tabbar-d/tabbar-d"
,
"text"
:
"页面D"
"text"
:
"页面D"
,
"iconPath"
:
"static/normal.png"
,
"selectedIconPath"
:
"static/selected.png"
},
{
"pagePath"
:
"pages/tabbar-e/tabbar-e"
,
"text"
:
"页面E"
"text"
:
"页面E"
,
"iconPath"
:
"static/normal.png"
,
"selectedIconPath"
:
"static/selected.png"
}
]
},
...
...
pages/tabbar-a/tabbar-a.vue
浏览文件 @
80049ce5
<
template
>
<view>
<view
class=
""
>
<button
@
click=
"clickGetUserRoles()"
>
获取当前用户拥有的角色
</button>
</view>
<view
class=
""
>
<button
@
click=
"clickAddRolesToUser()"
>
给当前用户添加角色
</button>
</view>
<view
class=
""
>
<button
@
click=
"clickSearchUserIncludeRole()"
>
查询用户是否拥有user角色
</button>
</view>
</view>
</
template
>
...
...
@@ -12,7 +20,18 @@
}
},
methods
:
{
clickGetUserRoles
(){
let
roles
=
this
.
$store
.
getters
.
getRoles
;
console
.
log
(
roles
);
},
clickAddRolesToUser
(){
let
roles
=
[
'
admin
'
,
'
user
'
,
'
user1
'
];
this
.
$store
.
commit
(
'
M_updateRoles
'
,
roles
);
},
clickSearchUserIncludeRole
(){
let
flag
=
this
.
$store
.
getters
.
getSearchRole
(
'
user1
'
);
console
.
log
(
flag
);
},
}
}
</
script
>
...
...
static/normal.png
0 → 100644
浏览文件 @
80049ce5
1.7 KB
static/selected.png
0 → 100644
浏览文件 @
80049ce5
1.7 KB
store/index.js
浏览文件 @
80049ce5
...
...
@@ -6,11 +6,16 @@ Vue.use(Vuex);
//Vuex.Store 构造器选项
const
store
=
new
Vuex
.
Store
({
state
:
{
//存放状态
state
:
{
// 用户信息
user
:
uni
.
getStorageSync
(
'
user
'
)
||
{},
// token信息
token
:
uni
.
getStorageSync
(
'
token
'
)
||
''
,
// 是否登录
isLogin
:
uni
.
getStorageSync
(
'
isLogin
'
)
||
false
,
roles
:
uni
.
getStorageSync
(
'
roles
'
)
||
{},
// 用户拥有的角色
roles
:
uni
.
getStorageSync
(
'
roles
'
)
||
[],
// 用户拥有的权限
premiss
:
uni
.
getStorageSync
(
'
premiss
'
)
||
[],
},
mutations
:
{
...
...
@@ -69,9 +74,15 @@ const store = new Vuex.Store({
getRoles
(
state
)
{
return
state
.
roles
;
},
getSearchRole
:(
state
)
=>
(
role
)
=>
{
return
state
.
roles
.
includes
(
role
);
},
getPremiss
(
state
)
{
return
state
.
premiss
;
}
},
getSearchPremiss
:(
state
)
=>
(
premiss
)
=>
{
return
state
.
premiss
.
includes
(
premiss
);
},
},
modules
:
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录