浏览代码

change question type

tags/v1.0.0^2
zhangtao 2 年前
父节点
当前提交
bf8f886b82
共有 1 个文件被更改,包括 13 次插入5 次删除
  1. +13
    -5
      src/utils/dictionary.js

+ 13
- 5
src/utils/dictionary.js 查看文件

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

正在加载...
取消
保存