function showModal_nocancel(msg){
    my.confirm({
      title: '提示', //提示的标题,
      content: msg, //提示的内容,
      showCancel: false, //是否显示取消按钮,
      cancelButtonText: '取消', //取消按钮的文字,默认为取消,最多 4 个字符,
      cancelColor: '#000000', //取消按钮的文字颜色,
      confirmButtonText: '知道了', //确定按钮的文字,默认为取消,最多 4 个字符,
      confirmColor: '#3CC51F', //确定按钮的文字颜色,
    });
}
function showModal(msg,success_callback,error_callback){
   my.confirm({
     title: '提示', //提示的标题,
     content: msg, //提示的内容,
     cancelButtonText: '取消', //取消按钮的文字,默认为取消,最多 4 个字符,
     cancelColor: '#000000', //取消按钮的文字颜色,
     confirmButtonText: '确定', //确定按钮的文字,默认为取消,最多 4 个字符,
     confirmColor: '#3CC51F', //确定按钮的文字颜色,
     success: res => {
       success_callback()
     },
     fail: res=>{
         error_callback()
     }
   });
}
function formatTime(date,fmt="YY-mm-dd HH:MM:SS"){
    let ret;
    const opt = {
        "Y+": date.getFullYear().toString(),        // 年
        "m+": (date.getMonth() + 1).toString(),     // 月
        "d+": date.getDate().toString(),            // 日
        "H+": date.getHours().toString(),           // 时
        "M+": date.getMinutes().toString(),         // 分
        "S+": date.getSeconds().toString()          // 秒
        // 有其他格式化字符需求可以继续添加,必须转化成字符串
    };
    for (let k in opt) {
        ret = new RegExp("(" + k + ")").exec(fmt);
        if (ret) {
            fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
        };
    };
    return fmt;
}



module.exports = {
    showModal_nocancel: showModal_nocancel,
    showModal: showModal,
    formatTime: formatTime
}