个人页面查询自己帖子

main
parent fa3b1557f5
commit 791862b593

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

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

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

@ -62,5 +62,8 @@ mybatis-plus:
mapper-locations: classpath*:mapper/**/*.xml mapper-locations: classpath*:mapper/**/*.xml
type-aliases-package: com.luojia.luojia_channel.modules.*.entity 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 UserPage from '@/views/UserPage.vue';
import NotificationList from '@/views/NotificationList.vue'; import NotificationList from '@/views/NotificationList.vue';
import ChangeInformation from '@/views/ChangeInformation.vue'; import ChangeInformation from '@/views/ChangeInformation.vue';
import FeedBack from '@/views/FeedBack.vue';
const routes = [ const routes = [
{ {
@ -43,6 +44,11 @@ const routes = [
name: 'NotificationDetail', name: 'NotificationDetail',
component: () => import('@/views/NotificationDetail.vue'), component: () => import('@/views/NotificationDetail.vue'),
props: true props: true
},
{//通知页面
path: '/feedback',
name: 'FeedBack',
component: FeedBack
}, },
{ {
//修改个人信息界面 //修改个人信息界面

@ -58,14 +58,17 @@
</template> </template>
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useUserStore } from '@/stores/user.js'; import { useUserStore } from '@/stores/user.js';
import axios from 'axios';
const router = useRouter(); const router = useRouter();
const userStore = useUserStore(); const userStore = useUserStore();
const userInfo = computed(() => userStore.userInfo);
//
const loading = ref(true);
//
const userPosts = ref([ const userPosts = ref([
{ {
id: 1, id: 1,
@ -85,13 +88,54 @@ const userPosts = ref([
} }
]); ]);
const userStats = ref({ const userInfo = computed(() => userStore.userInfo);
//
const userStats = computed(() => ({
postCount: userPosts.value.length, postCount: userPosts.value.length,
followers: 0, followers: 0,
following: 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) => { const goToPostDetail = (postId) => {
router.push({ name: 'PostDetail', params: { id: postId } }); router.push({ name: 'PostDetail', params: { id: postId } });
}; };

Loading…
Cancel
Save