From 1c6bbcd09235162d6a987c5a9a71c1e8648b4ed4 Mon Sep 17 00:00:00 2001
From: wanggeng <450292408@qq.com>
Date: Thu, 5 May 2022 17:42:33 +0800
Subject: [PATCH] =?UTF-8?q?common.js=E5=A2=9E=E5=8A=A0img=E8=BD=ACbase64?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 +-
src/main/resources/application-dev.yml | 2 +-
.../assets/layuiadmin/modules/common.js | 20 ++++++++++++++++++-
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 225a8dc..efba1a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
1.8
2.1.4
- 8.0.22
+ 8.0.27
1.1.9
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 856a2d5..fbfab6f 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -27,7 +27,7 @@ spring:
max-request-size: 1GB
datasource:
druid:
- url: jdbc:mysql://192.168.0.103:3306/db_smart_city_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true
+ url: jdbc:mysql://192.168.0.151:3306/db_smart_city_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true
db-type: mysql
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
diff --git a/src/main/resources/static/assets/layuiadmin/modules/common.js b/src/main/resources/static/assets/layuiadmin/modules/common.js
index e9aebb0..2aace98 100644
--- a/src/main/resources/static/assets/layuiadmin/modules/common.js
+++ b/src/main/resources/static/assets/layuiadmin/modules/common.js
@@ -240,6 +240,23 @@ layui.define(function (exports) {
return exportColumns;
}
+ function getImgBase64(url, callback) {
+ var Img = new Image(),
+ dataURL = '';
+ Img.src = url + '?v=' + Math.random();
+ Img.setAttribute('crossOrigin', 'Anonymous');
+ Img.onload = function() {
+ var canvas = document.createElement('canvas'),
+ width = Img.width,
+ height = Img.height;
+ canvas.width = width;
+ canvas.height = height;
+ canvas.getContext('2d').drawImage(Img, 0, 0, width, height);
+ dataURL = canvas.toDataURL('image/jpeg');
+ return callback ? callback(dataURL) : null;
+ };
+ }
+
//对外暴露的接口
exports('common', {
refreshTree: refreshTree,
@@ -248,6 +265,7 @@ layui.define(function (exports) {
formatDate: formatDate,
getBrowserType: getBrowserType,
getIEBrowserVersion: getIEBrowserVersion,
- listTableExportColumns: listTableExportColumns
+ listTableExportColumns: listTableExportColumns,
+ getImgBase64: getImgBase64
});
});
\ No newline at end of file