Commit 9816329804175cf7d075ab5ae0a91dff7b8a8e21
1 parent
8266ec66
wip: bug修复
Showing
3 changed files
with
123 additions
and
136 deletions
src/App.vue
1 | 1 | <template> |
2 | - <div id="app" ref="app"> | |
3 | - <transition name="fade" mode="out-in"> | |
4 | - <router-view></router-view> | |
5 | - </transition> | |
6 | - </div> | |
2 | + <div id="app" ref="app"> | |
3 | + <transition name="fade" mode="out-in"> | |
4 | + <router-view></router-view> | |
5 | + </transition> | |
6 | + </div> | |
7 | 7 | </template> |
8 | 8 | |
9 | 9 | <script> |
10 | 10 | import _ from "lodash"; |
11 | 11 | export default { |
12 | - name: "app", | |
13 | - mounted() { | |
12 | + name: "app", | |
13 | + mounted() {}, | |
14 | + methods: { | |
15 | + _reSize() { | |
16 | + const $app = this.$refs.app; | |
14 | 17 | |
15 | - }, | |
16 | - methods: { | |
17 | - _reSize() { | |
18 | + const standardScale = "100%" / "100%"; | |
18 | 19 | |
19 | - const $app = this.$refs.app; | |
20 | + const docHeight = document.body.clientHeight; | |
20 | 21 | |
21 | - const standardScale = "100%" / "100%"; | |
22 | + const docWidth = document.body.clientWidth; | |
22 | 23 | |
23 | - const docHeight = document.body.clientHeight; | |
24 | + if (docWidth < 1700) { | |
25 | + const currentScale = docHeight / docWidth; | |
24 | 26 | |
25 | - const docWidth = document.body.clientWidth; | |
27 | + let [scale, translate] = [0, 0]; | |
28 | + if (currentScale < standardScale) { | |
29 | + // 以高度计算 | |
30 | + scale = docHeight / 1080; | |
26 | 31 | |
27 | - if (docWidth < 1700) { | |
32 | + const shouleWidth = 1920 * scale; | |
28 | 33 | |
29 | - const currentScale = docHeight / docWidth; | |
34 | + const offsetWidth = docWidth - shouleWidth; | |
30 | 35 | |
31 | - let [scale, translate] = [0, 0]; | |
32 | - if (currentScale < standardScale) { | |
33 | - // 以高度计算 | |
34 | - scale = docHeight / 1080; | |
36 | + translate = | |
37 | + offsetWidth > 0 ? `translate(${offsetWidth / 2}px, 0)` : ""; | |
38 | + } else { | |
39 | + // 以宽度计算 | |
40 | + scale = docWidth / 1920; | |
35 | 41 | |
36 | - const shouleWidth = 1920 * scale; | |
42 | + const shouleHeight = 1080 * scale; | |
37 | 43 | |
38 | - const offsetWidth = docWidth - shouleWidth; | |
44 | + const offsetHeight = docHeight - shouleHeight; | |
39 | 45 | |
40 | - translate = | |
41 | - offsetWidth > 0 ? `translate(${offsetWidth / 2}px, 0)` : ""; | |
46 | + translate = | |
47 | + offsetHeight > 0 ? `translate(0, ${offsetHeight / 2}px)` : ""; | |
48 | + } | |
42 | 49 | |
43 | - } else { | |
44 | - // 以宽度计算 | |
45 | - scale = docWidth / 1920; | |
46 | - | |
47 | - const shouleHeight = 1080 * scale; | |
48 | - | |
49 | - const offsetHeight = docHeight - shouleHeight; | |
50 | - | |
51 | - translate = | |
52 | - offsetHeight > 0 ? `translate(0, ${offsetHeight / 2}px)` : ""; | |
53 | - } | |
54 | - | |
55 | - if (docHeight <= 600) { | |
56 | - | |
57 | - $app.style.cssText = ` | |
50 | + if (docHeight <= 600) { | |
51 | + $app.style.cssText = ` | |
58 | 52 | transform: scale(${scale}) ${translate}; |
59 | 53 | transform-origin: top left; |
60 | 54 | min-width: 1920px; |
61 | 55 | min-height:830px; |
62 | 56 | `; |
63 | - } | |
64 | - else if (docHeight == 610) { | |
65 | - $app.style.cssText = ` | |
57 | + } else if (docHeight == 610) { | |
58 | + $app.style.cssText = ` | |
66 | 59 | transform: scale(${scale}) ${translate}; |
67 | 60 | transform-origin: top left; |
68 | 61 | min-width: 1920px; |
69 | 62 | min-height:885px; |
70 | - `; | |
71 | - } | |
72 | - else if (docHeight <= 606) { | |
73 | - $app.style.cssText = ` | |
63 | + `; | |
64 | + } else if (docHeight <= 606) { | |
65 | + $app.style.cssText = ` | |
74 | 66 | transform: scale(${scale}) ${translate}; |
75 | 67 | transform-origin: top left; |
76 | 68 | min-width: 1920px; |
77 | 69 | min-height:850px; |
78 | 70 | `; |
79 | - } | |
80 | - else if (docHeight <= 650) { | |
81 | - | |
82 | - $app.style.cssText = ` | |
71 | + } else if (docHeight <= 650) { | |
72 | + $app.style.cssText = ` | |
83 | 73 | transform: scale(${scale}) ${translate}; |
84 | 74 | transform-origin: top left; |
85 | 75 | min-width: 1920px; |
86 | 76 | min-height:850px; |
87 | 77 | `; |
88 | - } | |
89 | - else if (docHeight <= 700) { | |
90 | - | |
91 | - $app.style.cssText = ` | |
78 | + } else if (docHeight <= 700) { | |
79 | + $app.style.cssText = ` | |
92 | 80 | transform: scale(${scale}) ${translate}; |
93 | 81 | transform-origin: top left; |
94 | 82 | min-width: 1920px; |
95 | 83 | min-height: 890px; |
96 | 84 | `; |
97 | - } | |
98 | - else if (docHeight <= 750) { | |
99 | - | |
100 | - $app.style.cssText = ` | |
85 | + } else if (docHeight <= 750) { | |
86 | + $app.style.cssText = ` | |
101 | 87 | transform: scale(${scale}) ${translate}; |
102 | 88 | transform-origin: top left; |
103 | 89 | min-width: 1920px; |
104 | 90 | min-height: 910px; |
105 | 91 | `; |
106 | - } | |
107 | - else { | |
108 | - $app.style.cssText = ` | |
109 | - transform: scale(${scale}) ${translate}; | |
110 | - transform-origin: top left; | |
111 | - min-width: 1920px; | |
112 | - min-height:1045px; | |
92 | + } | |
93 | + // else { | |
94 | + // $app.style.cssText = ` | |
95 | + // transform: scale(${scale}) ${translate}; | |
96 | + // transform-origin: top left; | |
97 | + // min-width: 1920px; | |
98 | + // min-height:1045px; | |
99 | + // `; | |
100 | + // } | |
101 | + else { | |
102 | + $app.style.cssText = ` | |
103 | + min-width: 100vh; | |
104 | + min-height:100vh; | |
113 | 105 | `; |
114 | - } | |
115 | - | |
116 | - } else { | |
117 | - $app.style.cssText = ''; | |
118 | - } | |
119 | - }, | |
120 | - }, | |
121 | - created() { | |
122 | - let that = this; | |
123 | - | |
124 | - this.$nextTick(() => { | |
125 | - if (document.createEvent) { | |
126 | - that._reSize(); | |
127 | - } else if (document.createEventObject) { | |
128 | - that._reSize(); | |
129 | - } | |
130 | - }); | |
131 | - } | |
132 | -} | |
133 | - | |
106 | + } | |
107 | + } else { | |
108 | + $app.style.cssText = ""; | |
109 | + } | |
110 | + }, | |
111 | + }, | |
112 | + created() { | |
113 | + let that = this; | |
114 | + | |
115 | + this.$nextTick(() => { | |
116 | + if (document.createEvent) { | |
117 | + that._reSize(); | |
118 | + } else if (document.createEventObject) { | |
119 | + that._reSize(); | |
120 | + } | |
121 | + }); | |
122 | + }, | |
123 | +}; | |
134 | 124 | </script> |
135 | 125 | |
136 | 126 | <style lang="scss"> |
137 | 127 | body { |
138 | - margin: 0px; | |
139 | - padding: 0px; | |
140 | - font-family: Microsoft YaHei, Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, SimSun, sans-serif; | |
141 | - -webkit-font-smoothing: antialiased; | |
128 | + margin: 0px; | |
129 | + padding: 0px; | |
130 | + font-family: Microsoft YaHei, Helvetica Neue, Helvetica, PingFang SC, | |
131 | + Hiragino Sans GB, SimSun, sans-serif; | |
132 | + -webkit-font-smoothing: antialiased; | |
142 | 133 | } |
143 | 134 | |
144 | 135 | #app { |
145 | - position: absolute; | |
146 | - top: 0px; | |
147 | - bottom: 0px; | |
148 | - width: 100%; | |
136 | + position: absolute; | |
137 | + top: 0px; | |
138 | + bottom: 0px; | |
139 | + width: 100%; | |
149 | 140 | } |
150 | 141 | |
151 | 142 | a { |
152 | - color: #56a9ff; | |
143 | + color: #56a9ff; | |
153 | 144 | } |
154 | 145 | |
155 | 146 | .fade-enter-active, |
156 | 147 | .fade-leave-active { |
157 | - transition: all .2s ease; | |
148 | + transition: all 0.2s ease; | |
158 | 149 | } |
159 | 150 | |
160 | 151 | .fade-enter, |
161 | 152 | .fade-leave-active { |
162 | - opacity: 0; | |
153 | + opacity: 0; | |
163 | 154 | } |
164 | 155 | |
165 | 156 | #nprogress .bar { |
166 | - height: 3px !important; | |
167 | - background: #56a9ff !important; //自定义颜色 | |
157 | + height: 3px !important; | |
158 | + background: #56a9ff !important; //自定义颜色 | |
168 | 159 | } |
169 | 160 | </style> | ... | ... |
src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
... | ... | @@ -603,24 +603,31 @@ export default { |
603 | 603 | }, |
604 | 604 | processString(input) { |
605 | 605 | // 正则表达式: |
606 | - const regexs = [/[0-9]+[.)]/, /(\d+分)/, /^(\d{1,3})/]; | |
606 | + // const regexs = [/[0-9]+[.)]/, /(\d+分)/, /^(\d{1,3})/]; | |
607 | 607 | |
608 | - // 使用正则表达式匹配并处理输入字符串 | |
609 | - for (const regex of regexs) { | |
610 | - const match = input.match(regex); | |
611 | - if (match) { | |
612 | - if (regex === regexs[2]) { | |
613 | - // 如果匹配第三条规则,使用substring截取返回结果的长度加1 | |
614 | - const matchLength = match[0].length; | |
615 | - return input.substring(matchLength + 1).trim(); | |
616 | - } else { | |
617 | - // 如果匹配第一条或第二条规则,替换匹配的部分 | |
618 | - input = input.replace(regex, ""); | |
619 | - } | |
620 | - } | |
608 | + // // 使用正则表达式匹配并处理输入字符串 | |
609 | + // for (const regex of regexs) { | |
610 | + // const match = input.match(regex); | |
611 | + // if (match) { | |
612 | + // if (regex === regexs[2]) { | |
613 | + // // 如果匹配第三条规则,使用substring截取返回结果的长度加1 | |
614 | + // const matchLength = match[0].length; | |
615 | + // return input.substring(matchLength + 1).trim(); | |
616 | + // } else { | |
617 | + // // 如果匹配第一条或第二条规则,替换匹配的部分 | |
618 | + // input = input.replace(regex, ""); | |
619 | + // } | |
620 | + // } | |
621 | + // } | |
622 | + const match = input.match(/^(\d{1,3})/); | |
623 | + if (match) { | |
624 | + const matchLength = match[0].length; | |
625 | + input = input.substring(matchLength + 1).trim(); | |
621 | 626 | } |
622 | - | |
623 | - return input; | |
627 | + // 使用正则表达式匹配并处理输入字符串 | |
628 | + input = input.replace(/[0-9]+[.)]/, ""); | |
629 | + input = input.replace(/(\d+(\.\d+)?分)/g, ""); | |
630 | + return input.trim(); | |
624 | 631 | }, |
625 | 632 | |
626 | 633 | // 接受两个参数,返回需要删除的数据以及需要添加的数据 | ... | ... |
src/views/basic/askTestQuestion/wrongQuestion.vue
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 | </div> |
56 | 56 | </el-col> |
57 | 57 | <el-col class="col-margin" :span="12"> |
58 | - <span style="font-weight: 600">时间:</span> | |
58 | + <span style="font-weight: 600; white-space: nowrap">时间:</span> | |
59 | 59 | <el-date-picker |
60 | 60 | :clearable="false" |
61 | 61 | value-format="yyyy-MM-dd" |
... | ... | @@ -100,7 +100,7 @@ |
100 | 100 | % |
101 | 101 | </div> |
102 | 102 | </el-col> |
103 | - <el-col class="col-margin" :span="6" | |
103 | + <el-col class="col-margin" :span="8" | |
104 | 104 | ><span |
105 | 105 | style="font-weight: 600; width: fit-content; white-space: nowrap" |
106 | 106 | >题型:</span |
... | ... | @@ -115,12 +115,11 @@ |
115 | 115 | {{ item.label }} |
116 | 116 | </div></el-col |
117 | 117 | > |
118 | - <el-col class="col-margin" style="margin-left: 10px" :span="2" | |
118 | + <el-col class="col-margin" :span="2" | |
119 | 119 | ><el-button |
120 | 120 | @click="handleSearch" |
121 | 121 | style="background: #6b73f5" |
122 | 122 | type="primary" |
123 | - y | |
124 | 123 | >筛选错题</el-button |
125 | 124 | ></el-col |
126 | 125 | > |
... | ... | @@ -622,25 +621,15 @@ export default { |
622 | 621 | this.getClassList(); |
623 | 622 | }, |
624 | 623 | processString(input) { |
625 | - // 正则表达式: | |
626 | - const regexs = [/[0-9]+[.)]/, /(\d+分)/, /^(\d{1,3})/]; | |
627 | - | |
628 | - // 使用正则表达式匹配并处理输入字符串 | |
629 | - for (const regex of regexs) { | |
630 | - const match = input.match(regex); | |
631 | - if (match) { | |
632 | - if (regex === regexs[2]) { | |
633 | - // 如果匹配第三条规则,使用substring截取返回结果的长度加1 | |
634 | - const matchLength = match[0].length; | |
635 | - return input.substring(matchLength + 1).trim(); | |
636 | - } else { | |
637 | - // 如果匹配第一条或第二条规则,替换匹配的部分 | |
638 | - input = input.replace(regex, ""); | |
639 | - } | |
640 | - } | |
624 | + const match = input.match(/^(\d{1,3})/); | |
625 | + if (match) { | |
626 | + const matchLength = match[0].length; | |
627 | + input = input.substring(matchLength + 1).trim(); | |
641 | 628 | } |
642 | - | |
643 | - return input; | |
629 | + // 使用正则表达式匹配并处理输入字符串 | |
630 | + input = input.replace(/[0-9]+[.)]/, ""); | |
631 | + input = input.replace(/(\d+(\.\d+)?分)/g, ""); | |
632 | + return input.trim(); | |
644 | 633 | }, |
645 | 634 | |
646 | 635 | // 获取ref | ... | ... |