|
@@ -1,7 +1,8 @@
|
|
import { Component, OnInit, signal, computed } from '@angular/core';
|
|
import { Component, OnInit, signal, computed } from '@angular/core';
|
|
import { CommonModule } from '@angular/common';
|
|
import { CommonModule } from '@angular/common';
|
|
import { FormsModule, ReactiveFormsModule, FormBuilder, FormGroup } from '@angular/forms';
|
|
import { FormsModule, ReactiveFormsModule, FormBuilder, FormGroup } from '@angular/forms';
|
|
-import { RouterModule } from '@angular/router';
|
|
|
|
|
|
+import { RouterModule, ActivatedRoute } from '@angular/router';
|
|
|
|
+import * as QRCode from 'qrcode';
|
|
|
|
|
|
// 定义案例接口
|
|
// 定义案例接口
|
|
interface CaseItem {
|
|
interface CaseItem {
|
|
@@ -20,6 +21,14 @@ interface CaseItem {
|
|
tags: string[];
|
|
tags: string[];
|
|
views: number;
|
|
views: number;
|
|
description: string;
|
|
description: string;
|
|
|
|
+ // 新增字段
|
|
|
|
+ projectType: '工装' | '家装';
|
|
|
|
+ subType: '平层' | '复式' | '别墅' | '自建房' | '其他';
|
|
|
|
+ renderingLevel: '高端' | '中端';
|
|
|
|
+ shareCount: number;
|
|
|
|
+ favoriteCount: number;
|
|
|
|
+ likeCount: number;
|
|
|
|
+ conversionRate: number; // 0-100
|
|
}
|
|
}
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
@@ -36,6 +45,12 @@ export class CaseLibrary implements OnInit {
|
|
// 搜索关键词
|
|
// 搜索关键词
|
|
searchTerm = signal('');
|
|
searchTerm = signal('');
|
|
|
|
|
|
|
|
+ // 分享弹窗
|
|
|
|
+ showShareModal = signal(false);
|
|
|
|
+ shareLink = signal('');
|
|
|
|
+ qrDataUrl = signal('');
|
|
|
|
+ sharedCaseId = signal<string | null>(null);
|
|
|
|
+
|
|
// 筛选表单
|
|
// 筛选表单
|
|
filterForm: FormGroup;
|
|
filterForm: FormGroup;
|
|
|
|
|
|
@@ -58,11 +73,11 @@ export class CaseLibrary implements OnInit {
|
|
}
|
|
}
|
|
|
|
|
|
// 应用表单筛选
|
|
// 应用表单筛选
|
|
- const filters = this.filterForm.value;
|
|
|
|
|
|
+ const filters = this.filterForm.value as any;
|
|
|
|
|
|
if (filters.style && filters.style.length > 0) {
|
|
if (filters.style && filters.style.length > 0) {
|
|
result = result.filter(caseItem =>
|
|
result = result.filter(caseItem =>
|
|
- caseItem.style.some(style => filters.style.includes(style))
|
|
|
|
|
|
+ caseItem.style.some((s: string) => filters.style.includes(s))
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -73,18 +88,51 @@ export class CaseLibrary implements OnInit {
|
|
if (filters.property) {
|
|
if (filters.property) {
|
|
result = result.filter(caseItem => caseItem.property === filters.property);
|
|
result = result.filter(caseItem => caseItem.property === filters.property);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (filters.projectType) {
|
|
|
|
+ result = result.filter(caseItem => caseItem.projectType === filters.projectType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (filters.subType) {
|
|
|
|
+ result = result.filter(caseItem => caseItem.subType === filters.subType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (filters.renderingLevel) {
|
|
|
|
+ result = result.filter(caseItem => caseItem.renderingLevel === filters.renderingLevel);
|
|
|
|
+ }
|
|
|
|
|
|
if (filters.minArea) {
|
|
if (filters.minArea) {
|
|
- result = result.filter(caseItem => caseItem.area >= filters.minArea);
|
|
|
|
|
|
+ result = result.filter(caseItem => caseItem.area >= Number(filters.minArea));
|
|
}
|
|
}
|
|
|
|
|
|
if (filters.maxArea) {
|
|
if (filters.maxArea) {
|
|
- result = result.filter(caseItem => caseItem.area <= filters.maxArea);
|
|
|
|
|
|
+ result = result.filter(caseItem => caseItem.area <= Number(filters.maxArea));
|
|
}
|
|
}
|
|
|
|
|
|
if (filters.favorite) {
|
|
if (filters.favorite) {
|
|
result = result.filter(caseItem => caseItem.isFavorite);
|
|
result = result.filter(caseItem => caseItem.isFavorite);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 排序
|
|
|
|
+ if (filters.sortBy) {
|
|
|
|
+ switch (filters.sortBy) {
|
|
|
|
+ case 'views':
|
|
|
|
+ result.sort((a, b) => b.views - a.views);
|
|
|
|
+ break;
|
|
|
|
+ case 'shares':
|
|
|
|
+ result.sort((a, b) => b.shareCount - a.shareCount);
|
|
|
|
+ break;
|
|
|
|
+ case 'conversion':
|
|
|
|
+ result.sort((a, b) => b.conversionRate - a.conversionRate);
|
|
|
|
+ break;
|
|
|
|
+ case 'createdAt':
|
|
|
|
+ result.sort((a, b) => +b.createdAt - +a.createdAt);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ // 默认按创建时间倒序
|
|
|
|
+ result.sort((a, b) => +b.createdAt - +a.createdAt);
|
|
|
|
+ }
|
|
|
|
|
|
return result;
|
|
return result;
|
|
});
|
|
});
|
|
@@ -114,60 +162,119 @@ export class CaseLibrary implements OnInit {
|
|
styleOptions = ['现代简约', '北欧风', '工业风', '新中式', '法式轻奢', '日式', '美式', '混搭'];
|
|
styleOptions = ['现代简约', '北欧风', '工业风', '新中式', '法式轻奢', '日式', '美式', '混搭'];
|
|
houseTypeOptions = ['一室一厅', '两室一厅', '两室两厅', '三室一厅', '三室两厅', '四室两厅', '复式', '别墅', '其他'];
|
|
houseTypeOptions = ['一室一厅', '两室一厅', '两室两厅', '三室一厅', '三室两厅', '四室两厅', '复式', '别墅', '其他'];
|
|
propertyOptions = ['万科', '绿城', '保利', '龙湖', '融创', '中海', '碧桂园', '其他'];
|
|
propertyOptions = ['万科', '绿城', '保利', '龙湖', '融创', '中海', '碧桂园', '其他'];
|
|
|
|
+ projectTypeOptions: Array<CaseItem['projectType']> = ['工装', '家装'];
|
|
|
|
+ subTypeOptions: Array<CaseItem['subType']> = ['平层', '复式', '别墅', '自建房', '其他'];
|
|
|
|
+ renderingLevelOptions: Array<CaseItem['renderingLevel']> = ['高端', '中端'];
|
|
|
|
+ sortOptions = [
|
|
|
|
+ { label: '最新上传', value: 'createdAt' },
|
|
|
|
+ { label: '浏览最多', value: 'views' },
|
|
|
|
+ { label: '分享最多', value: 'shares' },
|
|
|
|
+ { label: '转化率最高', value: 'conversion' }
|
|
|
|
+ ];
|
|
|
|
|
|
- constructor(private fb: FormBuilder) {
|
|
|
|
|
|
+ constructor(private fb: FormBuilder, private route: ActivatedRoute) {
|
|
// 初始化筛选表单
|
|
// 初始化筛选表单
|
|
this.filterForm = this.fb.group({
|
|
this.filterForm = this.fb.group({
|
|
style: [[]],
|
|
style: [[]],
|
|
houseType: [''],
|
|
houseType: [''],
|
|
property: [''],
|
|
property: [''],
|
|
|
|
+ projectType: [''],
|
|
|
|
+ subType: [''],
|
|
|
|
+ renderingLevel: [''],
|
|
minArea: [''],
|
|
minArea: [''],
|
|
maxArea: [''],
|
|
maxArea: [''],
|
|
- favorite: [false]
|
|
|
|
|
|
+ favorite: [false],
|
|
|
|
+ sortBy: ['createdAt']
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
ngOnInit(): void {
|
|
ngOnInit(): void {
|
|
// 加载模拟案例数据
|
|
// 加载模拟案例数据
|
|
this.loadCases();
|
|
this.loadCases();
|
|
|
|
+
|
|
|
|
+ // 读取分享链接参数并打开对应案例详情
|
|
|
|
+ this.route.queryParamMap.subscribe(params => {
|
|
|
|
+ const caseId = params.get('case');
|
|
|
|
+ if (caseId) {
|
|
|
|
+ const item = this.cases().find(c => c.id === caseId);
|
|
|
|
+ if (item) {
|
|
|
|
+ this.viewCaseDetails(item);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
// 加载案例数据
|
|
// 加载案例数据
|
|
loadCases(): void {
|
|
loadCases(): void {
|
|
|
|
+ // 本地占位图集合
|
|
|
|
+ const LOCAL_IMAGES = [
|
|
|
|
+ '/assets/images/portfolio-1.svg',
|
|
|
|
+ '/assets/images/portfolio-2.svg',
|
|
|
|
+ '/assets/images/portfolio-3.svg',
|
|
|
|
+ '/assets/images/portfolio-4.svg'
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ const rand = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1)) + min;
|
|
|
|
+ const pick = <T,>(arr: T[]): T => arr[Math.floor(Math.random() * arr.length)];
|
|
|
|
+
|
|
// 模拟API请求获取案例数据
|
|
// 模拟API请求获取案例数据
|
|
- const mockCases: CaseItem[] = Array.from({ length: 24 }, (_, i) => ({
|
|
|
|
- id: `case-${i + 1}`,
|
|
|
|
- name: `${this.styleOptions[Math.floor(Math.random() * this.styleOptions.length)]}风格 ${this.houseTypeOptions[Math.floor(Math.random() * this.houseTypeOptions.length)]}设计`,
|
|
|
|
- category: ['客厅', '卧室', '厨房', '浴室', '书房', '餐厅'][Math.floor(Math.random() * 6)],
|
|
|
|
- style: [this.styleOptions[Math.floor(Math.random() * this.styleOptions.length)]],
|
|
|
|
- houseType: this.houseTypeOptions[Math.floor(Math.random() * this.houseTypeOptions.length)],
|
|
|
|
- property: this.propertyOptions[Math.floor(Math.random() * this.propertyOptions.length)],
|
|
|
|
- designer: ['张设计', '李设计', '王设计', '赵设计', '陈设计'][Math.floor(Math.random() * 5)],
|
|
|
|
- area: Math.floor(Math.random() * 100) + 50, // 50-150㎡
|
|
|
|
- createdAt: new Date(Date.now() - Math.floor(Math.random() * 365) * 24 * 60 * 60 * 1000),
|
|
|
|
- coverImage: `https://picsum.photos/id/${100 + i}/600/400`,
|
|
|
|
- detailImages: Array.from({ length: 4 }, (_, j) => `https://picsum.photos/id/${130 + i + j}/800/600`),
|
|
|
|
- isFavorite: Math.random() > 0.7,
|
|
|
|
- tags: ['热门', '精选', '新上传', '高性价比', '业主好评'].filter(() => Math.random() > 0.5),
|
|
|
|
- views: Math.floor(Math.random() * 1000) + 100,
|
|
|
|
- description: '这是一个精美的' + ['现代简约', '北欧风', '新中式'][Math.floor(Math.random() * 3)] + '风格设计案例,融合了功能性与美学,为客户打造了舒适宜人的居住环境。'
|
|
|
|
- }));
|
|
|
|
|
|
+ const mockCases: CaseItem[] = Array.from({ length: 24 }, (_, i) => {
|
|
|
|
+ const cover = LOCAL_IMAGES[i % LOCAL_IMAGES.length];
|
|
|
|
+ const details = Array.from({ length: 4 }, (_, j) => LOCAL_IMAGES[(i + j) % LOCAL_IMAGES.length]);
|
|
|
|
+ const projectType = pick(this.projectTypeOptions);
|
|
|
|
+ const subType = pick(this.subTypeOptions);
|
|
|
|
+ const renderingLevel = pick(this.renderingLevelOptions);
|
|
|
|
+ const createdAt = new Date(Date.now() - rand(0, 365) * 24 * 60 * 60 * 1000);
|
|
|
|
+ const views = rand(100, 3000);
|
|
|
|
+ const shareCount = rand(10, 500);
|
|
|
|
+ const favoriteCount = rand(5, 400);
|
|
|
|
+ const likeCount = rand(10, 800);
|
|
|
|
+ const conversionRate = Number((Math.random() * 30 + 5).toFixed(1)); // 5% - 35%
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ id: `case-${i + 1}`,
|
|
|
|
+ name: `${pick(this.styleOptions)}风格 ${pick(this.houseTypeOptions)}设计`,
|
|
|
|
+ category: pick(['客厅', '卧室', '厨房', '浴室', '书房', '餐厅']),
|
|
|
|
+ style: [pick(this.styleOptions)],
|
|
|
|
+ houseType: pick(this.houseTypeOptions),
|
|
|
|
+ property: pick(this.propertyOptions),
|
|
|
|
+ designer: pick(['张设计', '李设计', '王设计', '赵设计', '陈设计']),
|
|
|
|
+ area: rand(50, 150),
|
|
|
|
+ createdAt,
|
|
|
|
+ coverImage: cover,
|
|
|
|
+ detailImages: details,
|
|
|
|
+ isFavorite: Math.random() > 0.7,
|
|
|
|
+ tags: ['热门', '精选', '新上传', '高性价比', '业主好评'].filter(() => Math.random() > 0.5),
|
|
|
|
+ views,
|
|
|
|
+ description: '这是一个精美的' + pick(['现代简约', '北欧风', '新中式']) + '风格设计案例,融合了功能性与美学,为客户打造了舒适宜人的居住环境。',
|
|
|
|
+ projectType,
|
|
|
|
+ subType,
|
|
|
|
+ renderingLevel,
|
|
|
|
+ shareCount,
|
|
|
|
+ favoriteCount,
|
|
|
|
+ likeCount,
|
|
|
|
+ conversionRate
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
|
|
this.cases.set(mockCases);
|
|
this.cases.set(mockCases);
|
|
}
|
|
}
|
|
|
|
|
|
- // 切换收藏状态
|
|
|
|
|
|
+ // 切换收藏状态(同时更新收藏计数)
|
|
toggleFavorite(caseId: string): void {
|
|
toggleFavorite(caseId: string): void {
|
|
this.cases.set(
|
|
this.cases.set(
|
|
- this.cases().map(caseItem =>
|
|
|
|
- caseItem.id === caseId
|
|
|
|
- ? { ...caseItem, isFavorite: !caseItem.isFavorite }
|
|
|
|
- : caseItem
|
|
|
|
- )
|
|
|
|
|
|
+ this.cases().map(caseItem => {
|
|
|
|
+ if (caseItem.id === caseId) {
|
|
|
|
+ const isFav = !caseItem.isFavorite;
|
|
|
|
+ const favoriteCount = Math.max(0, caseItem.favoriteCount + (isFav ? 1 : -1));
|
|
|
|
+ return { ...caseItem, isFavorite: isFav, favoriteCount };
|
|
|
|
+ }
|
|
|
|
+ return caseItem;
|
|
|
|
+ })
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- // 查看案例详情
|
|
|
|
|
|
+ // 查看案例详情(增加浏览量)
|
|
viewCaseDetails(caseItem: CaseItem): void {
|
|
viewCaseDetails(caseItem: CaseItem): void {
|
|
this.selectedCase.set(caseItem);
|
|
this.selectedCase.set(caseItem);
|
|
// 增加浏览量
|
|
// 增加浏览量
|
|
@@ -185,11 +292,78 @@ export class CaseLibrary implements OnInit {
|
|
this.selectedCase.set(null);
|
|
this.selectedCase.set(null);
|
|
}
|
|
}
|
|
|
|
|
|
- // 分享案例
|
|
|
|
- shareCase(caseId: string): void {
|
|
|
|
- console.log('分享案例:', caseId);
|
|
|
|
- // 模拟复制到剪贴板
|
|
|
|
- alert('案例链接已复制到剪贴板!');
|
|
|
|
|
|
+ // 分享案例:生成链接、复制并展示弹窗,同时更新分享计数
|
|
|
|
+ async shareCase(caseId: string): Promise<void> {
|
|
|
|
+ const link = this.getShareLink(caseId);
|
|
|
|
+ this.shareLink.set(link);
|
|
|
|
+ this.showShareModal.set(true);
|
|
|
|
+ this.sharedCaseId.set(caseId);
|
|
|
|
+
|
|
|
|
+ // 生成二维码
|
|
|
|
+ await this.generateQrCode(link);
|
|
|
|
+
|
|
|
|
+ // 分享计数 +1
|
|
|
|
+ this.cases.set(
|
|
|
|
+ this.cases().map(item => item.id === caseId ? { ...item, shareCount: item.shareCount + 1 } : item)
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ // 尝试自动复制
|
|
|
|
+ try {
|
|
|
|
+ await navigator.clipboard.writeText(link);
|
|
|
|
+ } catch {
|
|
|
|
+ // 忽略复制失败(例如非安全上下文),用户可手动复制
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ getShareLink(caseId: string): string {
|
|
|
|
+ const base = window.location.origin;
|
|
|
|
+ return `${base}/customer-service/case-library?case=${encodeURIComponent(caseId)}`;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ async copyShareLink(): Promise<void> {
|
|
|
|
+ const link = this.shareLink();
|
|
|
|
+ try {
|
|
|
|
+ await navigator.clipboard.writeText(link);
|
|
|
|
+ alert('链接已复制到剪贴板');
|
|
|
|
+ } catch {
|
|
|
|
+ alert('复制失败,请手动选择链接复制');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 生成二维码
|
|
|
|
+ private async generateQrCode(text: string): Promise<void> {
|
|
|
|
+ try {
|
|
|
|
+ const url = await QRCode.toDataURL(text, { width: 160, margin: 1 });
|
|
|
|
+ this.qrDataUrl.set(url);
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.error('生成二维码失败', e);
|
|
|
|
+ this.qrDataUrl.set('');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ downloadQrCode(): void {
|
|
|
|
+ const dataUrl = this.qrDataUrl();
|
|
|
|
+ if (!dataUrl) { return; }
|
|
|
|
+ const a = document.createElement('a');
|
|
|
|
+ const name = this.sharedCaseId() ? `${this.sharedCaseId()}-qr.png` : 'case-qr.png';
|
|
|
|
+ a.href = dataUrl;
|
|
|
|
+ a.download = name;
|
|
|
|
+ document.body.appendChild(a);
|
|
|
|
+ a.click();
|
|
|
|
+ document.body.removeChild(a);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ openShareLink(): void {
|
|
|
|
+ const link = this.shareLink();
|
|
|
|
+ if (link) {
|
|
|
|
+ window.open(link, '_blank', 'noopener');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ closeShareModal(): void {
|
|
|
|
+ this.showShareModal.set(false);
|
|
|
|
+ this.qrDataUrl.set('');
|
|
|
|
+ this.sharedCaseId.set(null);
|
|
}
|
|
}
|
|
|
|
|
|
// 重置筛选条件
|
|
// 重置筛选条件
|
|
@@ -198,9 +372,13 @@ export class CaseLibrary implements OnInit {
|
|
style: [],
|
|
style: [],
|
|
houseType: '',
|
|
houseType: '',
|
|
property: '',
|
|
property: '',
|
|
|
|
+ projectType: '',
|
|
|
|
+ subType: '',
|
|
|
|
+ renderingLevel: '',
|
|
minArea: '',
|
|
minArea: '',
|
|
maxArea: '',
|
|
maxArea: '',
|
|
- favorite: false
|
|
|
|
|
|
+ favorite: false,
|
|
|
|
+ sortBy: 'createdAt'
|
|
});
|
|
});
|
|
this.searchTerm.set('');
|
|
this.searchTerm.set('');
|
|
this.currentPage.set(1);
|
|
this.currentPage.set(1);
|
|
@@ -237,35 +415,36 @@ export class CaseLibrary implements OnInit {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
// 智能页码生成
|
|
// 智能页码生成
|
|
-pageNumbers = computed(() => {
|
|
|
|
- const pages = [];
|
|
|
|
- const total = this.totalPages();
|
|
|
|
- const current = this.currentPage();
|
|
|
|
-
|
|
|
|
- // 显示当前页及前后2页,加上第一页和最后一页
|
|
|
|
- const start = Math.max(1, current - 2);
|
|
|
|
- const end = Math.min(total, current + 2);
|
|
|
|
-
|
|
|
|
- if (start > 1) {
|
|
|
|
- pages.push(1);
|
|
|
|
- if (start > 2) {
|
|
|
|
- pages.push(-1); // 用-1表示省略号
|
|
|
|
|
|
+ pageNumbers = computed(() => {
|
|
|
|
+ const pages = [] as number[];
|
|
|
|
+ const total = this.totalPages();
|
|
|
|
+ const current = this.currentPage();
|
|
|
|
+
|
|
|
|
+ // 显示当前页及前后2页,加上第一页和最后一页
|
|
|
|
+ const start = Math.max(1, current - 2);
|
|
|
|
+ const end = Math.min(total, current + 2);
|
|
|
|
+
|
|
|
|
+ if (start > 1) {
|
|
|
|
+ pages.push(1);
|
|
|
|
+ if (start > 2) {
|
|
|
|
+ pages.push(-1); // 用-1表示省略号
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- for (let i = start; i <= end; i++) {
|
|
|
|
- pages.push(i);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (end < total) {
|
|
|
|
- if (end < total - 1) {
|
|
|
|
- pages.push(-1); // 用-1表示省略号
|
|
|
|
|
|
+
|
|
|
|
+ for (let i = start; i <= end; i++) {
|
|
|
|
+ pages.push(i);
|
|
}
|
|
}
|
|
- pages.push(total);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ if (end < total) {
|
|
|
|
+ if (end < total - 1) {
|
|
|
|
+ pages.push(-1); // 用-1表示省略号
|
|
|
|
+ }
|
|
|
|
+ pages.push(total);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return pages;
|
|
|
|
+ });
|
|
|
|
|
|
- return pages;
|
|
|
|
-});
|
|
|
|
// 格式化样式显示的辅助方法
|
|
// 格式化样式显示的辅助方法
|
|
getStyleDisplay(caseItem: CaseItem | null | undefined): string {
|
|
getStyleDisplay(caseItem: CaseItem | null | undefined): string {
|
|
if (!caseItem || !caseItem.style) {
|
|
if (!caseItem || !caseItem.style) {
|
|
@@ -274,22 +453,10 @@ pageNumbers = computed(() => {
|
|
return Array.isArray(caseItem.style) ? caseItem.style.join('、') : String(caseItem.style);
|
|
return Array.isArray(caseItem.style) ? caseItem.style.join('、') : String(caseItem.style);
|
|
}
|
|
}
|
|
|
|
|
|
- // 如果需要直接获取当前选中案例的样式显示
|
|
|
|
|
|
+ // 获取当前选中案例的样式显示
|
|
getSelectedCaseStyle(): string {
|
|
getSelectedCaseStyle(): string {
|
|
return this.getStyleDisplay(this.selectedCase());
|
|
return this.getStyleDisplay(this.selectedCase());
|
|
}
|
|
}
|
|
-
|
|
|
|
- // 删除重复的简单分页逻辑
|
|
|
|
- // 保留智能分页逻辑(第251-270行)
|
|
|
|
- // 移除下面这段代码:
|
|
|
|
- // // 在组件类中添加这个计算属性
|
|
|
|
- // pageNumbers = computed(() => {
|
|
|
|
- // const pages = [];
|
|
|
|
- // for (let i = 1; i <= this.totalPages(); i++) {
|
|
|
|
- // pages.push(i);
|
|
|
|
- // }
|
|
|
|
- // return pages;
|
|
|
|
- // });
|
|
|
|
|
|
|
|
// 修复 onStyleChange 方法中的类型安全问题
|
|
// 修复 onStyleChange 方法中的类型安全问题
|
|
onStyleChange(style: string, isChecked: boolean): void {
|
|
onStyleChange(style: string, isChecked: boolean): void {
|