7 Commits

Author SHA1 Message Date
WIN-VSNMD38DUOC\Administrator
70f2a39c24 修改README.md文件 2024-04-28 11:22:13 +08:00
WIN-VSNMD38DUOC\Administrator
c153538485 修改axAjax的timeout默认值为6000000 2024-04-10 08:48:55 +08:00
WIN-VSNMD38DUOC\Administrator
8077b49c49 修改启动文件 2024-03-20 15:39:07 +08:00
WIN-VSNMD38DUOC\Administrator
9e59798be2 修改版本号 2024-03-20 15:36:51 +08:00
WIN-VSNMD38DUOC\Administrator
aa1aef8583 修改日志文件生成及读取位置,上传文件格式新增支持js、css、html、vsdx、dmp、7z、ppt、pptx 2024-03-20 15:34:32 +08:00
WIN-VSNMD38DUOC\Administrator
f65fcbac7a 使用Promise封装XMLHttpRequest做异步请求 2024-03-15 10:28:39 +08:00
WIN-VSNMD38DUOC\Administrator
25817132fd 升级AXUI到v2.1.1 2024-03-11 09:13:08 +08:00
60 changed files with 10074 additions and 6205 deletions

View File

@@ -12,7 +12,7 @@
5. SpringBoot Starter WebSocket 3.1.1 5. SpringBoot Starter WebSocket 3.1.1
6. RocksDB 8.3.2 6. RocksDB 8.3.2
7. Hutool Json 5.8.21 7. Hutool Json 5.8.21
7. AXUI 2.0.14 7. AXUI 2.1.1
#### 安装教程 #### 安装教程

View File

@@ -10,7 +10,7 @@
</parent> </parent>
<groupId>cn.somkit</groupId> <groupId>cn.somkit</groupId>
<artifactId>fmt</artifactId> <artifactId>fmt</artifactId>
<version>1.1.0</version> <version>1.2.0</version>
<name>fmt</name> <name>fmt</name>
<description>fmt</description> <description>fmt</description>
<properties> <properties>

View File

@@ -7,28 +7,28 @@ import org.springframework.util.StringUtils;
@Component @Component
public class LogSocketConfig { public class LogSocketConfig {
public static String Log_File_Path = "D:/logs/fmt/fmt-server.log"; public static String Log_File_Path = "./logs/fmt-server.log";
public static String Max_Read_Length = "500"; public static String Max_Read_Length = "500";
public static String Read_Interval = "1000"; public static String Read_Interval = "1000";
@Value("${somkit.logging.socket.log-file-path}") @Value("${somkit.logging.socket.log-file-path}")
public static void setLog_File_Path(String log_File_Path) { public void setLog_File_Path(String log_File_Path) {
if(StringUtils.hasText(log_File_Path)){ if(StringUtils.hasText(log_File_Path)){
Log_File_Path = log_File_Path; Log_File_Path = log_File_Path;
} }
} }
@Value("${somkit.logging.socket.max-read-length}") @Value("${somkit.logging.socket.max-read-length}")
public static void setMax_Read_Length(String max_Read_Length) { public void setMax_Read_Length(String max_Read_Length) {
if(StringUtils.hasText(max_Read_Length)){ if(StringUtils.hasText(max_Read_Length)){
Max_Read_Length = max_Read_Length; Max_Read_Length = max_Read_Length;
} }
} }
@Value("${somkit.logging.socket.read-interval}") @Value("${somkit.logging.socket.read-interval}")
public static void setRead_Interval(String read_Interval) { public void setRead_Interval(String read_Interval) {
if(StringUtils.hasText(read_Interval)){ if(StringUtils.hasText(read_Interval)){
Read_Interval = read_Interval; Read_Interval = read_Interval;
} }

View File

@@ -30,7 +30,7 @@ somkit:
logging: logging:
socket: socket:
#日志文件地址 #日志文件地址
log-file-path: D:/logs/fmt/fmt-server.log log-file-path: ./logs/fmt-server.log
#最大读取展示行数 #最大读取展示行数
max-read-length: 500 max-read-length: 500
#读取间隔时间 毫秒 #读取间隔时间 毫秒

View File

@@ -1,5 +1,5 @@
chcp 65001 chcp 65001
SET JAR=D:/fmt/fmt-1.1.0.jar SET JAR=D:/fmt/fmt-1.2.0.jar
SET JAR_CONFIG=D:/fmt/config/ SET JAR_CONFIG=D:/fmt/config/
SET JAR_LIB=D:/fmt/lib/ SET JAR_LIB=D:/fmt/lib/
java -Dfile.encoding=utf-8 -jar %JAR% --spring.config.location=%JAR_CONFIG% --spring.lib.location=%JAR_LIB% java -Dfile.encoding=utf-8 -jar %JAR% --spring.config.location=%JAR_CONFIG% --spring.lib.location=%JAR_LIB%

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
JAR=/home/deploy/fmt/fmt-1.1.0.jar JAR=/home/deploy/fmt/fmt-1.2.0.jar
JAR_CONFIG=/home/deploy/fmt/config/ JAR_CONFIG=/home/deploy/fmt/config/
JAR_LIB=/home/deploy/fmt/lib/ JAR_LIB=/home/deploy/fmt/lib/
JAVA_HOME=/usr/local/jdk-17.0.7 JAVA_HOME=/usr/local/jdk-17.0.7

View File

@@ -4,7 +4,7 @@
<include resource="org/springframework/boot/logging/logback/defaults.xml"/> <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<!-- 定义日志的根目录 --> <!-- 定义日志的根目录 -->
<property name="LOG_HOME" value="/logs/fmt"/> <property name="LOG_HOME" value="./logs"/>
<!-- 定义日志文件名称 --> <!-- 定义日志文件名称 -->
<property name="APP_NAME" value="fmt-server"/> <property name="APP_NAME" value="fmt-server"/>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,9 @@
@charset "utf-8"; @charset "utf-8";
/* /*
*Last modified: 2023-07-04 22:50:35 *Last modified: 2023-11-11 09:36:26
*Filename: ax-response.css *Filename: ax-response.css
*Description: Global CSS *Description: Global CSS
*Version: v2.0.14 *Version: v2.1.1
*Website:www.axui.cn *Website:www.axui.cn
*Contact:3217728223@qq.com *Contact:3217728223@qq.com
*Author:Michael *Author:Michael
@@ -12,31 +12,30 @@
@media screen and (-webkit-max-device-pixel-ratio: 1.1), (max-device-pixel-ratio: 1.1) { @media screen and (-webkit-max-device-pixel-ratio: 1.1), (max-device-pixel-ratio: 1.1) {
/*scrollbar*/ /*scrollbar*/
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; width: 8px;
height: 10px; height: 8px;
background: transparent; background: transparent;
} }
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background-color: rgba(0, 0, 0, 0.04); background-color: rgba(0, 0, 0, 0.04);
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.3); background-color: rgba(0, 0, 0, 0.2);
} }
::-webkit-scrollbar-thumb:hover { ::-webkit-scrollbar-thumb:hover {
background-color: rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.4);
} }
::-webkit-scrollbar-thumb:active {
background-color: rgba(0, 0, 0, 0.6);
}
::-webkit-scrollbar-corner { ::-webkit-scrollbar-corner {
background-color: rgba(0, 0, 0, 0.04); background-color: rgba(0, 0, 0, 0.04);
} }
body { @-moz-document url-prefix() {
scrollbar-arrow-color: #b3b3b3; * {
scrollbar-face-color: #b3b3b3; scrollbar-gutter: auto;
scrollbar-3dlight-color: #b3b3b3; scrollbar-width: thin;
scrollbar-highlight-color: #f0f0f0; }
scrollbar-shadow-color: #b3b3b3;
scrollbar-darkshadow-color: #b3b3b3;
scrollbar-track-color: #f0f0f0;
scrollbar-base-color: #f0f0f0;
} }
select[multiple] { select[multiple] {
padding: 0; padding: 0;
@@ -88,9 +87,9 @@
.ax-btn.ax-primary:not(.ax-line), .ax-btn.ax-primary:not(.ax-line),
.ax-btn.ax-secondary:not(.ax-line), .ax-btn.ax-secondary:not(.ax-line),
.ax-btn.ax-success:not(.ax-line), .ax-btn.ax-success:not(.ax-line),
.ax-btn.ax-danger:not(.ax-line), .ax-btn.ax-error:not(.ax-line),
.ax-btn.ax-warning:not(.ax-line), .ax-btn.ax-warning:not(.ax-line),
.ax-btn.ax-ad:not(.ax-line), .ax-btn.ax-question:not(.ax-line),
.ax-btn.ax-info:not(.ax-line), .ax-btn.ax-info:not(.ax-line),
.ax-btn.ax-black:not(.ax-line) { .ax-btn.ax-black:not(.ax-line) {
border-width: 0; border-width: 0;
@@ -98,9 +97,9 @@
.ax-btn.ax-primary:not(.ax-line):after, .ax-btn.ax-primary:not(.ax-line):after,
.ax-btn.ax-secondary:not(.ax-line):after, .ax-btn.ax-secondary:not(.ax-line):after,
.ax-btn.ax-success:not(.ax-line):after, .ax-btn.ax-success:not(.ax-line):after,
.ax-btn.ax-danger:not(.ax-line):after, .ax-btn.ax-error:not(.ax-line):after,
.ax-btn.ax-warning:not(.ax-line):after, .ax-btn.ax-warning:not(.ax-line):after,
.ax-btn.ax-ad:not(.ax-line):after, .ax-btn.ax-question:not(.ax-line):after,
.ax-btn.ax-info:not(.ax-line):after, .ax-btn.ax-info:not(.ax-line):after,
.ax-btn.ax-black:not(.ax-line):after { .ax-btn.ax-black:not(.ax-line):after {
border-width: 0; border-width: 0;
@@ -285,6 +284,7 @@
max-height: calc(100% - 8.8rem - 1.4rem*2); max-height: calc(100% - 8.8rem - 1.4rem*2);
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
overscroll-behavior: contain;
background-color: #fff; background-color: #fff;
border-radius: 0.3rem !important; border-radius: 0.3rem !important;
transform: translate(-50%, -50%) !important; transform: translate(-50%, -50%) !important;
@@ -457,8 +457,8 @@
.ax-fit-tel .ax-form-btn.ax-btn-primary, .ax-fit-tel .ax-form-btn.ax-btn-primary,
.ax-fit-tel .ax-form-btn.ax-btn-primary [class*="font"], .ax-fit-tel .ax-form-btn.ax-btn-primary [class*="font"],
.ax-fit-tel .ax-form-btn.ax-btn-primary svg { .ax-fit-tel .ax-form-btn.ax-btn-primary svg {
color: #198cff; color: var(--color-primary);
fill: #198cff; fill: var(--color-primary);
} }
.ax-fit-tel .ax-form-btn.ax-btn-secondary, .ax-fit-tel .ax-form-btn.ax-btn-secondary,
.ax-fit-tel .ax-form-btn.ax-btn-secondary [class*="font"], .ax-fit-tel .ax-form-btn.ax-btn-secondary [class*="font"],
@@ -469,32 +469,32 @@
.ax-fit-tel .ax-form-btn.ax-btn-danger, .ax-fit-tel .ax-form-btn.ax-btn-danger,
.ax-fit-tel .ax-form-btn.ax-btn-danger [class*="font"], .ax-fit-tel .ax-form-btn.ax-btn-danger [class*="font"],
.ax-fit-tel .ax-form-btn.ax-btn-danger svg { .ax-fit-tel .ax-form-btn.ax-btn-danger svg {
color: #dc3545; color: var(--color-error);
fill: #dc3545; fill: var(--color-error);
} }
.ax-fit-tel .ax-form-btn.ax-btn-success, .ax-fit-tel .ax-form-btn.ax-btn-success,
.ax-fit-tel .ax-form-btn.ax-btn-success [class*="font"], .ax-fit-tel .ax-form-btn.ax-btn-success [class*="font"],
.ax-fit-tel .ax-form-btn.ax-btn-success svg { .ax-fit-tel .ax-form-btn.ax-btn-success svg {
color: #41a358; color: var(--color-success);
fill: #41a358; fill: var(--color-success);
} }
.ax-fit-tel .ax-form-btn.ax-btn-warning, .ax-fit-tel .ax-form-btn.ax-btn-warning,
.ax-fit-tel .ax-form-btn.ax-btn-warning [class*="font"], .ax-fit-tel .ax-form-btn.ax-btn-warning [class*="font"],
.ax-fit-tel .ax-form-btn.ax-btn-warning svg { .ax-fit-tel .ax-form-btn.ax-btn-warning svg {
color: #ffc107; color: var(--color-warning);
fill: #ffc107; fill: var(--color-warning);
} }
.ax-fit-tel .ax-form-btn.ax-btn-info, .ax-fit-tel .ax-form-btn.ax-btn-info,
.ax-fit-tel .ax-form-btn.ax-btn-info [class*="font"], .ax-fit-tel .ax-form-btn.ax-btn-info [class*="font"],
.ax-fit-tel .ax-form-btn.ax-btn-info svg { .ax-fit-tel .ax-form-btn.ax-btn-info svg {
color: #14ccc9; color: var(--color-info);
fill: #14ccc9; fill: var(--color-info);
} }
.ax-fit-tel .ax-form-btn.ax-btn-ad, .ax-fit-tel .ax-form-btn.ax-btn-ad,
.ax-fit-tel .ax-form-btn.ax-btn-ad [class*="font"], .ax-fit-tel .ax-form-btn.ax-btn-ad [class*="font"],
.ax-fit-tel .ax-form-btn.ax-btn-ad svg { .ax-fit-tel .ax-form-btn.ax-btn-ad svg {
color: #ff8400; color: var(--color-question);
fill: #ff8400; fill: var(--color-question);
} }
.ax-fit-tel .ax-form-input + .ax-strength { .ax-fit-tel .ax-form-input + .ax-strength {
margin-top: -0.2rem; margin-top: -0.2rem;
@@ -893,7 +893,7 @@
.ax-graphic [keywords] > *, .ax-graphic [keywords] > *,
.ax-graphic [byline] *[class*='font'], .ax-graphic [byline] *[class*='font'],
.ax-graphic [keywords] *[class*='font'] { .ax-graphic [keywords] *[class*='font'] {
color: #b3b3b3; color: var(--color-ignore);
font-size: 1rem; font-size: 1rem;
} }
.ax-graphic[type=ad]:after { .ax-graphic[type=ad]:after {
@@ -1330,7 +1330,7 @@
} }
} }
/*Laptop & Desktop & iPadpro flip*/ /*Laptop & Desktop & iPadpro flip*/
@media screen and (min-width: 1200px) and (max-width: 3000px) { @media screen and (min-width: 1200px) and (max-width: 4100px) {
.ax-hide-pc { .ax-hide-pc {
display: none !important; display: none !important;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 498 B

After

Width:  |  Height:  |  Size: 498 B

View File

Before

Width:  |  Height:  |  Size: 71 B

After

Width:  |  Height:  |  Size: 71 B

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 623 B

After

Width:  |  Height:  |  Size: 623 B

View File

Before

Width:  |  Height:  |  Size: 623 B

After

Width:  |  Height:  |  Size: 623 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,9 @@
/*! /*!
*Last modified: 2023-06-04 21:01:53 *Last modified: 2023-09-15 14:35:16
*名称: axRate.js *名称: axRate.js
*简介: 评星插件的js文件 *简介: 评星插件的js文件
*用法: new axRate('#id',{参数}) *用法: new axRate('#id',{参数})
*版本: v1.0.3 *版本: v1.0.4
*演示: https://www.axui.cn/v2.0/ax-rate.php *演示: https://www.axui.cn/v2.0/ax-rate.php
*客服: 3217728223@qq.com *客服: 3217728223@qq.com
*交流: QQ群952502085 *交流: QQ群952502085
@@ -30,6 +30,7 @@ class axRate {
rendered: '', rendered: '',
getValue: '', getValue: '',
setValue: '', setValue: '',
breakpoints: {},
}, options, this.targetDom, this.constructor.name); }, options, this.targetDom, this.constructor.name);
this.handlers = {}; this.handlers = {};
if (!this.targetDom || this.targetDom.nodeName == 'INPUT') { if (!this.targetDom || this.targetDom.nodeName == 'INPUT') {
@@ -50,6 +51,7 @@ class axRate {
} }
init() { init() {
axInstance.push(this, this.options.insName, 'rate'); axInstance.push(this, this.options.insName, 'rate');
!axIsEmpty(this.options.breakpoints) ? axBreakpoints(this.options, this.options.breakpoints) : null;
this.renderRate(); this.renderRate();
this.set(this.options.value); this.set(this.options.value);
let pop; let pop;

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,9 @@
/*! /*!
*Last modified: 2023-07-04 22:56:05 *Last modified: 2023-09-15 14:32:19
*名称: axTree.js *名称: axTree.js
*简介: tree树菜单的js文件 *简介: tree树菜单的js文件
*用法: new axTree('#id',{参数}) *用法: new axTree('#id',{参数})
*版本: v1.0.9 *版本: v1.0.10
*演示: https://www.axui.cn/v2.0/ax-tree.php *演示: https://www.axui.cn/v2.0/ax-tree.php
*客服: 3217728223@qq.com *客服: 3217728223@qq.com
*交流: QQ群952502085 *交流: QQ群952502085
@@ -62,6 +62,7 @@ class axTree {
separator: ',', separator: ',',
prop: 'label', prop: 'label',
}, },
breakpoints: {},
onBeforeRemove: '', onBeforeRemove: '',
onGetCheckeds: '', onGetCheckeds: '',
onInit: '', onInit: '',
@@ -95,6 +96,7 @@ class axTree {
return this; return this;
} }
begin() { begin() {
!axIsEmpty(this.options.breakpoints) ? axBreakpoints(this.options, this.options.breakpoints) : null;
this.checked = []; this.checked = [];
this.checkeds = []; this.checkeds = [];
this.expanded = []; this.expanded = [];

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,10 @@
class Fmt{ class Fmt{
static _fmt_token_key = "_fmt_token_value";
/**
* 缓存配置 sessionsessionStorage locallocalStorage
* @type {string}
*/
static cache_config = "session";
constructor() { constructor() {
} }
/** /**
@@ -11,5 +17,442 @@ class Fmt{
return window.location.protocol + '//' + window.location.host; return window.location.protocol + '//' + window.location.host;
} }
return window.location.protocol + '//' + window.location.host + '/' + webName; return window.location.protocol + '//' + window.location.host + '/' + webName;
};
/**
* 缓存封装
* @type {{
* set: function(String, *): void,
* get: function(String): string,
* clear: function(): void,
* remove: function(String): void,
* key: function(Number): string
* }}
*/
static cache = {
/**
* 设置缓存
* @param {String} key
* @param value
*/
set: (key, value) => {
const config = Fmt.cache_config;
const storage = config === 'session' ?
window.sessionStorage : window.localStorage;
storage.setItem(key, value);
},
/**
* 获取缓存
* @param {String} key
* @returns {string}
*/
get: (key) => {
const config = Fmt.cache_config;
const storage = config === 'session' ?
window.sessionStorage : window.localStorage;
return storage.getItem(key);
},
/**
* 清除缓存
* @param {String} key
*/
remove: (key) => {
const config = Fmt.cache_config;
const storage = config === 'session' ?
window.sessionStorage : window.localStorage;
storage.removeItem(key);
},
/**
* 获取缓存key
* @param {Number} num
* @returns {string}
*/
key: (num) => {
const config = Fmt.cache_config;
const storage = config === 'session' ?
window.sessionStorage : window.localStorage;
return storage.key(num);
},
/**
* 此方法会清空整个浏览器的LocalStorage缓存
*/
clear: () => {
const config = Fmt.cache_config;
const storage = config === 'session' ?
window.sessionStorage : window.localStorage;
storage.clear();
}
};
/**
* 常用工具方法封装
* @type {{isEmpty: function(*): boolean, typeOf: function(*): string}}
*/
static utils = {
/**
* 获得对象真正的类型
* 可检测出Array,Object,Function,String,Number,Boolean,Date,Null,Undefined,HTMLDivElement(Dom节点都包含HTML)等
* @param obj
* @returns {string}
*/
typeOf: (obj) => Object.prototype.toString.call(obj).slice(8, -1),
/**
* 定义判断为空函数可判断function(){}0''[]{}undefinednull
* @param data
* @returns {boolean}
*/
isEmpty: (data) => {
let type = this.utils.typeOf(data);
if (!data) {
return true;
} else if (type === 'Function') {
return (data.toString().replace(/\s+/g, '').match(/{.*}/g)[0] === '{}');
} else if (type === 'Array') {
return data.join('') === '';
} else if (type === 'Object') {
return (Object.keys(data).length === 0)
} else {
return false;
}
},
/**
* 该函数是深度拷贝函数,返回一个一模一样的对象
* @param data
* @returns {*|Date|{}}
*/
clone: (data) => {
let cloneObj = (obj) => {
if (obj === null) {
return null;
} else if (typeof obj !== 'object') {
return obj;
} else if (obj.constructor === Date) {
return new Date(obj);
} else {
let newObj = {};
for (let k in obj) {
if (obj[k] == null) {
newObj[k] = null;
} else if ((typeof obj[k]) == 'object' && !obj[k].nodeType) {
newObj[k] = axClone(obj[k]);
if (obj[k] instanceof Array) {
let newArray = [];
for (let i of obj[k]) {
newArray.push(axClone(i));
}
newObj[k] = newArray;
}
} else {
newObj[k] = obj[k];
}
}
return newObj;
}
}
if (Array.isArray(data)) {
return data.map(k => cloneObj(k));
} else {
return cloneObj(data);
}
},
/**
* 扩展source相同属性的值去覆盖target, target如果没有这个属性就新增
* @param {Object} target
* @param {Object} source
* @returns {Object}
*/
extend: (target, source) => {
if(this.utils.typeOf(target) !== 'Object') return null;
if(this.utils.typeOf(source) !== 'Object') return null;
for (const key in source) {
// 使用for in会遍历数组所有的可枚举属性包括原型。
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
return target;
},
/**
* 判断选择器类型
* @param str
* @returns {string|boolean}
*/
strType: (str) => {
if (typeof str !== 'string') {
console.error('Argument must be a string!')
return false;
}
str = str.trim();
let isUpperCase = (letter) => {
if (letter >= 'A' && letter <= 'Z') {
return true;
}
},
type = '';
if (str) {
if (str.includes(' ')) {
type = 'level';
} else {
if (str.startsWith('#')) {
type = 'id';
} else if (str.startsWith('.')) {
type = 'class';
} else if (str.startsWith('[') && str.endsWith(']')) {
type = 'name';
} else if ([...str].every(i => isUpperCase(i))) {
type = 'node';
}
}
}
return type;
},
/**
* 将#id转成DOM
* @param elem
* @returns {*|boolean}
*/
idToDom: (elem) => {
let type = this.utils.typeOf(elem);
if (!elem) {
console.warn('Node selector is empty!');
return false;
} else if (type === 'String') {
let trim = elem.trim();
if (this.utils.strType(trim)) {
if (this.utils.strType(trim) === 'name' && !trim.includes('=')) {
trim = trim.slice(0, 1) + 'name=' + trim.slice(1);
}
return document.querySelector(trim);
} else {
console.warn('No node is found with this string!');
return false;
}
} else if (type.includes('HTML')) {
return elem;
} else {
return false;
}
},
/**
* 从表单控件取值用于校验判断适合的控件checkbox、radio、select-multiple和file
* @param name
* @param type
* @param format
* @param form
* @param separator
* @returns {*[]|boolean}
*/
multiValues: (name, type = 'checkbox', format = 'array', form, separator = ',') => {
let inputs,
values = [],
parent = form ? this.utils.idToDom(form) : '';
if (this.utils.strType(name) === 'NodeList' || this.utils.strType(name) === 'Array') {
if (type.includes('select') || type === 'file') {
console.warn('Can not be an node array in this type!');
return false;
}
inputs = name;
} else if (typeof name == 'object' || (this.utils.strType(name) && this.utils.strType(name) !== 'name')) {
let dom = this.utils.idToDom(name);
if (type.includes('select') || name.nodeName === 'SELECT') {
type = 'select';
inputs = dom.options;
} else if (type === 'file' || dom.type === 'file') {
type = 'file';
inputs = [dom];
} else {
inputs = [...dom.querySelectorAll('input')];
}
} else {
let selector = '';
if (this.utils.strType(name) === 'name') {
selector = name.replace('[', '[name=');
} else {
selector = `[name=${name}]`;
}
if (type.includes('select')) {
inputs = parent ? parent.querySelector(selector).options : document.querySelector(selector).options;
} else if (type === 'file') {
inputs = parent ? [parent.querySelector(selector)] : [document.querySelector(selector)];
} else {
inputs = parent ? [...parent.querySelectorAll(selector)] : [...document.querySelectorAll(selector)];
}
}
for (let i = 0; i < inputs.length; i++) {
let condition,
item = inputs[i];
if (type.includes('select')) {
condition = item.selected;
} else {
condition = item.checked;
}
if (type === 'file') {
values = [...item.files];
} else {
if (condition) {
values.push(item.value);
}
}
}
if (format === 'string') {
values = values.join(separator)
}
return values;
},
/**
* 表单序列化,支持将表单值序列化为以“&”连接的字符串,和对象数组[{name:'',value:''},...]
* @param element
* @param type
* @param separator
* @returns {{}}
*/
serialize: (element, type = "string", separator = ',') => {
let inputs,
items = [],
output;
if (Array.isArray(element)) {
inputs = element;
} else {
inputs = [...this.utils.idToDom(element).querySelectorAll('[name]')].filter(i => ['INPUT', 'SELECT', 'TEXTAREA'].includes(i.nodeName) && i.name && !i.name.includes('_ax_alt'));
}
inputs.forEach(i => {
let have = items.find(k => k.name === i.name);
if (have) {
if (i.type === 'checkbox' || i.type === 'radio') {
have.dom.push(i);
}
} else {
items.push({ name: i.name, type: i.type, dom: [i] })
}
});
items.forEach(i => {
if (i.type === 'file') {
i.value = this.utils.multiValues(i.dom[0], 'file', 'array');
} else if (i.type === 'checkbox') {
i.value = this.utils.multiValues(i.dom, 'checkbox', 'string', '', separator);
} else if (i.type === 'radio') {
i.value = this.utils.multiValues(i.dom, 'radio', 'string');
} else if (i.type.includes('select')) {
i.value = this.utils.multiValues(i.dom[0], 'select', 'string', '', separator);
} else {
i.value = i.dom[0].value;
}
});
if (type === 'string') {
let str = '';
items.forEach(k => {
str += '&' + k.name + '=' + k.value;
});
output = str;
} else if (type === 'json') {
let obj = {}
items.forEach(k => {
obj[k.name] = k.value;
});
output = obj;
} else if (type === 'array') {
items.forEach(k => {
delete k.type;
delete k.dom;
})
output = items;
}
return output;
}
};
/**
* XMLHttpRequest封装
* @param {{url, data, method, responseType, contentType, timeout, headers}} options
* @returns {Promise<unknown>}
*/
#axiosPrivate(options){
let data = options.data;
let url = options.url;
let method = options.method || 'GET';
let responseType = options.responseType || 'json';
let contentType = options.contentType || 'application/x-www-form-urlencoded';
let timeout = options.timeout || 0;
/**
* 序列化参数
* @param data
* @returns {string}
*/
let serialize = (data) => {
if (Fmt.utils.isEmpty(data)) return '';
let pairs = [];
for (let name in data) {
if (!data.hasOwnProperty(name)) continue;
if (Fmt.utils.typeOf(data[name]) === 'Function') continue;
let value = data[name].toString();
name = encodeURIComponent(name);
value = encodeURIComponent(value);
pairs.push(name + '=' + value);
}
return pairs.join('&');
}
/**
* 创建xhr请求对象
* @returns {XMLHttpRequest || ActiveXObject}
*/
let xhrObj = () => {
let xhr = '';
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}else {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
return xhr;
}
return new Promise((resolve, reject) => { // promise封装
let xhr = xhrObj();
let params = null;
xhr.onreadystatechange = handler;
if (method.toUpperCase() === 'GET') {
url = url + '?now=' + new Date().getTime() + '&' + serialize(data);
} else if (method.toUpperCase() === 'POST') {
params = serialize(data);
}
xhr.responseType = responseType;
xhr.timeout = timeout;
xhr.open(method, url);
xhr.setRequestHeader('Content-Type', contentType);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader("Access-Control-Allow-Origin","*");
if(!Fmt.utils.isEmpty(options.headers) && Fmt.utils.typeOf(options.headers) === 'Object'){
for (let key in options.headers) {
xhr.setRequestHeader(key, options.headers[key]);
}
}
xhr.send(params);
function handler() {
if (this.readyState !== 4) {
return;
}
if (this.status === 200) {
resolve(this.response);//正确回调
} else {
reject(new Error(this.statusText));//错误回调
}
}
})
}
/**
* XMLHttpRequest封装
* <pre>
* 使用方式:
* const options = {
* url: Fmt.ctx() + '/salt',
* data: {username: username},
* method: 'post'
* };
* Fmt.axios(options).then((res) => {
* console.warn(res)
* }).catch((err) => {console.warn(err)});
* </pre>
* @param {{url, data, method, responseType, contentType, timeout, headers}} options
* @returns {Promise<unknown>}
*/
static axios(options){
let fmt = new Fmt();
return fmt.#axiosPrivate(options);
} }
} }

View File

@@ -12,8 +12,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>文件列表</title> <title>文件列表</title>
<link th:href="@{/axui-v2.0.14/css/ax.css}" rel="stylesheet" type="text/css" > <link th:href="@{/axui-v2.1.1/css/ax.css}" rel="stylesheet" type="text/css" >
<link th:href="@{/axui-v2.0.14/css/ax-response.css}" rel="stylesheet" type="text/css" > <link th:href="@{/axui-v2.1.1/css/ax-response.css}" rel="stylesheet" type="text/css" >
</head> </head>
<body> <body>
<header class="ax-header"> <header class="ax-header">
@@ -85,23 +85,24 @@
<a href="###" class="ax-btn" id="batchDelBtn">批量删除</a> <a href="###" class="ax-btn" id="batchDelBtn">批量删除</a>
<div class="ax-break"></div> <div class="ax-break"></div>
</div> </div>
<script th:src="@{/axui-v2.0.14/js/ax.js}" type="text/javascript" charset="utf-8"></script> <script th:src="@{/axui-v2.1.1/js/ax.js}" type="text/javascript" charset="utf-8"></script>
<script th:src="@{/common/js/basic.js}" type="text/javascript" charset="utf-8"></script> <script th:src="@{/common/js/basic.js}" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" th:inline="javascript" charset="utf-8"> <script type="text/javascript" th:inline="javascript" charset="utf-8">
let fileDel = (obj) => { const fileDel = (obj) => {
const path = obj.getAttribute("value"); const path = obj.getAttribute("value");
let formData = {path: path}; const options = {
axAjax({ url: Fmt.ctx() + '/download/delete',
url: '/fmt/download/delete', data: {path: path},
data: formData, method: 'post'
type: 'post', };
success: function (result) { Fmt.axios(options).then((result) => {
window.location.href = '/fmt/download/index'; window.location.href = Fmt.ctx() + '/download/index';
} }).catch((err) => {
new axMessage({content: err, result: 'error', iconShow: true}).show();
}); });
} }
let fileDown = (obj) => { const fileDown = (obj) => {
const path = obj.getAttribute("value"); const path = obj.getAttribute("value");
window.open(Fmt.ctx() + '/download/execute?path=' + encodeURIComponent(path) + '&temp=' + false); window.open(Fmt.ctx() + '/download/execute?path=' + encodeURIComponent(path) + '&temp=' + false);
}; };
@@ -109,7 +110,7 @@
window.onload = () => { window.onload = () => {
document.getElementById("search").onclick = () => { document.getElementById("search").onclick = () => {
const keyboard = document.getElementById("keyboard").value; const keyboard = document.getElementById("keyboard").value;
window.location.href = '/fmt/download/index?keyboard=' + keyboard; window.location.href = Fmt.ctx() + '/download/index?keyboard=' + keyboard;
} }
document.getElementById("zipDownBtn").onclick = () => { document.getElementById("zipDownBtn").onclick = () => {
@@ -125,18 +126,19 @@
new axMessage({content: '请选择要下载的文件',result: 'warning',iconShow: true}).show(); new axMessage({content: '请选择要下载的文件',result: 'warning',iconShow: true}).show();
return false; return false;
} }
let formData = {filenames: filenames.join(",")};
let message = new axMessage({content: '',result: 'success',iconShow: true}); let message = new axMessage({content: '',result: 'success',iconShow: true});
message.update({content: '正在根据所选文件创建压缩包......', result: 'success'}).show(); message.update({content: '正在根据所选文件创建压缩包......', result: 'success'}).show();
axAjax({ const options = {
url: '/fmt/download/packZip', url: Fmt.ctx() + '/download/packZip',
data: formData, data: {filenames: filenames.join(",")},
type: 'post', method: 'post'
success: function (result) { };
const data = result.content; Fmt.axios(options).then((result) => {
message.update({content: '压缩包' + data.filename + "创建完成,准备下载文件......", result: 'success'}).show(); message.update({content: '压缩包' + result.filename + "创建完成,准备下载文件......", result: 'success'}).show();
window.open(Fmt.ctx() + '/download/execute?path=' + encodeURIComponent(data.path) + '&temp=' + true); window.open(Fmt.ctx() + '/download/execute?path=' + encodeURIComponent(result.path) + '&temp=' + true);
} }).catch((err) => {
console.log(err);
new axMessage({content: err, result: 'error', iconShow: true}).show();
}); });
} }
@@ -153,14 +155,15 @@
new axMessage({content: '请选择要删除的文件',result: 'warning',iconShow: true}).show(); new axMessage({content: '请选择要删除的文件',result: 'warning',iconShow: true}).show();
return false; return false;
} }
let formData = {filenames: filenames.join(",")}; const options = {
axAjax({ url: Fmt.ctx() + '/download/batchDel',
url: '/fmt/download/batchDel', data: {filenames: filenames.join(",")},
data: formData, method: 'post'
type: 'post', };
success: function (result) { Fmt.axios(options).then((result) => {
window.location.href = '/fmt/download/index'; window.location.href = Fmt.ctx() + '/download/index';
} }).catch((err) => {
new axMessage({content: err, result: 'error', iconShow: true}).show();
}); });
} }
} }

View File

@@ -12,8 +12,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>在线日志</title> <title>在线日志</title>
<link th:href="@{/axui-v2.0.14/css/ax.css}" rel="stylesheet" type="text/css" > <link th:href="@{/axui-v2.1.1/css/ax.css}" rel="stylesheet" type="text/css" >
<link th:href="@{/axui-v2.0.14/css/ax-response.css}" rel="stylesheet" type="text/css" > <link th:href="@{/axui-v2.1.1/css/ax-response.css}" rel="stylesheet" type="text/css" >
</head> </head>
<body> <body>
<header class="ax-header"> <header class="ax-header">
@@ -43,7 +43,7 @@
<div id="RootDiv" class="ax-border ax-margin"> <div id="RootDiv" class="ax-border ax-margin">
</div> </div>
<script th:src="@{/axui-v2.0.14/js/ax.js}" type="text/javascript" charset="utf-8"></script> <script th:src="@{/axui-v2.1.1/js/ax.js}" type="text/javascript" charset="utf-8"></script>
<script th:src="@{/common/js/basic.js}" type="text/javascript" charset="utf-8"></script> <script th:src="@{/common/js/basic.js}" type="text/javascript" charset="utf-8"></script>
<script th:src="@{/common/js/fmt-socket.js}" type="text/javascript" charset="utf-8"></script> <script th:src="@{/common/js/fmt-socket.js}" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" th:inline="javascript" charset="utf-8"> <script type="text/javascript" th:inline="javascript" charset="utf-8">

View File

@@ -12,8 +12,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>文件上传</title> <title>文件上传</title>
<link th:href="@{/axui-v2.0.14/css/ax.css}" rel="stylesheet" type="text/css" > <link th:href="@{/axui-v2.1.1/css/ax.css}" rel="stylesheet" type="text/css" >
<link th:href="@{/axui-v2.0.14/css/ax-response.css}" rel="stylesheet" type="text/css" > <link th:href="@{/axui-v2.1.1/css/ax-response.css}" rel="stylesheet" type="text/css" >
</head> </head>
<body> <body>
<header class="ax-header"> <header class="ax-header">
@@ -49,11 +49,12 @@
</div> </div>
</div> </div>
</div> </div>
<script th:src="@{/axui-v2.0.14/js/ax.js}" type="text/javascript" charset="utf-8"></script> <script th:src="@{/axui-v2.1.1/js/ax.js}" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
window.onload = () => { window.onload = () => {
let accept = "jpg,jpeg,gif,png,svg,doc,docx,xls,xlsx,txt,mp4,mp3,pdf,exe,msi,jar,zip," + let accept = "jpg,jpeg,gif,png,svg,doc,docx,xls,xlsx,txt,mp4,mp3,pdf,exe,msi,jar,zip," +
"rar,tar,gz,conf,sql,sh,bat,log,out,ico,rpm,deb,dmg,avi,m3u8,ts"; "rar,tar,gz,conf,sql,sh,bat,log,out,ico,rpm,deb,dmg,avi,m3u8,ts,js,css,html,vsdx,dmp,7z," +
"ppt,pptx";
let upload = new axUpload('#upload', { let upload = new axUpload('#upload', {
type: 'gallery', type: 'gallery',
url: 'execute', url: 'execute',

View File

@@ -1,11 +1,19 @@
> v1.0.0 > v1.0.0
``` ```
使用SpringBoot3.1.1 + Jdk17搭建项目 使用SpringBoot3.1.1 + Jdk17搭建项目
集成AXUIv2.0.14实现文件上传、文件下载 集成AxUIv2.0.14实现文件上传、文件下载
集成RocksDBv8.3.2使用RocksDB做嵌入式缓存中间件 集成RocksDBv8.3.2使用RocksDB做嵌入式缓存中间件
``` ```
> v1.1.0 > v1.1.0
``` ```
配置logback-spring.xml日志输出到控制台和文件 配置logback-spring.xml日志输出到控制台和文件
集成WebSocket解析日志文件实现实时在线日志查看 集成WebSocket解析日志文件实现实时在线日志查看
```
> v1.2.0
```
AxUI从v2.0.14升级到v2.1.1
使用Promise封装XMLHttpRequest做异步请求
修改日志文件生成及读取位置
上传文件格式新增支持js、css、html、vsdx、dmp、7z、ppt、pptx
AxUI的axAjax方法timeout默认值改为6000000
``` ```