feat: 更新版权接口与彩票列表展示
This commit is contained in:
+19
-6
@@ -725,7 +725,6 @@ const CommonUtil = {
|
||||
sort: item.sort === undefined || item.sort === null ? index : Number(item.sort),
|
||||
}));
|
||||
|
||||
const copyrightItems = [];
|
||||
const footerContactItems = [];
|
||||
configs.forEach((item) => {
|
||||
const isFooterContact = this.isFooterContactConfig(item);
|
||||
@@ -740,15 +739,24 @@ const CommonUtil = {
|
||||
this.setMeta('description', item.content || '');
|
||||
} else if (item.type === 'web_icon') {
|
||||
this.setIcon(item.content || '');
|
||||
} else if (item.type === 'web_copyright' && !isFooterContact) {
|
||||
copyrightItems.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
this.applyFooterCopyright(copyrightItems);
|
||||
this.renderFooterContact(footerContactItems);
|
||||
},
|
||||
|
||||
applyCopyrightConfigs(configs) {
|
||||
const copyrightItems = this.asArray(configs)
|
||||
.filter((item) => item && (item.content || item.value) && item.isEnabled !== '0' && item.isEnabled !== 0 && item.isEnabled !== false)
|
||||
.map((item, index) => ({
|
||||
...item,
|
||||
content: item.content || item.value || '',
|
||||
sort: item.sort === undefined || item.sort === null ? index : Number(item.sort),
|
||||
}));
|
||||
|
||||
this.applyFooterCopyright(copyrightItems);
|
||||
},
|
||||
|
||||
ensureGlobalFooterLayout() {
|
||||
if (typeof document === 'undefined') return;
|
||||
const $ = this.$;
|
||||
@@ -1098,6 +1106,7 @@ const CommonUtil = {
|
||||
else if (data.siteConfig) this.applyWebConfigs(data.siteConfig);
|
||||
else if (data.config) this.applyWebConfigs(data.config);
|
||||
else if (result.data) this.applyWebConfigs(result.data);
|
||||
this.applyCopyrightConfigs(data.copyrightConfigs);
|
||||
|
||||
if (!loadHomeData && options.ads !== false && data.adList) {
|
||||
this.processAndRenderAds(data.adList, options.adPositions);
|
||||
@@ -2161,9 +2170,10 @@ const CommonUtil = {
|
||||
},
|
||||
|
||||
async loadBasePageData(options = {}) {
|
||||
const [configList, config, siteConfig, ads] = await Promise.all([
|
||||
const [configList, config, copyright, siteConfig, ads] = await Promise.all([
|
||||
ApiClient.get('/api/web/config/list').catch(() => ({ data: [] })),
|
||||
ApiClient.get('/api/web/config').catch(() => ({ data: {} })),
|
||||
ApiClient.get(ApiClient.API.configCopyright).catch(() => ({ data: [] })),
|
||||
ApiClient.get('/api/web/config/site').catch(() => ({ data: {} })),
|
||||
options.ads === false
|
||||
? Promise.resolve({ data: [] })
|
||||
@@ -2181,6 +2191,7 @@ const CommonUtil = {
|
||||
: ApiClient.configObjectToList
|
||||
? ApiClient.configObjectToList(config.data || {})
|
||||
: config.data || {},
|
||||
copyrightConfigs: this.asArray(this.pickData(copyright, [])),
|
||||
adList: this.asArray(this.pickData(ads, [])),
|
||||
},
|
||||
};
|
||||
@@ -2191,10 +2202,11 @@ const CommonUtil = {
|
||||
return ApiClient.loadHomeIndexCompat();
|
||||
}
|
||||
|
||||
const [configList, config, siteConfig, menus, banners, notices, ads, freeArticles, latest] =
|
||||
const [configList, config, copyright, siteConfig, menus, banners, notices, ads, freeArticles, latest] =
|
||||
await Promise.all([
|
||||
ApiClient.get('/api/web/config/list').catch(() => ({ data: [] })),
|
||||
ApiClient.get('/api/web/config').catch(() => ({ data: {} })),
|
||||
ApiClient.get(ApiClient.API.configCopyright).catch(() => ({ data: [] })),
|
||||
ApiClient.get('/api/web/config/site').catch(() => ({ data: {} })),
|
||||
ApiClient.get('/api/web/menu/home-nav').catch(() => ({ data: [] })),
|
||||
ApiClient.get('/api/web/banner/list').catch(() => ({ data: [] })),
|
||||
@@ -2266,6 +2278,7 @@ const CommonUtil = {
|
||||
: ApiClient.configObjectToList
|
||||
? ApiClient.configObjectToList(config.data || {})
|
||||
: config.data || {},
|
||||
copyrightConfigs: this.asArray(this.pickData(copyright, [])),
|
||||
siteConfig: siteConfig.data || {},
|
||||
bannerList: this.asArray(this.pickData(banners, [])),
|
||||
noticeList: this.asArray(this.pickData(notices, [])),
|
||||
|
||||
Reference in New Issue
Block a user