@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,345 @@
|
|
|
1
|
+
.zykjcommon-question{
|
|
2
|
+
.editor-content{
|
|
3
|
+
margin-top: 10px;
|
|
4
|
+
width: 100%;
|
|
5
|
+
overflow: auto;
|
|
6
|
+
&.editor-content-bor{
|
|
7
|
+
height: 300px;
|
|
8
|
+
/*border: 1px solid #666;*/
|
|
9
|
+
padding:5px;
|
|
10
|
+
}
|
|
11
|
+
img{
|
|
12
|
+
display: block;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
.question-type{
|
|
17
|
+
font-size: 18px;
|
|
18
|
+
font-family: PingFang-SC-Medium, PingFang-SC;
|
|
19
|
+
font-weight: bold;
|
|
20
|
+
color: #000000;
|
|
21
|
+
margin-bottom: 20px;
|
|
22
|
+
.score{
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
color: #666666;
|
|
25
|
+
font-weight: normal;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
.question-box{
|
|
29
|
+
padding-left: 30px;
|
|
30
|
+
}
|
|
31
|
+
.bcdt-btn{
|
|
32
|
+
margin-top: 30px;
|
|
33
|
+
padding:8px 11px;
|
|
34
|
+
border-radius: 4px;
|
|
35
|
+
color:#fff;
|
|
36
|
+
background: #FFBC00;
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
}
|
|
39
|
+
.question-option-list{
|
|
40
|
+
margin-top: 30px;
|
|
41
|
+
.question-option{
|
|
42
|
+
display: flex;
|
|
43
|
+
margin-bottom:20px;
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
color:#000;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
.question-stem{
|
|
49
|
+
color: #333333;
|
|
50
|
+
}
|
|
51
|
+
.radio-box{
|
|
52
|
+
margin-right:2px;
|
|
53
|
+
position: relative;display: inline-block;
|
|
54
|
+
span{
|
|
55
|
+
vertical-align: 3px;
|
|
56
|
+
margin-left:5px;
|
|
57
|
+
}
|
|
58
|
+
.radio{
|
|
59
|
+
position: absolute;left:0;top:0;
|
|
60
|
+
opacity: 0;
|
|
61
|
+
width: 100%;
|
|
62
|
+
height: 18px;
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
}
|
|
65
|
+
.radio-bg{
|
|
66
|
+
display: inline-block;
|
|
67
|
+
width: 16px;
|
|
68
|
+
height: 16px;
|
|
69
|
+
background: url("~@src/assets/img/radio.png") no-repeat center;
|
|
70
|
+
background-size: 100% 100%;
|
|
71
|
+
}
|
|
72
|
+
&.checked{
|
|
73
|
+
.radio-bg{
|
|
74
|
+
background: url("~@src/assets/img/radio-cur.png") no-repeat center;
|
|
75
|
+
background-size: 100% 100%;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
.checkbox-box{
|
|
80
|
+
margin-right:2px;
|
|
81
|
+
position: relative;display: inline-block;
|
|
82
|
+
/*span{
|
|
83
|
+
vertical-align: 3px;
|
|
84
|
+
margin-left:5px;
|
|
85
|
+
}*/
|
|
86
|
+
.checkbox{
|
|
87
|
+
height: 18px;
|
|
88
|
+
position: absolute;left:0;top:0;opacity: 0;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
}
|
|
91
|
+
.checkbox-bg{
|
|
92
|
+
width: 16px;height: 16px;display: inline-block;
|
|
93
|
+
background: url("~@src/assets/img/checkbox.png") no-repeat center;
|
|
94
|
+
background-size: 100% 100%;
|
|
95
|
+
}
|
|
96
|
+
&.checked{
|
|
97
|
+
.checkbox-bg{
|
|
98
|
+
background: url("~@src/assets/img/checkbox-cur.png") no-repeat center;
|
|
99
|
+
background-size: 100% 100%;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
.label-box{
|
|
104
|
+
word-break: break-all;
|
|
105
|
+
margin-top: -2px;
|
|
106
|
+
margin-left:5px;
|
|
107
|
+
flex:1;
|
|
108
|
+
label{
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
display: flex;
|
|
111
|
+
.img-box{
|
|
112
|
+
flex: 1;
|
|
113
|
+
margin-top: 2px;
|
|
114
|
+
img{
|
|
115
|
+
max-width: 100%;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
span{margin-right: 5px;}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
.editor-tit{
|
|
122
|
+
font-size: 16px;
|
|
123
|
+
font-family: PingFang-SC-Medium, PingFang-SC;
|
|
124
|
+
font-weight: bold;
|
|
125
|
+
color: #000000;
|
|
126
|
+
}
|
|
127
|
+
.editor-output{
|
|
128
|
+
margin-top: 15px;
|
|
129
|
+
background: #F7F7F7;
|
|
130
|
+
border-radius: 6px;
|
|
131
|
+
padding:15px;
|
|
132
|
+
color:#333;
|
|
133
|
+
font-size: 14px;
|
|
134
|
+
.output-main{
|
|
135
|
+
margin-top: 10px;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
.editor-textarea{
|
|
139
|
+
margin-top: 15px;
|
|
140
|
+
position: relative;
|
|
141
|
+
display: inline-block;
|
|
142
|
+
width: 100%;
|
|
143
|
+
textarea{
|
|
144
|
+
font-size: 14px;
|
|
145
|
+
min-width: 100%;max-width: 100%;min-height: 107px;
|
|
146
|
+
padding: 15px;
|
|
147
|
+
outline-color: #FFBC00;
|
|
148
|
+
border-radius: 6px;
|
|
149
|
+
border: 1px solid #DFDFDF;
|
|
150
|
+
color:#000;
|
|
151
|
+
}
|
|
152
|
+
.len{
|
|
153
|
+
right: 10px;
|
|
154
|
+
bottom: 10px;
|
|
155
|
+
position: absolute;
|
|
156
|
+
color:#999999;
|
|
157
|
+
font-size: 12px;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
.question-analysis{
|
|
161
|
+
position: relative;
|
|
162
|
+
margin-top: 16px;
|
|
163
|
+
border-radius: 8px;
|
|
164
|
+
padding:21px 15px 16px;
|
|
165
|
+
background: #F7F7F7;
|
|
166
|
+
width: 100%;
|
|
167
|
+
.question-analysis-item{
|
|
168
|
+
display: flex;
|
|
169
|
+
margin-top: 16px;
|
|
170
|
+
}
|
|
171
|
+
.question-analysis-item:nth-child(2){
|
|
172
|
+
margin-top: 0;
|
|
173
|
+
}
|
|
174
|
+
.txt{
|
|
175
|
+
vertical-align: top;
|
|
176
|
+
font-size: 16px;
|
|
177
|
+
font-family: PingFang-SC-Medium, PingFang-SC;
|
|
178
|
+
font-weight: bold;
|
|
179
|
+
color: #333333;
|
|
180
|
+
width: 112px;
|
|
181
|
+
}
|
|
182
|
+
.img-box{
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
display: inline-block;
|
|
185
|
+
position: relative;
|
|
186
|
+
width: 134px;
|
|
187
|
+
height: 134px;
|
|
188
|
+
img{
|
|
189
|
+
width: 100%;
|
|
190
|
+
height: 100%;
|
|
191
|
+
position: absolute;
|
|
192
|
+
left:0;
|
|
193
|
+
top:0;
|
|
194
|
+
}
|
|
195
|
+
.mask-text-box{
|
|
196
|
+
width: 100%;
|
|
197
|
+
height: 30px;
|
|
198
|
+
position: absolute;
|
|
199
|
+
bottom: 0;
|
|
200
|
+
left:0;
|
|
201
|
+
z-index:2;
|
|
202
|
+
.mask{
|
|
203
|
+
background: #000;
|
|
204
|
+
opacity: 0.4;
|
|
205
|
+
width: 100%;
|
|
206
|
+
height: 100%;
|
|
207
|
+
position: absolute;
|
|
208
|
+
left:0;
|
|
209
|
+
top:0;
|
|
210
|
+
z-index:1;
|
|
211
|
+
}
|
|
212
|
+
.mask-text{
|
|
213
|
+
width: 100%;
|
|
214
|
+
height: 100%;
|
|
215
|
+
position: absolute;
|
|
216
|
+
left:0;
|
|
217
|
+
top:0;
|
|
218
|
+
z-index:2;
|
|
219
|
+
line-height: 30px;
|
|
220
|
+
color:#fff;
|
|
221
|
+
text-align: center;
|
|
222
|
+
font-size: 14px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
.txt-box{
|
|
227
|
+
flex:1;
|
|
228
|
+
display: inline-block;
|
|
229
|
+
span{
|
|
230
|
+
color:#333;
|
|
231
|
+
}
|
|
232
|
+
.right{
|
|
233
|
+
color:#44BE57;
|
|
234
|
+
}
|
|
235
|
+
.wrong{
|
|
236
|
+
color:#E02020;
|
|
237
|
+
}
|
|
238
|
+
.analysis-txt{
|
|
239
|
+
color:#666;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
.reading-question-item{
|
|
244
|
+
margin-top: 30px;
|
|
245
|
+
padding:30px;
|
|
246
|
+
background: #f6f6f6;
|
|
247
|
+
border-radius: 8px;
|
|
248
|
+
.question-box{
|
|
249
|
+
padding-left: 0;
|
|
250
|
+
}
|
|
251
|
+
.question-option-list{
|
|
252
|
+
margin-left: 25px;
|
|
253
|
+
.question-option{
|
|
254
|
+
&:last-child{
|
|
255
|
+
margin-bottom: 0;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
.fill-blank{
|
|
261
|
+
display: inline;
|
|
262
|
+
border-bottom: 1px solid #FFA833;
|
|
263
|
+
outline: none;
|
|
264
|
+
word-break: break-all;
|
|
265
|
+
min-width: 80px;
|
|
266
|
+
margin-right:5px;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.imgLookerDialog{
|
|
271
|
+
.mask{
|
|
272
|
+
z-index:1001;
|
|
273
|
+
position: fixed;
|
|
274
|
+
left: 0;
|
|
275
|
+
top: 0;
|
|
276
|
+
width: 100%;
|
|
277
|
+
height: 100%;
|
|
278
|
+
background: #000;
|
|
279
|
+
opacity: 0.6;
|
|
280
|
+
}
|
|
281
|
+
.prev,.next{
|
|
282
|
+
position: fixed;z-index: 1003;top:50%;
|
|
283
|
+
width: 50px;
|
|
284
|
+
height: 50px;
|
|
285
|
+
cursor: pointer;
|
|
286
|
+
}
|
|
287
|
+
.prev{
|
|
288
|
+
left:10px;
|
|
289
|
+
background: url("~@src/assets/img/big-pre.png") no-repeat center;
|
|
290
|
+
background-size: cover;
|
|
291
|
+
}
|
|
292
|
+
.next{
|
|
293
|
+
right:10px;
|
|
294
|
+
background: url("~@src/assets/img/big-next.png") no-repeat center;
|
|
295
|
+
background-size: cover;
|
|
296
|
+
}
|
|
297
|
+
.close{
|
|
298
|
+
position: fixed;
|
|
299
|
+
z-index:1003;
|
|
300
|
+
top:10px;
|
|
301
|
+
right:30px;
|
|
302
|
+
color:#fff;
|
|
303
|
+
cursor: pointer;
|
|
304
|
+
border-radius: 50%;
|
|
305
|
+
width: 50px;
|
|
306
|
+
height: 50px;
|
|
307
|
+
img{
|
|
308
|
+
width: 100%;
|
|
309
|
+
height: 100%;
|
|
310
|
+
}
|
|
311
|
+
&:hover {
|
|
312
|
+
background: rgba(0, 0, 0, 0.2);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
.imgLooker{
|
|
316
|
+
width: 100%;
|
|
317
|
+
height: 100%;
|
|
318
|
+
z-index:1002;
|
|
319
|
+
position: fixed;
|
|
320
|
+
left: 0;
|
|
321
|
+
top: 0;
|
|
322
|
+
text-align: center;
|
|
323
|
+
overflow: auto;
|
|
324
|
+
display: flex;
|
|
325
|
+
justify-content: center;
|
|
326
|
+
align-items: center;
|
|
327
|
+
&.out {
|
|
328
|
+
display: inherit;
|
|
329
|
+
text-align: center;
|
|
330
|
+
overflow: auto;
|
|
331
|
+
cursor: zoom-out;
|
|
332
|
+
}
|
|
333
|
+
&.in {
|
|
334
|
+
cursor: zoom-in;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
/*定义滑块颜色、内阴影及圆角*/
|
|
339
|
+
.imgLooker::-webkit-scrollbar-thumb {
|
|
340
|
+
border-radius: 6px;
|
|
341
|
+
background-color: #fff;
|
|
342
|
+
&:hover {
|
|
343
|
+
background-color: #fff;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Created by Allen Liu on 2022/4/22.
|
|
5
|
+
*/
|
|
6
|
+
//全局用常量
|
|
7
|
+
export let questionMapper:any = {
|
|
8
|
+
'1':'Question_SingleChoice',//单选
|
|
9
|
+
'2':'Question_MultipleChoice',//多选
|
|
10
|
+
'3':'Question_SingleChoice',//判断
|
|
11
|
+
'7':'Question_BriefAnswer',//简答
|
|
12
|
+
'16':'Question_Programming',//编程
|
|
13
|
+
'11':'Question_Reading',//阅读
|
|
14
|
+
'4':'Question_FillBlank'//填空
|
|
15
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<teleport to="body">
|
|
3
|
+
<div class="dialog" v-if="visible">
|
|
4
|
+
<div class="mask"></div>
|
|
5
|
+
<div class="contentDialog"
|
|
6
|
+
:style="{'width':width+unit,'height':height+unit,'margin-left':'-'+(width/2)+unit,'margin-top':'-'+(height/2)+unit}">
|
|
7
|
+
<div class="content">
|
|
8
|
+
<slot name="content"></slot>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="footer" v-if="!hideFooter">
|
|
11
|
+
<button class="btn btn-cancel"
|
|
12
|
+
v-if="!hideCancel"
|
|
13
|
+
@click="cancel">{{ cancelText }}</button>
|
|
14
|
+
<button class="btn btn-confirm"
|
|
15
|
+
:class="{'ml20':!hideCancel}"
|
|
16
|
+
v-if="!hideConfirm"
|
|
17
|
+
@click="confirm">{{ confirmText }}</button>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
</teleport>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import {defineComponent, getCurrentInstance, onMounted, ref, toRef, toRefs,onUnmounted} from 'vue'
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export default defineComponent({
|
|
30
|
+
name: 'ContentDialog',
|
|
31
|
+
emits:['confirm','cancel','update:visible'],
|
|
32
|
+
props: {
|
|
33
|
+
visible: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
hideFooter:{
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
40
|
+
},
|
|
41
|
+
hideCancel:{
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
hideConfirm:{
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
title:{
|
|
50
|
+
type: String,
|
|
51
|
+
default: '标题'
|
|
52
|
+
},
|
|
53
|
+
height:{
|
|
54
|
+
type: Number,
|
|
55
|
+
default: 210
|
|
56
|
+
},
|
|
57
|
+
width:{
|
|
58
|
+
type: Number,
|
|
59
|
+
default: 362
|
|
60
|
+
},
|
|
61
|
+
unit:{
|
|
62
|
+
type: String,
|
|
63
|
+
default: 'px'
|
|
64
|
+
},
|
|
65
|
+
cancelText:{
|
|
66
|
+
type: String,
|
|
67
|
+
default: '取消'
|
|
68
|
+
},
|
|
69
|
+
confirmText:{
|
|
70
|
+
type: String,
|
|
71
|
+
default: '确定'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
setup(props, context) {
|
|
75
|
+
const currentInstance:any = getCurrentInstance()
|
|
76
|
+
let _this = currentInstance.proxy
|
|
77
|
+
|
|
78
|
+
onMounted(()=>{
|
|
79
|
+
//挂载时把弹窗实例保存在数组里
|
|
80
|
+
let dialogIndex = window.contentDialogs.findIndex((item)=>{
|
|
81
|
+
return item.uid === _this._.uid
|
|
82
|
+
})
|
|
83
|
+
if(dialogIndex < 0){
|
|
84
|
+
window.contentDialogs.push({uid:_this._.uid,scope:_this})
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
onUnmounted(()=>{
|
|
90
|
+
//销毁时候清楚数组里对应实例
|
|
91
|
+
let dialogIndex = window.contentDialogs.findIndex((item)=>{
|
|
92
|
+
return item.uid === _this._.uid
|
|
93
|
+
})
|
|
94
|
+
if(dialogIndex > -1){
|
|
95
|
+
window.contentDialogs.splice(dialogIndex,1)
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
function confirm(){
|
|
100
|
+
context.emit('confirm')
|
|
101
|
+
closeContentDialog()
|
|
102
|
+
}
|
|
103
|
+
function cancel(){
|
|
104
|
+
context.emit('cancel')
|
|
105
|
+
closeContentDialog()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function closeContentDialog(){
|
|
109
|
+
context.emit("update:visible", false);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
confirm,
|
|
114
|
+
cancel,
|
|
115
|
+
closeContentDialog
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
122
|
+
<style lang="scss">
|
|
123
|
+
/*.dialog{
|
|
124
|
+
& .mask{
|
|
125
|
+
z-index:1001;
|
|
126
|
+
position: fixed;
|
|
127
|
+
left: 0;
|
|
128
|
+
top: 0;
|
|
129
|
+
width: 100%;
|
|
130
|
+
height: 100%;
|
|
131
|
+
background: #000;
|
|
132
|
+
opacity: 0.6;
|
|
133
|
+
}
|
|
134
|
+
& .contentDialog{
|
|
135
|
+
&.pt50{padding-top: 50px;}
|
|
136
|
+
&.pb50{padding-bottom: 50px;}
|
|
137
|
+
z-index:1001;
|
|
138
|
+
background: #fff;
|
|
139
|
+
position: fixed;
|
|
140
|
+
left:50%;
|
|
141
|
+
top:50%;
|
|
142
|
+
.header{
|
|
143
|
+
height: 50px;
|
|
144
|
+
line-height: 50px;
|
|
145
|
+
position: absolute;
|
|
146
|
+
top:0;
|
|
147
|
+
left:0;
|
|
148
|
+
width: 100%;
|
|
149
|
+
.close{
|
|
150
|
+
position: absolute;
|
|
151
|
+
right:0;
|
|
152
|
+
top:0;
|
|
153
|
+
font-weight: bold;
|
|
154
|
+
font-size: 30px;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
.content{
|
|
159
|
+
height: 100%;
|
|
160
|
+
overflow: auto;
|
|
161
|
+
}
|
|
162
|
+
.footer{
|
|
163
|
+
height: 50px;
|
|
164
|
+
line-height: 50px;
|
|
165
|
+
width: 100%;
|
|
166
|
+
position: absolute;
|
|
167
|
+
left:0;
|
|
168
|
+
bottom: 0;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}*/
|
|
172
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<teleport to="#app">
|
|
3
|
+
<div class="iframeBox">
|
|
4
|
+
<iframe :src ="iframeUrl"
|
|
5
|
+
id="codeIframe"
|
|
6
|
+
loop
|
|
7
|
+
allow="microphone;camera;midi;encrypted-media;unsized-media;vr;xr-spatial-tracking;autoplay"
|
|
8
|
+
frameborder="0"
|
|
9
|
+
>
|
|
10
|
+
<p>Your browser does not support iframes.</p>
|
|
11
|
+
</iframe>
|
|
12
|
+
</div>
|
|
13
|
+
</teleport>
|
|
14
|
+
<Loading :loading="loading"></Loading>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import {defineComponent, toRefs, reactive, onMounted, onUnmounted} from 'vue'
|
|
19
|
+
interface dataInterface{
|
|
20
|
+
loading:boolean
|
|
21
|
+
}
|
|
22
|
+
export default defineComponent({
|
|
23
|
+
props: {
|
|
24
|
+
iframeUrl:{
|
|
25
|
+
type:String,
|
|
26
|
+
default:''
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
emits:['uploadCodingFileSuccess','close','closeAndSave','iframeLoaded','getQuestionInfo','saveCodeOnly'],
|
|
30
|
+
setup(props, context) {
|
|
31
|
+
let iframe:any = null
|
|
32
|
+
let data:dataInterface = reactive({
|
|
33
|
+
loading:true
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
function iframeLoadEvent(){
|
|
39
|
+
data.loading = false
|
|
40
|
+
context.emit('iframeLoaded',iframe)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function messageEvent(data:any){
|
|
44
|
+
// let iframeOrigin = ''+window.location.protocol+'//'+props.iframeUrl.replace(/^(http|https):\/\//g,'').split('/')[0];
|
|
45
|
+
// if(data.origin===iframeOrigin){
|
|
46
|
+
//判断是否json字符串
|
|
47
|
+
if(typeof(data.data)==='string'){
|
|
48
|
+
try {
|
|
49
|
+
let obj = JSON.parse(data.data)
|
|
50
|
+
context.emit(obj.type,obj.data)
|
|
51
|
+
} catch(e) {
|
|
52
|
+
let res = data.data
|
|
53
|
+
context.emit(res,data)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
function removeIframeEvents(){
|
|
62
|
+
iframe && iframe.removeEventListener('load',iframeLoadEvent)
|
|
63
|
+
window.removeEventListener('message',messageEvent)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
onMounted(()=>{
|
|
68
|
+
iframe = document.getElementById('codeIframe')
|
|
69
|
+
iframe.addEventListener('load',iframeLoadEvent)
|
|
70
|
+
window.addEventListener('message',messageEvent)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
onUnmounted(()=>{
|
|
74
|
+
removeIframeEvents()
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
...toRefs(data)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<style scoped lang="scss">
|
|
89
|
+
.iframeBox{
|
|
90
|
+
z-index:100;
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: 100%;
|
|
93
|
+
position: fixed;
|
|
94
|
+
left: 0;
|
|
95
|
+
top: 0;
|
|
96
|
+
iframe{
|
|
97
|
+
width: 100%;
|
|
98
|
+
height: 100%;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<teleport to="body">
|
|
3
|
+
<img class="loading" src="~@src/assets/img/loading.gif" alt="" v-if="loading">
|
|
4
|
+
</teleport>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import {defineComponent, toRefs, reactive, onMounted, onUnmounted} from 'vue'
|
|
9
|
+
interface dataInterface{
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
props: {
|
|
14
|
+
loading:{
|
|
15
|
+
type:Boolean,
|
|
16
|
+
default:false
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup(props, context) {
|
|
20
|
+
let data:dataInterface = reactive({
|
|
21
|
+
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
...toRefs(data)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<style scoped lang="scss">
|
|
34
|
+
.loading{
|
|
35
|
+
width: 50px;
|
|
36
|
+
height: 50px;
|
|
37
|
+
display: block;
|
|
38
|
+
position: fixed;
|
|
39
|
+
left:50%;
|
|
40
|
+
top:50%;
|
|
41
|
+
margin-left:-25px;
|
|
42
|
+
margin-top: -25px;
|
|
43
|
+
z-index:99999;
|
|
44
|
+
}
|
|
45
|
+
</style>
|