no message

doctree
zcy 2022-04-18 22:45:55 +08:00
parent d3bb6431d7
commit fa155ecde1
5 changed files with 21 additions and 48 deletions

View File

@ -23,7 +23,7 @@ class NewUi extends Controller
$groups = $docModel->getGroups(); $groups = $docModel->getGroups();
$doc_all = $redis->get("artilcetree"); $doc_all = $redis->get("artilcetree");
if( $doc_all == ""){ if( $doc_all == ""){
$doc_all = $docModel->getArticlesTree((int)$this->params[0]); $doc_all = $docModel->getArticlesTree(-1);
$redis->set("artilcetree", $doc_all); $redis->set("artilcetree", $doc_all);
} }

View File

@ -176,7 +176,20 @@ class Doc extends Model
'isParent'=> false, 'isParent'=> false,
'url' => \App\Config::Url() . "ArticleTree/article/" . $value['id']."/".$value['title'], 'url' => \App\Config::Url() . "ArticleTree/article/" . $value['id']."/".$value['title'],
'father' => (int)$value['father'], 'father' => (int)$value['father'],
'level' => $value['level']
); );
if($tmp['level'] == '0') {
$tmp = array(
'name' => $value['title'],
'id' =>$value['id'],
'isParent'=> false,
'url' => \App\Config::Url() . "ArticleTree/article/" . $value['id']."/".$value['title'],
'father' => (int)$value['father'],
'level' => $value['level'],
'open' => true
);
}
if($opendocid == $value['father']) if($opendocid == $value['father'])
$tmp['open'] = true; $tmp['open'] = true;
$mapforbuildtree[$value['id']] = $tmp; $mapforbuildtree[$value['id']] = $tmp;

View File

@ -178,6 +178,10 @@ function expandNode(e) {
onMouseDown: onMouseDown, onMouseDown: onMouseDown,
} }
}; };
var obj = $('#treeDemo' + "{{id}}" + "_span");
console.log("fasdfasdfasdfsad",obj);
var jsonData = "{{treedoc}}" var jsonData = "{{treedoc}}"
jsonData = jsonData.replace(/&/g, "&"); jsonData = jsonData.replace(/&/g, "&");
jsonData = jsonData.replace(/&lt;/g, "<"); jsonData = jsonData.replace(/&lt;/g, "<");
@ -185,7 +189,6 @@ function expandNode(e) {
jsonData = jsonData.replace(/&nbsp;/g, " "); jsonData = jsonData.replace(/&nbsp;/g, " ");
jsonData = jsonData.replace(/&quot;/g, "\""); jsonData = jsonData.replace(/&quot;/g, "\"");
console.log(jsonData)
znode = $.parseJSON(jsonData) znode = $.parseJSON(jsonData)
console.log(znode) console.log(znode)
$(document).ready(function(){ $(document).ready(function(){

View File

@ -9,6 +9,7 @@
} }
}; };
var jsonData = "{{treedoc}}" var jsonData = "{{treedoc}}"
jsonData = jsonData.replace(/&amp;/g, "&"); jsonData = jsonData.replace(/&amp;/g, "&");
jsonData = jsonData.replace(/&lt;/g, "<"); jsonData = jsonData.replace(/&lt;/g, "<");
jsonData = jsonData.replace(/&gt;/g, ">"); jsonData = jsonData.replace(/&gt;/g, ">");
@ -19,6 +20,8 @@
console.log(znode) console.log(znode)
$(document).ready(function(){ $(document).ready(function(){
$.fn.zTree.init($("#treeDemo"), setting, znode); $.fn.zTree.init($("#treeDemo"), setting, znode);
var obj = $('#treeDemo' + "{{id}}" + "_span");
console.log("fasdfasdfasdfsad",obj);
}); });
</SCRIPT> </SCRIPT>
@ -31,51 +34,6 @@
</ul> </ul>
</div> </div>
</div> </div>
<!--
<div id="grouptab" class="col-md-1" style="background: #bbbbbb; text-align: center;padding: 10px;">
<ul class="nav nav-tabs" style="font-size: 12px;">
{% for key,group in groups %}
<li >
<a href="#group_key_{{key}}" data-toggle="tab">
1级索引{{group}}
</a>
</li>
{% endfor %}
</ul>
</div>
<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; 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" onclick="loadtypedoc(this)" >
{{types.type_name}}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endfor %}
</div>
</div>
<div class="col-md-2" style="padding: 0px;" id="docs">
<div id="typedocContent" class="tab-content">
{% for key,typedoc in typedocs %}
<div id="doc_type_{{typedoc.key}}" class="tab-pane" style="background:#d4ccb0; padding: 0px;" >
<ul class="nav nav-tabs" style="font-size: 12px;">
{% for docid,doc in typedoc.arr %}
<li class="active" style="width: 100%; background:#d4ccb0;">
<a style="background:#d4ccb0;" href="{{ url }}NewUi/article/{{ docid }}/{{ doc.title }}">
{{doc.title}}
</a></li>
{% endfor %}
</ul>
</div>
{% endfor %}
</div>
</div> -->
<div class="col-lg-8" style="padding: 0px;" id="docshow" > <div class="col-lg-8" style="padding: 0px;" id="docshow" >
{% for doc in docs %} {% for doc in docs %}
<div class="panel panel-default" id="doc_id_{{ doc.id }}" style="letter-spacing: 0.4px;"> <div class="panel panel-default" id="doc_id_{{ doc.id }}" style="letter-spacing: 0.4px;">

View File

@ -60,7 +60,6 @@ abstract class Model
$dsn = 'mysql:host=117.50.176.114' . ';dbname=' . Config::DB_NAME . ';charset=utf8'; $dsn = 'mysql:host=117.50.176.114' . ';dbname=' . Config::DB_NAME . ';charset=utf8';
else else
$dsn = 'mysql:host=127.0.0.1' . ';dbname=' . Config::DB_NAME . ';charset=utf8'; $dsn = 'mysql:host=127.0.0.1' . ';dbname=' . Config::DB_NAME . ';charset=utf8';
// var_dump($dsn);
try { try {
$db = new PDO($dsn, Config::DB_USER, Config::DB_PASSWORD,$ssl); $db = new PDO($dsn, Config::DB_USER, Config::DB_PASSWORD,$ssl);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);