feat: 调整首页

This commit is contained in:
niedongsheng 2026-04-02 16:20:33 +08:00
parent f24ce93621
commit b7c1a2e231
8 changed files with 117 additions and 92 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -67,7 +67,7 @@ const routes = [
component: () => import('../views/IceEvent/IceEventDetails.vue')
},
{
path: '/warningMessage/:data',
path: '/warningMessage',
name: 'WarningMessage',
component: () => import('../views/WarningMessage/WarningMessage.vue')
},

View File

@ -1,53 +1,22 @@
<template>
<div class="home">
<van-nav-bar title="愉快政" fixed left-arrow />
<van-cell-group>
<van-cell title="当前站点" :value="yhzinfo.mc" />
</van-cell-group>
<PageContainer title="愉快政">
<CurrentSite />
<div class="content">
<van-grid :gutter="10" :column-num="3" class="grid">
<van-grid-item
icon="setting-o"
text="设备管理"
:to="{
name: 'EquipManage',
params: { data: encodeURIComponent(JSON.stringify(yhzinfo)) },
}"
/>
<van-grid-item
icon="setting-o"
text="物资管理"
:to="{
name: 'MaterialManage',
params: { data: encodeURIComponent(JSON.stringify(yhzinfo)) },
}"
/>
<van-grid-item
icon="setting-o"
text="人员管理"
:to="{
name: 'StaffManage',
params: { data: encodeURIComponent(JSON.stringify(yhzinfo)) },
}"
/>
<van-grid-item
icon="setting-o"
text="冰雪灾害"
:to="{
name: 'IceEventManage',
params: { data: encodeURIComponent(JSON.stringify(yhzinfo)) },
}"
/>
<van-grid-item
icon="setting-o"
text="气象预警"
:to="{
name: 'WarningMessage',
params: { data: encodeURIComponent(JSON.stringify(yhzinfo)) },
}"
/>
class="grid-item"
v-for="item in gridItems"
:key="item.text"
:to="item.to"
>
<template #icon>
<img :src="item.icon" class="grid-icon" />
</template>
<template #text>
<span class="grid-text">{{ item.text }}</span>
</template>
</van-grid-item>
</van-grid>
</div>
<van-popup
@ -69,7 +38,7 @@
>
</div>
</van-popup>
</div>
</PageContainer>
</template>
<script setup>
@ -80,6 +49,14 @@ import { useRouter, useRoute } from "vue-router";
import { useYHZStore } from "../stores/yhzStore";
import { showToast } from "vant";
import { request } from "../../../shared/utils/request";
import PageContainer from "@/components/PageContainer.vue";
import CurrentSite from "@/components/CurrentSite.vue";
import group63Icon from "@/assets/images/组 63.png";
import group105Icon from "@/assets/images/组 105.png";
import group10501Icon from "@/assets/images/组 105(1).png";
import group104Icon from "@/assets/images/组 104.png";
import group106Icon from "@/assets/images/组 106.png";
const router = useRouter();
const yhzinfo = ref({});
@ -89,6 +66,49 @@ const route = useRoute();
const token = route.query.token;
const YHZConfirmpopup = ref(false);
//
const gridItems = [
{
icon: group63Icon,
text: "设备管理",
to: {
name: "EquipManage",
params: { data: encodeURIComponent(JSON.stringify(yhzinfo.value)) },
},
},
{
icon: group10501Icon,
text: "物资管理",
to: {
name: "MaterialManage",
params: { data: encodeURIComponent(JSON.stringify(yhzinfo.value)) },
},
},
{
icon: group104Icon,
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: group105Icon,
text: "预警信息",
to: {
name: "WarningMessage",
},
},
];
//
const getYHZinfo = async () => {
try {
@ -99,6 +119,13 @@ const getYHZinfo = async () => {
if (res.code === "00000") {
yhzinfo.value = res.data[0];
yhzStore.setYHZInfo(res.data[0]);
// params使yhzinfo
gridItems.forEach(item => {
if (item.to.params && item.to.params.data) {
item.to.params.data = encodeURIComponent(JSON.stringify(yhzinfo.value));
}
});
} else {
throw new Error(res.message);
}
@ -114,6 +141,11 @@ const onYHZConfirmClose = () => {
YHZConfirmpopup.value = false;
};
const getLocation = () => {
//
YHZConfirmpopup.value = false;
};
onMounted(async () => {
if (token) {
localStorage.setItem("token", token);
@ -135,19 +167,7 @@ const goToUser = () => {
};
</script>
<style scoped>
.home {
padding-top: var(--van-nav-bar-height);
}
.content {
padding: 16px;
}
.grid {
margin-top: 16px;
}
<style lang="scss" scoped>
.btn-box {
width: 100%;
display: flex;
@ -161,4 +181,24 @@ const goToUser = () => {
.confirmpopup__content {
padding: 20px;
}
.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>

View File

@ -3,9 +3,9 @@
<CurrentSite />
<div class="form-panel">
<van-field v-model="value" label="现场情况描述" placeholder="请输入备注" label-align="top" rows="3" type="textarea" />
<van-field v-model="form.a" label="现场情况描述" placeholder="请输入备注" label-align="top" rows="3" type="textarea" />
<van-field class="mt-8" v-model="value" label="备注(非必填)" placeholder="请填写" input-align="right" />
<van-field class="mt-8" v-model="form.b" label="备注(非必填)" placeholder="请填写" input-align="right" />
<div class="image-upload-block">
<div class="label-box">
@ -45,39 +45,22 @@ const router = useRouter()
//
const fileList = ref([])
const form = ref({
a: '',
b: '',
photos: []
})
onMounted(() => {
getData()
})
//
const list = ref([
{
area: '合川区',
level: '红色气象预警',
content: '今天,北京将进入大雪,请做好',
publishTime: '2026/01/10 20:29',
method: '立即启动防汛Ⅰ级应急响应,立即转移危险区'
},
{
area: '万州区',
level: '红色气象预警',
publishTime: '2025/10/10 20:29',
method: '立即启动防汛Ⅰ级应急响应,立即转移危险区'
},
{
area: '涪陵区',
level: '红色气象预警',
publishTime: '2025/10/10 20:29',
method: '立即启动防汛Ⅰ级应急响应,立即转移危险区'
}
])
//
const handleDelete = (file) => {
if (file.serverUrl) {
const index = editForm.photos.findIndex((p) => p.photoUrl === file.serverUrl)
const index = form.value.photos.findIndex((p) => p.photoUrl === file.serverUrl)
if (index !== -1) {
editForm.photos.splice(index, 1)
form.value.photos.splice(index, 1)
}
}
}
@ -99,13 +82,13 @@ const afterRead = async (file) => {
})
toast.close()
if (res.code === '00000') {
editForm.photos.push({ photoUrl: res.data })
form.value.photos.push({ photoUrl: res.data })
const index = fileList.value.findIndex((f) => f.file === file.file)
if (index !== -1) {
fileList.value[index].serverUrl = res.data
}
console.log('editForm.photos', toRaw(editForm.photos))
console.log('form.value.photos', toRaw(form.value.photos))
console.log('fileList.value', fileList.value)
} else {
throw new Error(res.message)
@ -124,8 +107,10 @@ const getData = async () => {}
const handleClickBack = () => {
router.go(-1)
}
const confirm = () => {
router.push({ path: '/warningMessageHandle' })
const confirm = async () => {
console.log(form.value)
router.go(-1)
}
</script>