个人页面查询自己帖子

main
parent fa3b1557f5
commit 791862b593

@ -1,36 +1,36 @@
#本地开发环境
# lj:
# db:
# host: localhost
# password: 123456
# redis:
# host: localhost
# port: 6379
# password: 123456
# rabbitmq:
# host: localhost
# port: 15672
# username: root
# password: 123456
# minio:
# endpoint: http://localhost:9000
# accessKey: minioadmin
# secretKey: minioadmin
lj:
db:
host: localhost
password: 1243969857
redis:
host: localhost
port: 6379
password: 1243969857
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
minio:
endpoint: http://localhost:9000
accessKey: minioadmin
secretKey: minioadmin
lj:
db:
host: 192.168.59.129
password: Forely123!
redis:
host: 192.168.59.129
port: 6379
password: Forely123!
rabbitmq:
host: 192.168.59.129
port: 5672
username: admin
password: Forely123!
minio:
endpoint: http://192.168.59.129:9000
accessKey: forely
secretKey: Forely123!
#lj:
# db:
# host: 192.168.59.129
# password: Forely123!
# redis:
# host: 192.168.59.129
# port: 6379
# password: Forely123!
# rabbitmq:
# host: 192.168.59.129
# port: 5672
# username: admin
# password: Forely123!
# minio:
# endpoint: http://192.168.59.129:9000
# accessKey: forely
# secretKey: Forely123!

@ -62,5 +62,8 @@ mybatis-plus:
mapper-locations: classpath*:mapper/**/*.xml
type-aliases-package: com.luojia.luojia_channel.modules.*.entity
management:
health:
elasticsearch:
enabled: false

@ -1,36 +1,36 @@
#本地开发环境
# lj:
# db:
# host: localhost
# password: 123456
# redis:
# host: localhost
# port: 6379
# password: 123456
# rabbitmq:
# host: localhost
# port: 15672
# username: root
# password: 123456
# minio:
# endpoint: http://localhost:9000
# accessKey: minioadmin
# secretKey: minioadmin
lj:
db:
host: localhost
password: 1243969857
redis:
host: localhost
port: 6379
password: 1243969857
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
minio:
endpoint: http://localhost:9000
accessKey: minioadmin
secretKey: minioadmin
lj:
db:
host: 192.168.59.129
password: Forely123!
redis:
host: 192.168.59.129
port: 6379
password: Forely123!
rabbitmq:
host: 192.168.59.129
port: 5672
username: admin
password: Forely123!
minio:
endpoint: http://192.168.59.129:9000
accessKey: forely
secretKey: Forely123!
#lj:
# db:
# host: 192.168.59.129
# password: Forely123!
# redis:
# host: 192.168.59.129
# port: 6379
# password: Forely123!
# rabbitmq:
# host: 192.168.59.129
# port: 5672
# username: admin
# password: Forely123!
# minio:
# endpoint: http://192.168.59.129:9000
# accessKey: forely
# secretKey: Forely123!

@ -62,5 +62,8 @@ mybatis-plus:
mapper-locations: classpath*:mapper/**/*.xml
type-aliases-package: com.luojia.luojia_channel.modules.*.entity
management:
health:
elasticsearch:
enabled: false

@ -6,6 +6,7 @@ import MainPage from '@/views/MainPage.vue';
import UserPage from '@/views/UserPage.vue';
import NotificationList from '@/views/NotificationList.vue';
import ChangeInformation from '@/views/ChangeInformation.vue';
import FeedBack from '@/views/FeedBack.vue';
const routes = [
{
@ -43,6 +44,11 @@ const routes = [
name: 'NotificationDetail',
component: () => import('@/views/NotificationDetail.vue'),
props: true
},
{//通知页面
path: '/feedback',
name: 'FeedBack',
component: FeedBack
},
{
//修改个人信息界面

@ -58,14 +58,17 @@
</template>
<script setup>
import { ref, computed } from 'vue';
import { ref, computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useUserStore } from '@/stores/user.js';
import axios from 'axios';
const router = useRouter();
const userStore = useUserStore();
const userInfo = computed(() => userStore.userInfo);
//
const loading = ref(true);
//
const userPosts = ref([
{
id: 1,
@ -85,13 +88,54 @@ const userPosts = ref([
}
]);
const userStats = ref({
const userInfo = computed(() => userStore.userInfo);
//
const userStats = computed(() => ({
postCount: userPosts.value.length,
followers: 0,
following: 0,
likes: 0
likes: userPosts.value.reduce((sum, post) => sum + (post.likeCount || 0), 0)
}));
//
onMounted(async () => {
try {
//
const response = await axios.post('/post/user',
{
offset: 0, //
size: 10 //
},
{
headers: {
Authorization: `Bearer ${userStore.userInfo.accessToken}`
}
}
);
//
if (response.data.code === 0) {
userPosts.value = response.data.data.records.map(post => ({
id: post.id,
title: post.title,
summary: post.summary, // 50
likes: post.likeCount,
comments: post.commentCount,
favorites: post.favoriteCount,
image: post.image || '/default-post-image.png'
}));
}
} catch (error) {
console.error('帖子加载失败:', error);
alert('帖子加载失败,请检查网络连接');
} finally {
loading.value = false;
}
});
//
const goToPostDetail = (postId) => {
router.push({ name: 'PostDetail', params: { id: postId } });
};

Loading…
Cancel
Save