@zykjcommon/questions 0.0.1
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.
- package/.browserslistrc +3 -0
- package/.env +7 -0
- package/.env.buildTest +9 -0
- package/.env.development +9 -0
- package/.env.production +13 -0
- package/.env.test +12 -0
- package/@types/global.d.ts +33 -0
- package/@types/shims-vue.d.ts +6 -0
- package/@types/shims-vuex.d.ts +15 -0
- package/auto-imports.d.ts +6 -0
- package/babel.config.js +5 -0
- package/components.d.ts +23 -0
- package/design/App.vue +60 -0
- package/design/main.js +23 -0
- package/design/views/dialog/contentDialog.vue +18 -0
- package/design/views/dialog/contentDialog2.vue +18 -0
- package/design/views/dialog/contentDialog3.vue +19 -0
- package/design/views/exam/analysis.vue +208 -0
- package/design/views/exam/exam.vue +355 -0
- package/design/views/home/illustrate.vue +45 -0
- package/design/views/home/login.vue +43 -0
- package/design/vueMapper.js +8 -0
- package/design/vueMapperTree.js +2 -0
- package/dist/demo.html +1 -0
- package/dist/zykjcommon-questions.common.js +12817 -0
- package/dist/zykjcommon-questions.css +1 -0
- package/dist/zykjcommon-questions.umd.js +12836 -0
- package/dist/zykjcommon-questions.umd.min.js +18 -0
- package/index.js +10 -0
- package/package.json +61 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +19 -0
- package/public/static/js/jquery.html2json.js +169 -0
- package/public/static/js/jquery.json2html.js +137 -0
- package/public/static/js/jquery.min.js +2 -0
- package/public/static/js/json2html.js +447 -0
- package/readme +8 -0
- package/src/App.vue +37 -0
- package/src/assets/img/afei.jpg +0 -0
- package/src/assets/img/audio-ico.gif +0 -0
- package/src/assets/img/audio-ico.png +0 -0
- package/src/assets/img/bc-type-bg.png +0 -0
- package/src/assets/img/big-close.png +0 -0
- package/src/assets/img/big-next.png +0 -0
- package/src/assets/img/big-pre.png +0 -0
- package/src/assets/img/book-bg.png +0 -0
- package/src/assets/img/checkbox-cur.png +0 -0
- package/src/assets/img/checkbox.png +0 -0
- package/src/assets/img/cpp-bg.png +0 -0
- package/src/assets/img/deer-logo.png +0 -0
- package/src/assets/img/header-bg-2.png +0 -0
- package/src/assets/img/header-bg.png +0 -0
- package/src/assets/img/illustrate-bg.png +0 -0
- package/src/assets/img/loading.gif +0 -0
- package/src/assets/img/login-bg.png +0 -0
- package/src/assets/img/login-box-bg.png +0 -0
- package/src/assets/img/login-box-logo.png +0 -0
- package/src/assets/img/logo.png +0 -0
- package/src/assets/img/logoByText.png +0 -0
- package/src/assets/img/py-bg.png +0 -0
- package/src/assets/img/pygame-bg.png +0 -0
- package/src/assets/img/radio-cur.png +0 -0
- package/src/assets/img/radio.png +0 -0
- package/src/assets/img/return-top-hover.png +0 -0
- package/src/assets/img/return-top.png +0 -0
- package/src/assets/img/sb3-bg.png +0 -0
- package/src/assets/img/star-ico.png +0 -0
- package/src/assets/img/tab-mark.png +0 -0
- package/src/assets/img/video-play-btn.png +0 -0
- package/src/assets/js/arms.js +16 -0
- package/src/assets/js/bus.js +14 -0
- package/src/assets/js/fun.js +883 -0
- package/src/assets/js/helper.js +575 -0
- package/src/assets/js/http.js +219 -0
- package/src/assets/js/md5.js +260 -0
- package/src/assets/js/rem.js +33 -0
- package/src/assets/js/validation.js +216 -0
- package/src/assets/js/zykjcommon-questions.umd.min.js +18 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/scss/dialog/dialog.scss +144 -0
- package/src/assets/scss/exam/exam.scss +256 -0
- package/src/assets/scss/home/home.scss +222 -0
- package/src/assets/scss/index.scss +80 -0
- package/src/assets/scss/questions/index.scss +345 -0
- package/src/common/const.ts +15 -0
- package/src/components/common/ContentDialog.vue +172 -0
- package/src/components/common/IframeComponent.vue +101 -0
- package/src/components/common/Loading.vue +45 -0
- package/src/components/common/MediaLooker.vue +171 -0
- package/src/components/common/TextAreaEditor.vue +121 -0
- package/src/components/exam/QuestionCard.vue +494 -0
- package/src/components/exam/QuestionHeader.vue +87 -0
- package/src/components/exam/TimeCounter.vue +107 -0
- package/src/components/questions/QuestionReader.js +20 -0
- package/src/components/questions/Question_SingleChoice.vue +208 -0
- package/src/components/questions/buildEntry.js +12 -0
- package/src/components/questions/developmentEntry.js +11 -0
- package/src/components/questions/mixin.js +64 -0
- package/src/main.ts +176 -0
- package/src/router/exam.ts +50 -0
- package/src/router/index.ts +33 -0
- package/src/store/exam.ts +199 -0
- package/src/store/index.ts +22 -0
- package/src/types/common/index.ts +4 -0
- package/src/types/exam/exam.ts +10 -0
- package/src/views/exam/Analysis.vue +516 -0
- package/src/views/exam/Default.vue +28 -0
- package/src/views/exam/Exam.vue +594 -0
- package/src/views/exam/ReviewPaper.vue +178 -0
- package/src/views/exam/ReviewQuestion.vue +167 -0
- package/tasks/vueMapper.js +37 -0
- package/tasks/vueMapperTree.js +42 -0
- package/tsconfig.json +46 -0
- package/tslint.json +19 -0
- package/vue.config.js +107 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="zykjcommon-question">
|
|
3
|
+
<div class="question-type" v-if="!isSub">{{questionInfo.questionIndex}}、{{questionInfo.hint ? questionInfo.hint : questionInfo.question_type_str}}<span v-if="questionInfo.score!=='null'"><!--({{questionInfo.score}}分)--></span>
|
|
4
|
+
<span class="score fr" v-if="mode==='analysis'">得分:{{questionInfo.answerMap ? questionInfo.answerMap.user_score : '-'}}分</span>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="question-box">
|
|
7
|
+
<!-- <div class="question-stem" v-if="questionInfo.hint">{{questionInfo.hint}}</div>-->
|
|
8
|
+
<!-- <div class="question-stem" v-if="isSub"><span v-if="questionInfo.hint">{{questionInfo.questionIndex2}}、</span>{{questionInfo.hint}}</div>-->
|
|
9
|
+
<div class="editor-content" v-if="questionInfo.htmlContent" v-html="questionInfo.htmlContent"></div>
|
|
10
|
+
<!-- <div class="editor-content" style="display: flex" v-if="isSub">
|
|
11
|
+
<span v-if="!questionInfo.hint">{{questionInfo.questionIndex2}}、</span><div style="display: inline-block;flex: 1;" v-html="questionInfo.htmlContent"></div>
|
|
12
|
+
</div>-->
|
|
13
|
+
<div class="question-option-list" :style="(!questionInfo.htmlContent && !questionInfo.hint)?{'margin-top':0}:{}">
|
|
14
|
+
<div class="question-option" v-for="(item,index) in exam_options_data">
|
|
15
|
+
<div class="radio-box" :class="{'checked':radio == item.index}">
|
|
16
|
+
<input type="radio"
|
|
17
|
+
:disabled="mode === 'analysis' || mode === 'review'"
|
|
18
|
+
class="radio"
|
|
19
|
+
v-model="radio"
|
|
20
|
+
name="judge"
|
|
21
|
+
:id="'radio-'+questionInfo.questionIndex+'-'+index"
|
|
22
|
+
:value="item.index">
|
|
23
|
+
<div class="radio-bg"></div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="label-box">
|
|
26
|
+
<!--判断-->
|
|
27
|
+
<label v-if="questionInfo.question_type==3" :for="'radio-'+questionInfo.questionIndex+'-'+index">{{item.data.name}}</label>
|
|
28
|
+
<!--单选-->
|
|
29
|
+
<label v-if="questionInfo.question_type==1"
|
|
30
|
+
:for="'radio-'+questionInfo.questionIndex+'-'+index">
|
|
31
|
+
<!--file_type: 0.不带图片得文本选项-->
|
|
32
|
+
<span>{{item.enIndex}}.<span v-if="item.data.file_type == 0">{{item.data.option_content}}</span></span>
|
|
33
|
+
<div class="img-box" v-if="item.data.file_type != 0">
|
|
34
|
+
<img :src="item.data.file_url">
|
|
35
|
+
</div>
|
|
36
|
+
</label>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="question-analysis" v-if="mode === 'analysis'">
|
|
41
|
+
<div class="triangle-top"></div>
|
|
42
|
+
<div class="question-analysis-item">
|
|
43
|
+
<span class="txt">【你的回答】:</span>
|
|
44
|
+
<div class="txt-box">
|
|
45
|
+
<span :class="{'wrong':questionInfo.answerMap.is_correct !== '1','right':questionInfo.answerMap.is_correct === '1'}">{{questionInfo.answerMap.is_correct !== '1'?'错误':'正确'}}</span>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="question-analysis-item">
|
|
49
|
+
<span class="txt">【正确答案】:</span>
|
|
50
|
+
<div class="txt-box">
|
|
51
|
+
<span>{{analyCorrectAnswer}}</span>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="question-analysis-item" v-if="questionInfo.analysis">
|
|
55
|
+
<span class="txt">【本题解析】:</span>
|
|
56
|
+
<div class="txt-box">
|
|
57
|
+
<span class="analysis-txt" v-html="questionInfo.analysisHtmlContent"></span>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<!--
|
|
63
|
+
兼容性写法,两个都写
|
|
64
|
+
vue2支持.sync
|
|
65
|
+
vue3支持v-model:
|
|
66
|
+
:visible.sync="visible"
|
|
67
|
+
v-model:visible="visible"
|
|
68
|
+
-->
|
|
69
|
+
<MediaLooker :visible.sync="visible"
|
|
70
|
+
v-model:visible="visible"
|
|
71
|
+
v-if="visible"
|
|
72
|
+
:mediaCount="curMediaCount"
|
|
73
|
+
:mediaLookerList="mediaLookerList"></MediaLooker>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
76
|
+
<script>
|
|
77
|
+
|
|
78
|
+
import {commonData,doMediaLookerSome} from './mixin.js'
|
|
79
|
+
import MediaLooker from '../common/MediaLooker.vue'
|
|
80
|
+
import bus from "../../assets/js/bus";
|
|
81
|
+
import fun from "../../assets/js/fun";
|
|
82
|
+
|
|
83
|
+
export default {
|
|
84
|
+
name: 'Question_singleChoice',
|
|
85
|
+
props: {
|
|
86
|
+
isSub:{
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false
|
|
89
|
+
},
|
|
90
|
+
orderIndex:{
|
|
91
|
+
type: Number,
|
|
92
|
+
default: 0
|
|
93
|
+
},
|
|
94
|
+
questionInfo: {
|
|
95
|
+
type: Object,
|
|
96
|
+
default: {}
|
|
97
|
+
},
|
|
98
|
+
mode: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: 'exam'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
mounted() {
|
|
104
|
+
doMediaLookerSome(this)
|
|
105
|
+
this.$watch('radio',(nv)=>{
|
|
106
|
+
let self = this
|
|
107
|
+
let isSub = this.isSub
|
|
108
|
+
if(!isSub){
|
|
109
|
+
let answered = this.isAnswered()
|
|
110
|
+
this.mode === 'exam' && bus.$emit('questionCardChange',{
|
|
111
|
+
questionIndex:this.questionInfo.questionIndex - 1,
|
|
112
|
+
answered
|
|
113
|
+
})
|
|
114
|
+
}else{
|
|
115
|
+
this.mode === 'exam' && bus.$emit('optionChange')
|
|
116
|
+
this.mode === 'exam' && this.emit('optionChange', {orderIndex:this.orderIndex,isAnswered:self.isAnswered()})
|
|
117
|
+
}
|
|
118
|
+
},{
|
|
119
|
+
immediate:true
|
|
120
|
+
})
|
|
121
|
+
},
|
|
122
|
+
data() {
|
|
123
|
+
return {
|
|
124
|
+
radio:0,
|
|
125
|
+
analyCorrectAnswer:'',
|
|
126
|
+
exam_options_data:[],
|
|
127
|
+
answerMap:{},
|
|
128
|
+
...JSON.parse(commonData)
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
watch: {
|
|
132
|
+
questionInfo:{
|
|
133
|
+
handler(nv,ov){
|
|
134
|
+
if(nv){
|
|
135
|
+
this.exam_options_data = nv.exam_options_data
|
|
136
|
+
this.answerMap = nv.answerMap
|
|
137
|
+
//回显答案
|
|
138
|
+
if(nv.answerMap){
|
|
139
|
+
let {question_type} = nv
|
|
140
|
+
if(this.mode === 'analysis'){
|
|
141
|
+
if(question_type == 3){
|
|
142
|
+
this.analyCorrectAnswer = nv.correct_judge === '1' ? '正确':'错误'
|
|
143
|
+
}else{
|
|
144
|
+
this.analyCorrectAnswer = fun.indexToEnIndex(nv.correct_single_index)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if(question_type == 3){
|
|
148
|
+
let judge = nv.answerMap.judge
|
|
149
|
+
if(judge!==undefined && judge!==null && judge!==''){
|
|
150
|
+
this.radio = judge ? 1 : 2
|
|
151
|
+
}
|
|
152
|
+
}else{
|
|
153
|
+
let single_index = nv.answerMap.single_index
|
|
154
|
+
if(single_index!==undefined && single_index!==null && single_index!==''){
|
|
155
|
+
this.radio = single_index
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
immediate:true
|
|
162
|
+
},
|
|
163
|
+
/*radio:{
|
|
164
|
+
handler(nv,ov){
|
|
165
|
+
debugger
|
|
166
|
+
let self = this
|
|
167
|
+
let isSub = this.isSub
|
|
168
|
+
if(!isSub){
|
|
169
|
+
let answered = this.isAnswered()
|
|
170
|
+
this.mode === 'exam' && bus.$emit('questionCardChange',{
|
|
171
|
+
questionIndex:this.questionInfo.questionIndex - 1,
|
|
172
|
+
answered
|
|
173
|
+
})
|
|
174
|
+
}else{
|
|
175
|
+
this.mode === 'exam' && bus.$emit('optionChange')
|
|
176
|
+
this.mode === 'exam' && this.emit('optionChange', {orderIndex:this.orderIndex,isAnswered:self.isAnswered()})
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
immediate:true
|
|
180
|
+
}*/
|
|
181
|
+
},
|
|
182
|
+
computed:{
|
|
183
|
+
},
|
|
184
|
+
methods: {
|
|
185
|
+
getAnswer(){
|
|
186
|
+
let questionInfo = this.questionInfo
|
|
187
|
+
let question_type = questionInfo.question_type
|
|
188
|
+
if(question_type == 3){
|
|
189
|
+
let radio = this.radio == 1 ? true : false
|
|
190
|
+
return {judge:radio}
|
|
191
|
+
}else{
|
|
192
|
+
return {single_index:this.radio}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
isAnswered(){
|
|
196
|
+
let answerd = this.radio !== 0
|
|
197
|
+
return answerd
|
|
198
|
+
},
|
|
199
|
+
isCorrect(){
|
|
200
|
+
let correct = this.questionInfo.answerMap.is_correct === '1' ? true : false
|
|
201
|
+
return correct
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
components:{
|
|
205
|
+
MediaLooker
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Allen Liu on 2023/7/14.
|
|
3
|
+
*/
|
|
4
|
+
//此文件作为打包入口,打包后的dist文件给vue3用
|
|
5
|
+
import '../../assets/scss/questions/index.scss';
|
|
6
|
+
import Question_SingleChoice from './Question_SingleChoice.vue'
|
|
7
|
+
export default {
|
|
8
|
+
install(Vue){
|
|
9
|
+
Vue.component('Question_SingleChoice',Question_SingleChoice)
|
|
10
|
+
},
|
|
11
|
+
Question_SingleChoice
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Allen Liu on 2023/7/14.
|
|
3
|
+
*/
|
|
4
|
+
//给VUE2用是编译前的文件,和vue2项目一起打包构建
|
|
5
|
+
import Question_SingleChoice from './Question_SingleChoice.vue'
|
|
6
|
+
export default {
|
|
7
|
+
install(Vue){
|
|
8
|
+
Vue.component('Question_SingleChoice',Question_SingleChoice)
|
|
9
|
+
},
|
|
10
|
+
Question_SingleChoice
|
|
11
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {getCurrentInstance, onMounted} from "vue";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Created by Allen Liu on 2022/4/22.
|
|
5
|
+
*/
|
|
6
|
+
//共用commonData存在引用一个地址问题
|
|
7
|
+
export let commonData = JSON.stringify({
|
|
8
|
+
mediaLookerList:[],
|
|
9
|
+
mediaCount:0,
|
|
10
|
+
curMediaCount:0,
|
|
11
|
+
visible:false
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export function doMediaLookerSome(_this){
|
|
15
|
+
let nodeParser = {
|
|
16
|
+
img(child){
|
|
17
|
+
// console.log(child.getAttribute('src'));
|
|
18
|
+
let url = child.getAttribute('src')
|
|
19
|
+
child.setAttribute('media-index',_this.mediaCount+'')
|
|
20
|
+
_this.mediaCount ++;
|
|
21
|
+
_this.mediaLookerList.push({
|
|
22
|
+
url,
|
|
23
|
+
mediaType:1
|
|
24
|
+
})
|
|
25
|
+
child.addEventListener('click',(e)=>{
|
|
26
|
+
let target = e.target
|
|
27
|
+
let mediaIndex = Number(target.getAttribute('media-index'))
|
|
28
|
+
_this.curMediaCount = mediaIndex
|
|
29
|
+
openMediaLooker()
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function openMediaLooker(){
|
|
34
|
+
_this.visible = true
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function mountDo(){
|
|
38
|
+
let editorContent = _this.$el.querySelector('.question-box')
|
|
39
|
+
_this.$nextTick(()=>{
|
|
40
|
+
fn(editorContent)
|
|
41
|
+
})
|
|
42
|
+
function fn(node){
|
|
43
|
+
let childs = node.childNodes
|
|
44
|
+
childs.forEach(function(child){
|
|
45
|
+
if(child.nodeType === 1){
|
|
46
|
+
let nodeName = child.nodeName.toLowerCase()
|
|
47
|
+
if(nodeName === 'img'){
|
|
48
|
+
// console.log(child,'ccc');
|
|
49
|
+
nodeParser[nodeName](child)
|
|
50
|
+
}else{
|
|
51
|
+
//解析里面的图片不找
|
|
52
|
+
if(child.className.indexOf('question-analysis') < 0){
|
|
53
|
+
if(child.childNodes && child.childNodes.length){
|
|
54
|
+
fn(child)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
mountDo()
|
|
63
|
+
|
|
64
|
+
}
|
package/src/main.ts
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
window.vm = {}
|
|
2
|
+
import {createApp,h} from 'vue'
|
|
3
|
+
import App from './App.vue'
|
|
4
|
+
import router from './router'
|
|
5
|
+
import store from './store'
|
|
6
|
+
import setRem from '@src/assets/js/rem'
|
|
7
|
+
import Loading from '@src/components/common/Loading.vue'
|
|
8
|
+
import ContentDialog from '@src/components/common/ContentDialog.vue'
|
|
9
|
+
import fun from "@src/assets/js/fun.js";
|
|
10
|
+
import bus from "@/assets/js/bus";
|
|
11
|
+
// window.onerror = (fun as any).fbError
|
|
12
|
+
//引入表单验证指令
|
|
13
|
+
import validationPlugin from '@src/assets/js/validation'
|
|
14
|
+
|
|
15
|
+
import QuestionReader from '@src/components/questions/QuestionReader.js'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// 禁止右键菜单
|
|
21
|
+
document.oncontextmenu = function(){
|
|
22
|
+
return false
|
|
23
|
+
}
|
|
24
|
+
//禁止选中
|
|
25
|
+
// document.onselectstart = function(){
|
|
26
|
+
// return false
|
|
27
|
+
// }
|
|
28
|
+
//禁止复制
|
|
29
|
+
document.oncopy = function(){
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// console.log(QuestionReader,'QuestionReader');
|
|
34
|
+
setRem()
|
|
35
|
+
//应用中所有音频存放的容器
|
|
36
|
+
window.audiosContainer = []
|
|
37
|
+
window.contentDialogs = []
|
|
38
|
+
|
|
39
|
+
import '@src/assets/js/arms'
|
|
40
|
+
|
|
41
|
+
let vueInstance = createApp(App)
|
|
42
|
+
|
|
43
|
+
import zykj_question_plugin from "../dist/zykjcommon-questions.umd.min"
|
|
44
|
+
vueInstance.use(zykj_question_plugin as any)
|
|
45
|
+
import '../dist/zykjcommon-questions.css';
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
vueInstance.component('remote-js', {
|
|
49
|
+
render() {
|
|
50
|
+
let self = this;
|
|
51
|
+
let attrs:any = {
|
|
52
|
+
type: 'text/javascript'
|
|
53
|
+
};
|
|
54
|
+
self.async && (attrs.async = self.async);
|
|
55
|
+
self.defer && (attrs.defer = self.defer);
|
|
56
|
+
//虚拟节点不受BOM控制,模拟延迟效果
|
|
57
|
+
if (self.start) {
|
|
58
|
+
attrs.src = self.src;
|
|
59
|
+
}
|
|
60
|
+
let node = h('script', attrs);
|
|
61
|
+
return node;
|
|
62
|
+
},
|
|
63
|
+
data() {
|
|
64
|
+
return {
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
props: {
|
|
69
|
+
src: {
|
|
70
|
+
type: String,
|
|
71
|
+
required: true
|
|
72
|
+
},
|
|
73
|
+
async: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
defer: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false
|
|
80
|
+
},
|
|
81
|
+
start: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: true
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
watch: {
|
|
87
|
+
start(newValue) {
|
|
88
|
+
let self = this;
|
|
89
|
+
if (newValue) {
|
|
90
|
+
self.$el.src = self.src;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
vueInstance.component('remote-css', {
|
|
96
|
+
render() {
|
|
97
|
+
return h('link', {
|
|
98
|
+
type: 'type="text/css"',
|
|
99
|
+
rel: "stylesheet",
|
|
100
|
+
href: this.href
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
props: {
|
|
104
|
+
href: {
|
|
105
|
+
type: String,
|
|
106
|
+
required: true
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
vueInstance.component('Loading',Loading)
|
|
111
|
+
vueInstance.component('ContentDialog',ContentDialog)
|
|
112
|
+
//全局注册题型组件
|
|
113
|
+
// Object.keys(QuestionReader).forEach((key)=>{
|
|
114
|
+
// let component = (QuestionReader as any)[key]
|
|
115
|
+
// vueInstance.component(key,component)
|
|
116
|
+
// })
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
function eleClick(){
|
|
125
|
+
(document.querySelector('.content-outter') as HTMLElement).scrollTop = 0
|
|
126
|
+
}
|
|
127
|
+
function scrollerScroll(btn:any,scroller:any){
|
|
128
|
+
return function(e:any){
|
|
129
|
+
let scrollTop = scroller.scrollTop
|
|
130
|
+
if(scrollTop > 300){
|
|
131
|
+
btn.style.display = 'block'
|
|
132
|
+
}else{
|
|
133
|
+
btn.style.display = 'none'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function setReturnTopBtnLeft(ele:any){
|
|
138
|
+
return function(){
|
|
139
|
+
let contentLeft = jQuery('.content-left')
|
|
140
|
+
let w = contentLeft.width()
|
|
141
|
+
console.log(w,33);
|
|
142
|
+
let ofl = contentLeft.offset().left
|
|
143
|
+
let left = ofl + w
|
|
144
|
+
//设置回到顶部按钮离左边距离
|
|
145
|
+
ele.style.left = left + 'px'
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
vueInstance.directive('returnTop',{
|
|
149
|
+
mounted(ele:HTMLElement, binding:any,vNode){
|
|
150
|
+
if(ele){
|
|
151
|
+
ele.addEventListener('click',eleClick);
|
|
152
|
+
let scroller = (document.querySelector('.content-outter') as HTMLElement);
|
|
153
|
+
scroller.addEventListener('scroll',scrollerScroll(ele,scroller))
|
|
154
|
+
//todo iframe里获取contentLeft的宽度 offsetLeft那些有问题,这里先用timeout解决
|
|
155
|
+
setTimeout(()=>{
|
|
156
|
+
setReturnTopBtnLeft(ele)()
|
|
157
|
+
ele.style.display = 'none'
|
|
158
|
+
},100)
|
|
159
|
+
|
|
160
|
+
window.addEventListener('resize',setReturnTopBtnLeft(ele))
|
|
161
|
+
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
unmounted(ele:HTMLElement){
|
|
165
|
+
ele.removeEventListener('click',eleClick)
|
|
166
|
+
let scroller = (document.querySelector('.content-outter') as HTMLElement);
|
|
167
|
+
if(scroller){
|
|
168
|
+
scroller.removeEventListener('scroll',scrollerScroll(null,null))
|
|
169
|
+
}
|
|
170
|
+
window.removeEventListener('resize',setReturnTopBtnLeft)
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
vueInstance.use(validationPlugin)
|
|
175
|
+
vueInstance.use(store).use(router(store)).mount('#app')
|
|
176
|
+
window.vm.$store = store
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Allen Liu on 2020/4/11.
|
|
3
|
+
*/
|
|
4
|
+
const ExamIndex = () =>
|
|
5
|
+
import(/* webpackChunkName: "exam" */ "@src/views/exam/Exam.vue");
|
|
6
|
+
const Analysis = () =>
|
|
7
|
+
import(/* webpackChunkName: "exam" */ "@src/views/exam/Analysis.vue");
|
|
8
|
+
const ReviewPaper = () =>
|
|
9
|
+
import(/* webpackChunkName: "exam" */ "@src/views/exam/ReviewPaper.vue");
|
|
10
|
+
const ReviewQuestion = () =>
|
|
11
|
+
import(/* webpackChunkName: "exam" */ "@src/views/exam/ReviewQuestion.vue");
|
|
12
|
+
|
|
13
|
+
export default [
|
|
14
|
+
{
|
|
15
|
+
path: "index",
|
|
16
|
+
name: "examIndex",
|
|
17
|
+
component: ExamIndex,
|
|
18
|
+
meta: {
|
|
19
|
+
title: "考试页",
|
|
20
|
+
keepAlive: false
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
path: "analysis",
|
|
25
|
+
name: "analysis",
|
|
26
|
+
component: Analysis,
|
|
27
|
+
meta: {
|
|
28
|
+
title: "解析页",
|
|
29
|
+
keepAlive: false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
path: "reviewPaper",
|
|
34
|
+
name: "reviewPaper",
|
|
35
|
+
component: ReviewPaper,
|
|
36
|
+
meta: {
|
|
37
|
+
title: "预览试卷",
|
|
38
|
+
keepAlive: false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
path: "reviewQuestion",
|
|
43
|
+
name: "reviewQuestion",
|
|
44
|
+
component: ReviewQuestion,
|
|
45
|
+
meta: {
|
|
46
|
+
title: "预览试题",
|
|
47
|
+
keepAlive: false
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router'
|
|
2
|
+
import {createNamespacedHelpers} from 'vuex-composition-helpers';
|
|
3
|
+
import helper from '@src/assets/js/helper'
|
|
4
|
+
const Exam = () =>
|
|
5
|
+
import(/* webpackChunkName: "exam" */ "@/views/exam/Default.vue");
|
|
6
|
+
import exam from './exam'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default function(store:any){
|
|
10
|
+
const routes: Array<RouteRecordRaw> = [
|
|
11
|
+
{
|
|
12
|
+
path: "/",
|
|
13
|
+
redirect: "/exam/index"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
path: "/exam",
|
|
17
|
+
component: Exam,
|
|
18
|
+
redirect: "/exam/index",
|
|
19
|
+
children: [
|
|
20
|
+
...exam
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const router = createRouter({
|
|
26
|
+
history: createWebHistory('/'),
|
|
27
|
+
routes
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
window.vm.$router = router
|
|
31
|
+
|
|
32
|
+
return router
|
|
33
|
+
}
|