Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FleetTruckView
Project
Project
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
FleetTruck
FleetTruckView
Commits
014f5ff8
Commit
014f5ff8
authored
Nov 02, 2023
by
高晓帆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志
parent
53451bf0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
688 additions
and
0 deletions
+688
-0
index_20231102173843.js
.history/src/js/socket/index_20231102173843.js
+0
-0
index_20231102173924.js
.history/src/js/socket/index_20231102173924.js
+0
-0
writeLog_20231102173248.js
.history/src/js/writeLog_20231102173248.js
+0
-0
writeLog_20231102173300.js
.history/src/js/writeLog_20231102173300.js
+14
-0
main_20231102173217.js
.history/src/main_20231102173217.js
+75
-0
main_20231102173436.js
.history/src/main_20231102173436.js
+88
-0
Login_20231102173217.vue
.history/src/views/Login_20231102173217.vue
+162
-0
Login_20231102173621.vue
.history/src/views/Login_20231102173621.vue
+164
-0
Logout_20231102173217.vue
.history/src/views/Logout_20231102173217.vue
+75
-0
Logout_20231102173708.vue
.history/src/views/Logout_20231102173708.vue
+77
-0
index.js
src/js/socket/index.js
+2
-0
writeLog.js
src/js/writeLog.js
+14
-0
main.js
src/main.js
+13
-0
Login.vue
src/views/Login.vue
+2
-0
Logout.vue
src/views/Logout.vue
+2
-0
No files found.
.history/src/js/socket/index_20231102173843.js
0 → 100644
View file @
014f5ff8
This diff is collapsed.
Click to expand it.
.history/src/js/socket/index_20231102173924.js
0 → 100644
View file @
014f5ff8
This diff is collapsed.
Click to expand it.
.history/src/js/writeLog_20231102173248.js
0 → 100644
View file @
014f5ff8
.history/src/js/writeLog_20231102173300.js
0 → 100644
View file @
014f5ff8
import
axios
from
'axios'
;
let
loginForm
=
JSON
.
parse
(
window
.
localStorage
.
getItem
(
`
${
location
.
host
}
loginForm`
))
const
writeLog
=
(
type
,
data
)
=>
{
let
log
=
type
+
' '
+
new
Date
().
format
(
'yyyy-MM-dd hh:mm:ss'
)
+
' '
+
loginForm
.
number
+
' '
+
location
.
host
+
' '
+
data
axios
.
post
(
"//"
+
document
.
location
.
logServe
+
"/ht/api/web/log/upload"
,{
log
:
log
}).
then
(
res
=>
{
if
(
res
.
code
!=
0
){
console
.
log
(
'writeLog'
,
res
.
msg
)
}
}).
catch
(
err
=>
{
console
.
log
(
'writeLog'
,
err
)
})
}
export
default
writeLog
\ No newline at end of file
.history/src/main_20231102173217.js
0 → 100644
View file @
014f5ff8
import
{
createApp
}
from
'vue'
import
{
createPinia
}
from
'pinia'
import
App
from
'./App.vue'
import
router
from
'./router'
import
axios
from
'axios'
import
IndexRoot
from
'./js/IndexRoot.js'
import
ViewUIPlus
from
'view-ui-plus'
import
'leaflet/dist/leaflet.css'
import
'view-ui-plus/dist/styles/viewuiplus.css'
import
'./assets/main.css'
window
.
state
=
null
/**
* usage:
* let x = new Date()
* x.format('yyyy-MM-dd hh:mm:ss')
*
* @method format
*
* @param {[type]} format [description]
*
* @return {[type]} [description]
*/
Date
.
prototype
.
format
=
function
(
format
)
{
// eslint-disable-line
let
o
=
{
'M+'
:
this
.
getMonth
()
+
1
,
// month
'd+'
:
this
.
getDate
(),
// day
'h+'
:
this
.
getHours
(),
// hour
'm+'
:
this
.
getMinutes
(),
// minute
's+'
:
this
.
getSeconds
(),
// second
'q+'
:
Math
.
floor
((
this
.
getMonth
()
+
3
)
/
3
),
// quarter
'S'
:
this
.
getMilliseconds
()
// millisecond
}
if
(
/
(
y+
)
/
.
test
(
format
))
{
format
=
format
.
replace
(
RegExp
.
$1
,
(
this
.
getFullYear
()
+
''
).
substr
(
4
-
RegExp
.
$1
.
length
))
}
for
(
let
k
in
o
)
{
if
(
new
RegExp
(
'('
+
k
+
')'
).
test
(
format
))
{
format
=
format
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
===
1
?
o
[
k
]
:
(
'00'
+
o
[
k
]).
substr
((
''
+
o
[
k
]).
length
))
}
}
return
format
}
const
pinia
=
createPinia
()
const
app
=
createApp
(
App
)
let
$indexRoot
=
new
IndexRoot
()
app
.
config
.
globalProperties
.
$indexRoot
=
$indexRoot
app
.
use
(
router
)
.
use
(
ViewUIPlus
)
.
use
(
pinia
)
function
getSysConfig
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
get
(
'/config.json'
).
then
((
result
)
=>
{
let
config
=
result
.
data
resolve
(
config
)
}).
catch
((
error
)
=>
{
console
.
log
(
error
)
reject
()
})
})
}
async
function
init
()
{
const
{
SERVICE_IP
,
MAP_CENTER
}
=
await
getSysConfig
()
document
.
location
.
serviceIP
=
SERVICE_IP
document
.
location
.
mapCenter
=
MAP_CENTER
}
init
().
then
(()
=>
app
.
mount
(
'#app'
))
.history/src/main_20231102173436.js
0 → 100644
View file @
014f5ff8
import
{
createApp
}
from
'vue'
import
{
createPinia
}
from
'pinia'
import
App
from
'./App.vue'
import
router
from
'./router'
import
axios
from
'axios'
import
IndexRoot
from
'./js/IndexRoot.js'
import
writeLog
from
'./js/writeLog.js'
import
ViewUIPlus
from
'view-ui-plus'
import
'leaflet/dist/leaflet.css'
import
'view-ui-plus/dist/styles/viewuiplus.css'
import
'./assets/main.css'
window
.
state
=
null
/**
* usage:
* let x = new Date()
* x.format('yyyy-MM-dd hh:mm:ss')
*
* @method format
*
* @param {[type]} format [description]
*
* @return {[type]} [description]
*/
Date
.
prototype
.
format
=
function
(
format
)
{
// eslint-disable-line
let
o
=
{
'M+'
:
this
.
getMonth
()
+
1
,
// month
'd+'
:
this
.
getDate
(),
// day
'h+'
:
this
.
getHours
(),
// hour
'm+'
:
this
.
getMinutes
(),
// minute
's+'
:
this
.
getSeconds
(),
// second
'q+'
:
Math
.
floor
((
this
.
getMonth
()
+
3
)
/
3
),
// quarter
'S'
:
this
.
getMilliseconds
()
// millisecond
}
if
(
/
(
y+
)
/
.
test
(
format
))
{
format
=
format
.
replace
(
RegExp
.
$1
,
(
this
.
getFullYear
()
+
''
).
substr
(
4
-
RegExp
.
$1
.
length
))
}
for
(
let
k
in
o
)
{
if
(
new
RegExp
(
'('
+
k
+
')'
).
test
(
format
))
{
format
=
format
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
===
1
?
o
[
k
]
:
(
'00'
+
o
[
k
]).
substr
((
''
+
o
[
k
]).
length
))
}
}
return
format
}
const
pinia
=
createPinia
()
const
app
=
createApp
(
App
)
let
$indexRoot
=
new
IndexRoot
()
app
.
config
.
globalProperties
.
$indexRoot
=
$indexRoot
window
.
onerror
=
(
message
,
source
,
lineno
,
colno
,
error
)
=>
{
var
data
=
{
message
:
message
,
source
:
source
,
lineno
:
lineno
,
colno
:
colno
,
error
:
error
};
writeLog
(
'ERROR'
,
JSON
.
stringify
(
data
))
}
app
.
use
(
router
)
.
use
(
ViewUIPlus
)
.
use
(
pinia
)
function
getSysConfig
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
get
(
'/config.json'
).
then
((
result
)
=>
{
let
config
=
result
.
data
resolve
(
config
)
}).
catch
((
error
)
=>
{
console
.
log
(
error
)
reject
()
})
})
}
async
function
init
()
{
const
{
SERVICE_IP
,
MAP_CENTER
}
=
await
getSysConfig
()
document
.
location
.
serviceIP
=
SERVICE_IP
document
.
location
.
mapCenter
=
MAP_CENTER
}
init
().
then
(()
=>
app
.
mount
(
'#app'
))
.history/src/views/Login_20231102173217.vue
0 → 100644
View file @
014f5ff8
<
template
>
<div
class=
"login"
>
<p
v-show=
"isShow"
class=
"tips"
>
{{
tip
}}
</p>
<div
class=
"loadingContainer"
v-show=
"isShowLoading"
>
<Spin
fix
>
<Icon
type=
"ios-loading"
size=
"30"
class=
"spin-icon-load"
style=
"color: #dec02b"
></Icon>
<span
class=
"loading-tip"
>
正在登录,请稍后...
</span>
</Spin>
</div>
<img
class=
"logo"
src=
"/image/logo.png"
alt=
""
/>
<Form>
<FormItem
prop=
"number"
>
<Input
type=
"text"
v-model
.
trim=
"formItem.number"
placeholder=
"请输入用户名"
>
<Icon
type=
"ios-person-outline"
slot=
"prepend"
></Icon>
</Input>
</FormItem>
<FormItem
prop=
"name"
>
<Input
type=
"password"
v-model
.
trim=
"formItem.password"
placeholder=
"请输入密码"
>
<Icon
type=
"ios-lock-outline"
slot=
"prepend"
></Icon>
</Input>
</FormItem>
<FormItem>
<Button
long
type=
"primary"
@
click=
"handleSubmit"
>
登录
</Button>
</FormItem>
</Form>
</div>
</
template
>
<
script
setup
>
import
{
reactive
,
ref
,
watch
,
getCurrentInstance
}
from
'vue'
;
import
{
storeToRefs
}
from
'pinia'
import
{
Message
}
from
'view-ui-plus'
;
import
{
useStateStore
}
from
'@/store/StateStore.js'
import
router
from
'@/router'
const
isShow
=
ref
(
false
)
const
tip
=
ref
(
''
)
const
isShowLoading
=
ref
(
false
)
const
truckMonitorStatus
=
ref
(
false
)
const
rootBus
=
ref
(
null
)
const
stateStore
=
useStateStore
()
const
stateStoreToRefs
=
storeToRefs
(
stateStore
)
const
{
getLoginAck
,
truckMonitorMsg
,
isShowNetworkTip
}
=
stateStoreToRefs
const
instance
=
getCurrentInstance
()
const
{
appContext
}
=
instance
const
{
$indexRoot
}
=
appContext
.
config
.
globalProperties
const
formItem
=
reactive
({
number
:
''
,
password
:
''
})
function
handleSubmit
()
{
if
(
isShowLoading
.
value
)
return
if
(
truckMonitorStatus
.
value
)
return
Message
.
error
(
'车端未启动,无法登录!'
)
if
(
!
formItem
.
number
||
!
formItem
.
password
)
return
Message
.
error
(
'请将用户名和密码填写完整!'
)
window
.
state
=
"login"
;
let
loginForm
=
JSON
.
stringify
({
type
:
"/login/req"
,
msg
:
{
number
:
formItem
.
number
,
password
:
formItem
.
password
}
})
if
(
$indexRoot
.
sock
)
{
$indexRoot
.
sock
.
send
(
loginForm
)
}
else
{
$indexRoot
.
init
().
then
(
socket
=>
{
socket
.
send
(
loginForm
)
})
}
}
watch
(
getLoginAck
,
(
value
)
=>
{
if
(
value
&&
window
.
state
===
'login'
)
{
let
{
code
,
number
}
=
value
if
(
code
===
0
&&
number
===
formItem
.
number
)
{
router
.
push
({
name
:
'main'
})
window
.
state
=
null
stateStore
.
setLoginForm
(
formItem
)
}
else
{
Message
.
error
(
value
.
msg
)
stateStore
.
setData
(
'loginAck'
,
null
)
}
}
})
watch
([
truckMonitorMsg
,
isShowNetworkTip
],
([
data
,
isNetworkTip
])
=>
{
if
(
data
)
{
let
{
visible
,
msg
}
=
data
truckMonitorStatus
.
value
=
visible
isShow
.
value
=
visible
tip
.
value
=
msg
isShowLoading
.
value
=
false
}
if
(
isNetworkTip
)
{
isShow
.
value
=
isNetworkTip
.
value
}
},
{
deep
:
true
,
immediate
:
true
})
</
script
>
<
style
lang=
"less"
scoped
>
.login {
width: 100%;
height: 100%;
background: url("/image/background.png") no-repeat;
background-size: cover;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
.logo {
margin-bottom: 20px;
width: 25vw;
height: auto;
}
.tips {
color: #ff6363;
animation: roll 5s infinite;
position: absolute;
top: 2vh;
}
@keyframes roll {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-200px);
}
}
.loadingContainer {
display: block;
position: absolute;
width: 200px;
top: 15vh;
background: rgba(0, 0, 0, 0);
}
.loadingContainer .ivu-spin-fix {
background: rgba(0, 0, 0, 0) !important;
}
.loading-tip {
white-space: nowrap;
color: #fff;
}
}
</
style
>
\ No newline at end of file
.history/src/views/Login_20231102173621.vue
0 → 100644
View file @
014f5ff8
<
template
>
<div
class=
"login"
>
<p
v-show=
"isShow"
class=
"tips"
>
{{
tip
}}
</p>
<div
class=
"loadingContainer"
v-show=
"isShowLoading"
>
<Spin
fix
>
<Icon
type=
"ios-loading"
size=
"30"
class=
"spin-icon-load"
style=
"color: #dec02b"
></Icon>
<span
class=
"loading-tip"
>
正在登录,请稍后...
</span>
</Spin>
</div>
<img
class=
"logo"
src=
"/image/logo.png"
alt=
""
/>
<Form>
<FormItem
prop=
"number"
>
<Input
type=
"text"
v-model
.
trim=
"formItem.number"
placeholder=
"请输入用户名"
>
<Icon
type=
"ios-person-outline"
slot=
"prepend"
></Icon>
</Input>
</FormItem>
<FormItem
prop=
"name"
>
<Input
type=
"password"
v-model
.
trim=
"formItem.password"
placeholder=
"请输入密码"
>
<Icon
type=
"ios-lock-outline"
slot=
"prepend"
></Icon>
</Input>
</FormItem>
<FormItem>
<Button
long
type=
"primary"
@
click=
"handleSubmit"
>
登录
</Button>
</FormItem>
</Form>
</div>
</
template
>
<
script
setup
>
import
{
reactive
,
ref
,
watch
,
getCurrentInstance
}
from
'vue'
;
import
{
storeToRefs
}
from
'pinia'
import
{
Message
}
from
'view-ui-plus'
;
import
{
useStateStore
}
from
'@/store/StateStore.js'
import
router
from
'@/router'
import
writeLog
from
'@/js/writeLog.js'
const
isShow
=
ref
(
false
)
const
tip
=
ref
(
''
)
const
isShowLoading
=
ref
(
false
)
const
truckMonitorStatus
=
ref
(
false
)
const
rootBus
=
ref
(
null
)
const
stateStore
=
useStateStore
()
const
stateStoreToRefs
=
storeToRefs
(
stateStore
)
const
{
getLoginAck
,
truckMonitorMsg
,
isShowNetworkTip
}
=
stateStoreToRefs
const
instance
=
getCurrentInstance
()
const
{
appContext
}
=
instance
const
{
$indexRoot
}
=
appContext
.
config
.
globalProperties
const
formItem
=
reactive
({
number
:
''
,
password
:
''
})
function
handleSubmit
()
{
if
(
isShowLoading
.
value
)
return
if
(
truckMonitorStatus
.
value
)
return
Message
.
error
(
'车端未启动,无法登录!'
)
if
(
!
formItem
.
number
||
!
formItem
.
password
)
return
Message
.
error
(
'请将用户名和密码填写完整!'
)
window
.
state
=
"login"
;
let
loginForm
=
JSON
.
stringify
({
type
:
"/login/req"
,
msg
:
{
number
:
formItem
.
number
,
password
:
formItem
.
password
}
})
if
(
$indexRoot
.
sock
)
{
$indexRoot
.
sock
.
send
(
loginForm
)
}
else
{
$indexRoot
.
init
().
then
(
socket
=>
{
socket
.
send
(
loginForm
)
})
}
}
watch
(
getLoginAck
,
(
value
)
=>
{
if
(
value
&&
window
.
state
===
'login'
)
{
writeLog
(
'INFO'
,
"登陆成功"
)
let
{
code
,
number
}
=
value
if
(
code
===
0
&&
number
===
formItem
.
number
)
{
router
.
push
({
name
:
'main'
})
window
.
state
=
null
stateStore
.
setLoginForm
(
formItem
)
}
else
{
Message
.
error
(
value
.
msg
)
stateStore
.
setData
(
'loginAck'
,
null
)
}
}
})
watch
([
truckMonitorMsg
,
isShowNetworkTip
],
([
data
,
isNetworkTip
])
=>
{
if
(
data
)
{
let
{
visible
,
msg
}
=
data
truckMonitorStatus
.
value
=
visible
isShow
.
value
=
visible
tip
.
value
=
msg
isShowLoading
.
value
=
false
}
if
(
isNetworkTip
)
{
isShow
.
value
=
isNetworkTip
.
value
}
},
{
deep
:
true
,
immediate
:
true
})
</
script
>
<
style
lang=
"less"
scoped
>
.login {
width: 100%;
height: 100%;
background: url("/image/background.png") no-repeat;
background-size: cover;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
.logo {
margin-bottom: 20px;
width: 25vw;
height: auto;
}
.tips {
color: #ff6363;
animation: roll 5s infinite;
position: absolute;
top: 2vh;
}
@keyframes roll {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-200px);
}
}
.loadingContainer {
display: block;
position: absolute;
width: 200px;
top: 15vh;
background: rgba(0, 0, 0, 0);
}
.loadingContainer .ivu-spin-fix {
background: rgba(0, 0, 0, 0) !important;
}
.loading-tip {
white-space: nowrap;
color: #fff;
}
}
</
style
>
\ No newline at end of file
.history/src/views/Logout_20231102173217.vue
0 → 100644
View file @
014f5ff8
<
template
>
<div
class=
"log-out"
>
<p>
{{
tipsLogout
}}
</p>
<div
class=
"footer"
>
<Button
type=
"info"
class=
"btn"
@
click=
"doSureLogout"
>
确定
</Button>
<Button
type=
"error"
@
click=
"doCancelLogout"
>
取消
</Button>
</div>
</div>
</
template
>
<
script
setup
>
import
{
ref
,
watch
}
from
'vue'
import
{
useVehicleStore
}
from
'../store/VehicleStore'
;
import
{
useStateStore
}
from
'../store/StateStore'
;
import
{
storeToRefs
}
from
'pinia'
;
const
props
=
defineProps
({
isShow
:
Boolean
})
const
tipsLogout
=
ref
(
'退出当前系统'
)
const
logoutStep
=
ref
(
0
)
const
vehicleStore
=
useVehicleStore
()
const
vehicleStoreToRefs
=
storeToRefs
(
vehicleStore
)
const
{
pattern
}
=
vehicleStoreToRefs
const
stateStore
=
useStateStore
()
const
emits
=
defineEmits
([
'handleSend'
,
'closeModal'
])
function
doCancelLogout
()
{
logoutStep
.
value
=
0
emits
(
'closeModal'
)
}
function
closeSystem
()
{
logoutStep
.
value
=
0
window
.
state
=
'logout'
emits
(
'handleSend'
,
{
type
:
'/btn/quitApp'
,
msg
:
{}
})
stateStore
.
setData
(
'loginAck'
,
null
)
}
function
doSureLogout
()
{
if
(
pattern
.
value
===
1
&&
logoutStep
.
value
===
0
)
{
tipsLogout
.
value
=
'当前是无人模式,确定退出程序'
logoutStep
.
value
=
1
}
else
{
closeSystem
()
}
}
watch
(()
=>
props
.
isShow
,
(
value
)
=>
{
if
(
value
)
{
tipsLogout
.
value
=
'退出当前系统'
}
},
{
immediate
:
true
})
</
script
>
<
style
lang=
"less"
scoped
>
.log-out {
&>p {
margin-bottom: 20px;
}
.footer {
text-align: end;
.btn {
margin-right: 10px;
}
}
}
</
style
>
\ No newline at end of file
.history/src/views/Logout_20231102173708.vue
0 → 100644
View file @
014f5ff8
<
template
>
<div
class=
"log-out"
>
<p>
{{
tipsLogout
}}
</p>
<div
class=
"footer"
>
<Button
type=
"info"
class=
"btn"
@
click=
"doSureLogout"
>
确定
</Button>
<Button
type=
"error"
@
click=
"doCancelLogout"
>
取消
</Button>
</div>
</div>
</
template
>
<
script
setup
>
import
{
ref
,
watch
}
from
'vue'
import
{
useVehicleStore
}
from
'../store/VehicleStore'
;
import
{
useStateStore
}
from
'../store/StateStore'
;
import
{
storeToRefs
}
from
'pinia'
;
import
writeLog
from
'../js/writeLog.js'
const
props
=
defineProps
({
isShow
:
Boolean
})
const
tipsLogout
=
ref
(
'退出当前系统'
)
const
logoutStep
=
ref
(
0
)
const
vehicleStore
=
useVehicleStore
()
const
vehicleStoreToRefs
=
storeToRefs
(
vehicleStore
)
const
{
pattern
}
=
vehicleStoreToRefs
const
stateStore
=
useStateStore
()
const
emits
=
defineEmits
([
'handleSend'
,
'closeModal'
])
function
doCancelLogout
()
{
logoutStep
.
value
=
0
emits
(
'closeModal'
)
}
function
closeSystem
()
{
logoutStep
.
value
=
0
window
.
state
=
'logout'
emits
(
'handleSend'
,
{
type
:
'/btn/quitApp'
,
msg
:
{}
})
stateStore
.
setData
(
'loginAck'
,
null
)
}
function
doSureLogout
()
{
if
(
pattern
.
value
===
1
&&
logoutStep
.
value
===
0
)
{
tipsLogout
.
value
=
'当前是无人模式,确定退出程序'
logoutStep
.
value
=
1
}
else
{
closeSystem
()
}
}
watch
(()
=>
props
.
isShow
,
(
value
)
=>
{
if
(
value
)
{
writeLog
(
'INFO'
,
"退出系统"
)
tipsLogout
.
value
=
'退出当前系统'
}
},
{
immediate
:
true
})
</
script
>
<
style
lang=
"less"
scoped
>
.log-out {
&>p {
margin-bottom: 20px;
}
.footer {
text-align: end;
.btn {
margin-right: 10px;
}
}
}
</
style
>
\ No newline at end of file
src/js/socket/index.js
View file @
014f5ff8
import
{
useStateStore
}
from
'@/store/StateStore'
import
{
useVehicleStore
}
from
'@/store/VehicleStore.js'
import
{
useMapStore
}
from
'@/store/MapStore.js'
import
writeLog
from
'@/js/writeLog.js'
import
router
from
'../../router'
import
{
storeToRefs
}
from
'pinia'
import
{
Message
}
from
'view-ui-plus'
...
...
@@ -145,6 +146,7 @@ export default class Socket {
}
this
.
timeoutTimer
=
setInterval
(()
=>
{
if
(
this
.
timeoutCount
>
NETWORK_COUNT
)
{
writeLog
(
'WARNING'
,
`网络异常,请检测网络!连接超时
${
this
.
timeoutCount
}
s`
)
this
.
stateStore
.
dealNetworkTip
({
type
:
true
,
count
:
this
.
timeoutCount
})
}
this
.
timeoutCount
++
...
...
src/js/writeLog.js
0 → 100644
View file @
014f5ff8
import
axios
from
'axios'
;
let
loginForm
=
JSON
.
parse
(
window
.
localStorage
.
getItem
(
`
${
location
.
host
}
loginForm`
))
const
writeLog
=
(
type
,
data
)
=>
{
let
log
=
type
+
' '
+
new
Date
().
format
(
'yyyy-MM-dd hh:mm:ss'
)
+
' '
+
loginForm
.
number
+
' '
+
location
.
host
+
' '
+
data
axios
.
post
(
"//"
+
document
.
location
.
logServe
+
"/ht/api/web/log/upload"
,{
log
:
log
}).
then
(
res
=>
{
if
(
res
.
code
!=
0
){
console
.
log
(
'writeLog'
,
res
.
msg
)
}
}).
catch
(
err
=>
{
console
.
log
(
'writeLog'
,
err
)
})
}
export
default
writeLog
\ No newline at end of file
src/main.js
View file @
014f5ff8
...
...
@@ -4,6 +4,7 @@ import App from './App.vue'
import
router
from
'./router'
import
axios
from
'axios'
import
IndexRoot
from
'./js/IndexRoot.js'
import
writeLog
from
'./js/writeLog.js'
import
ViewUIPlus
from
'view-ui-plus'
import
'leaflet/dist/leaflet.css'
import
'view-ui-plus/dist/styles/viewuiplus.css'
...
...
@@ -50,6 +51,18 @@ const app = createApp(App)
let
$indexRoot
=
new
IndexRoot
()
app
.
config
.
globalProperties
.
$indexRoot
=
$indexRoot
window
.
onerror
=
(
message
,
source
,
lineno
,
colno
,
error
)
=>
{
var
data
=
{
message
:
message
,
source
:
source
,
lineno
:
lineno
,
colno
:
colno
,
error
:
error
};
writeLog
(
'ERROR'
,
JSON
.
stringify
(
data
))
}
app
.
use
(
router
)
.
use
(
ViewUIPlus
)
.
use
(
pinia
)
...
...
src/views/Login.vue
View file @
014f5ff8
...
...
@@ -34,6 +34,7 @@
import
{
Message
}
from
'view-ui-plus'
;
import
{
useStateStore
}
from
'@/store/StateStore.js'
import
router
from
'@/router'
import
writeLog
from
'@/js/writeLog.js'
const
isShow
=
ref
(
false
)
const
tip
=
ref
(
''
)
...
...
@@ -79,6 +80,7 @@
watch
(
getLoginAck
,
(
value
)
=>
{
if
(
value
&&
window
.
state
===
'login'
)
{
writeLog
(
'INFO'
,
"登陆成功"
)
let
{
code
,
number
}
=
value
if
(
code
===
0
&&
number
===
formItem
.
number
)
{
router
.
push
({
...
...
src/views/Logout.vue
View file @
014f5ff8
...
...
@@ -13,6 +13,7 @@
import
{
useVehicleStore
}
from
'../store/VehicleStore'
;
import
{
useStateStore
}
from
'../store/StateStore'
;
import
{
storeToRefs
}
from
'pinia'
;
import
writeLog
from
'../js/writeLog.js'
const
props
=
defineProps
({
isShow
:
Boolean
...
...
@@ -52,6 +53,7 @@
watch
(()
=>
props
.
isShow
,
(
value
)
=>
{
if
(
value
)
{
writeLog
(
'INFO'
,
"退出系统"
)
tipsLogout
.
value
=
'退出当前系统'
}
},
{
...
...
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