refactor: 重构首页
BIN
packages/mobile/src/assets/images/banenr.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
packages/mobile/src/assets/images/人员管理icon.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
packages/mobile/src/assets/images/恢复重建icon.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
packages/mobile/src/assets/images/灾毁管理icon.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
packages/mobile/src/assets/images/物资管理icon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
BIN
packages/mobile/src/assets/images/设备管理icon.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
packages/mobile/src/assets/images/预警信息icon.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
@ -3,22 +3,27 @@
|
|||||||
<CurrentSite />
|
<CurrentSite />
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<van-grid :gutter="10" :column-num="3" class="grid">
|
<div class="banner-card">
|
||||||
<van-grid-item
|
<img :src="bannerImage" alt="安全保通服务" class="banner-image" />
|
||||||
class="grid-item"
|
</div>
|
||||||
v-for="item in gridItems"
|
|
||||||
:key="item.text"
|
<section class="nav-card" v-for="(card, index) in navCardList" :key="index">
|
||||||
:to="item.to"
|
<div class="nav-card-header">
|
||||||
>
|
<span class="card-icon"></span>
|
||||||
<template #icon>
|
<span class="card-title">{{ card.text }}</span>
|
||||||
<img :src="item.icon" class="grid-icon" />
|
</div>
|
||||||
</template>
|
|
||||||
<template #text>
|
<div class="nav-list">
|
||||||
<span class="grid-text">{{ item.text }}</span>
|
<div v-for="item in card.navs" :key="item.text" class="nav-item" @click="toNav(item)">
|
||||||
</template>
|
<div class="nav-icon-wrap">
|
||||||
</van-grid-item>
|
<img :src="item.icon" :alt="item.text" class="nav-icon" />
|
||||||
</van-grid>
|
</div>
|
||||||
|
<span class="nav-text">{{ item.text }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<van-popup
|
<van-popup
|
||||||
:show="YHZConfirmpopup"
|
:show="YHZConfirmpopup"
|
||||||
position="center"
|
position="center"
|
||||||
@ -26,168 +31,250 @@
|
|||||||
close-on-click-overlay
|
close-on-click-overlay
|
||||||
:style="{ height: '20%', width: '80%' }"
|
:style="{ height: '20%', width: '80%' }"
|
||||||
@close="onYHZConfirmClose"
|
@close="onYHZConfirmClose"
|
||||||
class="confirmpopup"
|
|
||||||
>
|
>
|
||||||
<div class="confirmpopup__content">
|
<div class="confirmpopup__content">
|
||||||
<h3>请在服务站授权定位</h3>
|
<h3>请在服务站授权定位</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-box">
|
<div class="btn-box">
|
||||||
<van-button class="btn" @click="onYHZConfirmClose">取消</van-button>
|
<van-button class="btn" @click="onYHZConfirmClose">取消</van-button>
|
||||||
<van-button class="btn" type="primary" @click="getLocation"
|
<van-button class="btn" type="primary" @click="getLocation"> 授权定位 </van-button>
|
||||||
>授权定位</van-button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</van-popup>
|
</van-popup>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import "vant/es/toast/style";
|
import 'vant/es/toast/style'
|
||||||
import "vant/es/popup/style";
|
import 'vant/es/popup/style'
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from 'vue'
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import { useYHZStore } from "../stores/yhzStore";
|
import { useYHZStore } from '../stores/yhzStore'
|
||||||
import { showToast } from "vant";
|
import { showToast } from 'vant'
|
||||||
import { request } from "../../../shared/utils/request";
|
import { request } from '../../../shared/utils/request'
|
||||||
import PageContainer from "@/components/PageContainer.vue";
|
import PageContainer from '@/components/PageContainer.vue'
|
||||||
import CurrentSite from "@/components/CurrentSite.vue";
|
import CurrentSite from '@/components/CurrentSite.vue'
|
||||||
|
|
||||||
import group63Icon from "@/assets/images/组 63.png";
|
import bannerImage from '@/assets/images/banenr.png'
|
||||||
import group105Icon from "@/assets/images/组 105.png";
|
import equipmentIcon from '@/assets/images/设备管理icon.png'
|
||||||
import group10501Icon from "@/assets/images/组 105(1).png";
|
import materialIcon from '@/assets/images/物资管理icon.png'
|
||||||
import group104Icon from "@/assets/images/组 104.png";
|
import staffIcon from '@/assets/images/人员管理icon.png'
|
||||||
import group106Icon from "@/assets/images/组 106.png";
|
import disasterIcon from '@/assets/images/灾毁管理icon.png'
|
||||||
|
import warningIcon from '@/assets/images/预警信息icon.png'
|
||||||
|
import rebuildIcon from '@/assets/images/恢复重建icon.png'
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter()
|
||||||
const yhzinfo = ref({});
|
const yhzinfo = ref({})
|
||||||
const yhzStore = useYHZStore();
|
const yhzStore = useYHZStore()
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute()
|
||||||
const token = route.query.token;
|
const token = route.query.token
|
||||||
const YHZConfirmpopup = ref(false);
|
const YHZConfirmpopup = ref(false)
|
||||||
|
|
||||||
// 配置项
|
const navCardList = [
|
||||||
const gridItems = [
|
|
||||||
{
|
{
|
||||||
icon: group63Icon,
|
text: '灾毁管理',
|
||||||
text: "设备管理",
|
navs: [
|
||||||
to: {
|
{
|
||||||
name: "EquipManage",
|
icon: disasterIcon,
|
||||||
params: { data: encodeURIComponent(JSON.stringify(yhzinfo.value)) },
|
text: '灾害管理',
|
||||||
},
|
to: {
|
||||||
|
name: 'DisasterManagement',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: rebuildIcon,
|
||||||
|
text: '恢复重建',
|
||||||
|
to: {
|
||||||
|
name: 'Rebuild',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: group10501Icon,
|
text: '预警信息',
|
||||||
text: "物资管理",
|
navs: [
|
||||||
to: {
|
{
|
||||||
name: "MaterialManage",
|
icon: warningIcon,
|
||||||
params: { data: encodeURIComponent(JSON.stringify(yhzinfo.value)) },
|
text: '预警信息',
|
||||||
},
|
to: {
|
||||||
|
name: 'WarningMessage',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: group104Icon,
|
text: '应急力量',
|
||||||
text: "人员管理",
|
navs: [
|
||||||
to: {
|
{
|
||||||
name: "StaffManage",
|
icon: equipmentIcon,
|
||||||
params: { data: encodeURIComponent(JSON.stringify(yhzinfo.value)) },
|
text: '设备管理',
|
||||||
},
|
to: {
|
||||||
|
name: 'EquipManage',
|
||||||
|
params: { data: encodeURIComponent(JSON.stringify(yhzinfo.value)) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: materialIcon,
|
||||||
|
text: '物资管理',
|
||||||
|
to: {
|
||||||
|
name: 'MaterialManage',
|
||||||
|
params: { data: encodeURIComponent(JSON.stringify(yhzinfo.value)) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: staffIcon,
|
||||||
|
text: '人员管理',
|
||||||
|
to: {
|
||||||
|
name: 'StaffManage',
|
||||||
|
params: { data: encodeURIComponent(JSON.stringify(yhzinfo.value)) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
// {
|
]
|
||||||
// icon: group106Icon,
|
|
||||||
// text: "冰雪灾害",
|
|
||||||
// to: {
|
|
||||||
// name: "IceEventManage",
|
|
||||||
// params: { data: encodeURIComponent(JSON.stringify(yhzinfo.value)) },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
icon: group106Icon,
|
|
||||||
text: "灾害管理",
|
|
||||||
to: {
|
|
||||||
name: "DisasterManagement",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: group105Icon,
|
|
||||||
text: "预警信息",
|
|
||||||
to: {
|
|
||||||
name: "WarningMessage",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: group106Icon,
|
|
||||||
text: '恢复重建',
|
|
||||||
to: {
|
|
||||||
name: 'Rebuild',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// 获取当前登录用于就职的养护站信息
|
|
||||||
const getYHZinfo = async () => {
|
const getYHZinfo = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await request({
|
const res = await request({
|
||||||
url: `/snow-ops-platform/yhz/getStationByUser`,
|
url: `/snow-ops-platform/yhz/getStationByUser`,
|
||||||
method: "GET",
|
method: 'GET',
|
||||||
});
|
})
|
||||||
if (res.code === "00000") {
|
if (res.code === '00000') {
|
||||||
yhzinfo.value = res.data[0];
|
yhzinfo.value = res.data[0]
|
||||||
yhzStore.setYHZInfo(res.data[0]);
|
yhzStore.setYHZInfo(res.data[0])
|
||||||
|
|
||||||
// 更新配置项中的params,确保使用最新的yhzinfo
|
navCardList.forEach((card) => {
|
||||||
gridItems.forEach(item => {
|
card.navs?.forEach((item) => {
|
||||||
if (item.to.params && item.to.params.data) {
|
if (item.to.params && item.to.params.data) {
|
||||||
item.to.params.data = encodeURIComponent(JSON.stringify(yhzinfo.value));
|
item.to.params.data = encodeURIComponent(JSON.stringify(yhzinfo.value))
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
throw new Error(res.message);
|
throw new Error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
showToast({
|
showToast({
|
||||||
message: error.message,
|
message: error.message,
|
||||||
type: "fail",
|
type: 'fail',
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
const onYHZConfirmClose = () => {
|
const onYHZConfirmClose = () => {
|
||||||
YHZConfirmpopup.value = false;
|
YHZConfirmpopup.value = false
|
||||||
};
|
}
|
||||||
|
|
||||||
const getLocation = () => {
|
const getLocation = () => {
|
||||||
// 定位逻辑
|
YHZConfirmpopup.value = false
|
||||||
YHZConfirmpopup.value = false;
|
}
|
||||||
};
|
|
||||||
|
const toNav = (item) => {
|
||||||
|
if (!item?.to) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
router.push(item.to)
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (token) {
|
if (token) {
|
||||||
localStorage.setItem("token", token);
|
localStorage.setItem('token', token)
|
||||||
router.replace({ path: route.path }).then(() => {
|
router.replace({ path: route.path }).then(() => {
|
||||||
window.location.reload();
|
window.location.reload()
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
await getYHZinfo();
|
|
||||||
if (
|
|
||||||
yhzinfo.value.isManager &&
|
|
||||||
(yhzinfo.value.jd === "" || yhzinfo.value.wd === "")
|
|
||||||
) {
|
|
||||||
YHZConfirmpopup.value = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const goToUser = () => {
|
await getYHZinfo()
|
||||||
router.push("/user");
|
|
||||||
};
|
if (yhzinfo.value.isManager && (yhzinfo.value.jd === '' || yhzinfo.value.wd === '')) {
|
||||||
|
YHZConfirmpopup.value = true
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.banner-card {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.banner-image {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-card {
|
||||||
|
margin-top: 8px;
|
||||||
|
padding: 14px 0 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-card-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-icon {
|
||||||
|
width: 4px;
|
||||||
|
height: 11px;
|
||||||
|
background: #2E7AF4;
|
||||||
|
border-radius: 2px;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-list {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
gap: 14px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-icon-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-icon {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-text {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 16px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-box {
|
.btn-box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
@ -195,24 +282,4 @@ const goToUser = () => {
|
|||||||
.confirmpopup__content {
|
.confirmpopup__content {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
.grid-icon {
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grid-text {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #323233;
|
|
||||||
}
|
|
||||||
:deep(.grid-item) {
|
|
||||||
.grid-text {
|
|
||||||
margin-top: 16px;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 16px;
|
|
||||||
color: #333333;
|
|
||||||
line-height: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||