feat: mobile文章首页
This commit is contained in:
@@ -32,7 +32,8 @@ class Article extends Common
|
||||
// 获取banner焦点图
|
||||
$banner = SysBannerItemModel::hasWhere('banner', [
|
||||
'language_id' => $this->lang_id,
|
||||
'unique_label' => 'BANNER_67f9fc71e27db'
|
||||
'unique_label' => 'BANNER_67f9fc71e27db',
|
||||
'at_platform' => request()->from
|
||||
])
|
||||
->type('image')
|
||||
->visible(['id', 'title', 'image', 'link'])
|
||||
@@ -58,7 +59,8 @@ class Article extends Common
|
||||
'id',
|
||||
'title',
|
||||
'desc',
|
||||
'image'
|
||||
'image',
|
||||
'release_time'
|
||||
])
|
||||
->withSearch(['title'], ['title' => $param['keywords']??null])
|
||||
->category($param['cid']??$categorys[0]['id'])
|
||||
@@ -67,8 +69,12 @@ class Article extends Common
|
||||
->paginate([
|
||||
'list_rows' => $param['size'],
|
||||
'page' => $param['page'],
|
||||
'query' => request()->param([
|
||||
'cid',
|
||||
'keywords',
|
||||
]) // 保留查询参数,防止分页丢失
|
||||
]);
|
||||
}
|
||||
}
|
||||
View::assign('articles', $articles??[]);
|
||||
|
||||
return View::fetch('index');
|
||||
|
||||
62
app/index/view/mobile/article/index.html
Normal file
62
app/index/view/mobile/article/index.html
Normal file
@@ -0,0 +1,62 @@
|
||||
{extend name="public/base" /}
|
||||
{block name="style"}
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/article_index.css" />
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<div class="oricoEGapp">
|
||||
<!-- 内容 -->
|
||||
<div class="oricoEGapp-article">
|
||||
<!-- banner -->
|
||||
{notempty name="banner.image"}
|
||||
<div class="banner img-responsive">
|
||||
<img src="{$banner.image}">
|
||||
</div>
|
||||
{/notempty}
|
||||
<!-- 新闻列表 -->
|
||||
<div class="swt-Container">
|
||||
<div class="news-vertu">
|
||||
<div class="tab">
|
||||
{volist name="categorys" id="ca"}
|
||||
{if condition="$Request.get.cid == $ca.id || (!$Request.has.cid && $key == 0)"}
|
||||
<a class="on" href="{:url('article/index', ['pid' => $ca.pid, 'cid' => $ca.id])}">
|
||||
{else/}
|
||||
<a class="" href="{:url('article/index', ['pid' => $ca.pid, 'cid' => $ca.id])}">
|
||||
{/if}
|
||||
{$ca.name}
|
||||
</a>
|
||||
{/volist}
|
||||
</div>
|
||||
<div class="m_Container">
|
||||
<!-- Blog列表 s -->
|
||||
<div class="search_box">
|
||||
<form action="{:url('article/index', ['pid' => $Request.param.pid])}" method="get" autocomplete="off">
|
||||
<input type="text" class="search" id="article-blog-in" name="keywords" value="">
|
||||
<input type="hidden" class="search" id="article-blog-in" name="cid" value="{$Request.get.cid}">
|
||||
<button id="blog-btnput" class="search-button-blog" style="padding:5px 12px;">{:lang_i18n('搜索')}</button>
|
||||
</form>
|
||||
</div>
|
||||
{notempty name="articles"}
|
||||
<div class="blog_list">
|
||||
<ul class="clearfix">
|
||||
{volist name="articles" id="ar"}
|
||||
<li>
|
||||
<a href="{:url('article/detail', ['id' => $ar.id])}">
|
||||
<img src="{$ar.image}">
|
||||
<h3>{$ar.title}</h3>
|
||||
<p>{$ar.desc|raw}</p>
|
||||
</a>
|
||||
<span class="blue">{$ar.release_time|default=''|date='Y-m-d'}</span>
|
||||
</li>
|
||||
{/volist}
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 分页 s -->
|
||||
<div>{$articles|raw}</div>
|
||||
<!-- 分页 e -->
|
||||
{/notempty}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
7
public/static/index/mobile/css/article_index.css
Normal file
7
public/static/index/mobile/css/article_index.css
Normal file
@@ -0,0 +1,7 @@
|
||||
.oricoEGapp-article {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.oricoEGapp-article .img-responsive img {
|
||||
margin-top: 3.3rem;
|
||||
}
|
||||
Reference in New Issue
Block a user