nav&top
This commit is contained in:
parent
ac854d627d
commit
868797f0bb
@ -168,148 +168,6 @@ abstract class BaseController
|
|||||||
return $domain . $articleUrl;
|
return $domain . $articleUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 关键词
|
|
||||||
* 通过百度分词接口获取关键词或者标签
|
|
||||||
* flag 1.为word时获取分词,2.为tag时获取标签
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function setKeywords($data)
|
|
||||||
{
|
|
||||||
$keywords = [];
|
|
||||||
// 百度分词自动生成关键词
|
|
||||||
if(!empty(config('taoler.baidu.client_id')) == true) {
|
|
||||||
//headers数组内的格式
|
|
||||||
$headers = array();
|
|
||||||
$headers[] = "Content-Type:application/json";
|
|
||||||
|
|
||||||
switch($data['flag']) {
|
|
||||||
//分词
|
|
||||||
case 'word':
|
|
||||||
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
|
|
||||||
$body = ["text" => $data['keywords']];
|
|
||||||
break;
|
|
||||||
//标签
|
|
||||||
case 'tag':
|
|
||||||
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/keyword?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
|
|
||||||
$body = ['title' => $data['keywords'], 'content'=>$data['content']];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
|
|
||||||
$body = ["text" => $data['keywords']];
|
|
||||||
}
|
|
||||||
|
|
||||||
$postBody = json_encode($body);
|
|
||||||
$curl = curl_init();
|
|
||||||
curl_setopt($curl, CURLOPT_URL, $url);
|
|
||||||
curl_setopt($curl, CURLOPT_POST, true);
|
|
||||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);//设置请求头
|
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postBody);//设置请求体
|
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');//使用一个自定义的请求信息来代替"GET"或"HEAD"作为HTTP请求。(这个加不加没啥影响)
|
|
||||||
$datas = curl_exec($curl);
|
|
||||||
if($datas == false) {
|
|
||||||
echo '接口无法链接';
|
|
||||||
} else {
|
|
||||||
$res = stripos($datas,'error_code');
|
|
||||||
// 接收返回的数据
|
|
||||||
$dataItem = json_decode($datas);
|
|
||||||
if($res == false) {
|
|
||||||
// 数据正常
|
|
||||||
$items = $dataItem->items;
|
|
||||||
foreach($items as $item) {
|
|
||||||
|
|
||||||
switch($data['flag']) {
|
|
||||||
case 'word':
|
|
||||||
if($item->pos == 'n' && !in_array($item->item,$keywords)){
|
|
||||||
$keywords[] = $item->item;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'tag':
|
|
||||||
if(!in_array($item->tag,$keywords)){
|
|
||||||
$keywords[] = $item->tag;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if($item->pos == 'n' && !in_array($item->item,$keywords)){
|
|
||||||
$keywords[] = $item->item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 接口正常但获取数据失败,可能参数错误,重新获取token
|
|
||||||
$url = 'https://aip.baidubce.com/oauth/2.0/token';
|
|
||||||
$post_data['grant_type'] = config('taoler.baidu.grant_type');;
|
|
||||||
$post_data['client_id'] = config('taoler.baidu.client_id');
|
|
||||||
$post_data['client_secret'] = config('taoler.baidu.client_secret');
|
|
||||||
|
|
||||||
$o = "";
|
|
||||||
foreach ( $post_data as $k => $v )
|
|
||||||
{
|
|
||||||
$o.= "$k=" . urlencode( $v ). "&" ;
|
|
||||||
}
|
|
||||||
$post_data = substr($o,0,-1);
|
|
||||||
$res = $this->request_post($url, $post_data);
|
|
||||||
// 写入token
|
|
||||||
SetArr::name('taoler')->edit([
|
|
||||||
'baidu'=> [
|
|
||||||
'access_token' => json_decode($res)->access_token,
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
echo 'api接口数据错误 - ';
|
|
||||||
echo $dataItem->error_msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $keywords;
|
|
||||||
}
|
|
||||||
|
|
||||||
// api_post接口
|
|
||||||
function request_post($url = '', $param = '')
|
|
||||||
{
|
|
||||||
if (empty($url) || empty($param)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$postUrl = $url;
|
|
||||||
$curlPost = $param;
|
|
||||||
$curl = curl_init();//初始化curl
|
|
||||||
curl_setopt($curl, CURLOPT_URL,$postUrl);//抓取指定网页
|
|
||||||
curl_setopt($curl, CURLOPT_HEADER, 0);//设置header
|
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
|
|
||||||
curl_setopt($curl, CURLOPT_POST, 1);//post提交方式
|
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
|
|
||||||
$data = curl_exec($curl);//运行curl
|
|
||||||
curl_close($curl);
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标题调用百度关键词词条
|
|
||||||
*
|
|
||||||
* @return Json
|
|
||||||
*/
|
|
||||||
public function getBdiduSearchWordList($words)
|
|
||||||
{
|
|
||||||
if(empty($words)) return json(['code'=>-1,'msg'=>'null']);
|
|
||||||
$url = 'https://www.baidu.com/sugrec?prod=pc&from=pc_web&wd='.$words;
|
|
||||||
//$result = Api::urlGet($url);
|
|
||||||
$curl = curl_init();
|
|
||||||
curl_setopt($curl, CURLOPT_URL, $url);
|
|
||||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
|
||||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
|
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
$datas = curl_exec($curl);
|
|
||||||
curl_close($curl);
|
|
||||||
$data = json_decode($datas,true);
|
|
||||||
if(isset($data['g'])) {
|
|
||||||
return json(['code'=>0,'msg'=>'success','data'=>$data['g']]);
|
|
||||||
} else {
|
|
||||||
return json(['code'=>-1,'msg'=>'null']);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传接口
|
* 上传接口
|
||||||
@ -356,7 +214,6 @@ abstract class BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//下载远程图片
|
//下载远程图片
|
||||||
private function downloadImage($url)
|
private function downloadImage($url)
|
||||||
{
|
{
|
||||||
|
@ -288,29 +288,6 @@ class Forum extends AdminController
|
|||||||
return $this->uploadFiles($type);
|
return $this->uploadFiles($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 调用百度关键词
|
|
||||||
*
|
|
||||||
* @return json
|
|
||||||
*/
|
|
||||||
public function getKeywords()
|
|
||||||
{
|
|
||||||
$data = Request::only(['flag','keywords','content']);
|
|
||||||
$keywords = $this->setKeywords($data);
|
|
||||||
return json(['code'=>0, 'msg' => 'ok', 'data'=> $keywords]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标题调用百度关键词词条
|
|
||||||
* @return Json
|
|
||||||
*/
|
|
||||||
public function getWordList()
|
|
||||||
{
|
|
||||||
$title = input('title');
|
|
||||||
return $this->getBdiduSearchWordList($title);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内容中是否有图片视频音频插入
|
* 内容中是否有图片视频音频插入
|
||||||
*
|
*
|
||||||
@ -332,18 +309,6 @@ class Forum extends AdminController
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 获取描述,过滤html
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function getDescription()
|
|
||||||
{
|
|
||||||
$data = Request::only(['content']);
|
|
||||||
$description = getArtContent($data['content']);
|
|
||||||
return json(['code'=>0,'data'=>$description]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类树
|
* 分类树
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>新增管理员</title>
|
<title>表单配置</title>
|
||||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
|
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -24,10 +24,10 @@
|
|||||||
{:form_radio($name,$vo.content,['label'=>$vo.title,'tips'=>$vo.tips],$vo.value)}
|
{:form_radio($name,$vo.content,['label'=>$vo.title,'tips'=>$vo.tips],$vo.value)}
|
||||||
{/case}
|
{/case}
|
||||||
{case value="checkbox"}
|
{case value="checkbox"}
|
||||||
{:form_checkbox($name, $vo.content,['label'=>$vo.title, 'verify' =>$vo.rule,'tips'=>$vo.tips,], $vo['value'])};
|
{:form_checkbox($name, $vo.content,['label'=>$vo.title, 'verify' =>$vo.rule,'tips'=>$vo.tips,], $vo['value'])}
|
||||||
{/case}
|
{/case}
|
||||||
{case value="switch"}
|
{case value="switch"}
|
||||||
{:form_switch($name, $vo.content,['label'=>$vo.title, 'verify' =>$vo.rule,'tips'=>$vo.tips,], $vo['value'])};
|
{:form_switch($name, $vo.content,['label'=>$vo.title, 'verify' =>$vo.rule,'tips'=>$vo.tips,], $vo['value'])}
|
||||||
{/case}
|
{/case}
|
||||||
{case value="select"}
|
{case value="select"}
|
||||||
{:form_select($name,$vo.content,['label'=>$vo.title,'verify'=>$vo.rule,'tips'=>$vo.tips,'search'=>1] ,[],$vo.value)}
|
{:form_select($name,$vo.content,['label'=>$vo.title,'verify'=>$vo.rule,'tips'=>$vo.tips,'search'=>1] ,[],$vo.value)}
|
||||||
@ -66,7 +66,7 @@
|
|||||||
<script>
|
<script>
|
||||||
layui.use(['upload','toast'], function(){
|
layui.use(['upload','toast'], function(){
|
||||||
var $ = layui.$,upload = layui.upload,form = layui.form,notify=layui.notify;
|
var $ = layui.$,upload = layui.upload,form = layui.form,notify=layui.notify;
|
||||||
//上传头像
|
//上传
|
||||||
upload.render({
|
upload.render({
|
||||||
elem: '.upload-select'
|
elem: '.upload-select'
|
||||||
,url: "{:url('addon.addons/uploads')}"
|
,url: "{:url('addon.addons/uploads')}"
|
||||||
|
@ -130,7 +130,10 @@
|
|||||||
|
|
||||||
form.on('submit(comment-query)', function(data) {
|
form.on('submit(comment-query)', function(data) {
|
||||||
table.reload('comment-table', {
|
table.reload('comment-table', {
|
||||||
where: data.field
|
where: data.field,
|
||||||
|
page: {
|
||||||
|
curr: 1 //重新从第 1 页开始
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>新增帖子</title>
|
<title>新增帖子</title>
|
||||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
|
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
|
||||||
|
<style>
|
||||||
|
#L_title {position: relative;}
|
||||||
|
.bdsug {height: auto; position: absolute; left: 0; top: 30px; z-index: 100; background: #fff; border-radius: 0 0 10px 10px; border: 1px solid #dadade!important; border-top: 0!important; box-shadow: none;}
|
||||||
|
.bdsug ul{display: block;margin: 5px 2px 0; padding: 5px 0 7px; background: 0 0; border-top: 0px solid #f5f5f6;}
|
||||||
|
.bdsug ul>li{margin-top: 0;height:30px;line-height: 25px;}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
@ -21,10 +27,6 @@
|
|||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" style="position:relative;" value=""/>
|
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" style="position:relative;" value=""/>
|
||||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" />
|
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" />
|
||||||
<div class="layui-input bdsug layui-hide">
|
|
||||||
<ul class="wordlist">
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-col-md1">
|
<div class="layui-col-md1">
|
||||||
@ -34,7 +36,7 @@
|
|||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<textarea id="L_content" name="content" required lay-verify="" placeholder="{:lang('please input the content')}" class="layui-textarea"> </textarea>
|
<textarea id="L_content" name="content" lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea taonyeditor"> </textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item layui-inline">
|
<div class="layui-form-item layui-inline">
|
||||||
@ -83,36 +85,12 @@
|
|||||||
|
|
||||||
<script src="/static/component/layui/layui.js"></script>
|
<script src="/static/component/layui/layui.js"></script>
|
||||||
<script src="/static/component/pear/pear.js"></script>
|
<script src="/static/component/pear/pear.js"></script>
|
||||||
<script src="/static/addons/taonyeditor/tinymce/tinymce.min.js"></script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
layui.extend({
|
layui.use(["form", "colorpicker", "upload",'xmSelect'], function () {
|
||||||
editor: '{/}/static/addons/taonyeditor/js/taonyeditor'
|
|
||||||
}).use(["form", "colorpicker", "upload",'editor','xmSelect'], function () {
|
|
||||||
var $ = layui.jquery, form = layui.form, colorpicker = layui.colorpicker, upload = layui.upload;
|
var $ = layui.jquery, form = layui.form, colorpicker = layui.colorpicker, upload = layui.upload;
|
||||||
var editor = layui.editor;
|
|
||||||
var xmSelect = layui.xmSelect;
|
var xmSelect = layui.xmSelect;
|
||||||
|
|
||||||
editor.render({
|
|
||||||
selector: 'textarea#L_content',
|
|
||||||
uploadUrl: "{:url('content.forum/uploads')}",
|
|
||||||
imagePrependUrl: "{$domain}"
|
|
||||||
});
|
|
||||||
|
|
||||||
//获取百度标签标志,tag或者word;
|
|
||||||
var flag = 'word';
|
|
||||||
|
|
||||||
// 从详情页自动调用端口过滤,获取描述信息
|
|
||||||
tinymce.get('L_content').on('mouseleave', function() {
|
|
||||||
var content = tinymce.get('L_content').getContent({format: 'text'});
|
|
||||||
content = content.replace(/[\r\n]/g,"").replace(/\n/g, '').replace(/\s/g, '').replace(/\t/g, '');
|
|
||||||
if(content.length >200) {
|
|
||||||
content = content.substring(0,200);
|
|
||||||
}
|
|
||||||
// var test = tinymce.activeEditor.getContent({format: 'text'});
|
|
||||||
$('[name="description"]').val(content);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 分类选择
|
// 分类选择
|
||||||
$.get("{:url('content.forum/getCateList')}",function(res){
|
$.get("{:url('content.forum/getCateList')}",function(res){
|
||||||
// 渲染下拉树
|
// 渲染下拉树
|
||||||
@ -164,63 +142,6 @@
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 通过接口自动获取tag的内容
|
|
||||||
var conf = "{:empty(config('taoler.baidu.client_id'))}";
|
|
||||||
if (conf !== "1") {
|
|
||||||
$("#L_title").on("blur", function () {
|
|
||||||
var title = $(this).val();
|
|
||||||
var content = $("#L_content").val();
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: "{:url('content.forum/getKeywords')}",
|
|
||||||
data: { keywords: title, content:content, flag: flag },
|
|
||||||
daType: "json",
|
|
||||||
success: function (data) {
|
|
||||||
if (data.code === 0) {
|
|
||||||
$("input[name='keywords']").val(data.data.join(','));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 百度词条
|
|
||||||
var baidu_title_switch = "{:config('taoler.config.baidu_title_switch')}";
|
|
||||||
if(baidu_title_switch === 1) {
|
|
||||||
$("#L_title").bind('input propertychange',function () {
|
|
||||||
var title = $(this).val();
|
|
||||||
var str = '';
|
|
||||||
if(title.length > 0 ) {
|
|
||||||
$.post("{:url('content.forum/getWordList')}",{title:title},function(res){
|
|
||||||
// 动态生成ur>li内容
|
|
||||||
if (res.code === 0) {
|
|
||||||
// 显示动态框
|
|
||||||
$(".bdsug").removeClass('layui-hide');
|
|
||||||
for (var i = 0; i < res.data.length; i++) {
|
|
||||||
//str += '<li data-key=' + res.data[i].q + '><b>' + res.data[i].q.replace(title,'') + '</b></li>';
|
|
||||||
str += '<li data-key=' + res.data[i].q + '><b>' + res.data[i].q + '</b></li>';
|
|
||||||
}
|
|
||||||
// 清空ul并追加li
|
|
||||||
$('.wordlist').empty().append(str);
|
|
||||||
// 点击李获取li值并复制给#L_title input的value
|
|
||||||
$(".bdsug li").on('click',function(){
|
|
||||||
var word = $(this).attr('data-key');
|
|
||||||
var words = title + '(' + word + ')';
|
|
||||||
$("#L_title").val(words);
|
|
||||||
// 关闭动态框
|
|
||||||
$(".bdsug").addClass('layui-hide');
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$(".bdsug").addClass('layui-hide');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$(".bdsug").addClass('layui-hide');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//上传附件
|
//上传附件
|
||||||
upload.render({
|
upload.render({
|
||||||
elem: "#zip-button",
|
elem: "#zip-button",
|
||||||
@ -282,5 +203,10 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
{:hook('taonyeditor')}
|
||||||
|
{// 百度标题词条}
|
||||||
|
{:hook('seoBaiduTitle')}
|
||||||
|
{// 百度关键词}
|
||||||
|
{:hook('seoBaiduKeywords')}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>修改页面</title>
|
<title>修改页面</title>
|
||||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
|
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
|
||||||
|
<style>
|
||||||
|
#L_title {position: relative;}
|
||||||
|
.bdsug {height: auto; position: absolute; left: 0; top: 30px; z-index: 100; background: #fff; border-radius: 0 0 10px 10px; border: 1px solid #dadade!important; border-top: 0!important; box-shadow: none;}
|
||||||
|
.bdsug ul{display: block;margin: 5px 2px 0; padding: 5px 0 7px; background: 0 0; border-top: 0px solid #f5f5f6;}
|
||||||
|
.bdsug ul>li{margin-top: 0;height:30px;line-height: 25px;}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
@ -32,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细内容" class="layui-textarea">{$article.content}</textarea>
|
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细内容" class="layui-textarea taonyeditor">{$article.content}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
@ -84,27 +90,16 @@
|
|||||||
</form>
|
</form>
|
||||||
<script src="/static/component/layui/layui.js"></script>
|
<script src="/static/component/layui/layui.js"></script>
|
||||||
<script src="/static/component/pear/pear.js"></script>
|
<script src="/static/component/pear/pear.js"></script>
|
||||||
<script src="/static/addons/taonyeditor/tinymce/tinymce.min.js"></script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
layui.extend({
|
layui.use(['colorpicker','form','upload','xmSelect'], function(){
|
||||||
editor: '{/}/static/addons/taonyeditor/js/taonyeditor'
|
|
||||||
}).use(['colorpicker','form','upload', 'editor','xmSelect'], function(){
|
|
||||||
var $ = layui.jquery
|
var $ = layui.jquery
|
||||||
,colorpicker = layui.colorpicker
|
,colorpicker = layui.colorpicker
|
||||||
,form = layui.form
|
,form = layui.form
|
||||||
,upload = layui.upload;
|
,upload = layui.upload;
|
||||||
var artId = "{$article.id}";
|
var artId = "{$article.id}";
|
||||||
var editor = layui.editor;
|
|
||||||
var xmSelect = layui.xmSelect;
|
var xmSelect = layui.xmSelect;
|
||||||
|
|
||||||
// 初始化编辑器
|
|
||||||
editor.render({
|
|
||||||
selector: 'textarea#L_content',
|
|
||||||
uploadUrl: "{:url('content.forum/uploads')}",
|
|
||||||
imagePrependUrl: "{$domain}"
|
|
||||||
});
|
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
//1.渲染标签
|
//1.渲染标签
|
||||||
var addTags = xmSelect.render({
|
var addTags = xmSelect.render({
|
||||||
@ -135,16 +130,6 @@
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
// 从详情页自动调用端口过滤,获取描述信息
|
|
||||||
tinymce.get('L_content').on('mouseleave', function() {
|
|
||||||
var content = tinymce.get('L_content').getContent({format: 'text'});
|
|
||||||
content = content.replace(/[\r\n]/g,"").replace(/\n/g, '').replace(/\s/g, '').replace(/\t/g, '');
|
|
||||||
if(content.length >200) {
|
|
||||||
content = content.substring(0,200);
|
|
||||||
}
|
|
||||||
// var test = tinymce.activeEditor.getContent({format: 'text'});
|
|
||||||
$('[name="description"]').val(content);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 分类选择
|
// 分类选择
|
||||||
$.get("{:url('content.forum/getCateList')}",function(res){
|
$.get("{:url('content.forum/getCateList')}",function(res){
|
||||||
@ -175,44 +160,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取描述的内容
|
|
||||||
$("#L_content").bind('input propertychange', function(){
|
|
||||||
var content = $(this).val()
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url:"{:url('content.forum/getDescription')}",
|
|
||||||
data:{"content":content},
|
|
||||||
daType:"json",
|
|
||||||
success:function (data){
|
|
||||||
if (data.code == 0) {
|
|
||||||
$('[name="description"]').val(data.data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
|
|
||||||
// 获取tag的内容
|
|
||||||
var conf = "{:empty(config('taoler.baidu.client_id'))}";
|
|
||||||
if(conf !== '1'){
|
|
||||||
$("#L_title").on('blur', function(){
|
|
||||||
var title = $(this).val();
|
|
||||||
var flag = 'on';
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url:"{:url('content.forum/getKeywords')}",
|
|
||||||
data:{"keywords":keywords,"flag":flag},
|
|
||||||
daType:"json",
|
|
||||||
success:function (data){
|
|
||||||
if (data.code === 0) {
|
|
||||||
$("input[name='keywords']").val("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//预定义颜色项
|
//预定义颜色项
|
||||||
colorpicker.render({
|
colorpicker.render({
|
||||||
elem: '#color'
|
elem: '#color'
|
||||||
@ -275,5 +222,10 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
{:hook('taonyeditor')}
|
||||||
|
{// 百度标题词条}
|
||||||
|
{:hook('seoBaiduTitle')}
|
||||||
|
{// 百度关键词}
|
||||||
|
{:hook('seoBaiduKeywords')}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -161,10 +161,10 @@
|
|||||||
el: '#CateId',
|
el: '#CateId',
|
||||||
name: 'cate_id',
|
name: 'cate_id',
|
||||||
height: '250px',
|
height: '250px',
|
||||||
layVerify: 'required',
|
layVerify: '',
|
||||||
layVerType: 'tips',
|
layVerType: 'tips',
|
||||||
data: res.data,
|
data: res.data,
|
||||||
initValue: [res.data[0].id],
|
initValue: [],
|
||||||
model: {label: {type: 'text'}},
|
model: {label: {type: 'text'}},
|
||||||
prop: {
|
prop: {
|
||||||
name: 'catename',
|
name: 'catename',
|
||||||
@ -204,7 +204,10 @@
|
|||||||
|
|
||||||
form.on('submit(forum-query)', function(data) {
|
form.on('submit(forum-query)', function(data) {
|
||||||
table.reload('forum-table', {
|
table.reload('forum-table', {
|
||||||
where: data.field
|
where: data.field,
|
||||||
|
page: {
|
||||||
|
curr: 1 //重新从第 1 页开始
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -267,10 +267,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>UI</td>
|
<td>UI</td>
|
||||||
<td> Layui 2.8.5
|
<td class="UI"> Layui
|
||||||
<script type="text/html" template>
|
|
||||||
Layui-v {{ layui.v }}
|
|
||||||
</script>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -327,6 +324,8 @@
|
|||||||
const indexReplys = "{:url('Index/replys')}"; //回复
|
const indexReplys = "{:url('Index/replys')}"; //回复
|
||||||
const NEWS = "{:url('index/news')}"; //动态
|
const NEWS = "{:url('index/news')}"; //动态
|
||||||
const indexReply = "{:url('Index/reply')}"; //反馈
|
const indexReply = "{:url('Index/reply')}"; //反馈
|
||||||
|
const v = layui.v;
|
||||||
|
|
||||||
|
|
||||||
layui.use(['form','layer', 'echarts', 'element', 'count','toast'], function() {
|
layui.use(['form','layer', 'echarts', 'element', 'count','toast'], function() {
|
||||||
let $ = layui.jquery, form = layui.form,
|
let $ = layui.jquery, form = layui.form,
|
||||||
@ -337,6 +336,9 @@
|
|||||||
let toast = layui.toast;
|
let toast = layui.toast;
|
||||||
let table = layui.table;
|
let table = layui.table;
|
||||||
|
|
||||||
|
$('.UI').append(v);
|
||||||
|
|
||||||
|
|
||||||
count.up("value1", {
|
count.up("value1", {
|
||||||
time: 4000,
|
time: 4000,
|
||||||
num: 440.34,
|
num: 440.34,
|
||||||
|
@ -98,13 +98,13 @@
|
|||||||
<li class="layui-col-xs6">
|
<li class="layui-col-xs6">
|
||||||
<a lay-href="javascript:;" class="layadmin-backlog-body">
|
<a lay-href="javascript:;" class="layadmin-backlog-body">
|
||||||
<h3>待审商品</h3>
|
<h3>待审商品</h3>
|
||||||
<p><cite>99</cite></p>
|
<p><cite>0</cite></p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="layui-col-xs6">
|
<li class="layui-col-xs6">
|
||||||
<a href="javascript:;" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
|
<a href="javascript:;" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
|
||||||
<h3>待发货</h3>
|
<h3>待发货</h3>
|
||||||
<p><cite>20</cite></p>
|
<p><cite>0</cite></p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -243,11 +243,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">百度词条:</label>
|
<label class="layui-form-label">菜单位置:</label>
|
||||||
<div class="layui-input-inline" style="width: 60px;">
|
<div class="layui-input-inline" style="width: 60px;">
|
||||||
<input type="checkbox" name="baidu_title_switch" lay-skin="switch" lay-text="开启|关闭" value=1 {if config('taoler.config.baidu_title_switch') == 1} checked {/if}>
|
<input type="checkbox" name="nav_top" lay-skin="switch" lay-text="顶部|子栏" value=1 {if config('taoler.config.nav_top') == 1} checked {/if}>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-mid layui-word-aux">发文章标题引用百度词条</div>
|
<div class="layui-form-mid layui-word-aux">导航菜单在顶部或第二栏显示</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">置顶模式:</label>
|
||||||
|
<div class="layui-input-inline" style="width: 60px;">
|
||||||
|
<input type="checkbox" name="top_show" lay-skin="switch" lay-text="列表|滚动" value=1 {if config('taoler.config.top_show') == 1} checked {/if}>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid layui-word-aux">置顶帖子列表或滚动显示</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
{if hook('mailserveractivehook')}
|
{if hook('mailserveractivehook')}
|
||||||
@ -412,8 +419,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取描述的内容
|
// 获取描述的内容
|
||||||
$("input[name='article_as']").bind('input propertychange', function(){
|
$("input[name='article_as']").bind('input propertychange', function(){
|
||||||
var content = $(this).val()
|
var content = $(this).val()
|
||||||
|
@ -69,8 +69,14 @@ class Arts
|
|||||||
public function setKeywords(string $flag,string $title,string $content) :array
|
public function setKeywords(string $flag,string $title,string $content) :array
|
||||||
{
|
{
|
||||||
$keywords = [];
|
$keywords = [];
|
||||||
|
|
||||||
|
// seo插件配置
|
||||||
|
$addon = get_addons_instance('seo');
|
||||||
|
$config = $addon->getConfig();
|
||||||
|
$seo_token = $config['baidufenci']['access_token'];
|
||||||
|
|
||||||
// 百度分词自动生成关键词
|
// 百度分词自动生成关键词
|
||||||
if(!empty(config('taoler.baidu.client_id'))) {
|
if(!empty($seo_token)) {
|
||||||
//headers数组内的格式
|
//headers数组内的格式
|
||||||
$headers = [];
|
$headers = [];
|
||||||
$headers[] = "Content-Type:application/json";
|
$headers[] = "Content-Type:application/json";
|
||||||
@ -78,16 +84,16 @@ class Arts
|
|||||||
switch($flag) {
|
switch($flag) {
|
||||||
//分词
|
//分词
|
||||||
case 'word':
|
case 'word':
|
||||||
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
|
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.$seo_token;
|
||||||
$body = ["text" => $title];
|
$body = ["text" => $title];
|
||||||
break;
|
break;
|
||||||
//标签
|
//标签
|
||||||
case 'tag':
|
case 'tag':
|
||||||
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/keyword?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
|
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/keyword?charset=UTF-8&access_token='.$seo_token;
|
||||||
$body = ['title' => $title, 'content' => $content];
|
$body = ['title' => $title, 'content' => $content];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.config('taoler.baidu.access_token');
|
$url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer?charset=UTF-8&access_token='.$seo_token;
|
||||||
$body = ["text" => $title];
|
$body = ["text" => $title];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,9 +137,9 @@ class Arts
|
|||||||
} else {
|
} else {
|
||||||
// 接口正常但获取数据失败,可能参数错误,重新获取token
|
// 接口正常但获取数据失败,可能参数错误,重新获取token
|
||||||
$url = 'https://aip.baidubce.com/oauth/2.0/token';
|
$url = 'https://aip.baidubce.com/oauth/2.0/token';
|
||||||
$post_data['grant_type'] = config('taoler.baidu.grant_type');;
|
$post_data['grant_type'] = $config['baidufenci']['grant_type'];;
|
||||||
$post_data['client_id'] = config('taoler.baidu.client_id');
|
$post_data['client_id'] = $config['baidufenci']['client_id'];
|
||||||
$post_data['client_secret'] = config('taoler.baidu.client_secret');
|
$post_data['client_secret'] = $config['baidufenci']['client_secret'];
|
||||||
|
|
||||||
$o = "";
|
$o = "";
|
||||||
foreach ( $post_data as $k => $v )
|
foreach ( $post_data as $k => $v )
|
||||||
@ -210,8 +216,11 @@ class Arts
|
|||||||
*/
|
*/
|
||||||
public function baiduPushUrl(string $link)
|
public function baiduPushUrl(string $link)
|
||||||
{
|
{
|
||||||
|
// seo插件配置
|
||||||
|
$addon = get_addons_instance('seo');
|
||||||
|
$config = $addon->getConfig();
|
||||||
// baidu 接口
|
// baidu 接口
|
||||||
$api = config('taoler.baidu.push_api');
|
$api = $config['baidupush']['push_api'];
|
||||||
if(!empty($api)) {
|
if(!empty($api)) {
|
||||||
$url[] = $link;
|
$url[] = $link;
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
|
@ -392,6 +392,7 @@ class Article extends Model
|
|||||||
$query->field('id,ename,catename');
|
$query->field('id,ename,catename');
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
->where(['status' => 1])
|
||||||
->where($where)
|
->where($where)
|
||||||
->order('create_time', 'desc')
|
->order('create_time', 'desc')
|
||||||
->paginate([
|
->paginate([
|
||||||
|
@ -44,7 +44,7 @@ class Comment extends Model
|
|||||||
->append(['touser'])
|
->append(['touser'])
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
// halt($comment);
|
|
||||||
if(count($comment)) {
|
if(count($comment)) {
|
||||||
$data['data'] = getTree($comment);
|
$data['data'] = getTree($comment);
|
||||||
$data['total'] = count($data['data']);
|
$data['total'] = count($data['data']);
|
||||||
|
@ -448,40 +448,6 @@ class Article extends BaseController
|
|||||||
return download($zip,'my');
|
return download($zip,'my');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取描述,过滤html
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function getDescription()
|
|
||||||
{
|
|
||||||
$data = Request::only(['content']);
|
|
||||||
$description = getArtContent($data['content']);
|
|
||||||
return json(['code'=>0,'data'=>$description]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标题调用百度关键词词条
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function getWordList()
|
|
||||||
{
|
|
||||||
$title = input('title');
|
|
||||||
return $this->getBdiduSearchWordList($title);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关键词
|
|
||||||
* @return \think\response\Json
|
|
||||||
*/
|
|
||||||
public function keywords()
|
|
||||||
{
|
|
||||||
$data = Request::only(['flag','keywords','content']);
|
|
||||||
$keywords = $this->setKeywords($data);
|
|
||||||
return json(['code'=>0, 'msg' => 'ok', 'data'=> $keywords]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 文章置顶、加精、评论状态
|
// 文章置顶、加精、评论状态
|
||||||
public function jieset()
|
public function jieset()
|
||||||
{
|
{
|
||||||
|
@ -31,12 +31,11 @@ class Index extends BaseController
|
|||||||
$types = input('type');
|
$types = input('type');
|
||||||
//置顶文章
|
//置顶文章
|
||||||
$artTop = Article::getArtTop(5);
|
$artTop = Article::getArtTop(5);
|
||||||
//首页文章列表,显示15个
|
//首页文章列表,显示10个
|
||||||
$artList = Article::getArtList(15);
|
$artList = Article::getArtList(10);
|
||||||
//热议文章
|
//热议文章
|
||||||
$artHot = Article::getArtHot(10);
|
$artHot = Article::getArtHot(10);
|
||||||
|
|
||||||
|
|
||||||
$vs = [
|
$vs = [
|
||||||
'artTop' => $artTop,
|
'artTop' => $artTop,
|
||||||
'artList' => $artList,
|
'artList' => $artList,
|
||||||
|
@ -16,7 +16,7 @@ return [
|
|||||||
// 应用名,此项不可更改
|
// 应用名,此项不可更改
|
||||||
'appname' => 'TaoLer',
|
'appname' => 'TaoLer',
|
||||||
// 版本配置
|
// 版本配置
|
||||||
'version' => '2.3.5',
|
'version' => '2.3.7',
|
||||||
// 加盐
|
// 加盐
|
||||||
'salt' => 'taoler',
|
'salt' => 'taoler',
|
||||||
// 数据库备份目录
|
// 数据库备份目录
|
||||||
|
@ -14,6 +14,7 @@ use think\Response;
|
|||||||
|
|
||||||
class Api
|
class Api
|
||||||
{
|
{
|
||||||
|
public $code;
|
||||||
/**
|
/**
|
||||||
* @param $url
|
* @param $url
|
||||||
* @param $data
|
* @param $data
|
||||||
|
@ -282,7 +282,7 @@ class FormHlp
|
|||||||
$switchStr = $switchArr ? lang($switchArr[1]) . '|' . lang($switchArr[0]) : lang('open') . '|' . 'close';
|
$switchStr = $switchArr ? lang($switchArr[1]) . '|' . lang($switchArr[0]) : lang('open') . '|' . 'close';
|
||||||
$str = '<div class="layui-form-item">' .$this->label($label,$options) . '
|
$str = '<div class="layui-form-item">' .$this->label($label,$options) . '
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input ' . $this->addextend($options) . ' ' . $this->addstyle($options) . ' class="' . $this->addClass($options) . '" type="checkbox" value="' . $value . '" checked="" name="' . $name . '" ' . $this->verify($options) . $this->filter($options) . $this->readonlyOrdisabled($options) . ' lay-skin="switch" lay-text="' . $switchStr . '" data-text="' . lang($value) . '"/>
|
<input ' . $this->addextend($options) . ' ' . $this->addstyle($options) . ' class="' . $this->addClass($options) . '" type="checkbox" value="' . $value . '" checked="'.$checked.'" name="' . $name . '" ' . $this->verify($options) . $this->filter($options) . $this->readonlyOrdisabled($options) . ' lay-skin="switch" lay-text="' . $switchStr . '" data-text="' . lang($value) . '"/>
|
||||||
' . $this->tips($options) . '
|
' . $this->tips($options) . '
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
@ -32,9 +32,9 @@ if (!function_exists('form_switch')) {
|
|||||||
* @param $value
|
* @param $value
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function form_switch($name,$switch=[] , $option=[],$value='')
|
function form_switch($name, $switch=[], $option=[], $value='')
|
||||||
{
|
{
|
||||||
return FormHelper::switchs($name,$switch , $option,$value);
|
return FormHelper::switchs($name, $switch, $option, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!function_exists('form_checkbox')) {
|
if (!function_exists('form_checkbox')) {
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -80,7 +80,7 @@ layui.define(['form', 'upload'], function(exports){
|
|||||||
var field = data.field;
|
var field = data.field;
|
||||||
var URL = $(this).data('url');
|
var URL = $(this).data('url');
|
||||||
$.post(URL, field,function(res){
|
$.post(URL, field,function(res){
|
||||||
if(res.code == 0){
|
if(res.code === 0){
|
||||||
layer.msg(res.msg,{icon:6,tiye:2000},function(){
|
layer.msg(res.msg,{icon:6,tiye:2000},function(){
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
|
File diff suppressed because one or more lines are too long
@ -183,6 +183,7 @@ pre{overflow-y: auto;
|
|||||||
.fly-header{position: fixed; left: 0; top: 0; z-index: 10000; width: 100%; height: 60px; border-bottom: 1px solid #404553; border-right: 1px solid #404553; border-radius: 0;}
|
.fly-header{position: fixed; left: 0; top: 0; z-index: 10000; width: 100%; height: 60px; border-bottom: 1px solid #404553; border-right: 1px solid #404553; border-radius: 0;}
|
||||||
.fly-header .layui-container{position: relative; height: 100%; line-height: 60px; text-align: center;}
|
.fly-header .layui-container{position: relative; height: 100%; line-height: 60px; text-align: center;}
|
||||||
.fly-logo{position: absolute; left: 15px;}
|
.fly-logo{position: absolute; left: 15px;}
|
||||||
|
.fly-logo img {width:135px; height: 37px;}
|
||||||
.fly-logo-m{width: 91px;}
|
.fly-logo-m{width: 91px;}
|
||||||
.fly-nav{position: absolute; left: 200px;}
|
.fly-nav{position: absolute; left: 200px;}
|
||||||
.fly-nav a i{position: absolute; left: 15px; top: 0; padding-right: 10px; font-size: 22px;}
|
.fly-nav a i{position: absolute; left: 15px; top: 0; padding-right: 10px; font-size: 22px;}
|
||||||
|
@ -26,11 +26,6 @@
|
|||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" style="position:relative;" value=""/>
|
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" style="position:relative;" value=""/>
|
||||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" />
|
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" />
|
||||||
<input type="hidden" name="user_id" value="{:session('user_id')}" />
|
|
||||||
<div class="layui-input bdsug layui-hide">
|
|
||||||
<ul class="wordlist">
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{if ($user.auth == 1)}
|
{if ($user.auth == 1)}
|
||||||
@ -58,19 +53,14 @@
|
|||||||
<input type="text" id="L_version" value="" name="art_pass" autocomplete="off" class="layui-input" />
|
<input type="text" id="L_version" value="" name="art_pass" autocomplete="off" class="layui-input" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-col-md6 layui-hide">
|
|
||||||
<label class="layui-form-label" for="L_browser">浏览器</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本,如:IE 11" autocomplete="off" class="layui-input" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor"></textarea>
|
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor taonyeditor"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{//附件}
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<label class="layui-form-label">{:lang('enclosure')}</label>
|
<label class="layui-form-label">{:lang('enclosure')}</label>
|
||||||
@ -103,22 +93,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--div class="layui-form-item">
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">悬赏飞吻</label>
|
|
||||||
<div class="layui-input-inline" style="width: 190px;">
|
|
||||||
<select name="experience">
|
|
||||||
<option value="20">20</option>
|
|
||||||
<option value="30">30</option>
|
|
||||||
<option value="50">50</option>
|
|
||||||
<option value="60">60</option>
|
|
||||||
<option value="80">80</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
|
|
||||||
</div>
|
|
||||||
</div-->
|
|
||||||
|
|
||||||
{if config('taoler.config.post_captcha') == 1}
|
{if config('taoler.config.post_captcha') == 1}
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||||
@ -146,22 +120,17 @@
|
|||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="script"}
|
{block name="script"}
|
||||||
{:hook('taonyeditor')}
|
|
||||||
<script src="/static/xm-select.js"></script>
|
<script src="/static/xm-select.js"></script>
|
||||||
<script>
|
<script>
|
||||||
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||||
|
|
||||||
layui.use(["fly"], function () {
|
layui.use(['fly'], function () {
|
||||||
var $ = layui.jquery,
|
var $ = layui.jquery,
|
||||||
fly = layui.fly,
|
fly = layui.fly,
|
||||||
form = layui.form,
|
form = layui.form,
|
||||||
colorpicker = layui.colorpicker,
|
colorpicker = layui.colorpicker,
|
||||||
upload = layui.upload;
|
upload = layui.upload;
|
||||||
|
|
||||||
//获取百度标签标志,tag或者word;
|
|
||||||
var flag = 'word';
|
|
||||||
|
|
||||||
|
|
||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
// 编辑器插件启用状态
|
// 编辑器插件启用状态
|
||||||
if(taonystatus == 0) {
|
if(taonystatus == 0) {
|
||||||
@ -223,88 +192,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 通过标题内容自动获取tag的内容
|
|
||||||
var conf = "{:empty(config('taoler.baidu.client_id'))}";
|
|
||||||
if (conf !== "1") {
|
|
||||||
$("#L_title").on("blur", function () {
|
|
||||||
var title = $(this).val();
|
|
||||||
var content = $("#L_content").val();
|
|
||||||
getBdiduWords(flag,title,content);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从详情页自动调用端口过滤,获取描述信息
|
|
||||||
$("#L_content").mouseleave(function() {
|
|
||||||
var content = $(this).val().replace(/[\r\n]/g,"").replace(/\n/g, '').replace(/\s/g, '').replace(/\t/g, '');
|
|
||||||
var title = $("#L_title").val();
|
|
||||||
$.post("{:url('article/getDescription')}", { content: content }, function(data){
|
|
||||||
if (data.code == 0) {
|
|
||||||
$('[name="description"]').val(data.data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
getBdiduWords(flag,title,content);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 获取百度分词接口的关键词
|
|
||||||
function getBdiduWords(flag,title,content)
|
|
||||||
{
|
|
||||||
// console.log(flag,title,content)
|
|
||||||
$.post("{:url('article/keywords')}",{ keywords: title, content:content, flag: flag }, function (res) {
|
|
||||||
if (res.code === 0) {
|
|
||||||
$("input[name='keywords']").val(res.data.join(','));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 百度词条
|
|
||||||
(function(){
|
|
||||||
var baidu_title_switch = "{:config('taoler.config.baidu_title_switch')}";
|
|
||||||
if(baidu_title_switch == 1) {
|
|
||||||
$("#L_title").bind('input propertychange',function () {
|
|
||||||
var title = $(this).val();
|
|
||||||
var str = '';
|
|
||||||
if(title.length > 0 ) {
|
|
||||||
$.post("{:url('article/getWordList')}",{title:title},function(res){
|
|
||||||
// 动态生成ur>li内容
|
|
||||||
if (res.code === 0) {
|
|
||||||
// 显示动态框
|
|
||||||
$(".bdsug").removeClass('layui-hide');
|
|
||||||
for (var i = 0; i < res.data.length; i++) {
|
|
||||||
//str += '<li data-key=' + res.data[i].q + '><b>' + res.data[i].q.replace(title,'') + '</b></li>';
|
|
||||||
str += '<li data-key=' + res.data[i].q + '><b>' + res.data[i].q + '</b></li>';
|
|
||||||
}
|
|
||||||
// 清空ul并追加li
|
|
||||||
$('.wordlist').empty().append(str);
|
|
||||||
// 点击李获取li值并复制给#L_title input的value
|
|
||||||
$(".bdsug li").on('click',function(){
|
|
||||||
var word = $(this).attr('data-key');
|
|
||||||
var words = title + '(' + word + ')';
|
|
||||||
$("#L_title").val(words);
|
|
||||||
// 关闭动态框
|
|
||||||
$(".bdsug").addClass('layui-hide');
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$(".bdsug").addClass('layui-hide');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$(".bdsug").addClass('layui-hide');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}())
|
|
||||||
|
|
||||||
//关闭百度词条
|
|
||||||
$(function(){
|
|
||||||
$(".bdsug").mouseleave(function(){
|
|
||||||
$(this).addClass('layui-hide');
|
|
||||||
// $("#LAY_ucm").click(function(){
|
|
||||||
// $(this).addClass('layui-hide');
|
|
||||||
// });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 发布文章
|
// 发布文章
|
||||||
form.on("submit(article-add)", function (data) {
|
form.on("submit(article-add)", function (data) {
|
||||||
var field = data.field;
|
var field = data.field;
|
||||||
@ -363,5 +250,11 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
{// 编辑器}
|
||||||
|
{:hook('taonyeditor')}
|
||||||
|
{// 百度标题词条}
|
||||||
|
{:hook('seoBaiduTitle')}
|
||||||
|
{// 百度关键词}
|
||||||
|
{:hook('seoBaiduKeywords')}
|
||||||
|
|
||||||
{/block}
|
{/block}
|
||||||
|
@ -56,32 +56,11 @@
|
|||||||
<input type="text" value="{$article.art_pass ?? ''}" name="art_pass" autocomplete="off" class="layui-input" />
|
<input type="text" value="{$article.art_pass ?? ''}" name="art_pass" autocomplete="off" class="layui-input" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-col-md6 layui-hide">
|
|
||||||
<label class="layui-form-label" for="L_browser">浏览器</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本,如:IE 11" autocomplete="off" class="layui-input" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细内容" class="layui-textarea fly-editor" style="height: 260px;">{$article.content}</textarea>
|
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细内容" class="layui-textarea fly-editor taonyeditor" style="height: 260px;">{$article.content}</textarea>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<div class="layui-inline">
|
|
||||||
<label class="layui-form-label">悬赏飞吻</label>
|
|
||||||
<div class="layui-input-inline" style="width: 190px;">
|
|
||||||
<select name="experience">
|
|
||||||
<option value="20">20</option>
|
|
||||||
<option value="30">30</option>
|
|
||||||
<option value="50">50</option>
|
|
||||||
<option value="60">60</option>
|
|
||||||
<option value="80">80</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
@ -138,9 +117,6 @@
|
|||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="script"}
|
{block name="script"}
|
||||||
|
|
||||||
{:hook('taonyeditor')}
|
|
||||||
|
|
||||||
<script src="/static/xm-select.js"></script>
|
<script src="/static/xm-select.js"></script>
|
||||||
<script>
|
<script>
|
||||||
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||||
@ -152,9 +128,6 @@
|
|||||||
,form = layui.form
|
,form = layui.form
|
||||||
,upload = layui.upload;
|
,upload = layui.upload;
|
||||||
|
|
||||||
//获取百度标签标志,tag或者word;
|
|
||||||
var flag = 'word';
|
|
||||||
|
|
||||||
var cateId = "{$article.cate.id}";
|
var cateId = "{$article.cate.id}";
|
||||||
var artId = "{$article.id}";
|
var artId = "{$article.id}";
|
||||||
|
|
||||||
@ -227,87 +200,6 @@
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 通过标题内容自动获取tag的内容
|
|
||||||
var conf = "{:empty(config('taoler.baidu.client_id'))}";
|
|
||||||
if(conf !== '1'){
|
|
||||||
$("#L_title").on('blur', function(){
|
|
||||||
var title = $(this).val();
|
|
||||||
var content = $("#L_content").val();
|
|
||||||
getBdiduWords(flag,title,content);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从详情页自动调用端口过滤,获取描述信息
|
|
||||||
$("#L_content").bind('input propertychange', function(){
|
|
||||||
var content = $(this).val()
|
|
||||||
var title = $("#L_title").val();
|
|
||||||
$.post("{:url('article/getDescription')}", { content: content }, function(data){
|
|
||||||
if (data.code == 0) {
|
|
||||||
$('[name="description"]').val(data.data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
getBdiduWords(flag,title,content);
|
|
||||||
})
|
|
||||||
|
|
||||||
// 获取百度分词接口的关键词
|
|
||||||
function getBdiduWords(flag,title,content) {
|
|
||||||
$.post("{:url('article/keywords')}",{ keywords: title, content:content, flag: flag }, function (res) {
|
|
||||||
if (res.code == 0) {
|
|
||||||
$("input[name='keywords']").val(res.data.join(','));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 百度词条
|
|
||||||
(function(){
|
|
||||||
var baidu_title_switch = "{:config('taoler.config.baidu_title_switch')}";
|
|
||||||
if(baidu_title_switch == 1) {
|
|
||||||
$("#L_title").bind('input propertychange',function () {
|
|
||||||
var title = $(this).val();
|
|
||||||
var str = '';
|
|
||||||
if(title.length > 0 ) {
|
|
||||||
$.post("{:url('article/getWordList')}",{title:title},function(res){
|
|
||||||
// 动态生成ur>li内容
|
|
||||||
if (res.code == 0) {
|
|
||||||
// 显示动态框
|
|
||||||
$(".bdsug").removeClass('layui-hide');
|
|
||||||
for (var i = 0; i < res.data.length; i++) {
|
|
||||||
//str += '<li data-key=' + res.data[i].q + '><b>' + res.data[i].q.replace(title,'') + '</b></li>';
|
|
||||||
str += '<li data-key=' + res.data[i].q + '><b>' + res.data[i].q + '</b></li>';
|
|
||||||
}
|
|
||||||
// 清空ul并追加li
|
|
||||||
$('.wordlist').empty().append(str);
|
|
||||||
// 点击李获取li值并复制给#L_title input的value
|
|
||||||
$(".bdsug li").on('click',function(){
|
|
||||||
var word = $(this).attr('data-key');
|
|
||||||
var words = title + '(' + word + ')';
|
|
||||||
$("#L_title").val(words);
|
|
||||||
// 关闭动态框
|
|
||||||
$(".bdsug").addClass('layui-hide');
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$(".bdsug").addClass('layui-hide');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$(".bdsug").addClass('layui-hide');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}())
|
|
||||||
|
|
||||||
//关闭百度词条
|
|
||||||
$(function(){
|
|
||||||
$(".bdsug").mouseleave(function(){
|
|
||||||
$(this).addClass('layui-hide');
|
|
||||||
// $("#LAY_ucm").click(function(){
|
|
||||||
// $(this).addClass('layui-hide');
|
|
||||||
// });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//编辑文章
|
//编辑文章
|
||||||
form.on('submit(article-edit)', function(data){
|
form.on('submit(article-edit)', function(data){
|
||||||
var field = data.field;
|
var field = data.field;
|
||||||
@ -365,4 +257,10 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
{:hook('taonyeditor')}
|
||||||
|
{// 百度标题词条}
|
||||||
|
{:hook('seoBaiduTitle')}
|
||||||
|
{// 百度关键词}
|
||||||
|
{:hook('seoBaiduKeywords')}
|
||||||
|
|
||||||
{/block}
|
{/block}
|
@ -28,6 +28,13 @@
|
|||||||
<a href="#signin" class="layui-hide-sm layui-show-xs-block fly-right" id="LAY_goSignin">{:lang('go sign')}</a>
|
<a href="#signin" class="layui-hide-sm layui-show-xs-block fly-right" id="LAY_goSignin">{:lang('go sign')}</a>
|
||||||
</div>
|
</div>
|
||||||
<ul class="fly-list">
|
<ul class="fly-list">
|
||||||
|
{if config('taoler.config.top_show') == 1}
|
||||||
|
{// 列表}
|
||||||
|
{volist name="artTop" id="top"}
|
||||||
|
{include file="public/index-topforum" /}
|
||||||
|
{/volist}
|
||||||
|
{else /}
|
||||||
|
{// 滚动}
|
||||||
<div class="layui-carousel" id="ID-carousel">
|
<div class="layui-carousel" id="ID-carousel">
|
||||||
<div carousel-item>
|
<div carousel-item>
|
||||||
{volist name="artTop" id="top"}
|
{volist name="artTop" id="top"}
|
||||||
@ -35,6 +42,7 @@
|
|||||||
{/volist}
|
{/volist}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<a href="{$Request.domain}{:url('user/home',['id'=>$top.user_id])}" class="fly-avatar">
|
<a href="{$Request.domain}{:url('user/home',['id'=>$top.user_id])}" class="fly-avatar">
|
||||||
<img src="{$Request.domain}{$top.user.user_img}" alt="{$top.user.name}">
|
<img src="{$Request.domain}{$top.user.user_img}" alt="{$top.user.name}">
|
||||||
</a>
|
</a>
|
||||||
<h2><a href="{$Request.domain}{$top.url}" style="color:red;">{$top.title}</a></h2>
|
<h2><a href="{$Request.domain}{$top.url}" style="color: {$top.title_color ?? ''}">{$top.title}</a></h2>
|
||||||
<div class="fly-list-info">
|
<div class="fly-list-info">
|
||||||
{if config('taoler.config.cate_show') == 1}
|
{if config('taoler.config.cate_show') == 1}
|
||||||
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $top.cate.ename : $top.cate.catename}</a>
|
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $top.cate.ename : $top.cate.catename}</a>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="fly-list-badge">
|
<div class="fly-list-badge">
|
||||||
{if ($top.is_top == 1)}
|
{if ($top.is_top == 1)}
|
||||||
<i class="layui-icon layui-icon-top layui-hide-md" style="font-size: 25px; color: #000000;"></i> <span class="layui-badge layui-bg-black layui-hide-xs" >{:lang('top')}</span>
|
<span class="layui-badge layui-bg-black layui-hide-xs" >{:lang('top')}</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user