Commit fd30659a authored by 王玉鑫's avatar 王玉鑫

feat: icon修改

parent 72d68684
<template>
<div class="flex h-12 items-center justify-between">
<div class="flex h-[50px] items-center justify-between">
<div class="flex h-full items-center">
<div>
<img class="h-10 w-auto" src="@/assets/images/logo-head.png" alt="立业云" />
</div>
<div
class="ml-4 flex h-8 items-center px-4 font-yahei text-base text-[#C0322B] outline outline-1 outline-[#C0322B]"
>
{{ typeName }}
<img class="h-[50px]" :src="titleIcon" alt="立业云" />
</div>
</div>
<div v-if="showSearch" class="h-full">
......@@ -32,8 +27,16 @@
</div>
</template>
<script setup lang="ts">
import { onUnmounted, ref, watchEffect } from 'vue';
import { computed, onUnmounted, ref, watchEffect } from 'vue';
import { useSearchParamsStore } from '@/stores/searchParams.ts';
import { useRoute } from 'vue-router';
import parkIcon from '@/assets/images/title-icon__park.png';
import categoryIcon from '@/assets/images/title-icon__category.png';
import developIcon from '@/assets/images/title-icon__develop.png';
import landIcon from '@/assets/images/title-icon__land.png';
import policyIcon from '@/assets/images/title-icon__policy.png';
import carrierIcon from '@/assets/images/title-icon__carrier.png';
import { TitleIconType } from '@/types/enum.ts';
withDefaults(
defineProps<{
......@@ -50,8 +53,27 @@ const emit = defineEmits(['search']);
const searchParamsStore = useSearchParamsStore();
const route = useRoute();
const parkName = ref('');
const titleIcon = computed(() => {
const config: Record<TitleIconType, string> = {
[TitleIconType.carrier]: carrierIcon,
[TitleIconType.land]: landIcon,
[TitleIconType.park]: parkIcon,
[TitleIconType.category]: categoryIcon,
[TitleIconType.policy]: policyIcon,
[TitleIconType.develop]: developIcon,
[TitleIconType.user]: developIcon,
[TitleIconType.about]: developIcon,
[TitleIconType.contact]: developIcon,
};
const { iconType } = route.meta || {};
return config[iconType!];
});
watchEffect(() => {
parkName.value = searchParamsStore.searchName?.trim() || '';
});
......
......@@ -2,6 +2,7 @@ import { createRouter, createWebHashHistory } from 'vue-router';
import type { RouteRecordRaw } from 'vue-router';
/** 首页 */
import HomeView from '@/views/home/HomeView.vue';
import { TitleIconType } from '@/types/enum.ts';
/** 产业园 */
const IndustrialParkList = () => import('@/views/industrial-park/IndustrialParkList.vue');
......@@ -116,6 +117,7 @@ const routes: readonly RouteRecordRaw[] = [
component: DevelopZoneList,
meta: {
menuName: '开发区',
iconType: TitleIconType.develop,
},
},
{
......@@ -124,6 +126,7 @@ const routes: readonly RouteRecordRaw[] = [
component: IndustrialParkList,
meta: {
menuName: '产业园',
iconType: TitleIconType.park,
},
},
{
......@@ -131,6 +134,7 @@ const routes: readonly RouteRecordRaw[] = [
component: CarrierList,
meta: {
menuName: '载体',
iconType: TitleIconType.carrier,
},
},
{
......@@ -138,6 +142,7 @@ const routes: readonly RouteRecordRaw[] = [
component: LandList,
meta: {
menuName: '土地',
iconType: TitleIconType.land,
},
},
{
......@@ -146,6 +151,7 @@ const routes: readonly RouteRecordRaw[] = [
component: IndustryCategory,
meta: {
menuName: '产业分类',
iconType: TitleIconType.category,
},
},
{
......@@ -154,6 +160,7 @@ const routes: readonly RouteRecordRaw[] = [
component: IndustryPolicy,
meta: {
menuName: '产业政策',
iconType: TitleIconType.policy,
},
},
{
......@@ -162,6 +169,7 @@ const routes: readonly RouteRecordRaw[] = [
component: IndustryPolicyDetail,
meta: {
menuRouteName: RouteName.industryPolicy,
iconType: TitleIconType.policy,
},
},
{
......@@ -173,11 +181,17 @@ const routes: readonly RouteRecordRaw[] = [
// 关于立业云
...gen(RouteName.aboutUs),
component: AboutUs,
meta: {
iconType: TitleIconType.about,
},
},
{
// 联系我们
...gen(RouteName.contactUs),
component: ContactUs,
meta: {
iconType: TitleIconType.contact,
},
},
{
// 合伙人招募
......@@ -190,6 +204,7 @@ const routes: readonly RouteRecordRaw[] = [
component: IndustrialParkDetail,
meta: {
menuRouteName: RouteName.industrialParkList,
iconType: TitleIconType.park,
},
},
{
......@@ -198,6 +213,7 @@ const routes: readonly RouteRecordRaw[] = [
component: DevelopZoneDetail,
meta: {
menuRouteName: RouteName.developZoneList,
iconType: TitleIconType.develop,
},
},
{
......@@ -206,6 +222,7 @@ const routes: readonly RouteRecordRaw[] = [
component: LandDetail,
meta: {
menuRouteName: RouteName.landList,
iconType: TitleIconType.land,
},
},
{
......@@ -214,6 +231,7 @@ const routes: readonly RouteRecordRaw[] = [
component: CarrierDetail,
meta: {
menuRouteName: RouteName.carrierList,
iconType: TitleIconType.carrier,
},
},
{
......@@ -228,6 +246,7 @@ const routes: readonly RouteRecordRaw[] = [
component: MyPark,
meta: {
isAuth: true,
iconType: TitleIconType.user,
},
},
{
......@@ -236,6 +255,7 @@ const routes: readonly RouteRecordRaw[] = [
component: MyIndustrialDetail,
meta: {
isAuth: true,
iconType: TitleIconType.user,
},
},
{
......@@ -244,6 +264,7 @@ const routes: readonly RouteRecordRaw[] = [
component: MyDevelopDetail,
meta: {
isAuth: true,
iconType: TitleIconType.user,
},
},
{
......@@ -252,6 +273,7 @@ const routes: readonly RouteRecordRaw[] = [
component: ChangePassword,
meta: {
isAuth: true,
iconType: TitleIconType.user,
},
},
],
......
......@@ -118,3 +118,25 @@ export enum TabMessage {
/** 登录 */
login = 'login',
}
/** 标题icon类型 */
export enum TitleIconType {
/** 载体 */
carrier = 'carrier',
/** 产业园 */
park = 'park',
/** 开发区 */
develop = 'develop',
/** 产业分类 */
category = 'category',
/** 土地 */
land = 'land',
/** 产业政策 */
policy = 'policy',
/** 用户中心 */
user = 'user',
/** 关于我们 */
about = 'about',
/** 联系我们 */
contact = 'contact',
}
import 'vue-router';
import { RouteName } from '@/router/router.ts';
import { TitleIconType } from '@/types/enum.ts';
declare module 'vue-router' {
interface RouteMeta {
......@@ -7,5 +8,6 @@ declare module 'vue-router' {
parentMenuName?: string;
menuRouteName?: RouteName;
isAuth?: boolean;
iconType?: TitleIconType;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment