feat: update
This commit is contained in:
@@ -80,12 +80,6 @@ const navigateToEditPost = (post) => {
|
||||
router.push(`/posts/edit/${post.id}`);
|
||||
};
|
||||
|
||||
// View post details
|
||||
const viewPost = (post) => {
|
||||
// In a real app, this would navigate to a post detail page
|
||||
toast.add({ severity: 'info', summary: '查看', detail: `查看文章: ${post.title}`, life: 3000 });
|
||||
};
|
||||
|
||||
// Delete post
|
||||
const confirmDelete = (post) => {
|
||||
confirm.require({
|
||||
@@ -295,9 +289,6 @@ const handleSendConfirm = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const formatUserLabel = (user) => {
|
||||
return `${user.nickname} (${user.phone})`;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -62,6 +62,12 @@ onMounted(() => {
|
||||
fetchUserDetail();
|
||||
fetchUserArticles();
|
||||
});
|
||||
|
||||
|
||||
|
||||
const formatPrice = (price) => {
|
||||
return (price / 100).toFixed(2);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -114,7 +120,11 @@ onMounted(() => {
|
||||
:lazy="true" :totalRecords="totalArticles" :rows="lazyParams.limit" :loading="loading"
|
||||
@page="onPage" paginator :rows-per-page-options="[10, 20, 50]">
|
||||
<Column field="title" header="标题"></Column>
|
||||
<Column field="price" header="价格"></Column>
|
||||
<Column field="price" header="价格">
|
||||
<template #body="{ data }">
|
||||
¥ {{ formatPrice(data.price) }}
|
||||
</template>
|
||||
</Column>
|
||||
<Column field="bought_at" header="购买时间">
|
||||
<template #body="{ data }">
|
||||
{{ formatDate(data.bought_at) }}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import { useAuthStore } from '@/stores/authStore';
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
|
||||
// ...existing code...
|
||||
|
||||
// Add login route
|
||||
const routes = [
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: () => import('@/pages/LoginPage.vue'),
|
||||
meta: { requiresAuth: false }
|
||||
},
|
||||
// ...existing routes...
|
||||
];
|
||||
|
||||
// Add navigation guard
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
const authStore = useAuthStore();
|
||||
|
||||
if (to.meta.requiresAuth !== false && !authStore.isAuthenticated) {
|
||||
next('/login');
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user