/**
 * [OElove] (C)2010-2099 oelove.com biz
 * Email: service@phpcoo.com ,phpcoo@qq.com
 * This is NOT a freeware, use is subject to license terms
 * $ Last update 2020/11/11 by BO $
*/
$(function(){
    function Visit () {
        this.del();
    }
    Visit.prototype = {
        del: function () {
            $('[f="but_del"]').on('click', function () {
                var id = $(this).attr("data-id");

                OEUI.modal.info({
                    title: '温馨提示',
                    text: '确定要删除吗？',
                    confirm: function () {
                        $.ajax({
                            type: "POST",
                            url: _OE_FILE + "&c=visit",
                            data: {
                                a:"del", id: id, datatype:"json"
                            },
                            success: function(json) {
                                var res = JSON.parse(json);
                                if (res.response == "1") {
                                    OEUI.message.msg({text: '删除成功'});
                                    setTimeout(function() {
                                        location.reload();
                                    }, 800);
                                }
                                else {
                                    if (res.result.length > 0) {
                                        OEUI.message.msg({text: res.result});
                                    }
                                    else {
                                        OEUI.message.msg({text: '网络繁忙，请稍后再试'});
                                    }
                                }
                            },
                            error: function() {
                                OEUI.message.msg("网络繁忙，请稍后再试");
                            }
                        });  
                    }
                });
            });
        }
    }
    new Visit();
});