Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
德宏大魔王
uni-starter
提交
add0dedc
U
uni-starter
项目概览
德宏大魔王
/
uni-starter
与 Fork 源项目一致
Fork自
DCloud / uni-starter
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
add0dedc
编写于
4月 13, 2021
作者:
L
linju
浏览文件
操作
浏览文件
下载
差异文件
21
上级
32c7e51a
5d109735
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
51 addition
and
76 deletion
+51
-76
.gitignore
.gitignore
+2
-1
pages.json
pages.json
+1
-3
pages/grid/grid.vue
pages/grid/grid.vue
+7
-4
pages/list/news-list.vue
pages/list/news-list.vue
+6
-4
uniCloud-aliyun/database/db_init.json
uniCloud-aliyun/database/db_init.json
+0
-37
uni_modules/opendb-feedback/pages/opendb-feedback/list.vue
uni_modules/opendb-feedback/pages/opendb-feedback/list.vue
+16
-24
uni_modules/uni-nodata/components/uni-nodata/uni-nodata.nvue
uni_modules/uni-nodata/components/uni-nodata/uni-nodata.nvue
+19
-3
uni_modules/uni-nodata/static/loading.png
uni_modules/uni-nodata/static/loading.png
+0
-0
未找到文件。
.gitignore
浏览文件 @
add0dedc
...
...
@@ -3,4 +3,5 @@ unpackage/
node_modules
.DS_Store
uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id/config.json
manifest.json
\ No newline at end of file
manifest.json
pages/grid/banner.json
\ No newline at end of file
pages.json
浏览文件 @
add0dedc
...
...
@@ -34,8 +34,6 @@
}
}
}
//
"navigationBarTitleText"
:
""
,
//
"navigationBarBackgroundColor"
:
"#FFFFFF"
,
},
{
"path"
:
"pages/list/search/search"
,
"style"
:
{
...
...
@@ -69,7 +67,7 @@
},
{
"path"
:
"uni_modules/opendb-feedback/pages/opendb-feedback/list"
,
"style"
:
{
"navigationBarTitleText"
:
"
反馈列表
"
"navigationBarTitleText"
:
"
常见问题
"
}
},
{
"path"
:
"uni_modules/opendb-feedback/pages/opendb-feedback/add"
,
...
...
pages/grid/grid.vue
浏览文件 @
add0dedc
...
...
@@ -9,10 +9,10 @@
<!-- banner -->
<unicloud-db
ref=
"bannerdb"
v-slot:default=
"{data, loading, error, options}"
:collection=
"collection"
:field=
"field"
@
load=
"load"
>
<uni-swiper-dot
class=
"uni-swiper-dot-box"
@
clickItem=
"clickItem"
:info=
"bannerFormate(data)"
<uni-swiper-dot
class=
"uni-swiper-dot-box"
@
clickItem=
"clickItem"
:info=
"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 bannerFormate(data)"
:key=
"item._id"
>
<swiper-item
v-for=
"(item, index) in bannerFormate(data
, loading
)"
:key=
"item._id"
>
<view
:draggable=
"false"
class=
"swiper-item"
@
click=
"clickBannerItem(item)"
>
<image
class=
"swiper-image"
:src=
"item.bannerfile"
mode=
"aspectFill"
:draggable=
"false"
/>
</view>
...
...
@@ -119,7 +119,9 @@
current
:
0
,
mode
:
'
default
'
,
dotsStyles
:
{},
swiperDotIndex
:
0
swiperDotIndex
:
0
,
isLoading
:
true
}
},
methods
:
{
...
...
@@ -181,7 +183,8 @@
/**
* banner数据过滤
*/
bannerFormate
(
bannerList
)
{
bannerFormate
(
bannerList
,
loading
)
{
if
(
loading
)
return
[];
if
(
bannerList
.
length
>
0
)
return
bannerList
;
// 无数据添加默认值
let
list
=
[{
...
...
pages/list/news-list.vue
浏览文件 @
add0dedc
...
...
@@ -21,13 +21,13 @@
<!-- 页面分类标题 -->
<uni-section
style=
"margin:0;"
v-if=
"searchText"
:title=
"listTitle"
type=
"line"
></uni-section>
<unicloud-db
ref=
"udb"
v-slot:default=
"
{data, loading, error, options}" :options="formData"
:collection="collection" :field="field" :where="where" @load="load">
:collection="collection" :field="field" :where="where" @load="load
($event);isLoading = false;" @error="isLoading = false
">
<text
v-if=
"error"
class=
"list-info"
>
{{
error
.
message
}}
</text>
<!-- 基于 uni-list 的页面布局 -->
<uni-list
:class=
"
{ 'uni-list--waterfall': options.waterfall }">
<!-- 通过 uni-list--waterfall 类决定页面布局方向 -->
<!-- to 属性携带参数跳转详情页面,当前只为参考 -->
<uni-list-item
:border=
"!options.waterfall"
:to=
"'./detail?id='+item._id+'&title='+item.title"
class=
"uni-list-item--waterfall"
title=
"自定义
商品
列表"
<uni-list-item
:border=
"!options.waterfall"
:to=
"'./detail?id='+item._id+'&title='+item.title"
class=
"uni-list-item--waterfall"
title=
"自定义列表"
v-for=
"item in data"
:key=
"item._id"
>
<!-- 通过header插槽定义列表左侧图片 -->
<template
v-slot:header
>
...
...
@@ -54,6 +54,7 @@
</uni-list>
<!-- 通过 loadMore 组件实现上拉加载效果,如需自定义显示内容,可参考:https://ext.dcloud.net.cn/plugin?id=29 -->
<uni-load-more
v-if=
"!error && (loading || options.status === 'noMore') "
:status=
"options.status"
/>
<uni-nodata
v-if=
"data.length == 0"
:isLoading=
"isLoading"
@
retry=
"refresh"
></uni-nodata>
</unicloud-db>
</view>
</view>
...
...
@@ -87,7 +88,8 @@
collection
:
'
opendb-news-articles,uni-id-users
'
,
// 查询字段,多个字段用 , 分割
field
:
'
author{username, _id}, user_id,_id,avatar,title,excerpt,last_modify_date, comment_count, like_count
'
,
tipShow
:
false
// 是否显示顶部提示框
tipShow
:
false
,
// 是否显示顶部提示框
isLoading
:
true
};
},
/**
...
...
@@ -107,7 +109,7 @@
},
methods
:
{
/**
* 切换
商品
列表布局方向
* 切换列表布局方向
*/
select
()
{
this
.
formData
.
waterfall
=
!
this
.
formData
.
waterfall
;
...
...
uniCloud-aliyun/database/db_init.json
浏览文件 @
add0dedc
//
在本文件中可配置云数据库初始化,数据格式见:https://uniapp.dcloud.io/uniCloud/cf-database?id=db_init
//
编写完毕后对本文件点右键,可按配置规则创建表和添加数据
{
"opendb-banner"
:
{
"data"
:
[{
"bannerfile"
:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg"
,
"open_url"
:
"https://www.dcloud.io/"
,
"title"
:
"内容 A"
,
"sort"
:
0
,
"category_id"
:
"grid"
,
"status"
:
true
,
"description"
:
"备注"
},
{
"bannerfile"
:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg"
,
"open_url"
:
"https://www.dcloud.io/"
,
"title"
:
"内容 B"
,
"sort"
:
0
,
"category_id"
:
"grid"
,
"status"
:
true
,
"description"
:
"备注"
},
{
"bannerfile"
:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg"
,
"open_url"
:
"https://www.dcloud.io/"
,
"title"
:
"内容 C"
,
"sort"
:
0
,
"category_id"
:
"grid"
,
"status"
:
true
,
"description"
:
"备注"
},
{
"bannerfile"
:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg"
,
"open_url"
:
"https://www.dcloud.io/"
,
"title"
:
"内容 D"
,
"sort"
:
0
,
"category_id"
:
"grid"
,
"status"
:
true
,
"description"
:
"备注"
}
]
},
"opendb-news-articles-detail"
:
{
"data"
:
[{
"article_status"
:
1
,
...
...
uni_modules/opendb-feedback/pages/opendb-feedback/list.vue
浏览文件 @
add0dedc
<
template
>
<view
class=
"container"
>
<unicloud-db
ref=
"udb"
v-slot:default=
"
{data, pagination, loading, hasMore, error}" collection="opendb-feedback"
field="user_id,create_date,content,imgs,is_reply,feedback_id,contact,mobile,reply_count">
<view
v-if=
"data && data.length"
>
<uni-list>
<uni-list-item
v-for=
"(item, index) in data"
:key=
"index"
showArrow
:clickable=
"true"
@
click=
"handleItemClick(item._id)"
>
<view
slot=
"body"
>
<!-- 此处默认显示为_id,请根据需要自行修改为其他字段 -->
{{
item
.
content
}}
</view>
</uni-list-item>
</uni-list>
field="content, title" where="is_reply == false" @load="isLoading == false" @error="isLoading == false">
<view
v-if=
"data && data.length"
>
<uni-collapse
:accordion=
"true"
>
<uni-collapse-item
v-for=
"(item, index) in data"
:key=
"index"
:title=
"item.title"
:show-animation=
"true"
>
<text
class=
"content"
>
{{
item
.
content
}}
</text>
</uni-collapse-item>
</uni-collapse>
</view>
<uni-nodata
v-else
@
retry=
"refreshData"
></uni-nodata>
<uni-nodata
v-else
:isLoading=
"isLoading"
@
retry=
"refreshData"
></uni-nodata>
</unicloud-db>
<uni-fab
ref=
"fab"
horizontal=
"right"
vertical=
"bottom"
:pop-menu=
"false"
@
fabClick=
"fabClick"
/>
</view>
...
...
@@ -22,23 +18,16 @@
<
script
>
export
default
{
data
()
{
return
{
loadMore
:
{
contentdown
:
''
,
contentrefresh
:
''
,
contentnomore
:
''
}
return
{
isLoading
:
true
,
}
},
methods
:
{
refreshData
()
{
this
.
$refs
.
udb
.
loadData
({
clear
:
true
},
(
res
)
=>
{})
},
handleItemClick
(
id
)
{
uni
.
navigateTo
({
url
:
'
./detail?id=
'
+
id
},
(
res
)
=>
{
console
.
log
(
res
);
})
},
fabClick
()
{
...
...
@@ -59,5 +48,8 @@
}
</
script
>
<
style
>
<
style
>
.content
{
padding
:
20
rpx
;
}
</
style
>
uni_modules/uni-nodata/components/uni-nodata/uni-nodata.nvue
浏览文件 @
add0dedc
...
...
@@ -5,9 +5,14 @@
<text class="title">{{textTypes[networkType]}}</text>
</view>
<view class="icon-view">
<image src="/uni_modules/uni-nodata/static/nodata.png" class="icon-image"></image>
<!-- 无数据 icon -->
<image v-if="!isLoading" src="/uni_modules/uni-nodata/static/nodata.png" class="icon-image"></image>
<!-- 加载中 icon -->
<image v-else src="/uni_modules/uni-nodata/static/loading.png" class="icon-loading"></image>
<text class="title">{{isLoading ? '加载中...' : ''}}</text>
</view>
<view class="opera-view">
<view class="opera-view"
v-if="!isLoading"
>
<view class="btn btn-default" v-if="networkType!='none'" @click="retry">
<text class="btn-text">重试</text>
</view>
...
...
@@ -21,7 +26,13 @@
<script>
export default {
name: 'uni-nodata',
name: 'uni-nodata',
props:{
isLoading:{
type:Boolean,
default:false
}
},
data() {
return {
textTypes: {
...
...
@@ -207,6 +218,11 @@
border-color: #DD524D;
}
.icon-loading{
width: 500rpx;
height: 300rpx;
}
.icon-image{
width: 640rpx;
height: 640rpx;
...
...
uni_modules/uni-nodata/static/loading.png
0 → 100644
浏览文件 @
add0dedc
29.8 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录