优化插件管理&优化前台弹窗

pull/354/MERGE
Karson 2022-01-12 01:23:41 +08:00
parent 017970a2e3
commit c00584a5b5
14 changed files with 159 additions and 71 deletions

View File

@ -263,7 +263,7 @@ class Install extends Command
$configList = $instance->name("config")->select(); $configList = $instance->name("config")->select();
foreach ($configList as $k => $value) { foreach ($configList as $k => $value) {
if (in_array($value['type'], ['selects', 'checkbox', 'images', 'files'])) { if (in_array($value['type'], ['selects', 'checkbox', 'images', 'files'])) {
$value['value'] = explode(',', $value['value']); $value['value'] = is_array($value['value']) ? $value['value'] : explode(',', $value['value']);
} }
if ($value['type'] == 'array') { if ($value['type'] == 'array') {
$value['value'] = (array)json_decode($value['value'], true); $value['value'] = (array)json_decode($value['value'], true);

View File

@ -41,19 +41,7 @@ class Addon extends Backend
$v['config'] = $config ? 1 : 0; $v['config'] = $config ? 1 : 0;
$v['url'] = str_replace($this->request->server('SCRIPT_NAME'), '', $v['url']); $v['url'] = str_replace($this->request->server('SCRIPT_NAME'), '', $v['url']);
} }
if ($this->request->isAjax()) { $this->assignconfig(['addons' => $addons, 'api_url' => config('fastadmin.api_url'), 'faversion' => config('fastadmin.version'), 'domain' => request()->host(true)]);
$result = [];
debug('begin');
try {
$result = Service::addons($this->request->get());
} catch (\Exception $e) {
$this->error($e->getMessage());
}
debug('end');
\think\Log::record("tx:" . debug('begin', 'end', 6) . 's');
return json($result);
}
$this->assignconfig(['addons' => $addons, 'api_url' => config('fastadmin.api_url'), 'faversion' => config('fastadmin.version')]);
return $this->view->fetch(); return $this->view->fetch();
} }
@ -227,9 +215,6 @@ class Addon extends Backend
{ {
Config::set('default_return_type', 'json'); Config::set('default_return_type', 'json');
if (!config('app_debug')) {
$this->error(__('Only work at debug mode'));
}
$info = []; $info = [];
$file = $this->request->file('file'); $file = $this->request->file('file');
try { try {

View File

@ -81,11 +81,9 @@
<div id="toolbar" class="toolbar"> <div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" data-force-refresh="false"><i class="fa fa-refresh"></i> </a> <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" data-force-refresh="false"><i class="fa fa-refresh"></i> </a>
{if $Think.config.fastadmin.api_url} {if $Think.config.fastadmin.api_url}
{if $Think.config.app_debug}
<button type="button" id="faupload-addon" class="btn btn-danger faupload btn-mini-xs" data-url="addon/local" data-chunking="false" data-mimetype="zip,fastaddon" data-multiple="false"><i class="fa fa-upload"></i> <button type="button" id="faupload-addon" class="btn btn-danger faupload btn-mini-xs" data-url="addon/local" data-chunking="false" data-mimetype="zip,fastaddon" data-multiple="false"><i class="fa fa-upload"></i>
{:__('Local install')} {:__('Local install')}
</button> </button>
{/if}
<div class="btn-group"> <div class="btn-group">
<a href="#" class="btn btn-info btn-switch active btn-mini-xs" data-type="all"><i class="fa fa-list"></i> {:__('All')}</a> <a href="#" class="btn btn-info btn-switch active btn-mini-xs" data-type="all"><i class="fa fa-list"></i> {:__('All')}</a>
<a href="#" class="btn btn-info btn-switch btn-mini-xs" data-type="free"><i class="fa fa-gift"></i> {:__('Free')}</a> <a href="#" class="btn btn-info btn-switch btn-mini-xs" data-type="free"><i class="fa fa-gift"></i> {:__('Free')}</a>
@ -93,7 +91,6 @@
<a href="#" class="btn btn-info btn-switch btn-mini-xs" data-type="local" data-url="addon/downloaded"><i class="fa fa-laptop"></i> {:__('Local addon')}</a> <a href="#" class="btn btn-info btn-switch btn-mini-xs" data-type="local" data-url="addon/downloaded"><i class="fa fa-laptop"></i> {:__('Local addon')}</a>
</div> </div>
<a class="btn btn-primary btn-userinfo btn-mini-xs" href="javascript:;"><i class="fa fa-user"></i> {:__('Userinfo')}</a> <a class="btn btn-primary btn-userinfo btn-mini-xs" href="javascript:;"><i class="fa fa-user"></i> {:__('Userinfo')}</a>
<a class="btn btn-warning btn-authorization btn-mini-xs" href="javascript:;"><i class="fa fa-cloud"></i> {:__('Reload authorization')}</a>
{/if} {/if}
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover" width="100%"> <table id="table" class="table table-striped table-bordered table-hover" width="100%">
@ -189,7 +186,7 @@
<div> <div>
<form class="form-horizontal form-userinfo"> <form class="form-horizontal form-userinfo">
<fieldset> <fieldset>
<div class="alert alert-dismissable alert-success"> <div class="alert alert-dismissable alert-info-light">
<button type="button" class="close" data-dismiss="alert">×</button> <button type="button" class="close" data-dismiss="alert">×</button>
<strong>{:__('Warning')}</strong><br/>{:__('Logined tips', '<%=username%>')} <strong>{:__('Warning')}</strong><br/>{:__('Logined tips', '<%=username%>')}
</div> </div>

View File

@ -292,7 +292,7 @@ return [
//允许跨域的域名,多个以,分隔 //允许跨域的域名,多个以,分隔
'cors_request_domain' => 'localhost,127.0.0.1', 'cors_request_domain' => 'localhost,127.0.0.1',
//版本号 //版本号
'version' => '1.3.0.20220101', 'version' => '1.3.1.20220112',
//API接口地址 //API接口地址
'api_url' => 'https://api.fastadmin.net', 'api_url' => 'https://api.fastadmin.net',
], ],

View File

@ -21,7 +21,7 @@
"topthink/think-installer": "^1.0.14", "topthink/think-installer": "^1.0.14",
"topthink/think-queue": "1.1.6", "topthink/think-queue": "1.1.6",
"topthink/think-helper": "^1.0.7", "topthink/think-helper": "^1.0.7",
"karsonzhang/fastadmin-addons": "~1.3.0", "karsonzhang/fastadmin-addons": "~1.3.1",
"overtrue/pinyin": "^3.0", "overtrue/pinyin": "^3.0",
"phpoffice/phpspreadsheet": "1.12", "phpoffice/phpspreadsheet": "1.12",
"overtrue/wechat": "4.2.11", "overtrue/wechat": "4.2.11",

View File

@ -614,7 +614,6 @@ form.form-horizontal .control-label {
/*顶栏addtabs*/ /*顶栏addtabs*/
.nav-addtabs { .nav-addtabs {
height: 100%; height: 100%;
overflow-y: hidden;
border: none; border: none;
} }
.nav-addtabs.disable-top-badge > li > a > .pull-right-container { .nav-addtabs.disable-top-badge > li > a > .pull-right-container {

File diff suppressed because one or more lines are too long

View File

@ -431,6 +431,32 @@ a:focus {
.layui-layer-content { .layui-layer-content {
clear: both; clear: both;
} }
.layui-layer-fast .layui-layer-content > table.table {
margin-bottom: 0;
}
.layui-layer-fast .layui-layer-confirm {
display: none;
position: absolute;
width: 100%;
height: 100%;
left: 0;
bottom: 0;
border: 1px solid transparent;
background: transparent;
color: transparent;
}
.layui-layer-fast .layui-layer-confirm:focus {
border: 1px solid #444c69;
-webkit-border-radius: 2px;
-webkit-background-clip: padding-box;
-moz-border-radius: 2px;
-moz-background-clip: padding;
border-radius: 2px;
background-clip: padding-box;
}
.layui-layer-fast .layui-layer-confirm:focus-visible {
outline: 0;
}
.layui-layer-fast-msg { .layui-layer-fast-msg {
min-width: 100px; min-width: 100px;
border-radius: 2px; border-radius: 2px;

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
// 初始化表格参数配置 // 初始化表格参数配置
Table.api.init({ Table.api.init({
extend: { extend: {
index_url: Config.api_url ? 'addon/index' : "addon/downloaded", index_url: Config.api_url ? Config.api_url + '/addon/index' : "addon/downloaded",
add_url: '', add_url: '',
edit_url: '', edit_url: '',
del_url: '', del_url: '',
@ -45,6 +45,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
} }
}); });
table.on('load-error.bs.table', function (e, status, res) { table.on('load-error.bs.table', function (e, status, res) {
console.log(e, status, res);
switch_local(); switch_local();
}); });
table.on('post-body.bs.table', function (e, settings, json, xhr) { table.on('post-body.bs.table', function (e, settings, json, xhr) {
@ -94,6 +95,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
$.extend(params, { $.extend(params, {
uid: userinfo ? userinfo.id : '', uid: userinfo ? userinfo.id : '',
token: userinfo ? userinfo.token : '', token: userinfo ? userinfo.token : '',
domain: Config.domain,
version: Config.faversion version: Config.faversion
}); });
return params; return params;
@ -168,6 +170,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
}); });
return res; return res;
}, },
dataType: 'jsonp',
templateView: false, templateView: false,
clickToSelect: false, clickToSelect: false,
search: true, search: true,
@ -350,7 +353,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
area: area, area: area,
title: __('Userinfo'), title: __('Userinfo'),
resize: false, resize: false,
btn: [__('Logout'), __('Cancel')], btn: [__('Logout'), __('Close')],
yes: function () { yes: function () {
Fast.api.ajax({ Fast.api.ajax({
url: Config.api_url + '/user/logout', url: Config.api_url + '/user/logout',
@ -680,6 +683,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
api: { api: {
formatter: { formatter: {
title: function (value, row, index) { title: function (value, row, index) {
if ($(".btn-switch.active").data("type") == "local") {
// return value;
}
var title = '<a class="title" href="' + row.url + '" data-toggle="tooltip" title="' + __('View addon home page') + '" target="_blank">' + value + '</a>'; var title = '<a class="title" href="' + row.url + '" data-toggle="tooltip" title="' + __('View addon home page') + '" target="_blank">' + value + '</a>';
if (row.screenshots && row.screenshots.length > 0) { if (row.screenshots && row.screenshots.length > 0) {
title += ' <a href="javascript:;" data-index="' + index + '" class="view-screenshots text-success" title="' + __('View addon screenshots') + '" data-toggle="tooltip"><i class="fa fa-image"></i></a>'; title += ' <a href="javascript:;" data-index="' + index + '" class="view-screenshots text-success" title="' + __('View addon screenshots') + '" data-toggle="tooltip"><i class="fa fa-image"></i></a>';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -454,7 +454,7 @@ form.form-horizontal .control-label {
/*顶栏addtabs*/ /*顶栏addtabs*/
.nav-addtabs { .nav-addtabs {
height: 100%; height: 100%;
overflow-y: hidden; //overflow-y: hidden;
&.disable-top-badge { &.disable-top-badge {
> li > a > .pull-right-container { > li > a > .pull-right-container {

View File

@ -225,6 +225,35 @@ a {
clear: both; clear: both;
} }
.layui-layer-fast {
.layui-layer-content {
> table.table {
margin-bottom: 0;
}
}
.layui-layer-confirm {
display: none;
position: absolute;
width: 100%;
height: 100%;
left: 0;
bottom: 0;
border: 1px solid transparent;
background: transparent;
color: transparent;
&:focus {
border: 1px solid #444c69;
.border-radius(2px);
}
&:focus-visible {
outline: 0;
}
}
}
.layui-layer-fast-msg { .layui-layer-fast-msg {
min-width: 100px; min-width: 100px;
border-radius: 2px; border-radius: 2px;