2024-06-16 22:21:29 +08:00
|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
<!-- 列表 -->
|
|
|
|
<view class="bc-color" v-for="(postItem, postIndex) in postList" :key="postIndex">
|
|
|
|
<view class="line1"></view>
|
|
|
|
<PostView :postValue="postItem" :postViewIndex="3" :postViewType="1"></PostView>
|
|
|
|
<!-- <u-line></u-line> -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2024-06-17 15:06:06 +08:00
|
|
|
import {
|
|
|
|
ref,
|
|
|
|
getCurrentInstance,
|
|
|
|
reactive,
|
|
|
|
toRefs
|
|
|
|
} from 'vue';
|
|
|
|
import {
|
|
|
|
onReachBottom,
|
|
|
|
onShow,
|
|
|
|
onLoad,
|
|
|
|
onPullDownRefresh
|
|
|
|
} from '@dcloudio/uni-app'
|
|
|
|
import PostView from "@/pages/common/postview/index.vue";
|
|
|
|
import {
|
2024-06-16 22:21:29 +08:00
|
|
|
listPost,
|
|
|
|
listPostFollow,
|
|
|
|
getPost,
|
|
|
|
delPost,
|
|
|
|
addPost,
|
|
|
|
updatePost,
|
|
|
|
getLoginUserinfo
|
|
|
|
} from "@/api/talk/post";
|
2024-06-17 15:06:06 +08:00
|
|
|
const loginUser = reactive(uni.getStorageSync('loginUserPost'));
|
|
|
|
const postList = ref([]);
|
2024-06-16 22:21:29 +08:00
|
|
|
|
|
|
|
const loading = ref(true);
|
|
|
|
const total = ref(0);
|
|
|
|
|
|
|
|
const data = reactive({
|
|
|
|
form: {},
|
|
|
|
queryParams: {
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
uid: null,
|
|
|
|
topicId: null,
|
|
|
|
discussId: null,
|
|
|
|
voteId: null,
|
|
|
|
title: null,
|
|
|
|
content: null,
|
|
|
|
media: null,
|
|
|
|
tab: null,
|
|
|
|
readCount: null,
|
|
|
|
transmitCount: null,
|
|
|
|
likeCount: null,
|
|
|
|
commentCount: null,
|
|
|
|
favoriteCount: null,
|
|
|
|
postTop: null,
|
|
|
|
type: null,
|
|
|
|
anonymity: null,
|
|
|
|
postPrivate: null,
|
|
|
|
address: null,
|
|
|
|
longitude: null,
|
|
|
|
latitude: null,
|
|
|
|
auditor: null,
|
|
|
|
status: 5,
|
|
|
|
auditTime: null,
|
|
|
|
auditAdvice: null,
|
|
|
|
cut: null,
|
|
|
|
sortField: null,
|
|
|
|
sortDirection: null,
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
status: [{
|
|
|
|
required: true,
|
|
|
|
message: "状态不能为空",
|
|
|
|
trigger: "change"
|
|
|
|
}],
|
|
|
|
cut: [{
|
|
|
|
required: true,
|
|
|
|
message: "分类不能为空",
|
|
|
|
trigger: "change"
|
|
|
|
}],
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const {
|
|
|
|
queryParams,
|
|
|
|
form,
|
|
|
|
rules
|
|
|
|
} = toRefs(data);
|
2024-06-17 15:06:06 +08:00
|
|
|
|
2024-06-16 22:21:29 +08:00
|
|
|
onLoad(() => {
|
|
|
|
queryParams.value.uid = loginUser.userId
|
2024-06-17 15:06:06 +08:00
|
|
|
getList();
|
2024-06-16 22:21:29 +08:00
|
|
|
onReachBottom(() => {
|
2024-06-17 15:06:06 +08:00
|
|
|
console.log('触底了')
|
|
|
|
if (total.value > postList.value.length) {
|
|
|
|
queryParams.value.pageNum += 1;
|
|
|
|
getList();
|
|
|
|
}
|
2024-06-16 22:21:29 +08:00
|
|
|
})
|
|
|
|
})
|
2024-06-17 15:06:06 +08:00
|
|
|
|
2024-06-16 22:21:29 +08:00
|
|
|
/** 查询话题投稿new列表 */
|
2024-06-17 15:06:06 +08:00
|
|
|
function getList(type) {
|
|
|
|
|
|
|
|
listPost(queryParams.value).then(response => {
|
|
|
|
console.log('看一下查了啥啊', response.rows)
|
|
|
|
if (queryParams.value.pageNum > 1) {
|
|
|
|
postList.value.push(...response.rows);
|
|
|
|
uni.setStorageSync('myPostDraftList', postList.value)
|
|
|
|
} else {
|
|
|
|
uni.setStorageSync('myPostDraftList', response.rows)
|
|
|
|
}
|
|
|
|
postList.value = uni.getStorageSync('myPostDraftList');
|
|
|
|
// postList.value = response.rows;
|
|
|
|
total.value = response.total;
|
|
|
|
});
|
|
|
|
}
|
2024-06-16 22:21:29 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2024-06-17 15:06:06 +08:00
|
|
|
// page {
|
|
|
|
// background-color: #FFFFFF;
|
|
|
|
// }
|
|
|
|
|
2024-06-16 22:21:29 +08:00
|
|
|
.line1 {
|
|
|
|
height: 4rpx;
|
|
|
|
background-color: #f4f5f6;
|
|
|
|
}
|
2024-06-17 15:06:06 +08:00
|
|
|
</style>
|