function dateFormat(time) {
    if (time.indexOf('T') != -1) {
        time += ':00'
        time = time.replace('T', ' ')
    }
    return time;
}

function conertToHtmlDate(time) {
    return time.substring(0, 16)
}

function getDate(time) {
    return time.substring(0, 10)
}

function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}

function parseUserRole(role) {
    switch (role) {
        case 1:
            return "发布者"
        case 2:
            return "管理员"
    }
    return ""
}

function parseExStyle(style) {
    switch (style) {
        case 1:
            return "现代"
        case 2:
            return "古代"
    }
    return ""
}

function parseExClassification(classification) {
    switch (classification) {
        case 1:
            return "戏剧家协会"
        case 2:
            return "影视家协会"
        case 3:
            return "音乐家协会"
        case 4:
            return "美术家协会"
        case 5:
            return "曲艺家协会"
        case 6:
            return "舞蹈家协会"
        case 7:
            return "民间文艺家协会"
        case 8:
            return "摄影家协会"
        case 9:
            return "书法家协会"
        case 10:
            return "文艺评论家协会"
        case 11:
            return "志愿者协会"
        case 12:
            return "企业（行业）文联"
        case 13:
            return "杂技家协会"
    }
    return ""
}

function checkVisibleState(state) {
    if (!state) {
        return "hidden"
    }
    return ""
}

//验证是否为数字
function isNumber(value) {
    var patrn = /^(-)?\d+(\.\d+)?$/;
    if (patrn.exec(value) == null || value == "") {
        return false
    } else {
        return true
    }
}

// 判断图片
function isImage(file) {
    let lf = file.toLowerCase()
    return lf.endsWith(".png") || lf.endsWith(".jpg") || lf.endsWith(".jpeg")
}
// 判断视频
function isVideo(file) {
    return file.toLowerCase().endsWith(".mp4")
}
// 判断音频
function isAudio(file) {
    let lf = file.toLowerCase()
    return lf.endsWith(".mp3") || lf.endsWith("ogg")
}

// select标签option选中状态
function selectState(a, b) {
    if (a == b) {
        return "selected"
    }
    return ""
}

// checkbox选中状态
function checkedState(checked) {
    if (checked) {
        return "checked"
    }
    return ""
}