$(function () { FastClick.attach(document.body); var ApplyList = function () { RoomList.apply(this,arguments); this.droploadCallback = function(res) { var applyList = JSON.parse(res); console.log(applyList); if (applyList.code != 200) { $.alert(applyList.message); return; } var applyHTML = new ApplyHTML(applyList.datas.applys); applyHTML.appendHTML(this.append_el); if (applyList.datas.mobile_page.hasmore) { this.curpage = applyList.datas.mobile_page.curpage+1; this.hasmore = true; applyHTML.loadHTML(this.load_state_el); } else { $(window).off('scroll'); this.hasmore = false; applyHTML.endHTML(this.load_state_el); } }; }; var apply_list = new ApplyList({act:'member_talk',op: api_op},"#apply_list","#load_state",true); apply_list.init(); var ApplyHTML = function () { RoomListHTML.apply(this,arguments); this.appendHTML = function (id) { console.log(this); var html = ""; for (var i = 0; i < this.useObj.length; i++) { if (this.useObj[i].step == 1 || this.useObj[i].step == 2) { if (this.useObj[i].step == 1) { html += "
\n" + "
\n" + " \n" + "
\n" + "
\n" + "

" + this.useObj[i].nickname + "

\n" + "

" + this.useObj[i].msg + "

\n" + "
\n" + "
\n" + " 已接受\n" + "
\n" + "
" } else { html += "
\n" + "
\n" + " \n" + "
\n" + "
\n" + "

"+ this.useObj[i].nickname +"

\n" + "

"+this.useObj[i].msg+"

\n" + "
\n" + "
\n" + " 已拒绝\n" + "
\n" + "
" } } else { html += "
\n" + "
\n" + " \n" + "
\n" + "
\n" + "

" + this.useObj[i].nickname + "

\n" + "

" + this.useObj[i].msg + "

\n" + "
\n" + "
\n" + "
\n" + " 拒绝\n" + " 同意\n" + "
\n" + "
\n" + "
" } } $(id).append(html); } }; $(document).on('click','.refusal_btn',function(){ var apply_id = $(this).attr('data-apply-id'); console.log(apply_id); $.showLoading(); var _self = $(this); $.get("/mobile/index.php", { act: "member_talk", op: "pass_apply", apply_id: apply_id, step:2, client_type: "ajax", }, function (res) { $.hideLoading(); var data = JSON.parse(res); if (data.code != 200) { $.alert(data.message); return; } _self.parent().parent().append("
已拒绝
"); _self.parent().remove(); $.toast('操作成功',1000); }) }); $(document).on('click','.agree_btn',function(){ var apply_id = $(this).attr('data-apply-id'); console.log(apply_id); $.showLoading(); var _self = $(this); $.get("/mobile/index.php", { act: "member_talk", op: "pass_apply", apply_id: apply_id, step:1, client_type: "ajax", }, function (res) { $.hideLoading(); var data = JSON.parse(res); if (data.code != 200) { $.alert(data.message); return; } _self.parent().parent().append("
已接受
"); _self.parent().remove(); $.toast('操作成功',1000); }) }); $(document).on('click','.applys-item',function(){ var msg_id = $(this).attr('data-applys-id'); window.location.href = "/mobile/index.php?act=user_index&op=friend_apply&msg_id="+msg_id; }); });