提交 add0dedc 编写于 作者: L linju

21

...@@ -3,4 +3,5 @@ unpackage/ ...@@ -3,4 +3,5 @@ unpackage/
node_modules node_modules
.DS_Store .DS_Store
uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id/config.json uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id/config.json
manifest.json manifest.json
\ No newline at end of file pages/grid/banner.json
\ No newline at end of file
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
} }
} }
} }
// "navigationBarTitleText": "",
// "navigationBarBackgroundColor": "#FFFFFF",
}, { }, {
"path": "pages/list/search/search", "path": "pages/list/search/search",
"style": { "style": {
...@@ -69,7 +67,7 @@ ...@@ -69,7 +67,7 @@
}, { }, {
"path": "uni_modules/opendb-feedback/pages/opendb-feedback/list", "path": "uni_modules/opendb-feedback/pages/opendb-feedback/list",
"style": { "style": {
"navigationBarTitleText": "反馈列表" "navigationBarTitleText": "常见问题"
} }
}, { }, {
"path": "uni_modules/opendb-feedback/pages/opendb-feedback/add", "path": "uni_modules/opendb-feedback/pages/opendb-feedback/add",
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
<!-- banner --> <!-- banner -->
<unicloud-db ref="bannerdb" v-slot:default="{data, loading, error, options}" :collection="collection" <unicloud-db ref="bannerdb" v-slot:default="{data, loading, error, options}" :collection="collection"
:field="field" @load="load"> :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"> :current="current" :mode="mode" :dots-styles="dotsStyles" field="content">
<swiper class="swiper-box" @change="changeSwiper" :current="swiperDotIndex"> <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)"> <view :draggable="false" class="swiper-item" @click="clickBannerItem(item)">
<image class="swiper-image" :src="item.bannerfile" mode="aspectFill" :draggable="false" /> <image class="swiper-image" :src="item.bannerfile" mode="aspectFill" :draggable="false" />
</view> </view>
...@@ -119,7 +119,9 @@ ...@@ -119,7 +119,9 @@
current: 0, current: 0,
mode: 'default', mode: 'default',
dotsStyles: {}, dotsStyles: {},
swiperDotIndex: 0 swiperDotIndex: 0,
isLoading:true
} }
}, },
methods: { methods: {
...@@ -181,7 +183,8 @@ ...@@ -181,7 +183,8 @@
/** /**
* banner数据过滤 * banner数据过滤
*/ */
bannerFormate(bannerList) { bannerFormate(bannerList, loading) {
if (loading) return [];
if (bannerList.length > 0) return bannerList; if (bannerList.length > 0) return bannerList;
// 无数据添加默认值 // 无数据添加默认值
let list = [{ let list = [{
......
...@@ -21,13 +21,13 @@ ...@@ -21,13 +21,13 @@
<!-- 页面分类标题 --> <!-- 页面分类标题 -->
<uni-section style="margin:0;" v-if="searchText" :title="listTitle" type="line"></uni-section> <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" <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> <text v-if="error" class="list-info">{{error.message}}</text>
<!-- 基于 uni-list 的页面布局 --> <!-- 基于 uni-list 的页面布局 -->
<uni-list :class="{ 'uni-list--waterfall': options.waterfall }"> <uni-list :class="{ 'uni-list--waterfall': options.waterfall }">
<!-- 通过 uni-list--waterfall 类决定页面布局方向 --> <!-- 通过 uni-list--waterfall 类决定页面布局方向 -->
<!-- to 属性携带参数跳转详情页面,当前只为参考 --> <!-- 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"> v-for="item in data" :key="item._id">
<!-- 通过header插槽定义列表左侧图片 --> <!-- 通过header插槽定义列表左侧图片 -->
<template v-slot:header> <template v-slot:header>
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
</uni-list> </uni-list>
<!-- 通过 loadMore 组件实现上拉加载效果,如需自定义显示内容,可参考:https://ext.dcloud.net.cn/plugin?id=29 --> <!-- 通过 loadMore 组件实现上拉加载效果,如需自定义显示内容,可参考:https://ext.dcloud.net.cn/plugin?id=29 -->
<uni-load-more v-if="!error && (loading || options.status === 'noMore') " :status="options.status" /> <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> </unicloud-db>
</view> </view>
</view> </view>
...@@ -87,7 +88,8 @@ ...@@ -87,7 +88,8 @@
collection: 'opendb-news-articles,uni-id-users', collection: 'opendb-news-articles,uni-id-users',
// 查询字段,多个字段用 , 分割 // 查询字段,多个字段用 , 分割
field: 'author{username, _id}, user_id,_id,avatar,title,excerpt,last_modify_date, comment_count, like_count', 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 @@ ...@@ -107,7 +109,7 @@
}, },
methods: { methods: {
/** /**
* 切换商品列表布局方向 * 切换列表布局方向
*/ */
select() { select() {
this.formData.waterfall = !this.formData.waterfall; this.formData.waterfall = !this.formData.waterfall;
......
// 在本文件中可配置云数据库初始化,数据格式见:https://uniapp.dcloud.io/uniCloud/cf-database?id=db_init // 在本文件中可配置云数据库初始化,数据格式见: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": { "opendb-news-articles-detail": {
"data": [{ "data": [{
"article_status": 1, "article_status": 1,
......
<template> <template>
<view class="container"> <view class="container">
<unicloud-db ref="udb" v-slot:default="{data, pagination, loading, hasMore, error}" collection="opendb-feedback" <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"> <view v-if="data && data.length">
<uni-list> <uni-collapse :accordion="true">
<uni-list-item v-for="(item, index) in data" :key="index" showArrow :clickable="true" <uni-collapse-item v-for="(item, index) in data" :key="index" :title="item.title" :show-animation="true">
@click="handleItemClick(item._id)"> <text class="content">{{ item.content }}</text>
<view slot="body"> </uni-collapse-item>
<!-- 此处默认显示为_id,请根据需要自行修改为其他字段 --> </uni-collapse>
{{item.content}}
</view>
</uni-list-item>
</uni-list>
</view> </view>
<uni-nodata v-else @retry="refreshData"></uni-nodata> <uni-nodata v-else :isLoading="isLoading" @retry="refreshData"></uni-nodata>
</unicloud-db> </unicloud-db>
<uni-fab ref="fab" horizontal="right" vertical="bottom" :pop-menu="false" @fabClick="fabClick" /> <uni-fab ref="fab" horizontal="right" vertical="bottom" :pop-menu="false" @fabClick="fabClick" />
</view> </view>
...@@ -22,23 +18,16 @@ ...@@ -22,23 +18,16 @@
<script> <script>
export default { export default {
data() { data() {
return { return {
loadMore: { isLoading:true,
contentdown: '',
contentrefresh: '',
contentnomore: ''
}
} }
}, },
methods: { methods: {
refreshData() { refreshData() {
this.$refs.udb.loadData({ this.$refs.udb.loadData({
clear: true clear: true
}, (res) => {}) }, (res) => {
}, console.log(res);
handleItemClick(id) {
uni.navigateTo({
url: './detail?id=' + id
}) })
}, },
fabClick() { fabClick() {
...@@ -59,5 +48,8 @@ ...@@ -59,5 +48,8 @@
} }
</script> </script>
<style> <style>
.content{
padding: 20rpx;
}
</style> </style>
...@@ -5,9 +5,14 @@ ...@@ -5,9 +5,14 @@
<text class="title">{{textTypes[networkType]}}</text> <text class="title">{{textTypes[networkType]}}</text>
</view> </view>
<view class="icon-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>
<view class="opera-view"> <view class="opera-view" v-if="!isLoading">
<view class="btn btn-default" v-if="networkType!='none'" @click="retry"> <view class="btn btn-default" v-if="networkType!='none'" @click="retry">
<text class="btn-text">重试</text> <text class="btn-text">重试</text>
</view> </view>
...@@ -21,7 +26,13 @@ ...@@ -21,7 +26,13 @@
<script> <script>
export default { export default {
name: 'uni-nodata', name: 'uni-nodata',
props:{
isLoading:{
type:Boolean,
default:false
}
},
data() { data() {
return { return {
textTypes: { textTypes: {
...@@ -207,6 +218,11 @@ ...@@ -207,6 +218,11 @@
border-color: #DD524D; border-color: #DD524D;
} }
.icon-loading{
width: 500rpx;
height: 300rpx;
}
.icon-image{ .icon-image{
width: 640rpx; width: 640rpx;
height: 640rpx; height: 640rpx;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册