1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
| //监听 资料变化(自己或好友) 系统通知
| /*notify对数示例:
| {
| "Type":1,//子通知类型
| "Profile_Account": "Jim",//用户帐号
| "ProfileList": [
| {
| "Tag": "Tag_Profile_IM_Nick",//昵称
| "ValueBytes": "吉姆"
| },
| {
| "Tag": "Tag_Profile_IM_Gender",//性别
| "ValueBytes": "Gender_Type_Male"
| },
| {
| "Tag": "Tag_Profile_IM_AllowType",//加好友认证方式
| "ValueBytes": "AllowType_Type_NeedConfirm"
| },
| {
| "Tag": "Tag_Profile_IM_Image",//用户头像
| "ValueBytes": "img/image.png"
| }
| ]
| }
| */
|
| function onProfileModifyNotify(notify) {
| webim.Log.info("执行 资料修改 回调:" + JSON.stringify(notify));
| var typeCh = "[资料修改]";
| var profile, account, nick, sex, allowType, content;
| account = notify.Profile_Account;
| content = "帐号:" + account + ", ";
| for (var i in notify.ProfileList) {
| profile = notify.ProfileList[i];
| switch (profile.Tag) {
| case 'Tag_Profile_IM_Nick':
| nick = profile.ValueBytes;
| break;
| case 'Tag_Profile_IM_Gender':
| sex = profile.ValueBytes;
| break;
| case 'Tag_Profile_IM_AllowType':
| allowType = profile.ValueBytes;
| break;
| case 'Tag_Profile_IM_Image':
| image = profile.ValueBytes;
| break;
| default:
| webim.log.error('未知资料字段:' + JSON.stringify(profile));
| break;
| }
| }
| content += "最新资料:【昵称】:" + nick + ",【性别】:" + sex + ",【加好友方式】:" + allowType + ",【修改头像】:" + image;
| addProfileSystemMsg(notify.Type, typeCh, content);
|
| if (account != loginInfo.identifier) { //如果是好友资料更新
| //好友资料发生变化,需要重新加载好友列表或者单独更新account的资料信息
| //getAllFriend(getAllFriendsCallbackOK);
| if (account && nick) {
| updateSessNameDiv(webim.SESSION_TYPE.C2C, account, nick); //更新最近聊天会话中的好友昵称
| }
|
| }
| }
|
|
| //初始化我的资料系统消息表格
|
| function initGetMyProfileSystemMsgs(data) {
| $('#get_my_profile_system_msgs_table').bootstrapTable({
| method: 'get',
| cache: false,
| height: 500,
| striped: true,
| pagination: true,
| pageSize: pageSize,
| pageNumber: 1,
| pageList: [10, 20, 50, 100],
| search: true,
| showColumns: true,
| clickToSelect: true,
| columns: [{
| field: "Type",
| title: "类型",
| align: "center",
| valign: "middle",
| sortable: "false",
| visible: false
| }, {
| field: "TypeCh",
| title: "类型",
| align: "center",
| valign: "middle",
| sortable: "true"
| }, {
| field: "MsgContent",
| title: "内容",
| align: "center",
| valign: "middle",
| sortable: "true"
| }],
| data: data,
| formatNoMatches: function() {
| return '无符合条件的记录';
| }
| });
| }
|
| //查看我的资料系统消息
|
| function getMyProfileSystemMsgs() {
| $('#get_my_profile_system_msgs_dialog').modal('show');
| }
|
| //增加一条资料系统消息
|
| function addProfileSystemMsg(type, typeCh, msgContent) {
| var data = [];
| data.push({
| "Type": type,
| "TypeCh": typeCh,
| "MsgContent": webim.Tool.formatText2Html(msgContent)
| });
| $('#get_my_profile_system_msgs_table').bootstrapTable('append', data);
| }
|
|