This commit is contained in:
2025-03-20 19:32:25 +08:00
parent ebc8c7bb26
commit 8e35b74d86
17 changed files with 3170 additions and 1840 deletions
@@ -180,7 +180,7 @@ export default {
},
onReady() {
// 开始加载数据,修改 where 条件后才开始去加载 clinetDB 的数据 ,需要等组件渲染完毕后才开始执行 loadData,所以不能再 onLoad 中执行
if (this.id) { // ID 不为空,则发起查询
if (this.id) {
this.$refs.detail.loadData()
} else {
uni.showToast({
File diff suppressed because it is too large Load Diff
@@ -4,7 +4,19 @@
<statusBar></statusBar>
<view :style="{ height: `${navBarHeight}px` }"></view>
</view> -->
<view>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog
type="info"
cancelText="关闭"
confirmText="继续"
title="提示"
content="该功能还在开发中!"
@confirm="dialogConfirm"
@close="dialogClose">
</uni-popup-dialog>
</uni-popup>
</view>
<view class="v-preview">
<image :src="templateSrc" alt="" class="img" mode="widthFix" />
<view class="btn-area">
@@ -22,74 +34,52 @@
</view>
</view>
</view>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog
type="info"
cancelText="关闭"
confirmText="继续"
title="提示"
:content="content"
@confirm="dialogConfirm"
@close="dialogClose">
</uni-popup-dialog>
</uni-popup>
<view class="">
<view class="" :style="{ height: listHeight, 'overflow-y': 'scroll' }">
<unicloud-db ref='udb' v-slot:default="{ pagination, hasMore, loading, error, options }"
@error="onqueryerror" :collection="colList" :page-size="page.pageSize"
:page-current="page.currentPage" orderby="publish_date desc" @load="listLoad">
<!-- 基于 uni-list 的页面布局 field="user_id.nickname"-->
<unicloud-db ref='udb' v-slot:default="{ pagination, hasMore, loading, error, options }" @error="onqueryerror"
@onPullDownRefresh="onPullDownRefresh" :collection="colList" :page-size="10" orderby="publish_date desc"
@load="listLoad">
<!-- 基于 uni-list 的页面布局 field="user_id.nickname"-->
<!-- #ifdef APP-NVUE -->
<list class="uni-list" :border="false" :style="{ height: listHeight }">
<!-- #endif -->
<!-- #ifndef APP-NVUE -->
<scroll-view scroll-y class="uni-list" refresher-enabled :refresher-triggered="loadType=== 'refresh'"
:style="{ height: listHeight }" @refresherrefresh="refresh" @scrolltolower="loadMore">
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<list class="uni-list" :border="false" :style="{ height: listHeight }">
<refresh-box :loading="loading" @refresh="refresh"></refresh-box>
<!-- #endif -->
<!-- #ifndef APP-NVUE -->
<scroll-view scroll-y class="uni-list" refresher-enabled
:refresher-triggered="loadType=== 'refresh'" :style="{ height: listHeight }"
@refresherrefresh="refresh" @scrolltolower="loadMore">
<!-- 列表渲染 -->
<template v-for="item in listData">
<not-cover v-if="item.thumbnail && item.thumbnail.length === 0"
:data="getNewItem(item)"></not-cover>
<right-small-cover v-else-if="item.thumbnail && item.thumbnail.length === 1"
:data="getNewItem(item)"></right-small-cover>
<three-cover v-else-if="item.thumbnail && item.thumbnail.length === 3"
:data="getNewItem(item)"></three-cover>
</template>
<!-- 加载状态:上拉加载更多,加载中,没有更多数据了,加载错误 -->
<!-- #ifdef APP-PLUS -->
<uni-list-item>
<template v-slot:body>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<!-- <refresh-box :loading="loading" @refresh="refresh"></refresh-box> -->
<!-- #endif -->
<!-- 列表渲染 -->
<template v-for="item in listData">
<not-cover v-if="item.thumbnail && item.thumbnail.length === 0"
:data="getNewItem(item)"></not-cover>
<right-small-cover v-else-if="item.thumbnail && item.thumbnail.length === 1"
:data="getNewItem(item)"></right-small-cover>
<three-cover v-else-if="item.thumbnail && item.thumbnail.length === 3"
:data="getNewItem(item)"></three-cover>
</template>
<!-- 加载状态:上拉加载更多,加载中,没有更多数据了,加载错误 -->
<!-- #ifdef APP-PLUS -->
<uni-list-item>
<template v-slot:body>
<!-- #endif -->
<uni-load-state @networkResume="refresh"
:state="{ data: listData, pagination, hasMore, loading, error }"
@loadMore="loadMore">
</uni-load-state>
<!-- #ifdef APP-PLUS -->
</template>
</uni-list-item>
<!-- #endif -->
<!-- #ifndef APP-NVUE -->
</scroll-view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
</list>
<uni-load-state @networkResume="refresh"
:state="{ data: listData, pagination, hasMore, loading, error }" @loadMore="loadMore">
</uni-load-state>
<!-- #ifdef APP-PLUS -->
</template>
</uni-list-item>
<!-- #endif -->
<view class="content">
<page-pagination :total="page.total" :pageSize="page.pageSize" @change="change"
style="margin-bottom: 300rpx;"
layout="total,first,prev,page,next,last,jumper">
</page-pagination>
</view>
</unicloud-db>
<!-- #ifndef APP-NVUE -->
</scroll-view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
</list>
<!-- #endif -->
</unicloud-db>
</view>
@@ -165,11 +155,6 @@
data() {
return {
content: "",
page: {
total: 0,
pageSize: 5,
currentPage: 1
},
templateSrc: "https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/static/bg.jpg?expire_at=1741142837&er_sign=291c5dab058782f6472cf8792735686d",
where: '"article_status" == 1', // 查询条件
showRefresh: false, // 是否显示刷新按钮
@@ -184,8 +169,6 @@
}
},
onLoad() {
console.log(5);
this.getPage();
},
async onReady() {
@@ -204,18 +187,19 @@
dialogClose() {
console.log('点击关闭')
},
inputDialogToggle() {
this.$refs.inputDialog.open()
},
btn(item) {
if (item in [1, 3, 4, 5, 6, 7]) {
if (item === 0) {
this.inputDialogToggle();
} if ([1, 3, 4, 5, 6, 7].indexOf(item) !== -1) {
uni.switchTab({
url: "/uni_modules/uni-cms-article/pages/list/slist"
})
}
if (item === 0) {
this.content = "老兵直播";
} else if (item === 2) {
let token = uni.getStorageSync("uni_id_token");
console.log(token);
if (!token) {
uni.navigateTo({
url:"/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=weixin"
@@ -236,11 +220,6 @@
}
return item;
},
async getPage() {
let res = await uniCloud.importObject("uni-cms-articles").getTotal();
console.log(res);
this.page.total = res.total;
},
change(currentPage, type) { // 当前页改变
this.page.currentPage = currentPage;
File diff suppressed because it is too large Load Diff