ai-question-pro 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,12 @@
1
1
  <template>
2
2
  <div class="ai_question_contain">
3
+ <div class="question_header">
4
+ <div class="question_header_left">
5
+ <el-checkbox v-model="isSelected" :disabled="isJoined || joined" @change="handleSelectionChange"></el-checkbox>
6
+ <span class="type-name" :class="getTypeClass(detail.type)">{{ getQuestionTypeName(detail.type) }}</span>
7
+ </div>
8
+ <span v-if="!joined && !isJoined" class="join" @click="join">+ 加入题库</span>
9
+ </div>
3
10
  <div class="question_contain_title">
4
11
  <span class="question_contain_title_left">
5
12
  <span>{{ index + 1 }}.</span>
@@ -21,13 +28,14 @@
21
28
  <span>{{ item }}</span>
22
29
  </div>
23
30
  </div>
24
- <div class="question_contain_answer">参考答案:
31
+ <div class="question_answer_info">
32
+ <div class="question_contain_answer">参考答案:
25
33
  <span v-html="detail.answer"></span>
26
- </div>
27
- <div class="question_contain_parse">
28
- <span class="question_contain_parse_analysis">题目解析: {{ detail.analysis }}</span>
29
- <span v-if="!joined" class="join" @click="join">加入题库</span>
30
- </div>
34
+ </div>
35
+ <div class="question_contain_parse">
36
+ <span class="question_contain_parse_analysis"><span style="font-weight: bold">题目解析:</span> {{ detail.analysis }}</span>
37
+ </div>
38
+ </div>
31
39
  </div>
32
40
  </template>
33
41
  <script>
@@ -40,6 +48,10 @@ export default {
40
48
  },
41
49
  index: {
42
50
  type: Number
51
+ },
52
+ isJoined: {
53
+ type: Boolean,
54
+ default: false
43
55
  }
44
56
  },
45
57
  data() {
@@ -62,46 +74,103 @@ export default {
62
74
  { name: 'H', id: 7 },
63
75
  { name: 'I', id: 8 },
64
76
  ],
65
- joined: false
77
+ joined: false,
78
+ isSelected: false
66
79
  }
67
80
  },
68
81
  methods: {
69
82
  agree(e) {
70
83
  this.$emit('agree', this.index, e)
71
84
  },
72
- join(e) {
85
+ join() {
73
86
  this.$emit('join', this.detail)
74
87
  this.joined = true;
88
+ // 当加入题库后,自动取消选中状态
89
+ if (this.isSelected) {
90
+ this.isSelected = false;
91
+ this.handleSelectionChange(false);
92
+ }
93
+ },
94
+ // 获取题目类型中文名称
95
+ getQuestionTypeName(type) {
96
+ const typeMap = {
97
+ single: '单选题',
98
+ multiple: '多选题',
99
+ gapfilling: '填空题',
100
+ judge: '判断题',
101
+ shortanswer: '简答题'
102
+ };
103
+ return typeMap[type] || type;
104
+ },
105
+ // 获取题目类型样式类
106
+ getTypeClass(type) {
107
+ const classMap = {
108
+ single: 'type-single',
109
+ multiple: 'type-multiple',
110
+ gapfilling: 'type-gapfilling',
111
+ judge: 'type-judge',
112
+ shortanswer: 'type-shortanswer'
113
+ };
114
+ return classMap[type] || '';
115
+ },
116
+ // 处理选择变化
117
+ handleSelectionChange(value) {
118
+ this.$emit('selectionChange', {
119
+ index: this.index,
120
+ selected: value,
121
+ detail: this.detail
122
+ });
123
+ },
124
+ // 清空选中状态 - 供父组件调用
125
+ clearSelection() {
126
+ this.isSelected = false;
75
127
  }
76
128
  }
77
129
  }
78
130
  </script>
79
131
  <style lang="scss" scoped>
80
132
  .ai_question_contain {
81
- margin-bottom: 10px;
82
- padding: 10px;
83
- border-radius: 8px;
133
+ margin-bottom: 20px;
134
+ padding: 20px;
84
135
  background: rgba(255, 255, 255, .6);
136
+ border: 1px solid #DADCE0;
137
+ border-radius: 24px;
138
+ font-family: "Microsoft YaHei", 微软雅黑, sans-serif;
85
139
 
86
- .question_contain_title {
140
+ .question_header {
141
+ display: flex;
142
+ justify-content: space-between;
143
+ align-items: center;
87
144
  margin-bottom: 16px;
145
+
146
+ .question_header_left {
147
+ display: flex;
148
+ align-items: center;
149
+ gap: 12px;
150
+ }
151
+ }
152
+
153
+ .question_contain_title {
154
+ margin-bottom: 15px;
88
155
  display: flex;
89
156
  justify-content: space-between;
90
157
 
91
158
  .question_contain_title_left {
92
159
  color: #333333;
93
- font-weight: 600;
94
- font-size: 14px;
95
- width: 80%;
160
+ font-weight: bold;
161
+ font-size: 16px;
162
+ width: 100%;
163
+ line-height: 28px;
96
164
 
97
165
  .difficult {
98
166
  margin: 0 6px;
99
- font-weight: 400;
100
- padding: 2px 4px;
101
- color: #fff;
102
- background: #3E7BFA;
103
- font-size: 10px;
104
- border-radius: 2px;
167
+ font-weight: bold;
168
+ padding: 5px 7px;
169
+ color: #333333;
170
+ font-size: 12px;
171
+ border-radius: 24px;
172
+ border: 1px solid #2828E07A;
173
+ background: transparent;
105
174
  }
106
175
  }
107
176
 
@@ -118,14 +187,25 @@ export default {
118
187
 
119
188
  .question_contain_question {
120
189
  margin-bottom: 16px;
190
+ font-size: 14px;
191
+ padding-left: 5px;
121
192
 
122
193
  div {
123
194
  margin: 5px 0;
124
195
  }
125
196
  }
126
197
 
198
+ .question_answer_info {
199
+ border-radius: 15px;
200
+ padding: 20px;
201
+ background-color: rgba(64, 48, 240, 0.08);
202
+ }
203
+
127
204
  .question_contain_answer {
128
205
  margin-bottom: 16px;
206
+ font-size: 13px;
207
+ color: #6040E0;
208
+ font-weight: bold;
129
209
  }
130
210
 
131
211
  .question_contain_parse {
@@ -134,15 +214,79 @@ export default {
134
214
  justify-content: space-between;
135
215
 
136
216
  .question_contain_parse_analysis {
137
- width: 80%;
217
+ width: 100%;
218
+ font-size: 13px;
219
+ color: #262626;
138
220
  }
221
+ }
222
+ .type-name {
223
+ font-size: 14px;
224
+ font-weight: bold;
225
+ border-radius: 54px;
226
+ color: #fff;
227
+ height: 40px;
228
+ width: 72px;
229
+ display: flex;
230
+ align-items: center;
231
+ justify-content: center;
139
232
 
140
- .join {
141
- align-self: self-end;
142
- user-select: none;
143
- cursor: pointer;
144
- color: #3E7BFA;
145
- }
233
+ &.type-single {
234
+ background: #8060F029;
235
+ color: #6040F0;
236
+ }
237
+
238
+ &.type-multiple {
239
+ background: #0090F029;
240
+ color: #0090FF;
241
+ }
242
+
243
+ &.type-gapfilling {
244
+ background: #60C09029;
245
+ color: #60C090;
246
+ }
247
+
248
+ &.type-judge {
249
+ background: #F0A00029;
250
+ color: #F0A000;
251
+ }
252
+
253
+ &.type-shortanswer {
254
+ background: #E060C029;
255
+ color: #E060C0;
256
+ }
257
+ }
258
+
259
+ .join {
260
+ align-self: self-end;
261
+ user-select: none;
262
+ cursor: pointer;
263
+ font-weight: bold;
264
+ color: #6040E0;
265
+ font-size: 14px;
266
+ line-height: 32px;
267
+ }
268
+
269
+ .ai_warning_tip {
270
+ margin-top: 16px;
271
+ padding: 12px 16px;
272
+ background: rgba(124, 77, 255, 0.05);
273
+ border: 1px solid rgba(124, 77, 255, 0.15);
274
+ border-radius: 12px;
275
+ display: flex;
276
+ align-items: center;
277
+ gap: 8px;
278
+
279
+ .el-icon-info {
280
+ color: #7C4DFF;
281
+ font-size: 14px;
282
+ flex-shrink: 0;
283
+ }
284
+
285
+ span {
286
+ font-size: 12px;
287
+ color: #666;
288
+ line-height: 1.4;
146
289
  }
290
+ }
147
291
  }
148
292
  </style>