This commit is contained in:
TimSpan 2024-09-13 09:38:35 +08:00
parent 8ab0580add
commit 3322082043
4 changed files with 98 additions and 65 deletions

View File

@ -2,3 +2,34 @@ page {
background-color: #f0f0f0; background-color: #f0f0f0;
} }
.myProject {
.myProjectItem {
margin: 20px;
border-radius: 10px;
background: #ffffff;
padding: 15px;
font-size: 28px;
line-height: 50px;
color: #333333;
.myProjectIndex {
color: #9b9b9f;
}
.project {
display: flex;
justify-content: space-between;
flex-flow: wrap;
text-align: center;
view {
width: 45%;
height: 100rpx;
border: 1px solid #cccccc;
line-height: 100rpx;
margin: 8px 0 8px 0;
}
}
}
}

View File

@ -1,52 +1,47 @@
<template> <template>
<view class="myProject"> <view class="myProject">
<view> <view class="myProjectItem" v-for="(item,index) in myProjectList" :key="index">
<view style="display: flex;justify-content: space-between">
<text>{{ item?.name }}</text>
<!--<text>进行中</text>-->
</view>
<view class="myProjectIndex">地址
<text>{{ item?.provinceName }}{{ item.cityName }}{{ item.districtsName }}{{ item.streetName }}</text>
</view>
<view style="display: flex;justify-content: space-between">
<text>项目负责人{{ item?.contactPersonInfo.name }}</text>
<text>电话{{ item?.contactPersonInfo.telephone }}</text>
</view>
<view class="project">
<view v-for="(items,index) in item.serviceProjectList" :key="index">{{ items.name }}</view>
</view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import api from "@/request/index"; import api from "@/request/index";
import {onMounted} from "vue"; import {onMounted, ref} from "vue";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import './index.scss'
const myProjectList = ref<myProjectList[]>()
const getMyServiceProject = async () => { const getMyServiceProject = async () => {
const token = Taro.getStorageSync('token') const token = Taro.getStorageSync('token')
const resp = await api.get(`/projectManageIndex/getMyServiceProject`, { const resp = await api.get<myProjectList[]>(`/policeIndex/getUnitServiceProjectList`, {
token: token.value token: token.value
}) })
myProjectList.value = resp.data
console.log(resp.data) console.log(resp.data)
} }
onMounted(async () => { onMounted(async () => {
await getMyServiceProject() await getMyServiceProject()
}) })
</script> </script>
<style scoped lang="scss">
</style>
<!--<template>-->
<!-- <view>-->
<!-- <view class="content">-->
<!-- </view>-->
<!-- </view>-->
<!--</template>-->
<!--<script setup lang="ts">-->
<!--import Taro, {useLoad} from "@tarojs/taro";-->
<!--useLoad(() => {-->
<!-- console.log('onLoad')-->
<!--})-->
<!--import './index.scss'-->
<!--</script>-->

View File

@ -5,42 +5,31 @@
<div>公安后台</div> <div>公安后台</div>
</div> </div>
<div v-else class="logo flex-center"> <div v-else class="logo flex-center">
<img src="@/assets/vue.svg" title="超级后台" alt="xx" /> <img src="@/assets/vue.svg" title="超级后台" alt="xx"/>
</div> </div>
<!-- -->
<!-- <a-menu v-model:selectedKeys="selectedKeys" theme="light" mode="inline">
<a-menu-item key="1">
<router-link to="/index">
<pie-chart-outlined />
<span>首页</span>
</router-link>
</a-menu-item>
<a-menu-item key="2">
<router-link to="/register/index">
<pie-chart-outlined />
<span>注册</span>
</router-link>
</a-menu-item>
</a-menu> -->
<!-- 动态生成菜单项 --> <!-- 动态生成菜单项 -->
<a-menu v-model:selectedKeys="selectedKeys" v-model:openKeys="openKeys" theme="light" mode="inline"> <a-menu v-model:selectedKeys="selectedKeys" v-model:openKeys="openKeys" theme="light" mode="inline">
<template v-for="route in staticRouter"> <template v-for="route in staticRouter">
<a-menu-item v-if="route.meta?.title === undefined && route.children" :key="route.path" @click="handleMenuClick(route.children[0].path)"> <a-menu-item v-if="route.meta?.title === undefined && route.children" :key="route.path"
<router-link :to="`${route.children[0].path}`"> @click="handleMenuClick(route.children[0].path)">
<HomeOutlined v-if="route.name === 'dashboard'" /> <router-link :to="`${route.children[0].path}`" class="flex_">
<InsuranceOutlined v-if="route.name === 'police'" /> <!-- <icon-font :font-class="route.icon"/>-->
<SoundOutlined v-if="route.name === 'law'" /> <HomeOutlined v-if="route.name === 'dashboard'"/>
<ApartmentOutlined v-if="route.name === 'warning'" /> <InsuranceOutlined v-if="route.name === 'police'"/>
<SoundOutlined v-if="route.name === 'law'"/>
<ApartmentOutlined v-if="route.name === 'warning'"/>
<span>{{ route?.children[0]?.meta?.title }}</span> <span>{{ route?.children[0]?.meta?.title }}</span>
</router-link> </router-link>
</a-menu-item> </a-menu-item>
<a-sub-menu v-if="route.children && route.children.length && route?.meta?.title" :key="route.path"> <a-sub-menu v-if="route.children && route.children.length && route?.meta?.title" :key="route.path">
<template #title> <template #title>
<MailOutlined v-if="route.name === 'query-'" /> <MailOutlined v-if="route.name === 'query-'"/>
<UserOutlined v-if="route.name === 'user'" /> <UserOutlined v-if="route.name === 'user'"/>
<span>{{ route.meta?.title }}</span> <span>{{ route.meta?.title }}</span>
</template> </template>
<a-menu-item v-for="child in route.children" :key="child.path" @click="handleMenuClick(`${route.path}/${child.path}`)"> <a-menu-item v-for="child in route.children" :key="child.path"
@click="handleMenuClick(`${route.path}/${child.path}`)">
<router-link :to="`${route.path}/${child.path}`">{{ child.meta?.title }}</router-link> <router-link :to="`${route.path}/${child.path}`">{{ child.meta?.title }}</router-link>
</a-menu-item> </a-menu-item>
</a-sub-menu> </a-sub-menu>
@ -49,7 +38,7 @@
</a-layout-sider> </a-layout-sider>
<a-layout> <a-layout>
<a-layout-header class="layout-header"> <a-layout-header class="layout-header">
<layout-header v-model:collapsed="collapsed" /> <layout-header v-model:collapsed="collapsed"/>
</a-layout-header> </a-layout-header>
<a-layout-content class="layout-content"> <a-layout-content class="layout-content">
<!-- <keep-alive> 会缓存已经访问过的组件当你再次访问同一个页面时它会直接从缓存中加载而不会触发重新渲染 --> <!-- <keep-alive> 会缓存已经访问过的组件当你再次访问同一个页面时它会直接从缓存中加载而不会触发重新渲染 -->
@ -59,7 +48,7 @@
<!-- <router-view v-slot="{ Component, route }"> --> <!-- <router-view v-slot="{ Component, route }"> -->
<transition appear name="fade-transform" mode="out-in"> <transition appear name="fade-transform" mode="out-in">
<keep-alive :include="keepAliveNames"> <keep-alive :include="keepAliveNames">
<component :is="Component" :key="route.path" /> <component :is="Component" :key="route.path"/>
</keep-alive> </keep-alive>
</transition> </transition>
</router-view> </router-view>
@ -69,11 +58,21 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { InsuranceOutlined, HomeOutlined, SoundOutlined, MailOutlined, ApartmentOutlined, UserOutlined, AppstoreOutlined } from '@ant-design/icons-vue' import IconFont from "@/components/iconfont/IconFont.vue";
import {
InsuranceOutlined,
HomeOutlined,
SoundOutlined,
MailOutlined,
ApartmentOutlined,
UserOutlined,
AppstoreOutlined
} from '@ant-design/icons-vue'
import LayoutHeader from '@/components/layout/header/LayoutHeader.vue' import LayoutHeader from '@/components/layout/header/LayoutHeader.vue'
import { computed, watch, onMounted } from 'vue' import {computed, watch, onMounted} from 'vue'
import { staticRouter } from '@/router/staticRouters' import {staticRouter} from '@/router/staticRouters'
import { useRoute } from 'vue-router' import {useRoute} from 'vue-router'
const route = useRoute() const route = useRoute()
const selectedKeys = ref([route.path]) const selectedKeys = ref([route.path])
/** /**
@ -132,7 +131,7 @@ watch(openKeys, (newOpenKeys) => {
// //
// const keepAliveNames = ref(['index']) // const keepAliveNames = ref(['index'])
import { ref } from 'vue' import {ref} from 'vue'
// //
const collapsed = ref<boolean>(false) const collapsed = ref<boolean>(false)
@ -141,6 +140,13 @@ const keepAliveNames = ref<string[]>(['index', 'rindex'])
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.flex_ {
display: flex;
flex-direction: row;
align-items: center;
}
.main-content { .main-content {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;

View File

@ -9,6 +9,7 @@ export const staticRouter: RouteRecordRaw[] =
path: '/', path: '/',
name: 'dashboard', name: 'dashboard',
redirect: '/index', redirect: '/index',
icon: 'icon-policeman-full',
meta: { meta: {
keepalive: true keepalive: true
}, },