Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fk-spider-web
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
周田
fk-spider-web
Commits
f19c6910
Commit
f19c6910
authored
Nov 24, 2025
by
liucan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修改爬虫错误提示为全局提示
parent
2f48a31a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
35 deletions
+39
-35
.env.development
.env.development
+2
-0
AppMain.vue
src/layout/components/AppMain.vue
+33
-1
errorMessageChart.vue
src/views/os-status/components/errorMessageChart.vue
+2
-2
taskCard.vue
src/views/os-taskInformation/components/taskCard.vue
+2
-32
No files found.
.env.development
View file @
f19c6910
# 开发环境配置
VITE_APP_BASE_API = '/api'
VITE_APP_TITLE = 'Spider Admin Pro'
VITE_WEBSOCKET_API = "http://192.168.3.10:5001/"
\ No newline at end of file
src/layout/components/AppMain.vue
View file @
f19c6910
<
script
setup
lang=
"ts"
>
import
{
computed
}
from
"vue"
;
import
{
ElNotification
}
from
"element-plus"
;
import
{
Manager
,
Socket
}
from
"socket.io-client"
;
import
{
computed
,
onMounted
,
onUnmounted
,
ref
}
from
"vue"
;
import
{
useRoute
}
from
"vue-router"
;
const
route
=
useRoute
();
const
key
=
computed
(()
=>
route
.
path
);
const
socket
=
ref
<
Socket
|
null
>
(
null
);
//错误消息通知
const
handleErrorMsgNotify
=
()
=>
{
//websocket连接
const
manager
=
new
Manager
(
import
.
meta
.
env
.
VITE_WEBSOCKET_API
);
socket
.
value
=
manager
.
socket
(
"/"
);
//收到错误通知
socket
.
value
.
on
(
"error_message"
,
onErrorMsg
);
};
//错误消息处理
const
onErrorMsg
=
({
message
}:
{
message
:
any
})
=>
{
ElNotification
({
title
:
"爬虫错误提示"
,
message
,
type
:
"error"
,
});
};
onMounted
(()
=>
{
handleErrorMsgNotify
();
});
onUnmounted
(()
=>
{
if
(
socket
.
value
)
{
socket
.
value
.
disconnect
();
}
});
</
script
>
<
template
>
...
...
src/views/os-status/components/errorMessageChart.vue
View file @
f19c6910
...
...
@@ -8,7 +8,7 @@
<el-table-column
width=
"55"
label=
"序号"
type=
"index"
/>
<el-table-column
width=
"150"
property=
"spider"
label=
"爬虫名称"
/>
<el-table-column
property=
"error"
label=
"错误信息"
/>
<el-table-column
width=
"160"
property=
"timestamp"
label=
"
发生
时间"
/>
<el-table-column
width=
"160"
property=
"timestamp"
label=
"
记录
时间"
/>
</el-table>
<div
class=
"pagination w-full flex flex-row-reverse pr-4 m-t-4"
>
<Pagination
...
...
@@ -65,7 +65,7 @@ const logCountList = computed(() => {
return
logList
.
value
.
map
((
item
)
=>
item
.
count
);
});
//
x
轴日期列表
//
X
轴日期列表
const
dateList
=
ref
<
string
[]
>
([]);
//Y轴最大值
...
...
src/views/os-taskInformation/components/taskCard.vue
View file @
f19c6910
...
...
@@ -90,18 +90,17 @@
<
/template
>
<
script
lang
=
"ts"
setup
>
import
{
ref
,
onMounted
,
onUnmounted
}
from
"vue"
;
import
{
ref
,
onMounted
}
from
"vue"
;
import
{
useRouter
}
from
"vue-router"
;
import
addTaskDialog
from
"./addTaskDialog.vue"
;
import
{
getSpiderTaskList
,
resumeSpiderTask
,
pauseSpiderTask
,
getTaskCount
}
from
"@/api/spiderTask"
;
import
{
DeleteMode
}
from
"@/components/Delete/enum.ts"
;
import
{
AddMode
}
from
"./enum"
;
import
deleteDialog
from
"./deleteDialog.vue"
;
import
{
ElMessage
,
ElNotification
}
from
"element-plus"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
getSpiderList
}
from
"@/api/system.ts"
;
import
formatExactLargeNum
from
"@/utils/formatExactLargeNum"
;
import
TableSearch
from
"@/components/TableSearch.vue"
;
import
{
Manager
,
Socket
}
from
"socket.io-client"
;
const
props
=
defineProps
({
spiderType
:
{
...
...
@@ -118,26 +117,6 @@ const props = defineProps({
}
,
}
);
const
socket
=
ref
<
Socket
|
null
>
(
null
);
//错误消息通知
const
handleErrorMsgNotify
=
()
=>
{
//websocket连接
const
manager
=
new
Manager
(
"/api:5001"
);
socket
.
value
=
manager
.
socket
(
"/"
);
//收到错误通知
socket
.
value
.
on
(
"error_message"
,
onErrorMsg
);
}
;
//错误消息处理
const
onErrorMsg
=
({
message
}
:
{
message
:
any
}
)
=>
{
ElNotification
({
title
:
"任务错误提示"
,
message
,
type
:
"error"
,
}
);
}
;
// 所有响应式变量初始化时避免 undefined
const
taskSelectOptions
=
ref
<
any
[]
>
([]);
// 初始化为空数组
const
searchCondition
=
ref
({
...
...
@@ -311,15 +290,6 @@ onMounted(() => {
}
getData
();
getSpiderTypeList
();
//开启socket连接
handleErrorMsgNotify
();
}
);
onUnmounted
(()
=>
{
//关闭socket连接
if
(
socket
.
value
)
{
socket
.
value
.
disconnect
();
}
}
);
<
/script
>
...
...
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