Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api-gateway
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
API
api-gateway
Commits
691a6922
Commit
691a6922
authored
Mar 12, 2021
by
shaojiawen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:创建事件通知
parent
8c59eff0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
181 deletions
+60
-181
api-version-show.vue
src/components/api/api-version-show.vue
+30
-0
version-list.vue
src/components/api/version-list.vue
+5
-1
create-event-base.vue
src/components/createApi/create-event-base.vue
+10
-157
create-event-field.vue
src/components/createApi/create-event-field.vue
+0
-0
result-table.vue
src/components/createApi/result-table.vue
+4
-1
store.js
src/store/store.js
+7
-0
apiList.vue
src/views/index/apiList.vue
+1
-1
createEventApi.vue
src/views/index/createEventApi.vue
+2
-20
groupApiList.vue
src/views/index/groupApiList.vue
+1
-1
No files found.
src/components/api/api-version-show.vue
View file @
691a6922
...
...
@@ -88,6 +88,36 @@ import apiVersionShow from '@/components/api/api-version-show.vue';
</div>
</div>
</div>
<!--
<div
class=
"anchor-wrap"
>
<div
class=
"el-tabs el-tabs--right"
>
<div
class=
"el-tabs__header is-right"
>
<div
class=
"el-tabs__nav-wrap is-right"
>
<div
class=
"el-tabs__nav-scroll"
>
<div
role=
"tablist"
class=
"el-tabs__nav is-right"
style=
"transform: translateY(0px);"
>
<div
class=
"el-tabs__active-bar is-right"
:style=
"
{ transform: `translateY(${activeInfo * 24}px)`, height: '24px' }" />
<div
id=
"tab-0"
:class=
"['el-tabs__item h-24 is-right', activeInfo == 0 ? 'is-active' : '']"
@
click=
"goAuthor('#base', 0)"
>
基础配置
</div>
<div
id=
"tab-1"
:class=
"['el-tabs__item h-24 is-right', activeInfo == 1 ? 'is-active' : '']"
@
click=
"goAuthor('#frontend', 1)"
>
前端配置
</div>
</div>
</div>
</div>
</div>
</div>
</div>
-->
<div
id=
"base"
class=
"base-info-wrap info-wrap"
>
...
...
src/components/api/version-list.vue
View file @
691a6922
...
...
@@ -421,7 +421,11 @@ export default {
*/
handleEdit
(
index
,
row
)
{
const
that
=
this
;
that
.
$router
.
push
(
`/createApi?projectId=
${
row
.
projectId
}
&projectName=
${
that
.
$route
.
query
.
projectName
}
&interfaceGroupId=
${
row
.
interfaceGroupId
}
&interfaceGroupName=
${
that
.
$route
.
query
.
interfaceGroupName
}
&interfaceId=
${
that
.
$route
.
query
.
interfaceId
}
&interfaceName=
${
that
.
$route
.
query
.
interfaceName
}
&interfaceVersionId=
${
row
.
interfaceVersionId
}
`
);
if
(
that
.
$route
.
query
.
apiType
!=
2
){
that
.
$router
.
push
(
`/createApi?projectId=
${
row
.
projectId
}
&projectName=
${
that
.
$route
.
query
.
projectName
}
&interfaceGroupId=
${
row
.
interfaceGroupId
}
&interfaceGroupName=
${
that
.
$route
.
query
.
interfaceGroupName
}
&interfaceId=
${
that
.
$route
.
query
.
interfaceId
}
&interfaceName=
${
that
.
$route
.
query
.
interfaceName
}
&interfaceVersionId=
${
row
.
interfaceVersionId
}
`
);
return
;
}
that
.
$router
.
push
(
`/createEventApi?projectId=
${
row
.
projectId
}
&projectName=
${
that
.
$route
.
query
.
projectName
}
&interfaceGroupId=
${
row
.
interfaceGroupId
}
&interfaceGroupName=
${
that
.
$route
.
query
.
interfaceGroupName
}
&interfaceId=
${
that
.
$route
.
query
.
interfaceId
}
&interfaceName=
${
that
.
$route
.
query
.
interfaceName
}
&interfaceVersionId=
${
row
.
interfaceVersionId
}
`
);
},
/**
* @description: 下线
...
...
src/components/createApi/create-event-base.vue
View file @
691a6922
...
...
@@ -71,10 +71,8 @@ export default {
interfaceId
:
''
,
interfaceVersionId
:
''
,
interfaceName
:
''
,
// target: '1',
// optType: 'get',
// interfaceUrl: '',
interfaceDescribe
:
''
interfaceDescribe
:
''
,
code
:
''
},
rules
:
{
interfaceName
:
[
{
required
:
true
,
message
:
'请输入API名称'
,
trigger
:
'blur'
}
],
...
...
@@ -85,11 +83,14 @@ export default {
mounted
()
{
const
that
=
this
;
/* eslint-disable */
if
(
that
.
$route
.
query
.
interfaceId
&&
!
Object
.
keys
(
that
.
$store
.
state
.
baseInfo
).
length
)
{
console
.
log
(
that
.
$route
.
query
.
interfaceId
);
console
.
log
(
that
.
$store
.
state
.
baseEventInfo
);
console
.
log
(
Object
.
keys
(
that
.
$store
.
state
.
baseEventInfo
));
if
(
that
.
$route
.
query
.
interfaceId
&&
!
Object
.
keys
(
that
.
$store
.
state
.
baseEventInfo
).
length
)
{
that
.
getData
();
}
if
(
Object
.
keys
(
that
.
$store
.
state
.
baseInfo
).
length
)
{
that
.
apiInfoData
=
that
.
$store
.
state
.
baseInfo
;
if
(
Object
.
keys
(
that
.
$store
.
state
.
base
Event
Info
).
length
)
{
that
.
apiInfoData
=
that
.
$store
.
state
.
base
Event
Info
;
}
},
methods
:
{
...
...
@@ -97,7 +98,6 @@ export default {
const
that
=
this
;
that
.
$refs
[
formName
].
validate
(
valid
=>
{
if
(
valid
)
{
console
.
log
(
that
.
apiInfoData
)
// if (formName == 'baseForm') {
that
.
$emit
(
'submitNext'
,
that
.
apiInfoData
);
that
.
$store
.
dispatch
(
'saveBaseEventInfo'
,
that
.
apiInfoData
);
...
...
@@ -108,146 +108,6 @@ export default {
});
},
/**
* 处理 isRootKey
*/
async
handleArrObjData
(
item
)
{
const
that
=
this
;
for
(
let
childKey
in
item
)
{
item
[
childKey
][
'isRootKey'
]
=
!
item
[
childKey
][
'isRootKey'
]
||
item
[
childKey
][
'isRootKey'
]
==
''
||
item
[
childKey
][
'isRootKey'
]
==
0
?
false
:
true
;
// 是否是后端参数字段
if
(
item
[
childKey
].
type
==
'array'
&&
Object
.
keys
(
item
[
childKey
].
items
.
properties
).
length
)
{
await
that
.
handleArrObjData
(
item
[
childKey
].
items
.
properties
);
}
if
(
item
[
childKey
].
type
==
'object'
&&
Object
.
keys
(
item
[
childKey
].
properties
).
length
)
{
await
that
.
handleArrObjData
(
item
[
childKey
].
properties
);
}
}
return
item
;
},
/**
* 处理数据存入 store
*/
// 前端通用数据处理
async
handleQuery
(
front
,
allData
,
type
)
{
const
that
=
this
;
let
newObj
=
{
type
:
'object'
,
level
:
1
,
properties
:
{}
};
// 最开始处理的时候, frontParams 和 endParams是同一份数据,所有前后端公用一份参数数据
for
(
let
key
in
allData
.
frontParams
.
properties
)
{
if
(
allData
.
frontParams
.
properties
[
key
].
frontOriginType
==
type
&&
!
allData
.
endParams
.
properties
[
key
].
constFlag
)
{
allData
.
frontParams
.
properties
[
key
].
isRootKey
=
allData
.
frontParams
.
properties
[
key
].
isRootKey
==
1
||
allData
.
frontParams
.
properties
[
key
].
isRootKey
==
true
?
true
:
false
;
that
.
$set
(
newObj
.
properties
,
allData
.
frontParams
.
properties
[
key
].
currentKey
,
allData
.
frontParams
.
properties
[
key
]);
}
// 如果有数组出现
if
(
allData
.
frontParams
.
properties
[
key
].
type
==
'array'
&&
Object
.
keys
(
allData
.
frontParams
.
properties
[
key
].
items
.
properties
).
length
)
{
await
that
.
handleArrObjData
(
allData
.
frontParams
.
properties
[
key
].
items
.
properties
,
allData
.
frontParams
.
properties
[
key
].
isRootKey
);
}
// 如果有对象出现
if
(
allData
.
frontParams
.
properties
[
key
].
type
==
'object'
&&
Object
.
keys
(
allData
.
frontParams
.
properties
[
key
].
properties
).
length
)
{
await
that
.
handleArrObjData
(
allData
.
frontParams
.
properties
[
key
].
properties
,
allData
.
frontParams
.
properties
[
key
].
isRootKey
);
}
}
return
newObj
;
},
/**
* 处理常量参数
*/
handleConst
(
back
,
allData
)
{
const
that
=
this
;
let
newObj
=
{
type
:
'object'
,
level
:
1
,
properties
:
{}
};
for
(
let
key
in
allData
.
endParams
.
properties
)
{
if
(
allData
.
endParams
.
properties
[
key
].
constFlag
)
{
allData
.
endParams
.
properties
[
key
].
constFlag
=
allData
.
endParams
.
properties
[
key
].
constFlag
?
true
:
false
;
that
.
$set
(
newObj
.
properties
,
allData
.
endParams
.
properties
[
key
].
currentKey
,
allData
.
endParams
.
properties
[
key
]);
}
}
return
newObj
;
},
/**
* 获取已经保存的数据,处理前端数据
*/
async
handleFrontData
(
data
)
{
const
that
=
this
;
let
allData
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
let
front
=
{
protocol
:
allData
.
protocol
,
requestType
:
allData
.
requestType
,
frontBodyType
:
allData
.
frontBodyType
||
'json'
,
frontParams
:
{},
headerData
:
{},
queryData
:
{},
bodyJsonData
:
{},
bodyFormData
:
{}
};
front
.
queryData
=
await
that
.
handleQuery
(
front
,
allData
,
'query'
);
front
.
headerData
=
await
that
.
handleQuery
(
front
,
allData
,
'header'
);
if
(
allData
.
requestType
==
'POST'
&&
allData
.
frontBodyType
==
'form'
)
{
front
.
bodyFormData
=
await
that
.
handleQuery
(
front
,
allData
,
'form'
);
}
if
(
allData
.
requestType
==
'POST'
&&
allData
.
frontBodyType
==
'json'
)
{
// console.log('body', allData);
front
.
bodyJsonData
=
await
that
.
handleQuery
(
front
,
allData
,
'body'
);
}
// console.log('base:', allData.requestType, allData.frontBodyType, front);
that
.
$store
.
dispatch
(
'saveFrontInfo'
,
front
);
},
/**
* 获取已经保存的数据,处理前端数据
*/
async
handleBackData
(
data
)
{
const
that
=
this
;
let
allData
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
let
back
=
{
interfaceType
:
String
(
allData
.
interfaceType
),
// 后端服务
version
:
allData
.
version
,
// api 版本号
backendRequestType
:
allData
.
backendRequestType
,
backendHttpPath
:
allData
.
backendHttpPath
||
''
,
// 请求路径
dubboInterface
:
allData
.
dubboInterface
||
''
,
// dubbo接口名称
dubboMethod
:
allData
.
dubboMethod
||
''
,
// dubbo请求方法
dubboVersion
:
allData
.
dubboVersion
||
''
,
// dubbo 请求版本号
proxyCode
:
allData
.
proxyCode
||
''
,
// 注册中心
timeout
:
allData
.
timeout
,
// 超时
backHeaderData
:
{},
backQueryData
:
{},
backBodyJsonData
:
{},
backBodyFormData
:
{},
constData
:
{}
};
back
.
backQueryData
=
await
that
.
handleQuery
(
back
,
allData
,
'query'
);
back
.
backHeaderData
=
await
that
.
handleQuery
(
back
,
allData
,
'header'
);
if
(
allData
.
requestType
==
'POST'
&&
allData
.
frontBodyType
==
'form'
)
{
back
.
backBodyFormData
=
await
that
.
handleQuery
(
back
,
allData
,
'form'
);
}
if
(
allData
.
requestType
==
'POST'
&&
allData
.
frontBodyType
==
'json'
)
{
back
.
backBodyJsonData
=
await
that
.
handleQuery
(
back
,
allData
,
'body'
);
}
// console.log('back:', back);
// 常量
back
.
constData
=
await
that
.
handleConst
(
back
,
allData
);
that
.
$store
.
dispatch
(
'saveBackInfo'
,
back
);
},
handleResultData
(
data
)
{
const
that
=
this
;
let
allData
=
JSON
.
parse
(
JSON
.
stringify
(
data
));
let
result
=
{
resultParams
:
allData
.
resultParams
,
sucReturn
:
allData
.
sucReturn
,
// 成功返回示例
errReturn
:
allData
.
errReturn
,
// 失败返回示例
// 错误码
errCode
:
allData
.
errCode
,
// 场景 code
sceneCode
:
allData
.
sceneCode
};
// console.log(result);
that
.
$store
.
dispatch
(
'saveResultInfo'
,
result
);
},
/**
* 获取数据
*/
getData
()
{
...
...
@@ -260,20 +120,13 @@ export default {
.
then
(
res
=>
{
let
resData
=
res
.
data
;
if
(
resData
.
code
==
'0000'
)
{
resData
.
result
.
frontParams
=
JSON
.
parse
(
resData
.
result
.
endParams
);
// 编辑获取的时候使用后端数据
resData
.
result
.
endParams
=
JSON
.
parse
(
resData
.
result
.
endParams
);
// 编辑获取的时候使用后端数据
resData
.
result
.
errCode
=
JSON
.
parse
(
resData
.
result
.
errCode
);
resData
.
result
.
resultParams
=
JSON
.
parse
(
resData
.
result
.
resultParams
);
that
.
apiInfoData
.
interfaceId
=
resData
.
result
.
interfaceId
;
that
.
apiInfoData
.
interfaceVersionId
=
resData
.
result
.
interfaceVersionId
;
that
.
apiInfoData
.
interfaceName
=
resData
.
result
.
interfaceName
;
that
.
apiInfoData
.
target
=
String
(
resData
.
result
.
target
);
that
.
apiInfoData
.
optType
=
resData
.
result
.
optType
;
that
.
apiInfoData
.
interfaceUrl
=
resData
.
result
.
interfaceUrl
;
that
.
apiInfoData
.
code
=
resData
.
result
.
code
;
that
.
apiInfoData
.
interfaceDescribe
=
resData
.
result
.
interfaceDescribe
;
that
.
handleFrontData
(
resData
.
result
);
that
.
handleBackData
(
resData
.
result
);
that
.
handleResultData
(
resData
.
result
);
that
.
$store
.
dispatch
(
'saveFieldEventInfo'
,
resData
.
result
);
that
.
$nextTick
(()
=>
{
that
.
submitForm
(
'baseForm'
);
});
...
...
src/components/createApi/create-event-field.vue
View file @
691a6922
This diff is collapsed.
Click to expand it.
src/components/createApi/result-table.vue
View file @
691a6922
...
...
@@ -22,7 +22,7 @@ import resultTable from '@/components/createApi/result-table.vue';
<div
class=
"cell"
>
<el-input
v-model=
"itemValue.currentKey"
:disabled=
"
itemValue.type == 'array' || itemValue.type == 'object'
"
:disabled=
"
(itemValue.type == 'array' || itemValue.type == 'object')&&!isNotRoot
"
@
blur=
"blurKey(itemValue, itemName)"
/>
</div>
</td>
...
...
@@ -118,6 +118,9 @@ export default {
},
isDescription
:
{
type
:
Boolean
},
isNotRoot
:
{
type
:
Boolean
}
},
data
()
{
...
...
src/store/store.js
View file @
691a6922
...
...
@@ -53,6 +53,9 @@ export default new Vuex.Store({
saveBaseEvent
:
(
state
,
data
)
=>
{
state
.
baseEventInfo
=
data
;
},
saveFieldEvent
:
(
state
,
data
)
=>
{
state
.
fieldEventInfo
=
data
;
},
saveFront
:
(
state
,
data
)
=>
{
state
.
frontInfo
=
data
;
},
...
...
@@ -74,6 +77,7 @@ export default new Vuex.Store({
state
.
backInfo
=
{};
state
.
resultInfo
=
{};
state
.
baseEventInfo
=
{};
state
.
fieldEventInfo
=
{};
},
clearLog
:
state
=>
{
localStorage
.
removeItem
(
'logInfo'
);
...
...
@@ -111,6 +115,9 @@ export default new Vuex.Store({
saveBaseEventInfo
(
context
,
data
)
{
context
.
commit
(
'saveBaseEvent'
,
data
);
},
saveFieldEventInfo
(
context
,
data
)
{
context
.
commit
(
'saveFieldEvent'
,
data
);
},
clearTempBackData
(
context
,
data
)
{
context
.
commit
(
'clearTempBack'
);
},
...
...
src/views/index/apiList.vue
View file @
691a6922
...
...
@@ -240,7 +240,7 @@ export default {
*/
toApiListManage
(
index
,
row
)
{
const
that
=
this
;
that
.
$router
.
push
(
`/apiListManage?interfaceId=
${
row
.
interfaceId
}
&interfaceName=
${
row
.
interfaceName
}
&projectId=
${
row
.
projectId
}
&projectName=
${
row
.
projectName
}
&interfaceGroupId=
${
row
.
interfaceGroupId
}
&interfaceGroupName=
${
row
.
interfaceGroupName
}
`
);
that
.
$router
.
push
(
`/apiListManage?interfaceId=
${
row
.
interfaceId
}
&interfaceName=
${
row
.
interfaceName
}
&projectId=
${
row
.
projectId
}
&projectName=
${
row
.
projectName
}
&interfaceGroupId=
${
row
.
interfaceGroupId
}
&interfaceGroupName=
${
row
.
interfaceGroupName
}
&apiType=
${
row
.
type
}
`
);
},
/**
...
...
src/views/index/createEventApi.vue
View file @
691a6922
...
...
@@ -44,20 +44,6 @@
@
submitBack=
"submitBack"
@
submitNext=
"submitNext"
/>
</div>
<!--
<div
v-if=
"activeStep == '3'"
class=
"create-api-back"
>
<create-backend
@
submitBack=
"submitBack"
@
submitNext=
"submitNext"
/>
</div>
-->
<!--
<div
v-if=
"activeStep == '4'"
class=
"create-api-result"
>
<create-result
@
submitBack=
"submitBack"
@
submitNext=
"submitNext"
/>
</div>
-->
</div>
</div>
</div>
...
...
@@ -67,16 +53,12 @@
import
navBread
from
'@/components/nav/nav-bread.vue'
;
import
createEventBase
from
'@/components/createApi/create-event-base.vue'
;
import
createEventField
from
'@/components/createApi/create-event-field.vue'
;
// import createBackend from '@/components/createApi/create-backend.vue';
// import createResult from '@/components/createApi/create-result.vue';
export
default
{
name
:
'CreateApi'
,
name
:
'Create
Event
Api'
,
components
:
{
navBread
,
createEventBase
,
createEventField
,
// createBackend,
// createResult
createEventField
},
data
()
{
return
{
...
...
src/views/index/groupApiList.vue
View file @
691a6922
...
...
@@ -268,7 +268,7 @@ export default {
*/
toApiListManage
(
index
,
row
)
{
const
that
=
this
;
that
.
$router
.
push
(
`/apiListManage?interfaceId=
${
row
.
interfaceId
}
&interfaceName=
${
row
.
interfaceName
}
&projectId=
${
row
.
projectId
}
&projectName=
${
row
.
projectName
}
&interfaceGroupId=
${
row
.
interfaceGroupId
}
&interfaceGroupName=
${
row
.
interfaceGroupName
}
`
);
that
.
$router
.
push
(
`/apiListManage?interfaceId=
${
row
.
interfaceId
}
&interfaceName=
${
row
.
interfaceName
}
&projectId=
${
row
.
projectId
}
&projectName=
${
row
.
projectName
}
&interfaceGroupId=
${
row
.
interfaceGroupId
}
&interfaceGroupName=
${
row
.
interfaceGroupName
}
&apiType=
${
row
.
type
}
`
);
},
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment