From ad149b09268c33d2dd5a78429012a0b5fdec799e Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Thu, 30 Jun 2022 17:10:08 +0800 Subject: [PATCH] 优化图片上传地址,允许在外层指定服务器域名 --- common/Tools.js | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/common/Tools.js b/common/Tools.js index 7a9af98..2f36e53 100644 --- a/common/Tools.js +++ b/common/Tools.js @@ -70,6 +70,22 @@ } /** + * 获取随机字符串 + * @param {number} long + * @return {string} + */ + static getRandomString(long) { + long = long || 32; + const template = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; + const count = template.length; + let result = ''; + for (let i = 0; i < long; i++) { + result += template.charAt(Math.floor(Math.random() * count)); + } + return result; + } + + /** * 检查网络状态 */ static checkOnlineState(callback) { -- Gitblit v1.9.1