亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

結(jié)合本章學(xué)習(xí)內(nèi)容,完成前臺模塊

Original 2019-08-12 16:48:07 370
abstract:controller/Index.php<?php namespace app\index\controller; use app\index\model\SlideModel; use app\index\model\ProductModel; use app\index\model\NewsModel; use app\index\mod

1.png

controller/Index.php

<?php
namespace app\index\controller;
use app\index\model\SlideModel;
use app\index\model\ProductModel;
use app\index\model\NewsModel;
use app\index\model\SystemModel;
use think\facade\Request;
use think\Controller;

class Index extends Controller
{
    public function index()
    {
        //輪播圖部分渲染賦值
        $slide = new SlideModel();
        $slides = $slide->select()->toArray();
        $this->view->slides = $slides;
        //頭牌人選
        $product = new ProductModel();
        $products = $product->where('sort','1')->select()->toArray();
        $this->view->products = $products;
        //新上花魁
        $NewProduct = $product->where('sort','2')->limit(1)->select()->toArray();
        $this->view->NewProduct = $NewProduct;
        //查詢最新資訊
        $new = new NewsModel();
        $news = $new->limit(2)->select()->toArray();
        $this->view->news = $news;

        //渲染首頁模板
        return $this->fetch();
    }
    public function about()
    {
        $system = new SystemModel();
        $systems = $system->select()->toArray();
        $this->view->systems = $systems;
        return $this->fetch();
    }
    public function product()
    {
        $product = new ProductModel();
        $products = $product->order('id','desc')->paginate(4);
        $this->view->products = $products;
        return $this->fetch();
    }
    public function news()
    {
        //實例化模型
        $new = new NewsModel();
        //查詢數(shù)據(jù)按照id的順序進行查詢并且每頁4條數(shù)據(jù)
        $news = $new->order('id','desc')->paginate(4);
        //給摸板賦值
        $this->view->news = $news;
        //熱門新聞
        $hotNew = $new->limit(1)->select()->toArray();
        $this->view->hotNews = $hotNew;
        //最新發(fā)布
        $newNews = $new->limit(6)->select()->toArray();
        $this->view->newNews = $newNews;
        return $this->fetch();
    }
    public function ConNew()
    {
        $newId = Request::param('id');
        $new = NewsModel::get($newId);
        $this->view->new = $new;
        //熱門新聞
        $hotNew = $new->limit(1)->select()->toArray();
        $this->view->hotNews = $hotNew;
        //最新發(fā)布
        $newNews = $new->limit(6)->select()->toArray();
        $this->view->newNews = $newNews;
        //渲染首頁模板
        return $this->fetch();
    }
    public function ConPro()
    {
        //獲取產(chǎn)品id
        $ProId = Request::param('id');
        $product = ProductModel::get($ProId);
        $this->view->product = $product;
        //渲染首頁模板
        return $this->fetch();
    }
}

public/style.html

<link rel="shortcut icon" type="image/x-icon" href="/static/index/images/favicon.ico"/>
<link rel="stylesheet" href="/static/index/css/style.css" type="text/css">
<link rel="stylesheet" href="/static/index/css/zzsc.css" type="text/css">
<link rel="stylesheet" href="/static/index/css/lbt.css" type="text/css">
<link rel="stylesheet" type="text/css" href="/static/index/css/mobile.css">
<script src="/static/index/js/mobile.js" type="text/javascript"></script>
<script src="/static/index/js/jquery.min.js" type="text/javascript"></script>
<script src="/static/index/js/YuxiSlider.jQuery.min.js" type="text/javascript"></script>

public/head.html

<div id="header">
    <div>
        <a href="{:url(\'Index/index\')}" class="logo"><img src="/static/index/images/logo.png" alt=""></a>
        <ul id="navigation">
            <li>
                <a href="{:url(\'Index/index\')}">首頁</a>
            </li>
            <li>
                <a href="{:url(\'Index/about\')}">關(guān)于我們</a>
            </li>
            <li class="menu">
                <a href="{:url(\'Index/product\')}">產(chǎn)品展示</a>
            </li>
            <li class="menu">
                <a href="{:url(\'Index/news\')}">新聞中心</a>
            </li>
        </ul>
    </div>
</div>

public/floor.html

<div id="footer">
    <div class="footnote">
        <div>
            <p style="color: #EEE">Copyright &copy; 2019.Company name nnnr <a
                    href="#" target="_blank" style="color: #EEE;" title="xxx">nnnr</a> - Collect from
                <a href="#" style="color: #EEE" title="nnnr" target="_blank">nnnr</a></p>
        </div>
    </div>
</div>

view/about.html

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>xxx — 關(guān)于我們</title>
    {include file="public/style"}

</head>
<body>
<div id="page">
   {include file="public/head"}
    <div id="body" class="about">
        {volist name="systems" id="system"}
        <div class="header">
            <div>
                <h1 style="font-family: YouYuan;font-weight: bold;color: #FFFFFF;">關(guān)于我們</h1>
                <h2>{$system.about_title}</h2>
                <p>{$system.about_content}</p>
            </div>
        </div>
        <div class="body">
            <div>
                <img src="/static/index/images/earth-satellite.jpg"  alt="">
                <h2 style="color: #d5a8ab;  font-family: YouYuan; font-weight: bold;">{$system.ci_title}</h2>
                <p style="color: #0C0C0C">{$system.ci_content}</p>
            </div>
        </div>
        <div class="footer">
            <div>
                <img src="/static/index/images/space-shuttle.png" alt="" style="padding-bottom: 35px;">
                <h2 style="color: #6b6565;">{$system.cp_title}</h2>
                <p style="color: #0C0C0C">{$system.cp_content}</p>
            </div>
        </div>
        {/volist}
        <div class="section">
            <div>
                <h2 style="color: #000000;  font-family: YouYuan; font-weight: bold;">百年老店</h2>
                <p style="color: #0C0C0C">本著一心為客官服務(wù)的心做事、我們這里擁有十分美貌的姑娘和周到完美的服務(wù)!</p>
            </div>
        </div>
    </div>
    {include file="public/floor"}
</div>
</body>
</html>

view/news.html

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>xxx — 新聞中心</title>
    {include file="public/style"}
</head>
<body>
<div id="page">
    {include file="public/head"}
    <div id="body">
        <div class="header">
            <div>
                <h1 style="color: #6E6E6E; font-family: YouYuan; font-weight: bold">新聞中心</h1>
                <div class="article">
                    <ul>
                        {volist name="news" id="new"}
                        <li>
                            <a href="{:url('ConNew')}?id={$new.id}"><img src="{:GetNewsPic($new.id)}" style="border-radius:10px; box-shadow: 0 0 0px #6E6E6E;   width: 100%;height: 100%;" alt=""></a>
                            <h1>{$new.title}</h1>
                            <span style="color: #0C0C0C">{$new.time|date="Y-m-d"}</span>
                            <p style="color: #0C0C0C">{$new.desc}</p>
                            <a href="{:url('ConNew')}?id={$new.id}" class="more">閱讀更多</a>
                        </li>
                        {/volist}
                    </ul>
                </div>
                <div class="sidebar">
                    <ul>
                        {volist name="hotNews" id="hotNew"}
                        <li>
                            <h1>熱門新聞</h1>
                            <a href="{:url('ConNew')}?id={$hotNew.id}"><img src="{:GetNewsPic($hotNew.id)}" style="border-radius:10px; box-shadow: 0 0 5px #6E6E6E;   width: 340px;height: 188px;" alt=""></a>
                            <h2>{$hotNew.title}</h2>
                            <span>{$hotNew.desc}</span>
                        </li>
                        {/volist}
                        <li>
                            <h1>最新發(fā)布</h1>
                            {volist name="newNews" id="newNew"}
                            <ul>
                                <li>
                                    <a href="{:url('ConNew')}?id={$newNew.id}"><img src="{:GetNewsPic($newNew.id)}" style="border-radius:10px; box-shadow: 0 0 2px #6E6E6E;   width: 60px;height: 55px;" alt=""></a>
                                    <h2 style="font-size: 15px;">{$newNew.title}</h2>
                                    <span>{$newNew.time|date="Y-m-d"}</span>
                                </li>
                            </ul>
                            {/volist}
                        </li>
                    </ul>
                </div>
            </div>

        </div>
        <div class="page">
            <div>
                {$news|raw}
            </div>
        </div>
    </div>
    {include file="public/floor"}
</div>
</body>
</html>

view/index.html

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>xxx — 首頁</title>
    {include file="public/style"}
    {include file="public/head"}
</head>
<body>
<div id="page">
    <div id="body" class="home">
        <div class="demo">
            <a class="control prev"></a><a class="control next abs"></a>
            <div class="slider">
                <ul>
                    {volist name="slides" id="slide"}
                    <li><a href=""><img src="{$slide.pic}" alt="{$slide.desc}"/></a></li>
                    {/volist}
                </ul>
            </div>
        </div>
        <div class="header">
            <div>
                <h3 style="margin-top: 50px">頭牌人選</h3>
                <ul>
                    {volist name="products" id="product"}
                    <li>
                        <a href=" "><img src="{:GetProductPic($product.id)}" style=" width: 100%;height: 100%;" alt="{$product.desc}"></a>
                    </li>
                    {/volist}
                </ul>
            </div>
        </div>
        <div class="body">
            <div>
                <h1>xxx</h1>
                <p>為看官提供更養(yǎng)眼、更多樣、更直觀的感覺體驗!</p>
            </div>
        </div>
        <div class="footer">
            <div>
                <ul>
                    <li>
                        <h1>新上花魁</h1>
                        {volist name="NewProduct" id="NewProduct"}
                        <a href=" "><img src="{:GetProductPic($NewProduct.id)}"
                                         style="border-radius:10px; box-shadow: 0 0 10px #eaeaea;   border:5px solid #E9E7E7;width: 460px;height: 260px;"
                                         alt=""></a>
                        {/volist}
                    </li>
                    <li>
                        <h1>最新資訊</h1>
                        <ul>
                            {volist name="news" id="new"}
                            <li>
                                <a href=""><img src="{:GetNewsPic($new.id)}"
                                                style="border-radius:10px; box-shadow: 0 0 10px #6E6E6E;   width: 100px;height: 95px;"
                                                alt=""></a>
                                <h1>{$new.title}</h1>
                                <span>{$new.time|date="Y-m-d"}</span>
                                <a href="blog.php" class="more">了解更多</a>
                            </li>
                            {/volist}
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    {include file="public/floor"}
</div>

<script>
    $(".slider").YuxiSlider({
        width: 1900, //容器寬度
        height: 450, //容器高度
        control: $('.control'), //綁定控制按鈕
        during: 4000, //間隔4秒自動滑動
        speed: 800, //移動速度0.8秒
        mousewheel: true, //是否開啟鼠標滾輪控制
        direkey: true //是否開啟左右箭頭方向控制
    });
</script>
</body>
</html>

view/con_new

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>xxx — 新聞詳細</title>
    {include file="public/style"}
</head>
<body>
<div id="page">
    {include file="public/head"}
    <div id="body">
        <div class="header">
            <div>
                <h1 style="color: #6E6E6E; font-family: YouYuan; font-weight: bold">新聞詳細</h1>
                <div class="article">
                    <img src="{:GetNewsPic($new.id)}" style="border-radius:10px; box-shadow: 0 0 5px #6E6E6E;   width: 560px;height: 240px;" alt="">
                    <div style="border-radius:10px; box-shadow: 0 0 5px #6E6E6E; background: #BDBDBD; padding: 20px;">
                        <h1 style=" text-align:center; color: #000;">{$new.title}</h1>
                        <span style="color: #0C0C0C">{$new.time|date="Y-m-d"}</span>
                        <p>{:htmlspecialchars_decode($new.content)}</p></div>
                </div>
                <div class="sidebar">
                    <ul>
                        {volist name="hotNews" id="hotNew"}
                        <li>
                            <h1>熱門新聞</h1>
                            <a href="{:url('ConNew')}?id={$hotNew.id}"><img src="{:GetNewsPic($hotNew.id)}" style="border-radius:10px; box-shadow: 0 0 5px #6E6E6E;   width: 340px;height: 188px;" alt=""></a>
                            <h2>{$hotNew.title}</h2>
                            <span>{$hotNew.desc}</span>
                        </li>
                        {/volist}
                        <li>
                            <h1>最新發(fā)布</h1>
                            <ul>
                                {volist name="newNews" id="newNew"}
                                <li>
                                    <a href="{:url('ConNew')}?id={$newNew.id}"><img src="{:GetNewsPic($newNew.id)}" style="border-radius:10px; box-shadow: 0 0 2px #6E6E6E;   width: 60px;height: 55px;" alt=""></a>
                                    <h2 style="font-size: 15px;">{$newNew.title}</h2>
                                    <span>{$newNew.time|date="Y-m				

Correcting teacher:天蓬老師Correction time:2019-08-15 10:54:00
Teacher's summary:以后這樣的渲染, 推薦寫出明確的模板名稱:return $this->fetch();

Release Notes

Popular Entries