提交 add0dedc 编写于 作者: L linju

21

......@@ -4,3 +4,4 @@ node_modules
.DS_Store
uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id/config.json
manifest.json
pages/grid/banner.json
\ No newline at end of file
......@@ -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",
......
......@@ -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 = [{
......
......@@ -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;
......
// 在本文件中可配置云数据库初始化,数据格式见: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,
......
<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">
field="content, title" where="is_reply == false" @load="isLoading == false" @error="isLoading == false">
<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}}
<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-list-item>
</uni-list>
</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>
......@@ -23,22 +19,15 @@
export default {
data() {
return {
loadMore: {
contentdown: '',
contentrefresh: '',
contentnomore: ''
}
isLoading:true,
}
},
methods: {
refreshData() {
this.$refs.udb.loadData({
clear: true
}, (res) => {})
},
handleItemClick(id) {
uni.navigateTo({
url: './detail?id=' + id
}, (res) => {
console.log(res);
})
},
fabClick() {
......@@ -60,4 +49,7 @@
</script>
<style>
.content{
padding: 20rpx;
}
</style>
......@@ -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>
......@@ -22,6 +27,12 @@
<script>
export default {
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册