This commit is contained in:
toom1996
2025-07-04 09:49:52 +08:00
parent bcf7b3a25a
commit d723be397f
7 changed files with 76 additions and 19 deletions

View File

@ -3,7 +3,9 @@ import Layout from '../layouts/Layout.astro';
import { APP_NAME } from '../config/app'; import { APP_NAME } from '../config/app';
import { newsIndex } from '../../utils/rpc'; import { newsIndex } from '../../utils/rpc';
import Breadcrumb from '../components/Breadcrumb.astro'; import Breadcrumb from '../components/Breadcrumb.astro';
import { getConfig } from '../../utils/config';
const config = getConfig(Astro)
const {code, data} = await newsIndex(); const {code, data} = await newsIndex();

View File

@ -4,13 +4,12 @@ import Layout from "../../../layouts/Layout_2.astro";
import ImageXiazai from '../../../../public/template_2/xiazai.svg'; import ImageXiazai from '../../../../public/template_2/xiazai.svg';
import { Image } from 'astro:assets'; import { Image } from 'astro:assets';
import { getConfig, getExtra } from "../../../../utils/config"; import { getConfig, getExtra } from "../../../../utils/config";
import { TP2_COLUMN_ABOUT_US, TP2_COLUMN_INDEX, TP2_COLUMN_INDEX_URL } from "../../../../utils/const";
const config = getConfig(Astro) const config = getConfig(Astro)
const extra = getExtra('') const extra = getExtra(config.app_extra_tag)
// swiper 数据
const swiper = extra.index.sc3.swiper;
const breadcrumb = [{ const breadcrumb = [{
title: '主页', title: TP2_COLUMN_INDEX,
url: '/' url: TP2_COLUMN_INDEX_URL
}] }]
--- ---

View File

@ -4,7 +4,7 @@ import { newsIndex } from '../../../../utils/rpc';
import { getConfig } from '../../../../utils/config'; import { getConfig } from '../../../../utils/config';
import { TP2_COLUMN_NEWS, TP2_COLUMN_NEWS_URL } from '../../../../utils/const'; import { TP2_COLUMN_NEWS, TP2_COLUMN_NEWS_URL } from '../../../../utils/const';
const config = getConfig(Astro) const config = getConfig(Astro)
const {code, data} = await newsIndex(); const {code, data} = await newsIndex(config.id);
const breadcrumb = [ const breadcrumb = [
{ {
title: '主页', title: '主页',
@ -21,7 +21,7 @@ const breadcrumb = [
<div class="v4 h05-hero-text-only no-margin centered" data-component="h05-hero-text-only" data-video-width="0" data-video-height="0"> <div class="v4 h05-hero-text-only no-margin centered" data-component="h05-hero-text-only" data-video-width="0" data-video-height="0">
<div class="container"> <div class="container">
<div class="wrap"> <div class="wrap">
<h1 class="columns-name">新闻</h1> <h1 class="columns-name">新闻专栏</h1>
</div> </div>
</div> </div>
</div> </div>
@ -51,6 +51,7 @@ const breadcrumb = [
</main> </main>
</Layout> </Layout>
<style> <style>
.page-news { .page-news {
background-color: #fff !important; background-color: #fff !important;
padding-top: 5rem; padding-top: 5rem;
@ -63,6 +64,14 @@ const breadcrumb = [
padding: 3rem; padding: 3rem;
} }
@media only screen and (max-width: 767.98px) {
.columns-name {
font-size: 2rem;
padding: 1rem;
}
}
.result-product__media { .result-product__media {
-webkit-box-flex: 0; -webkit-box-flex: 0;
-webkit-flex: 0 0 260px; -webkit-flex: 0 0 260px;

View File

@ -1,5 +1,5 @@
import type { IWebsiteConfig } from "./rpc"; import type { IWebsiteConfig } from "./rpc";
import {EXTRA_HONGTIXIANYUE} from './extra.ts' import {EXTRA_DEFAULT, EXTRA_HONGTIXIANYUE} from './extra.ts'
export function getConfig(Astro: any):IWebsiteConfig export function getConfig(Astro: any):IWebsiteConfig
{ {
@ -7,7 +7,11 @@ export function getConfig(Astro: any):IWebsiteConfig
} }
// 取默认的配置 // 取默认的配置
export function getExtra(host: string) export function getExtra(extraTag: string = '')
{ {
if (extraTag == 'HONGTIXIANYUE') {
return EXTRA_HONGTIXIANYUE; return EXTRA_HONGTIXIANYUE;
} }
return EXTRA_DEFAULT;
}

View File

@ -1,5 +1,9 @@
// ----- 栏目 ----- // ----- 栏目 -----
export const TP2_COLUMN_INDEX = '首页'
export const TP2_COLUMN_INDEX_URL = '/'
export const TP2_COLUMN_NEWS = '新闻专栏' export const TP2_COLUMN_NEWS = '新闻专栏'
export const TP2_COLUMN_NEWS_URL = '/news' export const TP2_COLUMN_NEWS_URL = '/news'

File diff suppressed because one or more lines are too long

View File

@ -31,9 +31,12 @@ export interface InewsIndex {
created_at: string created_at: string
updated_at: string updated_at: string
} }
export async function newsIndex():Promise<result<InewsIndex[]>>{ export async function newsIndex(websiteId:number = 0):Promise<result<InewsIndex[]>>{
console.log(websiteId)
const client = getRpcClient() const client = getRpcClient()
const result = await client.call('news/index', {}) const result = await client.call('news/index', {
id:websiteId
})
return result return result
} }
@ -72,6 +75,8 @@ export async function newsDetail(id:string):Promise<result<InewsDetail>>{
// 网站配置 // 网站配置
export interface IWebsiteConfig { export interface IWebsiteConfig {
id: string
app_extra_tag: string
app_name: string app_name: string
app_description: string app_description: string
app_keywords: string app_keywords: string