소스 검색

新闻详情页

zhangdehua 1 년 전
부모
커밋
7a41fd223f
5개의 변경된 파일80개의 추가작업 그리고 11개의 파일을 삭제
  1. 13 0
      app/index/controller/Index.php
  2. 18 10
      app/index/view/error.html
  3. 1 1
      app/index/view/index/index.html
  4. 24 0
      app/index/view/index/newsDetails.html
  5. 24 0
      public/assets/index/css/newsDetail.css

+ 13 - 0
app/index/controller/Index.php

@@ -152,8 +152,21 @@ class Index extends Controller
     {
         return view('vapePoints');
     }
+
     public function returnWarranty(): View
     {
         return view('returnWarranty');
     }
+
+    public function newsDetail(): View
+    {
+        $newsId = $this->request->param('newsId');
+        if (empty($newsId)) {
+            return view('/error');
+        }
+
+        $model = new ArticleModel;
+        $article = $model->find($newsId)->toArray();
+        return view('newsDetails', ['article' => $article]);
+    }
 }

+ 18 - 10
app/index/view/error.html

@@ -1,10 +1,18 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>Title</title>
-</head>
-<body>
-    wocuole
-</body>
-</html>
+{extend name="base" /}
+{block name="title"}GoodsDetail{/block}
+{block name="styles"}
+<link rel="stylesheet" href="/assets/index/css/newsDetail.css?t=11101">
+{/block}
+{block name="mainArea"}
+<section class="sectionContainer">
+   Sorry, no relevant content found
+</section>
+{/block}
+{block name="scriptSrc"}
+<script src="/assets/index/js/jquery-1.12.0.js"></script>
+<script src="/assets/index/js/flexible.js"></script>
+<script src="/assets/index/js/public.js?t=11"></script>
+<script src="/assets/index/js/productDetails.js?t=11"></script>
+<script src="/assets/index/js/jquery.lazyload.js"></script>
+
+{/block}

+ 1 - 1
app/index/view/index/index.html

@@ -172,7 +172,7 @@
         </div>
         <div class="newConterBox">
             {foreach $article as $art}
-            <a href="">
+            <a href="/index/index/newsDetail.html?newsId={$art['article_id']}">
                 <div class="newConterItem">
                     <div class="newsDateBox">
                         <p>{$art['month_day']}</p>

+ 24 - 0
app/index/view/index/newsDetails.html

@@ -0,0 +1,24 @@
+{extend name="base" /}
+{block name="title"}GoodsDetail{/block}
+{block name="styles"}
+<link rel="stylesheet" href="/assets/index/css/newsDetail.css?t=11101">
+{/block}
+{block name="mainArea"}
+<section class="sectionContainer">
+    <div class="elementorContainer">
+        <article>
+            <h1>{$article['title']}</h1>
+            <p><em>Published on {$article['create_time']}</em></p>
+            <div id="richTextContainer">{$article['content'] | raw}</div>
+        </article>
+    </div>
+</section>
+{/block}
+{block name="scriptSrc"}
+<script src="/assets/index/js/jquery-1.12.0.js"></script>
+<script src="/assets/index/js/flexible.js"></script>
+<script src="/assets/index/js/public.js?t=11"></script>
+<script src="/assets/index/js/productDetails.js?t=11"></script>
+<script src="/assets/index/js/jquery.lazyload.js"></script>
+
+{/block}

+ 24 - 0
public/assets/index/css/newsDetail.css

@@ -0,0 +1,24 @@
+body {
+    font-family: Arial, sans-serif;
+    margin: 0;
+    padding: 0;
+}
+header {
+    background-color: #333;
+    color: #fff;
+    padding: 20px;
+    text-align: center;
+}
+.container {
+    width: 80%;
+    margin: auto;
+    padding: 20px;
+}
+h1, h3 {
+    color: #333;
+    text-align: center;
+    font-size: xx-large;
+}
+p {
+    line-height: 1.6;
+}