From fee2f2532144fca6c81b1523aeef54165c5263b2 Mon Sep 17 00:00:00 2001
From: hsy <1029150275@qq.com>
Date: 星期二, 25 八月 2026 16:50:38 +0800
Subject: [PATCH] Merge branch 'refs/heads/dev_pro2.0' into fix/hsy/20260812
---
src/packages/effects/layouts/src/widgets/preferences/blocks/company/company.vue | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 151 insertions(+), 0 deletions(-)
diff --git a/src/packages/effects/layouts/src/widgets/preferences/blocks/company/company.vue b/src/packages/effects/layouts/src/widgets/preferences/blocks/company/company.vue
new file mode 100644
index 0000000..6a7d235
--- /dev/null
+++ b/src/packages/effects/layouts/src/widgets/preferences/blocks/company/company.vue
@@ -0,0 +1,151 @@
+<script setup lang="ts">
+import { message } from 'ant-design-vue';
+import { Button, Input, Upload } from 'ant-design-vue';
+import { onMounted, ref } from 'vue';
+
+// 娉ㄦ剰锛氭湰鏂囦欢浣嶄簬 @vben 鐨� packages 鍐呴儴锛屾棤娉曚娇鐢ㄥ簲鐢ㄥ眰鍒悕 #/锛岄渶鐢ㄧ浉瀵硅矾寰勶紙涓庡悓鐩綍 custom.vue 淇濇寔涓�鑷达級
+import { publicUploadFile } from '../../../../../../../../api/system/storage';
+import { $t } from '../../../../../../../locales/src';
+import { useCompanyConfigStore } from '../../../../../../../../store/company-config';
+
+defineOptions({
+ name: 'PreferenceCompanyConfig',
+});
+
+const companyConfigStore = useCompanyConfigStore();
+
+const companyName = ref(companyConfigStore.companyName);
+const loginTitle = ref(companyConfigStore.loginTitle);
+const loginDescription = ref(companyConfigStore.loginDescription);
+const logoUrl = ref(companyConfigStore.logoUrl);
+const uploading = ref(false);
+
+// 鎵撳紑鍖哄潡鏃朵粠鍚庣鎷夊彇鏈�鏂板叕鍙搁厤缃苟鍥炲~琛ㄥ崟锛坰tore 鍒濆�煎彲鑳戒负绌猴紝鍥犲惎鍔ㄥ姞杞借蛋鐨勬槸绾嚱鏁帮級
+onMounted(async () => {
+ await companyConfigStore.loadFromServer();
+ companyName.value = companyConfigStore.companyName;
+ loginTitle.value = companyConfigStore.loginTitle;
+ loginDescription.value = companyConfigStore.loginDescription;
+ logoUrl.value = companyConfigStore.logoUrl;
+});
+
+/** 涓婁紶 logo锛堟案涔呭叕寮�锛屼緵鐧诲綍椤靛厤鐧诲綍灞曠ず锛� */
+async function handleBeforeUpload(file: File) {
+ uploading.value = true;
+ try {
+ const blobs = await publicUploadFile([file]);
+ const blob = blobs?.[0];
+ if (blob?.previewURL || blob?.url) {
+ logoUrl.value = blob.previewURL || blob.url || '';
+ message.success($t('preferences.company.uploadSuccess'));
+ } else {
+ message.error($t('preferences.company.uploadFailed'));
+ }
+ } catch {
+ message.error($t('preferences.company.uploadFailed'));
+ } finally {
+ uploading.value = false;
+ }
+ // 杩斿洖 false锛岄樆姝㈢粍浠堕粯璁や笂浼狅紙宸查�氳繃鎺ュ彛涓婁紶锛�
+ return false;
+}
+
+async function handleSave() {
+ if (!companyName.value.trim()) {
+ message.warning($t('preferences.company.companyNameRequired'));
+ return;
+ }
+ try {
+ await companyConfigStore.save({
+ companyName: companyName.value.trim(),
+ logoUrl: logoUrl.value || undefined,
+ loginTitle: loginTitle.value,
+ loginDescription: loginDescription.value,
+ });
+ message.success($t('preferences.company.saveSuccess'));
+ } catch {
+ message.error($t('preferences.company.saveFailed'));
+ }
+}
+</script>
+
+<template>
+ <div class="flex flex-col">
+ <!-- 鍏徃鍚嶇О -->
+ <div class="my-2 flex w-full items-center justify-between gap-4 rounded-md px-2 py-2">
+ <span class="shrink-0 text-sm text-foreground/80">
+ {{ $t('preferences.company.companyName') }}
+ </span>
+ <Input
+ v-model:value="companyName"
+ :placeholder="$t('preferences.company.companyNamePlaceholder')"
+ class="w-41.25"
+ allow-clear
+ />
+ </div>
+
+ <!-- 鐧诲綍椤垫爣棰� -->
+ <div class="my-2 flex w-full items-center justify-between gap-4 rounded-md px-2 py-2">
+ <span class="shrink-0 text-sm text-foreground/80">
+ {{ $t('preferences.company.loginTitle') }}
+ </span>
+ <Input
+ v-model:value="loginTitle"
+ :placeholder="$t('preferences.company.loginTitlePlaceholder')"
+ class="w-41.25"
+ allow-clear
+ />
+ </div>
+
+ <!-- 鐧诲綍椤垫弿杩� -->
+ <div class="my-2 flex w-full items-center justify-between gap-4 rounded-md px-2 py-2">
+ <span class="shrink-0 text-sm text-foreground/80">
+ {{ $t('preferences.company.loginDescription') }}
+ </span>
+ <Input
+ v-model:value="loginDescription"
+ :placeholder="$t('preferences.company.loginDescriptionPlaceholder')"
+ class="w-41.25"
+ allow-clear
+ />
+ </div>
+
+ <!-- 鍏徃 Logo -->
+ <div class="my-2 flex w-full items-center justify-between gap-4 rounded-md px-2 py-2">
+ <span class="shrink-0 text-sm text-foreground/80">
+ {{ $t('preferences.company.logo') }}
+ </span>
+ <div class="flex items-center gap-2">
+ <Upload
+ :show-upload-list="false"
+ accept="image/*"
+ :before-upload="handleBeforeUpload"
+ >
+ <Button size="small" :loading="uploading">
+ {{ $t('preferences.company.uploadLogo') }}
+ </Button>
+ </Upload>
+ <img
+ v-if="logoUrl"
+ :src="logoUrl"
+ alt="company-logo"
+ class="h-9 w-9 rounded border border-border object-contain"
+ />
+ <span v-else class="text-xs text-muted-foreground">
+ {{ $t('preferences.company.logoEmpty') }}
+ </span>
+ </div>
+ </div>
+
+ <div v-if="uploading" class="px-2 pb-1 text-xs text-muted-foreground">
+ {{ $t('preferences.company.uploading') }}
+ </div>
+
+ <!-- 淇濆瓨 -->
+ <div class="mt-3 px-2">
+ <Button type="primary" class="w-full" @click="handleSave">
+ {{ $t('preferences.company.save') }}
+ </Button>
+ </div>
+ </div>
+</template>
--
Gitblit v1.9.3