@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.
Files changed (115) hide show
  1. package/.browserslistrc +3 -0
  2. package/.env +7 -0
  3. package/.env.buildTest +9 -0
  4. package/.env.development +9 -0
  5. package/.env.production +13 -0
  6. package/.env.test +12 -0
  7. package/@types/global.d.ts +33 -0
  8. package/@types/shims-vue.d.ts +6 -0
  9. package/@types/shims-vuex.d.ts +15 -0
  10. package/auto-imports.d.ts +6 -0
  11. package/babel.config.js +5 -0
  12. package/components.d.ts +23 -0
  13. package/design/App.vue +60 -0
  14. package/design/main.js +23 -0
  15. package/design/views/dialog/contentDialog.vue +18 -0
  16. package/design/views/dialog/contentDialog2.vue +18 -0
  17. package/design/views/dialog/contentDialog3.vue +19 -0
  18. package/design/views/exam/analysis.vue +208 -0
  19. package/design/views/exam/exam.vue +355 -0
  20. package/design/views/home/illustrate.vue +45 -0
  21. package/design/views/home/login.vue +43 -0
  22. package/design/vueMapper.js +8 -0
  23. package/design/vueMapperTree.js +2 -0
  24. package/dist/demo.html +1 -0
  25. package/dist/zykjcommon-questions.common.js +12817 -0
  26. package/dist/zykjcommon-questions.css +1 -0
  27. package/dist/zykjcommon-questions.umd.js +12836 -0
  28. package/dist/zykjcommon-questions.umd.min.js +18 -0
  29. package/index.js +10 -0
  30. package/package.json +61 -0
  31. package/public/favicon.ico +0 -0
  32. package/public/index.html +19 -0
  33. package/public/static/js/jquery.html2json.js +169 -0
  34. package/public/static/js/jquery.json2html.js +137 -0
  35. package/public/static/js/jquery.min.js +2 -0
  36. package/public/static/js/json2html.js +447 -0
  37. package/readme +8 -0
  38. package/src/App.vue +37 -0
  39. package/src/assets/img/afei.jpg +0 -0
  40. package/src/assets/img/audio-ico.gif +0 -0
  41. package/src/assets/img/audio-ico.png +0 -0
  42. package/src/assets/img/bc-type-bg.png +0 -0
  43. package/src/assets/img/big-close.png +0 -0
  44. package/src/assets/img/big-next.png +0 -0
  45. package/src/assets/img/big-pre.png +0 -0
  46. package/src/assets/img/book-bg.png +0 -0
  47. package/src/assets/img/checkbox-cur.png +0 -0
  48. package/src/assets/img/checkbox.png +0 -0
  49. package/src/assets/img/cpp-bg.png +0 -0
  50. package/src/assets/img/deer-logo.png +0 -0
  51. package/src/assets/img/header-bg-2.png +0 -0
  52. package/src/assets/img/header-bg.png +0 -0
  53. package/src/assets/img/illustrate-bg.png +0 -0
  54. package/src/assets/img/loading.gif +0 -0
  55. package/src/assets/img/login-bg.png +0 -0
  56. package/src/assets/img/login-box-bg.png +0 -0
  57. package/src/assets/img/login-box-logo.png +0 -0
  58. package/src/assets/img/logo.png +0 -0
  59. package/src/assets/img/logoByText.png +0 -0
  60. package/src/assets/img/py-bg.png +0 -0
  61. package/src/assets/img/pygame-bg.png +0 -0
  62. package/src/assets/img/radio-cur.png +0 -0
  63. package/src/assets/img/radio.png +0 -0
  64. package/src/assets/img/return-top-hover.png +0 -0
  65. package/src/assets/img/return-top.png +0 -0
  66. package/src/assets/img/sb3-bg.png +0 -0
  67. package/src/assets/img/star-ico.png +0 -0
  68. package/src/assets/img/tab-mark.png +0 -0
  69. package/src/assets/img/video-play-btn.png +0 -0
  70. package/src/assets/js/arms.js +16 -0
  71. package/src/assets/js/bus.js +14 -0
  72. package/src/assets/js/fun.js +883 -0
  73. package/src/assets/js/helper.js +575 -0
  74. package/src/assets/js/http.js +219 -0
  75. package/src/assets/js/md5.js +260 -0
  76. package/src/assets/js/rem.js +33 -0
  77. package/src/assets/js/validation.js +216 -0
  78. package/src/assets/js/zykjcommon-questions.umd.min.js +18 -0
  79. package/src/assets/logo.png +0 -0
  80. package/src/assets/scss/dialog/dialog.scss +144 -0
  81. package/src/assets/scss/exam/exam.scss +256 -0
  82. package/src/assets/scss/home/home.scss +222 -0
  83. package/src/assets/scss/index.scss +80 -0
  84. package/src/assets/scss/questions/index.scss +345 -0
  85. package/src/common/const.ts +15 -0
  86. package/src/components/common/ContentDialog.vue +172 -0
  87. package/src/components/common/IframeComponent.vue +101 -0
  88. package/src/components/common/Loading.vue +45 -0
  89. package/src/components/common/MediaLooker.vue +171 -0
  90. package/src/components/common/TextAreaEditor.vue +121 -0
  91. package/src/components/exam/QuestionCard.vue +494 -0
  92. package/src/components/exam/QuestionHeader.vue +87 -0
  93. package/src/components/exam/TimeCounter.vue +107 -0
  94. package/src/components/questions/QuestionReader.js +20 -0
  95. package/src/components/questions/Question_SingleChoice.vue +208 -0
  96. package/src/components/questions/buildEntry.js +12 -0
  97. package/src/components/questions/developmentEntry.js +11 -0
  98. package/src/components/questions/mixin.js +64 -0
  99. package/src/main.ts +176 -0
  100. package/src/router/exam.ts +50 -0
  101. package/src/router/index.ts +33 -0
  102. package/src/store/exam.ts +199 -0
  103. package/src/store/index.ts +22 -0
  104. package/src/types/common/index.ts +4 -0
  105. package/src/types/exam/exam.ts +10 -0
  106. package/src/views/exam/Analysis.vue +516 -0
  107. package/src/views/exam/Default.vue +28 -0
  108. package/src/views/exam/Exam.vue +594 -0
  109. package/src/views/exam/ReviewPaper.vue +178 -0
  110. package/src/views/exam/ReviewQuestion.vue +167 -0
  111. package/tasks/vueMapper.js +37 -0
  112. package/tasks/vueMapperTree.js +42 -0
  113. package/tsconfig.json +46 -0
  114. package/tslint.json +19 -0
  115. package/vue.config.js +107 -0
@@ -0,0 +1,171 @@
1
+ <template>
2
+ <div class="dialog imgLookerDialog" v-if="visible">
3
+ <div class="mask"></div>
4
+ <div class="close" @click="cancel">
5
+ <img src="../../assets/img/big-close.png" alt="" />
6
+ </div>
7
+ <div class="prev" @click="prev"></div>
8
+ <div class="next" @click="next"></div>
9
+ <!-- <button style="position: fixed;z-index: 9999;top:0;left:0" @click="fn">click</button>-->
10
+ <div class="imgLooker" v-if="curMediaObj.mediaType == 1"
11
+ @click="enlarge"
12
+ :class="{ in: enlargeStatus === 'in', out: enlargeStatus === 'out' }">
13
+ <img :src="curMediaObj.url"
14
+ :style="{'width':curMediaObj.width+'px','height':curMediaObj.height+'px'}"
15
+ alt="">
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import fun from '../../assets/js/fun';
22
+
23
+ export default {
24
+ props: {
25
+ visible: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ mediaLookerList: {
30
+ type: Array,
31
+ default(){
32
+ return []
33
+ }
34
+ },
35
+ mediaCount:{
36
+ type: Number,
37
+ default:0
38
+ }
39
+ },
40
+ mounted() {
41
+
42
+ },
43
+ data() {
44
+ return {
45
+ curMediaObj: {},
46
+ curMediaCount:0,
47
+ imgCompressWidth:0,
48
+ imgCompressHeight:0,
49
+ imgNativeWidth:0,
50
+ imgNativeHeight:0,
51
+ enlargeStatus: "in", //in:放大图标 out:缩小图标
52
+ canEnlarge:false
53
+ };
54
+ },
55
+ watch: {
56
+ mediaLookerList:{
57
+ handler(nv,ov){
58
+ if(nv && nv.length){
59
+ if(nv && nv.length){
60
+ // console.log(nv,3333);
61
+ this.getCurMedia(this.mediaCount)
62
+ // console.log(props.mediaCount,11113);
63
+ }
64
+ }
65
+ },
66
+ immediate:true,
67
+ deep:true
68
+ }
69
+ },
70
+ computed:{
71
+ },
72
+ methods: {
73
+ cancel(){
74
+ this.$emit("update:visible", false);
75
+ },
76
+ getCurMedia(index){
77
+ this.curMediaCount = index
78
+ this.curMediaObj = fun.copyDeepObject(this.mediaLookerList[index])
79
+ let newImg = new Image()
80
+ newImg.src = this.curMediaObj.url
81
+ let root = document.documentElement || document.body
82
+ let rootW = root.clientWidth
83
+ let rootH = root.clientHeight
84
+ this.canEnlarge = false
85
+ this.enlargeStatus = 'in'
86
+ newImg.addEventListener('load',()=>{
87
+ let imgW = newImg.width;
88
+ let imgH = newImg.height;
89
+ let bili, compressW, compressH;
90
+ this.imgNativeWidth = imgW;
91
+ this.imgNativeHeight = imgH;
92
+ //缩放规则:
93
+ //如果(原图得宽度和窗口得宽度差)>(原图得高度和窗口得高度差)用宽度比利来缩放
94
+ //如果(原图得宽度和窗口得宽度差) <(原图得高度和窗口得高度差)用高度比利来缩放
95
+ if (imgW >= rootW || imgH >= rootH) {
96
+ let w = imgW - rootW;
97
+ let h = imgH - rootH;
98
+ let bili, compressW, compressH;
99
+ if (w > h) {
100
+ compressW = rootW * 0.9;
101
+ bili = compressW / imgW;
102
+ compressH = imgH * bili;
103
+ this.curMediaObj.width = compressW;
104
+ this.curMediaObj.height = compressH;
105
+ this.imgCompressWidth = compressW;
106
+ this.imgCompressHeight = compressH;
107
+ } else {
108
+ compressH = rootH * 0.9;
109
+ bili = compressH / imgH;
110
+ compressW = imgW * bili;
111
+ this.curMediaObj.width = compressW;
112
+ this.curMediaObj.height = compressH;
113
+ this.imgCompressWidth = compressW;
114
+ this.imgCompressHeight = compressH;
115
+ }
116
+ this.canEnlarge = true;
117
+ } else {
118
+ this.curMediaObj.width = imgW;
119
+ this.curMediaObj.height = imgH;
120
+ this.imgCompressWidth = imgW;
121
+ this.imgCompressHeight = imgH;
122
+ }
123
+ // if(newImg.width >= rootW * 0.9){
124
+ // data.curMediaObj.width = rootW * 0.9
125
+ // }else{
126
+ // data.curMediaObj.width = newImg.width
127
+ // }
128
+ })
129
+ },
130
+ enlarge() {
131
+ if (this.canEnlarge) {
132
+ if (this.enlargeStatus === "in") {
133
+ this.curMediaObj.width = this.imgNativeWidth;
134
+ this.curMediaObj.height = this.imgNativeHeight;
135
+ } else {
136
+ this.curMediaObj.width = this.imgCompressWidth;
137
+ this.curMediaObj.height = this.imgCompressHeight;
138
+ }
139
+ this.enlargeStatus = this.enlargeStatus === "in" ? "out" : "in";
140
+ window.console.log(
141
+ this.imgNativeWidth,
142
+ this.imgNativeHeight,
143
+ this.imgCompressWidth,
144
+ this.imgCompressHeight
145
+ );
146
+ }
147
+ },
148
+ next(){
149
+ if(this.curMediaCount === this.mediaLookerList.length -1){
150
+ this.curMediaCount = 0
151
+ }else{
152
+ this.curMediaCount++
153
+ }
154
+ this.getCurMedia(this.curMediaCount)
155
+ },
156
+ prev(){
157
+ if(this.curMediaCount === 0){
158
+ this.curMediaCount = this.mediaLookerList.length -1
159
+ }else{
160
+ this.curMediaCount--
161
+ }
162
+ this.getCurMedia(this.curMediaCount)
163
+ }
164
+ }
165
+ };
166
+ </script>
167
+
168
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
169
+ <style scoped lang="scss">
170
+
171
+ </style>
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <div class="editor-textarea">
3
+ <textarea v-model="textareaStr"
4
+ :disabled="disabled"
5
+ class="textareaComponent"
6
+ :placeholder="placeHolder"
7
+ maxlength="5000"></textarea>
8
+ <div class="len">{{textareaStr.length}}/5000</div>
9
+ </div>
10
+ </template>
11
+
12
+ <script lang="ts">
13
+ import {
14
+ defineComponent,
15
+ onMounted,
16
+ onUnmounted,
17
+ reactive,
18
+ ref,
19
+ toRef,
20
+ toRefs,
21
+ watch,
22
+ onActivated,
23
+ onDeactivated,
24
+ getCurrentInstance
25
+ } from 'vue'
26
+ interface dataInterface{
27
+ textareaStr:string
28
+ }
29
+ export default defineComponent({
30
+ props: {
31
+ placeHolder:{
32
+ type:String,
33
+ default:'请输入...'
34
+ },
35
+ value:{
36
+ type:String,
37
+ default:''
38
+ },
39
+ disabled:{
40
+ type:Boolean,
41
+ default:false
42
+ }
43
+ },
44
+ setup(props, context) {
45
+ let data:dataInterface = reactive({
46
+ textareaStr:'',
47
+ })
48
+ const currentInstance:any = getCurrentInstance()
49
+ let _this = currentInstance.proxy
50
+ let observer:any
51
+ onMounted(()=>{
52
+ let textareaComponent = _this.$el.querySelector('.textareaComponent')
53
+ let ele = textareaComponent as HTMLElement
54
+ let textareaInitH = textareaComponent.clientHeight
55
+ const MutationObserver = window.MutationObserver|| window.WebKitMutationObserver || window.MozMutationObserver
56
+ const config = { attributes: true, childList: false, subtree: true, attributeFilter:['style'],attributeOldValue:true };
57
+ observer = new MutationObserver( (mutationsList, observer) => {
58
+ let appNode = document.querySelector('.content-outter')
59
+ if(appNode){
60
+ let height = parseInt(getComputedStyle(ele).getPropertyValue('height'))
61
+ let scrollDistance = height - textareaInitH
62
+ // console.log(scrollDistance,appNode.scrollTop);
63
+ appNode.scrollTop = appNode.scrollTop + scrollDistance
64
+ // if(scrollDistance > 0){
65
+ // console.log(scrollDistance,appNode.scrollTop);
66
+ // appNode.scrollTop = appNode.scrollTop + scrollDistance
67
+ // }
68
+ textareaInitH = height
69
+ }
70
+ });
71
+ observer.observe(ele, config);
72
+ })
73
+
74
+ onUnmounted(()=>{
75
+ observer && observer.disconnect()
76
+ })
77
+
78
+ watch(() => data.textareaStr, (nv) => {
79
+ context.emit("getTextareaStr", nv);
80
+ })
81
+
82
+ watch(() => props.value, (nv) => {
83
+ if(nv){
84
+ data.textareaStr = nv
85
+ }
86
+ },{
87
+ immediate:true
88
+ })
89
+
90
+
91
+
92
+ return {
93
+ ...toRefs(data)
94
+ }
95
+ }
96
+ })
97
+ </script>
98
+
99
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
100
+ <style lang="scss" scoped>
101
+ .editor-textarea{
102
+ margin-top: 15px;
103
+ position: relative;
104
+ display: inline-block;
105
+ textarea{
106
+ font-size: 18px;min-width: 800px;max-width: 1600px;min-height: 300px;
107
+ padding: 10px 15px 15px 15px;
108
+ outline-color: deepskyblue;
109
+ }
110
+ .len{
111
+ right: 15px;
112
+ bottom: 4px;
113
+ position: absolute;
114
+ color:blue;
115
+ font-weight: bold;
116
+
117
+ }
118
+ }
119
+
120
+
121
+ </style>