refactor: update avatar dialog submission logic to remove hardcoded icon path

This commit is contained in:
CaptainB 2025-07-03 19:51:28 +08:00
parent 7dc20732d5
commit d40294d5a4
2 changed files with 5 additions and 5 deletions

View File

@ -57,7 +57,7 @@
style="background: none" style="background: none"
class="mr-8" class="mr-8"
> >
<img :src="scope.row?.icon" alt="" /> <img :src="resetUrl(scope.row?.icon)" alt="" />
</el-avatar> </el-avatar>
<el-avatar v-else class="avatar-green" shape="square" :size="24"> <el-avatar v-else class="avatar-green" shape="square" :size="24">
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt="" /> <img src="@/assets/node/icon_tool.svg" style="width: 58%" alt="" />
@ -165,7 +165,7 @@
import { onMounted, ref, reactive, computed } from 'vue' import { onMounted, ref, reactive, computed } from 'vue'
import ToolResourceApi from '@/api/system-resource-management/tool' import ToolResourceApi from '@/api/system-resource-management/tool'
import { t } from '@/locales' import { t } from '@/locales'
import { isAppIcon } from '@/utils/common' import {isAppIcon, resetUrl} from '@/utils/common'
import { ToolType } from '@/enums/tool' import { ToolType } from '@/enums/tool'
import useStore from '@/stores' import useStore from '@/stores'
import { datetimeFormat } from '@/utils/time' import { datetimeFormat } from '@/utils/time'

View File

@ -2,7 +2,7 @@
<CardBox :title="props.tool.name" :description="props.tool.desc" class="cursor"> <CardBox :title="props.tool.name" :description="props.tool.desc" class="cursor">
<template #icon> <template #icon>
<el-avatar v-if="isAppIcon(props.tool?.icon)" shape="square" :size="32" style="background: none"> <el-avatar v-if="isAppIcon(props.tool?.icon)" shape="square" :size="32" style="background: none">
<img :src="props.tool?.icon" alt="" /> <img :src="resetUrl(props.tool?.icon)" alt="" />
</el-avatar> </el-avatar>
<el-avatar v-else-if="props.tool?.name" :name="props.tool?.name" pinyinColor shape="square" :size="32" /> <el-avatar v-else-if="props.tool?.name" :name="props.tool?.name" pinyinColor shape="square" :size="32" />
</template> </template>
@ -29,7 +29,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { isAppIcon } from '@/utils/common' import {isAppIcon, resetUrl} from '@/utils/common'
const props = defineProps<{ const props = defineProps<{
tool: any, tool: any,
@ -69,4 +69,4 @@ const emit = defineEmits<{
} }
} }
} }
</style> </style>