修正用户文章列表

This commit is contained in:
liyukun 2022-01-24 01:46:57 +08:00
parent 15073e3ec7
commit aff980a792
7 changed files with 225 additions and 19 deletions

View File

@ -143,7 +143,7 @@ class Ape extends TagLib
$display = $display == 1 ? 1 : 0;
$parse = '<?php ';
$parse .= '$__FUN__ =' . "tpl_get_list(\"$orderBy\",$pageSize,$typeId,\"$type\",\"$model\",\"$where\",$display);";
$parse .= '$__LIST__ =$__FUN__["lists"];$pager = $__FUN__["model"]->render();';
$parse .= '$__LIST__ = $__FUN__["lists"];$pager = $__FUN__["model"]->render();';
$parse .= ' ?>';
$parse .= '{volist name="__LIST__" id="' . $void . '" key="i"}';
$parse .= $content;

View File

@ -308,4 +308,41 @@ class Article extends Base
}
return $this->fetch();
}
/**
* 用户首页
* @return string
* @throws Exception
* @author 李玉坤
* @date 2022-01-24 1:23
*/
public function user()
{
$author = input('author');
if (!trim($author)) {
$this->error('请输入搜索关键词');
}
if (!mb_check_encoding($author, 'utf-8')) {
$kw = iconv('gbk', 'utf-8', $author);
}
$apeField['id'] = '0';
$apeField['title'] = $author;
$apeField['meta_title'] = $author;
$apeField['keywords'] = web_config('keywords');
$apeField['description'] = web_config('description');
$apeField['position'] = '<a href="/">首页</a> > <a>' . $author . '</a>';
$this->assign('apeField', $apeField);
$this->assign('author', $author);
//清除可能存在的栏目分类树id
cache(Data::CURR_CATEGORY_PATENT_ID, false);
//模板兼容性标签
$this->assign('id', false);
$this->assign('cid', false);
$templateFile = config('view.view_path') . 'article/user.html';
if (!is_file($templateFile)) {
$this->error('模板文件不存在!');
}
return $this->fetch();
}
}

View File

@ -49,6 +49,11 @@ class Base extends BaseController
$pvLogModel = new PvLog();
$pvLogModel->set_view();
}
cache(Data::CURR_CATEGORY_PATENT_ID, false);
//模板兼容性标签
$this->assign('id', false);
$this->assign('cid', false);
//获取根域名
//判断是否开启了伪静态
// if (web_config('web_rewrite')=='0') {

View File

@ -7,7 +7,6 @@
namespace app\index\controller;
use app\admin\extend\Util;
use app\common\constant\Data;
use app\common\model\User as userModel;
use Exception;
use think\db\exception\DataNotFoundException;
@ -27,11 +26,6 @@ class User extends Base
if (!web_config('is_register')){
$this->error('登录未启用,请联系管理员!');
}
//清除可能存在的栏目分类树id
cache(Data::CURR_CATEGORY_PATENT_ID, false);
//模板兼容性标签
$this->assign('id', false);
$this->assign('cid', false);
return $this->fetch();
}
@ -66,11 +60,6 @@ class User extends Base
if (!web_config('is_register')){
$this->error('注册未启用,请联系管理员!');
}
//清除可能存在的栏目分类树id
cache(Data::CURR_CATEGORY_PATENT_ID, false);
//模板兼容性标签
$this->assign('id', false);
$this->assign('cid', false);
return $this->fetch();
}
@ -128,11 +117,6 @@ class User extends Base
*/
public function profile()
{
//清除可能存在的栏目分类树id
cache(Data::CURR_CATEGORY_PATENT_ID, false);
//模板兼容性标签
$this->assign('id', false);
$this->assign('cid', false);
return $this->fetch();
}

View File

@ -24,7 +24,8 @@
"topthink/think-captcha": "^3.0",
"phpmailer/phpmailer": "^6.5",
"spatie/macroable": "^1.0",
"topthink/think-view": "^1.0"
"topthink/think-view": "^1.0",
"ext-iconv": "*"
},
"require-dev": {
"symfony/var-dumper": "^4.2"

View File

@ -40,7 +40,7 @@
<div class="post-info">
<div class="post-info-left">
<a class="nickname url fn j-user-card" data-user="1"
href="../author/james/index.html"><i class="fa fa-user" aria-hidden="true"></i>{$apeField['author']}
href="{:url('article/user')}?author={$apeField['author']}"><i class="fa fa-user" aria-hidden="true"></i>{$apeField['author']}
</a>
<span class="dot"></span>
<time class="entry-date published" datetime="{$apeField['create_time']}" pubdate=""><i

View File

@ -0,0 +1,179 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<title>{$apeField['meta_title']} - {:web_config('title')}</title>
<meta name="keywords" content="{$apeField['keywords']}" />
<meta name="description" content="{$apeField['description']}" />
{include file="public/head" /}
</head>
<body>
<script>NProgress.start();</script>
<div id="app">
{include file="public/header" /}
<div class="top-divider"></div>
<main class="container">
<div class="html-main">
<div class="post-main">
<div class="post-list-page-plane">
<div class="list-plane-title">
<div>{$author} 的文章</div>
</div>
<ul class="post-list">
{ape:list pagesize="10" type="where" where="author='$author'"}
<li class="post-item">
<div class="post-item-container">
<div class="post-item-thumbnail">
<a href="{$field['url']}">
<img src="__IMG__/loading.gif" data-original="{:file_cdn($field['cover_path'])}"/>
</a>
</div>
<!-- tag链接等待完善-->
{notempty name="$field['tags']"}
<div class="post-item-tags ">
<span class="cat-item">
<a href="{$field['url']}">{:cn_substr($field['tags'],15)}</a>
</span>
</div>
{/notempty}
<div class="post-item-main">
<h2>
<a href="{$field['url']}" style="white-space: nowrap;text-overflow: ellipsis;">{:cn_substr($field['title'],20)}</a>
</h2>
<div class="post-item-content">
<a target="_blank" href="{$field['url']}" style="white-space: nowrap;text-overflow: ellipsis;">{:cn_substr($field['content'],100)}</a>
</div>
<div class="post-item-info">
<div class="post-item-meta">
<div class="post-item-meta-item">
<span class="post-item-meta-author">
<!-- <img alt="" src="__IMG__/corepress_avatar/1.jpg" srcset="__IMG__/corepress_avatar/1.jpg 2x" class="avatar avatar-24 photo post-item-avatar"-->
<!-- height="24" width="24" loading="lazy"/>-->
{$field['author']}
</span>
<span class="post-item-time">{$field['create_time']}</span>
</div>
<div class="item-post-meta-other">
<span><i class="fas fa-eye" aria-hidden="true"></i>{$field['view']}</span>
<!-- <span><i class="fas fa-comment-alt-lines"></i>0</span>-->
</div>
</div>
</div>
</div>
</div>
</li>
{/ape:list}
</ul>
<div class="pages">
<div class="fenye">
{$pager|raw}
</div>
</div>
</div>
</div>
<div class="sidebar">
<div class="sidebar-box-list">
<div class="aside-box">
<form class="search-form" action="{:url('/index/article/search')}" method="get" role="search">
<div class="search-form-input-plane">
<input type="text" class="search-keyword" name="kw" placeholder="搜索内容"/>
</div>
<div>
<button type="submit" class="search-submit" value="&#xf002;">搜索</button>
</div>
</form>
</div>
<div class="aside-box">
<h2 class="widget-title">热门阅读</h2>
{ape:arclist row="6" type="where" orderBy="view desc"}
<div class="hot-post-widget-item">
<div>
<span class="hot-post-widget-item-num">{$i}</span>
<span class="hot-post-widget-item-title">
<a href="{$field['url']}">{:cn_substr($field['title'],15)}</a>
</span>
</div>
<div class="hot-post-widget-item-meta">
<div>{$field['create_time']}</div>
<div>
<a href="#">{:cn_substr($field['category_title'],5)}</a>
</div>
</div>
</div>
{/ape:arclist}
</div>
<div class="aside-box">
<h2 class="widget-title">标签云</h2>
<script src="__JS__/TagCloud.js"></script>
<div class="corepress-tag-cloud">
<div class="corepress-tag-container-tag1"></div>
</div>
<style>
.corepress-tagcloud a {
font-size: 12px;
color: #fff;
padding: 0 !important;
}
.corepress-tagcloud a:hover {
color: #fff !important;
}
.tagcloud--item {
color: #fff;
padding: 2px 4px;
border-radius: 3px;
cursor: pointer;
}
.tagcloud--item:hover {
opacity: 1 !important;
z-index: 100 !important;
}
</style>
<script>
$.get("{:url('/index/article/taglist')}",function(data,status){
TagCloud(
".corepress-tag-container-tag1",
data.data,
{},
[
"#67C23A",
"#E6A23C",
"#F56C6C",
"#909399",
"#CC9966",
"#FF6666",
"#99CCFF",
"#FF9999",
"#CC6633",
"#67C23A",
'#ef5b9c',
'#fcaf17',
'#009ad6',
'#003A8C',
'#f36c21'
]
);
});
</script>
</div>
{ape:advert row="3" type="2"}
<div class="aside-box">
<h2 class="widget-title">{$field['title']}</h2>
<a href="{$field['url']}" target="_blank">
<img width="300" height="191" src="{$field['cover_path']}"
class="image wp-image-559 attachment-medium size-medium" alt=""
loading="lazy" style="max-width: 100%; height: auto;">
</a>
</div>
{/ape:advert}
</div>
</div>
</div>
</main>
{include file="public/footer"/}
<script src="__LIB__/highlight/init.js"></script>
</div>
</body>
</html>