<div class="form-group form-group-line"></div>
  <div class="meta-setting">
    <div class="meta-setting-header">
      <h3>Meta Tag 设置</h3>
      @if(config('managerLang') == config('setting.lang') && isset($type))
        <div class="meta-setting-header-btn">
          <i class="iconfont icon-shengcheng"></i><span>智能生成TDK</span>
        </div>
      @endif
    </div>
    <div class="meta-setting-from">
      <div class="meta-setting-from-input">
        <span>标题</span>
        {!! Form::text("description[{$managerLang}][seo_title]", isset($descriptions[$managerLang]) ? $descriptions[$managerLang][0]->seo_title : '', ['class'=>'form-control']) !!}
      </div>
      <div class="meta-setting-from-input">
        <span>关键词</span>
        {!! Form::text("description[{$managerLang}][seo_keywords]", isset($descriptions[$managerLang]) ? $descriptions[$managerLang][0]->seo_keywords : '', ['class'=>'form-control']) !!}
      </div>
      <div class="meta-setting-from-input">
        <span>描述</span>
        {!! Form::textarea("description[{$managerLang}][seo_description]", isset($descriptions[$managerLang]) ? $descriptions[$managerLang][0]->seo_description : '', ['class'=>'form-control', 'rows'=>3]) !!}
      </div>
    </div>
  </div>
  @if(isset($type))
    <script>
        window.onload = function () {
            var status = false
            $(".meta-setting-header-btn").click(function() {
                if (status) {
                    alert('请不要重复点击！')
                    return
                }
                status = true
                const tags = $('[name="tags[]"]').val();
                const title = $('[name="description[{{$managerLang}}][title]').val();
                const cname = $('[name="description[{{$managerLang}}][cname]').val();
                const content = $('[name="description[{{$managerLang}}][content]').val();
                $.ajax({
                    type: 'get',
                  @if($type == 'news')
                  url: '{{url("/admin/seo/news")}}',
                  @else
                  url: '{{url("/admin/seo/newsCate")}}',
                  @endif
                  timeout: 10000,
                    data: {
                      @if($type == 'news')
                      title: title,
                        tags: tags,
                        content: content
                      @else
                      title: cname,
                      tags: tags
                      @endif
                    },
                    success: function (res) {
                        if (res.status === 'success') {
                            for (let key in res.data) {
                                $('[name="description[{{$managerLang}}][seo_'+key+']"]').val(res.data[key])
                            }
                        }
                        status = false
                    },
                    error: function (error) {
                        console.log(error)
                        status = false
                    }
                })
            })
        }
    </script>
  @endif