|
|
|
|
|
|
|
|
import { getQuestionType } from '@/api/task/index.js' |
|
|
import { getQuestionType } from '@/api/task/index.js' |
|
|
import { dataToSelect } from '@/utils/handleData.js' |
|
|
import { dataToSelect } from '@/utils/handleData.js' |
|
|
import { setQuestion } from './question.js' |
|
|
|
|
|
|
|
|
import { setQuestion, getQuestion } from './question.js' |
|
|
import { ref } from 'vue' |
|
|
import { ref } from 'vue' |
|
|
|
|
|
|
|
|
export const QUESTION_TYPE = ref([]) |
|
|
export const QUESTION_TYPE = ref([]) |
|
|
|
|
|
|
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
export const getQuestionList = async function() { |
|
|
export const getQuestionList = async function() { |
|
|
const res = await getQuestionType() |
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
const data = dataToSelect(res.data, { label: 'content', value: 'code' }) |
|
|
|
|
|
setQuestion(data) |
|
|
|
|
|
|
|
|
if (getQuestion()) { |
|
|
|
|
|
const data = getQuestion() |
|
|
QUESTION_TYPE.value = data |
|
|
QUESTION_TYPE.value = data |
|
|
QUESTION_TYPE_ALL.value = [{ label: '全部', value: 'all' }].concat(data) |
|
|
QUESTION_TYPE_ALL.value = [{ label: '全部', value: 'all' }].concat(data) |
|
|
|
|
|
} else { |
|
|
|
|
|
const res = await getQuestionType() |
|
|
|
|
|
if (res.code === 0) { |
|
|
|
|
|
const data = dataToSelect(res.data, { label: 'content', value: 'code' }) |
|
|
|
|
|
setQuestion(data) |
|
|
|
|
|
QUESTION_TYPE.value = data |
|
|
|
|
|
QUESTION_TYPE_ALL.value = [{ label: '全部', value: 'all' }].concat(data) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getQuestionList() |