<?php

/* ========================================================================
 * $Id: links.php 1407 2020-07-09 00:46:20Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onez.cn
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');
# 资源导航
# links
#请求数据
if($MODE=='$post'){
  $action=onez()->gp('action');
  if($action=='data'){
    $items=array();
    $T2=$G['this']->data()->open('links.categorys')->record("1 order by step desc,id");
    foreach($T2 as $rs){
      $links=array();
      $T3=$G['this']->data()->open('links')->record("upid='$rs[id]' order by step desc,id");
      foreach($T3 as $r){
        !$r['icon'] && $r['icon']='http://cdn.onez.cn/icons/2020/0627/2020062717291039510001.svg';
        $links[]=array(
          'name'=>$r['name'],
          'icon'=>$r['icon'],
          'link'=>$r['link'],
          'summary'=>$r['summary'],
        );
      }
      $items[]=array(
        'name'=>$rs['name'],
        'links'=>$links,
      );
    }
    $A['items']=$items;
  }
  return;
}
?>
<div class="head">
  <onez-search-small placeholder="请填写您要搜索的关键词" :value="kw" @search="search" />
</div>
<div class="links" v-if="$items && kw.length>0">
  <h3>搜索结果<span @click="clear"><i class="layui-icon layui-icon-close-fill"></i></span></h3>
  <dl>
    <dd>
      <onez-links-link :data="link" islink v-for="link in links" />
    </dd>
  </dl>
</div>
<div class="links">
  <dl v-for="item in items">
    <dt>{{item.name}}</dt>
    <dd>
      <onez-links-link :data="link" islink v-for="link in item.links" />
    </dd>
  </dl>
</div>