feat: 新增nas帮助中心
This commit is contained in:
@@ -194,6 +194,7 @@ class TopsNas extends BaseController
|
|||||||
'id',
|
'id',
|
||||||
'pid',
|
'pid',
|
||||||
'name',
|
'name',
|
||||||
|
'picture'
|
||||||
])
|
])
|
||||||
->where('isshow', '=', 1)
|
->where('isshow', '=', 1)
|
||||||
->where('country_code', '=', $this->country_code)
|
->where('country_code', '=', $this->country_code)
|
||||||
@@ -310,4 +311,158 @@ class TopsNas extends BaseController
|
|||||||
|
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据分类获取文章
|
||||||
|
private function getArticleByCategory($categorys, $limit = 3)
|
||||||
|
{
|
||||||
|
if (!is_array($categorys)) {
|
||||||
|
throw new \Exception('请确认分类正确');
|
||||||
|
}
|
||||||
|
if (empty($categorys)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$model = Loader::model('Article')
|
||||||
|
->field([
|
||||||
|
'id',
|
||||||
|
'cid',
|
||||||
|
'name',
|
||||||
|
'sort'
|
||||||
|
])
|
||||||
|
->where('stat', '=', 0)
|
||||||
|
->where('cid', '=', $categorys[0]['id'])
|
||||||
|
->where('country_code', '=', $this->country_code);
|
||||||
|
foreach ($categorys as $key => $val) {
|
||||||
|
if ($key == 0) continue;
|
||||||
|
$model->union(function($query) use($val, $limit) {
|
||||||
|
$query->name('article')->field([
|
||||||
|
'id',
|
||||||
|
'cid',
|
||||||
|
'name',
|
||||||
|
'sort'
|
||||||
|
])
|
||||||
|
->where('stat', '=', 0)
|
||||||
|
->where('cid', '=', $val['id'])
|
||||||
|
->where('country_code', '=', $this->country_code)
|
||||||
|
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||||
|
->limit($limit);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$map = [];
|
||||||
|
$data = $model->order(['sort' => 'asc', 'id' => 'desc'])->limit($limit)->select();
|
||||||
|
foreach ($data as $key => $val) {
|
||||||
|
$map['cid_' . $val['cid']][] = $val;
|
||||||
|
}
|
||||||
|
return $map;
|
||||||
|
}
|
||||||
|
// 帮忙中心
|
||||||
|
public function helper()
|
||||||
|
{
|
||||||
|
// 获取分类
|
||||||
|
$categorys = $this->getCategoryTree(76);
|
||||||
|
// 获取文章
|
||||||
|
$articles = $this->getArticleByCategory($categorys, 3);
|
||||||
|
// 组装数据
|
||||||
|
foreach ($categorys as $key => &$val) {
|
||||||
|
if (!isset($val['articles'])) {
|
||||||
|
$val['articles'] = [];
|
||||||
|
}
|
||||||
|
if (isset($articles['cid_' . $val['id']])) {
|
||||||
|
$articles = $articles['cid_' . $val['id']];
|
||||||
|
foreach ($articles as $k => $v) {
|
||||||
|
$val['articles'][] = [
|
||||||
|
'id' => $v['id'],
|
||||||
|
'name' => $v['name']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($val);
|
||||||
|
$this->assign('categorys', $categorys);
|
||||||
|
|
||||||
|
$banners = $this->getBanners(126);
|
||||||
|
if (!empty($banners)) {
|
||||||
|
$banners = $banners['typeid_126']['banners'];
|
||||||
|
}
|
||||||
|
$this->assign('banners', $banners);
|
||||||
|
$this->assign('banners_size', count($banners));
|
||||||
|
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索帮助文章
|
||||||
|
public function helper_search()
|
||||||
|
{
|
||||||
|
$base_category = 76;
|
||||||
|
$keywords = request()->param('keywords');
|
||||||
|
$articles = Loader::model('Article')
|
||||||
|
->field([
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'sort',
|
||||||
|
])
|
||||||
|
->where('stat', '=', 0)
|
||||||
|
->where('country_code', '=', $this->country_code)
|
||||||
|
->where('cid', 'in', function($query) use($base_category) {
|
||||||
|
$query->name('article_category')
|
||||||
|
->field(['id'])
|
||||||
|
->where('id', '=', $base_category)
|
||||||
|
->whereOr('pid', '=', $base_category);
|
||||||
|
})
|
||||||
|
->where(function($query) use($keywords) {
|
||||||
|
if (!empty($keywords)) {
|
||||||
|
$query->where('name', 'like', '%' . $keywords . '%');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||||
|
->select();
|
||||||
|
|
||||||
|
return json([
|
||||||
|
'code' => 0,
|
||||||
|
'message' => '获取成功',
|
||||||
|
'data' => $articles
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 帮助中心文章详细
|
||||||
|
public function helper_detail()
|
||||||
|
{
|
||||||
|
$id = request()->param('id');
|
||||||
|
$article = Loader::model('Article')->where('id', '=', $id)->find();
|
||||||
|
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
return json([
|
||||||
|
'code' => 0,
|
||||||
|
'message' => '获取成功',
|
||||||
|
'data' => $article
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
// 获取分类
|
||||||
|
$categorys = $this->getCategoryTree(76);
|
||||||
|
// 获取文章
|
||||||
|
$articles = $this->getArticleByCategory($categorys, 3);
|
||||||
|
// 组装数据
|
||||||
|
foreach ($categorys as $key => &$val) {
|
||||||
|
if (!isset($val['articles'])) {
|
||||||
|
$val['articles'] = [];
|
||||||
|
}
|
||||||
|
if (isset($articles['cid_' . $val['id']])) {
|
||||||
|
$articles = $articles['cid_' . $val['id']];
|
||||||
|
foreach ($articles as $k => $v) {
|
||||||
|
$val['articles'][] = [
|
||||||
|
'id' => $v['id'],
|
||||||
|
'name' => $v['name']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($val);
|
||||||
|
$this->assign('categorys', $categorys);
|
||||||
|
$this->assign('article', $article);
|
||||||
|
$this->assign('cid', request()->param('cid'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
481
app/index/view/tops_nas/helper.phtml
Normal file
481
app/index/view/tops_nas/helper.phtml
Normal file
@@ -0,0 +1,481 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>帮助中心</title>
|
||||||
|
{include file='include/head-nas' /}
|
||||||
|
<style>
|
||||||
|
.narshelpCenterPc {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
/* 下拉搜索框样式 */
|
||||||
|
/* 下拉搜索框中的建议项样式 */
|
||||||
|
}
|
||||||
|
.narhelpgoimg{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.narshelpCenterPc .narhelpgoimg img{
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .pagetopbg {
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .pagetopbg .hpbgimg {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .pagetopbg .nhlp-search {
|
||||||
|
width: 35%;
|
||||||
|
height: 3rem;
|
||||||
|
border-radius: 1.5625rem;
|
||||||
|
background: #5299e1;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
position: absolute;
|
||||||
|
justify-content: space-between;
|
||||||
|
border: 0.0625rem solid #fff;
|
||||||
|
bottom: 15%;
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: 2px 2px 100px #8d8d8d;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .pagetopbg .nhlp-search .nhlp-ipt {
|
||||||
|
border: none;
|
||||||
|
width: 85%;
|
||||||
|
height: 3rem;
|
||||||
|
margin-left: 5%;
|
||||||
|
color: #fff;
|
||||||
|
background: transparent;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .pagetopbg .nhlp-search .searchimghelp {
|
||||||
|
width: 1.6rem;
|
||||||
|
height: 1.6rem;
|
||||||
|
margin-right: 3%;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .pagetopbg .nhlp-search input {
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .pagetopbg .nhlp-search input::placeholder {
|
||||||
|
color: #fff;
|
||||||
|
padding-left: 20%;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 {
|
||||||
|
width: 74.6%;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .helph1 {
|
||||||
|
margin: 0 auto;
|
||||||
|
margin-top: 54px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 32px;
|
||||||
|
margin-bottom: 38px;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-bottom: 4.625rem;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit {
|
||||||
|
width: 32.7%;
|
||||||
|
padding: 2.25rem;
|
||||||
|
background: #fafafa;
|
||||||
|
border-radius: 8px;
|
||||||
|
color: #202734;
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-right: 12px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit .nhlptl {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 1.25rem;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit .nhlptl .bhlpicoimg {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit .nhlp-tx-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit .nhlp-tx-list .txrow {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit .nhlp-tx-list .txrow .nhlp-point {
|
||||||
|
width: 0.3125rem;
|
||||||
|
height: 0.3125rem;
|
||||||
|
background: #202734;
|
||||||
|
border-radius: 0.1875rem;
|
||||||
|
margin: 0 0.625rem;
|
||||||
|
margin-left: 0.25rem;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit .nhlp-tx-list .txrow .nhlpsp {
|
||||||
|
flex: 1;
|
||||||
|
color: #1f2635;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit .nhlp-tx-list .ckgdbt {
|
||||||
|
background: #fff;
|
||||||
|
width: fit-content;
|
||||||
|
color: #bfbfc4;
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
border: 0.0625rem solid #bfbfc4;
|
||||||
|
padding: 0.4375rem 1.125rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 1.5rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit-w {
|
||||||
|
width: 49.4%;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit-w:last-child {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlppart1 .nhlp-row .nhlpit:nth-child(3n) {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .lxwmtitle {
|
||||||
|
margin: 0 auto;
|
||||||
|
margin-bottom: 38px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlp-lxwm {
|
||||||
|
width: 74.6%;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlp-lxwm .nhlp-row {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-bottom: 4.625rem;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlp-lxwm .nhlp-row .nhlplxwmit {
|
||||||
|
background: #f9f9f9;
|
||||||
|
width: 392px;
|
||||||
|
height: 291px;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin-right: 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlp-lxwm .nhlp-row .nhlplxwmit .lximg {
|
||||||
|
width: 4.375rem;
|
||||||
|
height: 4.375rem;
|
||||||
|
margin-bottom: 2.125rem;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlp-lxwm .nhlp-row .nhlplxwmit .lxewmimg {
|
||||||
|
width: 6.875rem;
|
||||||
|
width: 6.875rem;
|
||||||
|
margin-bottom: 1.25rem;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlp-lxwm .nhlp-row .nhlplxwmit .t1 {
|
||||||
|
font-size: 1rem;
|
||||||
|
padding-bottom: 0.375rem;
|
||||||
|
color: #1f2635;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlp-lxwm .nhlp-row .nhlplxwmit .t2 {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: #1f2635;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlp-lxwm .nhlp-row .nhlplxwmit-w1 {
|
||||||
|
width: 32.7%;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .nhlp-lxwm .nhlp-row .nhlplxwmit-w2 {
|
||||||
|
width: 24.3%;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .dropdown {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 355px;
|
||||||
|
left: 0;
|
||||||
|
width: 35%;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-top: none;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
margin: 0 auto;
|
||||||
|
right: 0;
|
||||||
|
max-height: 18.75rem;
|
||||||
|
min-height: 3.125rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .dropdown ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .dropdown ul li {
|
||||||
|
padding: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.narshelpCenterPc .dropdown ul li:hover {
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
}
|
||||||
|
/* 修改垂直滚动条 */
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 6px; /* 修改宽度 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改滚动条轨道背景色 */
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改滚动条滑块颜色 */
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background-color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改滚动条滑块悬停时的颜色 */
|
||||||
|
::-webkit-scrollbar-thumb:hover {
|
||||||
|
background-color: #D8DFE8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改滚动条滑块移动时的颜色 */
|
||||||
|
::-webkit-scrollbar-thumb:active {
|
||||||
|
background-color: #D8DFE8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改滚动条滑块的圆角 */
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
/* 整体滚动条 */
|
||||||
|
* {
|
||||||
|
scrollbar-width: thin; /* 滚动条宽度 */
|
||||||
|
scrollbar-color: #D8DBE6 transparent; /* 滚动条颜色(滑块颜色 轨道颜色) */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条轨道 */
|
||||||
|
*::-moz-scrollbar-track {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条滑块 */
|
||||||
|
*::-moz-scrollbar-thumb {
|
||||||
|
background-color: #D8DBE6;
|
||||||
|
border-radius: 5px; /* 滑块的圆角 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条的上下箭头 */
|
||||||
|
*::-moz-scrollbar-button {
|
||||||
|
display: none; /* 隐藏上下箭头 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条的上下箭头:向上箭头 */
|
||||||
|
*::-moz-scrollbar-button:vertical:decrement {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条的上下箭头:向下箭头 */
|
||||||
|
*::-moz-scrollbar-button:vertical:increment {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- 顶部导航 -->
|
||||||
|
{include file='include/top-header-nas'/}
|
||||||
|
<div class="narshelpCenterPc">
|
||||||
|
<!-- banner-搜索-->
|
||||||
|
<div class="pagetopbg">
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/banner.jpg" class="hpbgimg" />
|
||||||
|
<div class='nhlp-search'>
|
||||||
|
<input class="nhlp-ipt" id="search-input" placeholder="请输入搜索关键字,如安装赛博云空间,影视库" />
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nars-help-search.png" class="searchimghelp" />
|
||||||
|
</div>
|
||||||
|
<!-- 下拉搜索框 -->
|
||||||
|
<div class="dropdown" id="dropdown"></div>
|
||||||
|
</div>
|
||||||
|
<!-- 使用教程-->
|
||||||
|
<div class="nhlppart1">
|
||||||
|
<h1 class="helph1">使用教程</h1>
|
||||||
|
<div class="nhlp-row">
|
||||||
|
{volist name="categorys" id="vo"}
|
||||||
|
<div class="nhlpit {if condition='$key==6 || $key==7'}nhlpit-w{/if}">
|
||||||
|
<div class="nhlptl">
|
||||||
|
<img src="{$vo.picture}" class="bhlpicoimg" />{$vo.name}
|
||||||
|
</div>
|
||||||
|
<div class="nhlp-tx-list">
|
||||||
|
{volist name="vo.articles" id="va"}
|
||||||
|
<a class="txrow" href="{:url('tops_nas/helper_detail', ['id'=>$va.id])}">
|
||||||
|
<div class="nhlp-point"></div>
|
||||||
|
<span class="nhlpsp">{$va.name}</span>
|
||||||
|
<span class="narhelpgoimg">
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nars-jt.png"/>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
{/volist}
|
||||||
|
<a class="ckgdbt" href="{:url('tops_nas/helper_detail', ['cid'=>$vo.id, 'id'=>isset($vo.articles[0])?$vo.articles[0]['id']:0])}">查看更多
|
||||||
|
<span class="narhelpgoimg">
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nars-jt.png"/>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/volist}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 联系我们-->
|
||||||
|
<div class="nhlp-lxwm">
|
||||||
|
<h1 class=" helph1 lxwmtitle">联系我们</h1>
|
||||||
|
<div class="nhlp-row">
|
||||||
|
{if condition="$banners_size > 0"}
|
||||||
|
<div class="nhlplxwmit nhlplxwmit-w1">
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nhlp-lx1.png" class="lximg" />
|
||||||
|
{if condition="!empty($banners[0]['picture']) && $banners[0]['picture'] != '/uploads/nopic.jpg'"}
|
||||||
|
<img src="{$banners[0]['picture']}" class="lxewmimg">
|
||||||
|
{/if}
|
||||||
|
<span class="t1">{$banners[0]['name']}</span>
|
||||||
|
<span class="t2">{$banners[0]['desc']}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{if condition="$banners_size > 1"}
|
||||||
|
<div class="nhlplxwmit nhlplxwmit-w1">
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nhlp-lx2.png" class="lximg" />
|
||||||
|
{if condition="!empty($banners[1]['picture']) && $banners[1]['picture'] != '/uploads/nopic.jpg'"}
|
||||||
|
<img src="{$banners[1]['picture']}" class="lxewmimg">
|
||||||
|
{/if}
|
||||||
|
<span class="t1">{$banners[1]['name']}</span>
|
||||||
|
<span class="t2">{$banners[1]['desc']}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{if condition="$banners_size > 2"}
|
||||||
|
<div class="nhlplxwmit nhlplxwmit-w1" style="margin-right: 0;">
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nhlp-lx3.png" class="lximg" />
|
||||||
|
{if condition="!empty($banners[2]['picture']) && $banners[2]['picture'] != '/uploads/nopic.jpg'"}
|
||||||
|
<img src="{$banners[2]['picture']}" class="lxewmimg">
|
||||||
|
{/if}
|
||||||
|
<span class="t1">{$banners[2]['name']}</span>
|
||||||
|
<span class="t2">{$banners[2]['desc']}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{if condition="$banners_size > 3"}
|
||||||
|
<div class="nhlplxwmit nhlplxwmit-w2">
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nhlp-lx4.png" class="lximg" />
|
||||||
|
{if condition="!empty($banners[3]['picture']) && $banners[3]['picture'] != '/uploads/nopic.jpg'"}
|
||||||
|
<img src="{$banners[3]['picture']}" class="lxewmimg">
|
||||||
|
{/if}
|
||||||
|
<span class="t1">{$banners[3]['name']}</span>
|
||||||
|
<span class="t2">{$banners[3]['desc']}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{if condition="$banners_size > 4"}
|
||||||
|
<div class="nhlplxwmit nhlplxwmit-w2">
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nhlp-lx5.png" class="lximg" />
|
||||||
|
{if condition="!empty($banners[4]['picture']) && $banners[4]['picture'] != '/uploads/nopic.jpg'"}
|
||||||
|
<img src="{$banners[4]['picture']}" class="lxewmimg">
|
||||||
|
{/if}
|
||||||
|
<span class="t1">{$banners[4]['name']}</span>
|
||||||
|
<span class="t2">{$banners[4]['desc']}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{if condition="$banners_size > 5"}
|
||||||
|
<div class="nhlplxwmit nhlplxwmit-w2">
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nhlp-lx6.png" class="lximg" />
|
||||||
|
{if condition="!empty($banners[5]['picture']) && $banners[5]['picture'] != '/uploads/nopic.jpg'"}
|
||||||
|
<img src="{$banners[5]['picture']}" class="lxewmimg">
|
||||||
|
{/if}
|
||||||
|
<span class="t1">{$banners[5]['name']}</span>
|
||||||
|
<span class="t2">{$banners[5]['desc']}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{if condition="$banners_size > 6"}
|
||||||
|
<div class="nhlplxwmit nhlplxwmit-w2" style="margin-right: 0;">
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nhlp-lx7.png" class="lximg" />
|
||||||
|
{if condition="!empty($banners[6]['picture']) && $banners[6]['picture'] != '/uploads/nopic.jpg'"}
|
||||||
|
<img src="{$banners[6]['picture']}" class="lxewmimg">
|
||||||
|
{/if}
|
||||||
|
<span class="t1">{$banners[6]['name']}</span>
|
||||||
|
<span class="t2">{$banners[6]['desc']}</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{include file='include/bottom2023'/}
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
// 监听输入框内容变化
|
||||||
|
var timeout = null;
|
||||||
|
$('#search-input').on('focus input', function() {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
var _this = this;
|
||||||
|
timeout = setTimeout(function () {
|
||||||
|
var keywords = $(_this).val();
|
||||||
|
if (keywords == '') {
|
||||||
|
$('#dropdown').hide().html('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: "{:url('tops_nas/helper_search')}",
|
||||||
|
type: 'POST',
|
||||||
|
data: {keywords: keywords},
|
||||||
|
dataType: 'JSON',
|
||||||
|
success: function(r) {
|
||||||
|
var html = '';
|
||||||
|
if (r.code == 0) {
|
||||||
|
html = '<ul>'
|
||||||
|
$.each(r.data, function(k, v) {
|
||||||
|
html += '<li><a href="{:url(\'tops_nas/helper_detail\')}?id=' + v.id + '">' + v.name + '</a></li>'
|
||||||
|
})
|
||||||
|
html += '</ul>'
|
||||||
|
}
|
||||||
|
$('#dropdown').show().html(html);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, 300);
|
||||||
|
})
|
||||||
|
$(document).on('click', function (e) {
|
||||||
|
var target = $(e.target);
|
||||||
|
if (!target.closest('.nhlp-search').length) {
|
||||||
|
$('#dropdown').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.nhlplxwmit:not(:first)').click(function() {
|
||||||
|
$(this).find('.lximg').toggle();
|
||||||
|
$(this).find('.lxewmimg').toggle();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
408
app/index/view/tops_nas/helper_detail.phtml
Normal file
408
app/index/view/tops_nas/helper_detail.phtml
Normal file
@@ -0,0 +1,408 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>帮助中心</title>
|
||||||
|
{include file='include/head-nas' /}
|
||||||
|
<style>
|
||||||
|
.narshelpdetailPc {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #f9f9f9;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .narsssmain {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
padding: 21px 0;
|
||||||
|
top: 0;
|
||||||
|
align-items: center;
|
||||||
|
background: #fff;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .narsssmain .dropdown {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 124px;
|
||||||
|
left: 0;
|
||||||
|
width: 435px;
|
||||||
|
border-top: none;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
margin: 0 auto;
|
||||||
|
right: 0;
|
||||||
|
max-height: 18.75rem;
|
||||||
|
min-height: 3.125rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .narsssmain .dropdown ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .narsssmain .dropdown ul li {
|
||||||
|
padding: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .narsssmain .dropdown ul li:hover {
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .narsssmain .ml {
|
||||||
|
font-size: 14px;
|
||||||
|
padding-left: 25px;
|
||||||
|
padding-top: 37px;
|
||||||
|
padding-bottom: 31px;
|
||||||
|
color: #8f9099;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .narsssmain .nars-hlp-search {
|
||||||
|
width: 440px;
|
||||||
|
height: 42px;
|
||||||
|
border-radius: 1.3125rem;
|
||||||
|
font-size: 14px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
color: #8f9099;
|
||||||
|
border: 1px solid #cdcedb;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .narsssmain .nars-hlp-search .ssimg {
|
||||||
|
width: 1.6rem;
|
||||||
|
height: 1.6rem;
|
||||||
|
margin-right: 3%;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .narsssmain .nars-hlp-search input {
|
||||||
|
font-size: 14px;
|
||||||
|
border: none;
|
||||||
|
padding: 0 15px;
|
||||||
|
outline: none;
|
||||||
|
flex: 1;
|
||||||
|
margin-right: 2%;
|
||||||
|
margin-left: 2%;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .narsssmain .nars-hlp-search input::placeholder {
|
||||||
|
color: #8f9099;
|
||||||
|
padding-left: 10%;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml {
|
||||||
|
width: 252px;
|
||||||
|
overflow-y: auto;
|
||||||
|
border-right: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .nav-tree {
|
||||||
|
max-height: 800px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .category {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .category-title {
|
||||||
|
display: block;
|
||||||
|
padding: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-left: 10px;
|
||||||
|
color: #1f2635;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .arrow {
|
||||||
|
margin-right: 2px;
|
||||||
|
transform: rotate(0deg);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .arrow .nars-jt {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .rotate {
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .sub-list {
|
||||||
|
display: none;
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .sub-list li a {
|
||||||
|
width: fit-content;
|
||||||
|
display: block;
|
||||||
|
margin: 0 10px;
|
||||||
|
padding-top: 22px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #333;
|
||||||
|
margin-left: 41px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #8f9099;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .sub-list li:first a {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-ml .sub-list li a:hover {
|
||||||
|
color: #1f2635;
|
||||||
|
border-bottom: 1px solid #1f2635;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mm {
|
||||||
|
padding: 32px 150px;
|
||||||
|
max-height: 800px;
|
||||||
|
min-height: 700px;
|
||||||
|
height: auto;
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
/* .narshelpdetailPc .nars-help-content .nars-hlpdt-mm img{*/
|
||||||
|
/* width: -webkit-fill-available;*/
|
||||||
|
/*}*/
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr {
|
||||||
|
width: 252px;
|
||||||
|
overflow-y: auto;
|
||||||
|
border-left: 1px solid #ccc;
|
||||||
|
overflow-y: auto;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr #title-list {
|
||||||
|
padding: 0 20px;
|
||||||
|
float: right;
|
||||||
|
max-height: 800px;
|
||||||
|
min-height: 700px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr #title-list .tt {
|
||||||
|
font-size: 14px;
|
||||||
|
padding-top: 33px;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr #title-list ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr #title-list ul li {
|
||||||
|
margin-bottom: 23px;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr #title-list ul li a {
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #1f2635;
|
||||||
|
}
|
||||||
|
.narshelpdetailPc .nars-help-content .nars-hlpdt-mr #title-list ul li a:hover {
|
||||||
|
color: #1f2635;
|
||||||
|
border-bottom: 1px solid #1f2635;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-tree .category:nth-child(1) .category-title {
|
||||||
|
padding-top: 33px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改垂直滚动条 */
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 6px; /* 修改宽度 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改滚动条轨道背景色 */
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改滚动条滑块颜色 */
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background-color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改滚动条滑块悬停时的颜色 */
|
||||||
|
::-webkit-scrollbar-thumb:hover {
|
||||||
|
background-color: #D8DFE8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改滚动条滑块移动时的颜色 */
|
||||||
|
::-webkit-scrollbar-thumb:active {
|
||||||
|
background-color: #D8DFE8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改滚动条滑块的圆角 */
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
/* 整体滚动条 */
|
||||||
|
* {
|
||||||
|
scrollbar-width: thin; /* 滚动条宽度 */
|
||||||
|
scrollbar-color: #D8DBE6 transparent; /* 滚动条颜色(滑块颜色 轨道颜色) */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条轨道 */
|
||||||
|
*::-moz-scrollbar-track {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条滑块 */
|
||||||
|
*::-moz-scrollbar-thumb {
|
||||||
|
background-color: #D8DBE6;
|
||||||
|
border-radius: 5px; /* 滑块的圆角 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条的上下箭头 */
|
||||||
|
*::-moz-scrollbar-button {
|
||||||
|
display: none; /* 隐藏上下箭头 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条的上下箭头:向上箭头 */
|
||||||
|
*::-moz-scrollbar-button:vertical:decrement {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动条的上下箭头:向下箭头 */
|
||||||
|
*::-moz-scrollbar-button:vertical:increment {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
margin: 0;
|
||||||
|
all: revert; /* 将所有属性设置为初始值 */
|
||||||
|
/* 或者使用 all: revert; 恢复到浏览器默认样式,但该属性兼容性不如 initial */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- 顶部导航 -->
|
||||||
|
{include file='include/top-header-nas'/}
|
||||||
|
<div class="narshelpdetailPc">
|
||||||
|
<!-- top 搜索-->
|
||||||
|
<div class="narsssmain">
|
||||||
|
<div class="ml">帮助中心 / 使用教程</div>
|
||||||
|
<div class="nars-hlp-search">
|
||||||
|
<input placeholder="请输入搜索关键字,如安装赛博云空间,影视库" />
|
||||||
|
<img src="__PUBLIC__/m_web/images/nas/help/nhlp-ssico.png" class="ssimg">
|
||||||
|
</div>
|
||||||
|
<!-- 下拉搜索框 -->
|
||||||
|
<div class="dropdown" id="dropdown"></div>
|
||||||
|
</div>
|
||||||
|
<!-- 目录-文章详情-锚点定位--->
|
||||||
|
<div class="nars-help-content">
|
||||||
|
<!--目录 -->
|
||||||
|
<div class="nars-hlpdt-ml">
|
||||||
|
<div class="nav-tree">
|
||||||
|
{volist name="categorys" id="vo"}
|
||||||
|
<div class="category">
|
||||||
|
<div class="category-title">
|
||||||
|
<div class="arrow {if condition='$cid == $vo.id'}rotate{/if}"><img src="__PUBLIC__/m_web/images/nas/help/nars-jt.png" class="arrow {if condition='$cid == $vo.id'}rotate{/if}"/></div>
|
||||||
|
<span>{$vo.name}</span>
|
||||||
|
</div>
|
||||||
|
<ul class="sub-list" {if condition="$cid == $vo.id"}style="display: block;"{/if}>
|
||||||
|
{volist name="vo.articles" id="va"}
|
||||||
|
<li data-id="{$va.id}"><a href="javascript:void(0);" style="{if condition='$key==0'}padding-top: 6px;{/if}">{$va.name}</a></li>
|
||||||
|
{/volist}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{/volist}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--文章详情 -->
|
||||||
|
<div class="nars-hlpdt-mm" id="rendered-content">
|
||||||
|
<div>{$article.content|default=''}</div>
|
||||||
|
</div>
|
||||||
|
<!--锚点定位 -->
|
||||||
|
<div class="nars-hlpdt-mr">
|
||||||
|
<div id="title-list">
|
||||||
|
<h2 class="tt">目录</h2>
|
||||||
|
<ul></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{include file='include/bottom2023'/}
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.category-title').click(function() {
|
||||||
|
$(this).next('.sub-list').slideToggle();
|
||||||
|
$(this).find('.arrow').toggleClass('rotate');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
$(document).on('click', function(e) {
|
||||||
|
var target = $(e.target);
|
||||||
|
if (!target.closest('.nhlp-search').length) {
|
||||||
|
$('#dropdown').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var timeout = null;
|
||||||
|
$('.nars-hlp-search input').on('focus input', function() {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
var _this = this;
|
||||||
|
timeout = setTimeout(function () {
|
||||||
|
var keywords = $(_this).val();
|
||||||
|
if (keywords == '') {
|
||||||
|
$('#dropdown').hide().html('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: "{:url('tops_nas/helper_search')}",
|
||||||
|
type: 'POST',
|
||||||
|
data: {keywords: keywords},
|
||||||
|
dataType: 'JSON',
|
||||||
|
success: function(r) {
|
||||||
|
var html = '';
|
||||||
|
if (r.code == 0) {
|
||||||
|
html = '<ul>'
|
||||||
|
$.each(r.data, function(k, v) {
|
||||||
|
html += '<li><a href="{:url(\'tops_nas/helper_detail\')}?id=' + v.id + '">' + v.name + '</a></li>'
|
||||||
|
})
|
||||||
|
html += '</ul>'
|
||||||
|
}
|
||||||
|
$('#dropdown').show().html(html);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, 300);
|
||||||
|
})
|
||||||
|
// 内容
|
||||||
|
readerContentTitle();
|
||||||
|
$('.sub-list li').click(function() {
|
||||||
|
var id = $(this).data('id');
|
||||||
|
$.ajax({
|
||||||
|
url: '{:url("tops_nas/helper_detail")}?id=' + id,
|
||||||
|
type: 'GET',
|
||||||
|
dataType: 'JSON',
|
||||||
|
success: function(r) {
|
||||||
|
$('#rendered-content div').html(r.data.content);
|
||||||
|
readerContentTitle();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
function readerContentTitle() {
|
||||||
|
// 清空标题列表
|
||||||
|
$("#title-list ul").empty();
|
||||||
|
// 提取 h1 标题
|
||||||
|
var h1Titles = $("#rendered-content").find("h2");
|
||||||
|
h1Titles.each(function(index) {
|
||||||
|
var title = $(this);
|
||||||
|
var titleText = title.text();
|
||||||
|
var titleId = "title-" + index;
|
||||||
|
title.attr("id", titleId);
|
||||||
|
var listItem = $("<li>");
|
||||||
|
var link = $("<a>", {
|
||||||
|
href: "#" + titleId,
|
||||||
|
text: (index+1+'. ')+titleText
|
||||||
|
});
|
||||||
|
listItem.append(link);
|
||||||
|
$("#title-list ul").append(listItem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user