Browse Source

change question type

tags/v1.0.0^2
zhangtao 2 years ago
parent
commit
bf8f886b82
1 changed files with 13 additions and 5 deletions
  1. +13
    -5
      src/utils/dictionary.js

+ 13
- 5
src/utils/dictionary.js View File

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()

Loading…
Cancel
Save