1+ <template >
2+ <div class =" main" >
3+ <el-form ref =" form" label-width =" 80px"
4+ style =" box-shadow : 0 2px 12px 0 rgba (0 , 0 , 0 , 0.1 ); padding-top : 10px ; padding-right : 20px ; padding-bottom : 3px " >
5+ <el-form-item label =" 题目标签" >
6+ <el-select v-model =" label" multiple placeholder =" 请选择题目标签" >
7+ <el-option
8+ v-for =" item in options"
9+ :key =" item.value"
10+ :label =" item.title"
11+ :value =" item.value"
12+ clearable >
13+ </el-option >
14+ </el-select >
15+ </el-form-item >
16+ <el-form-item label =" 分数范围" >
17+ <el-slider
18+ v-model =" score"
19+ range
20+ :step =" 100"
21+ :max =" 3500" >
22+ </el-slider >
23+ </el-form-item >
24+ <el-form-item >
25+ <el-cascader
26+ v-model =" sortValue"
27+ :options =" sortOptions"
28+ :props =" { expandTrigger: 'hover' }" ></el-cascader >
29+ <el-button type =" primary" @click =" getProblemSet" style =" margin-left : 10px ; width : 120px "
30+ :loading =" loading" >拉取
31+ </el-button >
32+ </el-form-item >
33+ </el-form >
34+
35+ <template v-if =" ! notFetch " >
36+ <el-table :data =" problems"
37+ style =" width : 100% "
38+ :row-class-name =" getColor" >
39+ <el-table-column
40+ prop =" contest"
41+ label =" Contest"
42+ align =" center"
43+ min-width =" 75" >
44+ </el-table-column >
45+ <el-table-column
46+ prop =" id"
47+ label =" ID"
48+ align =" center"
49+ min-width =" 25" >
50+ </el-table-column >
51+ <el-table-column
52+ prop =" name"
53+ label =" name"
54+ align =" center"
55+ min-width =" 300" >
56+ </el-table-column >
57+ <el-table-column
58+ prop =" score"
59+ label =" score"
60+ align =" center"
61+ min-width =" 100" >
62+ </el-table-column >
63+ <el-table-column
64+ prop =" passed"
65+ label =" passed"
66+ align =" center"
67+ min-width =" 50" >
68+ </el-table-column >
69+ <el-table-column
70+ label =" "
71+ align =" center"
72+ min-width =" 50" >
73+ <template scope="scope">
74+ <el-button type =" primary"
75+ v-on:click =" clickProblem(scope.$index)" >
76+ 进入
77+ </el-button >
78+ </template >
79+ </el-table-column >
80+ </el-table >
81+ </template >
82+ </div >
83+ </template >
84+
85+ <script >
86+ let problemSet = require (' ../static/crawler/problemSet' )
87+
88+ export default {
89+ name: " ProblemSet" ,
90+
91+ data () {
92+ return {
93+ loading: false ,
94+ notFetch: true ,
95+ problems: [],
96+ options: [{value: " combine-tags-by-or" , title: " *combine tags by OR" },
97+ {value: " 2-sat" , title: " 2-sat" },
98+ {value: " binary search" , title: " binary search" },
99+ {value: " bitmasks" , title: " bitmasks" },
100+ {value: " brute force" , title: " brute force" },
101+ {value: " chinese remainder theorem" , title: " chinese remainder theorem" },
102+ {value: " combinatorics" , title: " combinatorics" },
103+ {value: " constructive algorithms" , title: " constructive algorithms" },
104+ {value: " data structures" , title: " data structures" },
105+ {value: " dfs and similar" , title: " dfs and similar" },
106+ {value: " divide and conquer" , title: " divide and conquer" },
107+ {value: " dp" , title: " dp" },
108+ {value: " dsu" , title: " dsu" },
109+ {value: " expression parsing" , title: " expression parsing" },
110+ {value: " fft" , title: " fft" },
111+ {value: " flows" , title: " flows" },
112+ {value: " games" , title: " games" },
113+ {value: " geometry" , title: " geometry" },
114+ {value: " graph matchings" , title: " graph matchings" },
115+ {value: " graphs" , title: " graphs" },
116+ {value: " greedy" , title: " greedy" },
117+ {value: " hashing" , title: " hashing" },
118+ {value: " implementation" , title: " implementation" },
119+ {value: " interactive" , title: " interactive" },
120+ {value: " math" , title: " math" },
121+ {value: " matrices" , title: " matrices" },
122+ {value: " meet-in-the-middle" , title: " meet-in-the-middle" },
123+ {value: " number theory" , title: " number theory" },
124+ {value: " probabilities" , title: " probabilities" },
125+ {value: " schedules" , title: " schedules" },
126+ {value: " shortest paths" , title: " shortest paths" },
127+ {value: " sortings" , title: " sortings" },
128+ {value: " string suffix structures" , title: " string suffix structures" },
129+ {value: " strings" , title: " strings" },
130+ {value: " ternary search" , title: " ternary search" },
131+ {value: " trees" , title: " trees" },
132+ {value: " two pointers" , title: " two pointers" }
133+ ],
134+ label: [],
135+ score: [0 , 3500 ],
136+ sortOptions: [
137+ {
138+ value: ' 0' ,
139+ label: ' 默认排序' ,
140+ },
141+ {
142+ value: ' 1' ,
143+ label: ' 按分数排序' ,
144+ children: [
145+ {
146+ value: ' BY_RATING_ASC' ,
147+ label: ' 升序' ,
148+ },
149+ {
150+ value: ' BY_RATING_DESC' ,
151+ label: ' 降序' ,
152+ }]
153+ }, {
154+ value: ' 2' ,
155+ label: ' 按通过人数排序' ,
156+ children: [
157+ {
158+ value: ' BY_SOLVED_ASC' ,
159+ label: ' 升序' ,
160+ },
161+ {
162+ value: ' BY_SOLVED_DESC' ,
163+ label: ' 降序' ,
164+ }]
165+ }
166+ ],
167+ sortValue: [' 0' ]
168+ }
169+ },
170+
171+ methods: {
172+ getProblemSet () {
173+ this .notFetch = true
174+ this .loading = true
175+
176+ let args = ' ?'
177+
178+ if (this .sortValue [0 ] !== ' 0' )
179+ args += ' order=' + this .sortValue [1 ] + ' &'
180+ if (this .label .length !== 0 )
181+ args += ' tags=' + this .label .join (' ,' )
182+ if (this .label .length !== 0 )
183+ args += ' ,' + this .score [0 ] + ' -' + this .score [1 ]
184+ else
185+ args += ' tags=' + this .score [0 ] + ' -' + this .score [1 ]
186+ problemSet .getProblemSetList (args, (e , p ) => {
187+ if (e) {
188+ console .log (p)
189+ this .$message .error (' 拉取失败' )
190+ } else {
191+ this .notFetch = false
192+ this .problems = p
193+ }
194+ this .loading = false
195+ })
196+ },
197+
198+ // eslint-disable-next-line no-unused-vars
199+ getColor ({row, rowIndex}) {
200+ if (row .status === 1 )
201+ return ' accept'
202+ if (row .status === 2 )
203+ return ' reject'
204+ },
205+
206+ clickProblem (index ) {
207+ console .log (this .problems [index].id )
208+ this .$emit (' proMessage' , {contest: this .problems [index].contest , id: this .problems [index].id , next: ' 5' })
209+ }
210+ }
211+ }
212+ </script >
213+
214+ <style scoped>
215+ .el-select {
216+ width : 100% ;
217+ }
218+
219+ .el-table .accept {
220+ background : #64ff64 ;
221+ }
222+
223+ .el-table .reject {
224+ background : #ff6464 ;
225+ }
226+ </style >
0 commit comments