Merge remote-tracking branch 'origin/main' into feature/v1.2灵机空间-项目管理_rxd

# Conflicts:
#	src/api/all/common.ts
#	src/components/_base/navbar/index.vue
#	src/hooks/useTableSelectionWithPagination.ts
#	src/router/routes/modules/propertyMarketing.ts
#	src/stores/modules/side-bar/constants.ts
#	src/views/property-marketing/media-account/account-manage/components/account-table/index.vue
#	src/views/property-marketing/media-account/account-manage/components/add-account-modal/index.vue
#	src/views/property-marketing/put-account/account-data/components/filter-block/index.vue
#	src/views/property-marketing/put-account/account-manage/components/account-table/index.vue
#	src/views/property-marketing/put-account/account-manage/components/add-account-modal/index.vue
#	src/views/property-marketing/put-account/account-manage/components/filter-block/index.vue
#	src/views/property-marketing/put-account/components/status-select/constants.ts
This commit is contained in:
rd
2025-07-23 15:22:46 +08:00
66 changed files with 2144 additions and 673 deletions

94
src/utils/arcoD.tsx Normal file
View File

@ -0,0 +1,94 @@
import { Notification } from '@arco-design/web-vue';
import { downloadByUrl } from '@/utils/tools';
import { IconLoading } from '@arco-design/web-vue/es/icon';
import icon1 from '@/assets/img/media-account/icon-warn-1.png';
import icon2 from '@/assets/img/media-account/icon-success.png';
import icon3 from "@/assets/img/media-account/icon-warn.png"
interface RenderNotificationData {
total_number: number;
success_number: number;
fail_number: number;
file?: string;
}
// 下载通知框
export function showExportNotification(label: string, others: { id?: string, duration?: number }) {
const { id = '', duration = 3000 } = others ?? {}
Notification.warning({
id,
showIcon: false,
closable: true,
content: () => (
<div class="flex items-center pr-16px">
<IconLoading size={16} class="color-#6D4CFE mr-8px" />
<p class="text-14px lh-22px font-400 color-#211F24">{label}</p>
</div>
),
duration,
class: 'px-16px py-9px w-450px rounded-2px bg-#F0EDFF',
});
}
// 下载失败框
export function showFailExportNotification(label: string, others: { id?: string, duration?: number, onReDownload?: Function }) {
const { id = '', duration = 0, onReDownload } = others ?? {}
Notification.warning({
id,
showIcon: false,
closable: true,
content: () => (
<div class="flex items-center justify-between pr-16px">
<div class="flex items-center mr-10px">
<img src={icon3} width={16} height={16} class=" mr-8px" />
<p class="text-14px lh-22px font-400 color-#211F24 ">{label}</p>
</div>
<p class="text-14px lh-22px font-400 color-#6D4CFE cursor-pointer" onClick={() => onReDownload?.()}></p>
</div>
),
duration,
class: 'px-16px py-9px w-500px rounded-2px bg-#FFE9E7',
});
}
export const showImportResultNotification = (data: RenderNotificationData) => {
const { total_number, success_number, fail_number, file } = data;
const hasError = fail_number > 0;
const handleDownloadError = (file?: string) => {
file && downloadByUrl(file);
};
Notification.warning({
showIcon: false,
closable: true,
content: () => (
<div>
<div class="flex items-center mb-4px">
<img src={hasError ? icon1 : icon2} width="16" height="16" class="mr-8px" />
<span class="text-16px lh-24px font-400 color-#211F24"></span>
</div>
<p class="text-14px lh-22px font-400 color-#211F24">
{total_number} {success_number}
{hasError && (
<span>
<span class="color-#F64B31">{fail_number}</span>
</span>
)}
</p>
{hasError && (
<div
class="mt-8px text-14px lh-22px font-400 color-#6D4CFE cursor-pointer"
onClick={() => handleDownloadError(file)}
>
</div>
)}
</div>
),
duration: 3000,
class: `px-16px py-16px w-400px rounded-2px ${hasError ? 'bg-#FFF7E5' : 'bg-#EBF7F2'}`,
});
};

View File

@ -106,3 +106,7 @@ export function downloadByUrl(url: string, filename?: string) {
a.click();
document.body.removeChild(a);
}
export function genRandomId() {
return `id_${Date.now()}_${Math.floor(Math.random() * 10000)}`;
}

View File

@ -12,13 +12,13 @@ import { useSidebarStore } from '@/stores/modules/side-bar';
export function goUserLogin(query?: any) {
router.push({ name: 'UserLogin', query });
}
// 初始化企业信息、navbar菜单、允许访问的路由
export const getUserEnterpriseInfo = async () => {
const enterpriseStore = useEnterpriseStore();
const sidebarStore = useSidebarStore();
const userStore = useUserStore();
await enterpriseStore.getEnterpriseInfo();
await enterpriseStore.getEnterpriseInfo(); // 初始化企业信息
sidebarStore.getUserNavbarMenuList(); // 初始化navbar菜单
userStore.getUserAllowAccessRoutes(); // 初始化允许访问的路由
};
@ -26,9 +26,11 @@ export const getUserEnterpriseInfo = async () => {
// 登录处理
export async function handleUserLogin() {
const userStore = useUserStore();
const sidebarStore = useSidebarStore();
await userStore.getUserInfo(); // 初始化用户信息
await getUserEnterpriseInfo();
await getUserEnterpriseInfo(); // 初始化企业信息、navbar菜单、允许访问的路由
sidebarStore.startUnreadInfoPolling(); // 初始化未读信息
handleUserHome();
}
@ -38,18 +40,19 @@ export function handleUserHome() {
router.push({ name: 'Home' });
}
// 登出处理
export function handleUserLogout() {
const userStore = useUserStore();
const enterpriseStore = useEnterpriseStore();
const sidebarStore = useSidebarStore();
userStore.clearUserInfo();
enterpriseStore.clearUserEnterpriseInfo();
sidebarStore.clearUserNavbarMenuList();
userStore.clearUserAllowAccessRoutes();
sidebarStore.clearActiveMenuId();
userStore.deleteToken();
userStore.clearUserInfo(); // 清除用户信息
userStore.clearToken(); // 清除token
enterpriseStore.clearUserEnterpriseInfo(); // 清除企业信息
sidebarStore.clearUserNavbarMenuList(); // 清除navbar菜单信息
userStore.clearUserAllowAccessRoutes(); // 清除权限路由列表
sidebarStore.stopUnreadInfoPolling(); // 清除未读消息
sidebarStore.clearActiveMenuId(); // 清除active菜单id
goUserLogin();
}