Ver Fonte

复制有滚动 上传license 文件名称固定

pengshengdong há 9 meses atrás
pai
commit
27974cc6b8

+ 1 - 1
dbsyncer-web/src/main/java/org/dbsyncer/web/controller/license/LicenseController.java

@@ -44,7 +44,7 @@ public class LicenseController {
     public RestResult upload(MultipartFile[] files) {
         try {
             if (files != null && files[0] != null) {
-                String filename = files[0].getOriginalFilename();
+                String filename = "license";
                 File dest = new File(licenseService.getLicensePath() + filename);
                 FileUtils.deleteQuietly(dest);
                 FileUtils.copyInputStreamToFile(files[0].getInputStream(), dest);

+ 6 - 3
dbsyncer-web/src/main/resources/static/js/license/license.js

@@ -31,20 +31,23 @@ $(function () {
     document.getElementById("copyBtn").addEventListener('click', async event => {
         //Get the copied text
         const text = document.getElementById("licenseKey").value;
-        fallbackCopyTextToClipboard(text);
+        fallbackCopyTextToClipboard(text)
     });
 
+
     // 旧浏览器的回退方案
     function fallbackCopyTextToClipboard(text) {
         var textArea = document.createElement("textarea");
         textArea.value = text;
+        textArea.style.height='0px';
         document.body.appendChild(textArea);
         textArea.focus();
         textArea.select();
         try {
             var successful = document.execCommand('copy');
-            var msg = successful ? '成功' : '失败';
-            console.log('复制' + msg);
+            if (successful) {
+                bootGrowl("复制机器码成功11!", "success");
+            }
         } catch (err) {
             console.error('复制失败', err);
         }