Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
陆宇天
/
config-center-front
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 819cde58
authored
Nov 08, 2023
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复bug
1 parent
a0316b2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
10 deletions
src/views/projectApi/AddApi.vue
src/views/projectApi/ApiList.vue
src/views/projectApi/AddApi.vue
View file @
819cde5
...
...
@@ -182,12 +182,37 @@ export default defineComponent({
};
//保存代码
const
saveCodeFn
=
async
()
=>
{
if
(
!
url
.
value
||
!
remark
.
value
||
!
businessType
.
value
&&
businessType
.
value
!=
'0'
||
!
editorContent
.
value
)
{
// if (!url.value || !remark.value || !businessType.value && businessType.value != '0' || !editorContent.value) {
// return ElMessage({
// message: "请把信息补充完整",
// type: "error",
// });
// }
if
(
!
url
.
value
)
{
return
ElMessage
({
message
:
"请把信息补充完整"
,
message
:
"请把
url
信息补充完整"
,
type
:
"error"
,
});
}
if
(
!
remark
.
value
)
{
return
ElMessage
({
message
:
"请把备注信息补充完整"
,
type
:
"error"
,
});
}
if
(
!
businessType
.
value
&&
businessType
.
value
!=
'0'
)
{
return
ElMessage
({
message
:
"请把业务类型信息补充完整"
,
type
:
"error"
,
});
}
if
(
!
editorContent
.
value
)
{
return
ElMessage
({
message
:
"请把编辑器信息补充完整"
,
type
:
"error"
,
});
}
// 校验代码的有效性
try
{
// eslint-disable-next-line @typescript-eslint/no-unused-vars
...
...
@@ -206,8 +231,8 @@ export default defineComponent({
username
:
userInfo
.
name
,
businessType
:
businessType
.
value
};
let
{
code
}
=
await
projectApiAdd
(
params
);
if
(
code
===
200
)
{
const
res
=
await
projectApiAdd
(
params
);
if
(
res
.
code
===
200
)
{
requestAnimationFrame
(()
=>
{
// router.push({
// name: "apilist",
...
...
@@ -222,6 +247,11 @@ export default defineComponent({
type
:
"success"
,
message
:
"保存成功"
,
});
}
else
if
(
res
.
code
as
unknown
as
string
==
'-1'
)
{
ElMessage
({
type
:
"error"
,
message
:
'该配置已存在'
,
})
}
}
else
{
//编辑
...
...
@@ -234,8 +264,8 @@ export default defineComponent({
username
:
userInfo
.
name
,
businessType
:
businessType
.
value
}
as
ProjectApi
;
let
{
code
}
=
await
projectApiEdit
(
params
);
if
(
code
===
200
)
{
const
res
=
await
projectApiEdit
(
params
);
if
(
res
.
code
===
200
)
{
requestAnimationFrame
(()
=>
{
// router.push({
// name: "apilist",
...
...
@@ -250,6 +280,11 @@ export default defineComponent({
type
:
"success"
,
message
:
"保存成功"
,
});
}
else
if
(
res
.
code
as
unknown
as
string
==
'-2'
)
{
ElMessage
({
type
:
"error"
,
message
:
'url已存在'
,
})
}
}
}
catch
(
error
)
{
...
...
src/views/projectApi/ApiList.vue
View file @
819cde5
...
...
@@ -3,18 +3,18 @@
* @Author: huyue
* @Date: 2023-01-30 16:10:23
* @LastEditors: huyue
* @LastEditTime: 2023-11-0
2 14:16:49
* @LastEditTime: 2023-11-0
8 14:43:45
-->
<
template
>
<div
class=
"api-list"
>
<h3>
{{
routerParams
.
baseUrl
}}
项目接口
</h3>
<div
class=
"search-item"
>
<el-form
:inline=
"true"
:model=
"apiData"
label-width=
"120px"
>
<el-form-item
label=
"
业务类型
"
>
<el-form-item
label=
"
url
"
>
<el-input
class=
"search-input"
v-model=
"apiData.urlInput"
clearable
placeholder=
"请输入url"
/>
</el-form-item>
<el-form-item
label=
"业务类型"
>
<el-select
v-model=
"apiData.businessType"
cl
ass=
"m-2"
placeholder=
"Select
"
>
<el-select
v-model=
"apiData.businessType"
cl
earable
class=
"m-2"
placeholder=
"请选择
"
>
<el-option
v-for=
"item in businessTypeList"
:key=
"item.value"
...
...
@@ -25,6 +25,7 @@
</el-form-item>
<el-form-item>
<el-button
class=
"search-button"
@
click=
"search"
type=
"primary"
>
查询
</el-button>
<el-button
class=
"search-button"
@
click=
"reset"
type=
"primary"
>
重置
</el-button>
<el-button
class=
"search-button"
:isDisabled=
"disabled"
v-preventReClick
@
click=
"addFn"
type=
"primary"
>
新建
</el-button>
</el-form-item>
</el-form>
...
...
@@ -229,7 +230,7 @@ export default {
projectId
:
routerParams
.
projectId
,
},
apiData
.
pager
)
if
(
url
)
params
.
url
=
url
;
if
(
businessType
)
params
.
businessType
=
businessType
params
.
businessType
=
businessType
console
.
log
(
params
)
let
{
code
,
data
}
=
await
getProjectApiList
(
params
);
if
(
code
===
200
)
{
...
...
@@ -240,6 +241,12 @@ export default {
const
search
=
()
=>
{
getdata
();
};
const
reset
=
()
=>
{
apiData
.
urlInput
=
''
apiData
.
businessType
=
''
search
()
}
// 页码切换
const
currentChange
=
(
value
:
number
)
=>
{
console
.
log
(
value
);
...
...
@@ -402,6 +409,7 @@ export default {
addFn
,
disabled
,
search
,
reset
,
currentChange
,
copy
,
businessTypeObj
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment