2023-03-15 14:20:18 +07:00
|
|
|
import { ref, computed } from 'vue'
|
|
|
|
|
import { defineStore } from 'pinia'
|
|
|
|
|
|
|
|
|
|
export const useExamDataStore = defineStore('exam', () => {
|
|
|
|
|
interface exam {
|
|
|
|
|
main: { columns: String[] }
|
2023-03-16 00:35:08 +07:00
|
|
|
education: { columns: String[] }
|
2023-03-16 13:52:21 +07:00
|
|
|
career: { columns: String[] }
|
2023-03-15 14:20:18 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const examData = ref<exam>({
|
2023-03-16 00:35:08 +07:00
|
|
|
main: { columns: [] },
|
2023-03-16 13:52:21 +07:00
|
|
|
education: { columns: [] },
|
|
|
|
|
career: { columns: [] }
|
2023-03-15 14:20:18 +07:00
|
|
|
})
|
|
|
|
|
|
2023-03-22 00:25:55 +07:00
|
|
|
const consend = ref<boolean>(false)
|
2023-04-06 22:52:53 +07:00
|
|
|
const status = ref<string>('')
|
2023-03-22 00:25:55 +07:00
|
|
|
|
2023-03-15 14:20:18 +07:00
|
|
|
const changeExamColumns = (system: String, val: String[]) => {
|
|
|
|
|
if (system == 'main') examData.value.main.columns = val
|
2023-03-16 00:35:08 +07:00
|
|
|
if (system == 'education') examData.value.education.columns = val
|
2023-03-16 13:52:21 +07:00
|
|
|
if (system == 'career') examData.value.career.columns = val
|
2023-03-15 14:20:18 +07:00
|
|
|
localStorage.setItem('exam', JSON.stringify(examData.value))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (localStorage.getItem('exam') !== null) {
|
|
|
|
|
examData.value = JSON.parse(localStorage.getItem('exam') || '{}')
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-06 22:52:53 +07:00
|
|
|
const changeStatus = (val: string) => {
|
|
|
|
|
status.value = val
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-15 14:20:18 +07:00
|
|
|
return {
|
|
|
|
|
examData,
|
2023-03-22 00:25:55 +07:00
|
|
|
changeExamColumns,
|
2023-04-06 22:52:53 +07:00
|
|
|
consend,
|
|
|
|
|
status,
|
|
|
|
|
changeStatus
|
2023-03-15 14:20:18 +07:00
|
|
|
}
|
|
|
|
|
})
|