Ver código fonte

change question type

tags/v1.0.0^2
zhangtao 2 anos atrás
pai
commit
bf8f886b82
1 arquivos alterados com 13 adições e 5 exclusões
  1. +13
    -5
      src/utils/dictionary.js

+ 13
- 5
src/utils/dictionary.js Ver arquivo

@@ -1,6 +1,6 @@
import { getQuestionType } from '@/api/task/index.js'
import { dataToSelect } from '@/utils/handleData.js'
import { setQuestion } from './question.js'
import { setQuestion, getQuestion } from './question.js'
import { ref } from 'vue'

export const QUESTION_TYPE = ref([])
@@ -55,11 +55,19 @@ export const MENU_STATUS = [
]

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

Carregando…
Cancelar
Salvar