123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
-
- Namespace.register("U.F.M");
- U.F.M.CreateFriendGroupPopup = function () {
- var _tempel,
- _temponeel,
- _temptwoel;
-
- _tempel = $$("div", { "className": "UD_SYSSZS UD_SYATNL UD_SYSOU" });
- _temponeel = $$("div", {}, _tempel)
- _temptwoel = $$("input", { "value": "请输入你要创建的群名", "onfocus": [[U.MR.InputTip, ["this", ['请输入你要创建的群名', ""]]]], "onblur": [[U.MR.InputTip, ["this", "", '请输入你要创建的群名']]] }, _temponeel);
-
- U.UI.Confirm("创建好友分组", { "width": "300px", "height": "140px" }, null, U.M.apply(null, [[U.F.M.CreateFriendGroup, [_temptwoel]]]), _tempel, $("#UD_SY")[0]);
- }
- U.F.M.CreateFriendGroup = function (inputel) {
- var _value = inputel.value,
- _groupid = Guid.newGuid();
-
- if (_value.length > 20) {
- U.Alert("分组名不可超过20个字符");
- }
-
- else if (_value.isStrNull() && _value != inputel.defaultValue) {
- U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "CreateFriendClass", Guid.newGuid(), US.userInfo.userid,
- _value, ""]), U.F.M.AsynCreateFriendGroup, ["", _value, _groupid];
- }
-
- else {
- U.Alert("请输入正确的群名");
- }
- }
- U.F.M.AsynCreateFriendGroup = function (r) {
- var _groupinfo,
- context = r.context;
- r = r.value;
- _groupinfo = new U.F.T.FriendGroupEntity(context[2], context[1], "");
-
- US.Friend[0].unshift(_groupinfo);
-
- $($("#UD_SYHZLTA").Child()[0]).Child()[0].onclick();
-
- U.Alert("创建" + context[1] + "分组成功");
- }
- U.F.M.DeleteFriend = function (friendinfo) {
-
- U.A.Request(US.Auth, ["DeleteFriend", US.userInfo.userid, friendinfo.FriendsID, friendinfo.UserId],
- U.F.M.AsynDeleteFriend, ["", friendinfo]);
- }
- U.F.M.AsynDeleteFriend = function (r) {
- var _friendel,
- _context = r.content,
- _friendinfo = _context[1],
- _friendclassinfo = _$(US.Friend[0]).Select({ "FriendsGroupID": friendinfo.FriendsGroupID })[0],
- _friendclassuserinfo = _$(US.Friend[1]).Select({ "FriendsGroupID": friendinfo.FriendsGroupID }),
- _el = $("div@TID=" + friendinfo.UserId, $("#UD_SYHZLZ")[0]),
- _switchbootom = $("#UD_SYHZLTA").Child();
- _$(US.Friend[1]).Delete({ "FriendsID": friendinfo.FriendsID });
-
- if ($(_switchbootom[0]).Child()[0].className.indexOf("UD_SYHZLTO") > -1) {
-
- _friendel = _el.Parent();
- _friendel.removeChild(_el);
-
- $("div", _friendel.parentNode)[0].innerHTML = _friendclassinfo.FriendsGroupName + "(" + (_friendgroupinfo.length) + ")";
-
- if (US.Friend[0].length == 1 && !_friendgroupinfo.length) {
- U.F.PrintHasNoFriend(_friendel);
- }
- }
- }
- U.F.M.AddFriend = function (userinfo, cb, typename) {
- if (!U.U.L.isLogin(3)) {
- typename = typename || "1";
-
- if (userInfo.userid != US.userInfo.userid) {
-
- var _friendinfo = _$(US.Friend[1]).Select({ "UserId": userInfo.userid })[0];
-
- if (!_friendinfo) {
- U.F.M.AddFriendForm(userinfo, cb, typename);
- }
-
- else {
- U.F.W.PopupFriendsForm(_friendinfo);
- }
- }
- }
- else { U.Alert("快速登录关注他(她)吧"); }
- }
- U.F.M.AddFriendForm = function (userinfo, cb, typename) {
- var i,
- _formel,
- _tempel,
- _temponeel,
- _temptwoel,
- _tempthreeel,
- _tempfourel,
- _friendgroupinfo = US.Friend[0];
-
- _tempel = $$("div", { "className": "UD_SYUIAC" });
- _temponeel = $$("div", { "className": "UD_SYUIACA" }, _tempel);
- _temptwoel = $$("div", { "className": "UD_SYUIACL" }, _temponeel);
- _tempthreeel = $$("div", { "className": "UD_SYUIACLT" }, _temptwoel);
- $$("img", { "onerror": U.M.ImgError, "title": "点击查看", "src": U.M.GetImgU(userinfo.UserThumbnailImageHead) }, _tempthreeel);
- _tempthreeel = $$("div", { "className": "UD_SYUIACLB" }, _temptwoel);
- $$("div", { "className": "UTDF", "innerHTML": userinfo.UserNickName || userinfo.UserName }, _tempthreeel);
- $$("div", { "className": "UTDF", "innerHTML": "性别:" + (userinfo.UserSex ? "男" : "女") }, _tempthreeel);
- $$("div", { "className": "UTDF", "innerHTML": "年龄:" + (U.MT.getYearMonthDay()[0] - U.MT.getYearMonthDay(userinfo.Birthday)[0]) }, _tempthreeel);
- _temptwoel = $$("div", { "className": "UD_SYUIACR" }, _temponeel);
- _tempthreeel = $$("div", { "className": "UD_SYUIACRT" }, _temptwoel);
- $$("div", { "className": "UD_SYUIACRTL", "innerHTML": "备注姓名:" }, _tempthreeel);
- _tempthreeel = $$("div", { "className": "UD_SYUIACRTR" }, _tempthreeel);
- $$("input", { "value": userinfo.UserNickName || userinfo.UserName }, _tempthreeel);
- _tempthreeel = $$("div", { "className": "UD_SYUIACRB" }, _temptwoel);
- $$("div", { "className": "UD_SYUIACRBL", "innerHTML": "分       组:" }, _tempthreeel);
- _tempthreeel = $$("div", { "className": "UD_SYUIACRBR" }, _tempthreeel);
- _tempfourel = $$("select", {}, _tempthreeel);
-
- _tempfourel.options.length = _friendgroupinfo.length;
- for (i = 0; i < _friendgroupinfo.length; i++) {
- _tempfourel.options[i].text = _friendgroupinfo[i].FriendsGroupName;
- }
-
- _formel = U.UI.Confirm("是否添加好友", { "width": "450px", "height": "370px" }, null,
- [U.M.apply(null, [[U.F.M.AddFriendToDb, [userinfo, cb, _tempfourel, _temponeel, typename]]])], _tempel);
- return _formel;
- }
- U.F.M.AddFriendToDb = function (userinfo, cb, selectel, loadingel, typename) {
- var _friendgroupinfo = US.Friend[0][selectel.selectedIndex],
- _groupid = _friendgroupinfo.FriendsGroupID,
- _friendid = Guid.newGuid();
-
-
- if (typename == "0") {
- U.A.Request(US.Auth, ["AgreeAddFriend", userInfo.userid, _friendid, _groupid, (userinfo.UserNickName || userinfo.UserName), userinfo.MessageContent.toUpperCase()]),
- U.F.M.AsynAddFriendToDb, [loadingel, _groupid, userinfo, _friendgroupinfo, cb, _friendid];
- }
-
- else {
- U.A.Request(US.Auth, ["AddFriend", userInfo.userid, _friendid, _groupid, (userinfo.UserNickName || userinfo.UserName)]),
- U.F.M.AsynAddFriendToDb, [loadingel, _groupid, userinfo, _friendgroupinfo, cb, _friendid];
- }
-
- U.Alert("正在添加中...");
- return false;
- }
- U.F.M.AsynAddFriendToDb = function (r) {
- var context = r.context,
- _loadingel = context[0],
- _groupid = context[1],
- _userinfo = context[2],
- _friendgroupinfo = context[3],
- _cb = context[4],
- _friendid = context[5];
- r = r.value;
-
- if (r) {
-
- U.F.M.DisplayAddFriend(_userinfo, _friendid, _groupid, _friendgroupinfo, r);
-
- if (_cb) {
- _cb();
- }
- }
-
- else {
- U.Alert("您的请求已经发送,请等待对方的同意。");
- }
-
- $(_loadingel).Parent({ usform: "true" }).remove();
- }
- U.F.M.DisplayAddFriend = function (userinfo, friendid, classid, friendgroupinfo, r) {
- var _childs,
- _groupel,
-
- _friendinfo = new U.F.T.FriendEntity(userinfo.UserIndividualitysignature, userInfo.userid, userinfo.UserImageHead,
- userinfo.UserThumbnailImageHead, userinfo.UserNickName || userinfo.UserName,
- userinfo.UserName, friendid, userinfo.UserNickName || userinfo.UserName, classid, 0);
- _friendinfo["IsLogin"] = r[1] == "True" ? 1 : 0;
- US.Friend[1].unshift(_friendinfo);
-
- _groupel = $("div@TID=" + classid, $("#UD_SYHZLZ")[0]);
- if (_groupel[0]) {
- _childs = $(_groupel).Child();
-
- if (US.Friend[1].length == 1) {
- $("#UD_SYHZR")[0].innerText = "";
- };
-
- U.F.PrintFriendOrGroup(_childs[1], [_friendinfo], true);
-
- _childs[0].innerText = friendgroupinfo["FriendsGroupName"] + "(" + (_$(US.Friend[1]).Select({ "FriendsGroupID": classid }).length) + ")";
- };
-
- U.F.W.PopupFriendsForm(_friendinfo);
-
- if (!US.Friend[4].length) {
- U.F.PrintRightFormFriend(US.Friend[1], $("#UD_SYHRC")[0]);
- }
- }
|