talk_appAmin/pages/mine/myPost/draft/draft.vue

133 lines
2.5 KiB
Vue

<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>
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 {
listPost,
listPostFollow,
getPost,
delPost,
addPost,
updatePost,
getLoginUserinfo
} from "@/api/talk/post";
const loginUser = reactive(uni.getStorageSync('loginUserPost'));
const postList = ref([]);
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);
onLoad(() => {
queryParams.value.uid = loginUser.userId
getList();
onReachBottom(() => {
console.log('触底了')
if (total.value > postList.value.length) {
queryParams.value.pageNum += 1;
getList();
}
})
})
/** 查询话题投稿new列表 */
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;
});
}
</script>
<style lang="scss">
// page {
// background-color: #FFFFFF;
// }
.line1 {
height: 4rpx;
background-color: #f4f5f6;
}
</style>