Files
product-uniapp/pages/mine/my_reply.vue
T
2025-12-13 17:30:18 +08:00

158 lines
3.2 KiB
Vue

<template>
<view class="container">
<z-paging ref="paging" :auto="false" v-model="contList" @query="queryList" empty-view-text="暂无数据!">
<template #top>
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" title="回复我的"></uni-nav-bar>
</template>
<view class="reply-list">
<view class="reply-card" v-for="(reply, index) in contList" :key="index">
<!-- 主回复 -->
<view class="reply-item">
<view class="reply-heard">
<image :src="reply.user.avatar_pull" class="avatar"></image>
<view class="reply-content">
<view class="username">{{ reply.user.nickname }}</view>
<view class="time">{{ reply.created_at}}</view>
</view>
</view>
<view class="reply-content">
<text class="reply-text">{{ reply.content }}</text>
</view>
</view>
<!-- 子回复 -->
<view class="sub-reply" v-for="(subReply, subIndex) in reply.child" :key="subIndex">
<view class="reply-heard">
<image :src="subReply.user.avatar_pull" class="avatar"></image>
<view class="reply-header">
<view class="username">{{ subReply.user.nickname }}</view>
</view>
</view>
<view class="reply-content">
<text class="reply-text">{{ subReply.content }}</text>
</view>
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
export default {
data() {
return {
contList: []
}
},
onShow(){
this.$refs.paging.reload()
},
methods: {
leftClick() {
uni.reLaunch({
url: '/pages/index/mine',// 替换为你要跳转的页面路径
});
},
queryList(pageNo, pageSize) {
this.loading = true;
var that = this;
request({
url:'common/post/comment/list?scene=self',
method:'get',
data: {
current:pageNo,
size:10
}
}).then(res => {
if(res.data.code ==200){
var datas = res.data.data.records;
this.$refs.paging.complete(datas);
}else{
// this.$refs.paging.complete(null);
// that.listlength=0
}
uni.stopPullDownRefresh();
//
})
}
}
}
</script>
<style scoped>
.container {
min-height: 100vh;
}
.reply-list {
padding: 0;
}
.reply-card {
background-color: #fff;
margin: 10px;
border-radius: 8px;
padding: 12px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.reply-item {
/* display: flex; */
margin-bottom: 12px;
}
.reply-heard{
display: flex;
gap: 10px;
}
.sub-reply {
/* margin-left: 30px; */
padding:8px 12px;
background-color: #F5F6FA;
border-radius: 6px;
}
.avatar {
width: 40px;
height: 40px;
border-radius: 50%;
flex-shrink: 0;
}
.reply-content {
margin-top: 20rpx;
flex: 1;
min-width: 0;
}
.reply-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 6px;
}
.username {
font-size: 13px;
color: #333;
font-weight: 500;
}
.time {
font-size: 12px;
color: #999;
}
.reply-text {
font-size: 13px;
color: #666;
line-height: 1.5;
word-break: break-all;
display: block;
}
</style>