Merge remote-tracking branch 'origin/main' into main

main
26947 2024-06-17 07:30:35 +08:00
commit 8e7afa5529
10 changed files with 605 additions and 195 deletions

View File

@ -9,6 +9,15 @@ export function listPost(query) {
}) })
} }
// 查询该用户关注的话题投稿new列表
export function listPostFollow(query) {
return request({
url: '/talk/post/follow',
method: 'get',
params: query
})
}
// 查询话题投稿new详细 // 查询话题投稿new详细
export function getPost(id) { export function getPost(id) {
return request({ return request({

View File

@ -407,6 +407,20 @@
"navigationBarTitleText": "消息切换", "navigationBarTitleText": "消息切换",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},
{
"path" : "pages/mine/myPost/myPost",
"style" :
{
"navigationBarTitleText" : "我的话题"
}
},
{
"path" : "pages/mine/myPost/draft/draft",
"style" :
{
"navigationBarTitleText" : "草稿箱"
}
} }
], ],
"tabBar": { "tabBar": {

View File

@ -2,7 +2,7 @@
<!-- 话题 --> <!-- 话题 -->
<view class="center-content-post" @click="toPostInfoView()"> <view class="center-content-post" @click="toPostInfoView()">
<view class="center-content-post-padding"> <view class="center-content-post-padding">
<view class="center-content-post-head"> <view class="center-content-post-head" v-if="postViewIndex != 3">
<!-- 左对齐 --> <!-- 左对齐 -->
<view class="flex alignCenter"> <view class="flex alignCenter">
<!-- 头像 --> <!-- 头像 -->
@ -19,16 +19,28 @@
</view> </view>
</view> </view>
<!-- 右对齐 --> <!-- 右对齐 -->
<view class="flex alignCenter" v-if="postViewIndex != 0"> <!-- 关注操作 -->
<view class="flex alignCenter" v-if="postViewIndex != 0 && loginUser.userId != postValue.uid">
<text class="focus-text" v-if="postValue.focus" @click.stop="cancelFocus(postValue.uid)"></text> <text class="focus-text" v-if="postValue.focus" @click.stop="cancelFocus(postValue.uid)"></text>
<text class="no-focus-text" v-else @click.stop="addFocus(postValue.uid)">关注</text> <text class="no-focus-text" v-else @click.stop="addFocus(postValue.uid)">关注</text>
</view> </view>
<!-- 状态 -->
<view class="" v-if="postViewIndex == 2 && loginUser.userId == postValue.uid">
<text class="pass-text" v-if="postValue.status == 0" >已发布</text>
<text class="audit-text" v-if="postValue.status == 2" >审核中</text>
<text class="refuse-text" v-if="postValue.status == 3" >未通过</text>
</view>
<!-- 删除操作 -->
<view class="">
<image v-if="postViewIndex == 4 && loginUser.userId == postValue.uid && postValue.status == 0" class="delImg" @click="toDel"
src="../../../static/images/icon/sang-1.png" :lazy-load="true"></image>
</view>
</view> </view>
<text class="center-content-post-title" v-if="postValue.title">{{postValue.title}}</text> <text class="center-content-post-title" v-if="postValue.title">{{postValue.title}}</text>
<text class="center-content-post-content-0" <text class="center-content-post-content-0"
v-if="postValue.content && postViewType == 0">{{postValue.content}}</text> v-if="postValue.content && postViewIndex == 3 || postViewIndex == 0 || postViewIndex == 1 || postViewIndex == 2">{{postValue.content}}</text>
<text class="center-content-post-content-1" <text class="center-content-post-content-1"
v-if="postValue.content && postViewType == 1">{{postValue.content}}</text> v-else>{{postValue.content}}</text>
<!-- 图片 --> <!-- 图片 -->
<!--一张图片--> <!--一张图片-->
<block v-if="toimage(postValue.media) && toimage(postValue.media).length == 1"> <block v-if="toimage(postValue.media) && toimage(postValue.media).length == 1">
@ -137,6 +149,8 @@
</view> </view>
</view> </view>
</view> </view>
<up-modal :show="modalShow" title="是否删除该话题" showCancelButton="true" closeOnClickOverlay="true" @confirm='modalConfirm' @cancel="modalCancel" @close="modalClose"></up-modal>
<up-toast ref="uToastRef"></up-toast>
</template> </template>
<script setup> <script setup>
@ -158,6 +172,15 @@
import { import {
getDicts getDicts
} from "@/api/system/dict/data"; } from "@/api/system/dict/data";
import {
listPost,
listPostFollow,
getPost,
delPost,
addPost,
updatePost,
getLoginUserinfo
} from "@/api/talk/post";
import { import {
listFollowUser, listFollowUser,
getFollowUser, getFollowUser,
@ -174,8 +197,12 @@
addPostFavorite addPostFavorite
} from "@/api/postFavorite/postFavorite"; } from "@/api/postFavorite/postFavorite";
const emit = defineEmits(["updateFocusFather"])
const modalShow = ref(false)
const loginUser = reactive(uni.getStorageSync('loginUserPost'));
const dictPostTab = ref([]) const dictPostTab = ref([])
onLoad((options) => { onLoad((options) => {
getDicts('post_tab').then(e => { getDicts('post_tab').then(e => {
dictPostTab.value = e.data dictPostTab.value = e.data
}) })
@ -287,6 +314,52 @@
}); });
}; };
//
//
const uToastRef = ref(null)
const uToastRefParams = reactive({
type: 'default',
title: '结束后跳转标签页',
message: "删除成功",
// url: '/pages/componentsB/tag/tag',
// iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/jump.png'
})
function showToast(params) {
uToastRef.value.show({
...params,
complete() {
params.url && uni.navigateTo({
url: params.url
});
}
});
}
const modalConfirm = () => {
delPost(props.postValue.id).then(res => {
showToast(uToastRefParams);
setTimeout(function() {
uni.$emit('refreshData');
uni.navigateBack({
delta: 1
});
}, 1000);
});
modalShow.value = false;
}
const modalCancel = () => {
modalShow.value = false;
}
const modalClose = () => {
modalShow.value = false;
}
const toDel = () => {
modalShow.value = true;
}
// //
const cancelCollection = (postId) => { const cancelCollection = (postId) => {
const postLike = reactive({ const postLike = reactive({
@ -336,7 +409,6 @@
// //
const emit = defineEmits(["updateFocusFather"])
const cancelFocus = (uid) => { const cancelFocus = (uid) => {
const followUser = reactive({ const followUser = reactive({
@ -374,10 +446,13 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.center-content-post {}
.center-content-post {
}
.center-content-post-padding { .center-content-post-padding {
padding: 46rpx 32rpx 28rpx 32rpx; padding: 46rpx 32rpx 28rpx 32rpx;
} }
.center-content-post-head { .center-content-post-head {
@ -412,6 +487,13 @@
/* 垂直结束对齐 */ /* 垂直结束对齐 */
height: 30rpx; height: 30rpx;
line-height: 30rpx; line-height: 30rpx;
display: block;
width: 480rpx;
// display: flex; /* */
// max-width: 450rpx; /* 300rpx */
overflow: hidden; /* 超出部分隐藏 */
text-overflow: ellipsis; /* 超出部分用省略号表示 */
white-space: nowrap; /* 不换行 */
} }
.no-focus-text { .no-focus-text {
@ -662,4 +744,27 @@
color: #fff; color: #fff;
} }
} }
.pass-text {
font-weight: 400;
font-size: 28rpx;
color: #3477FC;
}
.audit-text {
font-weight: 400;
font-size: 28rpx;
color: #43CE8F;
}
.refuse-text {
font-weight: 400;
font-size: 28rpx;
color: #F87863;
}
.delImg {
width: 32rpx;
height: 42rpx;
}
</style> </style>

View File

@ -54,8 +54,8 @@
<view class="flex alignCenter justifyBetween"> <view class="flex alignCenter justifyBetween">
<view class="center-content-focus-item" v-for="(item, index) in focusList" :key="index"> <view class="center-content-focus-item" v-for="(item, index) in focusList" :key="index">
<u-avatar class="center-content-focus-item-avatat" size="120rpx" <u-avatar class="center-content-focus-item-avatat" size="120rpx"
:src="item.avatar"></u-avatar> :src="getAvatar(item.avatar)"></u-avatar>
<text class="center-content-focus-item-text">{{item.uname}}</text> <text class="center-content-focus-item-text">{{item.nickName}}</text>
</view> </view>
</view> </view>
</u-scroll-list> </u-scroll-list>
@ -145,12 +145,14 @@
import PostView from "@/pages/common/postview/index.vue"; import PostView from "@/pages/common/postview/index.vue";
import { import {
listPost, listPost,
listPostFollow,
getPost, getPost,
delPost, delPost,
addPost, addPost,
updatePost, updatePost,
getLoginUserinfo getLoginUserinfo
} from "@/api/talk/post"; } from "@/api/talk/post";
import { listFollowUser, getFollowUser, delFollowUser, addFollowUser, updateFollowUser } from "@/api/followUser/followUser";
import { import {
useStore useStore
} from 'vuex'; } from 'vuex';
@ -159,6 +161,7 @@
proxy proxy
} = getCurrentInstance(); } = getCurrentInstance();
const loginUser = reactive(uni.getStorageSync('loginUserPost'));
const QNDomain = store.state.user.QNDomain; const QNDomain = store.state.user.QNDomain;
const postList = ref([]); const postList = ref([]);
@ -191,10 +194,12 @@
longitude: null, longitude: null,
latitude: null, latitude: null,
auditor: null, auditor: null,
status: null, status: 0,
auditTime: null, auditTime: null,
auditAdvice: null, auditAdvice: null,
cut: null, cut: null,
sortField: null,
sortDirection: null,
}, },
rules: { rules: {
status: [{ status: [{
@ -216,17 +221,81 @@
rules rules
} = toRefs(data); } = toRefs(data);
const followTotal = ref(0);
const queryFollowParams = reactive({
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: 0,
auditTime: null,
auditAdvice: null,
cut: null,
sortField: null,
sortDirection: null,
})
/** 查询话题投稿new列表 */ /** 查询话题投稿new列表 */
function getList() { function getList() {
queryParams.value.params = {}; if (searchPrerequisite.value == '热门') {
queryParams.value.sortField = 'like_count';
} else if (searchPrerequisite.value == '最新') {
queryParams.value.sortField = 'create_time';
}
listPost(queryParams.value).then(response => { listPost(queryParams.value).then(response => {
console.log('看一下查了啥啊',response.rows)
if (queryParams.value.pageNum > 1) {
postList.value.push(...response.rows);
uni.setStorageSync('postList', postList.value)
} else {
uni.setStorageSync('postList', response.rows) uni.setStorageSync('postList', response.rows)
}
postList.value = uni.getStorageSync('postList'); postList.value = uni.getStorageSync('postList');
// postList.value = response.rows; // postList.value = response.rows;
total.value = response.total; total.value = response.total;
}); });
} }
function getFollowList() {
if (searchPrerequisite.value == '热门') {
queryFollowParams.sortField = 'like_count';
} else if (searchPrerequisite.value == '最新') {
queryFollowParams.sortField = 'create_time';
}
listPostFollow(queryFollowParams).then(response => {
console.log('看一下查了啥啊关注',response)
if (queryFollowParams.pageNum > 1) {
postList.value.push(...response.rows);
} else {
postList.value = response.rows;
}
followTotal.value = response.total;
});
}
function getAvatar(avatar) {
return QNDomain + avatar;
}
const toimage = (url) => { const toimage = (url) => {
if (typeof url === 'string') { if (typeof url === 'string') {
let info = url.split(","); let info = url.split(",");
@ -239,6 +308,9 @@
const bgColor = ref('rgba(170, 0, 0, 0)'); const bgColor = ref('rgba(170, 0, 0, 0)');
onLoad(() => { onLoad(() => {
uni.$on('refreshData',() => {
reactiveList();
})
getLoginUserinfo().then(res => { getLoginUserinfo().then(res => {
uni.setStorageSync('loginUserPost', res.data) uni.setStorageSync('loginUserPost', res.data)
}) })
@ -252,6 +324,18 @@
}); });
onReachBottom(() => { onReachBottom(() => {
console.log('触底了') console.log('触底了')
if (viewIndex.value == 1) {
if (total.value > postList.value.length) {
queryParams.value.pageNum += 1;
getList();
}
}
if (viewIndex.value == 0) {
if (followTotal.value > postList.value.length) {
queryFollowParams.pageNum += 1;
getFollowList();
}
}
}) })
InspectionData() InspectionData()
}) })
@ -271,7 +355,12 @@
} }
onShow(() => { onShow(() => {
if (viewIndex.value == 1) {
postList.value = uni.getStorageSync('postList'); postList.value = uni.getStorageSync('postList');
}
if (viewIndex.value == 0) {
selectFollowView();
}
}) })
const viewIndex = ref(1); const viewIndex = ref(1);
@ -300,92 +389,7 @@
} }
]); ]);
const focusList = reactive([{ const focusList = ref([]);
avatar: 'https://k.sinaimg.cn/n/sports/transform/400/w600h600/20220130/dd38-eed53ba750d1d8c87eca8b57eda879a5.jpg/w700d1q75cms.jpg?by=cms_fixed_width',
uname: '爱吃饭的小张'
},
{
avatar: 'https://oss.1381801.com/forum/202308/11/093616ccxkx99wchwrrw1a.jpg',
uname: '喜欢你没道理'
},
{
avatar: 'https://picx.zhimg.com/v2-02f89d05a781ffed9fd2e32654d93135_720w.jpg?source=172ae18b',
uname: '恋爱60秒'
},
{
avatar: 'https://www.tboxn.com/wp-content/uploads/2022/11/%E5%A4%B4%E5%83%8F.png',
uname: '爱吃饭的小张'
}
]);
// const postList = reactive([
// {
// avatar: 'https://k.sinaimg.cn/n/sports/transform/400/w600h600/20220130/dd38-eed53ba750d1d8c87eca8b57eda879a5.jpg/w700d1q75cms.jpg?by=cms_fixed_width',
// uname: '',
// createTime: '11',
// address: '',
// isFocus: false,
// isOfficial: true,
// title: '·,',
// content: '......',
// type: '1',
// media: [
// 'https://img1.baidu.com/it/u=1179199327,1946315836&fm=253&fmt=auto&app=138&f=JPEG?w=1364&h=800',
// 'https://www4.bing.com//th?id=OHR.CopenhagenBicycles_ZH-CN3047958346_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp&w=360&h=202',
// 'https://www4.bing.com//th?id=OHR.CarnavalTenerife_ZH-CN1559136778_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp&w=360&h=202',
// 'https://www4.bing.com//th?id=OHR.StJamesPool_ZH-CN5930624359_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp&w=360&h=202',
// ],
// tab: ['', ''],
// transmitCount: 136,
// isLike: true,
// likeCount: 999,
// commentCount: 136,
// ifFavorite: true,
// favoriteCount: 136
// },
// {
// avatar: 'https://oss.1381801.com/forum/202308/11/093616ccxkx99wchwrrw1a.jpg',
// uname: '',
// createTime: '2024-5-5',
// address: '',
// isFocus: false,
// isOfficial: false,
// content: '20111线',
// type: '1',
// media: [
// 'https://www4.bing.com//th?id=OHR.BambooPanda_ZH-CN8455481760_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp&w=360&h=202',
// ],
// tab: [''],
// transmitCount: 13,
// isLike: false,
// likeCount: 99,
// commentCount: 13,
// ifFavorite: true,
// favoriteCount: 13
// },
// {
// avatar: 'https://picx.zhimg.com/v2-02f89d05a781ffed9fd2e32654d93135_720w.jpg?source=172ae18b',
// uname: '60',
// createTime: '2024-5-4',
// address: '',
// isFocus: false,
// isOfficial: false,
// title: '·,',
// content: '20111线',
// type: '1',
// media: [
// 'https://www4.bing.com//th?id=OHR.PlitviceWinter_ZH-CN0407572344_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp&w=360&h=202',
// 'https://www4.bing.com//th?id=OHR.HawkOwl_ZH-CN3401920167_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp&w=360&h=202'
// ],
// tab: [''],
// transmitCount: 13,
// isLike: false,
// likeCount: 99,
// commentCount: 13,
// ifFavorite: false,
// favoriteCount: 13
// }
// ]);
const publishTalk = (item) => { const publishTalk = (item) => {
if (item.id === 1) { if (item.id === 1) {
@ -432,12 +436,51 @@
}; };
const click = (item) => { const click = (item) => {
if (item.index == 1 && viewIndex.value == 0) {
queryParams.value.pageNum = 1;
getList();
}
viewIndex.value = item.index; viewIndex.value = item.index;
if (item.index == 0) {
selectFollowView();
}
if (item.index == 1) {
postList.value = uni.getStorageSync('postList');
}
}; };
const selectFollowView = () => {
const FollowUser ={
userId: loginUser.userId
};
listFollowUser(FollowUser).then(res => {
console.log(res.rows);
queryFollowParams.pageNum = 1;
postList.value = [];
if (res.rows.length == 0) {
const noFollew ={
avatar: 'noFollew',
nickName: '暂无关注'
};
res.rows.push(noFollew);
focusList.value = res.rows;
return;
};
focusList.value = res.rows;
getFollowList();
})
}
const handerLi = (res) => { const handerLi = (res) => {
lefther.value = res; lefther.value = res;
searchPrerequisite.value = searchPrerequisiteList[res]; searchPrerequisite.value = searchPrerequisiteList[res];
if (viewIndex.value == 1) {
queryParams.value.pageNum = 1;
postList.value = [];
getList();
} else if (viewIndex.value == 0) {
getFollowList();
}
setTimeout(() => { setTimeout(() => {
searchOpen.value = !searchOpen.value; searchOpen.value = !searchOpen.value;
}, 350); }, 350);
@ -462,6 +505,12 @@
postList.value = uni.getStorageSync('postList'); postList.value = uni.getStorageSync('postList');
// console.log('' + uni.getStorageSync('postList')) // console.log('' + uni.getStorageSync('postList'))
} }
const reactiveList = () => {
queryParams.value.pageNum = 1;
getList();
}
getList(); getList();
</script> </script>

View File

@ -233,6 +233,14 @@ function handleLogout() {
onPullDownRefresh((options) => { onPullDownRefresh((options) => {
proxy.$router.go(0) proxy.$router.go(0)
}) })
const grid1Click1 = (e) => {
console.log(e)
if (e == 4) {
proxy.$tab.navigateTo('/pages/mine/myPost/draft/draft')
} else {
proxy.$tab.navigateTo('/pages/mine/myPost/myPost?type=' + e)
}
}
const grid1Click2 = (e) => { const grid1Click2 = (e) => {
if (e == 4) { if (e == 4) {
proxy.$tab.navigateTo('/pages/mine/myActivity/draft') proxy.$tab.navigateTo('/pages/mine/myActivity/draft')

View File

@ -255,9 +255,7 @@ const getDictLabelByValue = (state) => {
</script> </script>
<style lang="scss"> <style lang="scss">
page {
background-color: #F4F5F6;
}
.tabsinfo { .tabsinfo {
background-color: #ffffff; background-color: #ffffff;

View File

@ -0,0 +1,123 @@
<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>

View File

@ -0,0 +1,191 @@
<template>
<view>
<!-- tab -->
<up-sticky offset-top="0">
<view class="tabsinfo flex alignCenter justifyCenter">
<up-tabs :list="list4" lineWidth="20" lineHeight="2" @click="tabsClick" :current="typeIndex" lineColor="#3477FC" :activeStyle="{
color: '#000000',
fontSize: '28rpx',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#999999',
fontSize: '28rpx',
transform: 'scale(1.05)'
}" itemStyle=" width: 180rpx; padding-bottom:18rpx;">
</up-tabs>
</view>
<up-line></up-line>
</up-sticky>
<!-- 列表 -->
<view class="bc-color" v-for="(postItem, postIndex) in postList" :key="postIndex">
<PostView :postValue="postItem" :postViewIndex="2" :postViewType="0"></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 typeIndex = ref(9)
const list4 = reactive([
{ name: '全部活动', state: 9 },
{ name: '已发布', state: 0 },
{ name: '未通过', state: 3 },
{ name: '审核中', state: 2 }
]);
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: null,
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((options) => {
const type = Number(options.type)
console.log('你好',type)
if (options.type == 0) {
typeIndex.value = 0
queryParams.value.status = null
} else if (options.type == 1) {
typeIndex.value = 1
queryParams.value.status = 0
} else if (options.type == 3) {
typeIndex.value = 2
queryParams.value.status = 2
} else if (options.type == 2) {
typeIndex.value = 3
queryParams.value.status = 3
}
queryParams.value.uid = loginUser.userId
getList(type);
onReachBottom(() => {
console.log('触底了')
if (total.value > postList.value.length) {
queryParams.value.pageNum += 1;
getList();
}
})
})
//
const tabsClick = (index) => {
removePage()
if (index.state == 9) {
queryParams.value.status = null;
} else {
queryParams.value.status = index.state
}
getList()
}
const removePage = () => {
queryParams.value.pageNum = 1;
}
/** 查询话题投稿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('myPostList', postList.value)
} else {
uni.setStorageSync('myPostList', response.rows)
}
console.log('看一下查了啥啊aa',uni.getStorageSync('myPostList'))
postList.value = uni.getStorageSync('myPostList');
console.log('看一下查了啥啊aa',postList.value)
// postList.value = response.rows;
total.value = response.total;
});
}
</script>
<style lang="scss">
page {
background-color: #F4F5F6;
}
.tabsinfo {
width: 100%;
height: 2.125rem;
background-color: #FFFFFF;
display: flex;
align-items: flex-end;
}
.bc-color {
background-color: #ffffff;
}
</style>

View File

@ -1,8 +1,8 @@
<template> <template>
<view> <view>
<PostView :postValue="postValue" :postViewIndex="1" :postViewType="1"></PostView> <PostView :postValue="postValue" :postViewIndex="4" :postViewType="1"></PostView>
<view class="center-content-focus-line"></view> <view class="center-content-focus-line"></view>
<view class="comment"> <view class="comment" v-if="postValue.status == 0">
<view class="flex justifyBetween alignCenter commentTop"> <view class="flex justifyBetween alignCenter commentTop">
<text class="commentLabel">{{"全部评论" + (postValue.commentCount != 0 ? "" + postValue.commentCount + "" : "")}}</text> <text class="commentLabel">{{"全部评论" + (postValue.commentCount != 0 ? "" + postValue.commentCount + "" : "")}}</text>
<text class="report">举报</text> <text class="report">举报</text>
@ -213,66 +213,6 @@
address: null, address: null,
}); });
const postList = reactive([{
avatar: 'https://k.sinaimg.cn/n/sports/transform/400/w600h600/20220130/dd38-eed53ba750d1d8c87eca8b57eda879a5.jpg/w700d1q75cms.jpg?by=cms_fixed_width',
nickName: '爱吃饭的小张',
address: '南开大学',
content: '大家来评论',
createTime: '7分钟前',
isOfficial: true,
deployment: false,
answerCommentAllCount: 4,
answerCommentPage: 0,
answerCommentDisplayCount: 0,
answerCommentList: [{
avatar: 'https://picx.zhimg.com/v2-02f89d05a781ffed9fd2e32654d93135_720w.jpg?source=172ae18b',
nickName: '恋爱60秒',
createTime: '2024.05.04',
isOfficial: false,
address: '理工大学',
content: '来了',
},
{
avatar: 'https://oss.1381801.com/forum/202308/11/093616ccxkx99wchwrrw1a.jpg',
nickName: '喜欢你没道理',
createTime: '2024.05.04',
isOfficial: false,
address: '理工大学',
content: '你干嘛~',
toUserName: '恋爱60秒',
},
{
avatar: 'https://www.tboxn.com/wp-content/uploads/2022/11/%E5%A4%B4%E5%83%8F.png',
nickName: '神奇宝贝',
createTime: '2024.05.04',
isOfficial: false,
address: '理工大学',
content: '哎呦~',
toUserName: '喜欢你没道理',
},
{
avatar: 'https://files.codelife.cc/wallhaven/full/wq/wallhaven-wqkw2r.jpg?x-oss-process=image/resize,limit_0,m_fill,w_307,h_158/quality,Q_92/format,webp',
nickName: '皮卡丘',
createTime: '2024.05.04',
isOfficial: true,
address: '理工大学',
content: '要再点一下才能看到我',
toUserName: '喜欢你没道理',
},
]
},
{
avatar: 'https://picx.zhimg.com/v2-02f89d05a781ffed9fd2e32654d93135_720w.jpg?source=172ae18b',
nickName: '恋爱60秒',
createTime: '2024.05.04',
isOfficial: false,
deployment: false,
address: '理工大学',
content: '评论区上线了',
answerCommentList: []
}
]);
const getPostInfo = () => { const getPostInfo = () => {
queryParams.postId = postValue.id; queryParams.postId = postValue.id;
listComment(queryParams).then(res => { listComment(queryParams).then(res => {
@ -281,32 +221,7 @@
total.value = res.total total.value = res.total
}); });
}; };
// const postValue = reactive(
// {
// avatar: 'https://k.sinaimg.cn/n/sports/transform/400/w600h600/20220130/dd38-eed53ba750d1d8c87eca8b57eda879a5.jpg/w700d1q75cms.jpg?by=cms_fixed_width',
// uname: '',
// createTime: '11',
// address: '',
// isFocus: false,
// isOfficial: true,
// title: '·,',
// content: '......',
// type: '1',
// media: [
// 'https://img1.baidu.com/it/u=1179199327,1946315836&fm=253&fmt=auto&app=138&f=JPEG?w=1364&h=800',
// 'https://www4.bing.com//th?id=OHR.CopenhagenBicycles_ZH-CN3047958346_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp&w=360&h=202',
// 'https://www4.bing.com//th?id=OHR.CarnavalTenerife_ZH-CN1559136778_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp&w=360&h=202',
// 'https://www4.bing.com//th?id=OHR.StJamesPool_ZH-CN5930624359_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp&w=360&h=202',
// ],
// tab: ['', ''],
// transmitCount: 136,
// like: true,
// likeCount: 999,
// commentCount: 136,
// favorite: true,
// favoriteCount: 136
// }
// );
const store = useStore(); const store = useStore();
const QNDomain = store.state.user.QNDomain; const QNDomain = store.state.user.QNDomain;
@ -537,9 +452,7 @@
queryParamsSon.rootId = comment.id; queryParamsSon.rootId = comment.id;
queryParamsSon.pageNum = comment.answerCommentPage; queryParamsSon.pageNum = comment.answerCommentPage;
listComment(queryParamsSon).then(res => { listComment(queryParamsSon).then(res => {
console.log('看看子评论', res.rows);
comment.answerCommentList.push(...res.rows); comment.answerCommentList.push(...res.rows);
console.log(postCommentList.value[index]);
}); });
if (comment.answerCommentDisplayCount + increment <= comment.answerCommentAllCount) { if (comment.answerCommentDisplayCount + increment <= comment.answerCommentAllCount) {
comment.answerCommentDisplayCount += increment; comment.answerCommentDisplayCount += increment;

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B