From e4c17fe22b99efc2cec3a44b981e0bdd674868d1 Mon Sep 17 00:00:00 2001
From: hejianhao <15708179461@qq.com>
Date: 星期六, 24 一月 2026 11:35:20 +0800
Subject: [PATCH] fix: 修复登录流程和UI样式,优化权限与数据获取逻辑
---
screen/src/view/login/index.vue | 6 +-
screen/src/App.vue | 59 ++++++++++++++++++++---------
screen/src/view/home/index.vue | 39 +++++++++++++------
screen/src/view/header/index.vue | 6 --
4 files changed, 70 insertions(+), 40 deletions(-)
diff --git a/screen/src/App.vue b/screen/src/App.vue
index f759c6e..6829b23 100644
--- a/screen/src/App.vue
+++ b/screen/src/App.vue
@@ -6,6 +6,7 @@
<script>
import autofit from "autofit.js";
+import { getLoginInfo } from "./view/login/service";
export default {
name: "app",
@@ -26,9 +27,11 @@
let projectId = "";
let projectName = "";
const hash = window.location.hash;
+ let queryPart = null;
+ let params = null;
if (hash && hash.indexOf("?") !== -1) {
- const queryPart = hash.split("?")[1];
- const params = new URLSearchParams(queryPart);
+ queryPart = hash.split("?")[1];
+ params = new URLSearchParams(queryPart);
token = params.get("token");
type = params.get("type");
if (type == 2) {
@@ -36,25 +39,43 @@
projectName = params.get("projectName");
}
}
-
if (token) {
localStorage.setItem("token", token);
- if (type == 1) {
- this.$router.replace({
- path: "/home",
- });
- return;
- }
- if (type == 2) {
- this.$router.replace({
- path: "/projectHome",
- query: {
- projectId,
- projectName,
- },
- });
- return;
- }
+ getLoginInfo({
+ id: type == 1 ? params.get("clientId") : params.get("projectId"),
+ type,
+ }).then((r) => {
+ localStorage.setItem(
+ "permissionClient",
+ JSON.stringify(
+ r.permissionClient ? r.permissionClient.split(",") : []
+ )
+ );
+ localStorage.setItem(
+ "permissionProject",
+ JSON.stringify(
+ r.permissionProject ? r.permissionProject.split(",") : []
+ )
+ );
+ if (type == 1) {
+ localStorage.setItem("clientId", params.get("clientId"));
+ localStorage.setItem("clientName", params.get("clientName"));
+ localStorage.setItem("clientLogo", r.logo);
+ this.$router.replace({
+ path: "/home",
+ });
+ return;
+ } else if (type == 2) {
+ this.$router.replace({
+ path: "/projectHome",
+ query: {
+ projectId,
+ projectName,
+ },
+ });
+ return;
+ }
+ });
}
if (!localStorage.getItem("token")) {
this.$router.replace("/");
diff --git a/screen/src/view/header/index.vue b/screen/src/view/header/index.vue
index 48dea0b..5af5957 100644
--- a/screen/src/view/header/index.vue
+++ b/screen/src/view/header/index.vue
@@ -5,11 +5,7 @@
class="flex a-center c-fff absolute adress1 cursor-pointer"
>
<img
- :src="
- clientLogo
- ? VUE_APP_IMAGE_BASE_URL + clientLogo
- : '../../assets/img/logo.png'
- "
+ :src="clientLogo || '../../assets/img/logo.png'"
class="w--30 h--30 shrink0 mr--10"
/>
<div class="color2 lh--30 fs--30 SHSBold">
diff --git a/screen/src/view/home/index.vue b/screen/src/view/home/index.vue
index 8523cfb..9cafaee 100644
--- a/screen/src/view/home/index.vue
+++ b/screen/src/view/home/index.vue
@@ -1,5 +1,5 @@
<template>
- <div class="relative">
+ <div>
<HeaderBox />
<div
id="container"
@@ -21,7 +21,10 @@
</div>
<!-- 左下角隐患 -->
<div
- v-if="(activeTab == 1 && permissionClient.includes('4')) || (activeTab == 1 && permissionClient.includes('6'))"
+ v-if="
+ (activeTab == 1 && permissionClient.includes('4')) ||
+ (activeTab == 1 && permissionClient.includes('6'))
+ "
class="flex a-center absolute left--14 bottom--14"
>
<img
@@ -35,7 +38,7 @@
<div class="ripple-wave wave-2"></div>
<div class="ripple-wave wave-3"></div>
</div>
- <div class="fs--15 lh--15 ml--10">重大隐患数</div>
+ <div class="fs--15 lh--15 ml--25">重大隐患数</div>
<div class="color5 ml--13 fs--30 lh--30 zh_tr">
{{ screenData.majorHazardTotal }}
</div>
@@ -58,7 +61,7 @@
</div>
<!-- 地图legend -->
<div
- class="absolute bottom--30 h--120 w--250 py--29 px--37 bgimg5"
+ class="fixed bottom--30 h--120 w--250 py--29 px--37 bgimg5"
style="right: 505px"
>
<div
@@ -207,7 +210,13 @@
<div class="btn" @click="handleSearch">搜索</div>
</div>
</div>
- <div v-if="(activeTab == 1 && permissionClient.includes('2')) || (activeTab == 1 && permissionClient.includes('5'))" class="mt--33 relative">
+ <div
+ v-if="
+ (activeTab == 1 && permissionClient.includes('2')) ||
+ (activeTab == 1 && permissionClient.includes('5'))
+ "
+ class="mt--33 relative"
+ >
<TitleBox>
<template #title> 项目数据总览 </template>
<template #content>
@@ -544,7 +553,7 @@
</div>
</template>
<template #content>
- <div class="px--19 pt--16 pb--9">
+ <div class="px--19 pt--5 pb--9">
<el-carousel
height="366px"
indicator-position="none"
@@ -567,7 +576,7 @@
<div class="flex a-center justify-center mt--9">
<div class="flex a-center gap--3">
<img
- v-for="(item,index) in workListData"
+ v-for="(item, index) in workListData"
:key="item.id"
:src="
activeIndex === index
@@ -781,7 +790,6 @@
key: "232929db1cb31f26d42b3645a7456154",
version: "2.0",
});
- this.getScreenData();
this.getStoryData();
getProjectSelect({ clientId: localStorage.getItem("clientId") }).then(
(res) => {
@@ -847,6 +855,7 @@
projectCategory: ["ongoing", "fixed"][this.activeTab - 1],
startDate: "",
endDate: "",
+ clientId: localStorage.getItem("clientId"),
};
if (this.dateRange.length) {
params.startDate = moment(this.dateRange[0]).format("YYYY-MM-DD");
@@ -904,10 +913,14 @@
if (!this.projectId) {
return;
}
- const target = this.projectList.find(
+ const target = this.screenData.projectMapPoints.find(
(item) => item.id === this.projectId
);
- if (!target) return;
+
+ if (!target) {
+ this.$message.warning("无此项目地图点位");
+ return;
+ }
let position = null;
if (target.addressInfo) {
@@ -1346,7 +1359,7 @@
.leftBox {
width: 380px;
- position: absolute;
+ position: fixed;
top: 109px;
left: 23px;
@@ -1485,7 +1498,7 @@
}
.ripple {
- position: relative;
+ position: fixed;
width: 14px;
height: 14px;
margin-right: 14px;
@@ -1536,7 +1549,7 @@
.rightBox {
width: 462px;
- position: absolute;
+ position: fixed;
top: 85px;
right: 20px;
}
diff --git a/screen/src/view/login/index.vue b/screen/src/view/login/index.vue
index 7121d98..5497578 100644
--- a/screen/src/view/login/index.vue
+++ b/screen/src/view/login/index.vue
@@ -346,9 +346,6 @@
r.permissionClient ? r.permissionClient.split(",") : []
)
);
- localStorage.setItem("clientName", r.name);
- localStorage.setItem("clientLogo", r.logo);
- localStorage.setItem("clientId", re[0].id);
localStorage.setItem(
"permissionProject",
JSON.stringify(
@@ -366,6 +363,9 @@
},
});
} else {
+ localStorage.setItem("clientName", r.name);
+ localStorage.setItem("clientLogo", r.logo);
+ localStorage.setItem("clientId", re[0].id);
this.$router.replace({
path: "/home",
});
--
Gitblit v1.7.1