WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2022-06-30 1759050be9578fb3e376f156a3ace42fa4250193
common/Tools.js
@@ -12,12 +12,13 @@
     * 显示消息
     * @param msg
     * @param [duration=2000]
     * @param [mask=false]
     */
    static toast(msg, duration = 2000) {
    static toast(msg, duration = 2000, mask = false) {
        Taro.showToast({
            title: msg,
            icon: 'none',
            mask: true,
            mask,
            duration,
        });
    }
@@ -69,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) {