...
 
Commits (6)
    https://gitcode.net/wolfcode/EasyAdmin8-Laravel/-/commit/9f16b8f8b6a8402c25a3033ccade04c967ebcff9 Update README.md 2023-09-02T23:01:37+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-Laravel/-/commit/4873ddbce4e2b0d64d5e7368786a206fef4fa974 Update LICENSE 2023-09-02T23:01:39+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-Laravel/-/commit/34047611ee8fb9f50782b026736e67f8bd015d0b Layui-v2.8.16 2023-09-03T10:33:12+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-Laravel/-/commit/f51468c7ac933e7b2d0068f4ced023f8857c4086 修复curd中关联节点异常 2023-09-05T10:43:38+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-Laravel/-/commit/611be860715444fcbc807764790d4d202d472cf7 新增OSS,COS上传 2023-09-07T01:04:56+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com https://gitcode.net/wolfcode/EasyAdmin8-Laravel/-/commit/57d8579e86b0febcfd7ed416ebdc913b320ecc3c Update ConfigController.php 2023-09-07T01:54:01+08:00 wolfcode 37436228+wolf-leo@users.noreply.github.com
此差异已折叠。
......@@ -127,7 +127,7 @@ location / {
* 用户明确并同意本声明条款列举的全部内容,对使用`EasyAdmin8-Laravel`后台框架可能存在的风险和相关后果将完全由用户自行承担,本开源项目不承担任何法律责任。
* 任何单位或个人在阅读本免责声明后,应在《GPL-3.0 开源许可证》所允许的范围内进行合法的发布、传播和使用`EasyAdmin8-Laravel`后台框架等行为,若违反本免责声明条款或违反法律法规所造成的法律责任(包括但不限于民事赔偿和刑事责任),由违约者自行承担。
* 任何单位或个人在阅读本免责声明后,应在《MIT 开源许可证》所允许的范围内进行合法的发布、传播和使用`EasyAdmin8-Laravel`后台框架等行为,若违反本免责声明条款或违反法律法规所造成的法律责任(包括但不限于民事赔偿和刑事责任),由违约者自行承担。
* 如果本声明的任何部分被认为无效或不可执行,其余部分仍具有完全效力。不可执行的部分声明,并不构成我们放弃执行该声明的权利。
......
......@@ -19,7 +19,9 @@ class ConfigController extends AdminController
public function initialize()
{
parent::initialize();
$this->model = new SystemConfig();
$this->model = new SystemConfig();
$upload_types = config('admin.upload_types');
$this->assign(compact('upload_types'));
}
/**
......@@ -36,11 +38,28 @@ class ConfigController extends AdminController
public function save(): JsonResponse
{
if (!request()->ajax()) return $this->error();
$post = request()->post();
$post = request()->post();
$notAddFields = ['_token', 'file', 'group'];
try {
$group = $post['group'] ?? '';
if (empty($group)) return $this->error('保存失败');
if ($group == 'upload') {
$upload_types = config('admin.upload_types');
// 兼容旧版本
$this->model->where('name', 'upload_allow_type')->update(['value' => implode(',', array_keys($upload_types))]);
}
foreach ($post as $key => $val) {
if (in_array($key, ['file', 'files'])) continue;
$this->model->where('name', $key)->update(['value' => $val,]);
if (in_array($key, $notAddFields)) continue;
if ($this->model->where('name', $key)->count()) {
$this->model->where('name', $key)->update(['value' => $val,]);
} else {
$this->model->insert(
[
'name' => $key,
'value' => $val,
'group' => $group,
]);
}
}
TriggerService::updateSysconfig();
} catch (\Exception $e) {
......
......@@ -18,7 +18,9 @@ class UploadfileController extends AdminController
public function initialize()
{
parent::initialize();
$this->model = new SystemUploadfile();
$this->model = new SystemUploadfile();
$upload_types = config('admin.upload_types');
$this->assign(compact('upload_types'));
}
}
......@@ -5,12 +5,12 @@ namespace App\Http;
use App\Http\Services\tool\CommonTool;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Validator;
use Illuminate\View\View;
use JetBrains\PhpStorm\NoReturn;
use jianyan\excel\Excel;
use PhpOffice\PhpSpreadsheet\Writer\Exception;
use App\Http\Services\annotation\NodeAnnotation;
use App\Http\Services\annotation\ControllerAnnotation;
/**
* 后台CURD复用
......@@ -21,7 +21,7 @@ trait Curd
{
/**
* @NodeAnotation(title="列表")
* @NodeAnnotation(title="列表")
*/
public function index(): View|JsonResponse
{
......@@ -42,7 +42,7 @@ trait Curd
}
/**
* @NodeAnotation(title="添加")
* @NodeAnnotation(title="添加")
*/
public function add(): View|JsonResponse
{
......@@ -58,7 +58,7 @@ trait Curd
}
/**
* @NodeAnotation(title="编辑")
* @NodeAnnotation(title="编辑")
*/
public function edit(): View|JsonResponse
{
......@@ -68,7 +68,7 @@ trait Curd
if (request()->ajax()) {
try {
$save = updateFields($this->model, $row);
} catch (\PDOException | \Exception $e) {
} catch (\PDOException|\Exception $e) {
return $this->error('保存失败:' . $e->getMessage());
}
return $save ? $this->success('保存成功') : $this->error('保存失败');
......@@ -78,7 +78,7 @@ trait Curd
}
/**
* @NodeAnotation(title="删除")
* @NodeAnnotation(title="删除")
*/
public function delete(): JsonResponse
{
......@@ -89,14 +89,14 @@ trait Curd
if (empty($row)) return $this->error('数据不存在');
try {
$save = $this->model->whereIn('id', $id)->delete();
} catch (\PDOException | \Exception $e) {
} catch (\PDOException|\Exception $e) {
return $this->error('删除失败:' . $e->getMessage());
}
return $save ? $this->success('删除成功') : $this->error('删除失败');
}
/**
* @NodeAnotation(title="导出")
* @NodeAnnotation(title="导出")
*/
public function export(): View|bool
{
......@@ -118,13 +118,13 @@ trait Curd
$fileName = time();
try {
return Excel::exportData($list, $header, $fileName, 'xlsx');
} catch (Exception | \PhpOffice\PhpSpreadsheet\Exception$e) {
} catch (Exception|\PhpOffice\PhpSpreadsheet\Exception$e) {
return $this->error($e->getMessage());
}
}
/**
* @NodeAnotation(title="属性修改")
* @NodeAnnotation(title="属性修改")
*/
public function modify(): JsonResponse
{
......@@ -150,7 +150,7 @@ trait Curd
try {
foreach ($post as $key => $item) if ($key == 'field') $row->$item = $post['value'];
$row->save();
} catch (\PDOException | \Exception $e) {
} catch (\PDOException|\Exception $e) {
return $this->error("操作失败:" . $e->getMessage());
}
return $this->success('保存成功');
......
......@@ -6,6 +6,9 @@ use App\Models\SystemUploadfile;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use OSS\Core\OssException;
use OSS\OssClient;
use Qcloud\Cos\Client;
class UploadService
{
......@@ -106,24 +109,67 @@ class UploadService
$endpoint = $config['oss_endpoint'];
$bucket = $config['oss_bucket'];
if ($file->isValid()) {
$object = $this->setFilePath($file, 'blog -static/');
$object = $this->setFilePath($file, env('EASYADMIN.OSS_STATIC_PREFIX', 'easyadmin8') . '/');
try {
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
$_rs = $ossClient->putObject($bucket, $object, file_get_contents($file->getRealPath()));
$oss_request_url = $_rs['oss - request - url'] ?? '';
$oss_request_url = $_rs['oss-request-url'] ?? '';
if (empty($oss_request_url)) return ['code' => 0, 'data' => '上传至OSS失败'];
$oss_request_url = str_replace('http://', 'https://', $oss_request_url);
$this->setSaveData($file);
} catch (OssException $e) {
return ['code' => 0, 'data' => $e->getMessage()];
}
$data = $type == 'editor' ? ['state' => 'success', 'msg' => $oss_request_url, 'name' => ''] : ['url' => $oss_request_url];
$data = ['url' => $oss_request_url];
$this->save($oss_request_url);
return ['code' => 1, 'data' => $data];
}
$data = '上传失败';
return ['code' => 0, 'data' => $data];
}
/**
* 腾讯云cos
*
* @param UploadedFile $file
* @param string $type
* @return array
*/
public function cos(UploadedFile $file, string $type = ''): array
{
$config = $this->getConfig();
$secretId = $config['cos_secret_id']; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
$secretKey = $config['cos_secret_key']; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
$region = $config['cos_region']; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
if ($file->isValid()) {
$cosClient = new Client(
[
'region' => $region,
'schema' => 'http',
'credentials' => ['secretId' => $secretId, 'secretKey' => $secretKey,
],
]);
try {
$object = $this->setFilePath($file, env('EASYADMIN.OSS_STATIC_PREFIX', 'easyadmin8') . '/');
$result = $cosClient->upload(
$config['cos_bucket'], //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
$object, //此处的 key 为对象键
file_get_contents($file->getRealPath())
);
$location = $result['Location'] ?? '';
if (empty($location)) return ['code' => 0, 'data' => '上传至COS失败'];
$location = 'https://' . $location;
$this->setSaveData($file);
} catch (\Exception $e) {
return ['code' => 0, 'data' => $e->getMessage()];
}
$data = ['url' => $location];
$this->save($location);
return ['code' => 1, 'data' => $data];
}
$data = '上传失败';
return ['code' => 0, 'data' => $data];
}
protected function save(string $url = ''): bool
{
......
......@@ -9,6 +9,7 @@
"license": "MIT",
"require": {
"php": "^8.1",
"aliyuncs/oss-sdk-php": "^2.6",
"doctrine/annotations": "^2.0",
"gregwar/captcha-bundle": "^2.2",
"guzzlehttp/guzzle": "^7.2",
......@@ -16,7 +17,8 @@
"laravel/framework": "^10.20",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"phpoffice/phpspreadsheet": "^1.29"
"phpoffice/phpspreadsheet": "^1.29",
"qcloud/cos-sdk-v5": "^2.6"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
......
......@@ -4,8 +4,53 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1470e6e4d9b06fc0a539fd4cf7d80217",
"content-hash": "930e8e0fc14fa3f75029629c482db5eb",
"packages": [
{
"name": "aliyuncs/oss-sdk-php",
"version": "v2.6.0",
"source": {
"type": "git",
"url": "https://github.com/aliyun/aliyun-oss-php-sdk.git",
"reference": "572d0f8e099e8630ae7139ed3fdedb926c7a760f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/572d0f8e099e8630ae7139ed3fdedb926c7a760f",
"reference": "572d0f8e099e8630ae7139ed3fdedb926c7a760f",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "*",
"satooshi/php-coveralls": "*"
},
"type": "library",
"autoload": {
"psr-4": {
"OSS\\": "src/OSS"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Aliyuncs",
"homepage": "http://www.aliyun.com"
}
],
"description": "Aliyun OSS SDK for PHP",
"homepage": "http://www.aliyun.com/product/oss/",
"support": {
"issues": "https://github.com/aliyun/aliyun-oss-php-sdk/issues",
"source": "https://github.com/aliyun/aliyun-oss-php-sdk/tree/v2.6.0"
},
"time": "2022-08-03T08:06:01+00:00"
},
{
"name": "brick/math",
"version": "0.11.0",
......@@ -659,6 +704,89 @@
},
"time": "2022-01-11T08:28:06+00:00"
},
{
"name": "guzzlehttp/command",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/command.git",
"reference": "3372bcfd79d4b357b6871665bf06155515e8d844"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/command/zipball/3372bcfd79d4b357b6871665bf06155515e8d844",
"reference": "3372bcfd79d4b357b6871665bf06155515e8d844",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "^7.5.1",
"guzzlehttp/promises": "^1.5.3 || ^2.0",
"guzzlehttp/psr7": "^1.9.1 || ^2.4.5",
"php": "^7.2.5 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1",
"phpunit/phpunit": "^8.5.19 || ^9.5.8"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Command\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Jeremy Lindblom",
"email": "jeremeamia@gmail.com",
"homepage": "https://github.com/jeremeamia"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
}
],
"description": "Provides the foundation for building command-based web service clients",
"support": {
"issues": "https://github.com/guzzle/command/issues",
"source": "https://github.com/guzzle/command/tree/1.3.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/command",
"type": "tidelift"
}
],
"time": "2023-05-21T14:15:09+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "7.7.0",
......@@ -761,6 +889,93 @@
],
"time": "2023-05-21T14:04:53+00:00"
},
{
"name": "guzzlehttp/guzzle-services",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle-services.git",
"reference": "f4bb1c205152a56741624b88753732e01a60565c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle-services/zipball/f4bb1c205152a56741624b88753732e01a60565c",
"reference": "f4bb1c205152a56741624b88753732e01a60565c",
"shasum": ""
},
"require": {
"guzzlehttp/command": "^1.3",
"guzzlehttp/guzzle": "^7.7",
"guzzlehttp/psr7": "^1.9.1 || ^2.4.5",
"guzzlehttp/uri-template": "^1.0.1",
"php": "^7.2.5 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1",
"phpunit/phpunit": "^8.5.19 || ^9.5.8"
},
"suggest": {
"gimler/guzzle-description-loader": "^0.0.4"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Command\\Guzzle\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Stefano Kowalke",
"email": "blueduck@mail.org",
"homepage": "https://github.com/Konafets"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
}
],
"description": "Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.",
"support": {
"issues": "https://github.com/guzzle/guzzle-services/issues",
"source": "https://github.com/guzzle/guzzle-services/tree/1.4.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle-services",
"type": "tidelift"
}
],
"time": "2023-05-21T14:21:30+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "2.0.0",
......@@ -2795,6 +3010,74 @@
],
"time": "2023-07-31T14:32:22+00:00"
},
{
"name": "qcloud/cos-sdk-v5",
"version": "v2.6.6",
"source": {
"type": "git",
"url": "https://github.com/tencentyun/cos-php-sdk-v5.git",
"reference": "9d82ccb550fe2dca1adfb53835791d314023a9a8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tencentyun/cos-php-sdk-v5/zipball/9d82ccb550fe2dca1adfb53835791d314023a9a8",
"reference": "9d82ccb550fe2dca1adfb53835791d314023a9a8",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"guzzlehttp/guzzle": "^6.2.1 || ^7.0",
"guzzlehttp/guzzle-services": "^1.1",
"guzzlehttp/psr7": "^1.3.1 || ^2.0",
"php": ">=5.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"files": [
"src/Common.php"
],
"psr-4": {
"Qcloud\\Cos\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "yaozongyou",
"email": "yaozongyou@vip.qq.com"
},
{
"name": "lewzylu",
"email": "327874225@qq.com"
},
{
"name": "tuunalai",
"email": "550566181@qq.com"
}
],
"description": "PHP SDK for QCloud COS",
"keywords": [
"cos",
"php",
"qcloud"
],
"support": {
"issues": "https://github.com/tencentyun/cos-php-sdk-v5/issues",
"source": "https://github.com/tencentyun/cos-php-sdk-v5/tree/v2.6.6"
},
"time": "2023-08-23T08:14:27+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
......
......@@ -33,4 +33,11 @@ return [
'login/index',
'login/out',
],
//上传类型
'upload_types' => [
'local' => '本地存储',
'oss' => '阿里云oss',
'cos' => '腾讯云cos'
],
];
......@@ -13,8 +13,7 @@ File Encoding : 65001
Date: 2020-05-17 23:24:06
*/
SET
FOREIGN_KEY_CHECKS=0;
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for ea_mall_cate
......@@ -219,7 +218,7 @@ VALUES ('57', 'upload_allow_size', 'upload', '1024000', '允许上传的大小',
INSERT INTO `ea_system_config`
VALUES ('58', 'upload_allow_mime', 'upload', 'image/gif,image/jpeg,video/x-msvideo,text/plain,image/png', '允许上传的文件mime', '0', null, null);
INSERT INTO `ea_system_config`
VALUES ('59', 'upload_allow_type', 'upload', 'local,oss,cos', '可用的上传文件方式', '0', null, null);
VALUES ('59', 'upload_allow_type', 'upload', 'local,oss,qnoss,cos', '可用的上传文件方式', '0', null, null);
INSERT INTO `ea_system_config`
VALUES ('60', 'oss_access_key_id', 'upload', '填你的', '阿里云oss公钥', '0', null, null);
INSERT INTO `ea_system_config`
......@@ -261,7 +260,15 @@ VALUES ('81', 'cos_secret_key', 'upload', '填你的', '腾讯云cos私钥', '0'
INSERT INTO `ea_system_config`
VALUES ('82', 'cos_region', 'upload', '填你的', '存储桶地域', '0', null, null);
INSERT INTO `ea_system_config`
VALUES ('83', 'tecos_bucket', 'upload', '填你的', '存储桶名称', '0', null, null);
VALUES ('83', 'cos_bucket', 'upload', '填你的', '存储桶名称', '0', null, null);
INSERT INTO `ea_system_config`
VALUES ('84', 'qnoss_access_key', 'upload', '填你的', '访问密钥', '0', null, null);
INSERT INTO `ea_system_config`
VALUES ('85', 'qnoss_secret_key', 'upload', '填你的', '安全密钥', '0', null, null);
INSERT INTO `ea_system_config`
VALUES ('86', 'qnoss_bucket', 'upload', '填你的', '存储空间', '0', null, null);
INSERT INTO `ea_system_config`
VALUES ('87', 'qnoss_domain', 'upload', '填你的', '访问域名', '0', null, null);
-- ----------------------------
-- Table structure for ea_system_menu
......
......@@ -4,6 +4,11 @@ define(["jquery", "easy-admin", "vue"], function ($, ea, Vue) {
var Controller = {
index: function () {
var _group = 'site'
var element = layui.element;
element.on('tab(docDemoTabBrief)', function (data) {
_group = $(this).data('group')
});
var app = new Vue({
el: '#app',
......@@ -16,8 +21,12 @@ define(["jquery", "easy-admin", "vue"], function ($, ea, Vue) {
app.upload_type = this.value;
});
form.on("submit", function (data) {
data.field['group'] = _group
});
ea.listen();
}
};
return Controller;
});
\ No newline at end of file
});
......@@ -19,7 +19,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
cols: [[
{type: "checkbox"},
{field: 'id', width: 80, title: 'ID', searchOp: '='},
{field: 'upload_type', minWidth: 80, title: '存储位置', search: 'select', selectList: {'local': '本地', 'alioss': '阿里云', 'qnoss': '七牛云', ',txcos': '腾讯云'}},
{field: 'upload_type', minWidth: 80, title: '存储位置', search: 'select', selectList: upload_types},
{field: 'url', minWidth: 80, search: false, title: '图片信息', templet: ea.table.image},
{field: 'url', minWidth: 120, title: '保存地址', templet: ea.table.url},
{field: 'original_name', minWidth: 80, title: '文件原名'},
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -3,9 +3,9 @@
<div class="layuimini-main" id="app">
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<ul class="layui-tab-title">
<li class="layui-this">网站设置</li>
<li>LOGO配置</li>
<li>上传配置</li>
<li class="layui-this" data-group="site">网站设置</li>
<li data-group="logo">LOGO配置</li>
<li data-group="upload">上传配置</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
......
......@@ -3,7 +3,7 @@
<div class="layui-form-item">
<label class="layui-form-label required">存储方式</label>
<div class="layui-input-block">
@foreach(['local'=>'本地存储','oss'=>'阿里云oss','cos'=>'腾讯云cos'] as $key=>$val)
@foreach($upload_types as $key=>$val)
<input type="radio" v-model="upload_type" name="upload_type" lay-filter="upload_type" value="{{$key}}" title="{{$val}}" @if($key==sysconfig('upload','upload_type')) checked="" @endif>
@endforeach
</div>
......@@ -25,74 +25,74 @@
</div>
</div>
<div class="layui-form-item" v-if="upload_type == 'alioss'" v-cloak>
<div class="layui-form-item" v-if="upload_type == 'oss'" v-cloak>
<label class="layui-form-label required">公钥信息</label>
<div class="layui-input-block">
<input type="text" name="alioss_access_key_id" class="layui-input" lay-verify="required" lay-reqtext="请输入公钥信息" placeholder="请输入公钥信息" value="{:sysconfig('upload','alioss_access_key_id')}">
<input type="text" name="oss_access_key_id" class="layui-input" lay-verify="required" lay-reqtext="请输入公钥信息" placeholder="请输入公钥信息" value="{{sysconfig('upload','oss_access_key_id')}}">
<tip>例子:FSGGshu64642THSk</tip>
</div>
</div>
<div class="layui-form-item" v-if="upload_type == 'alioss'" v-cloak>
<div class="layui-form-item" v-if="upload_type == 'oss'" v-cloak>
<label class="layui-form-label required">私钥信息</label>
<div class="layui-input-block">
<input type="text" name="alioss_access_key_secret" class="layui-input" lay-verify="required" lay-reqtext="请输入私钥信息" placeholder="请输入私钥信息" value="{:sysconfig('upload','alioss_access_key_secret')}">
<input type="text" name="oss_access_key_secret" class="layui-input" lay-verify="required" lay-reqtext="请输入私钥信息" placeholder="请输入私钥信息" value="{{sysconfig('upload','oss_access_key_secret')}}">
<tip>例子:5fsfPReYKkFSGGshu64642THSkmTInaIm</tip>
</div>
</div>
<div class="layui-form-item" v-if="upload_type == 'alioss'" v-cloak>
<div class="layui-form-item" v-if="upload_type == 'oss'" v-cloak>
<label class="layui-form-label required">数据中心</label>
<div class="layui-input-block">
<input type="text" name="alioss_endpoint" class="layui-input" lay-verify="required" lay-reqtext="请输入数据中心" placeholder="请输入数据中心" value="{:sysconfig('upload','alioss_endpoint')}">
<input type="text" name="oss_endpoint" class="layui-input" lay-verify="required" lay-reqtext="请输入数据中心" placeholder="请输入数据中心" value="{{sysconfig('upload','oss_endpoint')}}">
<tip>例子:https://oss-cn-shenzhen.aliyuncs.com</tip>
</div>
</div>
<div class="layui-form-item" v-if="upload_type == 'alioss'" v-cloak>
<div class="layui-form-item" v-if="upload_type == 'oss'" v-cloak>
<label class="layui-form-label required">空间名称</label>
<div class="layui-input-block">
<input type="text" name="alioss_bucket" class="layui-input" lay-verify="required" lay-reqtext="请输入空间名称" placeholder="请输入空间名称" value="{:sysconfig('upload','alioss_bucket')}">
<input type="text" name="oss_bucket" class="layui-input" lay-verify="required" lay-reqtext="请输入空间名称" placeholder="请输入空间名称" value="{{sysconfig('upload','oss_bucket')}}">
<tip>例子:easy-admin</tip>
</div>
</div>
<div class="layui-form-item" v-if="upload_type == 'alioss'" v-cloak>
<div class="layui-form-item" v-if="upload_type == 'oss'" v-cloak>
<label class="layui-form-label required">访问域名</label>
<div class="layui-input-block">
<input type="text" name="alioss_domain" class="layui-input" lay-verify="required" lay-reqtext="请输入访问域名" placeholder="请输入访问域名" value="{:sysconfig('upload','alioss_domain')}">
<input type="text" name="oss_domain" class="layui-input" lay-verify="required" lay-reqtext="请输入访问域名" placeholder="请输入访问域名" value="{{sysconfig('upload','oss_domain')}}">
<tip>例子:easy-admin.oss-cn-shenzhen.aliyuncs.com</tip>
</div>
</div>
<div class="layui-form-item" v-if="upload_type == 'txcos'" v-cloak>
<div class="layui-form-item" v-if="upload_type == 'cos'" v-cloak>
<label class="layui-form-label required">公钥信息</label>
<div class="layui-input-block">
<input type="text" name="txcos_secret_id" class="layui-input" lay-verify="required" lay-reqtext="请输入公钥信息" placeholder="请输入公钥信息" value="{:sysconfig('upload','txcos_secret_id')}">
<input type="text" name="cos_secret_id" class="layui-input" lay-verify="required" lay-reqtext="请输入公钥信息" placeholder="请输入公钥信息" value="{{sysconfig('upload','cos_secret_id')}}">
<tip>例子:AKIDta6OQCbALQGrCI6ngKwQffR3dfsfrwrfs</tip>
</div>
</div>
<div class="layui-form-item" v-if="upload_type == 'txcos'" v-cloak>
<div class="layui-form-item" v-if="upload_type == 'cos'" v-cloak>
<label class="layui-form-label required">私钥信息</label>
<div class="layui-input-block">
<input type="text" name="txcos_secret_key" class="layui-input" lay-verify="required" lay-reqtext="请输入私钥信息" placeholder="请输入私钥信息" value="{:sysconfig('upload','txcos_secret_key')}">
<input type="text" name="cos_secret_key" class="layui-input" lay-verify="required" lay-reqtext="请输入私钥信息" placeholder="请输入私钥信息" value="{{sysconfig('upload','cos_secret_key')}}">
<tip>例子:VllEWYKtClAbpqfFdTqysXxGQM6dsfs</tip>
</div>
</div>
<div class="layui-form-item" v-if="upload_type == 'txcos'" v-cloak>
<div class="layui-form-item" v-if="upload_type == 'cos'" v-cloak>
<label class="layui-form-label required">存储桶地域</label>
<div class="layui-input-block">
<input type="text" name="txcos_region" class="layui-input" lay-verify="required" lay-reqtext="请输入存储桶地域" placeholder="请输入存储桶地域" value="{:sysconfig('upload','txcos_region')}">
<input type="text" name="cos_region" class="layui-input" lay-verify="required" lay-reqtext="请输入存储桶地域" placeholder="请输入存储桶地域" value="{{sysconfig('upload','cos_region')}}">
<tip>例子:ap-guangzhou</tip>
</div>
</div>
<div class="layui-form-item" v-if="upload_type == 'txcos'" v-cloak>
<div class="layui-form-item" v-if="upload_type == 'cos'" v-cloak>
<label class="layui-form-label required">存储桶名称</label>
<div class="layui-input-block">
<input type="text" name="tecos_bucket" class="layui-input" lay-verify="required" lay-reqtext="请输入存储桶名称" placeholder="请输入存储桶名称" value="{:sysconfig('upload','tecos_bucket')}">
<input type="text" name="cos_bucket" class="layui-input" lay-verify="required" lay-reqtext="请输入存储桶名称" placeholder="请输入存储桶名称" value="{{sysconfig('upload','cos_bucket')}}">
<tip>例子:easyadmin-1251997243</tip>
</div>
</div>
......@@ -100,7 +100,7 @@
<div class="layui-form-item" v-if="upload_type == 'qnoss'" v-cloak>
<label class="layui-form-label required">公钥信息</label>
<div class="layui-input-block">
<input type="text" name="qnoss_access_key" class="layui-input" lay-verify="required" lay-reqtext="请输入公钥信息" placeholder="请输入公钥信息" value="{:sysconfig('upload','qnoss_access_key')}">
<input type="text" name="qnoss_access_key" class="layui-input" lay-verify="required" lay-reqtext="请输入公钥信息" placeholder="请输入公钥信息" value="{{sysconfig('upload','qnoss_access_key')}}">
<tip>例子:v-lV3tXev7yyfsfa1jRc6_8rFOhFYGQvvjsAQxdrB</tip>
</div>
</div>
......
......@@ -9,4 +9,8 @@
</table>
</div>
</div>
<script>
let upload_types = '{!! json_encode($upload_types) !!}';
upload_types = JSON.parse(upload_types)
</script>
@include('admin.layout.foot')