优化插件菜单

This commit is contained in:
taoser 2023-03-27 13:04:59 +08:00
parent 8546f94d3c
commit 94bf95951e
16 changed files with 139 additions and 119 deletions

View File

@ -1,5 +1,5 @@
<?php
/**
/*
* @Program: TaoLer 2023/3/15
* @FilePath: app\admin\controller\addon\Addons.php
* @Description: Addons
@ -309,6 +309,12 @@ class Addons extends AdminController
//$pid = AuthRule::where('name','addons')->value('id');
return json(['code'=>-1,'msg'=> 'is_nav菜单项目设置错误']);
}
// 开启关闭的父ID状态
$pidStatus = AuthRule::where('id', $pid)->value('status');
if(!$pidStatus) {
AuthRule::update(['status' => 1, 'id' => $pid]);
}
// 安装菜单
$menu_arr[] = $menu['menu'];
$this->addAddonMenu($menu_arr, (int)$pid,1);
}

View File

@ -1,5 +1,5 @@
<?php
/**
/*
* @Program: TaoLer 2023/3/14
* @FilePath: app\admin\controller\content\Forum.php
* @Description: Forum
@ -125,7 +125,6 @@ class Forum extends AdminController
$data = Request::only(['cate_id', 'title', 'title_color', 'tiny_content', 'content', 'upzip', 'keywords', 'description', 'captcha']);
$tagId = input('tagid');
$data['user_id'] = 1; //管理员ID
halt($data);
// 调用验证器
$validate = new \app\common\validate\Article;
$result = $validate->scene('Artadd')->check($data);

View File

@ -8,8 +8,9 @@
* @FilePath: \TaoLer\app\admin\controller\Tag.php
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
*/
declare(strict_types=1);
namespace app\admin\controller;
declare(strict_types=1);
namespace app\admin\controller\content;
use app\common\controller\AdminController;
use think\facade\View;

1
app/admin/validate/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/addons

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>新增管理员</title>
<title>新增帖子</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body>
@ -17,7 +17,7 @@
<select lay-verify="required" name="cate_id" lay-filter="column">
<option></option>
{volist name="cateList" id="cate"}
<option value="{$cate.id}" {if($Request.param.cate == $cate.ename)} selected {/if}>{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
<option value="{$cate.id}" {if ($Request.param.cate == $cate.ename)} selected {/if}>{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
{/volist}
</select>
</div>
@ -92,8 +92,8 @@
<script src="/static/component/pear/pear.js"></script>
<script src="/static/jquery-3.6.0.min.js"></script>
<script src="/addons/taonyeditor/tinymce/tinymce.min.js"></script>
<script src="/addons/taonyeditor/tinymce/tinymce-jquery.min.js"></script>
<script src="/static/addons/taonyeditor/tinymce/tinymce.min.js"></script>
<script src="/static/addons/taonyeditor/tinymce/tinymce-jquery.min.js"></script>
<script>
//定义选择器
var mytextareaid = 'textarea#L_content';
@ -110,49 +110,19 @@
<script src="/static/xm-select.js"></script>
<script>
layui.extend({
editor: '{/}/static/admin/modules/taonyeditor/js/taonyeditor'
}).use(["form", "colorpicker", "upload",'tinymce','editor','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 editor = layui.editor;
var xmSelect = layui.xmSelect;
var tinymce = layui.tinymce
// var tinymce = layui.tinymce
// var edit = tinymce.render({
// elem: "#L_content",
// height: 400
// });
form.on('submit(forum-save)', function(data) {
$.ajax({
url: "{:url('content.forum/add')}",
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function(result) {
if (result.code === 0) {
layer.msg(result.msg, {
icon: 1,
time: 1000
}, function() {
parent.layer.close(parent.layer.getFrameIndex(window
.name)); //关闭当前页
parent.layui.table.reload("user-table");
});
} else {
layer.msg(result.msg, {
icon: 2,
time: 1000
});
}
}
})
return false;
});
//获取百度标签标志tag或者word;
var flag = 'word';
@ -184,15 +154,15 @@
var addTags = xmSelect.render({
el: '#tag',
name: 'tagid',
layVerify: 'required',
layVerify: '',
layVerType: 'msg',
paging: true,
pageSize: 5,
data: []
});
//2.动态标签赋值
$.get("{:url('tag/getAllTag')}",function(res){
if(res.code == 0){
$.get("{:url('content.tag/getAllTag')}",function(res){
if(res.code === 0){
addTags.update({
data: res.data,
autoRow: true,
@ -210,11 +180,11 @@
var content = $("#L_content").val();
$.ajax({
type: "post",
url: "{:url('Forum/getKeywords')}",
url: "{:url('content.forum/getKeywords')}",
data: { keywords: title, content:content, flag: flag },
daType: "json",
success: function (data) {
if (data.code == 0) {
if (data.code === 0) {
$("input[name='keywords']").val(data.data.join(','));
}
},
@ -224,14 +194,14 @@
// 百度词条
var baidu_title_switch = "{:config('taoler.config.baidu_title_switch')}";
if(baidu_title_switch == 1) {
if(baidu_title_switch === 1) {
$("#L_title").bind('input propertychange',function () {
var title = $(this).val();
var str = '';
if(title.length > 0 ) {
$.post("{:url('forum/getWordList')}",{title:title},function(res){
$.post("{:url('content.forum/getWordList')}",{title:title},function(res){
// 动态生成ur>li内容
if (res.code == 0) {
if (res.code === 0) {
// 显示动态框
$(".bdsug").removeClass('layui-hide');
for (var i = 0; i < res.data.length; i++) {
@ -261,11 +231,11 @@
//上传附件
upload.render({
elem: "#zip-button",
url: "{:url('forum/uploads')}", //改成您自己的上传接口
url: "{:url('content.forum/uploads')}", //改成您自己的上传接口
data: { type: "zip" },
accept: "file", //普通文件
done: function (res) {
if (res.status == 0) {
if (res.status === 0) {
$('input[name="upzip"]').val(res.url);
layer.msg("上传成功");
} else {
@ -286,8 +256,35 @@
},
});
});
form.on('submit(forum-save)', function(data) {
$.ajax({
url: "{:url('content.forum/add')}",
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function(result) {
if (result.code === 0) {
layer.msg(result.msg, {
icon: 1,
time: 1000
}, function() {
parent.layer.close(parent.layer.getFrameIndex(window
.name)); //关闭当前页
parent.layui.table.reload("user-table");
});
} else {
layer.msg(result.msg, {
icon: 2,
time: 1000
});
}
}
})
return false;
});
});
</script>
</body>
</html>

View File

@ -75,17 +75,13 @@
<button type="submit" class="layui-btn" lay-filter="article-edit" lay-submit id="article-edit">{:lang('post now')}</button>
</div>
</div>
</div>
<div class="bottom">
<div class="button-container">
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
lay-filter="user-save">
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="user-save">
<i class="layui-icon layui-icon-ok"></i>
提交
</button>
@ -100,25 +96,25 @@
<script src="/static/component/pear/pear.js"></script>
<script src="/static/jquery-3.6.0.min.js"></script>
<script src="/addons/taonyeditor/tinymce/tinymce.min.js"></script>
<script src="/addons/taonyeditor/tinymce/tinymce-jquery.min.js"></script>
<script src="/static/addons/taonyeditor/tinymce/tinymce.min.js"></script>
<script src="/static/addons/taonyeditor/tinymce/tinymce-jquery.min.js"></script>
<script>
//定义选择器
var mytextareaid = 'textarea#L_content';
var imagePrependUrl = "{$domain}";
//定义文件上传接口接口
var taonyUploadUrl = "{:url('forum/uploads')}",
taonyUploadImgage = "{:url('forum/uploads')}?type=image",
taonyUploadVideo = "{:url('forum/uploads')}?type=video";
taonyUploadZip = "{:url('forum/uploads')}?type=zip";
taonyUploadAudio = "{:url('forum/uploads')}?type=audio";
var taonyUploadUrl = "{:url('content.forum/uploads')}",
taonyUploadImgage = "{:url('content.forum/uploads')}?type=image",
taonyUploadVideo = "{:url('content.forum/uploads')}?type=video";
taonyUploadZip = "{:url('content.forum/uploads')}?type=zip";
taonyUploadAudio = "{:url('content.forum/uploads')}?type=audio";
$(mytextareaid).removeClass();
</script>
<script src="/static/xm-select.js"></script>
<script>
layui.extend({
index: 'lib/index' //主入口模块
,editor: '{/}/static/admin/modules/taonyeditor/js/taonyeditor'
,editor: '{/}/static/addons/taonyeditor/js/taonyeditor'
}).use(['colorpicker','form','upload', 'editor'], function(){
var $ = layui.jquery
,colorpicker = layui.colorpicker
@ -139,16 +135,16 @@
data: []
});
//2.动态赋值
$.get("{:url('tag/getArticleTag')}",{id:artId},function(res){
if(res.code == 0){
$.get("{:url('content.tag/getArticleTag')}",{id:artId},function(res){
if(res.code === 0){
addTags.setValue(
res.data
)
}
});
//3.动态标签赋值
$.get("{:url('tag/getAllTag')}",function(res){
if(res.code == 0){
$.get("{:url('content.tag/getAllTag')}",function(res){
if(res.code === 0){
addTags.update({
data: res.data,
autoRow: true,
@ -173,7 +169,7 @@
var content = $(this).val()
$.ajax({
type:"post",
url:"{:url('Forum/getDescription')}",
url:"{:url('content.forum/getDescription')}",
data:{"content":content},
daType:"json",
success:function (data){
@ -193,11 +189,11 @@
var flag = 'on';
$.ajax({
type:"post",
url:"{:url('Forum/getKeywords')}",
url:"{:url('content.forum/getKeywords')}",
data:{"keywords":keywords,"flag":flag},
daType:"json",
success:function (data){
if (data.code == 0) {
if (data.code === 0) {
$("input[name='keywords']").val("");
}
}
@ -222,11 +218,11 @@
//指定允许上传的文件类型
upload.render({
elem: '#zip-button'
,url: "{:url('forum/uploads')}" //改成您自己的上传接口
,url: "{:url('content.forum/uploads')}" //改成您自己的上传接口
,data: {type:'zip'}
,accept: 'file' //普通文件
,done: function(res){
if(res.status == 0){
if(res.status === 0){
$('input[name="upzip"]').val(res.url);
layer.msg('上传成功');
} else {

View File

@ -15,7 +15,8 @@
<div class="layui-tab layui-tab-brief" lay-filter="website-tabs-brief">
<ul class="layui-tab-title">
<li class="layui-this" lay-id="website">网站设置</li>{if hook('mailstatushook') ==1 }<li lay-id="email">邮箱服务</li>{/if}
<li class="layui-this" lay-id="website">网站设置</li>
{if hook('mailstatushook') ==1 }<li lay-id="email">邮箱服务</li>{/if}
<li lay-id="config">服务配置</li>
<li lay-id="domain">域名绑定</li>
<li lay-id="bind_map">应用映射</li>

View File

@ -148,18 +148,18 @@ CREATE TABLE `tao_auth_rule` (
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `name`(`name`) USING BTREE,
INDEX `pid`(`pid`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 124 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '权限表' ROW_FORMAT = Dynamic;
) ENGINE = MyISAM AUTO_INCREMENT = 200 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '权限表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tao_auth_rule
-- ----------------------------
INSERT INTO `tao_auth_rule` VALUES (1, 'System', 'System', 1, 1, 0, 0, 'layui-icon-user', 0, 1, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (2, 'Account', 'Account', 1, 1, 0, 0, 'layui-icon-set', 0, 1, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (1, 'System', 'System', 1, 1, 0, 0, 'layui-icon-template', 0, 1, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (2, 'Account', 'Account', 1, 1, 0, 0, 'layui-icon-user', 0, 1, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (3, 'Addon', 'Addon', 1, 1, 0, 0, 'layui-icon-component', 0, 3, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (4, 'Content', 'Content', 1, 1, 0, 0, 'layui-icon-app', 0, 4, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (5, 'Set', 'Set', 1, -1, 0, 0, 'layui-icon-read', 0, 5, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (6, 'Server', 'Server', 1, -1, 0, 0, '', 0, 6, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (7, 'Apps', 'Apps', 1, -1, 0, 0, '', 0, 7, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (4, 'Content', 'Content', 1, 1, 0, 0, 'layui-icon-template-1', 0, 4, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (5, 'Set', 'Set', 1, -1, 0, 0, 'layui-icon-set', 0, 5, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (6, 'Server', 'Server', 1, -1, 0, 0, 'layui-icon-senior', 0, 6, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (7, 'Apps', 'Apps', 1, -1, 0, 0, 'layui-icon-app', 0, 7, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (8, 'ID8', 'ID8', 1, -1, 0, 0, '', 0, 8, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (9, 'ID9', 'ID9', 1, -1, 0, 0, '', 0, 9, '', 0, 0, 0);
INSERT INTO `tao_auth_rule` VALUES (10, 'apps/index', 'ID10', 1, -1, 0, 0, '', 0, 10, '', 0, 0, 0);

View File

@ -16,7 +16,7 @@ return [
// 应用名,此项不可更改
'appname' => 'TaoLer',
// 版本配置
'version' => '2.2.2',
'version' => '2.2.3',
// 加盐
'salt' => 'taoler',
// 数据库备份目录

File diff suppressed because one or more lines are too long

View File

@ -98,6 +98,7 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
}
$.each(item.children, function (i, note) {
count++;
noticeContent += '<div class="pear-notice-item" notice-form="' + note.form + '" notice-context="' + note.context +
'" notice-title="' + note.title + '" notice-id="' + note.id + '">' ;
@ -116,9 +117,16 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
noticeContent += '</div>';
})
var notice = '<li class="layui-nav-item" lay-unselect="">' +
'<a href="#" class="notice layui-icon layui-icon-notice"><span class="layui-badge-dot"></div></a>' +
'<div class="layui-nav-child layui-tab pear-notice" style="margin-top: 0px;left: -200px;padding:0px;">';
var notice;
if (count > 0){
notice = '<li class="layui-nav-item" lay-unselect="">' +
'<a href="#" class="notice layui-icon layui-icon-notice"><span class="layui-badge-dot"></span></a>' +
'<div class="layui-nav-child layui-tab pear-notice" style="margin-top: 0px;left: -200px;padding:0px;">';
}else {
notice = '<li class="layui-nav-item" lay-unselect="">' +
'<a href="#" class="notice layui-icon layui-icon-notice"></a>' +
'<div class="layui-nav-child layui-tab pear-notice" style="margin-top: 0px;left: -200px;padding:0px;">';
}
noticeTitle += '</ul>';
noticeContent += '</div>';
@ -129,4 +137,4 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
}
exports(MOD_NAME, new message());
})
})

View File

@ -10,6 +10,7 @@ layui.config({
version: "3.30.0"
}).extend({
admin: "admin", // 框架布局组件
common: "common", // 公共方法封装
menu: "menu", // 数据菜单组件
frame: "frame", // 内容页面组件
tab: "tab", // 多选项卡组件

View File

@ -3,7 +3,7 @@
'name' => 'taoser/taoler',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'e2096d3c22d231951f23d4b8d771440a9e17e599',
'reference' => '9c2eddaed601bdb6e510f417c528a79129611a4b',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -358,7 +358,7 @@
'taoser/taoler' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'e2096d3c22d231951f23d4b8d771440a9e17e599',
'reference' => '9c2eddaed601bdb6e510f417c528a79129611a4b',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2023-03-16 22:43:15
// This file is automatically generated at:2023-03-17 15:50:41
declare (strict_types = 1);
return array (
0 => 'taoser\\addons\\Service',

View File

@ -145,8 +145,32 @@
<script src="/static/xm-select.js"></script>
<script>
var cateId = "{$article.cate.id}";
var artId = "{$article.id}";
layui.use(['fly'], function(){
var $ = layui.jquery
,fly = layui.fly
,colorpicker = layui.colorpicker
,form = layui.form
,upload = layui.upload;
//获取百度标签标志tag或者word;
var flag = 'word';
var cateId = "{$article.cate.id}";
var artId = "{$article.id}";
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
var taonystatus = "{:hook('taonystatus')}";
// 编辑器插件启用状态
var isShow = taonystatus ? false : true;
if(isShow) {
$('.layui-textarea').each(function(){
var othis = $(this), html = othis.html();
othis.attr(fly.content(html));
})
}
// 分类选择
$(function(){
//这里模拟ajax
@ -211,29 +235,6 @@ $(function(){
});
})
</script>
<script>
layui.use(['fly'], function(){
var $ = layui.jquery
,fly = layui.fly
,colorpicker = layui.colorpicker
,form = layui.form
,upload = layui.upload;
//获取百度标签标志tag或者word;
var flag = 'word';
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
var taonystatus = "{:hook('taonystatus')}";
// 编辑器插件启用状态
var isShow = taonystatus ? false : true;
if(isShow) {
$('.layui-textarea').each(function(){
var othis = $(this), html = othis.html();
othis.attr(fly.content(html));
})
}
// 通过标题内容自动获取tag的内容
var conf = "{:empty(config('taoler.baidu.client_id'))}";

View File

@ -42,7 +42,7 @@
.html5plus .html5plus-hide {display: none}
{if strpos($Request.SERVER.HTTP_USER_AGENT,"Html5Plus") !== false} html body{margin-top: 1px;} {/if}
</style>
<script src="{$Request.domain}/static/share/plusShare.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/share/plusShare.js" type="text/javascript" charset="utf-8"></script>
</head>
<body >
<script> if(navigator.userAgent.indexOf("Html5Plus") > -1) {document.body.classList.add("html5plus")} </script>
@ -66,7 +66,7 @@
};
layui.config({
version: "3.0.0"
,base: "{$Request.domain}/static/res/mods/"
,base: "/static/res/mods/"
}).extend({
fly: 'index'
}).use('fly');