mess_admin.js 2.44 KB
/**
 * Created by Dell on 2018/9/5.
 */

/**
 * 删除留言 ajax实现
 * @param mid:留言ID
 * @returns {boolean}
 */
function jumpDel(mid)
{
    var delCon = confirm("确认删除该条留言?");
    if (delCon === false) {
        return false;
    }
    $.ajax({
        url:'http://lys.com/wx5019b9c455ea9c81/Message/Apicp/Message/MessDel/Del/',
        type:'post',
        data:{
            'mid':mid
        },
        dataType:'json',
        success:function(data){
            if (data['result'] == 1) {
                alert("删除成功。");
                console.log(data);
                window.location.href = './list.php';
            } else {
                alert("删除失败。");
                console.log('error:'+data);
                return false;
            }

        },
        error:function(e){
            alert("ajax调用失败。");
            console.log("error:"+e);
        }
    });
}

/**
 * 留言审核 ajax实现
 * @param mid:留言ID
 * @returns {boolean}
 */
function jumdAudit(mid)
{

    var status = 0;

    if ($('#audit_2').prop('checked') != false) {
        var reason = $('#reason').val();
        if ( reason == '') {
            alert('请填写驳回原因。');
            return false;
        }
        status = $('#audit_2').val();
    }
    if ($('#audit_3').prop('checked') != false ) {
        status = $('#audit_3').val();
    }
    if(status === 0){
        alert('请选择是否通过审核。');
        return false;
    }

    $.ajax({
        url:'http://lys.com/wx5019b9c455ea9c81/Message/Apicp/Message/MessAudit/Audit/',
        type:'post',
        dataType:'json',
        data:{
            'mid':mid,
            'status':status,
            'reason':reason
        },
        success:function(data){
            if(data['result'] == 1){
                console.log(data);
                alert('提交成功。');
                window.location.href = './list.php';
                return false;
            }else{
                alert('审核失败。');
                console.log(data);
            }
        },
        error:function(e){
            alert('ajax调用失败。');
            console.log('error:'+e);
        }
    });
}

/**
 * 重置时 清空条件,再次提交
 * @returns {boolean}
 */
function jumpCleanAll(){
    $('#name').val('');
    $('#sex').val('');
    $('#tel').val('');
    $('#mail').val('');
    $('#title').val('');
    $('#frm_search').submit();
    return false;
}