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,48 +4,83 @@ namespace App\Controllers;
use App\Models;
class Doc extends \Core\Controller
{
function docTypeAction(){
function docTypeAction()
{
$docModel = new Models\Doc();
$types = $docModel->getTypes();
$type = json_encode($types,JSON_FORCE_OBJECT);
$this->JsonResp(200,$type,"ok");
$type = json_encode($types, JSON_FORCE_OBJECT);
$this->JsonResp(200, $type, "ok");
}
public function docsAction(){
if(isset($this->input->id)){
public function docsAction()
{
if (isset($this->input->id)) {
$docs = new Models\Doc();
$ret = $docs->docs($this->input->id);
$this->JsonResp(200,$ret,"OK");
}else{
$this->JsonResp(200,null,"error");
$this->JsonResp(200, $ret, "OK");
} else {
$this->JsonResp(200, null, "error");
}
}
public function docAction(){
if(isset($this->input->id)) {
public function docAction()
{
if (isset($this->input->id)) {
$docs = new Models\Doc();
$ret = $docs->doc($this->input->id);
$this->JsonResp(200,$ret,"OK");
}else{
$this->JsonResp(200,null,"error");
$this->JsonResp(200, $ret, "OK");
} else {
$this->JsonResp(200, null, "error");
}
}
public function docTitleAction(){
public function docTitleAction()
{
$docs = new Models\Doc();
$ret = $docs->AllTitle();
$this->JsonResp(200,$ret,"OK");
$this->JsonResp(200, $ret, "OK");
}
public function countAction(){
$docs = new Models\Doc();
$ret = $docs->Count();
$this->JsonResp(200,$ret,"OK");
public function countAction()
{
$docs = new Models\Doc();
$ret = $docs->Count();
$this->JsonResp(200, $ret, "OK");
}
// 查找文件名字
function articleSearchAction(){
if(isset($this->input->title)){
function articleSearchAction()
{
if (isset($this->input->title)) {
$docModel = new Models\Doc();
$titles = $docModel->titleLikeDoc($this->input->title);
$this->JsonResp(0,$titles,"OK");
}else{
$this->JsonResp(200,null,"error");
$this->JsonResp(0, $titles, "OK");
} else {
$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(){
$docModel = new Models\Doc();
$fisrtpage = $docModel->topDoc();
$limit = 5;
$offset = 0;
$firstpagedocs = [];
$typedocs = $docModel->getAllTypeDocs();
$titles = $docModel->AllTitle();
$groups = $docModel->getGroups();
$groupstype = $docModel->GetAllGroupType();
if(sizeof($this->params) == 2){
$limit = $this->params[0];
$offset = $this->params[1];
}
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) {
$obj['title'] = $value['title'];
@ -65,7 +67,7 @@ class NewUi extends Controller
}
function articleAction(){
if(sizeof($this->params) < 2){
}
}
}

View File

@ -73,6 +73,20 @@ class Doc extends Model
$recv = $stmt->fetchAll();
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){
if(is_integer($id)){
$db = static::getDB();

View File

@ -21,7 +21,7 @@
</ul>
<div id="myTabContent" class="tab-content">
<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 id="grouptab" class="col-md-1" style="background: #bbbbbb; text-align: center;padding: 10px;">
<ul class="nav nav-tabs" style="font-size: 12px;">
@ -34,15 +34,15 @@
{% endfor %}
</ul>
</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">
{% 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;">
{% for keys,types in group_type.arr %}
<li style="width: 100%; background:#d4ccb0;">
<a style="background:#d4ccb0;" href="#doc_type_{{ keys }}" data-toggle="tab">
{{ keys }} {{types.type_name}}
<a style="background:#d4ccb0;" href="#doc_type_{{ keys }}" data-toggle="tab" onclick="loadtypedoc(this)" >
{{types.type_name}}
</a>
</li>
{% endfor %}
@ -67,19 +67,23 @@
{% endfor %}
</div>
</div>
<div class="col-md-7" style="padding: 0px;" >
<div class="panel panel-default">
<div class="panel-heading">面板标题</div>
<div class="col-lg-8" style="padding: 0px;" >
{% for doc in docs %}
<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">
<p>这是一个基本的面板内容。这是一个基本的面板内容。
这是一个基本的面板内容。这是一个基本的面板内容。
这是一个基本的面板内容。这是一个基本的面板内容。
这是一个基本的面板内容。这是一个基本的面板内容。
</p>
{{ doc.content | raw }}
</div>
</div>
{% endfor %}
</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>
@ -89,23 +93,56 @@
</div>
</div>
<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 src="/api/App/Views/blog/js/bootstrap-treeview.js"></script>
<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;
baseUrl = "";
function startRequest()
{
if(globalposx > 250){
$('#grouptab').fadeOut(1000);
}
if(globalposx > 400){
$('#doctype').fadeOut(1000);
}
if(globalposx > 500){
$('#docs').fadeOut(1000);
}
}
}
$(document).ready(
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() {
var defaultData = [
{
@ -162,9 +199,8 @@
data: defaultData
})
setInterval("startRequest()",1000);
$('#docs').hide();
$('#doctype').hide();
$('#doc_type_5').addClass("active");
$('#group_key_0').addClass("active");
});
$(document).mousemove(function(e){

View File

@ -48,7 +48,9 @@ abstract class Controller
}
$this->route_params = $route_params;
$this->params = explode('/',$route_params['id']);
if(isset($route_params['id'])){
$this->params = explode('/',$route_params['id']);
}
}
/**
* Magic method called when a non-existent or inaccessible method is