diff --git a/test_client/src/api/question.js b/test_client/src/api/question.js
index fc6631b..b728fcf 100644
--- a/test_client/src/api/question.js
+++ b/test_client/src/api/question.js
@@ -88,6 +88,13 @@ export function createQuestion(data) {
data
})
}
+export function getQuestion(id) {
+ return request({
+ url: `/question/question/${id}/`,
+ method: 'get',
+ })
+}
+
export function updateQuestion(id, data) {
return request({
url: `/question/question/${id}/`,
diff --git a/test_client/src/router/index.js b/test_client/src/router/index.js
index 16dc0af..b9cce84 100644
--- a/test_client/src/router/index.js
+++ b/test_client/src/router/index.js
@@ -115,6 +115,13 @@ export const asyncRoutes = [
component: () => import('@/views/question/questioncreate.vue'),
meta: { title: '新建题目', noCache: true, icon: '', perms: ['question_create']},
hidden: true
+ },
+ {
+ path: 'question/update',
+ name: 'UpdateQuestion',
+ component: () => import('@/views/question/questionupdate.vue'),
+ meta: { title: '编辑题目', noCache: true, icon: '', perms: ['question_update']},
+ hidden: true
}
]
},
diff --git a/test_client/src/views/question/question.vue b/test_client/src/views/question/question.vue
index 0bfa3f2..671f124 100644
--- a/test_client/src/views/question/question.vue
+++ b/test_client/src/views/question/question.vue
@@ -104,12 +104,19 @@
@click="handleDetail(scope)"
icon="el-icon-more"
>
+
@@ -264,6 +271,9 @@ export default {
this.dialogVisible = true
this.question = scope.row
},
+ handleEdit(scope) {
+ this.$router.push({path:"/Qmanage/question/update",query:{id:scope.row.id}})
+ },
handleDelete(scope) {
this.$confirm("确认删除该题目吗?将丢失数据!", "警告", {
confirmButtonText: "确认",
diff --git a/test_client/src/views/question/questioncreate.vue b/test_client/src/views/question/questioncreate.vue
index d2a0d0e..3d96ae8 100644
--- a/test_client/src/views/question/questioncreate.vue
+++ b/test_client/src/views/question/questioncreate.vue
@@ -10,6 +10,7 @@
+
+
+
-
+
-
-
+
+
@@ -40,6 +50,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
立即创建
重置
@@ -49,36 +88,31 @@
\ No newline at end of file
diff --git a/test_server/question/migrations/0011_auto_20200417_1135.py b/test_server/question/migrations/0011_auto_20200417_1135.py
new file mode 100644
index 0000000..1e708a8
--- /dev/null
+++ b/test_server/question/migrations/0011_auto_20200417_1135.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.0.4 on 2020-04-17 03:35
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('question', '0010_auto_20200402_2346'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='question',
+ name='resolution',
+ field=models.TextField(blank=True, verbose_name='解析'),
+ ),
+ ]
diff --git a/test_server/question/models.py b/test_server/question/models.py
index 1a942c6..e0d0f63 100644
--- a/test_server/question/models.py
+++ b/test_server/question/models.py
@@ -42,7 +42,7 @@ class Question(SoftCommonModel):
questioncat = models.ForeignKey(Questioncat, blank=True, null=True, on_delete=models.SET_NULL, verbose_name='所属题库', related_name='questioncat')
options = JSONField(verbose_name='选项')
right = JSONField(verbose_name='正确答案')
- resolution = models.TextField(verbose_name='解析')
+ resolution = models.TextField(verbose_name='解析', blank=True)
class Meta:
verbose_name = '题目'