mirror of https://gitee.com/karson/fastadmin.git
Compare commits
5 Commits
7a81b078f3
...
49e8cc52e7
| Author | SHA1 | Date |
|---|---|---|
|
|
49e8cc52e7 | |
|
|
31c3d7b469 | |
|
|
017c7687c3 | |
|
|
2bd2fd5684 | |
|
|
71d15964fd |
5
.bowerrc
5
.bowerrc
|
|
@ -7,5 +7,8 @@
|
||||||
"jspdf",
|
"jspdf",
|
||||||
"jspdf-autotable",
|
"jspdf-autotable",
|
||||||
"pdfmake"
|
"pdfmake"
|
||||||
]
|
],
|
||||||
|
"scripts":{
|
||||||
|
"postinstall": "node bower-cleanup.js"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
/public/assets/libs/
|
/public/assets/libs/
|
||||||
/public/assets/addons/*
|
/public/assets/addons/*
|
||||||
/public/uploads/*
|
/public/uploads/*
|
||||||
|
.DS_Store
|
||||||
.idea
|
.idea
|
||||||
composer.lock
|
composer.lock
|
||||||
*.log
|
*.log
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ return [
|
||||||
//允许跨域的域名,多个以,分隔
|
//允许跨域的域名,多个以,分隔
|
||||||
'cors_request_domain' => 'localhost,127.0.0.1',
|
'cors_request_domain' => 'localhost,127.0.0.1',
|
||||||
//版本号
|
//版本号
|
||||||
'version' => '1.5.2.20240906',
|
'version' => '1.5.4.20250312',
|
||||||
//API接口地址
|
//API接口地址
|
||||||
'api_url' => 'https://api.fastadmin.net',
|
'api_url' => 'https://api.fastadmin.net',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const minimatch = require('minimatch');
|
||||||
|
|
||||||
|
// bower.json和bower_components目录路径
|
||||||
|
const bowerJsonPath = path.resolve(__dirname, './bower.json');
|
||||||
|
const bowerDir = path.resolve(__dirname, './public/assets/libs');
|
||||||
|
|
||||||
|
console.log('Bower postinstall: 开始清理依赖包...');
|
||||||
|
|
||||||
|
// 检查bower.json是否存在
|
||||||
|
if (!fs.existsSync(bowerJsonPath)) {
|
||||||
|
console.error('未找到bower.json文件');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取bower.json配置
|
||||||
|
let bowerConfig;
|
||||||
|
try {
|
||||||
|
bowerConfig = JSON.parse(fs.readFileSync(bowerJsonPath, 'utf8'));
|
||||||
|
} catch (err) {
|
||||||
|
console.error('读取bower.json文件失败:', err);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 递归删除文件夹
|
||||||
|
function deleteFolderRecursive(folderPath) {
|
||||||
|
if (fs.existsSync(folderPath)) {
|
||||||
|
fs.readdirSync(folderPath).forEach(file => {
|
||||||
|
const curPath = path.join(folderPath, file);
|
||||||
|
if (fs.lstatSync(curPath).isDirectory()) {
|
||||||
|
// 递归删除子文件夹
|
||||||
|
deleteFolderRecursive(curPath);
|
||||||
|
} else {
|
||||||
|
// 删除文件
|
||||||
|
fs.unlinkSync(curPath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 删除空文件夹
|
||||||
|
fs.rmdirSync(folderPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取要删除的文件列表(支持gitignore语法)
|
||||||
|
function getFilesToRemove(packagePath, patterns) {
|
||||||
|
const result = [];
|
||||||
|
|
||||||
|
// 递归查找匹配的文件和文件夹
|
||||||
|
function findMatches(dir, relativePath = '') {
|
||||||
|
if (!fs.existsSync(dir)) return;
|
||||||
|
|
||||||
|
const files = fs.readdirSync(dir);
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
const fullPath = path.join(dir, file);
|
||||||
|
const relPath = relativePath ? path.join(relativePath, file) : file;
|
||||||
|
const stats = fs.statSync(fullPath);
|
||||||
|
|
||||||
|
let matched = false;
|
||||||
|
|
||||||
|
// 检查是否匹配任何模式
|
||||||
|
for (const pattern of patterns) {
|
||||||
|
// 处理目录特定模式(以/结尾)
|
||||||
|
if (pattern.endsWith('/') && stats.isDirectory()) {
|
||||||
|
if (minimatch(relPath, pattern.slice(0, -1)) ||
|
||||||
|
minimatch(relPath + '/', pattern)) {
|
||||||
|
matched = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 普通模式匹配
|
||||||
|
else if (minimatch(relPath, pattern)) {
|
||||||
|
matched = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matched) {
|
||||||
|
result.push(fullPath);
|
||||||
|
}
|
||||||
|
// 如果是目录且未匹配,则递归查找
|
||||||
|
else if (stats.isDirectory()) {
|
||||||
|
findMatches(fullPath, relPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
findMatches(packagePath);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取ignores配置
|
||||||
|
const ignores = bowerConfig.ignores || {};
|
||||||
|
|
||||||
|
// 处理每个包的ignores配置
|
||||||
|
Object.keys(ignores).forEach(packageName => {
|
||||||
|
const packagePath = path.join(bowerDir, packageName);
|
||||||
|
|
||||||
|
// 检查包是否存在
|
||||||
|
if (!fs.existsSync(packagePath)) {
|
||||||
|
console.log(`包 ${packageName} 不存在,跳过`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`处理包: ${packageName}`);
|
||||||
|
|
||||||
|
// 获取要删除的文件/文件夹模式列表
|
||||||
|
const patterns = ignores[packageName] || [];
|
||||||
|
|
||||||
|
// 如果没有模式,跳过
|
||||||
|
if (patterns.length === 0) {
|
||||||
|
console.log(`包 ${packageName} 没有配置忽略模式,跳过`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取匹配的文件和文件夹
|
||||||
|
const filesToRemove = getFilesToRemove(packagePath, patterns);
|
||||||
|
|
||||||
|
// 按照路径长度排序,确保先删除深层文件
|
||||||
|
filesToRemove.sort((a, b) => b.length - a.length);
|
||||||
|
|
||||||
|
// 删除匹配的文件和文件夹
|
||||||
|
filesToRemove.forEach(itemPath => {
|
||||||
|
if (fs.existsSync(itemPath)) {
|
||||||
|
const stats = fs.statSync(itemPath);
|
||||||
|
|
||||||
|
if (stats.isDirectory()) {
|
||||||
|
console.log(`删除冗余文件夹: ${itemPath}`);
|
||||||
|
deleteFolderRecursive(itemPath);
|
||||||
|
} else {
|
||||||
|
console.log(`删除冗余文件: ${itemPath}`);
|
||||||
|
fs.unlinkSync(itemPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Bower postinstall清理完成');
|
||||||
74
bower.json
74
bower.json
|
|
@ -6,7 +6,7 @@
|
||||||
"homepage": "https://www.fastadmin.net",
|
"homepage": "https://www.fastadmin.net",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jquery": "^3.7.0",
|
"jquery": "^3.7.1",
|
||||||
"bootstrap": "^3.3.7",
|
"bootstrap": "^3.3.7",
|
||||||
"font-awesome": "^4.6.1",
|
"font-awesome": "^4.6.1",
|
||||||
"bootstrap-table": "fastadmin-bootstraptable#~1.11.5",
|
"bootstrap-table": "fastadmin-bootstraptable#~1.11.5",
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
"tableExport.jquery.plugin": "~1.10.3",
|
"tableExport.jquery.plugin": "~1.10.3",
|
||||||
"jquery-slimscroll": "~1.3.8",
|
"jquery-slimscroll": "~1.3.8",
|
||||||
"jquery.cookie": "~1.4.1",
|
"jquery.cookie": "~1.4.1",
|
||||||
"Sortable": "~1.10.0",
|
"Sortable": "~1.10.2",
|
||||||
"nice-validator": "karsonzhang/fastadmin-nicevalidator#~1.1.6",
|
"nice-validator": "karsonzhang/fastadmin-nicevalidator#~1.1.6",
|
||||||
"art-template": "~3.1.3",
|
"art-template": "~3.1.3",
|
||||||
"bootstrap-daterangepicker": "~2.1.25",
|
"bootstrap-daterangepicker": "~2.1.25",
|
||||||
|
|
@ -30,5 +30,75 @@
|
||||||
"fastadmin-selectpage": "^1.0.12",
|
"fastadmin-selectpage": "^1.0.12",
|
||||||
"fastadmin-layer": "~3.5.1",
|
"fastadmin-layer": "~3.5.1",
|
||||||
"bootstrap-slider": "*"
|
"bootstrap-slider": "*"
|
||||||
|
},
|
||||||
|
"ignores": {
|
||||||
|
"art-template": [
|
||||||
|
".*",
|
||||||
|
"demo",
|
||||||
|
"doc",
|
||||||
|
"loader",
|
||||||
|
"node",
|
||||||
|
"src",
|
||||||
|
"test"
|
||||||
|
],
|
||||||
|
"jquery": [
|
||||||
|
"src",
|
||||||
|
"test",
|
||||||
|
"external"
|
||||||
|
],
|
||||||
|
"bootstrap": [
|
||||||
|
"grunt",
|
||||||
|
"js",
|
||||||
|
"nuget"
|
||||||
|
],
|
||||||
|
"bootstrap-daterangepicker": [
|
||||||
|
"example",
|
||||||
|
"website",
|
||||||
|
"*.html"
|
||||||
|
],
|
||||||
|
"bootstrap-table": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"eonasdan-bootstrap-datetimepicker": [
|
||||||
|
"docs",
|
||||||
|
"src",
|
||||||
|
"tasks"
|
||||||
|
],
|
||||||
|
"fastadmin-citypicker": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"fastadmin-cxselect": [
|
||||||
|
"*.html"
|
||||||
|
],
|
||||||
|
"fastadmin-layer": [
|
||||||
|
"src",
|
||||||
|
"test"
|
||||||
|
],
|
||||||
|
"jquery-slimscroll": [
|
||||||
|
"examples"
|
||||||
|
],
|
||||||
|
"jstree": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"moment": [
|
||||||
|
"src",
|
||||||
|
"ts3.1-*"
|
||||||
|
],
|
||||||
|
"require-css": [
|
||||||
|
"*.sh"
|
||||||
|
],
|
||||||
|
"Sortable": [
|
||||||
|
"entry",
|
||||||
|
"modular",
|
||||||
|
"plugins",
|
||||||
|
"scripts",
|
||||||
|
"src",
|
||||||
|
"st",
|
||||||
|
".*",
|
||||||
|
"*.html"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"jquery": "^3.7.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ class Date
|
||||||
*/
|
*/
|
||||||
public static function human($remote, $local = null)
|
public static function human($remote, $local = null)
|
||||||
{
|
{
|
||||||
$time_diff = (is_null($local) || $local ? time() : $local) - $remote;
|
$time_diff = (is_null($local) ? time() : $local) - $remote;
|
||||||
$tense = $time_diff < 0 ? 'after' : 'ago';
|
$tense = $time_diff < 0 ? 'after' : 'ago';
|
||||||
$time_diff = abs($time_diff);
|
$time_diff = abs($time_diff);
|
||||||
$chunks = [
|
$chunks = [
|
||||||
|
|
@ -146,7 +146,7 @@ class Date
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return __("%d $name%s $tense", $count, ($count > 1 ? 's' : ''));
|
return __("%d $name%s $tense", [$count, ($count > 1 ? 's' : '')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ class Http
|
||||||
/**
|
/**
|
||||||
* 发送一个POST请求
|
* 发送一个POST请求
|
||||||
* @param string $url 请求URL
|
* @param string $url 请求URL
|
||||||
* @param array $params 请求参数
|
* @param array $params 请求参数
|
||||||
* @param array $options 扩展参数
|
* @param array $options 扩展参数
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*/
|
*/
|
||||||
public static function post(string $url, array $params = [], array $options = [])
|
public static function post($url, $params = [], $options = [])
|
||||||
{
|
{
|
||||||
$req = self::sendRequest($url, $params, 'POST', $options);
|
$req = self::sendRequest($url, $params, 'POST', $options);
|
||||||
return $req['ret'] ? $req['msg'] : '';
|
return $req['ret'] ? $req['msg'] : '';
|
||||||
|
|
@ -24,11 +24,11 @@ class Http
|
||||||
/**
|
/**
|
||||||
* 发送一个GET请求
|
* 发送一个GET请求
|
||||||
* @param string $url 请求URL
|
* @param string $url 请求URL
|
||||||
* @param array $params 请求参数
|
* @param array $params 请求参数
|
||||||
* @param array $options 扩展参数
|
* @param array $options 扩展参数
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*/
|
*/
|
||||||
public static function get(string $url, array $params = [], array $options = [])
|
public static function get($url, $params = [], $options = [])
|
||||||
{
|
{
|
||||||
$req = self::sendRequest($url, $params, 'GET', $options);
|
$req = self::sendRequest($url, $params, 'GET', $options);
|
||||||
return $req['ret'] ? $req['msg'] : '';
|
return $req['ret'] ? $req['msg'] : '';
|
||||||
|
|
@ -42,7 +42,7 @@ class Http
|
||||||
* @param mixed $options CURL的参数
|
* @param mixed $options CURL的参数
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function sendRequest(string $url, $params = [], string $method = 'POST', $options = []): array
|
public static function sendRequest($url, $params = [], $method = 'POST', $options = [])
|
||||||
{
|
{
|
||||||
$method = strtoupper($method);
|
$method = strtoupper($method);
|
||||||
$protocol = substr($url, 0, 5);
|
$protocol = substr($url, 0, 5);
|
||||||
|
|
@ -108,7 +108,7 @@ class Http
|
||||||
* @param string $method 请求的方法
|
* @param string $method 请求的方法
|
||||||
* @return boolean TRUE
|
* @return boolean TRUE
|
||||||
*/
|
*/
|
||||||
public static function sendAsyncRequest(string $url, $params = [], string $method = 'POST'): bool
|
public static function sendAsyncRequest($url, $params = [], $method = 'POST')
|
||||||
{
|
{
|
||||||
$method = strtoupper($method);
|
$method = strtoupper($method);
|
||||||
$method = $method == 'POST' ? 'POST' : 'GET';
|
$method = $method == 'POST' ? 'POST' : 'GET';
|
||||||
|
|
@ -157,10 +157,10 @@ class Http
|
||||||
/**
|
/**
|
||||||
* 发送文件到客户端
|
* 发送文件到客户端
|
||||||
* @param string $file
|
* @param string $file
|
||||||
* @param bool $deleteAfterSend
|
* @param bool $delaftersend
|
||||||
* @param bool $exitAfterSend
|
* @param bool $exitaftersend
|
||||||
*/
|
*/
|
||||||
public static function sendToBrowser(string $file, bool $deleteAfterSend = true, bool $exitAfterSend = true)
|
public static function sendToBrowser($file, $delaftersend = true, $exitaftersend = true)
|
||||||
{
|
{
|
||||||
if (file_exists($file) && is_readable($file)) {
|
if (file_exists($file) && is_readable($file)) {
|
||||||
header('Content-Description: File Transfer');
|
header('Content-Description: File Transfer');
|
||||||
|
|
@ -174,10 +174,10 @@ class Http
|
||||||
ob_clean();
|
ob_clean();
|
||||||
flush();
|
flush();
|
||||||
readfile($file);
|
readfile($file);
|
||||||
if ($deleteAfterSend) {
|
if ($delaftersend) {
|
||||||
unlink($file);
|
unlink($file);
|
||||||
}
|
}
|
||||||
if ($exitAfterSend) {
|
if ($exitaftersend) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
|
||||||
table.bootstrapTable({
|
table.bootstrapTable({
|
||||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||||
sortName: '',
|
sortName: '',
|
||||||
escape: false,
|
escape: true,
|
||||||
columns: [
|
columns: [
|
||||||
[
|
[
|
||||||
{field: 'state', checkbox: true,},
|
{field: 'state', checkbox: true,},
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||||
pk: 'id',
|
pk: 'id',
|
||||||
sortName: 'weigh',
|
sortName: 'weigh',
|
||||||
escape: false,
|
escape: true,
|
||||||
columns: [
|
columns: [
|
||||||
[
|
[
|
||||||
{checkbox: true},
|
{checkbox: true},
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue