# 前端二次開發說明
## 組件說明
前端組件統一放在`components`文件夾中。
### 答題組件
答題組件文件位于`components/kz-question/kz-question.vue`,組件已完成以下模式:
* 考試模式
* 練習模式
* 看題模式
模式功能區別:
| 模式功能 | 考試模式 | 練習模式 | 看題模式 |
| --- | :-: | :-: | :-: |
| 倒計時、自動交卷 | ?? | × | × |
| 試題收藏、取消收藏 | ?? | ?? | ?? |
| 錯題刪除 | × | × | ?? |
| 選題后顯示是否正確、顯示題目解析 | × | ?? | ?? |
#### 常用組件參數
| 組件參數 | 說明 |
| --- | --- |
| mode | 模式,可傳參數:
EXAM:考試模式
TRAINING:練習模式
VIEW:看題模式 |
| title | 試卷標題 |
| questions | 試題集合 |
| limit\_time | 考試時間(倒計時/秒) |
| configs | 考試配置(配置判斷題/單選題/多選題的每題分數) |
| canCollect | 是否顯示收藏試題按鈕 |
| canDeleteWrong | 是否顯示刪除錯題按鈕 |
#### 事件
| 事件名稱 | 說明 |
| --- | --- |
| submitQuestion | 自動交卷事件 |
#### 使用示例
考試模式:
~~~js
<!-- 答題組件 -->
<kz-question v-show="result == null" mode="EXAM" :title="paper_name" :questions="questions" :configs="configs" :limit_time="limit_time" @submitQuestion="submitQuestion"></kz-question>
~~~
看題模式:
~~~js
<!-- 答題組件 -->
<kz-question mode="VIEW" title="我的錯題" :questions="list" v-show="!showNodata" :canDeleteWrong="true" v-on:refresh="refresh"></kz-question>
~~~