var _user_select_dlg_div;
function user_select_dlg_init(div) {
_user_select_dlg_div = div;
let html = "";
html += "
";
html += "
";
html += "
" + gLocal.gui.nick_name + "/" + gLocal.gui.group + "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "";
html += "
";
html += "
";
html += "
";
$("#" + div).append(html);
}
function user_select_dlg_show() {
$("#" + _user_select_dlg_div).show();
}
function user_select_dlg_hide() {
$("#" + _user_select_dlg_div).hide();
}
function user_select_cancel() {
user_select_dlg_hide();
$("#user_select_title").val("");
}
function username_search_keyup(e, obj) {
var keynum;
if (window.event) {
// IE
keynum = e.keyCode;
} else if (e.which) {
// Netscape/Firefox/Opera
keynum = e.which;
}
var keychar = String.fromCharCode(keynum);
if (keynum == 13) {
//dict_search(obj.value);
} else {
username_search(obj.value, 1);
}
}
function username_search(keyword, type) {
//let obj = document.querySelector("#cooperator_type_user");
if (type == 1) {
$.get(
"../ucenter/get.php",
{
username: keyword,
},
function (data, status) {
let result;
try {
result = JSON.parse(data);
} catch (error) {
console(error);
}
let html = "";
$("#user_list").html(html);
}
);
} else {
$.get(
"../group/get_name.php",
{
name: keyword,
},
function (data, status) {
let result;
try {
result = JSON.parse(data);
} catch (error) {
console(error);
}
let html = "";
$("#search_result").html(html);
}
);
}
}
function user_selected(id) {
$.post(
"../group/member_put.php",
{
userid: id,
groupid: gGroupId,
},
function (data) {
let error = JSON.parse(data);
if (error.status == 0) {
alert("ok");
user_select_cancel();
location.reload();
} else {
alert(error.message);
}
}
);
}
function user_select_new() {
$.post(
"../group/my_group_put.php",
{
name: $("#user_select_title").val(),
parent: parentid,
},
function (data) {
let error = JSON.parse(data);
if (error.status == 0) {
alert("ok");
user_select_cancel();
location.reload();
} else {
alert(error.message);
}
}
);
}