1234567891011121314151617181920212223242526272829303132333435 |
- import { defineStore } from 'pinia'
- import { ref } from 'vue'
- import { getSubjectList, getFormList, getContentList } from '@/api/common'
- export const useCommonStore = defineStore('useCommonStore', () => {
- const subjectList = ref([{ name: '全部', id: '', title: '培训科目' }])
- const formList = ref([{ name: '全部', id: '', title: '培训形式' }])
- const contentList = ref([])
- const _getSubjectList = async () => {
- if (subjectList.value.length === 1) {
- const { data } = await getSubjectList()
- subjectList.value.push(...data)
- }
- }
- const _getFormList = async () => {
- if (formList.value.length === 1) {
- const { data } = await getFormList()
- formList.value.push(...data)
- }
- }
- const _getContentList = async () => {
- const { data } = await getContentList()
- contentList.value.push(...data)
- }
- return {
- subjectList,
- formList,
- contentList,
- getSubjectList: _getSubjectList,
- getFormList: _getFormList,
- getContentList: _getContentList
- }
- })
|