会话历史
diff --git a/src/router/index.js b/src/router/index.js
index 4715ac5..8666baf 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -37,6 +37,11 @@ const routes = [
name: 'AnswerRecord',
component: () => import('../views/AnswerRecord.vue'),
},
+ {
+ path: 'question-category',
+ name: 'QuestionCategory',
+ component: () => import('@/views/question-category/index.vue'),
+ },
],
},
];
diff --git a/src/utils/date.js b/src/utils/date.js
new file mode 100644
index 0000000..d0b0f0a
--- /dev/null
+++ b/src/utils/date.js
@@ -0,0 +1,13 @@
+export const formatDate = (dateString) => {
+ if (!dateString) return '-'
+
+ const date = new Date(dateString)
+ return date.toLocaleString('zh-CN', {
+ year: 'numeric',
+ month: '2-digit',
+ day: '2-digit',
+ hour: '2-digit',
+ minute: '2-digit',
+ second: '2-digit'
+ })
+}
\ No newline at end of file
diff --git a/src/views/question-category/components/CategoryForm.vue b/src/views/question-category/components/CategoryForm.vue
new file mode 100644
index 0000000..e5e427a
--- /dev/null
+++ b/src/views/question-category/components/CategoryForm.vue
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+ 提交
+ 取消
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/question-category/components/CategoryTable.vue b/src/views/question-category/components/CategoryTable.vue
new file mode 100644
index 0000000..f2c1f6f
--- /dev/null
+++ b/src/views/question-category/components/CategoryTable.vue
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+ {{ row.name }}
+
+
+
+
+
+
+
+
+ L{{ row.level }}
+
+
+
+
+
+
+
+
+ {{ row.state === 1 ? '启用' : '禁用' }}
+
+
+
+
+
+
+ {{ formatDate(row.created_time) }}
+
+
+
+
+
+ {{ formatDate(row.updated_time) }}
+
+
+
+
+
+ 添加子类
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/question-category/components/Create.vue b/src/views/question-category/components/Create.vue
new file mode 100644
index 0000000..e49d054
--- /dev/null
+++ b/src/views/question-category/components/Create.vue
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/question-category/components/Edit.vue b/src/views/question-category/components/Edit.vue
new file mode 100644
index 0000000..4edb76d
--- /dev/null
+++ b/src/views/question-category/components/Edit.vue
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/question-category/components/SearchBar.vue b/src/views/question-category/components/SearchBar.vue
new file mode 100644
index 0000000..64956d8
--- /dev/null
+++ b/src/views/question-category/components/SearchBar.vue
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/question-category/constants/constant.js b/src/views/question-category/constants/constant.js
new file mode 100644
index 0000000..ec61c74
--- /dev/null
+++ b/src/views/question-category/constants/constant.js
@@ -0,0 +1,29 @@
+// 分类状态
+export const CATEGORY_STATUS = {
+ DISABLED: 0,
+ ENABLED: 1
+}
+
+export const CATEGORY_STATUS_MAP = {
+ [CATEGORY_STATUS.DISABLED]: '禁用',
+ [CATEGORY_STATUS.ENABLED]: '启用'
+}
+
+export const CATEGORY_STATUS_OPTIONS = [
+ { label: '启用', value: CATEGORY_STATUS.ENABLED },
+ { label: '禁用', value: CATEGORY_STATUS.DISABLED }
+]
+
+// 表单验证规则
+export const FORM_RULES = {
+ name: [
+ { required: true, message: '请输入分类名称', trigger: 'blur' },
+ { min: 1, max: 32, message: '长度在 1 到 32 个字符', trigger: 'blur' }
+ ],
+ parent_id: [
+ { required: true, message: '请选择上级分类', trigger: 'change' }
+ ],
+ sort: [
+ { required: true, message: '请输入排序值', trigger: 'blur' }
+ ]
+}
\ No newline at end of file
diff --git a/src/views/question-category/index.vue b/src/views/question-category/index.vue
index f79cdd8..d0ee8c8 100644
--- a/src/views/question-category/index.vue
+++ b/src/views/question-category/index.vue
@@ -1,11 +1,159 @@
-
-
+
+
+
+
+
+
+ 新增分类
+ 刷新
+
+
+
+
+
-
\ No newline at end of file
diff --git a/vite.config.js b/vite.config.js
index 084ad9a..14c4010 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -1,9 +1,16 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
+import { fileURLToPath, URL } from 'node:url'
+
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
+ resolve: {
+ alias: {
+ '@': fileURLToPath(new URL('./src', import.meta.url))
+ }
+ },
server: {
host: '0.0.0.0',
proxy: {