Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
vue-kwan-admin
提交
220c9294
V
vue-kwan-admin
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
vue-kwan-admin
通知
39
Star
6
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-kwan-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
220c9294
编写于
10月 07, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
整理
上级
3fcd93c2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
283 addition
and
281 deletion
+283
-281
src/components/menus/MyAlgorithmic.vue
src/components/menus/MyAlgorithmic.vue
+283
-281
未找到文件。
src/components/menus/MyAlgorithmic.vue
浏览文件 @
220c9294
...
...
@@ -161,296 +161,298 @@
<
script
>
import
axios
from
'
axios
'
export
default
{
name
:
'
MyInterview
'
,
name
:
'
MyInterview
'
,
data
()
{
return
{
// 用户列表数据
algorithmicList
:
[],
randomAlgorithmic
:
{
questionName
:
''
,
leetcodeNumber
:
''
,
leetcodeLink
:
''
,
},
loading
:
false
,
elementui_page_component_key
:
0
,
currentPage
:
Number
(
localStorage
.
getItem
(
'
lastPage
'
))
||
1
,
pageSize
:
9
,
total
:
0
,
formInline
:
{
questionName
:
''
,
},
options
:
[],
allOptions
:
[],
questionType
:
0
,
// 新增的内容
dialogFormVisible
:
false
,
randomFormVisible
:
false
,
dialogMutiFormVisible
:
false
,
form
:
{
questionName
:
''
,
questionType
:
0
,
degreeOfImportance
:
5
,
degreeOfDifficulty
:
1
,
difficultyOfScore
:
1200
,
leetcodeNumber
:
''
,
leetcodeLink
:
''
,
},
formLabelWidth
:
'
120px
'
,
dialogVisible
:
false
,
editVisible
:
false
,
currentRowId
:
null
,
}
},
watch
:
{
'
formInline.questionName
'
(
newVal
)
{
if
(
newVal
===
''
)
{
this
.
currentPage
=
1
localStorage
.
setItem
(
'
lastPage
'
,
this
.
currentPage
)
this
.
interviewPage
()
}
},
},
created
()
{
//获取问题类型的枚举
this
.
getQuestionType
()
//获取问题类型的枚举
this
.
getAllQuestionType
()
//获取问题列表
this
.
interviewPage
()
},
mounted
()
{},
methods
:
{
prepareAdd
()
{
this
.
form
.
questionName
=
''
this
.
form
.
questionType
=
0
this
.
dialogFormVisible
=
true
},
prepareRandom
()
{
this
.
randomAlgorithmic
=
[]
this
.
randomFormVisible
=
true
this
.
interviewRandom
()
},
prepareMutiAdd
()
{
this
.
form
.
questionName
=
''
this
.
form
.
questionType
=
0
this
.
dialogMutiFormVisible
=
true
},
data
()
{
return
{
// 用户列表数据
algorithmicList
:
[],
randomAlgorithmic
:
{
questionName
:
''
,
leetcodeNumber
:
''
,
leetcodeLink
:
''
,
},
loading
:
false
,
elementui_page_component_key
:
0
,
currentPage
:
Number
(
localStorage
.
getItem
(
'
lastPage
'
))
||
1
,
pageSize
:
9
,
total
:
0
,
formInline
:
{
questionName
:
''
,
},
options
:
[],
allOptions
:
[],
questionType
:
0
,
// 新增的内容
dialogFormVisible
:
false
,
randomFormVisible
:
false
,
dialogMutiFormVisible
:
false
,
form
:
{
questionName
:
''
,
questionType
:
0
,
degreeOfImportance
:
5
,
degreeOfDifficulty
:
1
,
difficultyOfScore
:
1200
,
leetcodeNumber
:
''
,
leetcodeLink
:
''
,
},
formLabelWidth
:
'
120px
'
,
dialogVisible
:
false
,
editVisible
:
false
,
currentRowId
:
null
,
}
},
watch
:
{
'
formInline.questionName
'
(
newVal
)
{
if
(
newVal
===
''
)
{
this
.
currentPage
=
1
localStorage
.
setItem
(
'
lastPage
'
,
this
.
currentPage
)
this
.
interviewPage
()
}
},
},
created
()
{
//获取问题类型的枚举
this
.
getQuestionType
()
//获取问题类型的枚举
this
.
getAllQuestionType
()
//获取问题列表
this
.
interviewPage
()
},
mounted
()
{},
methods
:
{
prepareAdd
()
{
this
.
form
.
questionName
=
''
this
.
form
.
questionType
=
0
this
.
dialogFormVisible
=
true
//获取问题类型的枚举
this
.
getAllQuestionType
()
},
prepareRandom
()
{
this
.
randomAlgorithmic
=
[]
this
.
randomFormVisible
=
true
this
.
interviewRandom
()
},
prepareMutiAdd
()
{
this
.
form
.
questionName
=
''
this
.
form
.
questionType
=
0
this
.
dialogMutiFormVisible
=
true
},
prepareDelete
(
id
)
{
this
.
currentRowId
=
id
this
.
dialogVisible
=
true
},
preEdit
(
id
,
questionName
,
questionTypeName
,
degreeOfImportance
,
degreeOfDifficulty
,
difficultyOfScore
,
leetcodeNumber
,
leetcodeLink
)
{
this
.
form
.
questionName
=
questionName
this
.
form
.
degreeOfImportance
=
degreeOfImportance
this
.
form
.
degreeOfDifficulty
=
degreeOfDifficulty
this
.
form
.
difficultyOfScore
=
difficultyOfScore
this
.
form
.
leetcodeNumber
=
leetcodeNumber
this
.
form
.
leetcodeLink
=
leetcodeLink
prepareDelete
(
id
)
{
this
.
currentRowId
=
id
this
.
dialogVisible
=
true
},
preEdit
(
id
,
questionName
,
questionTypeName
,
degreeOfImportance
,
degreeOfDifficulty
,
difficultyOfScore
,
leetcodeNumber
,
leetcodeLink
)
{
this
.
form
.
questionName
=
questionName
this
.
form
.
degreeOfImportance
=
degreeOfImportance
this
.
form
.
degreeOfDifficulty
=
degreeOfDifficulty
this
.
form
.
difficultyOfScore
=
difficultyOfScore
this
.
form
.
leetcodeNumber
=
leetcodeNumber
this
.
form
.
leetcodeLink
=
leetcodeLink
// 定义一个映射(map)来存储 questionType 到 name 的转换
const
questionTypeToNameMap
=
{}
this
.
options
.
forEach
((
option
)
=>
{
questionTypeToNameMap
[
option
.
name
]
=
option
.
questionType
})
this
.
form
.
questionType
=
questionTypeToNameMap
[
questionTypeName
]
this
.
currentRowId
=
id
this
.
editVisible
=
true
},
handleClose
(
done
)
{
this
.
$confirm
(
'
确认关闭?
'
)
.
then
((
_
)
=>
{
done
()
})
.
catch
((
_
)
=>
{})
},
handleConfirm
(
addType
)
{
this
.
dialogFormVisible
=
false
// 关闭对话框
this
.
dialogMutiFormVisible
=
false
this
.
addQuestion
(
addType
)
// 发送请求
},
// 定义一个映射(map)来存储 questionType 到 name 的转换
const
questionTypeToNameMap
=
{}
this
.
options
.
forEach
((
option
)
=>
{
questionTypeToNameMap
[
option
.
name
]
=
option
.
questionType
})
this
.
form
.
questionType
=
questionTypeToNameMap
[
questionTypeName
]
this
.
currentRowId
=
id
this
.
editVisible
=
true
},
handleClose
(
done
)
{
this
.
$confirm
(
'
确认关闭?
'
)
.
then
((
_
)
=>
{
done
()
})
.
catch
((
_
)
=>
{})
},
handleConfirm
(
addType
)
{
this
.
dialogFormVisible
=
false
// 关闭对话框
this
.
dialogMutiFormVisible
=
false
this
.
addQuestion
(
addType
)
// 发送请求
},
async
addQuestion
(
addType
)
{
try
{
this
.
loading
=
true
const
{
data
:
res
}
=
await
axios
.
post
(
'
http://120.79.36.53:8888/algorithmicProblem/add
'
,
{
addType
:
addType
,
questionName
:
this
.
form
.
questionName
,
questionType
:
this
.
form
.
questionType
,
degreeOfImportance
:
this
.
form
.
degreeOfImportance
,
degreeOfDifficulty
:
this
.
form
.
degreeOfDifficulty
,
difficultyOfScore
:
this
.
form
.
difficultyOfScore
,
leetcodeNumber
:
this
.
form
.
leetcodeNumber
,
leetcodeLink
:
this
.
form
.
leetcodeLink
,
})
if
(
res
.
code
===
200
)
{
this
.
form
.
questionName
=
''
this
.
form
.
questionType
=
0
this
.
form
.
degreeOfImportance
=
5
this
.
form
.
degreeOfDifficulty
=
1
this
.
form
.
difficultyOfScore
=
1200
this
.
form
.
leetcodeNumber
=
''
this
.
form
.
leetcodeLink
=
''
this
.
getQuestionType
()
this
.
interviewPage
()
}
else
{
console
.
error
(
'
Received non-200 status code
'
,
res
)
this
.
errorMsg
(
res
.
message
)
}
}
catch
(
error
)
{
console
.
error
(
'
An error occurred while adding the questionName:
'
,
error
)
// 异常处理逻辑
}
finally
{
this
.
loading
=
false
}
},
errorMsg
(
msg
)
{
this
.
$message
({
showClose
:
true
,
message
:
msg
,
type
:
'
error
'
,
})
},
async
editConfirm
()
{
try
{
this
.
loading
=
true
const
{
data
:
res
}
=
await
axios
.
post
(
'
http://120.79.36.53:8888/algorithmicProblem/update
'
,
{
id
:
this
.
currentRowId
,
questionName
:
this
.
form
.
questionName
,
questionType
:
this
.
form
.
questionType
,
degreeOfImportance
:
this
.
form
.
degreeOfImportance
,
degreeOfDifficulty
:
this
.
form
.
degreeOfDifficulty
,
difficultyOfScore
:
this
.
form
.
difficultyOfScore
,
leetcodeNumber
:
this
.
form
.
leetcodeNumber
,
leetcodeLink
:
this
.
form
.
leetcodeLink
,
})
if
(
res
.
code
===
200
)
{
this
.
form
.
questionName
=
''
this
.
form
.
questionType
=
0
this
.
editVisible
=
false
currentRowId
:
null
this
.
getQuestionType
()
this
.
interviewPage
()
// 确保这个方法是有效的
}
else
{
console
.
error
(
'
Received non-200 status code
'
,
res
)
}
}
catch
(
error
)
{
console
.
error
(
'
An error occurred while adding the questionName:
'
,
error
)
// 异常处理逻辑
}
finally
{
this
.
loading
=
false
}
},
async
addQuestion
(
addType
)
{
try
{
this
.
loading
=
true
const
{
data
:
res
}
=
await
axios
.
post
(
'
http://120.79.36.53:8888/algorithmicProblem/add
'
,
{
addType
:
addType
,
questionName
:
this
.
form
.
questionName
,
questionType
:
this
.
form
.
questionType
,
degreeOfImportance
:
this
.
form
.
degreeOfImportance
,
degreeOfDifficulty
:
this
.
form
.
degreeOfDifficulty
,
difficultyOfScore
:
this
.
form
.
difficultyOfScore
,
leetcodeNumber
:
this
.
form
.
leetcodeNumber
,
leetcodeLink
:
this
.
form
.
leetcodeLink
,
})
if
(
res
.
code
===
200
)
{
this
.
form
.
questionName
=
''
this
.
form
.
questionType
=
0
this
.
form
.
degreeOfImportance
=
5
this
.
form
.
degreeOfDifficulty
=
1
this
.
form
.
difficultyOfScore
=
1200
this
.
form
.
leetcodeNumber
=
''
this
.
form
.
leetcodeLink
=
''
this
.
getQuestionType
()
this
.
interviewPage
()
}
else
{
console
.
error
(
'
Received non-200 status code
'
,
res
)
this
.
errorMsg
(
res
.
message
)
}
}
catch
(
error
)
{
console
.
error
(
'
An error occurred while adding the questionName:
'
,
error
)
// 异常处理逻辑
}
finally
{
this
.
loading
=
false
}
},
errorMsg
(
msg
)
{
this
.
$message
({
showClose
:
true
,
message
:
msg
,
type
:
'
error
'
,
})
},
async
editConfirm
()
{
try
{
this
.
loading
=
true
const
{
data
:
res
}
=
await
axios
.
post
(
'
http://120.79.36.53:8888/algorithmicProblem/update
'
,
{
id
:
this
.
currentRowId
,
questionName
:
this
.
form
.
questionName
,
questionType
:
this
.
form
.
questionType
,
degreeOfImportance
:
this
.
form
.
degreeOfImportance
,
degreeOfDifficulty
:
this
.
form
.
degreeOfDifficulty
,
difficultyOfScore
:
this
.
form
.
difficultyOfScore
,
leetcodeNumber
:
this
.
form
.
leetcodeNumber
,
leetcodeLink
:
this
.
form
.
leetcodeLink
,
})
if
(
res
.
code
===
200
)
{
this
.
form
.
questionName
=
''
this
.
form
.
questionType
=
0
this
.
editVisible
=
false
currentRowId
:
null
this
.
getQuestionType
()
this
.
interviewPage
()
// 确保这个方法是有效的
}
else
{
console
.
error
(
'
Received non-200 status code
'
,
res
)
}
}
catch
(
error
)
{
console
.
error
(
'
An error occurred while adding the questionName:
'
,
error
)
// 异常处理逻辑
}
finally
{
this
.
loading
=
false
}
},
async
onDelete
(
id
)
{
this
.
dialogVisible
=
false
this
.
loading
=
true
const
{
data
:
res
}
=
await
axios
.
get
(
'
http://120.79.36.53:8888/algorithmicProblem/delete
'
,
{
params
:
{
id
:
id
,
},
})
this
.
interviewPage
()
this
.
loading
=
false
},
refreshPage
()
{
//获取问题类型的枚举
this
.
getQuestionType
()
location
.
reload
()
},
async
onDelete
(
id
)
{
this
.
dialogVisible
=
false
this
.
loading
=
true
const
{
data
:
res
}
=
await
axios
.
get
(
'
http://120.79.36.53:8888/algorithmicProblem/delete
'
,
{
params
:
{
id
:
id
,
},
})
this
.
interviewPage
()
this
.
loading
=
false
},
refreshPage
()
{
//获取问题类型的枚举
this
.
getQuestionType
()
location
.
reload
()
},
async
getQuestionType
()
{
const
{
data
:
res
}
=
await
axios
.
get
(
'
http://120.79.36.53:8888/algorithmicProblem/questionType
'
,
{
params
:
{}
})
if
(
res
.
code
===
200
)
{
this
.
options
=
res
.
result
}
},
async
getQuestionType
()
{
const
{
data
:
res
}
=
await
axios
.
get
(
'
http://120.79.36.53:8888/algorithmicProblem/questionType
'
,
{
params
:
{}
})
if
(
res
.
code
===
200
)
{
this
.
options
=
res
.
result
}
},
async
getAllQuestionType
()
{
const
{
data
:
res
}
=
await
axios
.
get
(
'
http://120.79.36.53:8888/algorithmicProblem/allQuestionType
'
,
{
params
:
{}
})
if
(
res
.
code
===
200
)
{
this
.
allOptions
=
res
.
result
}
},
async
getAllQuestionType
()
{
const
{
data
:
res
}
=
await
axios
.
get
(
'
http://120.79.36.53:8888/algorithmicProblem/allQuestionType
'
,
{
params
:
{}
})
if
(
res
.
code
===
200
)
{
this
.
allOptions
=
res
.
result
}
},
async
interviewPage
()
{
this
.
loading
=
true
const
{
data
:
res
}
=
await
axios
.
get
(
'
http://120.79.36.53:8888/algorithmicProblem/page
'
,
{
params
:
{
page
:
this
.
currentPage
,
pageSize
:
this
.
pageSize
,
questionName
:
this
.
formInline
.
questionName
,
questionType
:
this
.
questionType
,
},
})
if
(
res
.
code
===
200
)
{
this
.
total
=
res
.
result
.
totalElements
// 定义一个映射(map)来存储 questionType 到 name 的转换
const
questionTypeToNameMap
=
{}
this
.
options
.
forEach
((
option
)
=>
{
questionTypeToNameMap
[
option
.
questionType
]
=
option
.
name
})
// 修改 algorithmicList 中的每一个元素,将 questionType 转换为 name
res
.
result
.
content
.
forEach
((
item
)
=>
{
item
.
questionTypeName
=
questionTypeToNameMap
[
item
.
questionType
]
||
'
Unknown
'
})
this
.
algorithmicList
=
res
.
result
.
content
}
this
.
loading
=
false
},
async
interviewRandom
()
{
this
.
loading
=
true
const
{
data
:
res
}
=
await
axios
.
get
(
'
http://120.79.36.53:8888/algorithmicProblem/random
'
,
{
params
:
{}
})
if
(
res
.
code
===
200
)
{
this
.
randomAlgorithmic
.
questionName
=
res
.
result
.
questionName
this
.
randomAlgorithmic
.
leetcodeNumber
=
res
.
result
.
leetcodeNumber
this
.
randomAlgorithmic
.
leetcodeLink
=
res
.
result
.
leetcodeLink
}
this
.
loading
=
false
},
getClassForValue
(
value
)
{
if
(
value
===
'
链表
'
)
{
return
'
reddish-purple-value
'
}
else
if
(
value
===
'
数组
'
)
{
return
'
new-orange-value
'
}
else
if
(
value
===
'
二叉树
'
)
{
return
'
clove-tea-value
'
}
else
if
(
value
===
'
贪心
'
)
{
return
'
grassy-value
'
}
else
if
(
value
===
'
动态规划
'
)
{
return
'
daylily-value
'
}
// } else if (value === 'Redis') {
// return 'balloon-flower-value'
// } else if (value === '中间件') {
// return 'pink-value'
// } else if (value === 'Spring') {
// return 'purple-value'
// } else if (value === '微服务') {
// return 'sapphire-blue-value'
// } else if (value === '分布式') {
// return 'green-value'
// } else if (value === '项目') {
// return 'black-value'
// } else if (value === '算法') {
// return 'rose-hermosa-value'
// } else if (value === '反问环节') {
// return 'white-dress-value'
// } else if (value === '设计模式') {
// return 'prunus-gracilis-value'
// } else if (value === '其他') {
// return 'magenta-value'
else
{
return
'
dark-blue-value
'
}
},
async
interviewPage
()
{
this
.
loading
=
true
const
{
data
:
res
}
=
await
axios
.
get
(
'
http://120.79.36.53:8888/algorithmicProblem/page
'
,
{
params
:
{
page
:
this
.
currentPage
,
pageSize
:
this
.
pageSize
,
questionName
:
this
.
formInline
.
questionName
,
questionType
:
this
.
questionType
,
},
})
if
(
res
.
code
===
200
)
{
this
.
total
=
res
.
result
.
totalElements
// 定义一个映射(map)来存储 questionType 到 name 的转换
const
questionTypeToNameMap
=
{}
this
.
options
.
forEach
((
option
)
=>
{
questionTypeToNameMap
[
option
.
questionType
]
=
option
.
name
})
// 修改 algorithmicList 中的每一个元素,将 questionType 转换为 name
res
.
result
.
content
.
forEach
((
item
)
=>
{
item
.
questionTypeName
=
questionTypeToNameMap
[
item
.
questionType
]
||
'
Unknown
'
})
this
.
algorithmicList
=
res
.
result
.
content
}
this
.
loading
=
false
},
async
interviewRandom
()
{
this
.
loading
=
true
const
{
data
:
res
}
=
await
axios
.
get
(
'
http://120.79.36.53:8888/algorithmicProblem/random
'
,
{
params
:
{}
})
if
(
res
.
code
===
200
)
{
this
.
randomAlgorithmic
.
questionName
=
res
.
result
.
questionName
this
.
randomAlgorithmic
.
leetcodeNumber
=
res
.
result
.
leetcodeNumber
this
.
randomAlgorithmic
.
leetcodeLink
=
res
.
result
.
leetcodeLink
}
this
.
loading
=
false
},
getClassForValue
(
value
)
{
if
(
value
===
'
链表
'
)
{
return
'
reddish-purple-value
'
}
else
if
(
value
===
'
数组
'
)
{
return
'
new-orange-value
'
}
else
if
(
value
===
'
二叉树
'
)
{
return
'
clove-tea-value
'
}
else
if
(
value
===
'
贪心
'
)
{
return
'
grassy-value
'
}
else
if
(
value
===
'
动态规划
'
)
{
return
'
daylily-value
'
}
// } else if (value === 'Redis') {
// return 'balloon-flower-value'
// } else if (value === '中间件') {
// return 'pink-value'
// } else if (value === 'Spring') {
// return 'purple-value'
// } else if (value === '微服务') {
// return 'sapphire-blue-value'
// } else if (value === '分布式') {
// return 'green-value'
// } else if (value === '项目') {
// return 'black-value'
// } else if (value === '算法') {
// return 'rose-hermosa-value'
// } else if (value === '反问环节') {
// return 'white-dress-value'
// } else if (value === '设计模式') {
// return 'prunus-gracilis-value'
// } else if (value === '其他') {
// return 'magenta-value'
else
{
return
'
dark-blue-value
'
}
},
handleCurrentChange
(
currentPage
)
{
this
.
currentPage
=
currentPage
this
.
interviewPage
()
},
},
handleCurrentChange
(
currentPage
)
{
this
.
currentPage
=
currentPage
this
.
interviewPage
()
},
},
}
</
script
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录