Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
e-shield-h5
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f62e1c97
authored
Jul 21, 2022
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改
1 parent
a72ff119
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
58 deletions
src/api/index.js
src/components/top-tab.vue
src/views/index.vue
src/api/index.js
View file @
f62e1c9
...
...
@@ -40,11 +40,6 @@ export const ADD_FENCE = (params) => {
return
request
(
params
,
`
${
prefix
}
/fence/add`
,
"POST"
);
};
// 获取分享id
export
const
GET_SHARE_ID
=
(
params
)
=>
{
return
request
(
params
,
`
${
prefix
}
/share/vehicle`
);
};
// 校验分享时效性 是否可用
export
const
CHECK_SHARE
=
(
params
)
=>
{
return
request
(
params
,
`
${
prefix
}
/vehicle/sharedDetails`
);
...
...
src/components/top-tab.vue
View file @
f62e1c9
...
...
@@ -29,24 +29,23 @@ export default {
// 过滤tab
const
filterTabs
=
async
(
cb
)
=>
{
let
source
=
routeQuery
.
source
;
// 有线设备 无设备调频
if
(
source
==
1
)
{
routesArr
.
map
((
val
,
index
)
=>
{
if
(
val
.
name
===
"freq"
)
{
routesArr
.
splice
(
index
,
1
);
}
});
}
if
(
source
==
0
)
{
routesArr
.
map
((
val
,
index
)
=>
{
if
(
val
.
name
===
"fence"
)
{
routesArr
.
splice
(
index
,
1
);
}
});
}
console
.
log
(
localStorage
.
getItem
(
"sharePage"
));
if
(
localStorage
.
getItem
(
"sharePage"
))
{
routesArr
.
splice
(
routesArr
.
length
-
1
,
1
);
for
(
var
i
=
routes
.
tabRoutes
.
length
-
1
;
i
>=
0
;
i
--
)
{
if
(
routes
.
tabRoutes
[
i
].
name
===
"freq"
&&
source
==
1
)
{
routesArr
.
splice
(
i
,
1
);
}
if
(
(
routes
.
tabRoutes
[
i
].
name
===
"fence"
&&
source
==
0
)
||
(
routes
.
tabRoutes
[
i
].
name
===
"fence"
&&
JSON
.
parse
(
localStorage
.
getItem
(
"sharePage"
)))
)
{
routesArr
.
splice
(
i
,
1
);
}
if
(
routes
.
tabRoutes
[
i
].
name
===
"share"
&&
JSON
.
parse
(
localStorage
.
getItem
(
"sharePage"
))
)
{
routesArr
.
splice
(
i
,
1
);
}
}
await
cb
();
};
...
...
src/views/index.vue
View file @
f62e1c9
...
...
@@ -30,7 +30,7 @@
class=
"search-input"
v-model=
"keyWord"
placeholder=
"输入两位以上关键字搜索"
@
search=
"getCarList(
keyWord,
true)"
@
search=
"getCarList(true)"
/>
<van-list
class=
"list-box"
...
...
@@ -104,7 +104,6 @@ import moment from "@/utils/moment";
import
{
GET_ALL_CAR_LIST
,
GET_CAR_LOCATION_INFO
,
GET_SHARE_ID
,
CHECK_SHARE
,
}
from
"@/api/index"
;
export
default
defineComponent
({
...
...
@@ -156,41 +155,52 @@ export default defineComponent({
if
(
route
.
query
.
token
)
{
localStorage
.
setItem
(
"token"
,
route
.
query
.
token
);
}
if
(
JSON
.
parse
(
route
.
query
.
sharePage
))
{
if
(
route
.
query
.
sharePage
&&
JSON
.
parse
(
route
.
query
.
sharePage
))
{
localStorage
.
setItem
(
"sharePage"
,
JSON
.
parse
(
route
.
query
.
sharePage
));
// 获取分享id
GET_SHARE_ID
({
vehicleId
:
Number
(
routeQuery
.
value
.
id
)
}).
then
(
(
res
)
=>
{
if
(
res
.
code
==
200
)
{
// 校验分享链接是否有效
CHECK_SHARE
({
shareId
:
res
.
data
}).
then
((
v
)
=>
{
if
(
v
.
code
==
200
)
{
if
(
v
.
data
&&
v
.
data
.
setting
&&
v
.
data
.
setting
.
enableStatus
!==
1
)
{
Dialog
({
message
:
"该分享无效,请启用后使用"
});
}
else
if
(
v
.
data
&&
v
.
data
.
setting
&&
moment
().
isAfter
(
moment
(
v
.
data
.
setting
.
expirationDate
))
)
{
isShareDead
.
value
=
true
;
Dialog
({
message
:
"该分享已失效"
});
}
else
{
getCarInfo
(
carItem
.
value
);
// 校验分享时效性
checkIsShareDead
(
res
.
data
);
}
}
});
if
(
route
.
query
.
shareId
)
{
// 校验分享链接是否有效
CHECK_SHARE
({
shareId
:
Number
(
JSON
.
parse
(
route
.
query
.
shareId
)),
}).
then
((
v
)
=>
{
if
(
v
.
code
==
200
)
{
if
(
v
.
data
&&
v
.
data
.
setting
&&
v
.
data
.
setting
.
enableStatus
==
1
)
{
isShareDead
.
value
=
true
;
Dialog
({
message
:
"该分享无效,请启用后使用"
});
}
else
if
(
v
.
data
&&
v
.
data
.
setting
&&
moment
().
isAfter
(
moment
(
v
.
data
.
setting
.
expirationDate
))
)
{
isShareDead
.
value
=
true
;
Dialog
({
message
:
"该分享已失效"
});
}
else
{
getCarInfo
(
carItem
.
value
);
// 校验分享时效性
checkIsShareDead
(
Number
(
JSON
.
parse
(
route
.
query
.
shareId
)));
}
}
}
);
}
);
}
}
}
});
watch
(
()
=>
route
.
query
,
(
val
)
=>
{
if
(
val
)
{
carItem
.
value
=
{
sns
:
val
.
sn
,
ownerName
:
val
.
ownerName
==
"null"
?
"--"
:
val
.
ownerName
,
vin
:
val
.
vin
==
"null"
?
"--"
:
val
.
vin
,
};
getCarInfo
(
carItem
.
value
);
}
}
);
onMounted
(()
=>
{
localStorage
.
removeItem
(
"sharePage"
);
if
(
route
.
query
.
token
)
{
...
...
@@ -401,9 +411,10 @@ export default defineComponent({
}
else
{
carFenceBtn
&&
carFenceBtn
.
classList
.
add
(
"disabled"
);
}
// 是否被分享者打开
if
(
isSharePage
)
{
shareBtn
&&
shareBtn
.
classList
.
add
(
"disabled"
);
carFenceBtn
&&
carFenceBtn
.
classList
.
add
(
"disabled"
);
}
// 点击GPS
GPSBtn
&&
...
...
@@ -522,7 +533,7 @@ export default defineComponent({
// 电子围栏
(
carFenceBtn
&&
carFenceBtn
).
onclick
=
()
=>
{
if
(
item
.
source
==
0
)
{
if
(
item
.
source
==
0
||
isSharePage
)
{
return
;
}
else
{
wx
.
miniProgram
.
navigateTo
({
...
...
@@ -557,7 +568,7 @@ export default defineComponent({
cb
();
};
// 加载更多
const
getCarList
=
(
data
,
flag
)
=>
{
const
getCarList
=
(
flag
)
=>
{
if
(
flag
)
{
pageNumber
.
value
=
0
;
list
.
value
=
[];
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment