Skip to content

Commit caa9ad6

Browse files
feat: 简易应用支持设置应用Logo
1 parent f906efa commit caa9ad6

File tree

3 files changed

+36
-11
lines changed

3 files changed

+36
-11
lines changed

ui/src/styles/app.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,3 +733,13 @@ h5 {
733733
display: none !important;
734734
}
735735
}
736+
737+
738+
.edit-avatar {
739+
position: relative;
740+
.edit-mask {
741+
position: absolute;
742+
left: 0;
743+
background: rgba(0, 0, 0, 0.4);
744+
}
745+
}

ui/src/views/application-overview/index.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,5 @@ onMounted(() => {
332332
right: 16px;
333333
top: 21px;
334334
}
335-
336-
.edit-avatar {
337-
position: relative;
338-
.edit-mask {
339-
position: absolute;
340-
left: 0;
341-
background: rgba(0, 0, 0, 0.4);
342-
}
343-
}
344335
}
345336
</style>

ui/src/views/application/ApplicationSetting.vue

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,11 @@
457457
</h4>
458458
<div class="dialog-bg">
459459
<div class="flex align-center p-24">
460-
<div class="mr-12">
460+
<div
461+
class="edit-avatar mr-12"
462+
@mouseenter="showEditIcon = true"
463+
@mouseleave="showEditIcon = false"
464+
>
461465
<AppAvatar
462466
v-if="isAppIcon(applicationForm?.icon)"
463467
shape="square"
@@ -473,8 +477,16 @@
473477
shape="square"
474478
:size="32"
475479
/>
480+
<AppAvatar
481+
v-if="showEditIcon"
482+
shape="square"
483+
class="edit-mask"
484+
:size="32"
485+
@click="openEditAvatar"
486+
>
487+
<el-icon><EditPen /></el-icon>
488+
</AppAvatar>
476489
</div>
477-
478490
<h4>
479491
{{
480492
applicationForm?.name || $t('views.application.applicationForm.form.appName.label')
@@ -505,6 +517,7 @@
505517
@change="openCreateModel($event)"
506518
></CreateModelDialog>
507519
<SelectProviderDialog ref="selectProviderRef" @change="openCreateModel($event)" />
520+
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshIcon" />
508521
</LayoutContainer>
509522
</template>
510523
<script setup lang="ts">
@@ -516,6 +529,8 @@ import ParamSettingDialog from './component/ParamSettingDialog.vue'
516529
import AddDatasetDialog from './component/AddDatasetDialog.vue'
517530
import CreateModelDialog from '@/views/template/component/CreateModelDialog.vue'
518531
import SelectProviderDialog from '@/views/template/component/SelectProviderDialog.vue'
532+
533+
import EditAvatarDialog from '@/views/application-overview/component/EditAvatarDialog.vue'
519534
import applicationApi from '@/api/application'
520535
import { isAppIcon } from '@/utils/application'
521536
import type { FormInstance, FormRules } from 'element-plus'
@@ -545,6 +560,7 @@ const selectProviderRef = ref<InstanceType<typeof SelectProviderDialog>>()
545560
546561
const applicationFormRef = ref<FormInstance>()
547562
const AddDatasetDialogRef = ref()
563+
const EditAvatarDialogRef = ref()
548564
549565
const loading = ref(false)
550566
const datasetLoading = ref(false)
@@ -596,6 +612,7 @@ const providerOptions = ref<Array<Provider>>([])
596612
const datasetList = ref([])
597613
const sttModelOptions = ref<any>(null)
598614
const ttsModelOptions = ref<any>(null)
615+
const showEditIcon = ref(false)
599616
600617
const submit = async (formEl: FormInstance | undefined) => {
601618
if (!formEl) return
@@ -730,6 +747,13 @@ function getProvider() {
730747
})
731748
}
732749
750+
function openEditAvatar() {
751+
EditAvatarDialogRef.value.open(applicationForm.value)
752+
}
753+
function refreshIcon() {
754+
getDetail()
755+
}
756+
733757
function refresh() {
734758
getDataset()
735759
}

0 commit comments

Comments
 (0)