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 4a01eb70
authored
Jun 07, 2023
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化
1 parent
be35ede5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
13 deletions
auto-imports.d.ts
components.d.ts
src/views/condition/ConditionEditor.vue
src/views/project/AddProject.vue
src/views/project/Project.vue
src/views/projectApi/AddApi.vue
auto-imports.d.ts
View file @
4a01eb7
...
...
@@ -15,6 +15,7 @@ declare global {
const
ElPagination
:
typeof
import
(
'element-plus/es'
)[
'ElPagination'
]
const
ElRow
:
typeof
import
(
'element-plus/es'
)[
'ElRow'
]
const
ElSelect
:
typeof
import
(
'element-plus/es'
)[
'ElSelect'
]
const
ElSwitch
:
typeof
import
(
'element-plus/es'
)[
'ElSwitch'
]
const
ElTable
:
typeof
import
(
'element-plus/es'
)[
'ElTable'
]
const
ElTableColumn
:
typeof
import
(
'element-plus/es'
)[
'ElTableColumn'
]
}
...
...
components.d.ts
View file @
4a01eb7
...
...
@@ -22,6 +22,7 @@ declare module '@vue/runtime-core' {
ElPagination
:
typeof
import
(
'element-plus/es'
)[
'ElPagination'
]
ElRow
:
typeof
import
(
'element-plus/es'
)[
'ElRow'
]
ElSelect
:
typeof
import
(
'element-plus/es'
)[
'ElSelect'
]
ElSwitch
:
typeof
import
(
'element-plus/es'
)[
'ElSwitch'
]
ElTable
:
typeof
import
(
'element-plus/es'
)[
'ElTable'
]
ElTableColumn
:
typeof
import
(
'element-plus/es'
)[
'ElTableColumn'
]
HelloWorld
:
typeof
import
(
'./src/components/HelloWorld.vue'
)[
'default'
]
...
...
src/views/condition/ConditionEditor.vue
View file @
4a01eb7
...
...
@@ -78,7 +78,11 @@ import "element-plus/theme-chalk/el-message-box.css";
import
{
useRouter
,
onBeforeRouteLeave
}
from
"vue-router"
;
import
{
conditionEdit
}
from
"@/api/condition"
;
import
{
ConditionItem
}
from
"@/type"
;
interface
OptionType
{
label
:
string
;
value
:
string
;
isPro
:
boolean
}
export
default
defineComponent
({
name
:
"AddApi"
,
// props: {
...
...
@@ -96,8 +100,9 @@ export default defineComponent({
const
editorName
=
ref
(
""
);
const
editorIp
=
ref
(
""
);
const
editorEnv
=
ref
(
""
);
const
options
=
ref
<
{
label
:
string
;
value
:
string
}[]
>
([]);
options
.
value
=
JSON
.
parse
(
sessionStorage
.
getItem
(
"envOption"
)
||
"[]"
);
const
options
=
ref
<
OptionType
[]
>
([]);
const
allOptions
=
JSON
.
parse
(
sessionStorage
.
getItem
(
"envOption"
)
||
"[]"
)
// options.value = JSON.parse(sessionStorage.getItem("envOption") || "[]");
//获取路由参数(编辑的情况)
let
storageEditItem
=
...
...
@@ -105,6 +110,10 @@ export default defineComponent({
JSON
.
parse
(
window
.
sessionStorage
.
getItem
(
"conditionItem"
)
||
""
);
let
routerParams
=
storageEditItem
||
{};
let
keysLength
=
Object
.
keys
(
routerParams
).
length
;
// 过滤生产环境和非生产环境
options
.
value
=
allOptions
.
filter
((
i
:
OptionType
)
=>
{
return
routerParams
.
id
==
1
?
i
.
isPro
:
!
i
.
isPro
})
if
(
keysLength
>
0
)
{
//编辑
editorContent
.
value
=
routerParams
.
content
as
string
;
...
...
src/views/project/AddProject.vue
View file @
4a01eb7
...
...
@@ -19,6 +19,9 @@
<template
#
prepend
>
/
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"是否是生产环境"
prop=
"isPro"
>
<el-switch
v-model=
"ruleForm.isPro"
/>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model=
"ruleForm.remark"
type=
"textarea"
/>
</el-form-item>
...
...
@@ -64,6 +67,7 @@ export default defineComponent({
const
ruleForm
=
reactive
({
name
:
""
,
addr
:
""
,
isPro
:
false
,
remark
:
""
,
});
...
...
@@ -78,6 +82,7 @@ export default defineComponent({
ruleForm
.
name
=
routerParams
.
name
as
string
;
ruleForm
.
addr
=
routerParams
.
addr
as
string
;
ruleForm
.
remark
=
routerParams
.
remark
as
string
;
ruleForm
.
isPro
=
routerParams
.
isPro
as
boolean
;
}
const
userInfo
=
window
.
sessionStorage
.
getItem
(
"userInfo"
)
&&
...
...
src/views/project/Project.vue
View file @
4a01eb7
...
...
@@ -225,15 +225,16 @@ export default defineComponent({
//设置test,develop环境选择
const
envOption
=
rows
.
map
((
item
:
ProjectItem
)
=>
{
let
temp
=
{}
as
{
label
:
string
;
value
:
string
};
let
temp
=
{}
as
{
label
:
string
;
value
:
string
;
isPro
:
boolean
};
temp
.
value
=
item
.
name
;
temp
.
label
=
item
.
name
;
temp
.
isPro
=
item
.
isPro
return
temp
;
})
.
filter
(
(
item
:
{
label
:
string
;
value
:
string
})
=>
item
.
label
!==
"production"
);
//
.filter(
//
(item: { label: string; value: string }) =>
//
item.label !== "production"
//
);
sessionStorage
.
setItem
(
"envOption"
,
JSON
.
stringify
(
envOption
));
//获取条件判断
...
...
src/views/projectApi/AddApi.vue
View file @
4a01eb7
...
...
@@ -11,8 +11,8 @@
<div
class=
"rt-content"
>
<h3
class=
"info"
>
接口信息
</h3>
<div
class=
"option"
>
<div
class=
"name"
>
method
</div>
<div
class=
"wrap"
>
<div
class=
"name"
>
method
:get
</div>
<
!--
<
div
class=
"wrap"
>
<el-select
v-model=
"method"
class=
"m-2"
...
...
@@ -25,7 +25,7 @@
:value=
"item.value"
/>
</el-select>
</div>
</div>
-->
</div>
<div
class=
"option"
>
<div
class=
"name"
>
url
</div>
...
...
@@ -57,7 +57,7 @@
<el-button
type=
"warning"
v-preventReClick
@
click=
"$router.
replace('/project'
)"
@
click=
"$router.
go(-1
)"
>
回到首页
</el-button
>
<!-- <el-button type="danger" @click="clearCodeFn">清空代码</el-button> -->
...
...
@@ -87,7 +87,7 @@ export default defineComponent({
const
editorContent
=
ref
(
""
);
const
remark
=
ref
(
""
);
const
url
=
ref
(
""
);
const
method
=
ref
(
""
);
const
method
=
ref
(
"
get
"
);
const
methodsOptions
=
[
{
value
:
"get"
,
...
...
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