$(function () {
FastClick.attach(document.body);
var ApplyList = function () {
RoomList.apply(this,arguments);
this.droploadCallback = function(res){
var applyList = JSON.parse(res);
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: "ajax_room_apply"},"#apply_list","#load_state",true);
apply_list.init();
var ApplyHTML = function () {
RoomListHTML.apply(this,arguments);
this.appendHTML = function (id) {
var html = "";
for (var i = 0; i < this.listDatas.length; i++) {
if (this.listDatas[i].step == 1 || this.listDatas[i].step == 2) {
if (this.listDatas[i].step == 1) {
html += "
\n" +
"
\n" +
"

\n" +
"
\n" +
"
\n" +
"
" + this.listDatas[i].nickname + "
\n" +
"
" + this.listDatas[i].msg + "
\n" +
"
\n" +
"
\n" +
" 已接受\n" +
"
\n" +
"
"
}
else {
html += "\n" +
"
\n" +
"

\n" +
"
\n" +
"
\n" +
"
"+ this.listDatas[i].nickname +"
\n" +
"
"+this.listDatas[i].msg+"
\n" +
"
\n" +
"
\n" +
" 已拒绝\n" +
"
\n" +
"
"
}
}
else {
html += "\n" +
"
\n" +
"

\n" +
"
\n" +
"
\n" +
"
" + this.listDatas[i].nickname + "
\n" +
"
" + this.listDatas[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);
})
});
});