WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2022-04-14 b22223dd84a729174a5973971c08cc48d039bd1d
强化日期格式化识别能力,优化开关组件显示
2 files modified
21 ■■■■■ changed files
common/Tools.js 19 ●●●●● patch | view | raw | blame | history
forms/switch/cSwitch.scss 2 ●●● patch | view | raw | blame | history
common/Tools.js
@@ -345,7 +345,16 @@
        if (Tools.isString(timestamp)) {
            // 全数值
            if (/^\d+$/.test(timestamp)) {
                // 8位视为无连接符日期
                if (timestamp.length === 8) {
                    const day = timestamp.substr(0, 4) + '-' +
                        timestamp.substr(4, 2) + '-' + timestamp.substr(6, 2);
                    timestamp = (new Date(timestamp)).getTime();
                }
                // 超过8位,视为时间戳
                else if (timestamp.length > 8) {
                timestamp = parseInt(timestamp);
                }
            }
            // 日期
            else {
@@ -355,7 +364,15 @@
                }
            }
        }
        if (timestamp < 9 * 10e8) {
        // 转为数值的无连接符日期
        if (timestamp < 9 * 10e6) {
            const timeStr = timestamp + '';
            const day = timeStr.substr(0, 4) + '-' +
                timeStr.substr(4, 2) + '-' + timeStr.substr(6, 2);
            timestamp = (new Date(day)).getTime();
        }
        // 按秒时间戳
        else if (timestamp < 9 * 10e8) {
            timestamp *= 1000;
        }
        const curMoment = moment(timestamp);
forms/switch/cSwitch.scss
@@ -76,7 +76,7 @@
    }
    &.c-switch-radio-left {
        .c-switch-radio-group {
            width: 538px;
            width: calc(100% - 214px);
            padding-right: 0;
            .c-switch-radio-item {
                padding-left: 0;