97 lines
2.9 KiB
TypeScript
97 lines
2.9 KiB
TypeScript
import { defineStore } from 'pinia'
|
|
import type { ILibraryFile, ITreeNode } from '@/types/library.ts'
|
|
|
|
export const useLibraryStore = defineStore('library', {
|
|
state: () => ({
|
|
selectedSubject: 1,
|
|
selectedModule: 101,
|
|
subjectTree: [
|
|
{
|
|
id: 1,
|
|
name: '中医学',
|
|
children: [
|
|
{ id: 101, name: '中医基础理论' },
|
|
{ id: 102, name: '中医诊断学' },
|
|
{ id: 103, name: '中药学' },
|
|
{ id: 104, name: '方剂学' },
|
|
{ id: 105, name: '中医内科学' },
|
|
{ id: 106, name: '中医外科学' },
|
|
{ id: 107, name: '中医妇科学' },
|
|
{ id: 108, name: '中医儿科学' },
|
|
{ id: 109, name: '针灸学' },
|
|
{ id: 110, name: '推拿学' },
|
|
{ id: 111, name: '中医骨伤科学' },
|
|
{ id: 112, name: '黄帝内经' },
|
|
{ id: 113, name: '伤寒论' },
|
|
{ id: 114, name: '金匮要略' },
|
|
{ id: 115, name: '温病学' },
|
|
{ id: 116, name: '中医养生学' }
|
|
]
|
|
},
|
|
{
|
|
id: 2,
|
|
name: '公务员',
|
|
children: [
|
|
{ id: 201, name: '言语理解与表达' },
|
|
{ id: 202, name: '数量关系' },
|
|
{ id: 203, name: '判断推理' },
|
|
{ id: 204, name: '资料分析' },
|
|
{ id: 205, name: '常识判断' },
|
|
{ id: 206, name: '申论写作' },
|
|
{ id: 207, name: '公文写作' },
|
|
{ id: 208, name: '公共基础知识' },
|
|
{ id: 209, name: '面试技巧' },
|
|
{ id: 210, name: '时政热点' },
|
|
{ id: 211, name: '法律基础' }
|
|
]
|
|
}
|
|
] as ITreeNode[],
|
|
fileList: [] as ILibraryFile[],
|
|
currentFile: {} as ILibraryFile,
|
|
fileDetailDialogVisible: false,
|
|
fileDialogVisible: false
|
|
}),
|
|
actions: {
|
|
queryFileList() {
|
|
this.fileList = [
|
|
{
|
|
id: 1,
|
|
subject: '中医学',
|
|
module: '中医基础理疗',
|
|
name: '向量代数.pdf',
|
|
size: '2.4 MB',
|
|
time: '2分钟前',
|
|
type: 'pdf',
|
|
iconClass: 'icon-pdf',
|
|
questions: [
|
|
{ type: '选择题', stem: '设 a=(1,2,3), b=(2,-1,1),求 a·b = ?', options: ['A. 3', 'B. 5', 'C. 7', 'D. 9'], answer: 'A' },
|
|
{ type: '计算题', stem: '求过点 P(1,0,2) 且法向量为 n=(2,1,-1) 的平面方程', answer: '2x + y - z = 0' }
|
|
]
|
|
},
|
|
{
|
|
id: 2,
|
|
subject: '中医学',
|
|
module: '中医基础理疗',
|
|
name: '向量代数精讲.png',
|
|
size: '156 MB',
|
|
time: '3小时前',
|
|
type: 'image',
|
|
iconClass: 'icon-image'
|
|
}
|
|
]
|
|
},
|
|
getEmptyFile(): ILibraryFile {
|
|
return {
|
|
iconClass: '',
|
|
id: 0,
|
|
module: '',
|
|
name: '',
|
|
size: '',
|
|
subject: '',
|
|
time: '',
|
|
type: ''
|
|
}
|
|
}
|
|
}
|
|
})
|