diff --git a/src/middleware/index.ts b/src/middleware/index.ts index eb3a4ee..ba67711 100644 --- a/src/middleware/index.ts +++ b/src/middleware/index.ts @@ -3,7 +3,8 @@ import { websiteConfig } from "../../utils/rpc"; export async function onRequest (context: any, next: any) { - // 拦截一个请求里的数据 + console.log('middleware') + // 拦截一个请求里的数据 // 可选地修改 `locals` 中的属性 const host = await getHost(context.request); @@ -12,7 +13,6 @@ export async function onRequest (context: any, next: any) { return next(); } - // 防止无线跳转 if (context.locals.is_write) { return next(); diff --git a/src/pages/template/1/news.astro b/src/pages/template/1/news.astro index c0b32d8..8da0cef 100644 --- a/src/pages/template/1/news.astro +++ b/src/pages/template/1/news.astro @@ -1 +1,106 @@ -template_news \ No newline at end of file +--- +import Layout from '../../../layouts/Layout_1.astro'; +import { APP_NAME } from '../../../config/app'; +import { newsIndex } from '../../../../utils/rpc'; +import Breadcrumb from '../../../components/Breadcrumb.astro'; + +const {code, data} = await newsIndex(); + + +const title = `${APP_NAME} - 新闻专栏`; +const description = '知识回声最新新闻动态、行业资讯、合作信息。'; +const keywords = '知识回声,知识回声新闻,知识回声动态,知识回声合作'; +--- + + +
+
+
+ + +
+
+
+ + +
diff --git a/src/pages/template/1/news/[...slug].astro b/src/pages/template/1/news/[...slug].astro new file mode 100644 index 0000000..9765887 --- /dev/null +++ b/src/pages/template/1/news/[...slug].astro @@ -0,0 +1,294 @@ +--- +import Layout from '../../../../layouts/Layout_1.astro'; +import { newsDetail } from '../../../../../utils/rpc'; +import { APP_NAME } from '../../../../config/app'; + +const { slug } = Astro.params; + +if (!slug) { + return Astro.redirect('/404'); +} + +const {code, data} = await newsDetail(slug); + +if (!data || code !== 0) { + return Astro.redirect('/404'); +} + +console.log(data) +--- + +
+
+ + + +
+
+ + + +