File tree 2 files changed +92
-1
lines changed
2 files changed +92
-1
lines changed Original file line number Diff line number Diff line change 39
39
比赛题面
40
40
</span >
41
41
</el-menu-item >
42
+ <el-menu-item index =" 7" >
43
+ <span slot =" title" >
44
+ <i class =" el-icon-folder" ></i >
45
+ 本地缓存
46
+ </span >
47
+ </el-menu-item >
42
48
</el-menu >
43
49
</el-aside >
44
50
<el-main >
50
56
<Contest v-if =" status===5" :contestId =" contestId" v-on:enterProblem =" enterProblem" ></Contest >
51
57
<Problem v-if =" status===6" :contestId =" contestId" :problemId =" problemId"
52
58
v-on:submitProblem =" submitProblem" v-on:loadProblem =" loadProblem" ></Problem >
59
+ <LocalManager v-if =" status===7" ></LocalManager >
53
60
</el-main >
54
61
</el-container >
55
62
</el-container >
@@ -62,6 +69,7 @@ import Status from "@/components/Status";
62
69
import ContestList from " @/components/ContestList" ;
63
70
import Contest from " @/components/Contest" ;
64
71
import Problem from " @/components/Problem" ;
72
+ import LocalManager from " @/components/LocalManager" ;
65
73
66
74
export default {
67
75
name: " Home" ,
@@ -82,7 +90,8 @@ export default {
82
90
Status,
83
91
ContestList,
84
92
Contest,
85
- Problem
93
+ Problem,
94
+ LocalManager
86
95
},
87
96
88
97
methods: {
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div class =" main" >
3
+ <el-button type =" primary" :disabled =" !account"
4
+ v-on:click =" removeUser" >
5
+ 删除账号信息
6
+ </el-button >
7
+ <el-table :data =" problems"
8
+ style =" width : 100% " >
9
+ <el-table-column
10
+ prop =" id"
11
+ label =" 问题编号"
12
+ align =" center"
13
+ min-width =" 100" >
14
+ </el-table-column >
15
+ <el-table-column
16
+ prop =" memory"
17
+ label =" 占用内存"
18
+ align =" center"
19
+ min-width =" 100" >
20
+ </el-table-column >
21
+ <el-table-column
22
+ label =" 操作"
23
+ align =" center"
24
+ min-width =" 50" >
25
+ <template scope="scope">
26
+ <el-button type =" primary"
27
+ v-on:click =" remove(scope.$index)" >
28
+ 删除缓存
29
+ </el-button >
30
+ </template >
31
+ </el-table-column >
32
+ </el-table >
33
+ </div >
34
+ </template >
35
+
36
+ <script >
37
+ export default {
38
+ name: " LocalManager" ,
39
+
40
+ data () {
41
+ return {
42
+ account: false ,
43
+ problems: []
44
+ }
45
+ },
46
+
47
+ created () {
48
+ if (window .localStorage .getItem (' email' ) != null )
49
+ this .account = true
50
+ if (window .localStorage .savedProblem != null ) {
51
+ let problemList = window .localStorage .savedProblem
52
+ problemList = problemList .split (' ;' )
53
+ for (let i = 0 ; i < problemList .length - 1 ; ++ i) {
54
+ let pro = {
55
+ id: problemList[i],
56
+ memory: window .localStorage .getItem (problemList[i]).length / 1024 + ' KB'
57
+ }
58
+ this .problems .push (pro)
59
+ }
60
+ }
61
+ },
62
+
63
+ methods: {
64
+ remove (index ) {
65
+ window .localStorage .removeItem (this .problems [index].id )
66
+ window .localStorage .savedProblem = window .localStorage .savedProblem .replace (this .problems [index].id + ' ;' , ' ' )
67
+ this .useLocalStorage = false
68
+ this .problems .splice (index, 1 )
69
+ },
70
+
71
+ removeUser () {
72
+ window .localStorage .removeItem (' email' );
73
+ window .localStorage .removeItem (' password' );
74
+ this .account = false
75
+ }
76
+ }
77
+ }
78
+ </script >
79
+
80
+ <style scoped>
81
+
82
+ </style >
You can’t perform that action at this time.
0 commit comments