提交 8fb4b40f authored 作者: lihuihui's avatar lihuihui

修改接口项目传参

上级 4b45049b
...@@ -58,9 +58,9 @@ export function questionDetail(id) { ...@@ -58,9 +58,9 @@ export function questionDetail(id) {
/** /**
* 导入题 * 导入题
*/ */
export function importQuestion(data) { export function importQuestion(tag, data) {
return httpRequest({ return httpRequest({
url: '/api/qbs/admin/v1/question/import/x1', url: `/api/qbs/admin/v1/question/import/${tag}`,
method: 'post', method: 'post',
headers: { 'Content-Type': 'multipart/form-data' }, headers: { 'Content-Type': 'multipart/form-data' },
timeout: 900000, timeout: 900000,
......
...@@ -100,7 +100,7 @@ export default { ...@@ -100,7 +100,7 @@ export default {
pointOptions: [], pointOptions: [],
ruleForm: { ruleForm: {
permission: '1', permission: '1',
project_prefix: 'x1', project_prefix: '',
question_type: 1, question_type: 1,
question_difficulty: '', question_difficulty: '',
question_title: '', question_title: '',
......
...@@ -48,6 +48,11 @@ export default { ...@@ -48,6 +48,11 @@ export default {
fileList: [] fileList: []
} }
}, },
computed: {
activeProject() {
return this.$store.state.activeProject || {}
}
},
methods: { methods: {
beforeUpload(file) { beforeUpload(file) {
const suffix = splitStrLast(file.name, '.') const suffix = splitStrLast(file.name, '.')
...@@ -59,7 +64,7 @@ export default { ...@@ -59,7 +64,7 @@ export default {
} }
}, },
fetchFileUpload(data) { fetchFileUpload(data) {
importQuestion({ file: data.file, exam_id: this.id }).then(res => { importQuestion(this.activeProject.tag, { file: data.file, exam_id: this.id }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$message.success('导入数据成功') this.$message.success('导入数据成功')
history.go(0) history.go(0)
......
...@@ -39,13 +39,18 @@ export default { ...@@ -39,13 +39,18 @@ export default {
} }
} }
}, },
computed: {
activeProject() {
return this.$store.state.activeProject || {}
}
},
mounted() { mounted() {
this.getTreeList() this.getTreeList()
}, },
methods: { methods: {
// 获取tree列表 // 获取tree列表
getTreeList() { getTreeList() {
getQuestionCategory('x1').then(res => { getQuestionCategory(this.activeProject.tag).then(res => {
if (Array.isArray(res.data)) { if (Array.isArray(res.data)) {
this.initTree(res.data) this.initTree(res.data)
} }
...@@ -54,7 +59,6 @@ export default { ...@@ -54,7 +59,6 @@ export default {
// 发送请求添加 || 编辑tree // 发送请求添加 || 编辑tree
addTree() { addTree() {
const data = { const data = {
project_prefix: 'x1',
pid: this.treeParams.id || 0, pid: this.treeParams.id || 0,
category_name: this.treeParams.name || 'node' category_name: this.treeParams.name || 'node'
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论