Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
e894c12c
U
uni-starter
项目概览
DCloud
/
uni-starter
通知
4690
Star
229
Fork
210
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e894c12c
编写于
5月 22, 2021
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
宫格页新增根据,当前用户是否登陆、是否为管理员的角色来决定是否显示
上级
5a8dda09
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
148 addition
and
49 deletion
+148
-49
README.md
README.md
+5
-0
changelog.md
changelog.md
+4
-0
components/uni-id-show/uni-id-show.vue
components/uni-id-show/uni-id-show.vue
+59
-0
components/uni-quick-login/uni-quick-login.vue
components/uni-quick-login/uni-quick-login.vue
+1
-1
package.json
package.json
+1
-1
pages/grid/grid.vue
pages/grid/grid.vue
+77
-46
pages/list/list.nvue
pages/list/list.nvue
+1
-1
未找到文件。
README.md
浏览文件 @
e894c12c
...
...
@@ -375,6 +375,11 @@ uni-starter
</pre>
完整的uni-app目录结构
[
详情
](
https://uniapp.dcloud.io/frame?id=%e7%9b%ae%e5%bd%95%e7%bb%93%e6%9e%84
)
### 常见API示范
1.
判断当前用户是否拥有某角色
`uniIDHasRole`
演示页面:
`/pages/grid/grid`
[
API文档详情:
](
https://uniapp.dcloud.io/api/global?id=uniidhasrole
)
2.
指纹解锁、人脸解锁 演示页面:
`/pages/ucenter/settings/settings`
[
API文档详情:
](
https://uniapp.dcloud.io/api/system/authentication
)
### 注意事项
1.
真机运行需要制作自定义基座,制作后选择运行到自定义基座
2.
苹果登录的图标,需要满足苹果应用市场的审核规范请勿随便修改;如需修改请先阅读:
[
Human Interface Guidelines
](
https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons/
)
...
...
changelog.md
浏览文件 @
e894c12c
## 1.0.7(2021-05-22)
删除多余数据
## 1.0.6(2021-05-22)
修复当username(用户名&密码)为第一优先级的登陆方式时。无法切换到smsCode(短信验证码)登陆方式
## 1.0.5(2021-05-20)
改用uni_modules方式处理图片选择api时无权限,引导用户快捷打开系统设置
## 1.0.4(2021-05-19)
...
...
components/uni-id-show/uni-id-show.vue
0 → 100644
浏览文件 @
e894c12c
<
template
>
<view
v-if=
"pass"
>
<slot></slot>
</view>
</
template
>
<
script
>
export
default
{
name
:
"
uni-id-show
"
,
props
:
{
isLogin
:{
type
:
Boolean
,
default
(){
return
false
}
},
role
:
{
type
:
[
Array
,
String
],
default
(){
return
"
ALL
"
}
},
permission
:
{
type
:
[
Array
,
String
],
default
(){
return
"
ALL
"
}
}
},
data
()
{
return
{
pass
:
true
}
},
created
()
{
this
.
check
()
},
methods
:{
check
(){
let
{
permission
,
role
,
tokenExpired
,
uid
}
=
uniCloud
.
getCurrentUserInfo
()
console
.
log
(
permission
,
role
,
tokenExpired
,
uid
);
let
pass
=
true
//1.是否需要登陆
if
(
this
.
isLogin
){
pass
=
uid
!=
null
}
//2.角色要求
if
(
this
.
role
!=
"
ALL
"
){
pass
=
role
.
some
(
item
=>
this
.
role
.
includes
(
item
));
}
//3.权限要求
if
(
this
.
permission
!=
"
ALL
"
){
pass
=
permission
.
some
(
item
=>
this
.
permission
.
includes
(
item
));
}
this
.
pass
=
pass
}
}
}
</
script
>
\ No newline at end of file
components/uni-quick-login/uni-quick-login.vue
浏览文件 @
e894c12c
...
...
@@ -161,7 +161,7 @@
return
'
/
'
+
pages
[
pages
.
length
-
n
].
route
},
to
(
path
)
{
console
.
log
(
'
比较
'
,
this
.
getRoute
(
2
),
path
)
//
console.log('比较', this.getRoute(2), path)
if
(
this
.
getRoute
(
2
)
==
path
)
{
// 控制路由是重新打开还是返回,避免重复打开页面
uni
.
navigateBack
();
}
else
{
...
...
package.json
浏览文件 @
e894c12c
{
"id"
:
"uni-starter"
,
"displayName"
:
"uni-starter"
,
"version"
:
"1.0.
5
"
,
"version"
:
"1.0.
7
"
,
"description"
:
"云端一体应用快速开发模版"
,
"keywords"
:
[
"uni-starter"
,
...
...
pages/grid/grid.vue
浏览文件 @
e894c12c
<
template
>
<view
class=
"warp"
>
<!-- 搜索 -->
<template>
<!-- #ifdef APP-PLUS -->
<status-bar
/>
<template>
<!-- #ifdef APP-PLUS -->
<status-bar
/>
<!-- #endif -->
<uni-search-bar
ref=
"searchBar"
style=
"flex:1;"
radius=
"100"
@
click.native=
"searchClick"
cancelButton=
"none"
disabled
/>
...
...
@@ -11,22 +11,26 @@
<!-- banner -->
<unicloud-db
ref=
"bannerdb"
v-slot:default=
"{data, loading, error, options}"
collection=
"opendb-banner"
:field=
"field"
@
load=
"load"
>
<uni-swiper-dot
class=
"uni-swiper-dot-box"
@
clickItem=
"clickItem"
:info=
"data || bannerFormate(data, loading)"
:current=
"current"
:mode=
"mode"
:dots-styles=
"dotsStyles"
field=
"content"
>
<uni-swiper-dot
class=
"uni-swiper-dot-box"
@
clickItem=
"clickItem"
:info=
"data || bannerFormate(data, loading)"
:current=
"current"
:mode=
"mode"
:dots-styles=
"dotsStyles"
field=
"content"
>
<swiper
class=
"swiper-box"
@
change=
"changeSwiper"
:current=
"swiperDotIndex"
>
<swiper-item
v-for=
"(item, index) in (data || bannerFormate(data, loading))"
:key=
"item._id"
>
<view
:draggable=
"false"
class=
"swiper-item"
@
click=
"clickBannerItem(item)"
>
<image
class=
"swiper-image"
:src=
"item.bannerfile.url"
mode=
"aspectFill"
:draggable=
"false"
/>
<image
class=
"swiper-image"
:src=
"item.bannerfile.url"
mode=
"aspectFill"
:draggable=
"false"
/>
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
</unicloud-db>
<!-- 宫格 -->
<uni-section
title=
"宫格组件"
style=
"margin: 0;"
type=
"line"
></uni-section>
<uni-section
title=
"宫格组件"
style=
"margin: 0;"
type=
"line"
></uni-section>
<view
class=
"example-body"
>
<uni-grid
:column=
"3"
:highlight=
"true"
@
change=
"change"
>
<uni-grid-item
v-for=
"(item, index) in list"
:index=
"index"
:key=
"index"
>
<uni-grid-item
v-for=
"(item, index) in list"
:index=
"index"
:key=
"index"
v-if=
"index<3?true:(index<6?hasLogin:uniIDHasRole('admin'))"
>
<view
class=
"grid-item-box"
style=
"background-color: #fff;"
>
<image
:src=
"item.url"
class=
"image"
mode=
"aspectFill"
/>
<text
class=
"text"
>
{{ item.text }}
</text>
...
...
@@ -37,55 +41,76 @@
</view>
</template>
<
script
>
<
script
>
import
{
mapGetters
,
}
from
'
vuex
'
;
import
statusBar
from
"
@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar
"
;
export
default
{
components
:
{
statusBar
},
components
:
{
statusBar
},
data
()
{
return
{
list
:
[{
url
:
'
/static/grid/c1.png
'
,
text
:
'
Grid 1
'
,
text
:
'
所有人可见
'
,
badge
:
'
0
'
,
type
:
"
primary
"
type
:
"
primary
"
,
isShow
:
true
},
{
url
:
'
/static/grid/c2.png
'
,
text
:
'
Grid 2
'
,
text
:
'
所有人可见
'
,
badge
:
'
1
'
,
type
:
"
success
"
},
{
type
:
"
success
"
,
isShow
:
true
},
{
url
:
'
/static/grid/c3.png
'
,
text
:
'
Grid 3
'
,
badge
:
'
99
'
,
type
:
"
warning
"
text
:
'
所有人可见
'
,
badge
:
'
1
'
,
type
:
"
success
"
,
isShow
:
true
},
{
url
:
'
/static/grid/c4.png
'
,
text
:
'
Grid 4
'
,
badge
:
'
2
'
,
type
:
"
error
"
text
:
'
游客不可见
'
,
badge
:
'
1
'
,
type
:
"
success
"
,
isShow
:
"
this.hasLogin
"
},
{
url
:
'
/static/grid/c5.png
'
,
text
:
'
Grid 5
'
text
:
'
游客不可见
'
,
badge
:
'
1
'
,
type
:
"
success
"
,
isShow
:
"
hasLogin
"
},
{
url
:
'
/static/grid/c6.png
'
,
text
:
'
Grid 6
'
text
:
'
游客不可见
'
,
badge
:
'
1
'
,
type
:
"
success
"
,
isShow
:
"
hasLogin
"
},
{
url
:
'
/static/grid/c7.png
'
,
text
:
'
Grid 7
'
text
:
'
管理员可见
'
,
badge
:
'
99
'
,
type
:
"
warning
"
,
isShow
:
"
uniIDHasPermission('admin')
"
},
{
url
:
'
/static/grid/c8.png
'
,
text
:
'
Grid 8
'
text
:
'
管理员可见
'
,
badge
:
'
2
'
,
type
:
"
error
"
,
isShow
:
"
uniIDHasPermission('admin')
"
},
{
url
:
'
/static/grid/c9.png
'
,
text
:
'
Grid 9
'
text
:
'
管理员可见
'
,
isShow
:
"
uniIDHasPermission('admin')
"
}
],
// 查询字段,多个字段用 , 分割
...
...
@@ -119,12 +144,16 @@
current
:
0
,
mode
:
'
default
'
,
dotsStyles
:
{},
swiperDotIndex
:
0
,
isLoading
:
true
swiperDotIndex
:
0
,
isLoading
:
true
}
},
methods
:
{
computed
:
{
...
mapGetters
({
hasLogin
:
'
user/hasLogin
'
})
},
methods
:
{
change
(
e
)
{
let
{
index
...
...
@@ -147,7 +176,7 @@
* banner加载后触发的回调
*/
load
(
data
)
{
},
changeSwiper
(
e
)
{
this
.
current
=
e
.
detail
.
current
...
...
@@ -170,12 +199,12 @@
*/
clickBannerItem
(
item
)
{
// 有外部链接-跳转url
if
(
item
.
open_url
)
{
uni
.
navigateTo
({
url
:
'
/pages/common/webview/webview?url=
'
+
item
.
open_url
+
'
&title=
'
+
item
.
title
,
success
:
res
=>
{},
fail
:
()
=>
{},
complete
:
()
=>
{}
if
(
item
.
open_url
)
{
uni
.
navigateTo
({
url
:
'
/pages/common/webview/webview?url=
'
+
item
.
open_url
+
'
&title=
'
+
item
.
title
,
success
:
res
=>
{},
fail
:
()
=>
{},
complete
:
()
=>
{}
});
}
// 其余业务处理
...
...
@@ -183,7 +212,7 @@
/**
* banner数据过滤
*/
bannerFormate
(
bannerList
,
loading
)
{
bannerFormate
(
bannerList
,
loading
)
{
if
(
loading
)
return
[];
if
(
bannerList
.
length
>
0
)
return
bannerList
;
// 无数据添加默认值
...
...
@@ -201,6 +230,7 @@
<
style
>
@charset
"UTF-8"
;
/* #ifndef APP-NVUE */
page
{
display
:
flex
;
...
...
@@ -228,12 +258,13 @@
background-color
:
#ffffff
;
}
/* #endif */
/* #ifdef APP-NVUE */
.warp
{
background-color
:
#fff
;
}
/* #endif */
/* #ifdef APP-NVUE */
.warp
{
background-color
:
#fff
;
}
/* #endif */
.example-body
{
...
...
@@ -309,4 +340,4 @@
.uni-input-placeholder
{
font-size
:
28
rpx
;
}
</
style
>
</
style
>
pages/list/list.nvue
浏览文件 @
e894c12c
...
...
@@ -65,7 +65,7 @@
// #ifndef APP-NVUE
this.listHight = 'auto'
// #endif
cdbRef = this.$refs.udb
cdbRef = this.$refs.udb
},
onShow() {
this.keyword = getApp().globalData.searchText
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录