Skip to content

feat: 简易应用支持设置应用Logo #1195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ui/src/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -733,3 +733,13 @@ h5 {
display: none !important;
}
}


.edit-avatar {
position: relative;
.edit-mask {
position: absolute;
left: 0;
background: rgba(0, 0, 0, 0.4);
}
}
9 changes: 0 additions & 9 deletions ui/src/views/application-overview/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,5 @@ onMounted(() => {
right: 16px;
top: 21px;
}

.edit-avatar {
position: relative;
.edit-mask {
position: absolute;
left: 0;
background: rgba(0, 0, 0, 0.4);
}
}
}
</style>
28 changes: 26 additions & 2 deletions ui/src/views/application/ApplicationSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,11 @@
</h4>
<div class="dialog-bg">
<div class="flex align-center p-24">
<div class="mr-12">
<div
class="edit-avatar mr-12"
@mouseenter="showEditIcon = true"
@mouseleave="showEditIcon = false"
>
<AppAvatar
v-if="isAppIcon(applicationForm?.icon)"
shape="square"
Expand All @@ -473,8 +477,16 @@
shape="square"
:size="32"
/>
<AppAvatar
v-if="showEditIcon"
shape="square"
class="edit-mask"
:size="32"
@click="openEditAvatar"
>
<el-icon><EditPen /></el-icon>
</AppAvatar>
</div>

<h4>
{{
applicationForm?.name || $t('views.application.applicationForm.form.appName.label')
Expand Down Expand Up @@ -505,6 +517,7 @@
@change="openCreateModel($event)"
></CreateModelDialog>
<SelectProviderDialog ref="selectProviderRef" @change="openCreateModel($event)" />
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshIcon" />
</LayoutContainer>
</template>
<script setup lang="ts">
Expand All @@ -516,6 +529,8 @@ import ParamSettingDialog from './component/ParamSettingDialog.vue'
import AddDatasetDialog from './component/AddDatasetDialog.vue'
import CreateModelDialog from '@/views/template/component/CreateModelDialog.vue'
import SelectProviderDialog from '@/views/template/component/SelectProviderDialog.vue'

import EditAvatarDialog from '@/views/application-overview/component/EditAvatarDialog.vue'
import applicationApi from '@/api/application'
import { isAppIcon } from '@/utils/application'
import type { FormInstance, FormRules } from 'element-plus'
Expand Down Expand Up @@ -545,6 +560,7 @@ const selectProviderRef = ref<InstanceType<typeof SelectProviderDialog>>()

const applicationFormRef = ref<FormInstance>()
const AddDatasetDialogRef = ref()
const EditAvatarDialogRef = ref()

const loading = ref(false)
const datasetLoading = ref(false)
Expand Down Expand Up @@ -596,6 +612,7 @@ const providerOptions = ref<Array<Provider>>([])
const datasetList = ref([])
const sttModelOptions = ref<any>(null)
const ttsModelOptions = ref<any>(null)
const showEditIcon = ref(false)

const submit = async (formEl: FormInstance | undefined) => {
if (!formEl) return
Expand Down Expand Up @@ -730,6 +747,13 @@ function getProvider() {
})
}

function openEditAvatar() {
EditAvatarDialogRef.value.open(applicationForm.value)
}
function refreshIcon() {
getDetail()
}

function refresh() {
getDataset()
}
Expand Down
Loading