完善界面

deploy
DESKTOP-4RNDQIC\29019 2020-08-01 17:02:05 +08:00
parent 1e20c4d4e9
commit 2a063bf6ca
5 changed files with 109 additions and 70 deletions

View File

@ -43,7 +43,7 @@ class Config
if (true == Config::$DEBUG){
return "/api/public/";
}else{
return "/wapi/Blog/";
return "/wapi/";
}
}
static public function ServerUrl(){

View File

@ -24,7 +24,7 @@ class NewUi extends Controller
$limit = $this->params[0];
$offset = $this->params[1];
}
$fisrtpage = $docModel->pageDoc($limit,$offset,5);
$fisrtpage = $docModel->pageDoc($limit,$offset,55);
$top5 = $docModel->top5Doc();
foreach ($fisrtpage as $key => $value) {
$obj['title'] = $value['title'];
@ -74,18 +74,13 @@ class NewUi extends Controller
}
$docModel = new Models\Doc();
$limit = 5;
$offset = 0;
$firstpagedocs = [];
$typedocs = $docModel->getAllTypeDocs();
$doc = $docModel->doc((int)$this->params[0]);
$titles = $docModel->AllTitle();
$groups = $docModel->getGroups();
$groupstype = $docModel->GetAllGroupType();
if(sizeof($this->params) == 2){
$limit = $this->params[0];
$offset = $this->params[1];
}
$fisrtpage = $docModel->pageDoc(5,0,5);
$markdown = new Parsedown;
$doc[0]['content'] = $markdown->text($doc[0]['content']);
@ -139,4 +134,62 @@ class NewUi extends Controller
]);
}
}
function searchAction()
{
if (sizeof($this->querys) != 0) {
$docModel = new Models\Doc();
$commentModel = new Models\DocComment();
$doc = $docModel->titleDoc(rawurldecode($this->querys['title']));
$id = $doc[0]["id"];
$markdown = new Parsedown;
$content = $markdown->text($doc[0]['content']);
$typedocs = $docModel->getAllTypeDocs();
$doccoment = $commentModel->DocComments($id);
$titles = $docModel->AllTitle();
$top5 = $docModel->top5Doc();
$groups = $docModel->getGroups();
$groupstype = $docModel->GetAllGroupType();
if (\App\Config::$DEBUG)
View::renderTemplate("/blog/article.html",
[
"url"=>\App\Config::ServerUrl(),
'route'=>'article',
'index'=>true,
'debug'=>true,
"typedocs" => $typedocs,
"alltitle" => $titles,
"groups" => $groups,
"group_types"=>$groupstype,
"title"=>urldecode ($this->querys['title']),
"doc"=>$doc[0],
"comments" => $doccoment,
"comment_count" => count($doccoment),
"doc_type"=>$doc[0]["type"],
"group_type"=>$docModel->TypeGroup($doc[0]["type"])[0][0],
"topdoc"=>$top5,
]);
else
View::renderTemplate("/blog/article.html", [
"url"=>\App\Config::ServerUrl(),
'route'=>'article',
'index'=>true,
'debug'=>true,
"typedocs" => $typedocs,
"alltitle" => $titles,
"groups" => $groups,
"group_types"=>$groupstype,
"title"=>urldecode ($this->querys['title']),
"doc"=>$doc[0],
"comments" => $doccoment,
"comment_count" => count($doccoment),
"doc_type"=>$doc[0]["type"],
"group_type"=>$docModel->TypeGroup($doc[0]["type"])[0][0],
"topdoc"=>$top5,
]);
} else {
View::renderTemplate("/blog/article.html", ['title' => 'test', 'index' => false]);
}
}
}

View File

@ -10,6 +10,9 @@
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<script src="/api/App/Views/blog/js//jquery-editable-select.min.js"></script>
<script src="/api/App/Views/blog/js//bootstrap-treeview.min.js"></script>
<link href="/api/App/Views/blog/css/jquery-editable-select.min.css" rel="stylesheet">
</head>
<body style="background: #eee">
@ -20,10 +23,20 @@
</a>
</li>
<li>
<a href="#ios" data-toggle="tab">
备忘录
<a href="#notes" data-toggle="tab">
关于本博客
</a>
</li>
<li style="margin-top: 12px;">文章搜索</li>
<li style="margin-top: 12px" id="search">
<form style="margin-left: 5px;">
<select id="editable-select" style="width: 300px; height: 30px;margin-top: -10px;color: black; " >
{% for title in alltitle %}
<option>{{ title.title }}</option>
{% endfor %}
</select>
</form>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="home">
@ -145,7 +158,28 @@
</div>
</div>
<div class="tab-pane fade" id="notes">
<!-- 左对齐 -->
<div class="media col-md-3" style="margin-left: auto;margin-top: 20px;">
<div class="media-left">
<img src="img_avatar1.png" class="media-object" style="width:60px">
</div>
<div class="media-body ">
<h4 class="media-heading"> 关于博主</h4>
<h5 class="media-heading"> an actually real engineer</h5>
<p>通信工程专业毕业,7年软件开发经验</p>
<h4 class="media-heading">技术栈:</h4>
<p>精通c/c++</p>
<p>精通golang</p>
<p>熟悉常见的脚本,js,lua,python,php</p>
<p>熟悉常见的脚本,js,lua,python,php</p>
<p>熟悉电路基础fpga,采样,数字基带,单片机</p>
<h4 class="media-heading">耕耘领域:</h4>
<p>服务端开发</p>
<p>嵌入式开发</p>
</div>
</div>
</div>
<div class="list-group col-lg-1" style="position: fixed; bottom: 10px;left: 10px">
<a class="list-group-item active">
最新文章
@ -255,59 +289,18 @@
if(domain == "192.168.3.100"){
baseUrl = 'http://192.168.3.100/api/public/';
}
$('#editable-select').editableSelect({
effects: 'slide',
appendTo: '#search',
duration: 200,
}
).on('select.editable-select',function (e,li) {
window.location.replace("{{ url }}NewUi/search?title=" + li.text() + "&type=0");
});
$(".es-list").left = $("#editable-select").offset().left;
})
$(function() {
var defaultData = [
{
text: 'Parent 1',
href: '#parent1',
tags: ['4'],
nodes: [
{
text: 'Child 1',
href: '#child1',
tags: ['2'],
nodes: [
{
text: 'Grandchild 1',
href: '#grandchild1',
tags: ['0']
},
{
text: 'Grandchild 2',
href: '#grandchild2',
tags: ['0']
}
]
},
{
text: 'Child 2',
href: '#child2',
tags: ['0']
}
]
},
{
text: 'Parent 2',
href: '#parent2',
tags: ['0']
},
{
text: 'Parent 3',
href: '#parent3',
tags: ['0']
},
{
text: 'Parent 4',
href: '#parent4',
tags: ['0']
},
{
text: 'Parent 5',
href: '#parent5' ,
tags: ['0']
}
];
$('#treeview1').treeview({
data: defaultData

View File

@ -209,10 +209,8 @@ ul li a{
firstinit = true;
}else{
}
console.log($("#doc_type_{{type}}").innerText);
$("#doc_type_{{type}}").addClass("active");
$("#doc_type_{{type}}").find('ul.subMenu').slideDown();
console.log({{type}});
},1000);
$('#editable-select').editableSelect({
effects: 'slide',
@ -220,11 +218,7 @@ ul li a{
duration: 200,
}
).on('select.editable-select',function (e,li) {
console.log(li.text());
window.location.replace("{{ url }}article?title=" + li.text() + "&type=0");
window.location.replace("{{ url }}NewUi/search?title=" + li.text() + "&type=0");
});
function toTitle() {
console.log($('#editable-select').innerText);
}
</script>
</body>

View File

@ -243,8 +243,7 @@
duration: 200,
}
).on('select.editable-select',function (e,li) {
console.log(li.text());
window.location.replace("{{ url }}NewUi/article?title=" + li.text() + "&type=0");
window.location.replace("{{ url }}NewUi/search?title=" + li.text() + "&type=0");
});
$(".es-list").left = $("#editable-select").offset().left;
})