diff --git a/.example.env b/.example.env index 714ec06..1b2c691 100644 --- a/.example.env +++ b/.example.env @@ -50,4 +50,7 @@ OSS_STATIC_PREFIX=static_ulthon_admin DEFAULT_AUTH_CHECK=false # 严格要求部分事件的返回数据,不符则抛出异常 -STRICT_EVENT=true \ No newline at end of file +STRICT_EVENT=true + +# 严格要求每个页面都建立js文件 +STRICT_VIEW_JS=true \ No newline at end of file diff --git a/app/admin/service/curd/BuildCurdService.php b/app/admin/service/curd/BuildCurdService.php index 657f66c..8234e98 100644 --- a/app/admin/service/curd/BuildCurdService.php +++ b/app/admin/service/curd/BuildCurdService.php @@ -1473,11 +1473,11 @@ class BuildCurdService $var_name = $this->getFieldVarName($field); if ($val['formType'] == 'image') { - $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.image}"; + $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ua.table.image}"; } elseif ($val['formType'] == 'images') { continue; } elseif ($val['formType'] == 'file') { - $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.url}"; + $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ua.table.url}"; } elseif ($val['formType'] == 'files') { continue; } elseif ($val['formType'] == 'editor') { @@ -1486,18 +1486,18 @@ class BuildCurdService continue; } elseif (in_array($field, $this->switchFields)) { if (isset($val['define']) && !empty($val['define'])) { - $templateValue = "{field: '{$field}', search: 'select', selectList: ea.getDataBrage('{$var_name}'), title: '{$val['comment']}', templet: ea.table.switch}"; + $templateValue = "{field: '{$field}', search: 'select', selectList: ua.getDataBrage('{$var_name}'), title: '{$val['comment']}', templet: ua.table.switch}"; } else { - $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.switch}"; + $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ua.table.switch}"; } } elseif (in_array($val['formType'], ['select', 'checkbox', 'radio', 'switch'])) { if (isset($val['define']) && !empty($val['define'])) { - $templateValue = "{field: '{$field}', search: 'select', selectList: ea.getDataBrage('{$var_name}'), title: '{$val['comment']}'}"; + $templateValue = "{field: '{$field}', search: 'select', selectList: ua.getDataBrage('{$var_name}'), title: '{$val['comment']}'}"; } else { $templateValue = "{field: '{$field}', title: '{$val['comment']}'}"; } } elseif (in_array($field, ['remark'])) { - $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ea.table.text}"; + $templateValue = "{field: '{$field}', title: '{$val['comment']}', templet: ua.table.text}"; } elseif (in_array($field, $this->sortFields)) { $templateValue = "{field: '{$field}', title: '{$val['comment']}', edit: 'text'}"; } else { @@ -1512,11 +1512,11 @@ class BuildCurdService $table = Str::camel($table); foreach ($tableVal['tableColumns'] as $field => $val) { if ($val['formType'] == 'image') { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.image}"; + $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ua.table.image}"; } elseif ($val['formType'] == 'images') { continue; } elseif ($val['formType'] == 'file') { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.url}"; + $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ua.table.url}"; } elseif ($val['formType'] == 'files') { continue; } elseif ($val['formType'] == 'editor') { @@ -1526,9 +1526,9 @@ class BuildCurdService } elseif ($val['formType'] == 'select') { $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}'}"; } elseif (in_array($field, ['remark'])) { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.text}"; + $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ua.table.text}"; } elseif (in_array($field, $this->switchFields)) { - $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ea.table.switch}"; + $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', templet: ua.table.switch}"; } elseif (in_array($field, $this->sortFields)) { $templateValue = "{field: '{$table}.{$field}', title: '{$val['comment']}', edit: 'text'}"; } else { @@ -1539,7 +1539,7 @@ class BuildCurdService } } - $indexCols .= $this->formatColsRow("{width: 250, title: '操作', templet: ea.table.tool , fixed:'right'},\r"); + $indexCols .= $this->formatColsRow("{width: 250, title: '操作', templet: ua.table.tool , fixed:'right'},\r"); $jsValue = $this->replaceTemplate( $this->getTemplate("static{$this->DS}js"), diff --git a/app/admin/service/curd/templates/static/js.code b/app/admin/service/curd/templates/static/js.code index 588bd38..3347cfa 100644 --- a/app/admin/service/curd/templates/static/js.code +++ b/app/admin/service/curd/templates/static/js.code @@ -14,20 +14,20 @@ define(["jquery", "easy-admin"], function ($, ea) { var Controller = { index: function () { - ea.table.render({ + ua.table.render({ init: init, cols: [[ {{indexCols}} ]], }); - ea.listen(); + ua.listen(); }, add: function () { - ea.listen(); + ua.listen(); }, edit: function () { - ea.listen(); + ua.listen(); }, }; return Controller; diff --git a/app/admin/view/common/_require.html b/app/admin/view/common/_require.html new file mode 100644 index 0000000..4602d9c --- /dev/null +++ b/app/admin/view/common/_require.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/admin/view/debug/log/_common.js b/app/admin/view/debug/log/_common.js new file mode 100644 index 0000000..e69de29 diff --git a/app/admin/view/debug/log/add.html b/app/admin/view/debug/log/add.html deleted file mode 100644 index 8143510..0000000 --- a/app/admin/view/debug/log/add.html +++ /dev/null @@ -1,53 +0,0 @@ -
-
- -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- - -
- -
-
\ No newline at end of file diff --git a/app/admin/view/debug/log/edit.html b/app/admin/view/debug/log/edit.html deleted file mode 100644 index f7186b8..0000000 --- a/app/admin/view/debug/log/edit.html +++ /dev/null @@ -1,53 +0,0 @@ -
-
- -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- - -
- -
-
\ No newline at end of file diff --git a/app/admin/view/debug/log/index.js b/app/admin/view/debug/log/index.js new file mode 100644 index 0000000..dad2182 --- /dev/null +++ b/app/admin/view/debug/log/index.js @@ -0,0 +1,51 @@ +$(function () { + var init = { + table_elem: '#currentTable', + table_render_id: 'currentTableRenderId', + index_url: 'debug.log/index', + add_url: 'debug.log/add', + edit_url: 'debug.log/edit', + delete_url: 'debug.log/delete', + export_url: 'debug.log/export', + modify_url: 'debug.log/modify', + }; + + var uidList = []; + ua.table.render({ + init: init, + size: 'sm', + limit: 50, + cols: [[ + { type: 'checkbox' }, + { field: 'id', title: 'id', search: 'number_limit' }, + { field: 'id', title: 'id模糊匹配', trueHide: true, fieldAlias: '[id]like' }, + { field: 'id', title: '最大id', trueHide: true, fieldAlias: '[id]max', searchOp: 'max' }, + { + field: 'uid', title: 'uid', minWidth: 120, + }, + { field: 'level', title: 'level', minWidth: 70 }, + { + field: 'content', title: '日志内容', minWidth: 450, align: 'left', templet: function (data) { + + if (uidList.indexOf(data.uid) < 0) { + uidList.push(data.uid); + } + var currentUidIndex = uidList.indexOf(data.uid); + + var className = 'log-group log-group-' + (currentUidIndex % 2); + return '
' + data.content + '
'; + } + }, + { field: 'create_time', title: '记录时间', minWidth: 160, search: 'time_limit' }, + { field: 'app_name', title: 'app_name' }, + { field: 'controller_name', title: 'controller_name', }, + { field: 'action_name', title: 'action_name' }, + ]], + toolbar: [ + 'refresh', + 'export' + ] + }); + + ua.listen(); +}); \ No newline at end of file diff --git a/app/admin/view/index/_common.js b/app/admin/view/index/_common.js new file mode 100644 index 0000000..e69de29 diff --git a/app/admin/view/index/edit_admin.js b/app/admin/view/index/edit_admin.js new file mode 100644 index 0000000..4d2e0be --- /dev/null +++ b/app/admin/view/index/edit_admin.js @@ -0,0 +1,3 @@ +$(function () { + ua.listen(); +}); \ No newline at end of file diff --git a/app/admin/view/index/edit_password.js b/app/admin/view/index/edit_password.js new file mode 100644 index 0000000..4d2e0be --- /dev/null +++ b/app/admin/view/index/edit_password.js @@ -0,0 +1,3 @@ +$(function () { + ua.listen(); +}); \ No newline at end of file diff --git a/app/admin/view/index/index.html b/app/admin/view/index/index.html index da7c110..f2e3b4a 100644 --- a/app/admin/view/index/index.html +++ b/app/admin/view/index/index.html @@ -111,4 +111,4 @@ - \ No newline at end of file + diff --git a/app/admin/view/index/index.js b/app/admin/view/index/index.js new file mode 100644 index 0000000..22a744b --- /dev/null +++ b/app/admin/view/index/index.js @@ -0,0 +1,25 @@ +$(function () { + var options = { + iniUrl: ua.url('ajax/initAdmin'), // 初始化接口 + clearUrl: ua.url("ajax/clearCache"), // 缓存清理接口 + urlHashLocation: true, // 是否打开hash定位 + bgColorDefault: false, // 主题默认配置 + multiModule: true, // 是否开启多模块 + menuChildOpen: false, // 是否默认展开菜单 + loadingTime: 0, // 初始化加载时间 + pageAnim: true, // iframe窗口动画 + maxTabNum: 20, // 最大的tab打开数量 + }; + miniAdmin.render(options); + + $('.login-out').on("click", function () { + ua.request.get({ + url: 'login/out', + prefix: true, + }, function (res) { + ua.msg.success(res.msg, function () { + window.location = ua.url('login/index'); + }); + }); + }); +}); \ No newline at end of file diff --git a/app/admin/view/index/welcome.js b/app/admin/view/index/welcome.js new file mode 100644 index 0000000..d8c9891 --- /dev/null +++ b/app/admin/view/index/welcome.js @@ -0,0 +1,83 @@ +$(function () { + /** + * 报表功能 + */ + var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden'); + var optionRecords = { + title: { + text: '访问统计' + }, + tooltip: { + trigger: 'axis' + }, + legend: { + data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎'] + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true + }, + toolbox: { + feature: { + saveAsImage: {} + } + }, + xAxis: { + type: 'category', + boundaryGap: false, + data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] + }, + yAxis: { + type: 'value' + }, + series: [ + { + name: '邮件营销', + type: 'line', + stack: '总量', + data: [120, 132, 101, 134, 90, 230, 210] + }, + { + name: '联盟广告', + type: 'line', + stack: '总量', + data: [220, 182, 191, 234, 290, 330, 310] + }, + { + name: '视频广告', + type: 'line', + stack: '总量', + data: [150, 232, 201, 154, 190, 330, 410] + }, + { + name: '直接访问', + type: 'line', + stack: '总量', + data: [320, 332, 301, 334, 390, 330, 320] + }, + { + name: '搜索引擎', + type: 'line', + stack: '总量', + data: [820, 932, 901, 934, 1290, 1330, 1320] + } + ] + }; + + + var checkChartVisibleTimer = setInterval(() => { + var isChartVisible = $('#echarts-records').is(':visible'); + if (isChartVisible) { + echartsRecords.setOption(optionRecords); + echartsRecords.resize(); + window.addEventListener("resize", function () { + echartsRecords.resize(); + }); + + clearInterval(checkChartVisibleTimer); + } + }, 3000); + ua.listen(); +}); \ No newline at end of file diff --git a/app/admin/view/layout/default.html b/app/admin/view/layout/default.html index 084a77b..dc5858a 100644 --- a/app/admin/view/layout/default.html +++ b/app/admin/view/layout/default.html @@ -7,14 +7,7 @@ - - - - - + {include file='common/_require'/} - - - - + + {$content_js|raw} + diff --git a/app/admin/view/login/_common.js b/app/admin/view/login/_common.js new file mode 100644 index 0000000..e69de29 diff --git a/app/admin/view/login/ext/demo.html b/app/admin/view/login/ext/demo.html index 3e5db1a..ac8246e 100644 --- a/app/admin/view/login/ext/demo.html +++ b/app/admin/view/login/ext/demo.html @@ -1,4 +1,4 @@ -
演示账号快速登录
+
演示账号一键填写
"; + } + /** * 解析和获取模板内容 用于输出. * @param string $template @@ -150,7 +174,17 @@ class AdminController extends BaseController { $this->assign('data_brage', json_encode($this->dataBrage)); - return $this->app->view->fetch($template, $vars); + $vars['content_js'] = $this->fetchJS(); + + $content_main = View::layout($this->layout) + ->config([ + 'view_suffix' => 'html', + ])->fetch($template, $vars); + + $html = ''; + $html .= $content_main; + + return $html; } /** diff --git a/app/common/provider/View.php b/app/common/provider/View.php index 965ac90..cbcd3f3 100644 --- a/app/common/provider/View.php +++ b/app/common/provider/View.php @@ -36,4 +36,16 @@ class View extends ThinkView return $this; } + + /** + * 配置模板引擎. + * @param array $config 参数 + * @return $this + */ + public function config(array $config) + { + $this->driver()->config($config); + + return $this; + } } diff --git a/app/common/tools/PathTools.php b/app/common/tools/PathTools.php index b8fa6ce..db146fc 100644 --- a/app/common/tools/PathTools.php +++ b/app/common/tools/PathTools.php @@ -7,7 +7,7 @@ use think\facade\App; class PathTools { /** - * 系统生成的文件,这些文件应当是可以任意删除的 + * 系统生成的文件,这些文件应当是可以任意删除的. * * @param string $file_name * @return string @@ -49,6 +49,29 @@ class PathTools if (!is_dir($dir_name)) { mkdir($dir_name, 0777, true); } + return $file_path; } + + public static function mapDir($dir, $callback = null) + { + $result = []; + $cdir = scandir($dir); + foreach ($cdir as $key => $value) { + if (!in_array($value, ['.', '..'])) { + $current_path = $dir . DS . $value; + if (is_dir($current_path)) { + $result[$value] = self::mapDir($current_path, $callback); + } else { + if (is_callable($callback)) { + $result[$value] = $callback($current_path, $value, $dir); + } else { + $result[$value] = $current_path; + } + } + } + } + + return $result; + } } diff --git a/config/view.php b/config/view.php index e97254f..7b0099b 100644 --- a/config/view.php +++ b/config/view.php @@ -1,4 +1,5 @@ 'Think', + 'type' => 'Think', // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, + 'auto_rule' => 1, // 模板目录名 'view_dir_name' => 'view', // 模板后缀 - 'view_suffix' => 'html', + 'view_suffix' => 'html', // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, + 'view_depr' => DIRECTORY_SEPARATOR, // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', + 'tpl_begin' => '{', // 模板引擎普通标签结束标记 - 'tpl_end' => '}', + 'tpl_end' => '}', // 标签库标签开始标记 - 'taglib_begin' => '{', + 'taglib_begin' => '{', // 标签库标签结束标记 - 'taglib_end' => '}', + 'taglib_end' => '}', // 模板缓存 'display_cache' => true, // 字符替换 'tpl_replace_string' => [ '__STATIC__' => Env::get('adminsystem.static_path', '/static'), - '__JS__' => '/static/javascript', + '__JS__' => '/static/javascript', ], - 'default_filter' => 'ua_htmlentities', // 默认过滤方法 用于普通标签输出 + 'default_filter' => 'ua_htmlentities', // 默认过滤方法 用于普通标签输出 ]; diff --git a/public/static/admin/js/debug/log.js b/public/static/admin/js/debug/log.js index 74b1737..6ec3cee 100644 --- a/public/static/admin/js/debug/log.js +++ b/public/static/admin/js/debug/log.js @@ -15,7 +15,7 @@ define(["jquery", "easy-admin"], function ($, ea) { index: function () { var uidList = []; - ea.table.render({ + ua.table.render({ init: init, size: 'sm', limit: 50, @@ -51,13 +51,13 @@ define(["jquery", "easy-admin"], function ($, ea) { ] }); - ea.listen(); + ua.listen(); }, add: function () { - ea.listen(); + ua.listen(); }, edit: function () { - ea.listen(); + ua.listen(); }, }; return Controller; diff --git a/public/static/admin/js/index.js b/public/static/admin/js/index.js index e7997e1..1323f93 100644 --- a/public/static/admin/js/index.js +++ b/public/static/admin/js/index.js @@ -3,8 +3,8 @@ define(["jquery", "easy-admin", "echarts", "echarts-theme", "miniAdmin"], functi var Controller = { index: function () { var options = { - iniUrl: ea.url('ajax/initAdmin'), // 初始化接口 - clearUrl: ea.url("ajax/clearCache"), // 缓存清理接口 + iniUrl: ua.url('ajax/initAdmin'), // 初始化接口 + clearUrl: ua.url("ajax/clearCache"), // 缓存清理接口 urlHashLocation: true, // 是否打开hash定位 bgColorDefault: false, // 主题默认配置 multiModule: true, // 是否开启多模块 @@ -16,12 +16,12 @@ define(["jquery", "easy-admin", "echarts", "echarts-theme", "miniAdmin"], functi miniAdmin.render(options); $('.login-out').on("click", function () { - ea.request.get({ + ua.request.get({ url: 'login/out', prefix: true, }, function (res) { - ea.msg.success(res.msg, function () { - window.location = ea.url('login/index'); + ua.msg.success(res.msg, function () { + window.location = ua.url('login/index'); }) }); }); @@ -108,13 +108,13 @@ define(["jquery", "easy-admin", "echarts", "echarts-theme", "miniAdmin"], functi clearInterval(checkChartVisibleTimer) } }, 3000); - ea.listen(); + ua.listen(); }, editAdmin: function () { - ea.listen(); + ua.listen(); }, editPassword: function () { - ea.listen(); + ua.listen(); } }; return Controller; diff --git a/public/static/admin/js/login.js b/public/static/admin/js/login.js index dcaf4b5..5ce51fe 100644 --- a/public/static/admin/js/login.js +++ b/public/static/admin/js/login.js @@ -3,49 +3,7 @@ define(["easy-admin"], function (ea) { var Controller = { index: function () { - if (top.location !== self.location) { - top.location = self.location; - } - - $('.bind-password').on('click', function () { - if ($(this).hasClass('icon-5')) { - $(this).removeClass('icon-5'); - $("input[name='password']").attr('type', 'password'); - } else { - $(this).addClass('icon-5'); - $("input[name='password']").attr('type', 'text'); - } - }); - - $('.icon-nocheck').on('click', function () { - if ($(this).hasClass('icon-check')) { - $(this).removeClass('icon-check'); - } else { - $(this).addClass('icon-check'); - } - }); - - $('.login-tip').on('click', function () { - $('.icon-nocheck').click(); - }); - - ea.listen(function (data) { - data['keep_login'] = $('.icon-nocheck').hasClass('icon-check') ? 1 : 0; - return data; - }, function (res) { - ea.msg.success(res.msg, function () { - window.location = ea.url('index'); - }) - }, function (res) { - ea.msg.error(res.msg, function () { - $('#refreshCaptcha').trigger("click"); - }); - }); - - - $('.forget-password').click(function () { - layer.msg('可以使用重置密码命令设置:
php think admin:resetPassword
参考文档') - }) + }, }; diff --git a/public/static/admin/js/mall/cate.js b/public/static/admin/js/mall/cate.js index ea73205..d73e2fd 100644 --- a/public/static/admin/js/mall/cate.js +++ b/public/static/admin/js/mall/cate.js @@ -14,28 +14,28 @@ define(["jquery", "easy-admin"], function ($, ea) { var Controller = { index: function () { - ea.table.render({ + ua.table.render({ init: init, cols: [[ {type: "checkbox"}, {field: 'id', width: 80, title: 'ID'}, {field: 'sort', width: 80, title: '排序', edit: 'text'}, {field: 'title', minWidth: 80, title: '分类名称'}, - {field: 'image', minWidth: 80, title: '分类图片', search: false, templet: ea.table.image}, + {field: 'image', minWidth: 80, title: '分类图片', search: false, templet: ua.table.image}, {field: 'remark', minWidth: 80, title: '备注信息'}, - {field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch}, + {field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ua.table.switch}, {field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'}, - {width: 250, title: '操作', templet: ea.table.tool} + {width: 250, title: '操作', templet: ua.table.tool} ]], }); - ea.listen(); + ua.listen(); }, add: function () { - ea.listen(); + ua.listen(); }, edit: function () { - ea.listen(); + ua.listen(); }, }; return Controller; diff --git a/public/static/admin/js/mall/goods.js b/public/static/admin/js/mall/goods.js index ffb1c3a..f9a2465 100644 --- a/public/static/admin/js/mall/goods.js +++ b/public/static/admin/js/mall/goods.js @@ -17,21 +17,21 @@ define(["jquery", "easy-admin"], function ($, ea) { var Controller = { index: function () { - ea.table.render({ + ua.table.render({ init: init, totalRow: true, cols: [[ { type: "checkbox" }, { field: 'id', width: 80, title: 'ID', totalRowText: '合计:' }, { field: 'sort', width: 80, title: '排序', edit: 'text' }, - { field: 'cate_id', minWidth: 80, title: '商品分类', selectList: ea.getDataBrage('select_list_cate'), selectValue: 'id', selectLabel: 'title', defaultSearchValue: ea.getQueryVariable('cate_id', '') }, - { field: 'cate.image', minWidth: 80, title: '分类图片', search: false, templet: ea.table.image }, + { field: 'cate_id', minWidth: 80, title: '商品分类', selectList: ua.getDataBrage('select_list_cate'), selectValue: 'id', selectLabel: 'title', defaultSearchValue: ua.getQueryVariable('cate_id', '') }, + { field: 'cate.image', minWidth: 80, title: '分类图片', search: false, templet: ua.table.image }, { field: 'title', minWidth: 80, title: '商品名称', }, - { field: 'logo', minWidth: 80, title: '商品图片', search: false, templet: ea.table.image }, - { field: 'market_price', width: 100, title: '市场价', templet: ea.table.price }, + { field: 'logo', minWidth: 80, title: '商品图片', search: false, templet: ua.table.image }, + { field: 'market_price', width: 100, title: '市场价', templet: ua.table.price }, { - field: 'discount_price', width: 120, title: '折扣价', templet: ea.table.price, totalRow: true, - templet: ea.table.copyText, + field: 'discount_price', width: 120, title: '折扣价', templet: ua.table.price, totalRow: true, + templet: ua.table.copyText, valueParser(value) { return '¥' + value }, @@ -53,12 +53,12 @@ define(["jquery", "easy-admin"], function ($, ea) { }, { field: 'virtual_sales', width: 100, title: '虚拟销量' }, { field: 'sales', width: 80, title: '销量' }, - { field: 'status', title: '状态', width: 85, selectList: { 0: '禁用', 1: '启用' }, templet: ea.table.switch }, + { field: 'status', title: '状态', width: 85, selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch }, { field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' }, { width: 250, title: '操作', - templet: ea.table.tool, + templet: ua.table.tool, fixed: 'right', operat: [ 'edit', @@ -81,19 +81,19 @@ define(["jquery", "easy-admin"], function ($, ea) { ]], }); - ea.listen(); + ua.listen(); }, add: function () { - ea.listen(); + ua.listen(); }, edit: function () { - ea.listen(); + ua.listen(); }, stock: function () { - ea.listen(); + ua.listen(); }, read: function () { - ea.listen(); + ua.listen(); }, }; return Controller; diff --git a/public/static/admin/js/mall/tag.js b/public/static/admin/js/mall/tag.js index 6924560..ea4a250 100644 --- a/public/static/admin/js/mall/tag.js +++ b/public/static/admin/js/mall/tag.js @@ -14,23 +14,23 @@ define(["jquery", "easy-admin"], function ($, ea) { var Controller = { index: function () { - ea.table.render({ + ua.table.render({ init: init, cols: [[ {type: 'checkbox'}, {field: 'id', title: 'id'}, {field: 'title', title: '名称'}, - {width: 250, title: '操作', templet: ea.table.tool}, + {width: 250, title: '操作', templet: ua.table.tool}, ]], }); - ea.listen(); + ua.listen(); }, add: function () { - ea.listen(); + ua.listen(); }, edit: function () { - ea.listen(); + ua.listen(); }, }; return Controller; diff --git a/public/static/admin/js/system/admin.js b/public/static/admin/js/system/admin.js index 6070808..ccee7b9 100644 --- a/public/static/admin/js/system/admin.js +++ b/public/static/admin/js/system/admin.js @@ -12,10 +12,10 @@ define(["jquery", "easy-admin"], function ($, ea) { password_url: 'system.admin/password', }; - var authList = ea.getDataBrage('auth_list', []); - var count = ea.getDataBrage('count', 0); - var tips = ea.getDataBrage('tips', ''); - var tips = ea.getDataBrage('adminCustomFlag'); + var authList = ua.getDataBrage('auth_list', []); + var count = ua.getDataBrage('count', 0); + var tips = ua.getDataBrage('tips', ''); + var tips = ua.getDataBrage('adminCustomFlag'); console.log(authList); console.log(count); @@ -25,24 +25,24 @@ define(["jquery", "easy-admin"], function ($, ea) { index: function () { - ea.table.render({ + ua.table.render({ init: init, cols: [[ { type: "checkbox" }, { field: 'id', width: 80, title: 'ID' }, { field: 'sort', width: 80, title: '排序', edit: 'text' }, { field: 'username', minWidth: 80, title: '登录账户' }, - { field: 'head_img', minWidth: 80, title: '头像', search: false, templet: ea.table.image }, + { field: 'head_img', minWidth: 80, title: '头像', search: false, templet: ua.table.image }, { field: 'phone', minWidth: 80, title: '手机' }, { field: 'login_num', minWidth: 80, title: '登录次数' }, { field: 'remark', minWidth: 80, title: '备注信息', defaultValue: '无' }, - { field: 'status', title: '状态', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ea.table.switch }, + { field: 'status', title: '状态', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch }, { field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' }, { width: 250, title: '操作', fixed: 'right', - templet: ea.table.tool, + templet: ua.table.tool, operat: [ 'edit', [{ @@ -59,16 +59,16 @@ define(["jquery", "easy-admin"], function ($, ea) { ]], }); - ea.listen(); + ua.listen(); }, add: function () { - ea.listen(); + ua.listen(); }, edit: function () { - ea.listen(); + ua.listen(); }, password: function () { - ea.listen(); + ua.listen(); } }; return Controller; diff --git a/public/static/admin/js/system/auth.js b/public/static/admin/js/system/auth.js index e8aa2fe..04d7f96 100644 --- a/public/static/admin/js/system/auth.js +++ b/public/static/admin/js/system/auth.js @@ -15,7 +15,7 @@ define(["jquery", "easy-admin"], function ($, ea) { var Controller = { index: function () { - ea.table.render({ + ua.table.render({ init: init, cols: [[ {type: "checkbox"}, @@ -23,12 +23,12 @@ define(["jquery", "easy-admin"], function ($, ea) { {field: 'sort', width: 80, title: '排序', edit: 'text'}, {field: 'title', minWidth: 80, title: '权限名称'}, {field: 'remark', minWidth: 80, title: '备注信息'}, - {field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch}, + {field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ua.table.switch}, {field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'}, { width: 250, title: '操作', - templet: ea.table.tool, + templet: ua.table.tool, operat: [ 'edit', [{ @@ -44,18 +44,18 @@ define(["jquery", "easy-admin"], function ($, ea) { ]], }); - ea.listen(); + ua.listen(); }, add: function () { - ea.listen(); + ua.listen(); }, edit: function () { - ea.listen(); + ua.listen(); }, authorize: function () { var tree = layui.tree; - ea.request.get( + ua.request.get( { url: window.location.href, }, function (res) { @@ -69,7 +69,7 @@ define(["jquery", "easy-admin"], function ($, ea) { } ); - ea.listen(function (data) { + ua.listen(function (data) { var checkedData = tree.getChecked('nodeDataId'); var ids = []; $.each(checkedData, function (i, v) { diff --git a/public/static/admin/js/system/config.js b/public/static/admin/js/system/config.js index 7929936..c6329c8 100644 --- a/public/static/admin/js/system/config.js +++ b/public/static/admin/js/system/config.js @@ -13,7 +13,7 @@ define(["jquery", "easy-admin", "vue"], function ($, ea, Vue) { $('.show-type-item.' + this.value).show(); }); - ea.listen(); + ua.listen(); } }; return Controller; diff --git a/public/static/admin/js/system/menu.js b/public/static/admin/js/system/menu.js index a89e211..3b7de2b 100644 --- a/public/static/admin/js/system/menu.js +++ b/public/static/admin/js/system/menu.js @@ -26,18 +26,18 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu homdPid: 99999999, treeIdName: 'id', treePidName: 'pid', - url: ea.url(init.index_url), + url: ua.url(init.index_url), elem: init.table_elem, id: init.table_render_id, toolbar: '#toolbar', page: false, skin: 'line', - // @todo 不直接使用ea.table.render(); 进行表格初始化, 需要使用 ea.table.formatCols(); 方法格式化`cols`列数据 - cols: ea.table.formatCols([[ + // @todo 不直接使用ua.table.render(); 进行表格初始化, 需要使用 ua.table.formatCols(); 方法格式化`cols`列数据 + cols: ua.table.formatCols([[ { type: 'checkbox' }, { field: 'title', sort: false, width: 250, title: '菜单名称', align: 'left' }, - { field: 'icon', sort: false, width: 80, title: '图标', templet: ea.table.icon }, + { field: 'icon', sort: false, width: 80, title: '图标', templet: ua.table.icon }, { field: 'href', sort: false, minWidth: 120, title: '菜单链接' }, { field: 'is_home', sort: false, @@ -54,13 +54,13 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu } } }, - { field: 'status', sort: false, title: '状态', width: 85, templet: ea.table.switch }, + { field: 'status', sort: false, title: '状态', width: 85, templet: ua.table.switch }, { field: 'sort', sort: false, width: 80, title: '排序', edit: 'text' }, { width: 220, title: '操作', fixed: 'right', - templet: ea.table.tool, + templet: ua.table.tool, operat: [ [{ text: '添加下级', @@ -94,7 +94,7 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu data: ['id', 'title'], _if(data) { - if (data.pid == ea.getDataBrage('menu_home_pid')) { + if (data.pid == ua.getDataBrage('menu_home_pid')) { return false } @@ -126,15 +126,15 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu $('body').on('click', '[data-treetable-delete-item]', function () { var id = $(this).data('id'); var url = $(this).attr('data-url'); - url = url != undefined ? ea.url(url) : window.location.href; - ea.msg.confirm('确定删除?', function () { - ea.request.post({ + url = url != undefined ? ua.url(url) : window.location.href; + ua.msg.confirm('确定删除?', function () { + ua.request.post({ url: url, data: { id: id }, }, function (res) { - ea.msg.success(res.msg, function () { + ua.msg.success(res.msg, function () { renderTable(); }); }); @@ -146,25 +146,25 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu var tableId = $(this).attr('data-treetable-delete'), url = $(this).attr('data-url'); tableId = tableId || init.table_render_id; - url = url != undefined ? ea.url(url) : window.location.href; + url = url != undefined ? ua.url(url) : window.location.href; var checkStatus = table.checkStatus(tableId), data = checkStatus.data; if (data.length <= 0) { - ea.msg.error('请勾选需要删除的数据'); + ua.msg.error('请勾选需要删除的数据'); return false; } var ids = []; $.each(data, function (i, v) { ids.push(v.id); }); - ea.msg.confirm('确定删除?', function () { - ea.request.post({ + ua.msg.confirm('确定删除?', function () { + ua.request.post({ url: url, data: { id: ids }, }, function (res) { - ea.msg.success(res.msg, function () { + ua.msg.success(res.msg, function () { renderTable(); }); }); @@ -172,11 +172,11 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu return false; }); - ea.table.listenSwitch({ filter: 'status', url: init.modify_url }); + ua.table.listenSwitch({ filter: 'status', url: init.modify_url }); - ea.table.listenEdit(init, 'currentTable', init.table_render_id, false); + ua.table.listenEdit(init, 'currentTable', init.table_render_id, false); - ea.listen(); + ua.listen(); }, add: function () { iconPickerFa.render({ @@ -192,17 +192,17 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu }); autocomplete.render({ elem: $('#href')[0], - url: ea.url('system.menu/getMenuTips'), + url: ua.url('system.menu/getMenuTips'), template_val: '{{-d.node}}', template_txt: '{{-d.node}} {{-d.title}}', onselect: function (resp) { } }); - ea.listen(function (data) { + ua.listen(function (data) { return data; }, function (res) { - ea.msg.success(res.msg, function () { + ua.msg.success(res.msg, function () { var index = parent.layer.getFrameIndex(window.name); parent.layer.close(index); parent.$('[data-treetable-refresh]').trigger("click"); @@ -223,17 +223,17 @@ define(["jquery", "easy-admin", "treetable", "iconPickerFa", "autocomplete"], fu }); autocomplete.render({ elem: $('#href')[0], - url: ea.url('system.menu/getMenuTips'), + url: ua.url('system.menu/getMenuTips'), template_val: '{{-d.node}}', template_txt: '{{-d.node}} {{-d.title}}', onselect: function (resp) { } }); - ea.listen(function (data) { + ua.listen(function (data) { return data; }, function (res) { - ea.msg.success(res.msg, function () { + ua.msg.success(res.msg, function () { var index = parent.layer.getFrameIndex(window.name); parent.layer.close(index); parent.$('[data-treetable-refresh]').trigger("click"); diff --git a/public/static/admin/js/system/node.js b/public/static/admin/js/system/node.js index 2da0d40..529d02d 100644 --- a/public/static/admin/js/system/node.js +++ b/public/static/admin/js/system/node.js @@ -13,7 +13,7 @@ define(["jquery", "easy-admin"], function ($, ea) { var Controller = { index: function () { - ea.table.render({ + ua.table.render({ init: init, search: false, page: false, @@ -52,17 +52,17 @@ define(["jquery", "easy-admin"], function ($, ea) { { field: 'node', sort: false, minWidth: 200, align: 'left', title: '系统节点' }, { field: 'title', sort: false, minWidth: 80, title: '节点名称 *', edit: 'text' }, { field: 'update_time', sort: false, minWidth: 80, title: '更新时间', search: 'range' }, - { field: 'is_auth', sort: false, title: '节点控制', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ea.table.switch }, + { field: 'is_auth', sort: false, title: '节点控制', width: 85, search: 'select', selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch }, ]], }); - ea.listen(); + ua.listen(); }, add: function () { - ea.listen(); + ua.listen(); }, edit: function () { - ea.listen(); + ua.listen(); } }; return Controller; diff --git a/public/static/admin/js/system/quick.js b/public/static/admin/js/system/quick.js index 8afbd3a..b6134e9 100644 --- a/public/static/admin/js/system/quick.js +++ b/public/static/admin/js/system/quick.js @@ -17,23 +17,23 @@ define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea var Controller = { index: function () { - ea.table.render({ + ua.table.render({ init: init, cols: [[ {type: "checkbox"}, {field: 'id', width: 80, title: 'ID'}, {field: 'sort', width: 80, title: '排序', edit: 'text'}, {field: 'title', minWidth: 80, title: '权限名称'}, - {field: 'icon', width: 80, title: '图标', templet: ea.table.icon}, + {field: 'icon', width: 80, title: '图标', templet: ua.table.icon}, {field: 'href', minWidth: 120, title: '快捷链接'}, {field: 'remark', minWidth: 80, title: '备注信息'}, - {field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch}, + {field: 'status', title: '状态', width: 85, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ua.table.switch}, {field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'}, - {width: 250, title: '操作', templet: ea.table.tool, operat: ['edit', 'delete']} + {width: 250, title: '操作', templet: ua.table.tool, operat: ['edit', 'delete']} ]], }); - ea.listen(); + ua.listen(); }, add: function () { iconPickerFa.render({ @@ -49,14 +49,14 @@ define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea }); autocomplete.render({ elem: $('#href')[0], - url: ea.url('system.menu/getMenuTips'), + url: ua.url('system.menu/getMenuTips'), template_val: '{{d.node}}', template_txt: '{{d.node}} {{d.title}}', onselect: function (resp) { } }); - ea.listen(); + ua.listen(); }, edit: function () { iconPickerFa.render({ @@ -72,14 +72,14 @@ define(["jquery", "easy-admin", "iconPickerFa", "autocomplete"], function ($, ea }); autocomplete.render({ elem: $('#href')[0], - url: ea.url('system.menu/getMenuTips'), + url: ua.url('system.menu/getMenuTips'), template_val: '{{d.node}}', template_txt: '{{d.node}} {{d.title}}', onselect: function (resp) { } }); - ea.listen(); + ua.listen(); }, }; return Controller; diff --git a/public/static/admin/js/system/uploadfile.js b/public/static/admin/js/system/uploadfile.js index dcd8a5a..9c7193f 100644 --- a/public/static/admin/js/system/uploadfile.js +++ b/public/static/admin/js/system/uploadfile.js @@ -14,15 +14,15 @@ define(["jquery", "easy-admin"], function ($, ea) { var Controller = { index: function () { - ea.table.render({ + ua.table.render({ init: init, cols: [[ { type: "checkbox" }, { field: 'id', width: 80, title: 'ID' }, { field: 'upload_type', minWidth: 80, title: '存储位置', search: 'select', selectList: { 'local': '本地', 'alioss': '阿里云', 'qnoss': '七牛云', ',txcos': '腾讯云' } }, - { field: 'url', minWidth: 80, search: false, title: '文件预览', templet: ea.table.filePreview }, + { field: 'url', minWidth: 80, search: false, title: '文件预览', templet: ua.table.filePreview }, { - field: 'url', minWidth: 120, title: '保存地址', templet: ea.table.url, urlNameField: function (data) { + field: 'url', minWidth: 120, title: '保存地址', templet: ua.table.url, urlNameField: function (data) { return data.url; } }, @@ -31,8 +31,8 @@ define(["jquery", "easy-admin"], function ($, ea) { { field: 'file_ext', minWidth: 80, title: '文件后缀' }, { field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' }, { - width: 250, title: '操作', templet: ea.table.tool, operat: ['delete'], fixed: 'right', hide: function () { - var selectMode = ea.getQueryVariable("select_mode"); + width: 250, title: '操作', templet: ua.table.tool, operat: ['delete'], fixed: 'right', hide: function () { + var selectMode = ua.getQueryVariable("select_mode"); console.log(selectMode); if (selectMode == 'radio' || selectMode == 'checkbox') { @@ -44,16 +44,16 @@ define(["jquery", "easy-admin"], function ($, ea) { ]], }); - ea.listen(); + ua.listen(); }, add: function () { - ea.listen(); + ua.listen(); }, edit: function () { - ea.listen(); + ua.listen(); }, password: function () { - ea.listen(); + ua.listen(); } }; return Controller; diff --git a/public/static/plugs/lay-module/layuimini/miniAdmin.js b/public/static/plugs/lay-module/layuimini/miniAdmin.js index 44c19bd..2f8f67f 100644 --- a/public/static/plugs/lay-module/layuimini/miniAdmin.js +++ b/public/static/plugs/lay-module/layuimini/miniAdmin.js @@ -1,16 +1,11 @@ -/** - * date:2020/02/27 - * author:Mr.Chung - * version:2.0 - * description:layuimini 主体框架扩展 - */ - - -define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, miniTheme, miniTab) { +(function () { var $ = layui.$, layer = layui.layer, - element = layui.element; + element = layui.element + miniMenu = window.miniMenu + miniTheme = window.miniTheme + miniTab = window.miniTab; if (!/http(s*):\/\//.test(location.href)) { var tips = "请先将项目部署至web容器(Apache/Tomcat/Nginx/IIS/等),否则部分数据将无法显示"; @@ -108,7 +103,7 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi * @param clearUrl */ renderClear: function (clearUrl) { - $('.layuimini-clear').attr('data-href',clearUrl); + $('.layuimini-clear').attr('data-href', clearUrl); }, /** @@ -175,7 +170,7 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi el.msExitFullscreen(); } else if (el.oRequestFullscreen) { el.oCancelFullScreen(); - }else if (el.mozCancelFullScreen) { + } else if (el.mozCancelFullScreen) { el.mozCancelFullScreen(); } else if (el.webkitCancelFullScreen) { el.webkitCancelFullScreen(); @@ -211,7 +206,7 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi * @returns {*} */ success: function (title) { - return layer.msg(title, {icon: 1, shade: this.shade, scrollbar: false, time: 2000, shadeClose: true}); + return layer.msg(title, { icon: 1, shade: this.shade, scrollbar: false, time: 2000, shadeClose: true }); }, /** @@ -220,7 +215,7 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi * @returns {*} */ error: function (title) { - return layer.msg(title, {icon: 2, shade: this.shade, scrollbar: false, time: 3000, shadeClose: true}); + return layer.msg(title, { icon: 2, shade: this.shade, scrollbar: false, time: 3000, shadeClose: true }); }, /** @@ -251,7 +246,7 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi * 清理 */ $('body').on('click', '[data-clear]', function () { - var loading = layer.load(0, {shade: false, time: 2 * 1000}); + var loading = layer.load(0, { shade: false, time: 2 * 1000 }); sessionStorage.clear(); // 判断是否清理服务端 @@ -293,14 +288,14 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi tips = $(this).prop("innerHTML"), isShow = $('.layuimini-tool i').attr('data-side-fold'); if (isShow == 0 && tips) { - tips = "" ; + tips = ""; window.openTips = layer.tips(tips, $(this), { tips: [2, '#2f4056'], time: 300000, - skin:"popup-tips", - success:function (el) { - var left = $(el).position().left - 10 ; - $(el).css({ left:left }); + skin: "popup-tips", + success: function (el) { + var left = $(el).position().left - 10; + $(el).css({ left: left }); element.render(); } }); @@ -350,5 +345,5 @@ define(["jquery", "miniMenu", "miniTheme", "miniTab"], function ($, miniMenu, mi - return miniAdmin; -}); \ No newline at end of file + window.miniAdmin = miniAdmin; +})() \ No newline at end of file diff --git a/public/static/plugs/lay-module/layuimini/miniMenu.js b/public/static/plugs/lay-module/layuimini/miniMenu.js index 40bbdd4..6e6ea9b 100644 --- a/public/static/plugs/lay-module/layuimini/miniMenu.js +++ b/public/static/plugs/lay-module/layuimini/miniMenu.js @@ -1,12 +1,6 @@ -/** - * date:2020/02/27 - * author:Mr.Chung - * version:2.0 - * description:layuimini 菜单框架扩展 - */ -define(["jquery"], function ($) { +(function () { var element = layui.element, - laytpl = layui.laytpl, + laytpl = layui.laytpl, layer = layui.layer; var miniMenu = { @@ -39,9 +33,9 @@ define(["jquery"], function ($) { var leftMenuHtml = '', childOpenClass = '', leftMenuCheckDefault = 'layui-this'; - var me = this ; + var me = this; if (menuChildOpen) childOpenClass = ' layui-nav-itemed'; - leftMenuHtml = this.renderLeftMenu(menuList,{ childOpenClass:childOpenClass }) ; + leftMenuHtml = this.renderLeftMenu(menuList, { childOpenClass: childOpenClass }); $('.layui-layout-body').addClass('layuimini-single-module'); //单模块标识 $('.layuimini-header-menu').remove(); $('.layuimini-menu-left').html(leftMenuHtml); @@ -52,63 +46,63 @@ define(["jquery"], function ($) { /** * 渲染一级菜单 */ - compileMenu: function(menu,isSub){ - var menuHtml = '' ; - if(isSub){ - menuHtml = '' + compileMenu: function (menu, isSub) { + var menuHtml = ''; + if (isSub) { + menuHtml = ''; } return laytpl(menuHtml).render(menu); }, - compileMenuContainer :function(menu,isSub){ - var wrapperHtml = '' ; - if(isSub){ - wrapperHtml = '
{{-d.children}}
' ; + compileMenuContainer: function (menu, isSub) { + var wrapperHtml = ''; + if (isSub) { + wrapperHtml = '
{{-d.children}}
'; } - if(!menu.children){ + if (!menu.children) { return ""; } return laytpl(wrapperHtml).render(menu); }, - each:function(list,callback){ + each: function (list, callback) { var _list = []; - for(var i = 0 ,length = list.length ; i= options.maxTabNum) { + if ($('.layuimini-tab .layui-tab-title li').length >= options.maxTabNum) { layer.msg('Tab窗口已达到限定数量,请先关闭部分Tab'); return false; } var ele = element; if (options.isIframe) ele = parent.layui.element; ele.tabAdd('layuiminiTab', { - title: '' + options.title + '' //用于演示 - , content: '' - , id: options.tabId + title: + '' + + options.title + + '', //用于演示 + content: + '', + id: options.tabId, }); $('.layuimini-menu-left').attr('layuimini-tab-tag', 'add'); sessionStorage.setItem('layuiminimenu_' + options.tabId, options.title); }, - /** * 切换选项卡 * @param tabId @@ -75,7 +71,7 @@ define(["jquery"], function ($) { */ delete: function (tabId, isParent) { // todo 未知BUG,不知道是不是layui问题,必须先删除元素 - $(".layuimini-tab .layui-tab-title .layui-unselect.layui-tab-bar").remove(); + $('.layuimini-tab .layui-tab-title .layui-unselect.layui-tab-bar').remove(); if (isParent === true) { parent.layui.element.tabDelete('layuiminiTab', tabId); @@ -90,7 +86,7 @@ define(["jquery"], function ($) { openNewTabByIframe: function (options) { options.href = options.href || null; options.title = options.title || null; - var loading = parent.layer.load(0, {shade: false, time: 2 * 1000}); + var loading = parent.layer.load(0, { shade: false, time: 2 * 1000 }); if (options.href === null || options.href === undefined) options.href = new Date().getTime(); var checkTab = miniTab.check(options.href, true); if (!checkTab) { @@ -109,7 +105,7 @@ define(["jquery"], function ($) { * 在iframe层关闭当前tab方法 */ deleteCurrentByIframe: function () { - var ele = $(".layuimini-tab .layui-tab-title li.layui-this", parent.document); + var ele = $('.layuimini-tab .layui-tab-title li.layui-this', parent.document); if (ele.length > 0) { var layId = $(ele[0]).attr('lay-id'); miniTab.delete(layId, true); @@ -123,14 +119,14 @@ define(["jquery"], function ($) { // 判断选项卡上是否有 var checkTab = false; if (isIframe === undefined || isIframe === false) { - $(".layui-tab-title li").each(function () { + $('.layui-tab-title li').each(function () { var checkTabId = $(this).attr('lay-id'); if (checkTabId != null && checkTabId === tabId) { checkTab = true; } }); } else { - parent.layui.$(".layui-tab-title li").each(function () { + parent.layui.$('.layui-tab-title li').each(function () { var checkTabId = $(this).attr('lay-id'); if (checkTabId != null && checkTabId === tabId) { checkTab = true; @@ -147,7 +143,12 @@ define(["jquery"], function ($) { */ openTabRignMenu: function (tabId, left) { miniTab.closeTabRignMenu(); - var menuHtml = '
\n' + + var menuHtml = + '
\n' + '
\n' + '
关 闭 当 前
\n' + '
关 闭 其 他
\n' + @@ -203,22 +204,22 @@ define(["jquery"], function ($) { * 打开新窗口 */ $('body').on('click', '[layuimini-href]', function () { - var loading = layer.load(0, {shade: false, time: 2 * 1000}); + var loading = layer.load(0, { shade: false, time: 2 * 1000 }); var tabId = $(this).attr('layuimini-href'), href = $(this).attr('layuimini-href'), title = $(this).text(), target = $(this).attr('target'); - var el = $("[layuimini-href='" + href + "']", ".layuimini-menu-left"); + var el = $("[layuimini-href='" + href + "']", '.layuimini-menu-left'); layer.close(window.openTips); if (el.length) { - $(el).closest(".layui-nav-tree").find(".layui-this").removeClass("layui-this"); - $(el).parent().addClass("layui-this"); + $(el).closest('.layui-nav-tree').find('.layui-this').removeClass('layui-this'); + $(el).parent().addClass('layui-this'); } if (target === '_blank') { layer.close(loading); - window.open(href, "_blank"); + window.open(href, '_blank'); return false; } @@ -241,14 +242,14 @@ define(["jquery"], function ($) { * 在iframe子菜单上打开新窗口 */ $('body').on('click', '[layuimini-content-href]', function () { - var loading = parent.layer.load(0, {shade: false, time: 2 * 1000}); + var loading = parent.layer.load(0, { shade: false, time: 2 * 1000 }); var tabId = $(this).attr('layuimini-content-href'), href = $(this).attr('layuimini-content-href'), title = $(this).attr('data-title'), target = $(this).attr('target'); if (target === '_blank') { parent.layer.close(loading); - window.open(href, "_blank"); + window.open(href, '_blank'); return false; } if (tabId === null || tabId === undefined) tabId = new Date().getTime(); @@ -270,7 +271,7 @@ define(["jquery"], function ($) { * 关闭选项卡 **/ $('body').on('click', '.layuimini-tab .layui-tab-title .layui-tab-close', function () { - var loading = layer.load(0, {shade: false, time: 2 * 1000}); + var loading = layer.load(0, { shade: false, time: 2 * 1000 }); var $parent = $(this).parent(); var tabId = $parent.attr('lay-id'); if (tabId !== undefined || tabId !== null) { @@ -283,9 +284,9 @@ define(["jquery"], function ($) { * 选项卡操作 */ $('body').on('click', '[layuimini-tab-close]', function () { - var loading = layer.load(0, {shade: false, time: 2 * 1000}); + var loading = layer.load(0, { shade: false, time: 2 * 1000 }); var closeType = $(this).attr('layuimini-tab-close'); - $(".layuimini-tab .layui-tab-title li").each(function () { + $('.layuimini-tab .layui-tab-title li').each(function () { var tabId = $(this).attr('lay-id'); var id = $(this).attr('id'); var isCurrent = $(this).hasClass('layui-this'); @@ -307,16 +308,18 @@ define(["jquery"], function ($) { /** * 禁用网页右键 */ - $(".layuimini-tab .layui-tab-title").unbind("mousedown").bind("contextmenu", function (e) { - e.preventDefault(); - return false; - }); + $('.layuimini-tab .layui-tab-title') + .unbind('mousedown') + .bind('contextmenu', function (e) { + e.preventDefault(); + return false; + }); /** * 注册鼠标右键 */ $('body').on('mousedown', '.layuimini-tab .layui-tab-title li', function (e) { - var left = $(this).offset().left - $('.layuimini-tab ').offset().left + ($(this).width() / 2), + var left = $(this).offset().left - $('.layuimini-tab ').offset().left + $(this).width() / 2, tabId = $(this).attr('lay-id'); if (e.which === 3) { miniTab.openTabRignMenu(tabId, left); @@ -334,10 +337,10 @@ define(["jquery"], function ($) { * tab右键选项卡操作 */ $('body').on('click', '[layuimini-tab-menu-close]', function () { - var loading = layer.load(0, {shade: false, time: 2 * 1000}); + var loading = layer.load(0, { shade: false, time: 2 * 1000 }); var closeType = $(this).attr('layuimini-tab-menu-close'), currentTabId = $('.layuimini-tab-mousedown').attr('data-tab-id'); - $(".layuimini-tab .layui-tab-title li").each(function () { + $('.layuimini-tab .layui-tab-title li').each(function () { var tabId = $(this).attr('lay-id'); var id = $(this).attr('id'); if (id !== 'layuiminiHomeTabId') { @@ -365,9 +368,7 @@ define(["jquery"], function ($) { options.filter = options.filter || null; options.multiModule = options.multiModule || false; options.urlHashLocation = options.urlHashLocation || false; - options.listenSwichCallback = options.listenSwichCallback || function () { - - }; + options.listenSwichCallback = options.listenSwichCallback || function () { }; element.on('tab(' + options.filter + ')', function (data) { var tabId = $(this).attr('lay-id'); if (options.urlHashLocation) { @@ -378,9 +379,9 @@ define(["jquery"], function ($) { } // 判断是否为新增窗口 if ($('.layuimini-menu-left').attr('layuimini-tab-tag') === 'add') { - $('.layuimini-menu-left').attr('layuimini-tab-tag', 'no') + $('.layuimini-menu-left').attr('layuimini-tab-tag', 'no'); } else { - $("[layuimini-href]").parent().removeClass('layui-this'); + $('[layuimini-href]').parent().removeClass('layui-this'); if (options.multiModule) { miniTab.listenSwitchMultiModule(tabId); } else { @@ -403,10 +404,10 @@ define(["jquery"], function ($) { options.menuList = options.menuList || []; if (!options.urlHashLocation) return false; var tabId = location.hash.replace(/^#/, ''); - if (tabId === null || tabId === undefined || tabId ==='') return false; + if (tabId === null || tabId === undefined || tabId === '') return false; // 判断是否为首页 - if(tabId ===options.homeInfo.href) return false; + if (tabId === options.homeInfo.href) return false; // 判断是否为右侧菜单 var menu = miniTab.searchMenu(tabId, options.menuList); @@ -425,9 +426,9 @@ define(["jquery"], function ($) { // 判断是否为快捷菜单 var isSearchMenu = false; - $("[layuimini-content-href]").each(function () { - if ($(this).attr("layuimini-content-href") === tabId) { - var title = $(this).attr("data-title"); + $('[layuimini-content-href]').each(function () { + if ($(this).attr('layuimini-content-href') === tabId) { + var title = $(this).attr('data-title'); miniTab.create({ tabId: tabId, href: tabId, @@ -444,7 +445,10 @@ define(["jquery"], function ($) { if (isSearchMenu) return false; // 既不是右侧菜单、快捷菜单,就直接打开 - var title = sessionStorage.getItem('layuiminimenu_' + tabId) === null ? tabId : sessionStorage.getItem('layuiminimenu_' + tabId); + var title = + sessionStorage.getItem('layuiminimenu_' + tabId) === null + ? tabId + : sessionStorage.getItem('layuiminimenu_' + tabId); miniTab.create({ tabId: tabId, href: tabId, @@ -460,11 +464,11 @@ define(["jquery"], function ($) { * 监听滚动 */ listenRoll: function () { - $(".layuimini-tab-roll-left").click(function () { - miniTab.rollClick("left"); + $('.layuimini-tab-roll-left').click(function () { + miniTab.rollClick('left'); }); - $(".layuimini-tab-roll-right").click(function () { - miniTab.rollClick("right"); + $('.layuimini-tab-roll-right').click(function () { + miniTab.rollClick('right'); }); }, @@ -473,21 +477,21 @@ define(["jquery"], function ($) { * @param tabId */ listenSwitchSingleModule: function (tabId) { - $("[layuimini-href]").each(function () { - if ($(this).attr("layuimini-href") === tabId) { + $('[layuimini-href]').each(function () { + if ($(this).attr('layuimini-href') === tabId) { // 自动展开菜单栏 var addMenuClass = function ($element, type) { if (type === 1) { $element.addClass('layui-this'); if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-this')) { - $(".layuimini-header-menu li").attr('class', 'layui-nav-item'); + $('.layuimini-header-menu li').attr('class', 'layui-nav-item'); } else { addMenuClass($element.parent().parent(), 2); } } else { $element.addClass('layui-nav-itemed'); if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-nav-itemed')) { - $(".layuimini-header-menu li").attr('class', 'layui-nav-item'); + $('.layuimini-header-menu li').attr('class', 'layui-nav-item'); } else { addMenuClass($element.parent().parent(), 2); } @@ -504,19 +508,21 @@ define(["jquery"], function ($) { * @param tabId */ listenSwitchMultiModule: function (tabId) { - $("[layuimini-href]").each(function () { - if ($(this).attr("layuimini-href") === tabId) { - + $('[layuimini-href]').each(function () { + if ($(this).attr('layuimini-href') === tabId) { // 自动展开菜单栏 var addMenuClass = function ($element, type) { if (type === 1) { $element.addClass('layui-this'); if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-this')) { var moduleId = $element.parent().attr('id'); - $(".layuimini-header-menu li").attr('class', 'layui-nav-item'); - $("#" + moduleId + "HeaderId").addClass("layui-this"); - $(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide'); - $("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this'); + $('.layuimini-header-menu li').attr('class', 'layui-nav-item'); + $('#' + moduleId + 'HeaderId').addClass('layui-this'); + $('.layuimini-menu-left .layui-nav.layui-nav-tree').attr( + 'class', + 'layui-nav layui-nav-tree layui-hide', + ); + $('#' + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this'); } else { addMenuClass($element.parent().parent(), 2); } @@ -524,10 +530,13 @@ define(["jquery"], function ($) { $element.addClass('layui-nav-itemed'); if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-nav-itemed')) { var moduleId = $element.parent().attr('id'); - $(".layuimini-header-menu li").attr('class', 'layui-nav-item'); - $("#" + moduleId + "HeaderId").addClass("layui-this"); - $(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide'); - $("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this'); + $('.layuimini-header-menu li').attr('class', 'layui-nav-item'); + $('#' + moduleId + 'HeaderId').addClass('layui-this'); + $('.layuimini-menu-left .layui-nav.layui-nav-tree').attr( + 'class', + 'layui-nav layui-nav-tree layui-hide', + ); + $('#' + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this'); } else { addMenuClass($element.parent().parent(), 2); } @@ -545,16 +554,19 @@ define(["jquery"], function ($) { rollPosition: function () { var $tabTitle = $('.layuimini-tab .layui-tab-title'); var autoLeft = 0; - $tabTitle.children("li").each(function () { + $tabTitle.children('li').each(function () { if ($(this).hasClass('layui-this')) { return false; } else { autoLeft += $(this).outerWidth(); } }); - $tabTitle.animate({ - scrollLeft: autoLeft - $tabTitle.width() / 3 - }, 200); + $tabTitle.animate( + { + scrollLeft: autoLeft - $tabTitle.width() / 3, + }, + 200, + ); }, /** @@ -565,17 +577,22 @@ define(["jquery"], function ($) { var $tabTitle = $('.layuimini-tab .layui-tab-title'); var left = $tabTitle.scrollLeft(); if ('left' === direction) { - $tabTitle.animate({ - scrollLeft: left - 450 - }, 200); + $tabTitle.animate( + { + scrollLeft: left - 450, + }, + 200, + ); } else { - $tabTitle.animate({ - scrollLeft: left + 450 - }, 200); + $tabTitle.animate( + { + scrollLeft: left + 450, + }, + 200, + ); } - } - + }, }; - return miniTab; -}); \ No newline at end of file + window.miniTab = miniTab; +})(); diff --git a/public/static/plugs/lay-module/layuimini/miniTheme.js b/public/static/plugs/lay-module/layuimini/miniTheme.js index 8e2bab6..e274ff7 100644 --- a/public/static/plugs/lay-module/layuimini/miniTheme.js +++ b/public/static/plugs/lay-module/layuimini/miniTheme.js @@ -1,10 +1,4 @@ -/** - * date:2020/02/28 - * author:Mr.Chung - * version:2.0 - * description:layuimini tab框架扩展 - */ -define(["jquery"], function ($) { +(function () { var $ = layui.$, layer = layui.layer; @@ -486,7 +480,7 @@ define(["jquery"], function ($) { { title: '拟物', className: 'neomorphic', - + }, ] return listElemStyle; @@ -606,6 +600,5 @@ define(["jquery"], function ($) { } }; - return miniTheme; -}) - ; \ No newline at end of file + window.miniTheme = miniTheme; +})(); \ No newline at end of file diff --git a/public/static/plugs/lay-module/layuimini/miniTongji.js b/public/static/plugs/lay-module/layuimini/miniTongji.js deleted file mode 100644 index 540e623..0000000 --- a/public/static/plugs/lay-module/layuimini/miniTongji.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * date:2020/03/01 - * author:Mr.Chung - * version:2.0 - * description:layuimini 统计框架扩展 - */ -define(["jquery"], function ($) { - var $ = layui.$; - - var miniTongji = { - - /** - * 初始化 - * @param options - */ - render: function (options) { - options.specific = options.specific || false; - options.domains = options.domains || []; - var domain = window.location.hostname; - if (options.specific === false || (options.specific === true && options.domains.indexOf(domain) >=0)) { - miniTongji.listen(); - } - }, - - /** - * 监听统计代码 - */ - listen: function () { - var _hmt = _hmt || []; - (function () { - var hm = document.createElement("script"); - hm.src = "https://hm.baidu.com/hm.js?d97abf6d61c21d773f97835defbdef4e"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(hm, s); - })(); - } - }; - - return miniTongji; -}); \ No newline at end of file diff --git a/public/static/plugs/lay-module/propertyInput/propertyInput.js b/public/static/plugs/lay-module/propertyInput/propertyInput.js index b180d89..384046f 100644 --- a/public/static/plugs/lay-module/propertyInput/propertyInput.js +++ b/public/static/plugs/lay-module/propertyInput/propertyInput.js @@ -1,15 +1,17 @@ -define(['jquery', 'vue'], function ($, Vue) { +(function () { const propertyInputCss = '/static/plugs/lay-module/propertyInput/propertyInput.css'; const propertyInputHtml = '/static/plugs/lay-module/propertyInput/propertyInput.html'; var propertyInput = function () { - var cssElement = document.createElement('link'); + $(function () { + var cssElement = document.createElement('link'); - cssElement.setAttribute('rel', 'stylesheet'); + cssElement.setAttribute('rel', 'stylesheet'); - cssElement.setAttribute('href', propertyInputCss); + cssElement.setAttribute('href', propertyInputCss); - document.body.appendChild(cssElement); + document.body.appendChild(cssElement); + }); }; var propertyInputTemplate = ''; @@ -29,11 +31,11 @@ define(['jquery', 'vue'], function ($, Vue) { var defaultOption = { placeholder: '请选择', required: '' - } + }; var options = $.extend(defaultOption, data); - options.value = $.trim(options.value) + options.value = $.trim(options.value); app = new Vue({ @@ -48,7 +50,7 @@ define(['jquery', 'vue'], function ($, Vue) { value: '' } ] - } + }; }, watch: { listItem: { @@ -63,7 +65,7 @@ define(['jquery', 'vue'], function ($, Vue) { created() { if (this.setting.value) { - if(typeof this.setting.value === 'string'){ + if (typeof this.setting.value === 'string') { this.setting.value = JSON.parse(this.setting.value); } this.listItem = this.setting.value; @@ -81,13 +83,13 @@ define(['jquery', 'vue'], function ($, Vue) { methods: { removeItem(item, index) { - this.listTag.splice(index, 1) + this.listTag.splice(index, 1); }, onAddItem() { this.listItem.push({ name: '', value: '' - }) + }); }, onItemNameChange(item, index, event) { this.listItem[index].name = event.target.value; @@ -99,17 +101,17 @@ define(['jquery', 'vue'], function ($, Vue) { onItemMoveUp(item, index) { var arr = this.listItem; if (index != 0) { - arr[index] = arr.splice(index - 1, 1, arr[index])[0] + arr[index] = arr.splice(index - 1, 1, arr[index])[0]; } else { - arr.push(arr.shift()) + arr.push(arr.shift()); } }, onItemMoveDown(item, index) { var arr = this.listItem; if (index != arr.length - 1) { - arr[index] = arr.splice(index + 1, 1, arr[index])[0] + arr[index] = arr.splice(index + 1, 1, arr[index])[0]; } else { - arr.unshift(arr.splice(index, 1)[0]) + arr.unshift(arr.splice(index, 1)[0]); } }, @@ -120,16 +122,16 @@ define(['jquery', 'vue'], function ($, Vue) { name: '', value: '' } - ] + ]; } else { - this.listItem.splice(index, 1) + this.listItem.splice(index, 1); } }, } - }) + }); return app; - } + }; - return new propertyInput(); -}) \ No newline at end of file + window.propertyInput = new propertyInput(); +})(); \ No newline at end of file diff --git a/public/static/plugs/lay-module/tableData/tableData.js b/public/static/plugs/lay-module/tableData/tableData.js index ce46476..d532cbb 100644 --- a/public/static/plugs/lay-module/tableData/tableData.js +++ b/public/static/plugs/lay-module/tableData/tableData.js @@ -1,15 +1,14 @@ -define(['jquery', 'vue'], function ($, Vue) { +(function () { const tableDataCss = '/static/plugs/lay-module/tableData/tableData.css'; const tableDataHtml = '/static/plugs/lay-module/tableData/tableData.html'; var tableData = function () { - var cssElement = document.createElement('link'); - - cssElement.setAttribute('rel', 'stylesheet'); - - cssElement.setAttribute('href', tableDataCss); - - document.body.appendChild(cssElement); + $(function () { + var cssElement = document.createElement('link'); + cssElement.setAttribute('rel', 'stylesheet'); + cssElement.setAttribute('href', tableDataCss); + document.body.appendChild(cssElement); + }); }; var tableDataTemplate = ''; @@ -42,19 +41,19 @@ define(['jquery', 'vue'], function ($, Vue) { height: clientHeight, placeholder: '请选择', selectConfirmCallback: 'onTableDataConfirm', - } + }; var options = $.extend(defaultOption, data); var valueField = options.valueField; if (options.index.indexOf('?') > -1) { - options.index += '&' + options.index += '&'; } else { - options.index += '?' + options.index += '?'; } - options.index += 'select_mode=' + options.selectType + options.index += 'select_mode=' + options.selectType; app = new Vue({ el: elem, @@ -63,14 +62,14 @@ define(['jquery', 'vue'], function ($, Vue) { setting: options, listSelected: [], value: '' - } + }; }, watch: { listSelected(value) { - var valueList = value.map(itemValue => itemValue[valueField]) + var valueList = value.map(itemValue => itemValue[valueField]); - this.value = valueList.join(',') + this.value = valueList.join(','); } }, created() { @@ -87,9 +86,9 @@ define(['jquery', 'vue'], function ($, Vue) { op: JSON.stringify({ [options.valueField]: 'in' }), group: options.valueField }, (result) => { - loading.hide() + loading.hide(); this.listSelected = result.data; - }) + }); }, mounted() { @@ -102,7 +101,7 @@ define(['jquery', 'vue'], function ($, Vue) { methods: { openSelectPage() { - if(options.readonly == 1){ + if (options.readonly == 1) { return false; } @@ -124,17 +123,17 @@ define(['jquery', 'vue'], function ($, Vue) { this.listSelected = []; } - var itemFind = this.listSelected.find(itemSelect => itemSelect[valueField] == dataItem[valueField]) + var itemFind = this.listSelected.find(itemSelect => itemSelect[valueField] == dataItem[valueField]); if (itemFind == undefined) { - this.listSelected.push(dataItem) + this.listSelected.push(dataItem); } }); this.$forceUpdate(); layer.close(index); - } + }; }, end: function () { @@ -148,10 +147,10 @@ define(['jquery', 'vue'], function ($, Vue) { this.listSelected.splice(index, 1); } } - }) + }); return app; - } + }; - return new tableData(); -}) \ No newline at end of file + window.tableData = new tableData(); +})(); \ No newline at end of file diff --git a/public/static/plugs/lay-module/tagInput/tagInput.js b/public/static/plugs/lay-module/tagInput/tagInput.js index 2201653..25390e6 100644 --- a/public/static/plugs/lay-module/tagInput/tagInput.js +++ b/public/static/plugs/lay-module/tagInput/tagInput.js @@ -1,15 +1,17 @@ -define(['jquery', 'vue'], function ($, Vue) { +(function () { const tagInputCss = '/static/plugs/lay-module/tagInput/tagInput.css'; const tagInputHtml = '/static/plugs/lay-module/tagInput/tagInput.html'; var tagInput = function () { - var cssElement = document.createElement('link'); + $(function () { + var cssElement = document.createElement('link'); - cssElement.setAttribute('rel', 'stylesheet'); + cssElement.setAttribute('rel', 'stylesheet'); - cssElement.setAttribute('href', tagInputCss); + cssElement.setAttribute('href', tagInputCss); - document.body.appendChild(cssElement); + document.body.appendChild(cssElement); + }); }; var tagInputTemplate = ''; @@ -29,7 +31,7 @@ define(['jquery', 'vue'], function ($, Vue) { var defaultOption = { placeholder: '请选择', required: '' - } + }; var options = $.extend(defaultOption, data); @@ -45,21 +47,21 @@ define(['jquery', 'vue'], function ($, Vue) { inputWidth: 100, inputValuePreview: '', listTag: [] - } + }; }, watch: { inputValue(value) { this.inputValuePreview = value; - this.updateInputWidth() + this.updateInputWidth(); }, listTag(value) { - this.value = value.join(',') + this.value = value.join(','); } }, created() { if (options.value.length > 0) { - this.listTag = options.value.split(',') + this.listTag = options.value.split(','); } @@ -80,12 +82,12 @@ define(['jquery', 'vue'], function ($, Vue) { return false; } - this.listTag.push(this.inputValue) + this.listTag.push(this.inputValue); this.inputValue = ''; return false; }, onContainerClick() { - $(this.$refs['tagInputMain']).focus() + $(this.$refs['tagInputMain']).focus(); }, onInputChange(e) { @@ -102,13 +104,13 @@ define(['jquery', 'vue'], function ($, Vue) { this.inputWidth = width + 60; }, removeItem(item, index) { - this.listTag.splice(index, 1) + this.listTag.splice(index, 1); } } - }) + }); return app; - } + }; - return new tagInput(); -}) \ No newline at end of file + window.tagInput = new tagInput(); +})(); \ No newline at end of file diff --git a/public/static/plugs/easy-admin/easy-admin.js b/public/static/plugs/ulthon-admin/ulthon-admin.js similarity index 96% rename from public/static/plugs/easy-admin/easy-admin.js rename to public/static/plugs/ulthon-admin/ulthon-admin.js index ba9d587..6607300 100644 --- a/public/static/plugs/easy-admin/easy-admin.js +++ b/public/static/plugs/ulthon-admin/ulthon-admin.js @@ -1,16 +1,16 @@ -define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput', 'propertyInput', 'miniTab', 'clipboardjs'], function ($, undefined, miniTheme, tableData, citypicker, tagInput, propertyInput, miniTab, ClipboardJS) { +(function () { window.onInitElemStyle = function () { - miniTheme.renderElemStyle() + miniTheme.renderElemStyle(); $('iframe').each(function (index, iframe) { if (typeof iframe.contentWindow.onInitElemStyle == "function") { iframe.contentWindow.onInitElemStyle(); } - }) + }); - } + }; window.onInitElemStyle(); var lastTableWhere = {}; @@ -60,7 +60,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' // visio扩展名数组 'visio': ['vsd', 'vsdx'], 'file': [] - } + }; var allExtGroup = []; @@ -68,14 +68,14 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (Object.hasOwnProperty.call(extGroup, extGroupName)) { const extGroupList = extGroup[extGroupName]; - allExtGroup = allExtGroup.concat(extGroupList) + allExtGroup = allExtGroup.concat(extGroupList); } } - init.upload_exts += allExtGroup.join('|') + init.upload_exts += allExtGroup.join('|'); - extGroup['office'] = [].concat(extGroup['word'], extGroup['excel'], extGroup['ppt'], extGroup['pdf']) - extGroup['media'] = [].concat(extGroup['image'], extGroup['music'], extGroup['video']) + extGroup['office'] = [].concat(extGroup['word'], extGroup['excel'], extGroup['ppt'], extGroup['pdf']); + extGroup['media'] = [].concat(extGroup['image'], extGroup['music'], extGroup['video']); var admin = { config: { @@ -143,7 +143,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (option.prefix == true) { option.url = admin.url(option.url); } - loading.show() + loading.show(); $.ajax({ url: option.url, type: type, @@ -202,7 +202,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' success: function (msg, callback) { if (callback === undefined) { callback = function () { - } + }; } var index = layer.msg(msg, { icon: 1, shade: admin.config.shade, scrollbar: false, time: 800, shadeClose: true }, callback); return index; @@ -211,7 +211,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' error: function (msg, callback) { if (callback === undefined) { callback = function () { - } + }; } var index = layer.msg(msg, { icon: 2, shade: admin.config.shade, scrollbar: false, time: 3000, shadeClose: true }, callback); return index; @@ -272,10 +272,10 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' layEvent: 'TABLE_SEARCH', icon: 'layui-icon-search', extend: 'data-table-id="' + options.id + '"' - }) + }); } if (options.defaultToolbar === undefined) { - options.defaultToolbar = defaultToolbar + options.defaultToolbar = defaultToolbar; } var table2card = function () { @@ -289,20 +289,20 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if ($(cell).hasClass('laytable-cell-checkbox')) { colsHeader.push('选择'); } else { - colsHeader.push($(cell).find('span').first().text()) + colsHeader.push($(cell).find('span').first().text()); } - }) + }); domTable.find('.layui-table-main').find('tr').each(function (index, domTr) { $(domTr).find('td').each(function (indexTd, domTd) { - $('
' + colsHeader[indexTd] + '
').insertBefore($(domTd).find('.layui-table-cell')) - }) - }) + $('
' + colsHeader[indexTd] + '
').insertBefore($(domTd).find('.layui-table-cell')); + }); + }); } - } + }; var tableFixedAutoHeight = function () { $(".layui-table-main tr").each(function (index, val) { @@ -310,20 +310,20 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' $($(this).find(".layui-table-body tbody tr")[index]).height($(val).height()); }); }); - } + }; - var optionDone = function () { } + var optionDone = function () { }; if (options.done != undefined) { optionDone = options.done; } options.done = function () { - optionDone() - table2card() - tableFixedAutoHeight() + optionDone(); + table2card(); + tableFixedAutoHeight(); // 监听表格内的复制组件 admin.api.copyText('[lay-id=' + options.id + ']'); - } + }; selectMode = admin.getQueryVariable("select_mode"); @@ -343,7 +343,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' options.page = { layout: ['first', 'prev', 'page', 'next', 'last', 'count'] - } + }; } @@ -353,7 +353,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' } else if (options.cols[0][0].type != 'checkbox') { options.cols[0].unshift({ type: 'checkbox' - }) + }); } } else if (selectMode == 'radio') { if (options.cols[0][0].type == 'checkbox') { @@ -362,7 +362,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' } else if (options.cols[0][0].type != 'radio') { options.cols[0].unshift({ type: 'radio' - }) + }); } } @@ -384,13 +384,13 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (selectMode == 'checkbox' || selectMode == 'radio') { options.toolbar.unshift('selectConfirm'); - options.height = 'full-85' + options.height = 'full-85'; } if (options.init.formFullScreen == true) { - options.init.formFullScreen = 'true' + options.init.formFullScreen = 'true'; } else { - options.init.formFullScreen = 'false' + options.init.formFullScreen = 'false'; } options.toolbar = admin.table.renderToolbar(options.toolbar, options.elem, options.id, options.init); @@ -402,7 +402,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' options.cols = admin.table.renderTrueHide(options.cols, options); - var parseData = function (res) { return res } + var parseData = function (res) { return res; }; if (typeof options.parseData === 'function') { parseData = options.parseData; @@ -428,9 +428,9 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' } } - res = parseData(res) + res = parseData(res); return res; - } + }; // 初始化表格 @@ -452,7 +452,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' admin.table.listenExport(options); // 监听表格选择器 - admin.table.listenTableSelectConfirm(options) + admin.table.listenTableSelectConfirm(options); return newTable; }, @@ -523,7 +523,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var fieldPlusArr = d.fieldAlias.replace('[').split(']'); - d.elemIdName = fieldPlusArr.join('-') + d.elemIdName = fieldPlusArr.join('-'); } d.elemIdName = d.elemIdName.replace('.', '-'); @@ -543,7 +543,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var formSearchHideClass = ''; if (d.searchHide) { - formSearchHideClass = ' search-hide-item' + formSearchHideClass = ' search-hide-item'; } if (d.field !== false && d.search !== false) { @@ -653,7 +653,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' options.where = { filter: JSON.stringify(formatFilter), op: JSON.stringify(formatOp) - } + }; lastTableWhere[tableId] = options.where; @@ -689,7 +689,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' for (k in item) { var v = item[k]; if (v.auth == undefined) { - v.auth = 'add' + v.auth = 'add'; } if (admin.checkAuth(v.auth, elem)) { check = true; @@ -699,7 +699,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' } } if (!check) { - data[dk].pop() + data[dk].pop(); } } @@ -715,7 +715,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' col.forEach(colItem => { var trueHide = false; if (typeof colItem.trueHide == 'function') { - trueHide = colItem.trueHide(colItem, col, options) + trueHide = colItem.trueHide(colItem, col, options); } else if (typeof colItem.trueHide == 'string') { trueHide = !admin.checkAuth(colItem.trueHide, options.elem); } else { @@ -723,11 +723,11 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' } if (!trueHide) { - newCol.push(colItem) + newCol.push(colItem); } }); - newData.push(newCol) + newData.push(newCol); } return newData; @@ -782,18 +782,18 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (typeof operat.titleField == 'function') { console.log(operat.titleField(data, operat)); - titleEndfix = operat.titleField(data, operat) + titleEndfix = operat.titleField(data, operat); } else if (data[operat.titleField]) { titleEndfix = '-' + data[operat.titleField]; } if (typeof operat.text == 'function') { - operat.text = operat.text(data, operat) + operat.text = operat.text(data, operat); } if (typeof operat.title == 'function') { - operat.title = operat.title(data, operat) + operat.title = operat.title(data, operat); } var formatOperat = operat; @@ -813,7 +813,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' formatOperat.dataBind = ' '; operat.data.forEach((item, index) => { - formatOperat.dataBind += 'data-' + item + '="' + data[item] + '" ' + formatOperat.dataBind += 'data-' + item + '="' + data[item] + '" '; }); html = '' + formatOperat.icon + formatOperat.text + ''; @@ -836,11 +836,11 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (val['width'] == undefined && val['minWidth'] == undefined) { var width = null; if (val.title) { - width = val.title.length * 15 + 55 + width = val.title.length * 15 + 55; } if (width != null) { - cols[i][index]['minWidth'] = width + cols[i][index]['minWidth'] = width; } } @@ -953,11 +953,11 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' endVal.endTemplet = endVal.templet; endVal.templet = function (data) { if (!data.LAY_COL) { - data.LAY_COL = this + data.LAY_COL = this; } - return this.endTemplet(data) - } + return this.endTemplet(data); + }; cols[i][index] = endVal; @@ -1023,7 +1023,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' operat.text = operat.text || operat.title; operat.extend = operat.extend || ''; - operat._if = operat._if || function () { return true }; + operat._if = operat._if || function () { return true; }; if (typeof operat._if == 'function') { if (operat._if(data, operat) !== true) { @@ -1032,7 +1032,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' } else if (typeof operat._if == 'string') { var ifValue = admin.table.returnColumnValue(data, operat._if, false); if (!ifValue) { - return '' + return ''; } } @@ -1056,17 +1056,17 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var fieldParam = operat.field(data, operat); if (typeof fieldParam == 'string') { - operat.url = fieldParam + operat.url = fieldParam; } else { var querys = ''; if (operat.url.indexOf("?") !== -1) { if (operat.url.indexOf("?") !== operat.url.length - 1) { - querys = '&' + querys = '&'; } } else { - querys = '?' + querys = '?'; } - operat.url += querys + $.param(fieldParam) + operat.url += querys + $.param(fieldParam); } } @@ -1101,7 +1101,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var groupName = admin.getExtGroupName(data.file_ext); - return '' + return ''; } }, @@ -1133,7 +1133,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var value = admin.table.returnColumnValue(data); if (admin.empty(value)) { - return '' + return ''; } var urlName = value; @@ -1143,9 +1143,9 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var urlNameFieldType = typeof urlNameField; if (urlNameFieldType == 'string') { - urlName = data[urlNameField] + urlName = data[urlNameField]; } else if (urlNameFieldType == 'function') { - urlName = urlNameField(data) + urlName = urlNameField(data); } } catch (e) { @@ -1202,8 +1202,8 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' }, bytes: (data) => { var size = admin.table.returnColumnValue(data); - sizeReadable = admin.bytes(size) - return sizeReadable + sizeReadable = admin.bytes(size); + return sizeReadable; }, copyText(data) { var option = data.LAY_COL; @@ -1248,7 +1248,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (val !== '') { formatFilter[key] = val; - var elemId = admin.table.renderSearchFormItemElementId(key) + var elemId = admin.table.renderSearchFormItemElementId(key); var op = $('#c-' + elemId).attr('data-search-op'); op = op || '%*%'; @@ -1259,8 +1259,8 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var where = { filter: JSON.stringify(formatFilter), op: JSON.stringify(formatOp) - } - lastTableWhere[tableId] = where + }; + lastTableWhere[tableId] = where; table.reloadData(tableId, { page: { curr: 1 @@ -1313,7 +1313,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var lastWhere = lastTableWhere[option.id] ?? {}; - lastWhere.sort = {} + lastWhere.sort = {}; lastWhere.sort[obj.field] = obj.type; table.reloadData(option.id, { @@ -1383,7 +1383,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' } parent.window[selectConfirmCallback](checkStatus.data); - }) + }); }, listenExport: function (options) { @@ -1407,7 +1407,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' switch (col.fieldFormat) { case 'image': - imageFields.push(col.field) + imageFields.push(col.field); break; case 'select': @@ -1417,7 +1417,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' break; case 'date': - dateFields.push(col.field) + dateFields.push(col.field); break; default: @@ -1445,7 +1445,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (val !== '') { formatFilter[key] = val; - var elemId = admin.table.renderSearchFormItemElementId(key) + var elemId = admin.table.renderSearchFormItemElementId(key); var op = $('#c-' + elemId).attr('data-search-op'); op = op || '%*%'; @@ -1460,7 +1460,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' image_fields: JSON.stringify(imageFields), select_fields: JSON.stringify(selectFields), date_fields: JSON.stringify(dateFields), - } + }; var query = $.param(searchQuery); @@ -1470,11 +1470,11 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (toUrl.indexOf('?') < 0) { toUrl += '?'; } else { - toUrl += '&' + toUrl += '&'; } toUrl += query; - window.open(toUrl) + window.open(toUrl); layer.close(index); }); @@ -1538,7 +1538,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' } }, end: function () { - index = null + index = null; } }); if (admin.checkMobile() || width === undefined || height === undefined) { @@ -1547,7 +1547,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (isResize) { $(window).on("resize", function () { index && layer.full(index); - }) + }); } }, listen: function (preposeCallback, ok, no, ex) { @@ -1785,7 +1785,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' location.reload(); } }); - }) + }); }); return false; }); @@ -1827,8 +1827,8 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' api: { button: function () { $('button[target="_blank"]').click(function () { - window.open(admin.url($(this).attr('href'))) - }) + window.open(admin.url($(this).attr('href'))); + }); }, form: function (url, data, ok, no, ex, refreshTable) { if (refreshTable === undefined) { @@ -1881,7 +1881,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' // var options = { // url :'system.menu/index?id=1' // } - // ea.api.reloadTable('currentTableRenderId',options) + // ua.api.reloadTable('currentTableRenderId',options) reloadTable: function (tableName, options, mode) { tableName = tableName || 'currentTableRenderId'; if (mode == 'table') { @@ -1936,7 +1936,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' // 自动添加layui事件过滤器 if (filter === undefined || filter === '') { filter = 'save_form_' + (i + 1); - $(this).attr('lay-filter', filter) + $(this).attr('lay-filter', filter); } if (url === undefined || url === '' || url === null) { url = window.location.href; @@ -1946,9 +1946,9 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' form.on('submit(' + filter + ')', function (data) { var dataField = data.field; - dataField = admin.api.formSubmitEditor(dataField, v) + dataField = admin.api.formSubmitEditor(dataField, v); - dataField = admin.api.formSubmitCity(dataField, v) + dataField = admin.api.formSubmitCity(dataField, v); if (typeof preposeCallback === 'function') { dataField = preposeCallback(dataField); @@ -1963,7 +1963,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' }, formSubmitEditor(dataField, form) { // 富文本数据处理 - var editorList = $(form).closest('.layui-form').find('.editor') + var editorList = $(form).closest('.layui-form').find('.editor'); if (editorList.length > 0) { $.each(editorList, function (i, v) { var name = $(this).attr("name"); @@ -2005,9 +2005,9 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' formatTargetList[targetType] = 0; } - }) + }); - var codeArr = code.split('/') + var codeArr = code.split('/'); var textArr = text.split('/'); if (formatTargetList['name'] == 1) { @@ -2035,9 +2035,9 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' dataField[fieldName + '_code_district'] = codeArr[2] || ''; } - }) + }); } - return dataField + return dataField; }, upload: function () { var uploadList = document.querySelectorAll("[data-upload]"); @@ -2125,8 +2125,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (extGroup.image.indexOf(ext) != -1) { // 是图片 - liHtml += '
  • ×
  • \n'; - + liHtml += '
  • ×
  • \n'; } else { // 不是图片 // 遍历extGroup数组找到扩展名所在的索引 @@ -2166,14 +2165,14 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var currentUrlList = currentUrl.split(sign); var deleteIndex = currentUrlList.indexOf(deleteUrl); - currentUrlList.splice(deleteIndex, 1) + currentUrlList.splice(deleteIndex, 1); $(elem).val(currentUrlList.join(sign)); $(elem).trigger("input"); if (currentFilename) { var currentFilenameList = currentFilename.split(sign); - currentFilenameList.splice(deleteIndex, 1) + currentFilenameList.splice(deleteIndex, 1); $(elemFilenameField).val(currentFilenameList.join(sign)); } @@ -2193,7 +2192,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (uploadFilenameField) { var elemFilenameField = "input[name='" + uploadFilenameField + "']"; - var elemFilename = $(elemFilenameField) + var elemFilename = $(elemFilenameField); } var selectCheck = uploadNumber === 'one' ? 'radio' : 'checkbox'; @@ -2227,16 +2226,16 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var currentFilename = $(elemFilename).val(); var filenameArray = currentFilename.split(uploadSign); if (currentFilename.length == 0 || selectCheck == 'radio') { - filenameArray = [] + filenameArray = []; } } $.each(data, function (index, val) { if (urlArray.indexOf(val.url) == -1) { - urlArray.push(val.url) + urlArray.push(val.url); } if (uploadFilenameField) { if (filenameArray.indexOf(val.original_name) == -1) { - filenameArray.push(val.original_name) + filenameArray.push(val.original_name); } } @@ -2253,10 +2252,10 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' $(elem).trigger("input"); layer.close(index); admin.msg.success('选择成功'); - } + }; } - }) - }) + }); + }); }); } @@ -2291,7 +2290,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' if (typeof template != 'function') { template = function (data, fields) { return data[fields[1]]; - } + }; } var fields = selectFields.replace(/\s/g, "").split(','); @@ -2356,7 +2355,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' tableData() { var tableList = document.querySelectorAll('[data-toggle="table-data"]'); $.each(tableList, function (i, v) { - var data = $(v).data() + var data = $(v).data(); tableData.render(v, data, admin); }); @@ -2364,7 +2363,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' tagInput() { var list = document.querySelectorAll('[data-toggle="tag-input"]'); $.each(list, function (i, v) { - var data = $(v).data() + var data = $(v).data(); tagInput.render(v, data, admin); }); @@ -2372,8 +2371,8 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' propertyInput() { var list = document.querySelectorAll('[data-toggle="property-input"]'); $.each(list, function (i, v) { - var data = $(v).data() - data.value = $(v).text() + var data = $(v).data(); + data.value = $(v).text(); propertyInput.render(v, data, admin); }); @@ -2381,7 +2380,7 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' }, copyText(elem) { if (elem == undefined) { - elem = 'body' + elem = 'body'; } var list = $(elem).find('[data-toggle="copy-text"]'); @@ -2395,11 +2394,11 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' var clipboard = new ClipboardJS(v); clipboard.on('success', function (e) { - admin.msg.success('复制成功') + admin.msg.success('复制成功'); }); clipboard.on('error', function (e) { - admin.msg.error('复制失败') + admin.msg.error('复制失败'); }); }); @@ -2456,23 +2455,24 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput' for (t = 0, e = f.length; t < e; t++) if (r === f[t]) return !0; if ("object" == typeof r) { for (n in r) if (r.hasOwnProperty(n)) return !1; - return !0 + return !0; } - return !1 + return !1; }, bytes(size) { if (size > 0) { - const kb = 1024 - const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] - const i = Math.floor(Math.log(size) / Math.log(kb)) - const num = (size / Math.pow(kb, i)).toPrecision(3) - const u = unit[i] + const kb = 1024; + const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + const i = Math.floor(Math.log(size) / Math.log(kb)); + const num = (size / Math.pow(kb, i)).toPrecision(3); + const u = unit[i]; return num + u; } return '0B'; } }; - return admin; -}); + + window.ulAdmin = window.ua = admin; +})(); \ No newline at end of file