Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gateway-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
gateway-ui
Commits
e98a4753
Commit
e98a4753
authored
Jul 16, 2020
by
付清曌
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'new0219' into 'master'
New0219 See merge request
!2
parents
5b084957
348e681d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1281 additions
and
380 deletions
+1281
-380
.eslintrc.js
.eslintrc.js
+1
-0
prettierrc.js
prettierrc.js
+5
-0
mainconfigguration.server.js
src/api/mainconfigguration.server.js
+49
-28
env.config.js
src/config/env.config.js
+2
-4
prod.config.js
src/config/prod.config.js
+4
-6
mainconfiguration.vue
src/pages/mainconfiguration/mainconfiguration.vue
+1149
-284
http.service.js
src/services/http.service.js
+33
-29
init.service.js
src/services/init.service.js
+20
-14
localStorage.service.js
src/services/localStorage.service.js
+18
-15
No files found.
.eslintrc.js
View file @
e98a4753
...
...
@@ -19,6 +19,7 @@ module.exports = {
'
prettier/prettier
'
:
'
error
'
,
// 防止iview的标签报错
'
vue/no-parsing-error
'
:
[
2
,
{
'
x-invalid-end-tag
'
:
false
}],
'
prettier/prettier
'
:
0
,
},
}
prettierrc.js
0 → 100644
View file @
e98a4753
module
.
exports
=
{
"
printWidth
"
:
200
,
"
trailingComma
"
:
"
es5
"
,
"
singleQuote
"
:
true
,
}
\ No newline at end of file
src/api/mainconfigguration.server.js
View file @
e98a4753
import
axios
from
'
../services/http.service
'
import
{
sapi
}
from
'
../config
'
import
qs
from
'
qs
'
let
comapi
=
'
/heimdallr-config
'
import
axios
from
"
../services/http.service
"
;
import
{
sapi
}
from
"
../config
"
;
// import qs from "qs";
// 获取服务列表
export
function
getservicelist
()
{
return
axios
.
get
(
`
${
sapi
}
/service/list`
)
export
function
getservicelist
()
{
return
axios
.
get
(
`
${
sapi
}
/service/list`
)
;
}
// 获取文字说明
export
function
getkey
(
key
)
{
return
axios
.
get
(
`
${
sapi
}
/get-key-explain/
${
key
}
`
)
export
function
getkey
(
key
)
{
return
axios
.
get
(
`
${
sapi
}
/get-key-explain/
${
key
}
`
)
;
}
// 获取配置列表
export
function
getconfigurelist
(
data
)
{
return
axios
.
get
(
`
${
sapi
}
/config/service/
${
data
.
key
}
/
${
data
.
service_name
}
`
)
export
function
getconfigurelist
(
data
)
{
return
axios
.
get
(
`
${
sapi
}
/config/service/
${
data
.
key
}
/
${
data
.
service_name
}
`
)
;
}
// 发布
export
function
postconfigurelist
(
data
,
params
)
{
return
axios
.
post
(
`
${
sapi
}
/config/service/
${
data
.
key
}
/
${
data
.
service_name
}
`
,
params
,
{
headers
:
{
'
Content-Type
'
:
'
application/json
'
}})
export
function
postconfigurelist
(
data
,
params
)
{
return
axios
.
post
(
`
${
sapi
}
/config/service/
${
data
.
key
}
/
${
data
.
service_name
}
`
,
params
,
{
headers
:
{
"
Content-Type
"
:
"
application/json
"
}
}
);
}
// 获取版本
export
function
getVersionnumber
(
data
)
{
return
axios
.
get
(
`
${
sapi
}
/config-version/service/
${
data
.
key
}
/
${
data
.
service_name
}
/list`
)
export
function
getVersionnumber
(
data
)
{
return
axios
.
get
(
`
${
sapi
}
/config-version/service/
${
data
.
key
}
/
${
data
.
service_name
}
/list`
);
}
// 回滚版本
export
function
rollbacknum
(
data
)
{
return
axios
.
get
(
`
${
sapi
}
/config-version/service/
${
data
.
key
}
/
${
data
.
service_name
}
/set/
${
data
.
version
}
`
)
export
function
rollbacknum
(
data
)
{
return
axios
.
get
(
`
${
sapi
}
/config-version/service/
${
data
.
key
}
/
${
data
.
service_name
}
/set/
${
data
.
version
}
`
);
}
// 获取节点列表
export
function
getnodelist
(
data
)
{
return
axios
.
get
(
`
${
sapi
}
/node/list/
${
data
.
service_name
}
`
)
export
function
getnodelist
(
data
)
{
return
axios
.
get
(
`
${
sapi
}
/node/list/
${
data
.
service_name
}
`
)
;
}
// 获取节点配置
export
function
getnodeconfig
(
data
)
{
return
axios
.
get
(
`
${
sapi
}
/config/node/
${
data
.
service_name
}
/
${
data
.
node_id
}
`
)
export
function
getnodeconfig
(
data
)
{
return
axios
.
get
(
`
${
sapi
}
/config/node/
${
data
.
service_name
}
/
${
data
.
node_id
}
`
)
;
}
// 设置节点配置
export
function
nodeconfig
(
data
,
weight
)
{
return
axios
.
post
(
`
${
sapi
}
/config/node/
${
data
.
service_name
}
/
${
data
.
node_id
}
`
,
weight
,
{
headers
:
{
'
Content-Type
'
:
'
application/json
'
}})
export
function
nodeconfig
(
data
,
weight
)
{
return
axios
.
post
(
`
${
sapi
}
/config/node/
${
data
.
service_name
}
/
${
data
.
node_id
}
`
,
weight
,
{
headers
:
{
"
Content-Type
"
:
"
application/json
"
}
}
);
}
// 获取菜单列表
export
function
getMenuList
()
{
return
axios
.
get
(
`
${
sapi
}
/key/list`
);
}
// 获取标签列表
export
function
getTypeList
()
{
return
axios
.
get
(
`
${
sapi
}
/filter/list`
);
}
src/config/env.config.js
View file @
e98a4753
const
sapi
=
'
https://kapi-fe.liangkebang.net
'
const
sapi
=
"
https://kapi-fe.liangkebang.net
"
;
// const sapi = 'http://192.168.29.88:5555'
export
{
sapi
}
export
{
sapi
};
src/config/prod.config.js
View file @
e98a4753
let
comapi
=
'
/heimdallr-config
'
const
sapi
=
`//kapi.xyqb.com/heimdallr-config`
// const sapi = `//kapi.xyqb.com`
export
{
sapi
}
// let comapi = "/heimdallr-config";
const
sapi
=
`//kapi.xyqb.com/heimdallr-config`
;
// const sapi = `//kapi.xyqb.com`;
export
{
sapi
};
src/pages/mainconfiguration/mainconfiguration.vue
View file @
e98a4753
...
...
@@ -14,12 +14,7 @@
</div>
<div
class=
"content_header_list"
>
<div
class=
"header_list_left"
>
<p
class=
"list_content"
@
click=
"authenticationlist('url_auth_list')"
:class=
"
{'colorlistone':listonecolorauth}">鉴权URL列表
</p>
<p
class=
"list_content"
@
click=
"foreignlist('url_white_list')"
:class=
"
{'colorlistone':listonecolorfor}">对外URL列表
</p>
<p
class=
"list_content"
@
click=
"internallylist('url_black_list')"
:class=
"
{'colorlistone':listonecolorint}">对内URL列表
</p>
<p
class=
"list_content"
@
click=
"domainnameprefixlist('domain_prefix')"
:class=
"
{'colorlistone':listonecolordoma}">域名前缀列表
</p>
<p
class=
"list_content"
@
click=
"serviceAdministrator('service_owner')"
:class=
"
{'colorlistone':listonecolorserv}">服务管理员列表
</p>
<p
class=
"list_content"
@
click=
"testmo('test_mode')"
:class=
"
{'colorlistone':listonecolortest}">测试模式
</p>
<p
class=
"list_content"
v-for=
"(item, index) in menu"
:key=
"index"
:class=
"
{'colorlistone':index==colorIndex}" @click="authenticationlist(item.Key,index)">
{{
item
.
Value
}}
</p>
</div>
<div
class=
"header_list_right"
>
<div
class=
"list_right_header"
>
...
...
@@ -27,9 +22,9 @@
<span
class=
"textExplain"
v-html=
"textExplain"
></span>
</div>
<div
class=
"list_right_content"
>
<
p
class=
"right_content_btn"
>
<
div
class=
"right_content_btn"
>
<Button
type=
"primary"
size =
'small'
@
click=
"configlist"
:class=
"
{'colorlistcolor':colorupdata}">发布
</Button>
</
p
>
</
div
>
<p>
<Button
type=
"primary"
size =
'small'
@
click=
"rollback"
>
回滚
</Button>
</p>
...
...
@@ -37,19 +32,19 @@
</div>
<div
class=
"list_right_configure"
>
<div
class=
"configure_content"
v-show=
"isShowList"
>
<
p
class=
"configure_content_configure"
>
<
div
class=
"configure_content_configure"
>
<span><Input
v-model=
"singlebaraddition"
placeholder=
"请输入配置项"
style=
"width: 65%;margin-top:1%;float:left;margin-left:2%"
@
keyup.enter.native=
'oneadd'
/></span>
<Button
type=
"primary"
size =
'small'
style=
"margin:1.2% 0 0 1%;float:left"
@
click=
"oneadd"
>
单条添加
</Button>
<span
style=
"float:right;margin:1.2% 2% 0% 1%"
>
<Button
type=
"primary"
size =
'small'
@
click=
"clear"
>
清空
</Button>
<Button
type=
"primary"
size =
'small'
@
click=
"alladd"
>
批量添加
</Button>
</span>
</
p
>
</
div
>
<p
class=
"configure_content_page"
>
<Table
:data=
'logData'
:columns=
'logCol'
border
></Table>
</p>
</p>
</div>
<div
class=
"configure_content_test"
v-show=
"
isShowList == false
"
>
<div
class=
"configure_content_test"
v-show=
"
showTestModal
"
>
<p
class=
"test_content"
>
<span
style=
"margin-left:20px"
>
状态:
<span
class=
"test_conten_status"
v-if=
"testmostatus === true"
>
开启
</span>
...
...
@@ -60,6 +55,51 @@
</span>
</p>
</div>
<div
class=
"ipSet"
v-show=
"showIpSet"
>
<div
style=
"float:right"
>
<Button
type=
"primary"
size =
'small'
@
click=
"clear"
>
清空
</Button>
<Button
type=
"primary"
size =
'small'
@
click=
"addIpset"
>
添加
</Button>
</div>
<div
style=
"float:left;margin:10px 0"
class=
"configure_content_page"
>
<Table
:data=
'ipsetData'
:columns=
'ipsetCol'
border
></Table>
</div>
</div>
<div
class=
"urlIpSet"
v-show=
"showUrlIpSet"
>
<div
style=
"float:right"
>
<Button
type=
"primary"
size =
'small'
@
click=
"clear"
>
清空
</Button>
<Button
type=
"primary"
size =
'small'
@
click=
"addUrlIpset"
>
添加
</Button>
</div>
<div
style=
"float:left;margin:10px 0"
class=
"configure_content_page"
>
<Table
:data=
'urlIpSetData'
:columns=
'urlIpSetCol'
border
></Table>
</div>
</div>
<div
class=
"urlIpSet"
v-show=
"showLimit"
>
<div
style=
"float:right"
>
<Button
type=
"primary"
size =
'small'
@
click=
"clear"
>
清空
</Button>
<Button
type=
"primary"
size =
'small'
@
click=
"addLimit"
>
添加
</Button>
</div>
<div
style=
"float:left;margin:10px 0"
class=
"configure_content_page"
>
<Table
:data=
'limitData'
:columns=
'limitCol'
border
></Table>
</div>
</div>
<div
class=
"urlIpSet"
v-show=
"showSpecified"
>
<div
style=
"float:right"
>
<Button
type=
"primary"
size =
'small'
@
click=
"clear"
>
清空
</Button>
<Button
type=
"primary"
size =
'small'
@
click=
"addSpecified"
>
添加
</Button>
</div>
<div
style=
"float:left;margin:10px 0"
class=
"configure_content_page"
>
<Table
:data=
'specifiedData'
:columns=
'specifiedCol'
border
></Table>
</div>
</div>
<div
class=
"urlIpSet"
v-show=
"showElse"
>
<div
style=
"float:right"
>
<Button
type=
"primary"
size =
'small'
@
click=
"modify"
>
修改
</Button>
<Button
type=
"primary"
size =
'small'
@
click=
"reduction"
>
还原
</Button>
</div>
<div
style=
"float:left;margin:10px 0;border-top:1px solid #999;width:100%;height:100%"
>
{{
origenContent
}}
</div>
</div>
</div>
</div>
</div>
...
...
@@ -73,6 +113,77 @@
</div>
</div>
</div>
<Modal
v-model=
"addIpsetModal"
:mask-closable =
'false'
:footer-hide=
'true'
>
<Form
ref=
"formInline"
:model=
"formInline"
:rules=
"ruleInline"
style=
"margin-top:20px"
:label-width=
"80"
>
<FormItem
prop=
"alladdcontent"
label=
"名称:"
>
<Input
v-model=
"ipsetName"
type=
"text"
placeholder=
"请输入名称"
:disabled=
"updataIpsetSta"
style=
"width: 70%"
/>
</FormItem>
<FormItem
prop=
"alladdcontent"
label=
"列表:"
>
<Input
v-model=
"ipsetContent"
type=
"text"
placeholder=
"请输入"
style=
"width: 70%"
/>
</FormItem>
</Form>
<div
class=
"alladdbtn"
>
<Button
type=
"primary"
size=
'large'
style=
"margin:0 20px"
@
click=
"addIpsetModal = false"
>
取消
</Button>
<Button
type=
"primary"
size=
'large'
@
click=
"confireIpset"
>
保存
</Button>
</div>
</Modal>
<Modal
v-model=
"addUrlIpsetModal"
:mask-closable =
'false'
:footer-hide=
'true'
>
<Form
ref=
"formInline"
:model=
"formInline"
:rules=
"ruleInline"
style=
"margin-top:20px"
:label-width=
"80"
>
<FormItem
prop=
"alladdcontent"
label=
"路径:"
>
<Input
v-model=
"urlIpsetPath"
type=
"text"
placeholder=
"请输入"
style=
"width: 70%"
/>
</FormItem>
<FormItem
prop=
"alladdcontent"
label=
"集合:"
>
<Select
v-model=
"urlIpsetName"
style=
"width:70%"
>
<Option
v-for=
"item in ipsetList"
:value=
"item"
:key=
"item"
>
{{
item
}}
</Option>
</Select>
</FormItem>
</Form>
<div
class=
"alladdbtn"
>
<Button
type=
"primary"
size=
'large'
style=
"margin:0 20px"
@
click=
"addUrlIpsetModal = false"
>
取消
</Button>
<Button
type=
"primary"
size=
'large'
@
click=
"confireUrlSet"
>
保存
</Button>
</div>
</Modal>
<Modal
v-model=
"addLimitModal"
:mask-closable =
'false'
:footer-hide=
'true'
>
<Form
ref=
"formInline"
:model=
"formInline"
:rules=
"ruleInline"
style=
"margin-top:20px"
:label-width=
"80"
>
<FormItem
prop=
"alladdcontent"
label=
"路径:"
>
<Input
v-model=
"limitPath"
type=
"text"
placeholder=
"请输入路径"
style=
"width: 70%"
/>
</FormItem>
<FormItem
prop=
"alladdcontent"
label=
"单位时间:"
>
<Input
v-model=
"limitTime"
type=
"number"
placeholder=
"请输入单位时间"
style=
"width: 70%"
/>
</FormItem>
<FormItem
prop=
"alladdcontent"
label=
"速率:"
>
<Input
v-model=
"limitRate"
type=
"number"
placeholder=
"请输入速率"
style=
"width: 70%"
/>
</FormItem>
</Form>
<div
class=
"alladdbtn"
>
<Button
type=
"primary"
size=
'large'
style=
"margin:0 20px"
@
click=
"addLimitModal = false"
>
取消
</Button>
<Button
type=
"primary"
size=
'large'
@
click=
"confireLimit"
>
保存
</Button>
</div>
</Modal>
<Modal
v-model=
"addSpecifiedModal"
:mask-closable =
'false'
:footer-hide=
'true'
>
<Form
ref=
"formInline"
:model=
"formInline"
:rules=
"ruleInline"
style=
"margin-top:20px"
:label-width=
"80"
>
<FormItem
prop=
"alladdcontent"
label=
"类型:"
>
<Select
v-model=
"err_type"
style=
"width:70%"
@
on-change=
"changeType"
>
<Option
v-for=
"(item, index) in typeList"
:value=
"item.value"
:key=
"index"
>
{{
item
.
value
}}
</Option>
</Select>
</FormItem>
<FormItem
prop=
"alladdcontent"
label=
"标签:"
>
<Select
v-model=
"err_tag"
style=
"width:70%"
>
<Option
v-for=
"(item, index) in tageList"
:value=
"item"
:key=
"index"
>
{{
item
}}
</Option>
</Select>
</FormItem>
<FormItem
prop=
"alladdcontent"
label=
"header:"
>
<Input
v-model=
"header"
type=
"text"
placeholder=
"请输入首部"
style=
"width: 70%"
/>
</FormItem>
<FormItem
prop=
"alladdcontent"
label=
"body:"
>
<Input
v-model=
"body"
type=
"text"
placeholder=
"请输入主体"
style=
"width: 70%"
/>
</FormItem>
</Form>
<div
class=
"alladdbtn"
>
<Button
type=
"primary"
size=
'large'
style=
"margin:0 20px"
@
click=
"addSpecifiedModal = false"
>
取消
</Button>
<Button
type=
"primary"
size=
'large'
@
click=
"confireSpecified"
>
保存
</Button>
</div>
</Modal>
<Modal
v-model=
"alladdModal"
:mask-closable =
'false'
:footer-hide=
'true'
>
<h2
class=
"alladdtitle"
>
批量添加
</h2>
<Form
ref=
"formInline"
:model=
"formInline"
:rules=
"ruleInline"
style=
"margin-top:20px"
:label-width=
"80"
>
...
...
@@ -106,6 +217,29 @@
<Button
type=
"primary"
size=
'small'
@
click=
"confiredelate"
>
确认
</Button>
</div>
</Modal>
<Modal
v-model=
"modifyModal"
:mask-closable =
'false'
:footer-hide=
'true'
width=
'300'
>
<div
style=
"padding-top:40px"
>
<Input
v-model=
"updataOrigenContent"
type=
"textarea"
clearable
style=
"width: 90%"
/>
</div>
<div
class=
"rollbackdivbtn"
>
<Button
type=
"primary"
size=
'small'
style=
"margin:0 20px"
@
click=
"modifyModal = false"
>
取消
</Button>
<Button
type=
"primary"
size=
'small'
@
click=
"conforeModify"
>
确认
</Button>
</div>
</Modal>
<Modal
v-model=
"clearModal"
:mask-closable =
'false'
:footer-hide=
'true'
width=
'300'
>
<h3
class=
"delatediv"
>
是否确认清空该列表?
</h3>
<div
class=
"rollbackdivbtn"
>
<Button
type=
"primary"
size=
'small'
style=
"margin:0 20px"
@
click=
"clearModal = false"
>
取消
</Button>
<Button
type=
"primary"
size=
'small'
@
click=
"confireClear"
>
确认
</Button>
</div>
</Modal>
<Modal
v-model=
"delateIpModal"
:mask-closable =
'false'
:footer-hide=
'true'
width=
'300'
>
<h3
class=
"delatediv"
>
是否确认删除该选项?
</h3>
<div
class=
"rollbackdivbtn"
>
<Button
type=
"primary"
size=
'small'
style=
"margin:0 20px"
@
click=
"delateIpModal = false"
>
取消
</Button>
<Button
type=
"primary"
size=
'small'
@
click=
"confierDelateOne"
>
确认
</Button>
</div>
</Modal>
<Modal
v-model=
"changeserverModal"
:mask-closable =
'false'
:footer-hide=
'true'
width=
'300'
>
<h3
class=
"delatediv"
>
有尚未发布的配置,是否确认切换服务?切换会导致未发布的配置丢失。
</h3>
<div
class=
"rollbackdivbtn"
>
...
...
@@ -169,6 +303,36 @@
<Button
type=
"primary"
size=
'small'
@
click=
"confirfabu"
>
发布
</Button>
</div>
</Modal>
<Modal
v-model=
"elseConfireModal"
:mask-closable =
'false'
:footer-hide=
'true'
width=
'500'
>
<h3
class=
"updatediv"
>
是否确认发布?
</h3>
<div
class=
"updatetestclass"
>
<p>
<span>
原配置:
{{
netModily
}}
</span>
</p>
<p>
<span>
新配置:
{{
origenContent
}}
</span>
</p>
</div>
<div
class=
"rollbackdivbtn"
>
<Button
type=
"primary"
size=
'small'
style=
"margin:0 20px"
@
click=
"elseConfireModal = false"
>
取消
</Button>
<Button
type=
"primary"
size=
'small'
@
click=
"confirfabu"
>
发布
</Button>
</div>
</Modal>
<Modal
v-model=
"contrastIpset"
:mask-closable =
'false'
:footer-hide=
'true'
width=
'500'
>
<h3
class=
"updatediv"
>
是否确认发布?
</h3>
<div
class=
"updatetestclass"
>
<p>
<span>
原配置:
{{
needModilyArr
}}
</span>
</p>
<p>
<span>
新配置:
{{
newIpsetData
}}
</span>
</p>
</div>
<div
class=
"rollbackdivbtn"
>
<Button
type=
"primary"
size=
'small'
style=
"margin:0 20px"
@
click=
"contrastIpset = false"
>
取消
</Button>
<Button
type=
"primary"
size=
'small'
@
click=
"confirfabu"
>
发布
</Button>
</div>
</Modal>
<Modal
v-model=
"ContrasttestModal"
:mask-closable =
'false'
:footer-hide=
'true'
width=
'500'
>
<h3
class=
"updatediv"
>
是否确认发布?
</h3>
<div
class=
"updatetestclass"
>
...
...
@@ -202,11 +366,279 @@
</div>
</
template
>
<
script
>
import
{
getservicelist
,
getkey
,
get
configurelist
,
postconfigurelist
,
getVersionnumber
,
rollbacknum
,
getnodelist
,
nodeconfig
}
from
'
../../api/mainconfigguration.server
'
import
{
getservicelist
,
getkey
,
get
TypeList
,
getconfigurelist
,
postconfigurelist
,
getVersionnumber
,
rollbacknum
,
getnodelist
,
nodeconfig
,
getMenuList
}
from
'
../../api/mainconfigguration.server
'
export
default
{
data
()
{
return
{
menu
:
[],
colorIndex
:
''
,
changeIndex
:
''
,
addIpsetModal
:
false
,
elseConfireModal
:
false
,
addUrlIpsetModal
:
false
,
addSpecifiedModal
:
false
,
addLimitModal
:
false
,
showSpecified
:
false
,
showElse
:
false
,
contrastIpset
:
false
,
updataIpsetSta
:
false
,
updataUrlSta
:
false
,
updataLimitSta
:
false
,
updataSpecifiedSta
:
false
,
delateIpModal
:
false
,
ipsetName
:
''
,
header
:
''
,
err_type
:
''
,
err_tag
:
''
,
body
:
''
,
origenContent
:
'
显示原始值
'
,
urlIpsetPath
:
''
,
urlIpsetName
:
''
,
ipsetContent
:
''
,
typeList
:
[
{
key
:
'
pre
'
,
value
:
'
pre
'
,
},{
key
:
'
proxy
'
,
value
:
'
proxy
'
,
},{
key
:
'
post
'
,
value
:
'
post
'
,
}
],
limitPath
:
''
,
limitRate
:
0
,
limitTime
:
1
,
tageList
:
[],
ipsetList
:
[],
ipsetData
:
[],
ipsetCol
:[
{
title
:
'
名称
'
,
key
:
'
name
'
,
align
:
'
center
'
},
{
title
:
'
ip列表
'
,
key
:
'
ip_list
'
,
align
:
'
center
'
},
{
title
:
'
操作
'
,
key
:
'
action
'
,
// width: 200,
align
:
'
center
'
,
render
:
(
h
,
params
)
=>
{
let
arr
=
[
h
(
'
Button
'
,
{
props
:
{
type
:
'
primary
'
,
size
:
'
small
'
},
style
:
{
marginRight
:
'
10px
'
},
on
:
{
click
:
()
=>
{
this
.
updateIpset
(
params
.
row
)
}
}
},
'
修改
'
),
h
(
'
Button
'
,
{
props
:
{
type
:
'
primary
'
,
size
:
'
small
'
,
},
style
:
{
marginRight
:
'
10px
'
},
on
:
{
click
:
()
=>
{
this
.
delateOne
(
params
.
row
)
}
}
},
'
删除
'
)]
return
h
(
'
div
'
,
arr
)
}
}
],
clearModal
:
false
,
updataOrigenContent
:
''
,
urlIpSetData
:
[],
urlIpSetCol
:
[
{
title
:
'
路径
'
,
key
:
'
path
'
,
align
:
'
center
'
},
{
title
:
'
集合
'
,
key
:
'
ip_set_name
'
,
align
:
'
center
'
},
{
title
:
'
操作
'
,
key
:
'
action
'
,
width
:
200
,
align
:
'
center
'
,
render
:
(
h
,
params
)
=>
{
let
arr
=
[
h
(
'
Button
'
,
{
props
:
{
type
:
'
primary
'
,
size
:
'
small
'
},
style
:
{
marginRight
:
'
10px
'
},
on
:
{
click
:
()
=>
{
this
.
updateUrlIpset
(
params
.
row
)
}
}
},
'
修改
'
),
h
(
'
Button
'
,
{
props
:
{
type
:
'
primary
'
,
size
:
'
small
'
},
style
:
{
marginRight
:
'
10px
'
},
on
:
{
click
:
()
=>
{
this
.
delateOne
(
params
.
row
)
}
}
},
'
删除
'
)]
return
h
(
'
div
'
,
arr
)
}
}
],
limitData
:
[],
limitCol
:
[
{
title
:
'
路径
'
,
key
:
'
path
'
,
align
:
'
center
'
},
{
title
:
'
单位时间(秒)
'
,
key
:
'
duration
'
,
align
:
'
center
'
},
{
title
:
'
速率
'
,
key
:
'
rate
'
,
align
:
'
center
'
},
{
title
:
'
操作
'
,
key
:
'
action
'
,
width
:
200
,
align
:
'
center
'
,
render
:
(
h
,
params
)
=>
{
let
arr
=
[
h
(
'
Button
'
,
{
props
:
{
type
:
'
primary
'
,
size
:
'
small
'
},
style
:
{
marginRight
:
'
10px
'
},
on
:
{
click
:
()
=>
{
this
.
updateLimit
(
params
.
row
)
}
}
},
'
修改
'
),
h
(
'
Button
'
,
{
props
:
{
type
:
'
primary
'
,
size
:
'
small
'
},
style
:
{
marginRight
:
'
10px
'
},
on
:
{
click
:
()
=>
{
this
.
delateOne
(
params
.
row
)
}
}
},
'
删除
'
)]
return
h
(
'
div
'
,
arr
)
}
}
],
specifiedData
:
[],
specifiedCol
:
[
{
title
:
'
类型
'
,
key
:
'
err_type
'
,
align
:
'
center
'
},
{
title
:
'
标签
'
,
key
:
'
err_tag
'
,
align
:
'
center
'
},
{
title
:
'
首部
'
,
key
:
'
header
'
,
align
:
'
center
'
},
{
title
:
'
主体
'
,
key
:
'
body
'
,
align
:
'
center
'
},
{
title
:
'
操作
'
,
key
:
'
action
'
,
width
:
200
,
align
:
'
center
'
,
render
:
(
h
,
params
)
=>
{
let
arr
=
[
h
(
'
Button
'
,
{
props
:
{
type
:
'
primary
'
,
size
:
'
small
'
},
style
:
{
marginRight
:
'
10px
'
},
on
:
{
click
:
()
=>
{
this
.
updateSpecified
(
params
.
row
)
}
}
},
'
修改
'
),
h
(
'
Button
'
,
{
props
:
{
type
:
'
primary
'
,
size
:
'
small
'
},
style
:
{
marginRight
:
'
10px
'
},
on
:
{
click
:
()
=>
{
this
.
delateOne
(
params
.
row
)
}
}
},
'
删除
'
)]
return
h
(
'
div
'
,
arr
)
}
}
],
server
:
''
,
needModilyArr
:
[],
delateindex
:
null
,
modifyModal
:
false
,
origenIpsetList
:
[],
newIpsetData
:
[],
showIpSet
:
false
,
showUrlIpSet
:
false
,
showLimit
:
false
,
showTestModal
:
false
,
isShowList
:
true
,
alladdModal
:
false
,
listonecolorauth
:
true
,
...
...
@@ -233,6 +665,7 @@ export default {
changeserverModal
:
false
,
ContrasttestModal
:
false
,
ContrastnodeModal
:
false
,
netModily
:
''
,
aftertestmostatuorigen
:
false
,
opentest
:
false
,
closetest
:
false
,
...
...
@@ -270,7 +703,7 @@ export default {
{
title
:
'
配置
'
,
key
:
'
sort
'
,
align
:
'
center
'
align
:
'
left
'
},
{
title
:
'
操作
'
,
...
...
@@ -323,7 +756,7 @@ export default {
key
:
'
Status
'
,
align
:
'
center
'
,
render
:
(
h
,
params
)
=>
{
return
h
(
'
div
'
,
params
.
row
.
Status
==
'
passing
'
?
'
up
'
:
'
down
'
)
return
h
(
'
div
'
,
params
.
row
.
Status
==
=
'
passing
'
?
'
up
'
:
'
down
'
)
}
},
{
...
...
@@ -375,45 +808,11 @@ export default {
}
}
],
rollbacklist
:
[]
rollbacklist
:
[],
keyArr
:
[],
}
},
methods
:
{
testmo
(
key
)
{
this
.
changekey
=
key
if
(
this
.
colorupdata
===
true
)
{
this
.
changedivModal
=
true
return
}
this
.
contrastlist
=
[]
this
.
listonecolorauth
=
false
this
.
listonecolorfor
=
false
this
.
listonecolorint
=
false
this
.
listonecolorserv
=
false
this
.
listonecolordoma
=
false
this
.
listonecolortest
=
true
this
.
isShowList
=
false
this
.
colorupdatacolor
=
false
this
.
colorupdata
=
false
this
.
key
=
key
this
.
testdiv
=
true
this
.
getkeytext
(
key
)
let
data
=
{
key
:
key
,
service_name
:
this
.
server
}
getconfigurelist
(
data
).
then
(
data
=>
{
this
.
testmostatus
=
data
.
body
this
.
aftertestmostatuorigen
=
data
.
body
if
(
data
.
body
===
true
)
{
this
.
opentest
=
true
this
.
closetest
=
false
}
else
{
this
.
closetest
=
true
this
.
opentest
=
false
}
})
},
opentestradio
(
data
)
{
this
.
closetest
=
!
this
.
closetest
this
.
aftertestmostatus
=
true
...
...
@@ -424,126 +823,140 @@ export default {
},
confireupdaterido
()
{
this
.
updatetestModal
=
false
this
.
testmostatus
=
this
.
aftertestmostatus
this
.
colorupdata
=
true
this
.
colorupdatacolor
=
true
this
.
origenselectserver
=
this
.
server
},
serviceAdministrator
(
key
)
{
this
.
changekey
=
key
if
(
this
.
colorupdata
===
true
)
{
this
.
changedivModal
=
true
return
}
this
.
contrastlist
=
[]
this
.
listonecolorauth
=
false
this
.
listonecolorfor
=
false
this
.
listonecolorint
=
false
this
.
listonecolorserv
=
true
this
.
listonecolordoma
=
false
this
.
listonecolortest
=
false
this
.
colorupdatacolor
=
false
this
.
colorupdata
=
false
this
.
isShowList
=
true
this
.
testdiv
=
false
this
.
key
=
key
this
.
logData
=
[]
this
.
getkeytext
(
key
)
this
.
getconfigurlist
(
key
,
this
.
server
)
},
domainnameprefixlist
(
key
)
{
this
.
changekey
=
key
if
(
this
.
colorupdata
===
true
)
{
this
.
changedivModal
=
true
return
}
this
.
contrastlist
=
[]
this
.
listonecolorauth
=
false
this
.
listonecolorfor
=
false
this
.
listonecolorint
=
false
this
.
listonecolorserv
=
false
this
.
listonecolordoma
=
true
this
.
listonecolortest
=
false
this
.
colorupdatacolor
=
false
this
.
colorupdata
=
false
this
.
isShowList
=
true
this
.
testdiv
=
false
this
.
key
=
key
this
.
logData
=
[]
this
.
getkeytext
(
key
)
this
.
getconfigurlist
(
key
,
this
.
server
)
this
.
testmostatus
=
this
.
aftertestmostatus
this
.
colorupdata
=
true
this
.
colorupdatacolor
=
true
this
.
origenselectserver
=
this
.
server
},
internallylist
(
key
)
{
authenticationlist
(
key
,
Tindex
)
{
this
.
changeIndex
=
Tindex
;
this
.
changekey
=
key
if
(
this
.
colorupdata
===
true
)
{
this
.
changedivModal
=
true
return
}
this
.
contrastlist
=
[]
this
.
listonecolorauth
=
false
this
.
listonecolorfor
=
false
this
.
listonecolorint
=
true
this
.
listonecolorserv
=
false
this
.
listonecolordoma
=
false
this
.
listonecolortest
=
false
this
.
colorupdatacolor
=
false
this
.
colorupdata
=
false
this
.
isShowList
=
true
this
.
testdiv
=
false
this
.
key
=
key
this
.
logData
=
[]
this
.
getkeytext
(
key
)
this
.
getconfigurlist
(
key
,
this
.
server
)
},
foreignlist
(
key
)
{
this
.
changekey
=
key
if
(
this
.
colorupdata
===
true
)
{
this
.
changedivModal
=
true
return
this
.
contrastlist
=
[];
this
.
origenIpsetList
=
[];
this
.
colorIndex
=
Tindex
;
if
(
key
===
'
url_auth_list
'
||
key
===
'
url_white_list
'
||
key
===
'
url_black_list
'
||
key
===
'
domain_prefix
'
||
key
===
'
service_owner
'
)
{
this
.
testdiv
=
false
this
.
key
=
key
this
.
logData
=
[]
this
.
singlebaraddition
=
''
this
.
getkeytext
(
key
)
this
.
getconfigurlist
(
key
,
this
.
server
)
this
.
isShowList
=
true
this
.
showSpecified
=
false
;
this
.
showLimit
=
false
;
this
.
showIpSet
=
false
;
this
.
showUrlIpSet
=
false
;
}
this
.
contrastlist
=
[]
this
.
listonecolorauth
=
false
this
.
listonecolorfor
=
true
this
.
listonecolorint
=
false
this
.
listonecolorserv
=
false
this
.
listonecolordoma
=
false
this
.
listonecolortest
=
false
this
.
colorupdatacolor
=
false
this
.
colorupdata
=
false
this
.
isShowList
=
true
this
.
testdiv
=
false
this
.
key
=
key
this
.
logData
=
[]
this
.
getkeytext
(
key
)
this
.
getconfigurlist
(
key
,
this
.
server
)
},
authenticationlist
(
key
)
{
this
.
changekey
=
key
if
(
this
.
colorupdata
===
true
)
{
this
.
changedivModal
=
true
return
if
(
key
===
'
test_mode
'
)
{
this
.
key
=
key
let
data
=
{
key
:
key
,
service_name
:
this
.
server
}
getconfigurelist
(
data
).
then
(
data
=>
{
this
.
testmostatus
=
data
.
body
this
.
aftertestmostatuorigen
=
data
.
body
if
(
data
.
body
===
true
)
{
this
.
opentest
=
true
this
.
closetest
=
false
}
else
{
this
.
closetest
=
true
this
.
opentest
=
false
}
})
this
.
showTestModal
=
true
this
.
isShowList
=
false
this
.
showSpecified
=
false
;
this
.
showIpSet
=
false
;
this
.
showUrlIpSet
=
false
;
this
.
testdiv
=
true
this
.
showLimit
=
false
;
this
.
getkeytext
(
key
);
}
if
(
key
===
'
ip_set_v2
'
)
{
this
.
key
=
key
this
.
isShowList
=
false
;
this
.
showIpSet
=
true
;
this
.
showTestModal
=
false
;
this
.
showUrlIpSet
=
false
;
this
.
showLimit
=
false
;
this
.
showSpecified
=
false
;
this
.
getkeytext
(
key
);
this
.
getList
(
key
,
this
.
server
);
}
if
(
key
===
'
url_ip_set_v2
'
)
{
this
.
isShowList
=
false
;
this
.
showIpSet
=
false
;
this
.
showUrlIpSet
=
true
;
this
.
showTestModal
=
false
;
this
.
showLimit
=
false
;
this
.
showLimit
=
false
;
this
.
showSpecified
=
false
;
this
.
key
=
key
this
.
getkeytext
(
key
);
this
.
getList
(
key
,
this
.
server
);
}
if
(
key
===
'
limit
'
)
{
this
.
isShowList
=
false
;
this
.
showIpSet
=
false
;
this
.
showUrlIpSet
=
false
;
this
.
showTestModal
=
false
;
this
.
showLimit
=
true
;
this
.
showSpecified
=
false
;
this
.
showElse
=
false
;
this
.
getkeytext
(
key
);
this
.
key
=
key
this
.
getList
(
key
,
this
.
server
);
}
if
(
key
===
'
specified_values
'
)
{
this
.
isShowList
=
false
;
this
.
showIpSet
=
false
;
this
.
showUrlIpSet
=
false
;
this
.
showTestModal
=
false
;
this
.
showLimit
=
false
;
this
.
showElse
=
false
;
this
.
showSpecified
=
true
;
this
.
key
=
key
this
.
getkeytext
(
key
);
this
.
getList
(
key
,
this
.
server
);
}
let
arr
=
[
'
specified_values
'
,
'
limit
'
,
'
url_ip_set_v2
'
,
'
ip_set_v2
'
,
'
test_mode
'
,
'
url_auth_list
'
,
'
url_white_list
'
,
'
url_black_list
'
,
'
domain_prefix
'
,
'
service_owner
'
];
let
keys
=
arr
.
some
(
function
(
item
){
return
item
===
key
;
})
if
(
!
keys
)
{
this
.
showElse
=
true
this
.
isShowList
=
false
;
this
.
showIpSet
=
false
;
this
.
showUrlIpSet
=
false
;
this
.
showTestModal
=
false
;
this
.
showLimit
=
false
;
this
.
showSpecified
=
false
;
this
.
key
=
key
this
.
getkeytext
(
key
);
this
.
getList
(
key
,
this
.
server
);
}
this
.
contrastlist
=
[]
this
.
listonecolorauth
=
true
this
.
listonecolorfor
=
false
this
.
listonecolorint
=
false
this
.
listonecolorserv
=
false
this
.
listonecolordoma
=
false
this
.
listonecolortest
=
false
this
.
colorupdatacolor
=
false
this
.
colorupdata
=
false
this
.
isShowList
=
true
this
.
testdiv
=
false
this
.
key
=
key
this
.
logData
=
[]
this
.
getkeytext
(
key
)
this
.
getconfigurlist
(
key
,
this
.
server
)
},
oneadd
()
{
if
(
this
.
singlebaraddition
==
''
)
{
if
(
this
.
singlebaraddition
==
=
''
)
{
this
.
$Message
.
error
(
'
请先输入要添加的内容
'
)
return
}
let
keys
=
this
.
logData
.
some
(
item
=>
{
return
item
.
sort
===
this
.
singlebaraddition
})
if
(
keys
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
不能添加重复的内容
'
,
});
return
}
this
.
logData
.
push
({
sort
:
this
.
singlebaraddition
})
this
.
logparamsarr
.
push
(
this
.
singlebaraddition
)
this
.
singlebaraddition
=
''
...
...
@@ -552,18 +965,36 @@ export default {
this
.
origenselectserver
=
this
.
server
},
alladd
()
{
this
.
formInline
.
alladdcontent
=
''
this
.
alladdModal
=
true
},
alladdconfire
()
{
if
(
this
.
formInline
.
alladdcontent
==
''
)
{
if
(
this
.
formInline
.
alladdcontent
==
=
''
)
{
this
.
$Message
.
error
(
'
请先输入要添加的内容
'
)
return
}
let
str
=
this
.
formInline
.
alladdcontent
.
replace
(
/
\[
|]/g
,
''
)
str
=
str
.
replace
(
/
\n
/g
,
''
)
str
=
str
.
replace
(
/
\"
/g
,
''
)
str
=
str
.
replace
(
/
\'
/g
,
''
)
str
=
str
.
replace
(
/
\"
/g
,
''
)
// eslint-disable-line no-useless-escape
str
=
str
.
replace
(
/
\'
/g
,
''
)
// eslint-disable-line no-useless-escape
let
arr
=
str
.
split
(
'
,
'
)
arr
.
map
(
item
=>
{
let
keys
=
this
.
logData
.
some
(
data
=>
{
return
item
===
data
.
sort
})
this
.
keyArr
.
push
(
keys
)
})
let
keys
=
this
.
keyArr
.
some
(
item
=>
{
return
item
===
true
})
if
(
keys
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
不能添加重复的内容
'
,
});
this
.
keyArr
=
[]
return
}
this
.
logparamsarr
=
arr
arr
.
map
(
item
=>
{
this
.
logData
.
push
({
sort
:
item
})
...
...
@@ -578,13 +1009,32 @@ export default {
this
.
formInline
.
alladdcontent
=
''
},
clear
()
{
this
.
logData
=
[]
// this.contrastlist = []
this
.
singlebaraddition
=
''
this
.
logparamsarr
=
[]
this
.
clearModal
=
true
},
confireClear
()
{
if
(
this
.
key
===
'
url_auth_list
'
||
this
.
key
===
'
url_white_list
'
||
this
.
key
===
'
url_black_list
'
||
this
.
key
===
'
domain_prefix
'
||
this
.
key
===
'
service_owner
'
)
{
this
.
logData
=
[]
this
.
singlebaraddition
=
''
this
.
logparamsarr
=
[]
}
else
{
if
(
this
.
key
===
'
ip_set_v2
'
)
{
this
.
ipsetData
=
[]
}
if
(
this
.
key
===
'
url_ip_set_v2
'
)
{
this
.
urlIpSetData
=
[]
}
if
(
this
.
key
===
'
limit
'
)
{
this
.
limitData
=
[]
}
if
(
this
.
key
===
'
specified_values
'
)
{
this
.
specifiedData
=
[]
}
}
this
.
newIpsetData
=
[]
this
.
colorupdatacolor
=
true
this
.
colorupdata
=
true
this
.
origenselectserver
=
this
.
server
this
.
clearModal
=
false
},
rollback
()
{
let
data
=
{
...
...
@@ -600,8 +1050,8 @@ export default {
item
.
listonecolorback
=
false
}
})
this
.
content
=
data
.
body
.
length
==
0
?
''
:
data
.
body
[
0
].
value
this
.
version
=
data
.
body
.
length
==
0
?
''
:
data
.
body
[
0
].
key
this
.
content
=
data
.
body
.
length
==
=
0
?
''
:
data
.
body
[
0
].
value
this
.
version
=
data
.
body
.
length
==
=
0
?
''
:
data
.
body
[
0
].
key
if
(
this
.
rollbacklist
.
length
===
0
)
{
this
.
$Message
.
error
(
'
暂无要回滚的内容
'
)
return
false
...
...
@@ -616,7 +1066,7 @@ export default {
this
.
clickIndex1
=
index
},
confirerollback
()
{
if
(
this
.
version
==
''
)
{
if
(
this
.
version
==
=
''
)
{
this
.
$Message
.
error
(
'
没有要回滚的内容
'
)
return
}
...
...
@@ -630,6 +1080,7 @@ export default {
this
.
rollbackModal
=
false
this
.
$Message
.
success
(
'
回滚成功
'
)
this
.
getconfigurlist
(
this
.
key
,
this
.
server
)
this
.
getList
(
this
.
key
,
this
.
server
)
this
.
getnodeList
()
}
})
...
...
@@ -640,10 +1091,10 @@ export default {
},
confiredelate
()
{
this
.
logData
=
this
.
logData
.
filter
(
item
=>
{
return
item
.
sort
!=
this
.
delateconfigurecontent
return
item
.
sort
!=
=
this
.
delateconfigurecontent
})
this
.
contrastlist
.
filter
(
item
=>
{
return
item
!=
this
.
delateconfigurecontent
return
item
!=
=
this
.
delateconfigurecontent
})
this
.
delateModal
=
false
this
.
colorupdata
=
true
...
...
@@ -697,6 +1148,7 @@ export default {
})
},
getkeytext
(
key
)
{
this
.
textExplain
=
''
;
getkey
(
key
).
then
((
data
)
=>
{
this
.
textExplain
=
data
.
body
.
replace
(
/
\n
/g
,
'
<br/>
'
)
})
...
...
@@ -717,14 +1169,79 @@ export default {
})
})
},
getList
(
key
,
service
)
{
this
.
limitData
=
[];
this
.
ipsetData
=
[];
this
.
urlIpSetData
=
[];
this
.
specifiedData
=
[];
this
.
origenContent
=
''
;
this
.
contrastlist
=
[]
let
data
=
{
key
:
key
,
service_name
:
service
}
getconfigurelist
(
data
).
then
(
data
=>
{
let
arr
=
[
'
limit
'
,
'
ip_set_v2
'
,
'
url_ip_set_v2
'
,
'
specified_values
'
]
let
keys
=
arr
.
some
(
function
(
item
){
return
item
===
key
;
})
if
(
key
===
'
limit
'
)
{
this
.
needModilyArr
=
[];
this
.
limitData
=
[];
this
.
limitData
=
(
data
&&
data
.
body
)
||
[]
this
.
limitData
=
[...
this
.
limitData
]
this
.
needModilyArr
=
JSON
.
stringify
((
data
&&
data
.
body
))
||
[];
}
if
(
key
===
'
ip_set_v2
'
)
{
this
.
needModilyArr
=
[];
this
.
ipsetData
=
[];
this
.
ipsetData
=
(
data
&&
data
.
body
)
||
[];
this
.
ipsetData
=
[...
this
.
ipsetData
]
this
.
needModilyArr
=
JSON
.
stringify
((
data
&&
data
.
body
))
||
[];
}
if
(
key
===
'
url_ip_set_v2
'
)
{
this
.
needModilyArr
=
[];
this
.
urlIpSetData
=
[];
this
.
urlIpSetData
=
(
data
&&
data
.
body
)
||
[]
this
.
urlIpSetData
=
[...
this
.
urlIpSetData
]
this
.
needModilyArr
=
JSON
.
stringify
((
data
&&
data
.
body
))
||
[];
}
if
(
key
===
'
specified_values
'
)
{
this
.
needModilyArr
=
[];
this
.
specifiedData
=
[];
this
.
specifiedData
=
(
data
&&
data
.
body
)
||
[]
this
.
specifiedData
=
[...
this
.
specifiedData
]
this
.
needModilyArr
=
JSON
.
stringify
((
data
&&
data
.
body
))
||
[];
}
if
(
!
keys
)
{
this
.
origenContent
=
JSON
.
stringify
(
data
&&
data
.
body
)
||
''
;
this
.
netModily
=
JSON
.
stringify
(
data
&&
data
.
body
)
||
''
;
}
})
},
configlist
()
{
this
.
logDataorigen
=
[]
this
.
logData
.
map
(
item
=>
{
this
.
logDataorigen
.
push
(
item
.
sort
)
})
if
(
this
.
testdiv
===
true
)
{
let
_this
=
this
let
arr
=
[
'
specified_values
'
,
'
limit
'
,
'
url_ip_set_v2
'
,
'
ip_set_v2
'
,
'
test_mode
'
,
'
url_auth_list
'
,
'
url_white_list
'
,
'
url_black_list
'
,
'
domain_prefix
'
,
'
service_owner
'
];
let
keys
=
arr
.
some
(
function
(
item
){
return
item
===
_this
.
key
;
})
if
(
!
keys
)
{
this
.
elseConfireModal
=
true
;
return
}
if
(
this
.
key
===
'
ip_set_v2
'
||
this
.
key
===
'
url_ip_set_v2
'
||
this
.
key
===
'
specified_values
'
||
this
.
key
===
'
limit
'
)
{
this
.
contrastIpset
=
true
return
}
if
(
this
.
testdiv
)
{
this
.
ContrasttestModal
=
true
}
else
{
}
if
(
!
this
.
testdiv
)
{
this
.
ContrastModal
=
true
}
},
...
...
@@ -735,9 +1252,57 @@ export default {
}
if
(
this
.
key
===
'
test_mode
'
)
{
this
.
paramscontent
=
this
.
aftertestmostatus
===
true
?
'
true
'
:
'
false
'
}
else
{
}
if
(
this
.
key
===
'
url_auth_list
'
||
this
.
key
===
'
url_white_list
'
||
this
.
key
===
'
url_black_list
'
||
this
.
key
===
'
domain_prefix
'
||
this
.
key
===
'
service_owner
'
)
{
this
.
paramscontent
=
this
.
logDataorigen
}
if
(
this
.
key
===
'
ip_set_v2
'
)
{
this
.
ipsetData
.
map
(
item
=>
{
if
(
typeof
(
item
.
ip_list
)
===
'
object
'
)
{
item
.
ip_list
=
item
.
ip_list
}
else
{
item
.
ip_list
=
JSON
.
parse
(
item
.
ip_list
)
}
})
this
.
paramscontent
=
this
.
ipsetData
}
if
(
this
.
key
===
'
url_ip_set_v2
'
)
{
this
.
paramscontent
=
this
.
urlIpSetData
}
if
(
this
.
key
===
'
specified_values
'
)
{
if
(
!
this
.
specifiedData
.
length
)
{
this
.
paramscontent
=
this
.
specifiedData
}
else
{
this
.
specifiedData
.
forEach
(
item
=>
{
if
(
typeof
(
item
.
header
)
===
'
object
'
)
{
item
.
header
=
item
.
header
}
else
{
item
.
header
=
JSON
.
parse
(
item
.
header
)
}
})
this
.
paramscontent
=
this
.
specifiedData
}
}
if
(
this
.
key
===
'
limit
'
)
{
if
(
!
this
.
limitData
.
length
)
{
this
.
paramscontent
=
this
.
limitData
}
else
{
this
.
limitData
&&
this
.
limitData
.
forEach
(
item
=>
{
item
.
rate
=
Number
(
item
.
rate
)
item
.
duration
=
Number
(
item
.
duration
)
})
this
.
paramscontent
=
this
.
limitData
}
}
let
arr
=
[
'
specified_values
'
,
'
limit
'
,
'
url_ip_set_v2
'
,
'
ip_set_v2
'
,
'
test_mode
'
,
'
url_auth_list
'
,
'
url_white_list
'
,
'
url_black_list
'
,
'
domain_prefix
'
,
'
service_owner
'
];
let
_this
=
this
;
let
keys
=
arr
.
some
(
function
(
item
){
return
item
===
_this
.
key
;
})
if
(
!
keys
)
{
this
.
paramscontent
=
this
.
origenContent
}
postconfigurelist
(
data
,
this
.
paramscontent
).
then
(
data
=>
{
if
(
data
.
code
===
200
)
{
this
.
$Message
.
success
(
'
发布成功
'
)
...
...
@@ -745,8 +1310,15 @@ export default {
this
.
colorupdatacolor
=
false
this
.
ContrastModal
=
false
this
.
ContrasttestModal
=
false
this
.
contrastIpset
=
false
this
.
getconfigurlist
(
this
.
key
,
this
.
server
)
this
.
getList
(
this
.
key
,
this
.
server
)
this
.
contrastlist
=
this
.
logDataorigen
this
.
updataIpsetSta
=
false
this
.
updataUrlSta
=
false
this
.
updataLimitSta
=
false
this
.
elseConfireModal
=
false
this
.
updataSpecifiedSta
=
false
}
else
{
this
.
$Message
.
error
(
data
.
body
)
this
.
ContrastModal
=
false
...
...
@@ -802,6 +1374,7 @@ export default {
this
.
getnodeList
()
this
.
getkeytext
(
this
.
key
)
this
.
getconfigurlist
(
this
.
key
,
this
.
server
)
this
.
getList
(
this
.
key
,
this
.
server
)
},
coloechangeserver
()
{
this
.
server
=
this
.
origenselectserver
...
...
@@ -840,9 +1413,9 @@ export default {
return
arr
.
push
(
item
.
Meta
.
weight
)
})
let
sta
=
arr
.
some
(
function
(
item
,
index
,
array
)
{
return
item
!=
0
return
item
!=
=
0
})
if
(
sta
==
false
)
{
if
(
sta
==
=
false
)
{
this
.
$Message
.
error
(
'
权重不能全部修改为0
'
)
this
.
ContrastnodeModal
=
false
this
.
getnodeList
()
...
...
@@ -875,113 +1448,90 @@ export default {
})
},
confiechangediv
()
{
if
(
this
.
changekey
===
'
url_white_list
'
)
{
this
.
listonecolorauth
=
false
this
.
listonecolorfor
=
true
this
.
listonecolorint
=
false
this
.
listonecolorserv
=
false
this
.
listonecolordoma
=
false
this
.
listonecolortest
=
false
this
.
isShowList
=
true
this
.
logData
=
[]
this
.
contrastlist
=
[]
this
.
testdiv
=
false
this
.
colorupdatacolor
=
false
this
.
getkeytext
(
this
.
changekey
)
this
.
getconfigurlist
(
this
.
changekey
,
this
.
server
)
}
if
(
this
.
changekey
===
'
url_auth_list
'
)
{
this
.
listonecolorauth
=
true
this
.
listonecolorfor
=
false
this
.
listonecolorint
=
false
this
.
listonecolorserv
=
false
this
.
listonecolordoma
=
false
this
.
listonecolortest
=
false
this
.
colorupdatacolor
=
false
this
.
isShowList
=
true
this
.
testdiv
=
false
this
.
logData
=
[]
this
.
contrastlist
=
[]
this
.
getkeytext
(
this
.
changekeyy
)
this
.
getconfigurlist
(
this
.
changekey
,
this
.
server
)
}
if
(
this
.
changekey
===
'
url_black_list
'
)
{
this
.
listonecolorauth
=
false
this
.
listonecolorfor
=
false
this
.
listonecolorint
=
true
this
.
listonecolorserv
=
false
this
.
listonecolordoma
=
false
this
.
listonecolortest
=
false
this
.
colorupdatacolor
=
false
this
.
isShowList
=
true
this
.
testdiv
=
false
this
.
logData
=
[]
this
.
contrastlist
=
[]
this
.
getkeytext
(
this
.
changekey
)
this
.
getconfigurlist
(
this
.
changekey
,
this
.
server
)
}
if
(
this
.
changekey
===
'
domain_prefix
'
)
{
this
.
listonecolorauth
=
false
this
.
listonecolorfor
=
false
this
.
listonecolorint
=
false
this
.
listonecolorserv
=
false
this
.
listonecolordoma
=
true
this
.
listonecolortest
=
false
this
.
colorupdatacolor
=
false
this
.
isShowList
=
true
this
.
testdiv
=
false
this
.
logData
=
[]
this
.
contrastlist
=
[]
this
.
getkeytext
(
this
.
changekey
)
this
.
getconfigurlist
(
this
.
changekey
,
this
.
server
)
}
if
(
this
.
changekey
===
'
service_owner
'
)
{
this
.
listonecolorauth
=
false
this
.
listonecolorfor
=
false
this
.
listonecolorint
=
false
this
.
listonecolorserv
=
true
this
.
listonecolordoma
=
false
this
.
listonecolortest
=
false
this
.
colorupdatacolor
=
false
this
.
isShowList
=
true
this
.
testdiv
=
false
this
.
logData
=
[]
this
.
contrastlist
=
[]
this
.
getkeytext
(
this
.
changekey
)
this
.
getconfigurlist
(
this
.
changekey
,
this
.
server
)
}
if
(
this
.
changekey
===
'
test_mode
'
)
{
this
.
listonecolorauth
=
false
this
.
listonecolorfor
=
false
this
.
listonecolorint
=
false
this
.
listonecolorserv
=
false
this
.
listonecolordoma
=
false
this
.
listonecolortest
=
true
this
.
colorIndex
=
this
.
changeIndex
if
(
this
.
changekey
===
'
url_white_list
'
||
this
.
changekey
===
'
url_auth_list
'
||
this
.
changekey
===
'
url_black_list
'
||
this
.
changekey
===
'
domain_prefix
'
||
this
.
changekey
===
'
service_owner
'
||
this
.
changekey
===
'
test_mode
'
)
{
if
(
this
.
changekey
===
'
test_mode
'
)
{
this
.
listonecolorfor
=
false
this
.
listonecolortest
=
true
this
.
isShowList
=
false
this
.
testdiv
=
true
this
.
showTestModal
=
true
this
.
logData
=
[]
this
.
contrastlist
=
[]
this
.
getkeytext
(
this
.
changekey
)
let
data
=
{
key
:
this
.
changekey
,
service_name
:
this
.
server
}
getconfigurelist
(
data
).
then
(
data
=>
{
this
.
testmostatus
=
data
.
body
this
.
aftertestmostatuorigen
=
data
.
body
if
(
data
.
body
===
true
)
{
this
.
opentest
=
true
this
.
closetest
=
false
}
else
{
this
.
closetest
=
true
this
.
opentest
=
false
}
})
}
else
{
this
.
listonecolorfor
=
true
this
.
isShowList
=
true
this
.
logData
=
[]
this
.
contrastlist
=
[]
this
.
testdiv
=
false
this
.
colorupdatacolor
=
false
this
.
getkeytext
(
this
.
changekey
)
this
.
getconfigurlist
(
this
.
changekey
,
this
.
server
)
}
this
.
colorupdata
=
false
this
.
colorupdatacolor
=
false
this
.
isShowList
=
false
this
.
testdiv
=
true
this
.
logData
=
[]
this
.
contrastlist
=
[]
this
.
getkeytext
(
this
.
changekey
)
let
data
=
{
key
:
this
.
changekey
,
service_name
:
this
.
server
}
getconfigurelist
(
data
).
then
(
data
=>
{
this
.
testmostatus
=
data
.
body
this
.
aftertestmostatuorigen
=
data
.
body
if
(
data
.
body
===
true
)
{
this
.
opentest
=
true
this
.
closetest
=
false
}
else
{
this
.
closetest
=
true
this
.
opentest
=
false
this
.
changedivModal
=
false
}
else
{
if
(
this
.
changekey
===
'
ip_set_v2
'
||
this
.
changekey
===
'
url_ip_set_v2
'
||
this
.
changekey
===
'
limit
'
||
this
.
changekey
===
'
specified_values
'
)
{
if
(
this
.
changekey
===
'
ip_set_v2
'
)
{
this
.
showIpSet
=
true
this
.
showUrlIpSet
=
false
this
.
showLimit
=
false
this
.
showSpecified
=
false
this
.
showElse
=
false
}
})
if
(
this
.
changekey
===
'
url_ip_set_v2
'
)
{
this
.
showUrlIpSet
=
true
this
.
showIpSet
=
false
this
.
showLimit
=
false
this
.
showSpecified
=
false
this
.
showElse
=
false
}
if
(
this
.
changekey
===
'
limit
'
)
{
this
.
showLimit
=
true
this
.
showIpSet
=
false
this
.
showUrlIpSet
=
false
this
.
showSpecified
=
false
this
.
showElse
=
false
}
if
(
this
.
changekey
===
'
specified_values
'
)
{
this
.
showIpSet
=
false
this
.
showUrlIpSet
=
false
this
.
showLimit
=
false
this
.
showElse
=
false
this
.
showTestModal
=
false
}
this
.
getList
(
this
.
changekey
,
this
.
server
)
this
.
getkeytext
(
this
.
changekey
)
}
else
{
this
.
origenContent
=
''
this
.
showElse
=
true
this
.
getList
(
this
.
changekey
,
this
.
server
)
this
.
getkeytext
(
this
.
changekey
)
}
this
.
isShowList
=
false
this
.
showTestModal
=
false
this
.
colorupdata
=
false
this
.
colorupdatacolor
=
false
this
.
changedivModal
=
false
}
this
.
colorupdata
=
false
this
.
colorupdatacolor
=
false
this
.
changedivModal
=
false
},
confireupdatenode
()
{
if
(
this
.
updateweight
<
0
)
{
...
...
@@ -998,15 +1548,329 @@ export default {
this
.
colorupdatacolor
=
true
this
.
colorupdatacolor
=
true
this
.
origenselectserver
=
this
.
server
}
},
MenuList
()
{
getMenuList
().
then
(
res
=>
{
this
.
menu
=
res
&&
res
.
body
||
[]
})
},
addIpset
()
{
this
.
ipsetName
=
''
;
this
.
ipsetContent
=
''
;
this
.
addIpsetModal
=
true
;
this
.
updataIpsetSta
=
false
;
},
updateIpset
(
data
)
{
this
.
updataIpsetSta
=
true
;
this
.
updateconfigindex
=
data
.
_index
;
this
.
ipsetName
=
data
.
name
;
this
.
ipsetContent
=
JSON
.
stringify
(
data
.
ip_list
);
this
.
addIpsetModal
=
true
;
},
updateUrlIpset
(
data
)
{
this
.
updataUrlSta
=
true
;
let
list
=
{
key
:
'
ip_set_v2
'
,
service_name
:
this
.
server
};
getconfigurelist
(
list
).
then
(
data
=>
{
let
arr
=
(
data
&&
data
.
body
)
||
[];
arr
=
arr
.
filter
((
x
,
index
,
self
)
=>
self
.
indexOf
(
x
)
===
index
)
arr
.
map
(
item
=>
{
this
.
ipsetList
.
push
(
item
.
name
)
})
this
.
ipsetList
=
this
.
ipsetList
.
filter
((
x
,
index
,
self
)
=>
self
.
indexOf
(
x
)
===
index
)
});
this
.
updateconfigindex
=
data
.
_index
;
this
.
urlIpsetName
=
data
.
ip_set_name
;
this
.
urlIpsetPath
=
data
.
path
;
this
.
addUrlIpsetModal
=
true
;
},
updateLimit
(
data
)
{
this
.
updataLimitSta
=
true
;
this
.
updateconfigindex
=
data
.
_index
;
this
.
limitTime
=
data
.
duration
;
this
.
limitRate
=
data
.
rate
;
this
.
limitPath
=
data
.
path
;
this
.
addLimitModal
=
true
},
updateSpecified
(
data
)
{
this
.
updataSpecifiedSta
=
true
;
this
.
updateconfigindex
=
data
.
_index
;
this
.
body
=
data
.
body
;
this
.
header
=
JSON
.
stringify
(
data
.
header
);
this
.
err_type
=
data
.
err_type
;
this
.
err_tag
=
data
.
err_tag
;
this
.
addSpecifiedModal
=
true
},
addUrlIpset
()
{
this
.
urlIpsetName
=
''
;
this
.
urlIpsetPath
=
''
;
this
.
addUrlIpsetModal
=
true
;
let
data
=
{
key
:
'
ip_set_v2
'
,
service_name
:
this
.
server
}
getconfigurelist
(
data
).
then
(
data
=>
{
let
arr
=
(
data
&&
data
.
body
)
||
[];
arr
=
arr
.
filter
((
x
,
index
,
self
)
=>
self
.
indexOf
(
x
)
===
index
)
arr
.
map
(
item
=>
{
this
.
ipsetList
.
push
(
item
.
name
)
})
this
.
ipsetList
=
this
.
ipsetList
.
filter
((
x
,
index
,
self
)
=>
self
.
indexOf
(
x
)
===
index
)
})
},
addLimit
()
{
this
.
limitPath
=
''
;
this
.
limitTime
=
''
;
this
.
limitRate
=
''
;
this
.
addLimitModal
=
true
;
},
addSpecified
()
{
this
.
header
=
''
;
this
.
body
=
''
;
this
.
err_tag
=
''
;
this
.
err_type
=
''
;
this
.
addSpecifiedModal
=
true
;
},
confireIpset
()
{
if
(
!
this
.
ipsetName
||
!
this
.
ipsetContent
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
请输入完整信息
'
,
});
return
}
let
re
=
/
[
"
\[\]]
/g
// eslint-disable-line no-useless-escape
if
(
!
re
.
test
(
this
.
ipsetContent
))
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
输入格式不正确
'
,
});
return
}
let
str
=
this
.
ipsetContent
.
replace
(
re
,
''
);
let
arr
=
str
.
split
(
'
,
'
)
// 判断是否是IP字段
let
test
=
arr
&&
arr
.
every
(
item
=>
{
let
reg
=
/^
(\d
+
)\.(\d
+
)\.(\d
+
)\.(\d
+
)
$/
return
!
reg
.
test
(
item
)
})
if
(
test
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
输入格式不正确
'
,
});
return
}
if
(
this
.
updataIpsetSta
)
{
this
.
ipsetData
[
this
.
updateconfigindex
].
ip_list
=
this
.
ipsetContent
}
else
{
let
keys
=
this
.
ipsetData
.
some
(
item
=>
{
return
item
.
name
===
this
.
ipsetName
})
if
(
keys
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
不能添加重复的内容
'
,
});
return
}
this
.
ipsetData
.
push
(
{
name
:
this
.
ipsetName
,
ip_list
:
this
.
ipsetContent
,
}
);
}
this
.
addIpsetModal
=
false
;
this
.
colorupdata
=
true
;
this
.
colorupdatacolor
=
true
this
.
newIpsetData
=
[];
this
.
newIpsetData
=
this
.
ipsetData
;
this
.
origenselectserver
=
this
.
server
},
confireUrlSet
()
{
if
(
!
this
.
urlIpsetPath
||
!
this
.
urlIpsetName
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
请输入完整信息
'
,
});
return
}
let
keys
=
this
.
urlIpSetData
.
some
(
item
=>
{
return
item
.
ip_set_name
===
this
.
urlIpsetName
})
if
(
keys
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
不能添加重复的内容
'
,
});
return
}
if
(
this
.
updataUrlSta
)
{
this
.
urlIpSetData
[
this
.
updateconfigindex
].
path
=
this
.
urlIpsetPath
this
.
urlIpSetData
[
this
.
updateconfigindex
].
ip_set_name
=
this
.
urlIpsetName
}
else
{
this
.
urlIpSetData
.
push
(
{
ip_set_name
:
this
.
urlIpsetName
,
path
:
this
.
urlIpsetPath
,
}
);
}
this
.
addUrlIpsetModal
=
false
;
this
.
colorupdata
=
true
;
this
.
colorupdatacolor
=
true
this
.
newIpsetData
=
[];
this
.
newIpsetData
=
this
.
urlIpSetData
;
this
.
origenselectserver
=
this
.
server
},
confireLimit
()
{
if
(
!
this
.
limitPath
||
!
this
.
limitRate
||
!
this
.
limitTime
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
请输入完整信息
'
,
});
return
}
if
(
this
.
limitTime
<=
0
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
时间不能为0
'
,
});
return
}
let
keys
=
this
.
urlIpSetData
.
some
(
item
=>
{
return
item
.
path
===
this
.
limitPath
})
if
(
keys
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
不能添加重复的内容
'
,
});
return
}
if
(
this
.
updataLimitSta
)
{
this
.
limitData
[
this
.
updateconfigindex
].
path
=
this
.
limitPath
this
.
limitData
[
this
.
updateconfigindex
].
duration
=
this
.
limitTime
this
.
limitData
[
this
.
updateconfigindex
].
rate
=
this
.
limitRate
}
else
{
this
.
limitData
.
push
(
{
path
:
this
.
limitPath
,
rate
:
this
.
limitRate
,
duration
:
this
.
limitTime
,
}
);
}
this
.
addLimitModal
=
false
;
this
.
colorupdata
=
true
;
this
.
newIpsetData
=
[];
this
.
newIpsetData
=
this
.
limitData
;
this
.
colorupdatacolor
=
true
this
.
origenselectserver
=
this
.
server
},
confireSpecified
()
{
if
(
!
this
.
header
||
!
this
.
body
||
!
this
.
err_type
||
!
this
.
err_tag
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
请输入完整信息
'
,
});
return
}
let
keys
=
this
.
specifiedData
.
some
(
item
=>
{
return
item
.
err_type
===
this
.
err_type
&&
item
.
err_tag
===
this
.
err_tag
})
if
(
keys
)
{
this
.
$Notice
.
error
({
title
:
'
提示
'
,
desc
:
'
不能添加重复的内容
'
,
});
return
}
if
(
this
.
updataSpecifiedSta
)
{
this
.
specifiedData
[
this
.
updateconfigindex
].
body
=
this
.
body
this
.
specifiedData
[
this
.
updateconfigindex
].
header
=
this
.
header
this
.
specifiedData
[
this
.
updateconfigindex
].
err_type
=
this
.
err_type
this
.
specifiedData
[
this
.
updateconfigindex
].
err_tag
=
this
.
err_tag
}
else
{
this
.
specifiedData
.
push
(
{
body
:
this
.
body
,
header
:
this
.
header
,
err_type
:
this
.
err_type
,
err_tag
:
this
.
err_tag
,
}
);
}
this
.
addSpecifiedModal
=
false
;
this
.
colorupdata
=
true
;
this
.
newIpsetData
=
[];
this
.
newIpsetData
=
this
.
specifiedData
;
this
.
colorupdatacolor
=
true
this
.
origenselectserver
=
this
.
server
},
delateOne
(
data
)
{
this
.
delateindex
=
data
.
_index
;
this
.
delateIpModal
=
true
},
confierDelateOne
()
{
if
(
this
.
key
===
'
ip_set_v2
'
)
{
this
.
ipsetData
.
splice
(
this
.
delateindex
,
1
);
}
if
(
this
.
key
===
'
url_ip_set_v2
'
)
{
this
.
urlIpSetData
.
splice
(
this
.
delateindex
,
1
)
}
if
(
this
.
key
===
'
limit
'
)
{
this
.
limitData
.
splice
(
this
.
delateindex
,
1
)
}
if
(
this
.
key
===
'
specified_values
'
)
{
this
.
specifiedData
.
splice
(
this
.
delateindex
,
1
)
}
this
.
delateIpModal
=
false
this
.
colorupdata
=
true
;
this
.
colorupdatacolor
=
true
this
.
origenselectserver
=
this
.
server
},
getType
()
{
getTypeList
().
then
(
data
=>
{
this
.
tageList
=
(
data
&&
data
.
body
)
||
[]
})
},
changeType
(
data
)
{
if
(
data
===
'
proxy
'
)
{
this
.
tageList
=
[
'
timeout
'
,
'
other
'
]
}
else
{
this
.
getType
()
}
},
modify
()
{
this
.
updataOrigenContent
=
this
.
origenContent
;
this
.
modifyModal
=
true
;
},
conforeModify
()
{
this
.
origenContent
=
this
.
updataOrigenContent
;
this
.
colorupdatacolor
=
true
this
.
colorupdata
=
true
this
.
origenselectserver
=
this
.
server
this
.
modifyModal
=
false
;
},
reduction
()
{
this
.
origenContent
=
this
.
netModily
;
this
.
colorupdatacolor
=
false
this
.
colorupdata
=
false
},
},
created
()
{
},
async
mounted
()
{
await
this
.
getserlist
()
this
.
MenuList
()
this
.
getkeytext
(
'
url_auth_list
'
)
this
.
getconfigurlist
(
'
url_auth_list
'
,
this
.
server
)
this
.
getnodeList
()
this
.
getType
()
},
destroyed
()
{
}
...
...
@@ -1068,11 +1932,11 @@ export default {
}
.list_content
{
background
:
#f2f2f2
;
height
:
30px
;
line-height
:
30px
;
margin-top
:
10px
;
line-height
:
20px
;
margin
:
10px
0
;
width
:
80%
;
margin-left
:
10%
;
padding
:
10px
;
border-radius
:
5px
;
cursor
:
pointer
}
...
...
@@ -1103,7 +1967,8 @@ export default {
height
:
72%
;
width
:
99%
;
margin-left
:
1%
;
margin-top
:
1%
margin-top
:
1%
;
overflow-y
:
auto
;
}
.right_content_btn
{
margin
:
10%
0%
20%
0%
...
...
src/services/http.service.js
View file @
e98a4753
import
axios
from
'
axios
'
import
{
Notice
}
from
'
iview
'
import
localStorage
from
'
./localStorage.service
'
import
axios
from
"
axios
"
;
import
{
Notice
}
from
"
iview
"
;
import
localStorage
from
"
./localStorage.service
"
;
// window.Promise = require('es6-promise').Promise
const
config
=
{
timeout
:
600000
// withCredentials: true // 允许携带cookie
}
const
instance
=
axios
.
create
(
Object
.
assign
({},
config
))
instance
.
_extend
=
{}
}
;
const
instance
=
axios
.
create
(
Object
.
assign
({},
config
))
;
instance
.
_extend
=
{}
;
function
requestInterceptor
(
config
)
{
config
.
headers
[
'
x-requested-with
'
]
=
'
XMLHttpRequest
'
function
requestInterceptor
(
config
)
{
config
.
headers
[
"
x-requested-with
"
]
=
"
XMLHttpRequest
"
;
// if (!config.headers['Content-Type']) {
// config.headers['Content-Type'] = 'application/x-www-form-urlencoded'
// }
if
(
!
config
.
headers
[
'
heimdallr-token
'
])
{
config
.
headers
[
'
heimdallr-token
'
]
=
localStorage
.
get
(
'
heimdallr-token
'
)
||
''
if
(
!
config
.
headers
[
"
heimdallr-token
"
])
{
config
.
headers
[
"
heimdallr-token
"
]
=
localStorage
.
get
(
"
heimdallr-token
"
)
||
""
;
}
return
config
return
config
;
}
function
responseInterceptor
(
response
)
{
function
responseInterceptor
(
response
)
{
if
(
response
.
status
<
200
||
response
.
status
>
300
)
{
Notice
.
error
({
title
:
'
请求发生错误
'
,
desc
:
response
&&
response
.
data
&&
(
response
.
data
.
errorMsg
||
'
请联系系统管理员
'
)
})
return
Promise
.
reject
(
response
&&
response
.
data
)
title
:
"
请求发生错误
"
,
desc
:
response
&&
response
.
data
&&
(
response
.
data
.
errorMsg
||
"
请联系系统管理员
"
)
});
return
Promise
.
reject
(
response
&&
response
.
data
);
}
// code是0000表示成功
if
(
response
.
data
.
code
===
200
||
response
.
data
.
code
===
400
)
{
return
Promise
.
resolve
(
response
.
data
||
null
)
return
Promise
.
resolve
(
response
.
data
||
null
)
;
}
if
(
response
.
data
.
code
===
401
)
{
window
.
location
.
href
=
window
.
location
.
origin
+
'
/login
'
window
.
location
.
href
=
window
.
location
.
origin
+
"
/login
"
;
}
// Notice.error({
// title: '',
// desc: response.data.errorMsg || response.data.message || '请联系客服'
// })
return
Promise
.
reject
(
response
&&
response
.
data
)
return
Promise
.
reject
(
response
&&
response
.
data
)
;
}
/**
...
...
@@ -52,23 +56,23 @@ function responseInterceptor (response) {
* axios.interceptors.request.eject(0)
* axios.interceptors.response.eject(0)
*/
instance
.
interceptors
.
request
.
use
(
requestInterceptor
,
(
error
)
=>
{
// return Promise.reject(error)
})
instance
.
interceptors
.
request
.
use
(
requestInterceptor
,
error
=>
{
return
Promise
.
reject
(
error
);
})
;
instance
.
interceptors
.
response
.
use
(
responseInterceptor
,
error
=>
{
// const code = response.data
if
(
error
.
response
&&
error
.
response
.
status
===
401
)
{
window
.
location
.
href
=
window
.
location
.
origin
+
'
/login
'
window
.
location
.
href
=
window
.
location
.
origin
+
"
/login
"
;
}
if
(
error
.
message
.
indexOf
(
'
timeout
'
)
!==
-
1
)
{
if
(
error
.
message
.
indexOf
(
"
timeout
"
)
!==
-
1
)
{
Notice
.
error
({
title
:
''
,
desc
:
'
请求超时
'
})
title
:
""
,
desc
:
"
请求超时
"
})
;
}
// return Promise.reject(error)
})
})
;
export
default
instance
export
default
instance
;
src/services/init.service.js
View file @
e98a4753
import
localStorage
from
'
../services/localStorage.service
'
export
default
{
init
(
router
)
{
import
localStorage
from
"
../services/localStorage.service
"
;
export
default
{
init
(
router
)
{
router
.
beforeEach
((
to
,
form
,
next
)
=>
{
const
token
=
localStorage
.
get
(
'
heimdallr-token
'
)
if
(
to
.
meta
&&
!
to
.
meta
.
allowBack
&&
window
.
history
&&
window
.
history
.
pushState
)
{
// 登录页面不能后退
history
.
pushState
(
null
,
null
,
document
.
URL
)
const
token
=
localStorage
.
get
(
"
heimdallr-token
"
);
if
(
to
.
meta
&&
!
to
.
meta
.
allowBack
&&
window
.
history
&&
window
.
history
.
pushState
)
{
// 登录页面不能后退
history
.
pushState
(
null
,
null
,
document
.
URL
);
}
if
(
to
.
name
===
'
login
'
)
{
next
()
return
if
(
to
.
name
===
"
login
"
)
{
next
()
;
return
;
}
if
(
!
token
)
{
window
.
location
.
href
=
`
${
window
.
location
.
origin
}
/login`
return
window
.
location
.
href
=
`
${
window
.
location
.
origin
}
/login`
;
return
;
}
next
()
})
next
()
;
})
;
}
}
}
;
src/services/localStorage.service.js
View file @
e98a4753
export
default
{
get
(
key
)
{
let
result
=
localStorage
.
getItem
(
key
)
export
default
{
get
(
key
)
{
let
result
=
localStorage
.
getItem
(
key
)
;
try
{
result
=
JSON
.
parse
(
result
)
result
=
JSON
.
parse
(
result
)
;
}
catch
(
e
)
{}
return
result
return
result
;
},
set
(
key
,
value
)
{
let
toString
=
Object
.
prototype
.
toString
if
(
toString
.
call
(
value
)
===
'
[object Array]
'
||
toString
.
call
(
value
)
===
'
[object Object]
'
)
{
value
=
JSON
.
stringify
(
value
)
set
(
key
,
value
)
{
let
toString
=
Object
.
prototype
.
toString
;
if
(
toString
.
call
(
value
)
===
"
[object Array]
"
||
toString
.
call
(
value
)
===
"
[object Object]
"
)
{
value
=
JSON
.
stringify
(
value
);
}
return
localStorage
.
setItem
(
key
,
value
)
return
localStorage
.
setItem
(
key
,
value
)
;
},
remove
(
key
)
{
return
localStorage
.
removeItem
(
key
)
remove
(
key
)
{
return
localStorage
.
removeItem
(
key
)
;
},
clear
()
{
return
localStorage
.
clear
()
clear
()
{
return
localStorage
.
clear
()
;
}
}
}
;
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