1. 程式人生 > >微信中獲取部門成員資訊

微信中獲取部門成員資訊

//QY  根據部門Id獲取使用者列表資訊
function GetMemberInfo(url,id,where) {
    $.ajax({
        url: url,
        async:false,
        data: {'id':id},
        type: 'post',
        dataType: 'json',
        success: function (result) {
            result = result.userlist;
            //alert(result.userlist.length);
            //alert(de[2].id);
            //  $('body').append('<div class="weui_cells_title">複選列表項</div>');
            for (var i = 0; i < result.length; i++) {

                var img = result[i].avatar;
                if (img != null) {
                    img+='64';
                } //將最後的/0 改成/64
                //var str = img[img.length];
                //var im = String.replace(str, '64');
                var name = result[i].name;
                var r = where;
                //這裡注意input和i 不需要空格
                var item = '<div class="weui_cells weui_cells_checkbox">'+'<br>'
                    +'<label class="weui_cell weui_check_label" for="' +'s'+i+ '">' + '<br>'
                    + '<div class="weui_cell_hd">' + '<br>'
                    + '<input type="checkbox" class="weui_check" name="checkbox1" id="' + 's'+i+'" checked="checked">'
                    + '<i class="weui_icon_checked"></i>'+ '</div>'
                    + '<div class="weui_cell_bd weui_cell_primary">' + '<br>'
                    + '<img src="'+img+'" alt="圖片" id="showImg"/>'+' '
                    + '<label id="showName">' + name + '</label>' + '</div>' + '<br>'
                    + '</label>'+'<br>'+'</div>';
                $(where).append(item);
            }
        },
        error: function (error) {
            log(error);
        }
    });
}