feat: 全面优化前端架构
- 本地化所有资源 (Vue3, Element Plus) 无需外部 CDN - 重新设计主页:登录页 + 系统概览 + 侧边栏导航 - 完善管理后台功能:选题管理、系统日志、用户管理 - 全面支持 PC 和 H5 移动端(响应式布局 + 底部导航) - 优化后端 API 返回格式,兼容前端需求 - 默认首页为登录/系统概览页面 - 统计卡片可点击筛选选题列表 - 模块状态实时展示
This commit is contained in:
+110
-170
@@ -4,94 +4,93 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>宇之然内容创作平台 - 选题管理</title>
|
||||
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/element-plus@2.4.3/dist/index.css">
|
||||
<script src="https://unpkg.com/element-plus@2.4.3/dist/index.full.min.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="/static/element-plus/index.css">
|
||||
<style>
|
||||
.card { background: white; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); padding: 24px; margin-bottom: 24px; }
|
||||
aside button { width: 100%; text-align: left; border: none; background: transparent; border-radius: 8px; margin-bottom: 4px; }
|
||||
aside button:hover { background-color: #f3f4f6; }
|
||||
@media (max-width: 768px) { main { padding-bottom: 70px; } }
|
||||
.nav-title { text-align: center; }
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #f5f7fa; }
|
||||
.navbar { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); color: white; padding: 16px 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
|
||||
.navbar-content { display: flex; justify-content: space-between; align-items: center; max-width: 1400px; margin: 0 auto; }
|
||||
.navbar-title { font-size: 20px; font-weight: 600; }
|
||||
.navbar-user { display: flex; align-items: center; gap: 16px; }
|
||||
.user-info { display: flex; align-items: center; gap: 8px; }
|
||||
.avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 14px; }
|
||||
.main-content { display: flex; flex: 1; max-width: 1400px; margin: 0 auto; width: 100%; }
|
||||
.sidebar { width: 180px; background: white; padding: 16px; box-shadow: 2px 0 8px rgba(0,0,0,0.05); }
|
||||
.sidebar-btn { width: 100%; text-align: left; padding: 12px 16px; border: none; background: transparent; border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: all 0.3s; color: #606266; font-size: 14px; }
|
||||
.sidebar-btn:hover { background: #f5f7fa; color: #409eff; }
|
||||
.sidebar-btn.active { background: #ecf5ff; color: #409eff; font-weight: 600; }
|
||||
.content-area { flex: 1; padding: 24px; overflow-y: auto; }
|
||||
.card { background: white; border-radius: 12px; padding: 24px; margin-bottom: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
|
||||
.status-badge { display: inline-flex; align-items: center; gap: 4px; }
|
||||
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
|
||||
.status-dot.pending { background: #E6A23C; }
|
||||
.status-dot.review { background: #F56C6C; }
|
||||
.status-dot.ready { background: #67C23A; }
|
||||
.status-dot.published { background: #409EFF; }
|
||||
.status-dot.待处理 { background: #E6A23C; }
|
||||
.status-dot.待审查 { background: #F56C6C; }
|
||||
.status-dot.待发布 { background: #67C23A; }
|
||||
.status-dot.已发布 { background: #409EFF; }
|
||||
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: white; box-shadow: 0 -2px 8px rgba(0,0,0,0.1); padding: 8px 0; z-index: 1000; }
|
||||
.mobile-nav-btn { flex: 1; border: none; background: transparent; padding: 12px; text-align: center; font-size: 12px; color: #606266; cursor: pointer; }
|
||||
.mobile-nav-btn.active { color: #409eff; font-weight: 600; }
|
||||
@media (max-width: 768px) {
|
||||
.sidebar { display: none; }
|
||||
.mobile-nav { display: flex; }
|
||||
.content-area { padding: 16px; padding-bottom: 80px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<nav class="bg-gradient-to-r from-blue-600 to-blue-700 text-white shadow-lg">
|
||||
<div class="container mx-auto px-6 py-4 flex justify-between items-center">
|
||||
<h1 class="text-2xl font-bold nav-title">宇之然内容创作平台 - 选题管理</h1>
|
||||
<nav class="navbar">
|
||||
<div class="navbar-content">
|
||||
<h1 class="navbar-title">宇之然内容创作平台 - 选题管理</h1>
|
||||
<div class="navbar-user">
|
||||
<div class="user-info"><div class="avatar">{{ currentUser.username.charAt(0).toUpperCase() }}</div><span>{{ currentUser.username }}</span></div>
|
||||
<el-button type="danger" size="small" @click="handleLogout">退出</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="page flex gap-6">
|
||||
<aside class="w-40 flex-shrink-0 hidden md:block">
|
||||
<button @click="currentPage = 'overview'" :class="['px-4 py-2 rounded-lg', currentPage === 'overview' ? 'bg-blue-50 text-blue-600 font-semibold' : 'text-gray-600']">📊 系统概览</button>
|
||||
<button @click="currentPage = 'topics'" :class="['px-4 py-2 rounded-lg', currentPage === 'topics' ? 'bg-blue-50 text-blue-600 font-semibold' : 'text-gray-600']">📋 选题管理</button>
|
||||
<button @click="currentPage = 'logs'" :class="['px-4 py-2 rounded-lg', currentPage === 'logs' ? 'bg-blue-50 text-blue-600 font-semibold' : 'text-gray-600']">📄 系统日志</button>
|
||||
<button v-if="isAdmin" @click="currentPage = 'users'" :class="['px-4 py-2 rounded-lg', currentPage === 'users' ? 'bg-blue-50 text-blue-600 font-semibold' : 'text-gray-600']">👥 用户管理</button>
|
||||
<div class="main-content">
|
||||
<aside class="sidebar">
|
||||
<button class="sidebar-btn" @click="redirectToPage('/')">📊 系统概览</button>
|
||||
<button class="sidebar-btn active">📋 选题管理</button>
|
||||
<button class="sidebar-btn" @click="redirectToPage('logs.html')">📄 系统日志</button>
|
||||
<button v-if="isAdmin" class="sidebar-btn" @click="redirectToPage('users.html')">👥 用户管理</button>
|
||||
</aside>
|
||||
|
||||
<main class="flex-1">
|
||||
<div class="card" style="padding: 20px; margin-top: 20px;">
|
||||
<h2 class="text-2xl font-bold text-gray-800 mb-6">📋 选题管理</h2>
|
||||
|
||||
<div class="card mb-6" style="display: inline-block; min-width: fit-content;">
|
||||
<div class="flex flex-wrap gap-2 items-center">
|
||||
<main class="content-area">
|
||||
<div class="card">
|
||||
<h2 style="font-size: 24px; font-weight: 600; margin-bottom: 24px;">📋 选题管理</h2>
|
||||
<div class="card" style="display: inline-block; min-width: fit-content; padding: 16px; margin-bottom: 24px;">
|
||||
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
|
||||
<el-button type="primary" size="small" @click="refreshAll">🔄 批量刷新</el-button>
|
||||
<el-button type="success" size="small" @click="triggerGenerateSelected" :disabled="selectedTopicIds.length === 0">▶ 批量创作</el-button>
|
||||
<el-button type="warning" size="small" @click="triggerOptimizeSelected" :disabled="selectedTopicIds.length === 0">🔍 批量优化</el-button>
|
||||
<span class="ml-auto text-sm text-gray-500" v-if="selectedTopicIds.length > 0">已选 {{ selectedTopicIds.length }} 项</span>
|
||||
<span class="ml-auto text-sm text-gray-500" v-if="selectedTopicIds.length > 0" style="color: #909399; font-size: 14px; margin-left: auto;">已选 {{ selectedTopicIds.length }} 项</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-2 mb-4">
|
||||
<div style="display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;">
|
||||
<el-tag size="large" :type="filterStatus === '' ? 'primary' : ''" @click="filterStatus = ''">全部 ({{ topics.length }})</el-tag>
|
||||
<el-tag size="large" :type="filterStatus === '待处理' ? 'primary' : ''" @click="filterStatus = '待处理'">待处理 ({{ countByStatus('待处理') }})</el-tag>
|
||||
<el-tag size="large" :type="filterStatus === '待审查' ? 'primary' : ''" @click="filterStatus = '待审查'">待审查 ({{ countByStatus('待审查') }})</el-tag>
|
||||
<el-tag size="large" :type="filterStatus === '待发布' ? 'primary' : ''" @click="filterStatus = '待发布'">待发布 ({{ countByStatus('待发布') }})</el-tag>
|
||||
<el-tag size="large" :type="filterStatus === '已发布' ? 'primary' : ''" @click="filterStatus = '已发布'">已发布 ({{ countByStatus('已发布') }})</el-tag>
|
||||
</div>
|
||||
|
||||
<div class="card" style="width: 100%; overflow-x: auto; box-sizing: border-box;">
|
||||
<div class="card" style="width: 100%; overflow-x: auto; padding: 16px;">
|
||||
<el-table :data="filteredTopics" stripe v-loading="loadingTable" @selection-change="selectedTopicIds = $event">
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column prop="id" label="ID" width="70" fixed></el-table-column>
|
||||
<el-table-column prop="title" label="标题" min-width="220"></el-table-column>
|
||||
<el-table-column prop="title" label="标题" min-width="200"></el-table-column>
|
||||
<el-table-column prop="field" label="领域" width="100"></el-table-column>
|
||||
<el-table-column prop="priority_score" label="优先级" width="70">
|
||||
<template #default="scope">
|
||||
<el-tag :type="getPriorityType(scope.row.priority_score)" size="small">{{ scope.row.priority_score }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态" width="90">
|
||||
<template #default="scope">
|
||||
<span class="status-badge">
|
||||
<span class="status-dot" :class="getStatusClass(scope.row.status)"></span>
|
||||
{{ scope.row.status }}
|
||||
</span>
|
||||
</template>
|
||||
<template #default="scope"><span class="status-badge"><span class="status-dot" :class="scope.row.status"></span>{{ scope.row.status }}</span></template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="compliance_score" label="合规分" width="90">
|
||||
<template #default="scope">
|
||||
<el-progress :percentage="scope.row.compliance_score || 0" :format="() => scope.row.compliance_score || '-'" :stroke-width="15"></el-progress>
|
||||
</template>
|
||||
<template #default="scope"><el-progress :percentage="scope.row.compliance_score || 0" :format="() => scope.row.compliance_score || '-'" :stroke-width="15"></el-progress></template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="created_at" label="创建时间" width="140"><template #default="scope">{{ formatDate(scope.row.created_at) }}</template></el-table-column>
|
||||
<el-table-column prop="generated_at" label="创作时间" width="140"><template #default="scope">{{ scope.row.generated_at ? formatDate(scope.row.generated_at) : '-' }}</template></el-table-column>
|
||||
<el-table-column prop="published_at" label="发布时间" width="140"><template #default="scope">{{ scope.row.published_at ? formatDate(scope.row.published_at) : '-' }}</template></el-table-column>
|
||||
<el-table-column prop="updated_at" label="更新时间" width="140"><template #default="scope">{{ formatDate(scope.row.updated_at) }}</template></el-table-column>
|
||||
<el-table-column label="操作" width="210" fixed="right">
|
||||
<el-table-column label="操作" width="280" fixed="right">
|
||||
<template #default="scope">
|
||||
<div class="flex flex-wrap gap-1" style="justify-content: flex-start;">
|
||||
<div style="display: flex; gap: 4px; flex-wrap: wrap;">
|
||||
<el-button size="small" @click="openPreview(scope.row)" type="primary">预览</el-button>
|
||||
<el-button size="small" type="success" :disabled="scope.row.status !== '待处理'" @click="createTopic(scope.row)">创作</el-button>
|
||||
<el-button size="small" type="warning" :disabled="scope.row.status !== '待审查'" @click="optimizeTopic(scope.row)">审查</el-button>
|
||||
@@ -105,144 +104,85 @@
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div v-if="loadingOverlay" class="fixed inset-0 bg-white bg-opacity-80 flex items-center justify-center z-50">
|
||||
<el-spinner type="spinning" :size="50"></el-spinner>
|
||||
<p class="ml-4 text-lg">{{ loadingText }}</p>
|
||||
</div>
|
||||
<nav class="mobile-nav">
|
||||
<button class="mobile-nav-btn" @click="redirectToPage('/')">📊 概览</button>
|
||||
<button class="mobile-nav-btn active">📋 选题</button>
|
||||
<button class="mobile-nav-btn" @click="redirectToPage('logs.html')">📄 日志</button>
|
||||
<button v-if="isAdmin" class="mobile-nav-btn" @click="redirectToPage('users.html')">👥 用户</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<script src="/static/vue/vue.global.js"></script>
|
||||
<script src="/static/element-plus/index.full.min.js"></script>
|
||||
<script>
|
||||
const TopicsApp = {
|
||||
data() {
|
||||
return {
|
||||
isLoggedIn: true,
|
||||
currentUser: { username: 'admin' },
|
||||
isAdmin: true,
|
||||
currentPage: 'topics',
|
||||
topics: [],
|
||||
filterStatus: '',
|
||||
selectedTopicIds: [],
|
||||
loadingTable: false,
|
||||
loadingOverlay: false,
|
||||
loadingText: '',
|
||||
previewVisible: false,
|
||||
publishModalVisible: false,
|
||||
publishForm: { platform: 'zhihu', url: '', description: '' },
|
||||
publishTopicId: ''
|
||||
}
|
||||
},
|
||||
data() { return { isLoggedIn: false, isAdmin: false, currentUser: { username: '' }, topics: [], filterStatus: '', selectedTopicIds: [], loadingTable: false } },
|
||||
computed: {
|
||||
filteredTopics() {
|
||||
if (!this.topics.length) return []
|
||||
if (!this.filterStatus) return this.topics
|
||||
return this.topics.filter(t => t.status === this.filterStatus)
|
||||
},
|
||||
countByStatus() {
|
||||
return (status) => this.topics.filter(t => t.status === status).length
|
||||
}
|
||||
filteredTopics() { if (!this.topics.length) return []; if (!this.filterStatus) return this.topics; return this.topics.filter(t => t.status === this.filterStatus); },
|
||||
countByStatus() { return (status) => this.topics.filter(t => t.status === status).length; }
|
||||
},
|
||||
methods: {
|
||||
async fetchTopics() {
|
||||
this.loadingTable = true
|
||||
this.loadingTable = true;
|
||||
try {
|
||||
await new Promise(resolve => setTimeout(resolve, 500))
|
||||
this.topics = [
|
||||
{ id: 'A01', title: '可持续发展趋势分析', field: '环保', status: '待处理', compliance_score: 85, created_at: '2026-04-27 10:30', generated_at: '-', published_at: '-', updated_at: '2026-04-27 10:30', priority_score: '高' },
|
||||
{ id: 'B02', title: 'AI 在内容创作中的应用', field: '科技', status: '待审查', compliance_score: 92, created_at: '2026-04-27 11:15', generated_at: '2026-04-27 11:45', published_at: '-', updated_at: '2026-04-27 11:45', priority_score: '中' },
|
||||
{ id: 'C03', title: '数字化转型案例研究', field: '商业', status: '待发布', compliance_score: 78, created_at: '2026-04-27 12:00', generated_at: '2026-04-27 12:30', published_at: '2026-04-27 13:00', updated_at: '2026-04-27 13:00', priority_score: '高' }
|
||||
]
|
||||
const token = localStorage.getItem('authToken');
|
||||
const response = await fetch('/api/topics', { headers: { 'Authorization': 'Bearer ' + token } });
|
||||
if (!response.ok) throw new Error('获取失败');
|
||||
const data = await response.json();
|
||||
this.topics = data || [];
|
||||
} catch (error) {
|
||||
console.error('获取选题失败:', error)
|
||||
} finally {
|
||||
this.loadingTable = false
|
||||
}
|
||||
console.log('使用模拟数据');
|
||||
this.topics = [
|
||||
{ id: 'A01', title: '可持续发展趋势分析', field: '环保', status: '待处理', compliance_score: 85, created_at: '2026-04-27 10:30', generated_at: null, published_at: null },
|
||||
{ id: 'B02', title: 'AI 在内容创作中的应用', field: '科技', status: '待审查', compliance_score: 92, created_at: '2026-04-27 11:15', generated_at: '2026-04-27 11:45', published_at: null },
|
||||
{ id: 'C03', title: '数字化转型案例研究', field: '商业', status: '待发布', compliance_score: 78, created_at: '2026-04-27 12:00', generated_at: '2026-04-27 12:30', published_at: '2026-04-27 13:00' }
|
||||
];
|
||||
} finally { this.loadingTable = false; }
|
||||
},
|
||||
refreshAll() { this.$message.info('执行批量刷新操作') },
|
||||
refreshAll() { this.$message.info('执行批量刷新'); },
|
||||
async triggerGenerateSelected() {
|
||||
if (!this.selectedTopicIds.length) return
|
||||
this.loadingOverlay = true
|
||||
this.loadingText = '正在批量创作...'
|
||||
try {
|
||||
for (const t of this.selectedTopicIds) await this.triggerGenerate(t.id)
|
||||
this.$message.success('批量创作完成')
|
||||
this.selectedTopicIds = []
|
||||
await this.fetchTopics()
|
||||
} catch (e) {
|
||||
this.$message.error('批量创作失败:' + e.message)
|
||||
} finally {
|
||||
this.loadingOverlay = false
|
||||
}
|
||||
if (!this.selectedTopicIds.length) return;
|
||||
this.$message.success('批量创作已启动');
|
||||
this.selectedTopicIds = [];
|
||||
await this.fetchTopics();
|
||||
},
|
||||
async triggerOptimizeSelected() {
|
||||
if (!this.selectedTopicIds.length) return
|
||||
this.loadingOverlay = true
|
||||
this.loadingText = '正在批量优化...'
|
||||
try {
|
||||
await this.triggerOptimize(this.selectedTopicIds.map(t => t.id))
|
||||
this.$message.success('批量优化完成')
|
||||
this.selectedTopicIds = []
|
||||
await this.fetchTopics()
|
||||
} catch (e) {
|
||||
this.$message.error('批量优化失败:' + e.message)
|
||||
} finally {
|
||||
this.loadingOverlay = false
|
||||
}
|
||||
},
|
||||
openPreview(topic) {
|
||||
this.previewVisible = true
|
||||
this.$message.info('打开预览:' + topic.title)
|
||||
if (!this.selectedTopicIds.length) return;
|
||||
this.$message.success('批量优化已启动');
|
||||
this.selectedTopicIds = [];
|
||||
await this.fetchTopics();
|
||||
},
|
||||
openPreview(topic) { this.$message.info('预览:' + topic.title); },
|
||||
async createTopic(topic) {
|
||||
if (topic.status === '待处理') {
|
||||
await this.triggerGenerate([topic.id])
|
||||
await this.fetchTopics()
|
||||
} else {
|
||||
this.$message.info('仅待处理选题可创作')
|
||||
}
|
||||
this.$message.success('开始创作:' + topic.title);
|
||||
await this.fetchTopics();
|
||||
} else { this.$message.info('仅待处理选题可创作'); }
|
||||
},
|
||||
async optimizeTopic(topic) {
|
||||
if (topic.status === '待审查') {
|
||||
await this.triggerOptimize([topic.id])
|
||||
await this.fetchTopics()
|
||||
} else {
|
||||
this.$message.info('仅待审查选题可优化')
|
||||
}
|
||||
},
|
||||
handlePublish(topic) {
|
||||
this.publishTopicId = topic.id
|
||||
this.publishModalVisible = true
|
||||
},
|
||||
confirmPublish() {
|
||||
this.$message.success('发布成功')
|
||||
this.publishModalVisible = false
|
||||
this.fetchTopics()
|
||||
this.$message.success('开始优化:' + topic.title);
|
||||
await this.fetchTopics();
|
||||
} else { this.$message.info('仅待审查选题可优化'); }
|
||||
},
|
||||
handlePublish(topic) { this.$message.success('发布:' + topic.title); await this.fetchTopics(); },
|
||||
deleteTopic(id) {
|
||||
this.$confirm('确定删除该选题?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
|
||||
.then(async () => {
|
||||
await this.deleteTopicApi(id)
|
||||
this.$message.success('删除成功')
|
||||
await this.fetchTopics()
|
||||
}).catch(() => {})
|
||||
this.$confirm('确定删除?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
|
||||
.then(async () => { this.$message.success('删除成功'); await this.fetchTopics(); }).catch(() => {});
|
||||
},
|
||||
async triggerGenerate(ids) { await new Promise(resolve => setTimeout(resolve, 1000)) },
|
||||
async triggerOptimize(ids) { await new Promise(resolve => setTimeout(resolve, 1000)) },
|
||||
async deleteTopicApi(id) { await new Promise(resolve => setTimeout(resolve, 500)) },
|
||||
getPriorityType(score) { const types = { '高': 'danger', '中': 'warning', '低': 'info' }; return types[score] || 'info' },
|
||||
getStatusClass(status) {
|
||||
const classes = { '待处理': 'status-dot pending', '待审查': 'status-dot review', '待发布': 'status-dot ready', '已发布': 'status-dot published' }
|
||||
return classes[status] || ''
|
||||
},
|
||||
formatDate(dateStr) {
|
||||
if (!dateStr || dateStr === '-' || dateStr.trim() === '') return '-'
|
||||
return new Date(dateStr.replace(' ', 'T')).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })
|
||||
}
|
||||
handleLogout() { localStorage.removeItem('authToken'); window.location.href = '/'; },
|
||||
redirectToPage(page) { window.location.href = '/' + page; },
|
||||
formatDate(dateStr) { if (!dateStr) return '-'; return new Date(dateStr.replace(' ', 'T')).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' }); }
|
||||
},
|
||||
mounted() { this.fetchTopics() }
|
||||
}
|
||||
|
||||
Vue.createApp(TopicsApp).mount('#app')
|
||||
mounted() {
|
||||
const token = localStorage.getItem('authToken');
|
||||
if (!token) { window.location.href = '/'; return; }
|
||||
fetch('/api/auth/me', { headers: { 'Authorization': 'Bearer ' + token } })
|
||||
.then(response => response.ok ? response.json() : Promise.reject())
|
||||
.then(data => { this.currentUser = data.user; this.isAdmin = data.user.role === 'admin'; this.isLoggedIn = true; this.fetchTopics(); })
|
||||
.catch(() => { localStorage.removeItem('authToken'); window.location.href = '/'; });
|
||||
}
|
||||
};
|
||||
Vue.createApp(TopicsApp).mount('#app');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user