feat: add configuration management system
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
import { PageConfig } from '../types';
|
||||
|
||||
export const testPages: Record<string, PageConfig> = {
|
||||
home: {
|
||||
name: '首页',
|
||||
url: '/',
|
||||
selectors: {
|
||||
title: 'h1',
|
||||
hero: '.hero-section',
|
||||
features: '.features-section'
|
||||
}
|
||||
},
|
||||
about: {
|
||||
name: '关于我们',
|
||||
url: '/about',
|
||||
selectors: {
|
||||
title: 'h1',
|
||||
content: '.about-content'
|
||||
}
|
||||
},
|
||||
contact: {
|
||||
name: '联系我们',
|
||||
url: '/contact',
|
||||
selectors: {
|
||||
title: 'h1',
|
||||
form: '#contact-form',
|
||||
submitButton: 'button[type="submit"]'
|
||||
}
|
||||
},
|
||||
products: {
|
||||
name: '产品',
|
||||
url: '/products',
|
||||
selectors: {
|
||||
title: 'h1',
|
||||
productGrid: '.products-grid',
|
||||
productCard: '.product-card'
|
||||
}
|
||||
},
|
||||
services: {
|
||||
name: '服务',
|
||||
url: '/services',
|
||||
selectors: {
|
||||
title: 'h1',
|
||||
servicesList: '.services-list',
|
||||
serviceItem: '.service-item'
|
||||
}
|
||||
},
|
||||
cases: {
|
||||
name: '案例',
|
||||
url: '/cases',
|
||||
selectors: {
|
||||
title: 'h1',
|
||||
casesGrid: '.cases-grid',
|
||||
caseCard: '.case-card'
|
||||
}
|
||||
},
|
||||
news: {
|
||||
name: '新闻',
|
||||
url: '/news',
|
||||
selectors: {
|
||||
title: 'h1',
|
||||
newsList: '.news-list',
|
||||
newsItem: '.news-item'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export function getPageConfig(pageKey: string): PageConfig {
|
||||
return testPages[pageKey] || testPages.home;
|
||||
}
|
||||
|
||||
export function getAllPageConfigs(): PageConfig[] {
|
||||
return Object.values(testPages);
|
||||
}
|
||||
Reference in New Issue
Block a user