/* 好友初始化区域 此文件为好友窗体使用初始化窗体 */ Namespace.register("U.MD.F.W"); //好友和群窗口区域命名空间 //#region 好友聊天 /** * 弹出好友窗体处理 * * @param {object} 群信息 */ U.MD.F.W.viewFriend = U.MD.F.W.SLHCK = function (friendinfo) { //使用好友系统必须登录 if (!(U.MD.U.L.isLogin())) { var _childs, //所有的好友元素 _friendel; //好友的信息元素 //如果有传入好友的信息,则查看指定的好友的信息,否则弹出默认的好友窗体 if (friendinfo) { //如果用户是和自己聊天,那么直接提示不允许,否则弹出好友聊天框 if (friendinfo.UserId == US.userInfo.userid) { U.alert("无法与本人聊天!"); } else { //获取制定好友的点击元素 _friendel = $("#U_MD_F_H_RCO").find("[tid=" + friendinfo.UserId + "]")[0]; //如果查看的好友在好友列表里 if (_friendel) { _friendel.onclick(); } //弹出好有窗体 else { U.MD.F.W.popupFriendsForm(friendinfo); } } } //弹出默认的好友窗体 else { _childs = $("#U_MD_F_H_RCO").Child(); //右侧栏 friendinfo = (US.friend.recentcontacts[0] || US.friend.friends[0]); //最近联系人、 我的好友列表 //如果有显示的好友,则弹出第一个好友聊天 if (_childs.length) { _childs[0].onclick(); } //查看好友 else { //这里判断如果弹出的是群聊天框,则选择群信息,需要修改 if (friendinfo && friendinfo.tf) { friendinfo = U.Json.select(US.friend.group, { "GroupManageID": friendinfo.UserId })[0]; } //弹出好友信息 U.MD.F.W.popupFriendsForm(friendinfo); //如果用户没有好友和群,那么则直接弹出推荐好友 if (!friendinfo || (!friendinfo.UserId && !friendinfo.GroupManageID)) { U.MD.F.W.recommendFriend(); } } } } } //#region 空好友提示 /** * 空好友的提示 * */ U.MD.F.W.recommendFriend = function () { U.MD.F.W.printRecommendFriend(US.userInfo.TJF.slice(0, 8), $("#U_MD_F_H_ZR")[0], 1); //推荐好友提示 U.MD.F.W.friendDisplayAndNone([{ "display": "block" }, { "display": "none"}], true); //弹出好友窗体,隐藏右边好友栏 } /** * 空用户的提示 * */ U.MD.F.W.printRecommendFriend = function (friendinfo, el, page) { //变量定义 var _tempel, //临时元素变量 _temponeel, //临时元素变量 _temptwoel, //临时元素变量 _tempthreeel, //临时元素变量 _tempfourel, //临时元素变量 _tempfiveel //临时元素变量 ; //清空内容 el.innerText = ""; //创建显示 _tempel = $$("div", { "className": "U_MD_F_H_ZRO", "onmousedown": U.UF.EV.stopBubble }); _temponeel = $$("div", { "className": "U_MD_F_H_ZROS" }, _tempel); $$("div", { "className": "U_MD_F_H_ZROSS", "innerHTML": "这里暂时没有任何内容哦" }, _temponeel); $$("div", { "className": "U_MD_F_H_ZROSZ", "innerHTML": "Nothing!!" }, _temponeel); _temptwoel = $$("div", { "className": "U_MD_F_H_ZROSX" }, _temponeel); $$("div", { "className": "U_MD_F_H_ZROSXL", "innerHTML": "可尝试点击左边的头像,或追随一下的用户!" }, _temptwoel); $$("div", { "className": "U_MD_F_H_ZROSXR U_Img" }, _temptwoel); _temponeel = $$("div", { "className": "U_MD_F_H_ZROX" }, _tempel); _temptwoel = $$("div", { "className": "U_MD_F_H_ZROXT" }, _temponeel); $$("div", { "className": "U_MD_HomeSXLTTO U_MD_HomeSXROHTO", "innerHTML": "推荐追随" }, _temptwoel); $$("div", { "className": "U_MD_HomeSXLTTI U_Img", "onclick": function () { U.MD.F.W.recommendFriend(el, page); } }, _temptwoel); _temptwoel = $$("div", { "className": "U_MD_F_H_ZROXX" }, _temponeel); //推荐好友循环打印区域 for (i = 0; i < friendinfo.length; i++) { _tempthreeel = $$("div", { "className": "U_MD_F_H_ZROXXO", "style": { "marginLeft": "65px"} }, _temptwoel); _tempfourel = $$("div", { "className": "U_MD_F_H_ZROXXOS" }, _tempthreeel); _tempfiveel = $$("div", { "className": "U_MD_F_H_ZROXXOSL" }, _tempfourel); $$("img", { "onerror": U.MD.C.imgError, "title": "点击查看", "onclick": function () { U.UF.EV.stopBubble(); U.MD.U.V.ViewOtherUserInfo(friendinfo[i].UserID); }, "src": U.MD.C.getHeadImage(friendinfo[i].UserThumbnailImageHead), "alt": friendinfo[i].UserName }, _tempfiveel); $$("div", { "className": "U_MD_F_H_ZROXXOSN U_MD_D_Text_Abbreviation", "innerHTML": friendinfo[i].UserName }, _tempfourel); $$("div", { "className": "U_MD_F_H_ZROXXOSR", "title": "点击追随该用户", "innerHTML": "追随", "onclick": function () { U.MD.F.M.addFriend(friendinfo[i]); } }, _tempfourel); _tempfourel = $$("div", { "className": "U_MD_F_H_ZROXXOX U_MD_HomeSXZLLZOOX" }, _tempthreeel); $$("div", { "className": "U_MD_F_W_S", "innerHTML": "▲" }, _tempfourel); $$("div", { "className": "U_MD_F_W_X", "innerHTML": function () { if (friendinfo[i].UserIndividualitysignature) { friendinfo[i].UserIndividualitysignature.substring(0, 15) } else { ("添加我为好友吧,分享我们的信息,让我们距离更近一步").trim() } } }, _tempfourel); } //添加内容 el.appendChild(_tempel); } //好友推荐变化 U.MD.F.W.recommendFriend = function (el, page) { var _userinfo = US.userInfo, //登录用户资料 _start = page * 4, //分页的开始 _end = (page + 1) * 4, //分页的结束 _recommendfriend = _userinfo.TJF.slice(_start, _end) //分页获取推荐的用户 ; //获取的用户存在则打印 if (_recommendfriend.length) { U.MD.F.W.printRecommendFriend(_recommendfriend, el, page + 1); } //否则去数据库取数 else { U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "RecommendFriends", _userinfo.UserId || US.EMPTYGUID, _userinfo.length, _userinfo.length + 4], U.MD.D.H.AsynSYTJ, [el, el, page]); } } //获取推荐好友 U.MD.F.W.asynRecommendFriend = function (r) { var _userinfo = US.userInfo, //登录用户资料 _context = r.context, //回调的参数 _el = _context[1], //输出的内容区域 _page = _context[2] //输出的号码 ; r = r.value; //获取推荐用户的返回值 _userinfo = _userinfo.concat(r); //获取的推荐用户存储到用户推荐用户信息里 U.MD.F.W.printRecommendFriend(r, _el, _page + 1); //打印推荐好友 } //#endregion //#region /** * 好友聊天器里查看好友聊天 * * @param {object} 群信息 */ U.MD.F.W.popupFriendsForm = function (friendinfo, el) { //登录的用户才能弹出窗体 var _close; if (!U.MD.U.L.isLogin()) { var _friendform = $("#U_MD_F_H_ZA")[0]; //判断窗体是否创建如果创建直接显示,如果没有则创建 if (!_friendform) { $("#U_MD_F_H_Z")[0].style.display = "block"; //创建窗体弹出窗体 var _window = new U.UF.UI.form("", $("#U_MD_F_H_Z")[0], { "resize": U.MD.F.W.reSize, "id": "U_MD_F_H_ZA", "style": { "display": "block", "height": "80%" } }, { isstretching: false, isnarrow: false }); _close = $($($($($(_window.content).Parent()).Parent()).Parent()).Child()[3]).Child()[0]; //获取关闭按钮 _close.onclick = function () { U.MD.F.W.friendDisplayAndNone([{ "display": "none" }, { "display": "block"}], { "left": "auto", "right": "0px" }); } } //指定元素 else { U.UF.F.topWindow($("#U_MD_F_H_ZA")[0]); } //隐藏好友右边的显示,显示窗体 U.MD.F.W.friendDisplayAndNone([{ "display": "block" }, { "display": "none"}]); U.MD.F.W.openFriendChat(friendinfo); //打开指定的好友聊天显示 // U.MD.F.W.reSize(); //好友聊天区域大小初始化 } } /** * 初始化好友聊天区域 * * @param {object} 群信息 */ U.MD.F.W.openFriendChat = function (friendinfo) { var _friendfromel = $("#U_MD_F_H_ZR")[0], //整个好友窗体元素 _friendchatfrom = $("#U_MD_F")[0], //好友聊天区域元素 _userid = friendinfo.GroupManageID || friendinfo.UserId, //打开群或者好友的窗体 _chatform = U.MD.F.W.isCreateForm(_userid), //判断窗体是否已经打开创建 _isgroup = friendinfo.GroupManageID != null ; _friendchatfrom.style.display = "block"; //默认是隐藏,这些显示 _friendfromel.appendChild(_friendchatfrom); //追加聊天区域 //如果好友聊天框不存在,则创建好友聊天框 if (!_chatform) { _chatform = U.MD.F.W.createFriendChat(friendinfo); } //选择到指定的窗体 U.MD.F.W.switchFriendsChat(_chatform, friendinfo); //好友聊天查看 U.MD.F.H.getFriendOrGroupNews(_userid, function (r) { U.MD.F.N.asynReceiveMessages(_isgroup, _chatform[1], r.value); }, _isgroup); } //大小变化处理 U.MD.F.W.reSize = function () { U.MD.F.W.leftSize(); //左边的处理 U.MD.F.W.chatBoxSize($("#U_MD_F_H_ZA")[0], U.MD.F.W.switchFriendsChat.Ele || $("#U_MD_F")[0].childs[0].element[1]); //右边聊天框处理 } /** * 好友聊天左边聊天框显示,主要是好友显示的区域的大小加上上面的导航等于整个左边的高 * */ U.MD.F.W.leftSize = function () { //获取容器DIV var _content = $("#U_MD_F_H_ZA")[0]; if (_content) { //得到高度 var _height = _content.offsetHeight, _childs = $(".U_MD_F_H_ZL").Child(); //获取下面的所有的孩子节点 //设置下面的高度等于整个高度-导航的高度 $("#U_MD_F_H_ZLZ")[0].style.height = _height - _childs[0].offsetHeight - _childs[1].offsetHeight - 30 + "px"; } } //调整好友聊天框 U.MD.F.W.chatBoxSize = function (el, chatel) { var i, //用于循环 _childs, //0 聊天区域 1聊天记录区域 _rightchilds = $(chatel).Child(), //获取整个右边好友聊天区域的子元素 _chatchilds = $(chatel.parentNode).Child(), //获取聊天区域的子元素 _height = el.offsetHeight, //右边的高 _width = chatel.offsetWidth; //右边的长 //循环设置 for (i = 0; i < _chatchilds.length; i++) { //聊天记录和聊天框的大小设置 _childs = $(_chatchilds[i]).Child(); _childs[0].style.width = _width - _childs[1].offsetWidth + "px"; _childs[1].style.height = _height - 90 + "px"; //聊天框的大小设置 $(".U_MD_F_CA", _chatchilds[i]).css("height", _height - 380 + "px"); } } /** * 设置好友窗体打开和关闭的状态 * * @param {array} 显示隐藏的集合 */ U.MD.F.W.friendDisplayAndNone = function (style) { var _friendform = $("#U_MD_F_H_ZA"), //好友窗体 _friendright = $("#U_MD_F_H_R"); //好友右侧 _friendform.addAttrArray({ "style": style[0] }); //给窗体设置参入的css值 _friendright.addAttrArray({ "style": style[1] }); //给窗体设置参入的css值 } //#endregion //判断是否需要创建 /** * 根据friendid判断好友窗体是否创建 * * @param {object} 群信息 */ U.MD.F.W.isCreateForm = function (friendid) { var i, //用于循环处理 _friendchatform = $("#U_MD_F")[0]; //好友聊天框 if (_friendchatform.childs) { //判断是否打开了聊天 for (i = 0; i < _friendchatform.childs.length; i++) { //循环所有打开的聊天找到已经和friendid对应打开的好友聊天 if (_friendchatform.childs[i].formid == friendid) { //如果找到匹配的好友聊天框或者群聊天框,则直接返回 return _friendchatform.childs[i].element; } } } } /** * 生成统一的好友窗体区域 * * @param {object} 好友或群信息 */ U.MD.F.W.createFriendChat = function (friendandgroupinfo) { //变量定义 var _headel, _headimageel, _chatel, _chatleftel, _chatheadel, _chatheadimageel, _chatheadcontentel, _chatheadpromptel, _chatcontentel, _chatcontentnewsel, _chatnewsel, _chatnewsoneel, _chatnewstwoel, _chateditel, _chatbuttonel, _chatbuttonsendel, _chatrecordel, _buttondiv, _userid, _name, descript, _chatformel, _chatformchilds, _navichilds; //群id获取好友id,作为窗体的唯一识别id _userid = friendandgroupinfo.GroupManageID || friendandgroupinfo.UserId; //显示在聊天框的名字,群名、好友描述、好友名字 _name = friendandgroupinfo.GroupManageName || friendandgroupinfo.FriendsDescript || friendandgroupinfo.UserNickName; //群描述、好友签名 descript = friendandgroupinfo.GroupManageDescript || friendandgroupinfo.UserIndividualitysignature || "暂时没有填写介绍.."; //聊天框元素 _chatformel = $("#U_MD_F")[0]; //聊天区域的还在元素 _chatformchilds = $(_chatformel).Child(); //头部切换导航区域的元素 _navichilds = $(_chatformchilds[0]).Child(); //头部标签 _headel = $$("div", { "className": "U_MD_F_TO", "onmousedown": U.UF.EV.stopBubble }, _navichilds[0], _navichilds[0].firstChild); _headimageel = $$("div", { "className": "U_MD_F_TOI" }, _headel); $(_headel).attr("user", _userid); //好友显示头像 if (friendandgroupinfo.UserId) { $$("img", { "onerror": U.MD.C.imgError, "onerror": U.MD.C.imgError, "title": "点击查看", "src": U.MD.C.getHeadImage(friendandgroupinfo.UserThumbnailImageHead), "alt": friendandgroupinfo.UserNickName }, _headimageel); } //群显示头像 else { U.MD.F.printGroupHeadImage(friendandgroupinfo, _headimageel, 4, [25, 25]); } $$("div", { "className": "U_MD_F_TON U_MD_D_Text_Abbreviation", "innerHTML": _name }, _headel); $$("div", { "className": "U_MD_F_TOC U_Img", "onclick": function () { U.MD.F.W.delteFriendChat(_userid, _chatformel, friendandgroupinfo); } }, _headel); //聊天区 _chatel = $$("div", { "className": "U_MD_F_NA" }); _chatformchilds[1].insertBefore(_chatel, _chatformchilds[1].firstChild); //左侧 _chatleftel = $$("div", { "className": "U_MD_F_N" }, _chatel); //头部信息 _chatheadel = $$("div", { "className": "U_MD_F_H" }, _chatleftel); _chatheadimageel = $$("div", { "className": "U_MD_F_HH" }, _chatheadel); if (friendandgroupinfo.GroupManageID) { U.MD.F.printGroupHeadImage(friendandgroupinfo, _chatheadimageel); $(_chatheadimageel).addAttrArray({ onclick: function () { U.MD.F.J.groupInfoForm(friendandgroupinfo, _chatleftel); }, title: friendandgroupinfo["GroupManageName"] }); } else { $$("img", { "onerror": U.MD.C.imgError, "onerror": U.MD.C.imgError, "title": "点击查看", "onclick": function () { U.UF.EV.stopBubble(); if (U.MD.D.IsUseStudio) { U.MD.U.V.ViewOtherUserInfo(_userid); } }, "src": U.MD.C.getHeadImage(friendandgroupinfo.UserThumbnailImageHead), "alt": friendandgroupinfo.UserNickName }, _chatheadimageel); } _chatheadcontentel = $$("div", { "className": "U_MD_F_HT U_MD_D_Text_Abbreviation" }, _chatheadel); $$("div", { "className": "U_MD_F_HTN", "innerHTML": _name }, _chatheadcontentel); $$("div", { "className": "U_MD_F_HTC", "innerHTML": (friendandgroupinfo.GroupManageDescript || friendandgroupinfo.UserIndividualitysignature || "暂时没有填写介绍..") }, _chatheadcontentel); _chatheadpromptel = $$("div", { "className": "U_MD_F_HG" }, _chatleftel); $$("div", { "className": "U_MD_F_GI U_Img" }, _chatheadpromptel); $$("div", { "className": "U_MD_F_GC", "innerHTML": "交谈中请勿轻信汇款、中奖信息、陌生电话..." }, _chatheadpromptel); $$("div", { "style": { "width": "10px", "height": "10px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-817px -482px", "float": "right", "margin": "8px" }, "onclick": function () { _chatheadpromptel.style.visibility = "hidden"; } }, _chatheadpromptel); //内容发布区 _chatcontentel = $$("div", { "className": "U_MD_F_CA" }, _chatleftel); _chatcontentnewsel = $$("div", { "className": "U_MD_F_C" }, _chatcontentel); //发布内容区域 _chatnewsel = $$("div", { "className": "U_MD_F_D", "style": { "position": "relative"} }, _chatleftel); _chatnewsoneel = $$("div", { "className": "U_MD_F_DA" }, _chatnewsel); _chatnewstwoel = $$("div", { "className": "U_MD_F_DT" }, _chatnewsoneel); _chateditel = $$("div", { "className": "U_MD_F_DC", "contentEditable": "true" }, _chatnewsoneel); $$("div", { "className": "U_MD_F_DJ U_Img" }, _chatnewsoneel); // 按钮区域 _chatface = $$("div", { "style": { "margin-top": "-194px", "margin-left": "14px"} }, _chatformel); _chatbuttonel = $$("div", { "className": "U_MD_F_X" }, _chatleftel); _chatbuttonsendel = $$("div", { "className": "U_MD_F_XE", "innerHTML": "发送(Ctrl+Enter)", "style": { "marginRight": "15px" }, "onclick": function () { U.MD.F.H.sendFriendOrGroupChatMessage(friendandgroupinfo, _chateditel, _chatcontentnewsel, (friendandgroupinfo.UserId == null)); } }, _chatbuttonel); $$("div", { "className": "U_MD_F_XC", "innerHTML": "关闭(n)", "onclick": function () { U.MD.F.W.friendDisplayAndNone([{ "display": "none" }, { "display": "block"}], { "left": "auto", "right": "0px" }); } }, _chatbuttonel); //右侧聊天记录 _chatrecordel = $$("div", { "className": "U_MD_F_L" }, _chatel); $$("div", { "className": "U_MD_F_LA" }, _chatrecordel); $$("div", { "className": "U_MD_F_LB" }, _chatrecordel); //事件赋值 _buttondiv = $$("div", { "className": "U_MD_F_DTF U_MD_F_W_Face", "title": "发送表情", "style": { "margin": "0", "position": "relative", "background": "url(/img/face.png) no-repeat 0", "background-size": "20px" } }, _chatnewstwoel); $$("button", { "style": { "opacity": "0", "width": "28px", "height": "28px" }, "onmousedown": function () { U.MD.UI.face(_chatface, _chateditel); }, "onclick": U.UF.EV.stopBubble }, _buttondiv); _chatheadimageel = $$("div", { "className": "U_MD_F_UploadPng U_Img", "title": "添加文件", "style": { "cssText": "margin-left:5px" }, "onclick": function (e) { if ($(".U_MD_F_UploadInput")[0]) { //删除弹出框 $(".U_MD_F_UploadInput").remove(); return; } var _firendinfo = friendandgroupinfo; var _div = $$("div", { "className": "U_MD_F_UploadInput", style: { "cssText": "width:154px;float:none;position:absolute;background-color:#fff;z-Index:999;border:1px solid #ccc;height:80px;text-align:center;top:-78px;left:-12px" }, "fiendInfo": friendandgroupinfo, "place": _chatcontentnewsel }, _chatheadimageel); var _local = $$("div", { "className": "U_MD_F_LoaclChose", innerHTML: "选择本地上传文件", style: { "cssText": "position:relative;float:none;width:100%;height:32px;margin:8px 0 0 0;line-height:32px" }, onclick: function () { var _groupid, _ancestors, _directoryid = US.disk.Disks[US.userInfo.userid].directoryid, _dirinfo = U.Json.select(US.disk.Disks[US.userInfo.userid].directoryOrFiles, { "UserDirectoryID": _directoryid })[0]; //获取粘贴到制定目录的群id _ancestors = U.MD.DK.C.getAncestors(_dirinfo, US.disk.Disks[US.userInfo.userid]); //获取所有的祖先 //如果是ftp目录,那么groupid就是用户id if (_ancestors[_ancestors.length - 1].UserDirectoryID == US.FTPFOLDERID) { _groupid = US.disk.Disks[US.userInfo.userid].userInfo.UserId; } //否则就是对应的群id,如果不存在那么就是"" else { _groupid = _ancestors[_ancestors.length - 1].GroupID || ""; } U.MD.UI.upload( "http://main.1473.cn/USUpfile.ashx?typename=UploadFlashfile&DirectoryId=" + _directoryid + "&Encrypt=" + _groupid + "&UserId=" + US.userInfo.userid + "&IsF=true", //上传的地址 //上传成功的回调函数 function (r, fileinfo) { var _data = r.data //获取服务器返回值 ; //根据文件的唯一识别id获取文件的信息 //获取从服务器获取的值,这里加一个错误处理,因为如果后台出现了错误,那么eval的过程就会失败 try { _data = eval("0," + _data); } catch (e) { } var _fileInfo = { "UserallDirectoryName": fileinfo.name, "UserDirectoryExtendType": U.UF.UP.getFileNameAndExtension(fileinfo.name)[1], "UserDirectorySize": _data[3], "UserDirectoryID": _data[2], "UserDirectoryUrl": _data[1] } U.MD.F.W.printMessageContent(_fileInfo.UserDirectoryExtendType, _fileInfo, _chatcontentnewsel, true, _firendinfo); }, //得到md5的回调函数 function (md5, fileinfo, cb) { //根据用户的md5值判断用户是否需要上传,如果需要上传则需要执行上传处理,如果已经存在后台直接给用户生成文件路径等录入数据库 U.A.Request(US.AUTH, ["IfFileExistInsertDB", US.userInfo.userid, _directoryid, _groupid, fileinfo.size, md5, U.UF.UP.getFileNameAndExtension(fileinfo.name)[1], fileinfo.name], //判断上传文件是否存在 function (r) { var _userid = US.userInfo.userid; //当前登录用户的id r = r.value; //获取服务器返回的值,如果服务器响应出问题了,eval的时候就会报错。 try { r = eval(r)[0]; } catch (e) { } //当用户想上传的文件已经在数据库里存在了,那么后台会执行复制数据的操作。 if (r) { var _fileInfo = { "UserallDirectoryName" : r.UserDirectoryName.addEllipsis(20), "UserDirectoryExtendType" : U.UF.UP.getFileNameAndExtension(r.UserDirectoryName)[1], "UserDirectorySize":r.UserDirectorySize, "UserDirectoryID":r.UserDirectoryID, "UserDirectoryUrl": r.UserDirectoryUrl } U.MD.F.W.printMessageContent(_fileInfo.UserDirectoryExtendType, _fileInfo, _chatcontentnewsel, true, _firendinfo); cb(false); } //否则调用flash里面的函数执行用户的上传操作。 else { cb(true); } }); }); //阻止冒泡 U.UF.EV.stopBubble() //删除弹出框 $(".U_MD_F_UploadInput").remove(); } }, _div); var _localinput = $$('input', { 'type': 'file', style: { "cssText": "position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0;" }, onchange: function () { if (this.files.length) { //判断是否存在文件 var _range = U.UF.E.getRangeAt(); //获取光标处理 U.UF.UP.inputUpload([this], 'http://main.1473.cn/USUpfile.ashx?typename=UseStudioEditor', function (r) { //调用统一上传处理 var _file, _filetype, _input = r.context[0]; var _imgtype = /.*(jpg|png|gif|jpeg|JPG|PNG|GIF|JPEG|bmp|BMP)$/; var _filearray = []; //记录上传图片的数组 if (Object.prototype.toString.call(r.value[0]) != "[object Array]") { //根据返回值类型判断是否多图上传 _filearray = [r.value]; //单图用数组则直接记录 } else { _filearray = r.value; //多图则直接替换即可 } var _el, _frag = $$('frag'); for (i = 0; i < _filearray.length; i++) { //循环评接拼接 _file = _input.files[i]; _filetype = _file.name.substring(_file.name.lastIndexOf('.') + 1, _file.name.length); //获取文件后缀名 if (_filetype.match(_imgtype)) {//图片类型处理 _el = $$("div", {}, _frag); ; $$('span', { innerHTML: ' ' }, _el); } else { //其余文件类型处理 _el = U.UF.E.attachment.create(_file, _filearray[i][2], _filetype); $(_el).appendTo(_frag); } } var _data = [_div.fiendInfo, _div.place] var _filedata = { 'UserallDirectoryName': _file.name, 'UserDirectoryExtendType': _filetype, 'UserDirectorySize': _file.size, 'UserDirectoryID': r.value[2], 'UserDirectoryUrl': r.value[0] }; U.MD.F.W.printMessageContent(_filetype, _filedata, _data[1], true, _data[0]); }, [this]); } } }, _local); var _disk = $$("div", { "className": "U_MD_F_DiskChose", innerHTML: "选择网盘上传文件", style: { "cssText": "float:none;width:100%;height:32px;margin:0 0 0 0;line-height:32px" }, onclick: function () { //阻止冒泡 U.UF.EV.stopBubble() U.MD.DK.VW.choseFile(function (data) { var _data = [$('.U_MD_F_UploadInput')[0].fiendInfo, $('.U_MD_F_UploadInput')[0].place] //根据选择的文件生成内容 U.MD.F.W.printMessageContent(data.UserDirectoryExtendType, data, _data[1], true, _data[0]); //删除弹出框 $(".U_MD_F_UploadInput").remove(); }) } }, _div); } }, _chatnewstwoel); if (friendandgroupinfo.GroupManageID) { $$("div", { "className": "U_MD_F_DTS U_Img", "title": "网盘提交", "onclick": function () { U.MD.D.I.openApplication("disk", { "userid": US.userInfo.userid, "directoryid": friendandgroupinfo.GroupManageID }); } }, _chatnewstwoel); } $$("div", { "className": "U_MD_F_DTJ U_Img", "title": "聊天记录", "onclick": function () { U.MD.F.H.viewFriendsChatRecords(_chatrecordel, friendandgroupinfo, 1, (friendandgroupinfo.UserId == null)); } }, _chatnewstwoel); _chateditel.onkeydown = function () { if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10)) { _chatbuttonsendel.onclick(); //发送消息 U.UF.EV.stopDefault(); //回车处理 } }; U.UF.E.initEditor(_chateditel); //初始化编辑器处理 _headel.onclick = function () { U.MD.F.W.switchFriendsChat([_headel, _chatel], friendandgroupinfo); }; //切换事件 //设置光标处理 // U.UF.E.GetSelectionRange(window, _chateditel, { "TF": "Friend" }); //创建的好友窗体记录 if (_chatformel.childs == null) { _chatformel.childs = []; } _chatformel.childs.unshift({ "formid": _userid, "element": [_headel, _chatel], "info": friendandgroupinfo }); //添加记录 return _chatformel.childs[0].element; } // /** * 好友聊天切换 * * @param {string} 好友的id * @param {element} 窗体元素 */ U.MD.F.W.switchFriendsChat = function (elements, friendorgroupinfo) { var i, _friendchatel, _topleftbottom, _chatel = $(elements[1]).Parent(2), _topbottom = $($(_chatel).Child()[0]).Child()[2], //右上角功能按钮 _chatchilds = $(_chatel)[0].childs; //判断右上角功能按钮是否存在 if (_topbottom.children[0]) { _topbottom.children[0].remove(); } //显示当前elements的聊天窗体,其他的隐藏 for (i = 0; i < _chatchilds.length; i++) { _friendchatel = _chatchilds[i].element; if (_friendchatel[0] == elements[0] && _friendchatel[1] == elements[1]) { //需要显示的聊天框 U.MD.F.W.switchFriendsChat.Ele = elements[1]; $(elements[0]).addClass("U_MD_F_TOT"); $(elements[1]).css("display", "block"); //可编辑区域聚焦 $(".U_MD_F_DC", elements[1])[0].focus(); } else { //需要隐藏的聊天框 $(_friendchatel[0]).removeClass("U_MD_F_TOT"); $(_friendchatel[1]).css("display", "none"); } } //右上角功能点击处理处理 _topbottom.onclick = function () { U.UF.EV.stopBubble(); U.MD.F.R.popupRightCornerMenu(friendorgroupinfo, _topbottom); $("#U_MD_F_Add_O")[0].style.display="none"; var _friendmenuel = $('#U_MD_F_G_Group')[0], //右键的菜单 _child = $(_friendmenuel).Child(); //子菜单 //显示菜单,定位 $(_friendmenuel).css({ "display": "block", "zIndex": "999" }); U.UF.C.rightClickMenuLocation(_friendmenuel); //右键菜单定位 new_element=document.createElement("script"); new_element.setAttribute("type","text/javascript"); new_element.setAttribute("src","http://friend.1473.cn/js/Friend/Add.js");// 在这里引入了a.js document.body.appendChild(new_element); //按钮功能赋值 _child[0].onclick = function () { $("#U_MD_F_Add_O")[0].style.display="block";/*U.MD.F.R.popupRightCornerMenu(friendorgroupinfo, _topbottom);*/ }; //查看群聊资料 _child[1].onclick = function () { $(".U_MD_F_Add_B")[0].click(); }; //退出/解散群聊 //点击其它区域隐藏右键菜单 $(document).bind("click", function () { $(_friendmenuel)[0].style.display = "none"; }) if($(".U_MD_F_Add_B")[0].innerHTML=="解散该群"){ _child[1].innerHTML="解散该群"; }else{ _child[1].innerHTML="退出该群"; } }; if (friendorgroupinfo.UserId) { _topleftbottom = "个人信息"; } else { _topleftbottom = "创建群"; } _topbottom.title = _topleftbottom; //好友聊天框 U.MD.F.W.chatBoxSize($(elements[1]).Parent(7), elements[1]); } /** * 删除单个好友聊天 * * @param {string} 好友的id * @param {element} 窗体元素 */ U.MD.F.W.delteFriendChat = function (friendid, el) { var i, j, //循环处理 _chatinfo, //好友聊天的好友或者群信息 _elements, //好友聊天信息的框 _childs = $(el)[0].childs; //获取所有的聊天框 U.UF.EV.stopBubble(); //剩下最后一个直接关闭聊天框 if (_childs.length == 1) { U.MD.F.W.friendDisplayAndNone([{ "display": "none" }, { "display": "block"}], { "left": "auto", "right": "0px" }); //移除 } else { //循环找到friendid对应的弹框 for (i = 0; i < _childs.length; i++) { //判断窗体的id和好友的id是否一致 if (_childs[i].formid == friendid) { _elements = _childs[i]["element"]; //获取根据friendid创建的所有的元素 for (j = 0; j < _elements.length; j++) { //循环所有的元素,然后全部删除 $(_elements[j]).remove(); //移除元素处理 } _childs.splice(i, 1); //在所有孩子元素中删除该元素 //判断当前窗体是否在正在进行的聊天窗体,如果是的话,删除了这个窗体后要把下面的窗体显示出来 if (_elements[0].className.indexOf("U_MD_F_TOT") > -1) { //获取下一个要显示的聊天框 _chatinfo = _childs[i] || _childs[i - 1]; //下一个或者是上一个 //显示该聊天框 U.MD.F.W.switchFriendsChat(_chatinfo["element"], _chatinfo["info"]); } break; } } } } //生成发表聊天消息和获取聊天消息区域 /** * 查看聊天好友 * @param {element} 打印的内容区域 * @param {array} 打印消息的数组 * @param {boolean} 判断消息是自己发送的还是获取的 ---------- true 自己发送的 ---------- flase 获取的带的 */ U.MD.F.W.printFriendChatMessage = function (el, newsinfo, issend) { var i, _date, //打印的时间 _chatcontentel, _chatcontentoneel, _chatcontentwordsel, _chatel = el.parentNode, //聊天框 _frag = $$("frag"); if (issend) { _stylearray = ["U_MD_F_CT", " U_MD_F_CTLC U_MD_F_GCTLC", " U_MD_F_COLCOO", " U_MD_F_CTTO", " "]; } else { _stylearray = ["U_MD_F_CO", "", " U_MD_F_COLCOT", " U_MD_F_CTT"]; } //打印的样式 //打印的消息 var _el; for (i = 0; i < newsinfo.length; i++) { _date = U.UF.D.getYearMonthDay(newsinfo[i]["MessageSendTime"]) || U.UF.D.getYearMonthDay(newsinfo[i]["GroupMessageSendTime"]) || newsinfo[i]["Time"], "Array"; _contentBox = $$("div", { "style": { "margin": " 0 10px"} }, _frag); _time = $$("div", { "className": "U_MD_F_COTO U_MD_F_CTO", "style": { "margin": " 0 10px", "text-align": "center", "color": "#aaaaaa", "font-size": "13px" }, "innerHTML": (_date) }, _contentBox); _contentel = $$("div", { "className": _stylearray[0], "title": newsinfo[i].GroupMessageSendUsername || newsinfo[i].MessageDescript || newsinfo[i].Name }, _contentBox); _content = $$("div", {}, _contentel); _contentoneel = $$("div", { "className": "U_MD_F_COLC" + _stylearray[1] }, _content); _contentimgel = $$("img", { "onerror": U.MD.C.imgError, "title": "点击查看", "onclick": function () { U.MD.U.V.ViewOtherUserInfo(newsinfo[i].GroupMessageSendUser || newsinfo[i].UserId); }, "src": U.MD.C.getHeadImage((newsinfo[i].IMG || newsinfo[i].UserThumbnailImageHead)), "className": "U_MD_F_COLCI" }, _contentel); //如果消息类型为6 if (newsinfo[i].MessageIsVerify == 6) { var _filedata = JSON.parse(newsinfo[i].MessageContent), //生成盒子,并且绑定点击事件 _filebox = $$('div', { style: { cssText: 'position:relative; padding: 10px; background-color: #fff; border:1px solid silver; overflow:hidden; cursor: pointer;'} }, _contentoneel) U.MD.F.W.printFileContent(_filedata, _filebox) } else { _el = newsinfo[i]["MessageContent"] || newsinfo[i]["GroupMessageContent"] || newsinfo[i]["Content"] if (U.UF.C.isElement(_el)) { _contentwordsel = $$("div", { "className": "U_MD_F_COLCO " + _stylearray[2] }, _contentoneel); $(_el).appendTo(_contentwordsel); } else { _contentwordsel = $$("div", { "className": "U_MD_F_COLCO " + _stylearray[2], "innerHTML": _el }, _contentoneel); } } if (issend) { _contentoneimgel = $$("div", { "style": { "width": "6px", "height": "10px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-984px -344px", "margin": "10px 4px 10px 0px"} }, _content); _content.style.float = "right"; _contentel.insertBefore(_contentimgel, _content); _contentimgel.style.float = "right"; _content.style.marginRight = "8px"; } else { _contentoneimgel = $$("div", { "style": { "width": "6px", "height": "10px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-1004px -344px", "margin": "10px 0px 10px 4px"} }, _content); _content.style.float = "left"; _contentel.insertBefore(_contentimgel, _content); } } el.appendChild(_frag); //消息定位到底部 _chatel.scrollTop = _chatel.scrollHeight - _chatel.offsetHeight; } /** * 查看聊天 好友或者群 * @param {element} 打印的内容区域 * @param {array} 打印消息的数组 * @param {boolean} 判断消息是自己发送的还是获取的 ---------- true 自己发送的 ---------- flase 获取的带的 */ U.MD.F.W.printGroupChatMessage = function (el, newsinfo, issend) { var i, _date, _contentel, _contentoneel, _contentwordsel, _contentimgel, _contentnameel, _stylearray, _chatcontentel = el.parentNode, _frag = $$("frag"); //发送消息是自己和他人区别的样式 if (issend) { _stylearray = ["U_MD_F_CT", " U_MD_F_CTLC U_MD_F_GCTLC", " U_MD_F_COLCOO", " U_MD_F_CTTO", " "]; } else { _stylearray = ["U_MD_F_CO", "", " U_MD_F_COLCOT", " U_MD_F_CTT"]; } //循环打印聊天消息 for (i = 0; i < newsinfo.length; i++) { var _isFile = true; // try{ // var _obj = JSON.parse(newsinfo[i].GroupMessageContent); // if(typeof obj == 'object' && obj ) // _isFile = true; // // }catch(e) { // continue; // } _date = newsinfo[i]["Time"] || U.UF.D.getYearMonthDay(newsinfo[i]["GroupMessageSendTime"]), "Array"; _contentBox = $$("div", { "style": { "margin": " 0 10px"} }, _frag); _time = $$("div", { "className": "U_MD_F_COTO U_MD_F_CTO", "style": { "margin": " 0 10px", "text-align": "center", "color": "#aaaaaa", "font-size": "13px" }, "innerHTML": (_date) }, _contentBox); _contentel = $$("div", { "className": _stylearray[0], "title": newsinfo[i].GroupMessageSendUsername || newsinfo[i].MessageDescript || newsinfo[i].Name }, _contentBox); _content = $$("div", {}, _contentel); _contentoneel = $$("div", { "className": "U_MD_F_COLC" + _stylearray[1] }, _content); _contentimgel = $$("img", { "onerror": U.MD.C.imgError, "title": "点击查看", "onclick": function () { U.MD.U.V.ViewOtherUserInfo(newsinfo[i].GroupMessageSendUser || newsinfo[i].UserId); }, "src": U.MD.C.getHeadImage((newsinfo[i].IMG || newsinfo[i].UserThumbnailImageHead)), "className": "U_MD_F_COLCI" }, _contentel); if (_isFile) { _contentwordsel = $$("div", { "className": "U_MD_F_COLCO " + _stylearray[2], "innerHTML": newsinfo[i]["Content"] || newsinfo[i]["GroupMessageContent"] }, _contentoneel); } else { // var _filedata = JSON.parse(newsinfo[i].GroupMessageContent), var _filedata = newsinfo[i].Content, _filebox = $$('div', { style: { cssText: 'position:relative; padding: 10px; background-color: #fff; border:1px solid silver; overflow:hidden; cursor: pointer;' }, onclick: U.UF.C.closure(function (i, filedata) { var _type = ''; switch (filedata.fileType) { case "uw": _type = 'word'; break; case "ue": _type = 'excel'; break; } U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", filedata.fileID]), function (r) { U.MD.D.I.openApplication(_type, r.value[0]) }); }, [i, _filedata]) }, _contentoneel) $$('span', { className: 'U_MD_DK_RZOS U_MD_DK_Img U_MD_DK_RZOD' }, _filebox); $$('span', { style: { cssText: 'vertical-align: top; padding-left: 20px; padding-right: 40px;' }, innerText: _filedata.fileName + '.' + _filedata.fileType }, _filebox); $$('div', { style: { cssText: 'position: absolute; right: 10px; bottom: 10px;' }, innerText: '查看' }, _filebox) } if (issend) { _contentoneimgel = $$("div", { "style": { "width": "6px", "height": "10px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-984px -344px", "margin": "10px 4px 10px 0px"} }, _content); _content.style.float = "right"; _contentel.insertBefore(_contentimgel, _content); _contentimgel.style.float = "right"; _content.style.marginRight="8px"; } else { _contentoneimgel = $$("div", { "style": { "width": "6px", "height": "10px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-1004px -344px", "margin": "10px 0px 10px 4px"} }, _content); _content.style.float = "left"; _contentel.insertBefore(_contentimgel, _content); } // _contentnameel = $$("div", { "className": "U_MD_F_COT " + _stylearray[3] }, _contentel); // $$("div", { "className": "U_MD_F_COTOK", "innerHTML": newsinfo[i].GroupMessageSendUsername || newsinfo[i].Name }, _contentnameel); } //追加消息 el.appendChild(_frag); //消息定位到底部 _chatcontentel.scrollTop = _chatcontentel.scrollHeight - _chatcontentel.clientHeight; } /** * 查看聊天好友 * @param {element} 打印的内容区域 * @param {array} 打印消息的数组 * @param {boolean} 判断消息是自己发送的还是获取的 ---------- true 自己发送的 ---------- flase 获取的带的 */ U.MD.F.W.addFile = function (friendinfo, el, thumbnail, fileurl, fileinfo) { //临时元素变量 var _tempel, _temponeel, _temptwoel, _tempthreeel, _isgroup = friendinfo.UserId == null; //图片发送方式 if (U.UF.UP.isImg(fileinfo.UserDirectoryExtendType)) { //创建一个元素 _tempel = $$("div", {}); //创建一个图片标签,添加图片 $$("img", { "onerror": U.MD.C.imgError, "className": "U_MD_F_CI", "src": U.MD.C.getHeadImage(thumbnail), "title": U.MD.C.getHeadImage(fileurl) }, _messageel).onclick = "U.UF.EV.stopBubble();U.MD.I.Img(US.userInfo, { 'Thm': '" + fileurl + "', 'Img': '" + fileurl + "'})"; //图片内容 //发送图片 U.MD.F.H.sendFriendOrGroupChatMessage(friendinfo, _messageel, el, _isgroup, true); } //文件发送方式 else { _tempthreeel = $$("div"); //发表文章样式 _tempel = $$("div", { "className": "U_MD_F_F" }, _tempthreeel); _temponeel = $$("div", { "className": "U_MD_F_FS" }, _tempel); _temptwoel = $$("div", { "className": "U_MD_F_FSS" }, _temponeel); $$("div", { "innerHTML": fileinfo["UserDirectoryExtendType"] }, _temptwoel); _temptwoel = $$("div", { "className": "U_MD_F_FSX" }, _temponeel); $$("div", { "className": "U_MD_F_FSXN", "innerHTML": fileinfo["UserallDirectoryName"] }, _temptwoel); $$("div", { "className": "U_MD_F_FSXS", "innerHTML": "已成功发送" }, _temptwoel); _temponeel = $$("div", { "className": "U_MD_F_FX" }, _tempel); //如果是在1473上看到该信息,则可以直接打开网盘到指定的地方 if (U.MD.D.IsUseStudio) { _tempel.onclick = "U.UF.EV.stopBubble();YDHJH('disk', ['" + fileinfo.UserId + "', '" + fileinfo.UserDirectoryID + "'])" _temptwoel = $$("div", { "innerHTML": "打开我的云盘", "title": "打开我的云盘" }, _temponeel); _temptwoel.onclick = "U.UF.EV.stopBubble();YDHJH('disk', ['" + fileinfo.UserId + "','" + fileinfo.UserDirectoryParentID + "'])"; _temptwoel = $$("div", { "innerHTML": "打开", "title": "打开" }, _temponeel); _temptwoel.onclick = "U.UF.EV.stopBubble();YDHJH('disk', ['" + fileinfo.UserId + "','" + fileinfo.UserDirectoryID + "'])"; } //如果是第三方调用我们的好友,则出现下载 else { _temptwoel = $$("div", { "innerHTML": "下载", "title": "下载" }, _temponeel); _temptwoel.onclick = "U.UF.EV.stopBubble();U.UF.UP.download('" + fileinfo.UserallDirectoryName + "','" + fileinfo.UserFilesServerName + "')"; } //显示出文件的样式 U.MD.F.H.sendFriendOrGroupChatMessage(friendinfo, _tempthreeel, el, _isgroup, true); } } //#endregion //右侧好友定位 U.MD.F.W.rightFormlocation = function () { $("#U_MD_F_H_R").addAttrArray({ "style": { "top": (US.height - 530) / 2, "right": "0px" } }); // } /* 打印消息内容 参数一:type(string) 消息种类 例如 文件夹folder 图片 jpg 等 参数二:data(json) 文件数据 参数三:parent(element) 生成元素 参数五:send(boolean) 发送消息为true ,接受消息为false 参数四:friend(json) 好友数据 */ U.MD.F.W.printMessageContent = function (type, data, parent, send, friend) { var _content = $$('div', {}); var _folder = $$("div", { style: { "cssText": "padding:8px;background:#fff;border-radius:2px;position:relative"} }, _content); //生成发送数据 var _message = { fileName: data.UserallDirectoryName, fileType: data.UserDirectoryExtendType, fileSize: data.UserDirectorySize, fileID: data.UserDirectoryID, fileUrl: data.UserDirectoryUrl, filetype: fileType = "folder" ? 1 : 0, UserDirectoryExtendType: data.UserDirectoryExtendType, UserDirectoryID: data.UserDirectoryID, UserallDirectoryName: data.UserallDirectoryName }; U.MD.F.W.printFileContent(_message, _folder); //生成消息数据 var _newsinfo = [{ "UserId": US.userInfo.userid, "Time": new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds(), "Content": _content, "IMG": US.userInfo.UserThumbnailImageHead, "Name": US.userInfo.UserNickName }]; //是否发送消息 if (send) { //发送记录到数据库 U.A.Request(US.CD, [US.DB, "UseStudio_Friends", "SentMessageToFriend", US.userInfo.userid, friend.UserId, US.userInfo.UserNickName, JSON.stringify(_message), 6, false], function () { }); } //打印在好友聊天 U.MD.F.W.printFriendChatMessage(parent, _newsinfo, true); } /* 打印消息文件内容 参数一:data(json) 文件数据 参数二:parent(element) 生成元素 */ U.MD.F.W.printFileContent = function (data, parent) { // parent.onclick = function () { // U.UF.C.closure(function (filedata) { // var _type; // var _fileType = ''; // //获取文件 // switch (filedata.fileType) { // case "uw": case "UW": // _type = true; // _fileType = 'word'; // break; // case "ue": // _type = true; // _fileType = 'excel'; // break; // case "folder": _fileType = "disk"; _type = true; break; // case "jpg": case "png": case "mp4": case "txt": case "html": _type = false; break; // } // //获取文件 // if (_type) { // U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", filedata.fileID]), function (r) { // U.MD.D.I.openApplication(_fileType, r.value[0]) // }); // } else { // U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", filedata.fileID]), function (r) { // U.MD.DK.LE.openFileDirectory(r.value[0], top.US.userInfo.userid) // }); // } // }, [data])(); // } /*$(parent).bind("click", function () { U.UF.C.closure(function (filedata) { var _type = ''; //获取文件 U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "GetFileById", filedata.fileID]), function (r) { U.MD.DK.LE.openFileDirectory(r.value[0], top.US.userInfo.userid) }); }, [data]) })//绑定点击事件*/ switch (data.fileType) { case "folder": //打印文件夹类型的文件 var _content = $$("div", { style: { "cssText": "width:100%"} }, parent); var _icon = $$("div", { "className": "U_MD_DK_RZOS U_MD_DK_Img U_MD_DK_RZOW", style: { "cssText": "float:none;display:inline-block;"} }, _content); var _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;"} }, _content); var _titileContent = $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000"} }, _titile); var _titileSize = $$("div", { innerHTML: "(" + data.fileSize + "MB)", style: { "cssText": "color:#aaaaaa;font-size:10px;line-height:10px"} }, _titile); var _open = $$("div", { onclick: function () { U.MD.DK.LE.openFileDirectory(data, US.userInfo.userid) }, innerHTML: "打开", style: { "cssText":"color:#429bfe;margin-top:-20px;text-align: right;cursor: pointer;"} }, parent); break; case "UW": case "txt": case "html": case "uw": //打印文本文件 var _content = $$("div", { style: { "cssText": "width:100%"} }, parent); var _icon = $$("div", { "className": "U_MD_DK_RZOD U_MD_DK_RZOS", style: { "cssText": "float:none;display:inline-block;"} }, _content); var _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;"} }, _content); var _titileContent = $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000"} }, _titile); var _titileSize = $$("div", { onclick: function(){U.MD.DK.LE.openFileDirectory(data, US.userInfo.userid)}, innerHTML: "查看", style: { "cssText": "color:#429bfe;margin-top:-20px;text-align: right;cursor: pointer;"} }, parent); break; case "jpg": case "png": //打印图片文件 _img = $$("img", { "onerror": U.MD.C.imgError, "src": "http://fs.1473.cn/" + data.fileUrl, "style": { "cssText": "width:100%;max-width:300px;min-width:30px;min-height:30px"} }, parent); break; case "mp4": //打印视频文件 if (parent.parentElement.className == "U_MD_F_LO") { var _content = $$("div", { style: { "cssText": "width:100%"} }, parent); var _icon = $$("div", { "className": "U_MD_DK_RZOS U_MD_DK_VIDEO", style: { "cssText": "float:none;display:inline-block;width:40px;height:40px;background-image:url('/img/YS2017.png');background-repeat:no-repeat;background-position:-1081px -527px;"} }, _content); var _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;"} }, _content); var _titileContent = $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000"} }, _titile); var _titileSize = $$("div", { onclick: function () { U.MD.DK.LE.openFileDirectory(data, US.userInfo.userid) }, innerHTML: "查看", style: { "cssText": "color:#429bfe;margin-top:-20px;float:right"} }, parent); } else { var _video = $$("img", { "onerror": U.MD.C.imgError, "src": "http://fs.1473.cn/" + data.fileUrl, "style": { "cssText": "width:100%;max-width:300px;"} }, parent), _videoText = $$("div", {}, parent), _videoStart = $$("div", { "style": { "width": "97px", "height": "96px", "background-image": "url('/img/YS2017.png')", "display": "inline-block", "background-repeat": "no-repeat", "background-position": "-1015px -362px", "position": "absolute", "top": "25%", "left": "35%"} }, _videoText), _videoName = $$("div", { "innerHTML": data.fileName, "style": { "cssText": "color:white;font-size:16px;position: absolute;top: 137px;margin-left: 10px;"} }, _videoText), _videoSize = $$("span", { "innerHTML": data.fileSize, "style": { "cssText": "color:#d4d3d1;font-size:14px;position: absolute;top: 155px;margin-left: 10px;"} }, _videoText), _videoState = $$("span", { "innerHTML": "已发送", "style": { "cssText": "color:#d4d3d1;font-size:14px;position: absolute;top: 155px;right:20px"} }, _videoText); } break; default: var _content = $$("div", { style: { "cssText": "width:100%"} }, parent); var _icon = $$("div", { "className": "U_MD_DK_RZOS U_MD_DK_Img downel_content_a_r", style: { "cssText": "float:none;display:inline-block;"} }, _content); var _iconContent = $$("div", { "className": "U_MD_DK_RZOSZ", 'innerHTML': data.fileType }, _icon); var _titile = $$("div", { "className": "", style: { "cssText": "display:inline-block;margin:0px 5px;width:155px;vertical-align:top;"} }, _content); var _titileContent = $$("div", { innerHTML: data.fileName, style: { "cssText": "color:#000"} }, _titile); var _titileSize = $$("div", { innerHTML: "(" + data.fileSize + "MB)", style: { "cssText": "color:#aaaaaa;font-size:10px;line-height:10px"} }, _titile); var _open = $$("div", { innerHTML: "打开", style: { "cssText": "color:#429bfe;margin-top:-20px;text-align: right;cursor: pointer;"} }, parent); _open.onclick = function () { U.MD.DK.LE.openFileDirectory(data, US.userInfo.userid); } break; }; }