Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
map-property-screen
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
zhangzhaohui
map-property-screen
Commits
ccce3f01
Commit
ccce3f01
authored
Feb 04, 2024
by
leidahong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录
parent
07db4c1f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
40 deletions
+67
-40
router.js
src/router/router.js
+9
-9
cesiumTools.js
src/utils/cesiumTools.js
+9
-7
request.js
src/utils/request.js
+2
-2
Login.vue
src/view/Login.vue
+29
-15
index.vue
src/view/index.vue
+18
-7
No files found.
src/router/router.js
View file @
ccce3f01
...
@@ -18,13 +18,13 @@ const router = createRouter({
...
@@ -18,13 +18,13 @@ const router = createRouter({
});
});
// 路由守卫
// 路由守卫
//
router.beforeEach((to, from, next) => {
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
// if (to.path === "/login") {
const
token
=
getToken
();
// next();
if
(
to
.
path
===
"/login"
)
{
// } else {
if
(
token
)
next
(
"/"
);
// const token = getToken
();
else
next
();
// if (token) next();
}
else
{
// else next("/login"
);
next
(
);
//
}
}
//
});
});
export
{
router
};
export
{
router
};
src/utils/cesiumTools.js
View file @
ccce3f01
...
@@ -33,15 +33,17 @@ export function drawLabel(
...
@@ -33,15 +33,17 @@ export function drawLabel(
backgroundColor
:
Cesium
.
Color
.
fromCssColorString
(
backgroundColor
),
backgroundColor
:
Cesium
.
Color
.
fromCssColorString
(
backgroundColor
),
backgroundPadding
:
new
Cesium
.
Cartesian2
(
10
,
8
),
backgroundPadding
:
new
Cesium
.
Cartesian2
(
10
,
8
),
font
:
"18px sans-serif"
,
font
:
"18px sans-serif"
,
pixelOffset
:
new
Cesium
.
Cartesian2
(
0
,
-
7
5
),
pixelOffset
:
new
Cesium
.
Cartesian2
(
0
,
imgName
?
-
75
:
-
2
5
),
...
labelOptions
,
...
labelOptions
,
},
},
billboard
:
{
billboard
:
imgName
image
:
new
URL
(
`../assets/imgs/
${
imgName
}
.png`
,
import
.
meta
.
url
).
href
,
// 图标图片的路径
?
{
width
:
40
,
image
:
new
URL
(
`../assets/imgs/
${
imgName
}
.png`
,
import
.
meta
.
url
).
href
,
// 图标图片的路径
height
:
50
,
width
:
40
,
pixelOffset
:
new
Cesium
.
Cartesian2
(
0
,
-
25
),
height
:
50
,
},
pixelOffset
:
new
Cesium
.
Cartesian2
(
0
,
-
25
),
}
:
null
,
});
});
}
}
export
function
drawPolygonLine
(
position
,
color
=
"#37b9ff"
,
withAlpha
=
1
)
{
export
function
drawPolygonLine
(
position
,
color
=
"#37b9ff"
,
withAlpha
=
1
)
{
...
...
src/utils/request.js
View file @
ccce3f01
...
@@ -15,7 +15,7 @@ const service = axios.create({
...
@@ -15,7 +15,7 @@ const service = axios.create({
service
.
interceptors
.
request
.
use
(
service
.
interceptors
.
request
.
use
(
(
config
)
=>
{
(
config
)
=>
{
config
.
headers
[
"Authorization"
]
=
"Bearer "
+
getToken
()
;
config
.
headers
[
"Authorization"
]
=
getToken
()
?
"Bearer "
+
getToken
()
:
""
;
return
config
;
return
config
;
},
},
(
error
)
=>
{
(
error
)
=>
{
...
@@ -31,6 +31,7 @@ service.interceptors.response.use(
...
@@ -31,6 +31,7 @@ service.interceptors.response.use(
if
(
code
===
401
||
code
===
403
)
{
if
(
code
===
401
||
code
===
403
)
{
if
(
!
isRelogin
.
show
)
{
if
(
!
isRelogin
.
show
)
{
isRelogin
.
show
=
true
;
isRelogin
.
show
=
true
;
removeToken
();
ElMessageBox
.
confirm
(
ElMessageBox
.
confirm
(
"登录状态已过期,您可以继续留在该页面,或者重新登录"
,
"登录状态已过期,您可以继续留在该页面,或者重新登录"
,
"系统提示"
,
"系统提示"
,
...
@@ -42,7 +43,6 @@ service.interceptors.response.use(
...
@@ -42,7 +43,6 @@ service.interceptors.response.use(
)
)
.
then
(()
=>
{
.
then
(()
=>
{
isRelogin
.
show
=
false
;
isRelogin
.
show
=
false
;
router
.
push
(
"/login"
);
router
.
push
(
"/login"
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
...
...
src/view/Login.vue
View file @
ccce3f01
...
@@ -2,37 +2,51 @@
...
@@ -2,37 +2,51 @@
<div
class=
"screen"
id=
"screen"
>
<div
class=
"screen"
id=
"screen"
>
<top-header></top-header>
<top-header></top-header>
<div
class=
"title"
></div>
<div
class=
"title"
></div>
<el-form
class=
"form"
ref=
"formRef"
:model=
"loginForm"
:rules=
"loginRules"
@
keyup
.
enter
.
native=
"submitForm(formRef)"
>
<el-form
class=
"form"
ref=
"formRef"
:model=
"loginForm"
:rules=
"loginRules"
@
keyup
.
enter
.
native=
"submitForm(formRef)"
>
<el-form-item
label=
""
prop=
"username"
>
<el-form-item
label=
""
prop=
"username"
>
<el-input
v-model=
"loginForm.username"
placeholder=
"请输入账号"
>
<el-input
v-model=
"loginForm.username"
placeholder=
"请输入账号"
>
<template
#
prefix
>
<template
#
prefix
>
<img
src=
"@/assets/imgs/user_icon.png"
alt=
""
>
<img
src=
"@/assets/imgs/user_icon.png"
alt=
""
/
>
</
template
>
</
template
>
</el-input>
</el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
""
prop=
"password"
>
<el-form-item
label=
""
prop=
"password"
>
<el-input
v-model=
"loginForm.password"
placeholder=
"请输入密码"
type=
"password"
>
<el-input
v-model=
"loginForm.password"
placeholder=
"请输入密码"
type=
"password"
>
<
template
#
prefix
>
<
template
#
prefix
>
<img
src=
"@/assets/imgs/password_icon.png"
alt=
""
>
<img
src=
"@/assets/imgs/password_icon.png"
alt=
""
/
>
</
template
>
</
template
>
</el-input>
</el-input>
</el-form-item>
</el-form-item>
<el-form-item
prop=
"code"
v-if=
"captchaEnabled"
>
<el-form-item
prop=
"code"
v-if=
"captchaEnabled"
>
<el-input
v-model=
"loginForm.code"
auto-complete=
"off"
style=
"width:266px;"
placeholder=
"验证码"
>
<el-input
v-model=
"loginForm.code"
auto-complete=
"off"
style=
"width: 266px"
placeholder=
"验证码"
>
<
template
#
prefix
>
<
template
#
prefix
>
<img
src=
"@/assets/imgs/yzm_icon.png"
alt=
""
>
<img
src=
"@/assets/imgs/yzm_icon.png"
alt=
""
/
>
</
template
>
</
template
>
</el-input>
</el-input>
<div
class=
"login-code"
>
<div
class=
"login-code"
>
<img
:src=
"codeUrl"
@
click=
"getCode"
class=
"login-code-img"
/>
<img
:src=
"codeUrl"
@
click=
"getCode"
class=
"login-code-img"
/>
</div>
</div>
</el-form-item>
</el-form-item>
<el-button
type=
"primary"
@
click=
"submitForm(formRef)"
>
登录{{ $store.state.count }}
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm(formRef)"
>
登录{{ $store.state.count }}
</el-button
>
</el-form>
</el-form>
</div>
</div>
</template>
</template>
...
@@ -42,11 +56,11 @@ import topHeader from "@/components/header.vue";
...
@@ -42,11 +56,11 @@ import topHeader from "@/components/header.vue";
import
{
setToken
}
from
"@/utils/auth"
;
import
{
setToken
}
from
"@/utils/auth"
;
import
{
getCodeImg
,
login
,
getUserType
}
from
"@/api/user"
;
import
{
getCodeImg
,
login
,
getUserType
}
from
"@/api/user"
;
import
{
useRouter
}
from
"vue-router"
;
import
{
useRouter
}
from
"vue-router"
;
import
{
useStore
}
from
'vuex'
import
{
useStore
}
from
"vuex"
;
const
store
=
useStore
()
const
store
=
useStore
()
;
const
loginForm
=
reactive
({
const
loginForm
=
reactive
({
username
:
"
cbht
"
,
username
:
""
,
password
:
"
xcsq1234,
"
,
password
:
""
,
code
:
""
,
code
:
""
,
uuid
:
""
,
uuid
:
""
,
rememberMe
:
false
,
rememberMe
:
false
,
...
@@ -166,4 +180,4 @@ onMounted(() => {
...
@@ -166,4 +180,4 @@ onMounted(() => {
}
}
}
}
}
}
</
style
>
</
style
>
\ No newline at end of file
src/view/index.vue
View file @
ccce3f01
...
@@ -41,6 +41,12 @@ watch(currentCommunityInfo, (val) => {
...
@@ -41,6 +41,12 @@ watch(currentCommunityInfo, (val) => {
console
.
log
(
"currentCommunityInfo"
,
val
);
console
.
log
(
"currentCommunityInfo"
,
val
);
let
position
=
JSON
.
parse
(
val
.
solid
);
let
position
=
JSON
.
parse
(
val
.
solid
);
flyTo
({
longitude
:
position
.
x
,
latitude
:
position
.
y
});
flyTo
({
longitude
:
position
.
x
,
latitude
:
position
.
y
});
const
removeArr
=
[];
viewer
.
entities
.
values
.
forEach
((
item
)
=>
{
if
(
item
.
_data
&&
item
.
_data
.
type
===
"house"
)
removeArr
.
push
(
item
);
});
removeArr
.
forEach
((
item
)
=>
viewer
.
entities
.
remove
(
item
));
getHouseListFunc
(
val
.
id
);
getHouseListFunc
(
val
.
id
);
});
});
function
communityChangeHandle
(
index
)
{
function
communityChangeHandle
(
index
)
{
...
@@ -84,6 +90,7 @@ function getUserTypeInfo() {
...
@@ -84,6 +90,7 @@ function getUserTypeInfo() {
// 获取小区列表
// 获取小区列表
function
getHouseListFunc
(
communityId
)
{
function
getHouseListFunc
(
communityId
)
{
getHouseList
(
communityId
).
then
((
res
)
=>
{
getHouseList
(
communityId
).
then
((
res
)
=>
{
console
.
log
(
"getHouseList"
,
res
.
data
);
drawHouseMarker
(
res
.
data
);
drawHouseMarker
(
res
.
data
);
getHouseInfoFunc
(
res
.
data
[
0
].
id
);
getHouseInfoFunc
(
res
.
data
[
0
].
id
);
});
});
...
@@ -114,14 +121,18 @@ function getHouseInfoFunc(houseId) {
...
@@ -114,14 +121,18 @@ function getHouseInfoFunc(houseId) {
currentHouseInfo
.
value
=
res
.
data
;
currentHouseInfo
.
value
=
res
.
data
;
let
{
solid
,
coordinates
}
=
currentHouseInfo
.
value
;
let
{
solid
,
coordinates
}
=
currentHouseInfo
.
value
;
drawLabel
(
// drawLabel(
JSON
.
parse
(
solid
),
// JSON.parse(solid),
currentHouseInfo
.
value
.
name
,
// currentHouseInfo.value.name,
"#003860"
,
// "#003860",
"blue_dw_icon"
// "blue_dw_icon"
);
// );
if
(
res
.
data
.
remark
)
{
JSON
.
parse
(
res
.
data
.
remark
).
forEach
((
item
)
=>
{
drawLabel
(
JSON
.
parse
(
item
.
solid
),
item
.
name
,
"#003860"
,
null
,
item
);
});
}
// drawPolygonLine(JSON.parse(coordinates));
flyTo
(
cartesianToDegrees
(
JSON
.
parse
(
solid
)));
flyTo
(
cartesianToDegrees
(
JSON
.
parse
(
solid
)));
});
});
}
}
...
...
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