no message

deploy
DESKTOP-4RNDQIC\29019 2020-07-12 15:59:34 +08:00
parent 58ab432f9d
commit 117569811a
5 changed files with 147 additions and 58 deletions

View File

@ -4,13 +4,16 @@ namespace App\Controllers;
use App\Models; use App\Models;
class Doc extends \Core\Controller class Doc extends \Core\Controller
{ {
function docTypeAction(){ function docTypeAction()
{
$docModel = new Models\Doc(); $docModel = new Models\Doc();
$types = $docModel->getTypes(); $types = $docModel->getTypes();
$type = json_encode($types, JSON_FORCE_OBJECT); $type = json_encode($types, JSON_FORCE_OBJECT);
$this->JsonResp(200, $type, "ok"); $this->JsonResp(200, $type, "ok");
} }
public function docsAction(){
public function docsAction()
{
if (isset($this->input->id)) { if (isset($this->input->id)) {
$docs = new Models\Doc(); $docs = new Models\Doc();
$ret = $docs->docs($this->input->id); $ret = $docs->docs($this->input->id);
@ -19,7 +22,9 @@ class Doc extends \Core\Controller
$this->JsonResp(200, null, "error"); $this->JsonResp(200, null, "error");
} }
} }
public function docAction(){
public function docAction()
{
if (isset($this->input->id)) { if (isset($this->input->id)) {
$docs = new Models\Doc(); $docs = new Models\Doc();
$ret = $docs->doc($this->input->id); $ret = $docs->doc($this->input->id);
@ -28,18 +33,24 @@ class Doc extends \Core\Controller
$this->JsonResp(200, null, "error"); $this->JsonResp(200, null, "error");
} }
} }
public function docTitleAction(){
public function docTitleAction()
{
$docs = new Models\Doc(); $docs = new Models\Doc();
$ret = $docs->AllTitle(); $ret = $docs->AllTitle();
$this->JsonResp(200, $ret, "OK"); $this->JsonResp(200, $ret, "OK");
} }
public function countAction(){
public function countAction()
{
$docs = new Models\Doc(); $docs = new Models\Doc();
$ret = $docs->Count(); $ret = $docs->Count();
$this->JsonResp(200, $ret, "OK"); $this->JsonResp(200, $ret, "OK");
} }
// 查找文件名字 // 查找文件名字
function articleSearchAction(){ function articleSearchAction()
{
if (isset($this->input->title)) { if (isset($this->input->title)) {
$docModel = new Models\Doc(); $docModel = new Models\Doc();
$titles = $docModel->titleLikeDoc($this->input->title); $titles = $docModel->titleLikeDoc($this->input->title);
@ -48,4 +59,28 @@ class Doc extends \Core\Controller
$this->JsonResp(200, null, "error"); $this->JsonResp(200, null, "error");
} }
} }
function typedocAction()
{
$limit = 5;
$type = 0;
$offset = 0;
if (len($this->params) == 3) {
$limit = $this->params[0];
$offset = $this->params[1];
$type = $this->params[3];
}
$docModel = new Models\Doc();
$typedoc = $docModel->pageDoc($limit, $offset, $type);
$this->JsonResp(200, $typedoc, "error");
}
function typeCountAction()
{
$type = $this->params[0];
$docModel = new Models\Doc();
$count = $docModel->typeCounts($type);
$this->JsonResp(200, $count, "error");
}
} }

View File

@ -13,18 +13,20 @@ class NewUi extends Controller
{ {
function indexAction(){ function indexAction(){
$docModel = new Models\Doc(); $docModel = new Models\Doc();
$fisrtpage = $docModel->topDoc(); $limit = 5;
$offset = 0;
$firstpagedocs = []; $firstpagedocs = [];
$typedocs = $docModel->getAllTypeDocs(); $typedocs = $docModel->getAllTypeDocs();
$titles = $docModel->AllTitle(); $titles = $docModel->AllTitle();
$groups = $docModel->getGroups(); $groups = $docModel->getGroups();
$groupstype = $docModel->GetAllGroupType(); $groupstype = $docModel->GetAllGroupType();
if(sizeof($this->params) == 2){
$limit = $this->params[0];
$offset = $this->params[1];
}
echo "<pre>"; echo "<pre>";
print_r($this->route_params);
print_r($this->params);
echo "</pre>"; echo "</pre>";
$fisrtpage = $docModel->pageDoc($limit,$offset,5);
foreach ($fisrtpage as $key => $value) { foreach ($fisrtpage as $key => $value) {
$obj['title'] = $value['title']; $obj['title'] = $value['title'];

View File

@ -73,6 +73,20 @@ class Doc extends Model
$recv = $stmt->fetchAll(); $recv = $stmt->fetchAll();
return $recv; return $recv;
} }
public function typeCounts($type){
$db = static::getDB();
$stmt = $db->query('select count(id) from doc where doc.type = '.$type);
$recv = $stmt->fetchAll();
return $recv;
}
public function pageDoc($limit ,$offset,$type){
$result = [];
$db = static::getDB();
$stmt = $db->query('select * from doc where doc.type = '.$type. ' limit '.$limit.' offset '.$offset);
$recv = $stmt->fetchAll();
print_r('select * from doc where doc.type = '.$type. ' limit '.$limit.' offset '.$offset);
return $recv;
}
public function doc($id){ public function doc($id){
if(is_integer($id)){ if(is_integer($id)){
$db = static::getDB(); $db = static::getDB();

View File

@ -21,7 +21,7 @@
</ul> </ul>
<div id="myTabContent" class="tab-content"> <div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="home"> <div class="tab-pane fade in active" id="home">
<div class="container" style="padding: 5px; margin: 0px"> <div class="container" style="padding: 5px; margin: 0px;width: 100%">
<div class="row"> <div class="row">
<div id="grouptab" class="col-md-1" style="background: #bbbbbb; text-align: center;padding: 10px;"> <div id="grouptab" class="col-md-1" style="background: #bbbbbb; text-align: center;padding: 10px;">
<ul class="nav nav-tabs" style="font-size: 12px;"> <ul class="nav nav-tabs" style="font-size: 12px;">
@ -34,15 +34,15 @@
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
<div id="doctype" class="col-md-2" style="background: #d4ccb0;padding: 0px;"> <div id="doctype" class="col-md-1" style="background: #d4ccb0;padding: 0px;">
<div id="grouptabContent" class="tab-content"> <div id="grouptabContent" class="tab-content">
{% for key,group_type in group_types %} {% for key,group_type in group_types %}
<div id="group_key_{{key}}" class="tab-pane" style="background:#d4ccb0;" > <div id="group_key_{{key}}" class="tab-pane" style="background:#d4ccb0; margin-left: 5px;" >
<ul class="nav nav-tabs" style="font-size: 12px;"> <ul class="nav nav-tabs" style="font-size: 12px;">
{% for keys,types in group_type.arr %} {% for keys,types in group_type.arr %}
<li style="width: 100%; background:#d4ccb0;"> <li style="width: 100%; background:#d4ccb0;">
<a style="background:#d4ccb0;" href="#doc_type_{{ keys }}" data-toggle="tab"> <a style="background:#d4ccb0;" href="#doc_type_{{ keys }}" data-toggle="tab" onclick="loadtypedoc(this)" >
{{ keys }} {{types.type_name}} {{types.type_name}}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}
@ -67,19 +67,23 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
<div class="col-md-7" style="padding: 0px;" > <div class="col-lg-8" style="padding: 0px;" >
<div class="panel panel-default"> {% for doc in docs %}
<div class="panel-heading">面板标题</div> <div class="panel panel-default" id="doc_id_{{ doc.id }}">
<div class="panel-heading" style="font-size: 20px ; background: #1d5987;color: white">{{ doc.title }}</div>
<div class="panel-body"> <div class="panel-body">
<p>这是一个基本的面板内容。这是一个基本的面板内容。 {{ doc.content | raw }}
这是一个基本的面板内容。这是一个基本的面板内容。
这是一个基本的面板内容。这是一个基本的面板内容。
这是一个基本的面板内容。这是一个基本的面板内容。
</p>
</div> </div>
</div> </div>
{% endfor %}
</div> </div>
</div> </div>
<div class="row">
<ul class="pagination" style="margin-left: 50%" id="pagenation">
<li><a href="#">&laquo;</a></li>
<li><a href="#">&raquo;</a></li>
</ul>
</div>
</div> </div>
</div> </div>
@ -89,23 +93,56 @@
</div> </div>
</div> </div>
<script src="/api/App/Views/blog/js/bootstrap-treeview.js"></script>
<script src="/api/App/Views/blog/js//jquery-2.1.0.min.js"></script>
<script src="/api/App/Views/blog/js//bootstrap-treeview.js"></script>
<script type="text/javascript"> <script type="text/javascript">
function loadtypedoc(data){
console.log(data.href.split("#")[1].split("doc_type_")[1]);
$.ajax({
method: "POST",
url: baseUrl + "Doc/typeCount/" + data.href.split("#")[1].split("doc_type_")[1],
async: false,
dataType: "json",
beforeSend: function (xhr) {
//xhr.setRequestHeader("x-requested-with","DESKTOP_WEB");
},
success: function (data) {
count = data['data']['0'][0];
console.log(count);
page = 0;
if(count %5 == 0){
page = count /5;
}
page = count/5 +1;
$("#pagenation").empty();
for(i = 0;i < page; i++){
li = $("<li><a>" + i + "</a></li>");
$("#pagenation").append(li);
}
}
});
}
globalposx = 0; globalposx = 0;
baseUrl = "";
function startRequest() function startRequest()
{ {
if(globalposx > 250){ if(globalposx > 250){
$('#grouptab').fadeOut(1000); $('#grouptab').fadeOut(1000);
} }
if(globalposx > 400){
$('#doctype').fadeOut(1000);
} }
if(globalposx > 500){ $(document).ready(
$('#docs').fadeOut(1000); function () {
var domain = window.location.host;
if(domain === '127.0.0.1'){
console.log("debug mode");
}else{
console.log(baseUrl);
baseUrl = "https://www.testingcloud.club/wapi/";
} }
if(domain == "192.168.3.100"){
baseUrl = 'http://192.168.3.100/api/public/';
} }
})
$(function() { $(function() {
var defaultData = [ var defaultData = [
{ {
@ -162,9 +199,8 @@
data: defaultData data: defaultData
}) })
setInterval("startRequest()",1000); setInterval("startRequest()",1000);
$('#docs').hide(); $('#doc_type_5').addClass("active");
$('#doctype').hide(); $('#group_key_0').addClass("active");
}); });
$(document).mousemove(function(e){ $(document).mousemove(function(e){

View File

@ -48,8 +48,10 @@ abstract class Controller
} }
$this->route_params = $route_params; $this->route_params = $route_params;
if(isset($route_params['id'])){
$this->params = explode('/',$route_params['id']); $this->params = explode('/',$route_params['id']);
} }
}
/** /**
* Magic method called when a non-existent or inaccessible method is * Magic method called when a non-existent or inaccessible method is
* called on an object of this class. Used to execute before and after * called on an object of this class. Used to execute before and after