优化前端html
This commit is contained in:
parent
8c70a21d43
commit
0aec4ca54c
@ -69,7 +69,7 @@ class Article extends BaseController
|
||||
//通用右栏
|
||||
$ad_comm = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',2)->whereTime('slid_over','>=',time())->select();
|
||||
|
||||
View::assign(['type'=>$type,'artList'=>$artList,'artHot'=>$artHot,'ad_cate'=>$ad_cate,'ad_comm'=>$ad_comm]);
|
||||
View::assign(['type'=>$type,'artList'=>$artList,'artHot'=>$artHot,'ad_cate'=>$ad_cate,'ad_comm'=>$ad_comm,'jspage'=>'jie']);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ class Article extends BaseController
|
||||
//通用右栏
|
||||
$ad_comm = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',2)->whereTime('slid_over','>=',time())->select();
|
||||
|
||||
View::assign(['article'=>$artDetail,'pv'=>$pv,'comments'=>$comments,'artHot'=>$artHot,'ad_art'=>$ad_article,'ad_comm'=>$ad_comm,$download]);
|
||||
View::assign(['article'=>$artDetail,'pv'=>$pv,'comments'=>$comments,'artHot'=>$artHot,'ad_art'=>$ad_article,'ad_comm'=>$ad_comm,$download,'jspage'=>'jie']);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
@ -178,6 +178,7 @@ class Article extends BaseController
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
View::assign(['jspage'=>'jie']);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
@ -223,7 +224,7 @@ class Article extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
View::assign(['article'=>$article,'tags'=>$tags]);
|
||||
View::assign(['article'=>$article,'tags'=>$tags,'jspage'=>'jie']);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
|
70
app/index/controller/Doc.php
Normal file
70
app/index/controller/Doc.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
use think\facade\Db;
|
||||
use think\facade\Cache;
|
||||
use app\common\model\Article;
|
||||
use app\common\model\User;
|
||||
use app\common\model\Cate;
|
||||
use app\common\model\Comment;
|
||||
|
||||
|
||||
class Doc extends BaseController
|
||||
{
|
||||
|
||||
public function timeline()
|
||||
{
|
||||
$types = input('type');
|
||||
//幻灯
|
||||
$sliders = Cache::get('slider');
|
||||
if(!$sliders){
|
||||
$sliders = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',1)->whereTime('slid_over','>=',time())->select();
|
||||
Cache::set('slider',$sliders,3600);
|
||||
}
|
||||
|
||||
//更新日志
|
||||
$timeline = Db::name('time_line')->where('delete_time',0)->order('create_time','desc')->select();
|
||||
|
||||
//热议文章
|
||||
$artHot = Article::field('id,title')->withCount('comments')->where(['status'=>1,'delete_time'=>0])->whereTime('create_time', 'year')->order('comments_count','desc')->limit(10)->select();
|
||||
|
||||
//首页赞助
|
||||
$ad_index = Cache::get('adindex');
|
||||
if(!$ad_index){
|
||||
$ad_index = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>3])->whereTime('slid_over','>=',time())->select();
|
||||
Cache::set('adindex',$ad_index,3600);
|
||||
}
|
||||
|
||||
//首页右栏
|
||||
$ad_comm = Cache::get('adcomm');
|
||||
if(!$ad_comm){
|
||||
$ad_comm = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>2])->whereTime('slid_over','>=',time())->select();
|
||||
Cache::set('adcomm',$ad_comm,3600);
|
||||
}
|
||||
|
||||
//友情链接
|
||||
$friend_links = Cache::get('flinks');
|
||||
if(!$friend_links){
|
||||
$friend_links = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>6])->whereTime('slid_over','>=',time())->field('slid_name,slid_href')->select();
|
||||
Cache::set('flinks',$friend_links,3600);
|
||||
}
|
||||
|
||||
$vs = [
|
||||
'slider' => $sliders,
|
||||
'timeline' => $timeline,
|
||||
'artHot' => $artHot,
|
||||
'type' => $types,
|
||||
'ad_index' => $ad_index,
|
||||
'ad_comm' => $ad_comm,
|
||||
'flinks' => $friend_links,
|
||||
'jspage' => '',
|
||||
];
|
||||
View::assign($vs);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
}
|
@ -64,6 +64,7 @@ class Index extends BaseController
|
||||
'ad_index' => $ad_index,
|
||||
'ad_comm' => $ad_comm,
|
||||
'flinks' => $friend_links,
|
||||
'jspage' => '',
|
||||
];
|
||||
View::assign($vs);
|
||||
|
||||
@ -98,7 +99,7 @@ class Index extends BaseController
|
||||
$artHot = Article::getArtHot(10);
|
||||
|
||||
View::assign($searchs);
|
||||
View::assign(['flinks'=>$friend_links,'artHot'=>$artHot]);
|
||||
View::assign(['flinks'=>$friend_links,'artHot'=>$artHot,'jspage'=>'']);
|
||||
return View::fetch('search');
|
||||
}
|
||||
|
||||
|
@ -13,14 +13,20 @@ use think\facade\Cache;
|
||||
use think\facade\View;
|
||||
use app\common\model\User;
|
||||
|
||||
|
||||
class Login extends BaseController
|
||||
{
|
||||
//已登陆检测
|
||||
//已登陆中间件检测
|
||||
protected $middleware = [
|
||||
'logedcheck' => ['except' => ['index'] ]
|
||||
];
|
||||
|
||||
//给模板中JScace文件赋值
|
||||
protected function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
View::assign(['jspage'=>'user']);
|
||||
}
|
||||
|
||||
//用户登陆
|
||||
public function index()
|
||||
{
|
||||
@ -75,6 +81,7 @@ class Login extends BaseController
|
||||
return Msgres::error($res);
|
||||
}
|
||||
}
|
||||
|
||||
return View::fetch('login');
|
||||
}
|
||||
|
||||
@ -103,7 +110,6 @@ class Login extends BaseController
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
//加载注册模板
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}发表帖子{/block}
|
||||
{block name="column"}{/block}
|
||||
{block name="content"}
|
||||
@ -141,20 +142,7 @@
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
layui.cache.page = 'jie';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use(['fly','form','colorpicker','upload'], function(){
|
||||
layui.use(['fly','form','colorpicker','upload'], function(){
|
||||
var $ = layui.$
|
||||
,fly = layui.fly
|
||||
,form = layui.form
|
||||
@ -271,4 +259,3 @@
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
{block name="cachepage"}jie{/block}
|
@ -97,20 +97,7 @@
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script>
|
||||
layui.cache.page = 'jie';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use(['fly','laypage'], function(){
|
||||
layui.use(['laypage'], function(){
|
||||
var laypage = layui.laypage;
|
||||
|
||||
//执行一个laypage实例
|
||||
|
@ -1,4 +1,5 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
||||
{block name="keywords"}{$article.title},{$article.tags}{/block}
|
||||
{block name="description"}{$article.title},{:getArtContent($article.content)}{/block}
|
||||
@ -216,31 +217,18 @@
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script>
|
||||
var collectionFind = "{:url('index/Collection/find')}",
|
||||
articleJieset = "{:url('index/Article/jieset')}",
|
||||
articleDelete = "{:url('index/Article/delete')}",
|
||||
collection = "{:url('index/Collection/')}",
|
||||
commentJiedaZan = "{:url('index/Comment/jiedaZan')}",
|
||||
commentJiedaCai = "{:url('index/Comment/jiedaCai')}",
|
||||
commentGetDa = "{:url('index/Comment/getDa')}",
|
||||
commentUpdateDa = "{:url('index/Comment/updateDa')}",
|
||||
commentJiedaDelete = "{:url('index/Comment/jiedaDelete')}",
|
||||
var collectionFind = "{:url('Collection/find')}",
|
||||
articleJieset = "{:url('Article/jieset')}",
|
||||
articleDelete = "{:url('Article/delete')}",
|
||||
collection = "{:url('Collection/')}",
|
||||
commentJiedaZan = "{:url('Comment/jiedaZan')}",
|
||||
commentJiedaCai = "{:url('Comment/jiedaCai')}",
|
||||
commentGetDa = "{:url('Comment/getDa')}",
|
||||
commentUpdateDa = "{:url('Comment/updateDa')}",
|
||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||
langCollection = "{:lang('collection')}",
|
||||
langCancelCollection = "{:lang('cancel collection')}";
|
||||
layui.cache.page = 'jie';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use(['fly', 'face','colorpicker'], function(){
|
||||
layui.use(['fly', 'face','colorpicker'], function(){
|
||||
var $ = layui.$
|
||||
,fly = layui.fly
|
||||
,colorpicker = layui.colorpicker;
|
||||
|
@ -1,4 +1,5 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}编辑帖子{/block}
|
||||
{block name="column"}{/block}
|
||||
{block name="content"}
|
||||
@ -138,20 +139,7 @@
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
layui.cache.page = 'jie';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use(['fly','colorpicker','form','upload'], function(){
|
||||
layui.use(['fly','colorpicker','form','upload'], function(){
|
||||
var $ = layui.$
|
||||
,colorpicker = layui.colorpicker
|
||||
,form = layui.form
|
||||
|
@ -137,21 +137,4 @@
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
layui.cache.page = 'index';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
|
||||
{/block}
|
@ -101,6 +101,7 @@
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
var replyUrl = "{:url('index/reply')}";
|
||||
layui.use(['form', 'layer'], function() {
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
@ -226,21 +227,4 @@
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
var replyUrl = "{:url('index/reply')}";
|
||||
layui.cache.page = 'index';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
{/block}
|
@ -1,9 +1,7 @@
|
||||
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}
|
||||
TP5学习制作:Tao.2019
|
||||
{/block}
|
||||
{block name="title"}{$sysInfo.webname}{$keywords}搜索内容{/block}
|
||||
|
||||
{block name="column"}
|
||||
{include file="/public/column" /}
|
||||
@ -14,21 +12,16 @@ TP5学习制作:Tao.2019
|
||||
<div class="layui-row layui-col-space15">
|
||||
|
||||
<div class="layui-col-md8">
|
||||
|
||||
<div class="fly-panel" style="margin-bottom: 0;">
|
||||
|
||||
<div class="fly-panel-title fly-filter">
|
||||
<a href="" class="layui-this">“{$keywords}” 共{$counts}条结果</a>
|
||||
</div>
|
||||
|
||||
<ul class="fly-list">
|
||||
{volist name="artList" id="art"}
|
||||
<li>
|
||||
|
||||
<a href="{:url('user/home',['id'=>$art.user_id])}" class="fly-avatar">
|
||||
<img src="{$art.user.user_img}" alt="{$art.user_id|getUserName}">
|
||||
</a>
|
||||
|
||||
<h2>
|
||||
<a class="layui-badge">{$art.cate.catename}</a>
|
||||
<a href="{:url('article/detail',['id' => $art.id])}">{$art.title}</a>
|
||||
@ -56,10 +49,9 @@ TP5学习制作:Tao.2019
|
||||
</li>
|
||||
{/volist}
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-col-md4">
|
||||
<!--温馨通道-->
|
||||
<div class="fly-panel">
|
||||
@ -86,27 +78,11 @@ TP5学习制作:Tao.2019
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/flink" /}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
layui.cache.page = 'index';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user.name? $user['user_img']:'/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ? $user.point : ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
{/block}
|
@ -218,22 +218,6 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</script>
|
||||
<script>
|
||||
layui.cache.page = 'user';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
{/block}
|
||||
|
@ -91,21 +91,4 @@ $(function() {
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
layui.cache.page = 'user';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
{/block}
|
@ -1,5 +1,5 @@
|
||||
|
||||
{extend name="public:base" /}
|
||||
|
||||
{block name="title"}注册账号{/block}
|
||||
{block name="column"}{/block}
|
||||
{block name="content"}
|
||||
@ -67,7 +67,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
@ -108,20 +107,4 @@ $(function() {
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
layui.cache.page = 'user';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
{/block}
|
||||
|
@ -31,6 +31,22 @@
|
||||
{block name="column"}导航{/block}
|
||||
{block name="content"}内容{/block}
|
||||
{include file="public/footer" /}
|
||||
<script>
|
||||
layui.cache.page = '{$jspage}';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
{block name="script"}{/block}
|
||||
</body>
|
||||
</html>
|
||||
|
@ -11,7 +11,7 @@
|
||||
{/volist}
|
||||
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>
|
||||
{if session('?user_id')}
|
||||
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="{:url('user/post')}">{:lang('add post')}</a></li>
|
||||
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="{:url('user/post')}">{:lang('my post')}</a></li>
|
||||
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="{:url('user/post#collection')}">{:lang('my collection')}</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
|
Loading…
x
Reference in New Issue
Block a user