TG.WXCRM.V4/WEB/Views/WeiXin/WorkAccount/MyMessage - 复制.cshtml

867 lines
41 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@{
ViewBag.Title = "聊天记录";
Layout = "~/Views/Shared/_EasyUI_Layout.cshtml";
}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@using WX.CRM.Model.MAP
@using WX.CRM.Common
<style>
#wochalei {
height: 30px;
width: 100%;
background-color: #536484;
}
#wochalei ul {
padding: 0px;
font-size: 12px;
color: #FFF;
line-height: 26px;
whitewhite-space: nowrap;
}
#wochalei li {
list-style-type: none;
}
#wochalei li span {
text-decoration: none;
font-family: Arial, Helvetica, sans-serif;
padding: 7px 5px;
width: 100%;
}
.rcontacthover {
color: #ff0;
background-color: #7E8BA3;
}
.rcontactClick {
color: #ff0;
background-color: #8988AE;
}
.isSelf {
color: #006EFE;
padding-left: 10px;
}
.isFriend {
color: #42B475;
padding-left: 10px;
}
.message {
padding-left: 20px;
}
.redColor {
color: red;
}
.displayLi {
display: none;
}
.contentTable td {
font-size: 12px;
line-height: 26px;
}
.imageClass {
max-width: 200px;
}
.miniimageClass {
max-width: 100px;
}
</style>
@*[微笑][撇嘴][色][发呆][得意][流泪][害羞][闭嘴][睡][大哭][尴尬][发怒][调皮][呲牙]
[惊讶][难过][囧][抓狂][吐][偷笑][愉快][白眼][傲慢][困][惊恐][流汗][憨笑][悠闲]
[奋斗][咒骂][疑问][嘘][晕][衰][骷髅][敲打][再见][擦汗][抠鼻][鼓掌][坏笑]
[左哼哼][右哼哼][哈欠][鄙视][委屈][快哭了][阴险][亲亲][可怜][菜刀][西瓜]
[啤酒][咖啡][猪头][玫瑰][凋谢][嘴唇][爱心][心碎][蛋糕][炸弹][便便][月亮]
[太阳][拥抱][强][弱][握手][胜利][抱拳][勾引][拳头][OK][跳跳][发抖][怄火][转圈]
[嘿哈][捂脸][奸笑][机智][皱眉][耶][茶][红包][蜡烛]*@
<script type="text/JavaScript" language="javascript">
var face = [{ name: "[微笑]", imgpath: "0.png" }, { name: "[撇嘴]", imgpath: "1.png" }, { name: "[色]", imgpath: "2.png" }, { name: "[发呆]", imgpath: "3.png" },
{ name: "[得意]", imgpath: "4.png" }, { name: "[流泪]", imgpath: "5.png" }, { name: "[害羞]", imgpath: "6.png" }, { name: "[闭嘴]", imgpath: "7.png" }, { name: "[睡]", imgpath: "8.png" },
{ name: "[大哭]", imgpath: "9.png" }, { name: "[尴尬]", imgpath: "10.png" }, { name: "[发怒]", imgpath: "11.png" }, { name: "[调皮]", imgpath: "12.png" },
{ name: "[呲牙]", imgpath: "13.png" }, { name: "[惊讶]", imgpath: "14.png" }, { name: "[难过]", imgpath: "15.png" }, { name: "[酷]", imgpath: "16.png" },
{ name: "[囧]", imgpath: "17.png" }, { name: "[抓狂]", imgpath: "18.png" }, { name: "[吐]", imgpath: "19.png" }, { name: "[偷笑]", imgpath: "20.png" },
{ name: "[愉快]", imgpath: "21.png" }, { name: "[白眼]", imgpath: "22.png" }, { name: "[傲慢]", imgpath: "23.png" },
{ name: "[饿]", imgpath: "24.png" }, { name: "[困]", imgpath: "25.png" }, { name: "[惊恐]", imgpath: "26.png" },
{ name: "[流汗]", imgpath: "27.png" }, { name: "[憨笑]", imgpath: "28.png" }, { name: "[悠闲]", imgpath: "29.png" }, { name: "[奋斗]", imgpath: "30.png" },
{ name: "[咒骂]", imgpath: "31.png" }, { name: "[疑问]", imgpath: "32.png" }, { name: "[嘘]", imgpath: "33.png" }, { name: "[晕]", imgpath: "34.png" },
{ name: "[疯]", imgpath: "35.png" }, { name: "[衰]", imgpath: "36.png" }, { name: "[骷髅]", imgpath: "37.png" },
{ name: "[敲打]", imgpath: "38.png" }, { name: "[再见]", imgpath: "39.png" }, { name: "[擦汗]", imgpath: "40.png" },
{ name: "[抠鼻]", imgpath: "41.png" }, { name: "[鼓掌]", imgpath: "42.png" }, { name: "[糟糕]", imgpath: "43.png" },
{ name: "[坏笑]", imgpath: "44.png" }, { name: "[左哼哼]", imgpath: "45.png" },
{ name: "[右哼哼]", imgpath: "46.png" }, { name: "[哈欠]", imgpath: "47.png" },
{ name: "[鄙视]", imgpath: "48.png" }, { name: "[委屈]", imgpath: "49.png" },
{ name: "[快哭了]", imgpath: "50.png" }, { name: "[阴险]", imgpath: "51.png" },
{ name: "[亲亲]", imgpath: "52.png" }, { name: "[吓]", imgpath: "53.png" },
{ name: "[可怜]", imgpath: "54.png" }, { name: "[菜刀]", imgpath: "55.png" },
{ name: "[西瓜]", imgpath: "56.png" }, { name: "[啤酒]", imgpath: "57.png" },
{ name: "[篮球]", imgpath: "58.png" }, { name: "[乒乓]", imgpath: "59.png" },
{ name: "[咖啡]", imgpath: "60.png" }, { name: "[美食]", imgpath: "61.png" },
{ name: "[猪头]", imgpath: "62.png" }, { name: "[玫瑰]", imgpath: "63.png" },
{ name: "[凋谢]", imgpath: "64.png" }, { name: "[嘴唇]", imgpath: "65.png" },
{ name: "[爱心]", imgpath: "66.png" }, { name: "[心碎]", imgpath: "67.png" },
{ name: "[蛋糕]", imgpath: "68.png" }, { name: "[电]", imgpath: "69.png" }, { name: "[炸弹]", imgpath: "70.gif" }, { name: "[便便]", imgpath: "71.gif" },
{ name: "[月亮]", imgpath: "72.gif" }, { name: "[太阳]", imgpath: "73.gif" }, { name: "[拥抱]", imgpath: "74.png" }, { name: "[强]", imgpath: "75.gif" }, { name: "[弱]", imgpath: "76.gif" },
{ name: "[握手]", imgpath: "77.gif" }, { name: "[胜利]", imgpath: "78.gif" }, { name: "[抱拳]", imgpath: "79.gif" }, { name: "[勾引]", imgpath: "80.gif" },
{ name: "[拳头]", imgpath: "81.gif" }, { name: "[OK]", imgpath: "82.gif" }, { name: "[跳跳]", imgpath: "83.gif" }, { name: "[发抖]", imgpath: "84.gif" },
{ name: "[怄火]", imgpath: "85.png" }, { name: "[转圈]", imgpath: "86.gif" }
];
</script>
<script type="text/javascript">
var sortBy = function (filed, rev, primer) {
rev = (rev) ? -1 : 1;
return function (a, b) {
a = a[filed];
b = b[filed];
if (typeof (primer) != 'undefined') {
a = primer(a);
b = primer(b);
}
if (a < b) { return rev * -1; }
if (a > b) { return rev * 1; }
return 1;
}
};
$(function () {
$("#friendList li").live("mouseover", function () {
$(this).addClass("rcontacthover");
}).live("mouseout", function () {
$(this).removeClass("rcontacthover");
}).live("click", function () {
$(".rcontactClick").removeClass("rcontactClick");
$(this).addClass("rcontactClick");
$("#rcontent").prev().find(".panel-title").html($(this).html() + "--聊天记录");
clickValue = $(this);
//GetMessage();
ShowMessage()
});
$("#export").click(function () {
var workusername = "@Html.Raw(Request.QueryString["workusername"])";
var worknickname = "@Html.Raw(ViewBag.workAccountName)";
var username = $(clickValue).attr("nvalue");
var nickname = $(clickValue).text();
if (username == "") {
alert("请选择一个客户!");
return;
}
if (workusername === "" || worknickname === "" || username === "" || nickname === "") {
alert("参数错误!");
return;
}
window.location.href = "Export?workusername=" + workusername + "&username=" + username + "&worknickname=" + worknickname + "&nickname=" + $.trim(nickname);
});
$("#rcontactsort").change(function () {
var workusername = "@Html.Raw(Request.QueryString["workusername"])";
var columnsort = $(this).val();
var column = "";
var sort = "";
if (columnsort !== "") {
var columnsortArr = columnsort.split('_');
column = columnsortArr[0];
sort = columnsortArr[1];
}
window.location.href = "MyMessage?workusername=" + workusername + "&column=" + column + "&sort=" + sort;
});
var c = getQueryString("column");
var s = getQueryString("sort");
$("#rcontactsort").val(c + "_" + s);
});
var clickValue;
function ShowMessage() {
$("#henniubai").html("");
if (clickValue == null)
return;
var isGroup = $(clickValue).attr("isgroup")
if (isGroup != "true") {
tab_option = $('#tt').tabs('getTab', "群发消息").panel('options').tab;
tab_option.show();
var tab = $('#tt').tabs('getTab', 0); // 取得第一个tab
$('#tt').tabs('update', {
tab: tab,
options: {
title: '消息内容'
}
});
$("#txtDate").attr("style", "");
$("#txtGL").attr("style", "");
GetMessage();
} else {
tab_option = $('#tt').tabs('getTab', "群发消息").panel('options').tab;
tab_option.hide();
$("#txtDate").attr("style", "display:none;");
$("#txtGL").attr("style", "display:none;");
GetGroupMessage();
}
}
var chatRoomNumber;
var chatName;
function GetGroupMessage() {
//ajaxLoading();
//=======================获取群成员信息================================================
chatName = $(clickValue).attr("nvalue");
var nrul = "/WeiXin/WorkAccount/GetGroupNumber?chatroom=" + chatName;
chatRoomNumber = [];
$.ajax({
type: "GET",
url: nrul,
dataType: "JSON",
async: false,
success: function (data) {
$(data).each(function (i, xn) {
chatRoomNumber[xn.username] = xn.nickname;
});
//alert("微信号:"+chatRoomNumber["wxid_h1sph8q2rgo722"]);
//=========================获取群消息文件==================================================
nrul = "/WeiXin/WorkAccount/GetMonthMessageJsonList?chatroom=" + chatName;
$.ajax({
type: "GET",
url: nrul,
dataType: "JSON",
async: false,
success: function (ndata) {
ndata = bubbleSort(ndata);
var nhtml = "";
$("#contentBody").html("");
$("#QunFacontentBody").html("");
$("#henniubai").html("");
if (ndata.length == null)
return;
$(ndata).each(function (i, xn) {
var txt = xn.replace(".json", "").replace(chatName + "_", "");
//alert(GetMonth(txt));
nhtml += "<a href='javascript:ShowGroupMonthMsg(\"" + xn + "\",\"" + txt + "\")'>" + txt + "<a>&nbsp;&nbsp;";
});
if (nhtml == "")
return;
$("#henniubai").html(nhtml);
var txt2 = ndata[0].replace(".json", "").replace(chatName + "_", "");
var tab = $('#tt').tabs('getTab', 0); // 取得第一个tab
$('#tt').tabs('update', {
tab: tab,
options: {
title: txt2
}
});
var url = "/Message/" + $(clickValue).attr("nvalue") + "/" + ndata[0] + "?i=" + GetGuid();
GetGroupMessageByUrl(url, "contentBody");
}
});
}
});
//ajaxLoadEnd();
}
//排序
function bubbleSort(arr) {
var len = arr.length, j;
var temp;
var wn, xn;
while (len > 0) {
for (j = 0; j < len - 1; j++) {
wn = GetMonth(arr[j].replace(".json", "").replace(chatName + "_", ""));
xn = GetMonth(arr[j + 1].replace(".json", "").replace(chatName + "_", ""));
if (arr[j] < arr[j + 1]) {
temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
len--;
}
return arr;
}
function GetMonth(xmn) {
if (xmn.length == 5) {
var mnmm = xmn.substring(0, 4) + "0" + xmn.substring(4, 5);
return mnmm;
}
else
return xmn;
}
function ShowGroupMonthMsg(month, txt) {
var tab = $('#tt').tabs('getTab', 0); // 取得第一个tab
$('#tt').tabs('update', {
tab: tab,
options: {
title: txt
}
});
$("#contentBody").html("");
$("#QunFacontentBody").html("");
var url = "/Message/" + $(clickValue).attr("nvalue") + "/" + month + "?i=" + GetGuid();
GetGroupMessageByUrl(url, "contentBody");
}
var mygroupmsgKey = {};
function GetGroupMessageByUrl(url, tabName) {
mygroupmsgKey = {};
$.ajax({
type: "GET",
url: url,
dataType: "text",
async: false,
success: function (data) {
var workAccountName = "@Html.Raw(ViewBag.workAccountName)";
var json = JSON.parse("[" + data + "]");
json.sort(sortBy('createTime', false, parseInt));
$(json).each(function (i, da) {
var newDate = new Date();
newDate.setTime(da.createTime);
var dataStr = getNowFormatDate(newDate);//聊天时间
var html = "";
//if (da.isSend == 1) {
// html += "<tr><td class=\"isSelf\">" + workAccountName + " " + dataStr + "</td></tr>";
//} else {
//alert("索引:"+da.content.indexOf(":"));
var username = da.content.substring(0, da.content.indexOf(":"));
var ShowName = username;
//alert(chatRoomNumber.length);
//alert("username" + username + ",ShowName:" + chatRoomNumber[username]);
if (da.msgSvrId.indexOf("-") > -1 && (da.type == 3 || da.type == 47 || da.type == 34 || da.type == 43 || da.type == 49)) {
return true;
}
if (mygroupmsgKey[da.msgSvrId] != null) {
return true;
} else {
mygroupmsgKey[da.msgSvrId] = "1";
}
if (chatRoomNumber[username] != null) {
ShowName = chatRoomNumber[username];
da.content = da.content.replace(username + ":", "");
}
if (username == "") {
ShowName = "系统消息";
}
if (username.indexOf("@Html.Raw("@chatroom")") > -1) {
ShowName = "系统消息";
}
if (username == "@Html.Raw(Request.QueryString["workusername"])") {
html += "<tr><td class=\"isSelf\">" + ShowName + " " + dataStr + "</td></tr>";
} else {
html += "<tr><td class=\"isFriend\">" + ShowName + " " + dataStr + "</td></tr>";
}
//}
if (da.type == 3) {
html += "<tr><td class=\"message\">[图片]<img style='max-width:300px' id='file_" + da.msgSvrId + "' src=''></td></tr>";
$("#" + tabName).append(html);
GetImage(da);
} else if (da.type == 47) {
if (da.url != "" && da.url != "null") {
html += "<tr><td class=\"message\"><img style='max-width:100px' id='file_" + da.msgSvrId + "' src='" + da.url + "'></td></tr>";
$("#" + tabName).append(html);
} else {
html += "<tr><td class=\"message\"><img style='max-width:100px' id='file_" + da.msgSvrId + "' src=''></td></tr>";
$("#" + tabName).append(html);
GetImage(da);
}
} else if (da.type == 34) {
html += "<tr><td class=\"message\"><a id='file_" + da.msgSvrId + "' >[语音]<a></td></tr>";
$("#" + tabName).append(html);
GetImage(da);
} else if (da.type == 43) {
html += "<tr><td class=\"message\"><a id='file_" + da.msgSvrId + "' >[视频]<a></td></tr>";
$("#" + tabName).append(html);
GetImage(da);
} else if (da.type == 49) {
html += "<tr><td class=\"message\"><a id='file_" + da.msgSvrId + "' >[文件]<a></td></tr>";
$("#" + tabName).append(html);
GetImage(da);
}
else {//普通文本
html += "<tr><td class=\"message\">" + replaceFace(da.content) + "</td></tr>";
//if (!IsContainMobile(html)) {
//$("#" + tabName).append(html);
$("#" + tabName).append(ReplaceMobile(html));
//}
}
});
}
});
}
//普通消息
var mymsgKey = {};
function GetMessage() {
ajaxLoading();
var txtDate = $("#txtDate").val();
if (txtDate != "") {
$("#contentBody").html("");
var getDate = txtDate.replace("-", "");
var url = "/Message/@Html.Raw(Request.QueryString["workusername"])/" + $(clickValue).attr("nvalue") + "_" + getDate + ".json?i=" + GetGuid();
//alert(url);
GetMessageByUrl(url, "contentBody");
} else {//如果默认没有选择时间,显示最近6个月数据
$("#contentBody").html("");
$("#QunFacontentBody").html("");
var arrayObj = new Array(); //创建一个数组
arrayObj[6] = "@Html.Raw(DateTime.Now.ToString("yyyyM"))";//当前月2017/2
arrayObj[5] = "@Html.Raw(DateTime.Now.AddMonths(-1).ToString("yyyyM"))";//前一个月2017/1
arrayObj[4] = "@Html.Raw(DateTime.Now.AddMonths(-2).ToString("yyyyM"))";//前两个月2016/12
arrayObj[3] = "@Html.Raw(DateTime.Now.AddMonths(-3).ToString("yyyyM"))";//前三个月2016/11
arrayObj[2] = "@Html.Raw(DateTime.Now.AddMonths(-4).ToString("yyyyM"))";//前四个月2016/10
arrayObj[1] = "@Html.Raw(DateTime.Now.AddMonths(-5).ToString("yyyyM"))";//前五个月2016/9
arrayObj[0] = "@Html.Raw(DateTime.Now.AddMonths(-6).ToString("yyyyM"))";//前六个月2016/8
mymsgKey = {};
$(arrayObj).each(function (i, n) {
var url = "/Message/@Html.Raw(Request.QueryString["workusername"])/" + $(clickValue).attr("nvalue") + "_" + n + ".json?i=" + GetGuid();
GetMessageByUrl(url, "contentBody");
});
var nurl = "/Message/@Html.Raw(Request.QueryString["workusername"])/" + $(clickValue).attr("nvalue") + "_qunfa.json?i=" + GetGuid();
GetMessageByUrl(nurl, "QunFacontentBody");
}
ajaxLoadEnd();
}
function GetMessageByUrl(url, tabName) {
$.ajax({
type: "GET",
url: url,
dataType: "text",
async: false,
success: function (data) {
var workAccountName = "@Html.Raw(ViewBag.workAccountName)";
var json = JSON.parse("[" + data + "]");
json.sort(sortBy('createTime', false, parseInt));
$(json).each(function (i, da) {
var newDate = new Date();
newDate.setTime(da.createTime);
var dataStr = getNowFormatDate(newDate);//聊天时间
var html = "";
if (da.msgSvrId.indexOf("-") > -1 && (da.type == 3 || da.type == 47 || da.type == 34 || da.type == 43 || da.type == 49)) {
return true;
}
if (mymsgKey[da.msgSvrId] != null) {
return true;
} else {
mymsgKey[da.msgSvrId] = "1";
}
if (da.isSend == 1) {
html += "<tr><td class=\"isSelf\">" + workAccountName + " " + dataStr + "</td></tr>";
} else {
html += "<tr><td class=\"isFriend\">" + ReplaceMobile(da.nickname) + " " + dataStr + "</td></tr>";
}
if (da.type == 3) {
html += "<tr><td class=\"message\">[图片]<img style='max-width:300px' id='file_" + da.msgSvrId + "' src=''></td></tr>";
$("#" + tabName).append(html);
GetImage(da);
} else if (da.type == 47) {
if (da.url != "" && da.url != "null") {
html += "<tr><td class=\"message\"><img style='max-width:100px' id='file_" + da.msgSvrId + "' src='" + da.url + "'></td></tr>";
$("#" + tabName).append(html);
} else {
html += "<tr><td class=\"message\"><img style='max-width:100px' id='file_" + da.msgSvrId + "' src=''></td></tr>";
$("#" + tabName).append(html);
GetImage(da);
}
} else if (da.type == 34) {
html += "<tr><td class=\"message\"><a id='file_" + da.msgSvrId + "' >[语音]<a></td></tr>";
$("#" + tabName).append(html);
GetImage(da);
} else if (da.type == 43) {
html += "<tr><td class=\"message\"><a id='file_" + da.msgSvrId + "' >[视频]<a></td></tr>";
$("#" + tabName).append(html);
GetImage(da);
} else if (da.type == 49) {
html += "<tr><td class=\"message\"><a id='file_" + da.msgSvrId + "' >[文件]<a></td></tr>";
$("#" + tabName).append(html);
GetImage(da);
}
else {//普通文本
html += "<tr><td class=\"message\">" + replaceFace(da.content) + "</td></tr>";
//if (!IsContainMobile(html)) {
$("#" + tabName).append(ReplaceMobile(html));
//}
}
});
}
});
}
function GetImage(da) {
//var isShare = "@string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["IsShare"])";
var isShare ="True";
if (isShare == "False") {
if (da.type == 3 || da.type == 47) {
$("#file_" + da.msgSvrId).attr("src", "http://192.168.1.132:809/FilePath2.ashx?msgSvrId=" + da.msgSvrId + "&msgType=" + da.type);
}
else if (da.type == 43 || da.type == 49) {
$("#file_" + da.msgSvrId).attr("target", "_blank").attr("href", "http://192.168.1.132:809/FilePath2.ashx?msgSvrId=" + da.msgSvrId + "&msgType=" + da.type);
}
else if (da.type == 34) {
$.ajax({
url: GetTrueUlr("@Html.Raw(System.Configuration.ConfigurationManager.AppSettings["WeiXinFilePath"])") + da.msgSvrId + "?i=" + GetGuid(),
type: "GET",
dataType: "json",
loading: true,
success: function (data) {
if (data.retmsg != null) {
var index = data.retmsg.indexOf("_");
var msgsId = data.retmsg.substring(0, index);
var path = GetTrueUlr(data.retmsg.substring(index + 1, data.retmsg.length));
$("#file_" + msgsId).attr("href", "javascript:void(0);").attr("onclick", "PalyRecord('" + path + "','" + da.msgSvrId + "');");
}
}
});
}
}
else {
$.ajax({
url: GetTrueUlr("@Html.Raw(System.Configuration.ConfigurationManager.AppSettings["WeiXinFilePath"])") + da.msgSvrId + "?i=" + GetGuid(),
type: "GET",
dataType: "json",
loading: true,
success: function (data) {
if (data.retmsg != null) {
var index = data.retmsg.indexOf("_");
var msgsId = data.retmsg.substring(0, index);
var path = GetTrueUlr(data.retmsg.substring(index + 1, data.retmsg.length));
if (da.type != 34) {
$("#file_" + msgsId).attr("src", path);
$("#file_" + msgsId).attr("href", path);
$("#file_" + msgsId).attr("target", "_blank");
} else {
$("#file_" + msgsId).attr("href", "javascript:void(0);").attr("onclick", "PalyRecord('" + path + "');");
}
}
}
});
}
}
//替换表情
function replaceFace(cotent) {
var txt = cotent;
$(face).each(function (i, n) {
while (txt.indexOf(n.name) > -1) {
txt = txt.replace(n.name, "<img src=\"/Face/" + n.imgpath + "\">");
}
});
return txt;
}
function ReplaceMobile(content) {
var txt = content;
//var myreg = /(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(18[0-9]{1}|(17[0-9]{1}))|(19[0-9]{1}))+\d{8})/;
//var reg = new RegExp(myreg, "g");
//if (txt.match(reg)) {
// var res = txt.match(reg);
// $(res).each(function (i, m) {
// var mm = m.replace(/(\d{3})\d{5}(\d{3})/, '$1*****$2');
// txt = txt.replace(m, mm);
// })
//}
var reg = /[1][0-9]{10}/;
if (reg.test(txt)) {
var res = txt.match(reg);
$(res).each(function (i, m) {
var mm = m.replace(/(\d{3})\d{5}(\d{3})/, '$1*****$2');
txt = txt.replace(m, mm);
})
}
return txt;
}
function IsContainMobile(content)
{
var txt = content;
//匹配是否有红包信息,有红包信息直接返回
if (txt.match(/(weixin:\/\/weixinhongbao)/g)) {
return false;
}
//var myreg = /(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(18[0-9]{1}|(17[0-9]{1}))|(19[0-9]{1}))+\d{8})/;
//var reg = new RegExp(myreg, "g");
//if (txt.match(reg)) {
// return true;
//}
//return false;
var reg = /[1][0-9]{10}/;
return reg.test(txt);
}
//linux时间格式化
function getNowFormatDate(date) {
//var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + date.getHours() + seperator2 + date.getMinutes()
+ seperator2 + date.getSeconds();
return currentdate;
}
function findTxt() {
$(".displayLi").each(function (i, n) {
$(this).removeClass("displayLi");
});
$(".redColor").each(function (i, n) {
$(this).after($(this).attr("ntitle"));
$(this).remove();
});
var txt = $("#findTxt").val();
if (txt == "")
return;
$("#friendList li").each(function () {
var html = $(this).html();
html = html.replace(txt, "<b ntitle=\"" + txt + "\" class=\"redColor\">" + txt + "</b>");
$(this).html(html);
if (html.indexOf("redColor") == -1) {
$(this).addClass("displayLi");
}
});
//var reg2 = new RegExp("\\" + escape(txt), "g");
}
function PalyRecord(url,msgSvrId) {
$.post("/Weixin/WorkAccount/Audio", { url: url }, function (result) {
if (result.result === "ok") {
var data = result.data;
//var isShare = "@string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["IsShare"])";
var isShare ="True";
if (isShare == "False") {
data = "http://192.168.1.132:809/FilePath2.ashx?msgSvrId=" + msgSvrId + "&msgType=34";
}
$('#recordPlayerWin').window({ title: '播放录音', width: 330, height: 180, iconCls: 'icon-add', shadow: true, modal: true, closed: true, minimizable: false, maximizable: false, collapsible: false }).window('open');
var isChrome = window.navigator.userAgent.indexOf("Chrome") !== -1;
if (isChrome) {
$('#recordPlayerWin').html("<video controls=\"\" src=\"" + data + "\" style=\"width:300px; height:50px;\" autoplay=\"autoplay\" />");
} else {
$('#recordPlayerWin').html('<object id="Player" width="300" height="50" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"hspace="5"><param name="AutoRewind" value="1"><param name="FileName" value="' + data + '"><param name="ShowControls" value="1"><param name="ShowPositionControls" value="0"><param name="ShowAudioControls" value="1"><param name="ShowTracker" value="1"><param name="ShowDisplay" value="0"><param name="ShowStatusBar" value="0"><param name="ShowGotoBar" value="0"><param name="ShowCaptioning" value="0"><param name="AutoStart" value="1"><param name="Volume" value="5000"><param name="AnimationAtStart" value="0"><param name="TransparentAtStart" value="0"><param name="AllowChangeDisplaySize" value="0"><param name="AllowScan" value="0"><param name="EnableContextMenu" value="0"><param name="ClickToPlay" value="1"> </object>');
}
} else {
alert("转换失败,请稍后重试!");
}
});
}
</script>
<script>
function GetTrueUlr(purl) {
if (purl == null)
return purl;
var realhost = window.location.host;//当前域名
if (purl.indexOf(realhost) > -1) {//如果包含真的域名则直接返回
return purl;
} else {//不等于真实域名
purl = purl.replace("http://", "");
if (purl.indexOf(":") > -1)
purl = "http://" + realhost.substring(0, realhost.indexOf(":")) + purl.substring(purl.indexOf(":"));
else
purl = "http://" + realhost.substring(0, realhost.indexOf(":")) + purl.substring(purl.indexOf("/"));
return purl;
}
}
</script>
@{
List<WX_WorkRCONTACT> rcontact1 = new List<WX_WorkRCONTACT>();
List<WX_WorkRCONTACT> rcontact2 = new List<WX_WorkRCONTACT>();
List<WX_WorkRCONTACT> rcontact3 = new List<WX_WorkRCONTACT>();
List<WX_WorkRCONTACT> rcontact4 = new List<WX_WorkRCONTACT>();
List<WX_WorkRCONTACT> rcontact5 = new List<WX_WorkRCONTACT>();
List<Wx_WorkGroupRcontact> groupList = ViewBag.grouplist as List<Wx_WorkGroupRcontact>;
string isShowGroupMsg = ViewBag.isShowGroupMessage as string;
foreach (WX_WorkRCONTACT rcontact in ViewBag.rcontactList as List<WX_WorkRCONTACT>)
{
if (rcontact.isblacklist == 1)
{
rcontact4.Add(rcontact);
}
else if (rcontact.isunservedlist == 1)
{
rcontact5.Add(rcontact);
}
else if (!string.IsNullOrEmpty(rcontact.WUSERNAME) || !string.IsNullOrEmpty(rcontact.NUSERNAME) || rcontact.NICKNAME.IndexOf("证券之星") > -1)
{
rcontact3.Add(rcontact);
}
else if (!string.IsNullOrEmpty(rcontact.FUSERNAME))
{
rcontact1.Add(rcontact);
}
else
{
rcontact2.Add(rcontact);
}
}
}
<div id="wochalei" data-options="region:'west',title:'分组',split:true" style="width:200px;">
<div id="friendList" class="easyui-accordion" style="background-color: #536484;" data-options="animate:false,fit:true">
<div title="被加/推广" style="background-color: #536484;">
<ul id="rcontact1">
@foreach (WX_WorkRCONTACT rcontact in rcontact1)
{
string text = "";
if (rcontact.USERNAME.StartsWith("fake_") || rcontact.USERNAME == "filehelper" || rcontact.NICKNAME == "微信团队")
{
continue;
}
<li isgroup="false" nvalue="@Html.Raw(rcontact.USERNAME)" title="@Html.Raw("最近聊天:" + (rcontact.LASTCHARTIME == 0 ? "无" : DateTimeTool.GetTimeFromLinuxTime(Convert.ToInt64(rcontact.LASTCHARTIME)).ToString("yyyy-MM-dd")))">
<span> @Html.Raw(WX.CRM.Common.Utility.ReplaceMobile(WX.CRM.WEB.Handler.WxMessageHandler.GetRcontactNickName(rcontact)))</span>
</li>
}
</ul>
</div>
<div title="我加/其它" style="background-color: #536484;">
<ul id="rcontact2">
@foreach (WX_WorkRCONTACT rcontact in rcontact2)
{
string text = "";
if (rcontact.USERNAME.StartsWith("fake_") || rcontact.USERNAME == "filehelper" || rcontact.NICKNAME == "微信团队")
{
continue;
}
<li isgroup="false" nvalue="@Html.Raw(rcontact.USERNAME)" title="@Html.Raw("最近聊天:" + (rcontact.LASTCHARTIME == 0 ? "无" : DateTimeTool.GetTimeFromLinuxTime(Convert.ToInt64(rcontact.LASTCHARTIME)).ToString("yyyy-MM-dd")))">
<span> @Html.Raw(WX.CRM.Common.Utility.ReplaceMobile(WX.CRM.WEB.Handler.WxMessageHandler.GetRcontactNickName(rcontact)))</span>
</li>
}
</ul>
</div>
<div title="拉黑/删除" style="background-color: #536484;">
<ul id="rcontact4">
@foreach (WX_WorkRCONTACT rcontact in rcontact4)
{
string text = "";
if (rcontact.USERNAME.StartsWith("fake_") || rcontact.USERNAME == "filehelper" || rcontact.NICKNAME == "微信团队")
{
continue;
}
<li isgroup="false" nvalue="@Html.Raw(rcontact.USERNAME)" title="@Html.Raw("最近聊天:" + (rcontact.LASTCHARTIME == 0 ? "无" : DateTimeTool.GetTimeFromLinuxTime(Convert.ToInt64(rcontact.LASTCHARTIME)).ToString("yyyy-MM-dd")))">
<span> @Html.Raw(WX.CRM.Common.Utility.ReplaceMobile(WX.CRM.WEB.Handler.WxMessageHandler.GetRcontactNickName(rcontact)))</span>
</li>
}
</ul>
</div>
<div title="未服务推广资源" style="background-color: #536484;">
<ul id="rcontact5">
@foreach (WX_WorkRCONTACT rcontact in rcontact5)
{
string text = "";
if (rcontact.USERNAME.StartsWith("fake_") || rcontact.USERNAME == "filehelper" || rcontact.NICKNAME == "微信团队")
{
continue;
}
<li isgroup="false" nvalue="@Html.Raw(rcontact.USERNAME)" title="@Html.Raw("最近聊天:"+(rcontact.LASTCHARTIME == 0 ? "无" : DateTimeTool.GetTimeFromLinuxTime(Convert.ToInt64(rcontact.LASTCHARTIME)).ToString("yyyy-MM-dd")))">
<span> @Html.Raw(WX.CRM.Common.Utility.ReplaceMobile(WX.CRM.WEB.Handler.WxMessageHandler.GetRcontactNickName(rcontact)))</span>
</li>
}
</ul>
</div>
<div title="同事" style="background-color: #536484;">
<ul id="rcontact3">
@foreach (WX_WorkRCONTACT rcontact in rcontact3)
{
string text = "";
if (rcontact.USERNAME.StartsWith("fake_") || rcontact.USERNAME == "filehelper" || rcontact.NICKNAME == "微信团队")
{
continue;
}
<li isgroup="false" nvalue="@Html.Raw(rcontact.USERNAME)" title="@Html.Raw("最近聊天:" + (rcontact.LASTCHARTIME == 0 ? "无" : DateTimeTool.GetTimeFromLinuxTime(Convert.ToInt64(rcontact.LASTCHARTIME)).ToString("yyyy-MM-dd")))">
<span> @Html.Raw(WX.CRM.Common.Utility.ReplaceMobile(WX.CRM.WEB.Handler.WxMessageHandler.GetRcontactNickName(rcontact)))</span>
</li>
}
</ul>
</div>
@if (isShowGroupMsg == "true")
{
<div title="微信群" style="background-color: #536484;">
<ul id="rcontact4">
@foreach (Wx_WorkGroupRcontact group in groupList)
{
string text = "";
if (group.chatRoomName.StartsWith("fake_") || group.chatRoomName == "filehelper" || group.chatRoomName == "微信团队")
{
continue;
}
<li isgroup="true" nvalue="@Html.Raw(group.chatRoomName)" title="@Html.Raw("最近聊天:" + (group.LASTCHARTIME == 0 ? "无" : DateTimeTool.GetTimeFromLinuxTime(Convert.ToInt64(group.LASTCHARTIME)).ToString("yyyy-MM-dd")))">
<span> @Html.Raw(string.IsNullOrEmpty(group.groupName) ? group.shortName : group.groupName)</span>
</li>
}
</ul>
</div>
}
</div>
</div>
<div id="rcontent" data-options="region:'center',title:'消息内容'" style="">
<div id="tt" class="easyui-tabs" data-options="fit:true" style="width:500px;height:250px;">
<div title="消息内容" style="padding: 5px;" data-options="fit:true">
<table class="contentTable">
<tbody id="contentBody"></tbody>
</table>
</div>
<div title="群发消息" data-options="closable:false,fit:true" style="overflow:auto;padding:5px;">
<table class="contentTable">
<tbody id="QunFacontentBody"></tbody>
</table>
</div>
</div>
</div>
<div data-options="region:'south',border:false" style="height: 30px; background-color: #E4EBF9">
昵称:<input type="text" id="findTxt" /><input type="button" value="查找" onclick="findTxt()" />
<input id='txtDate' name='txtDate' class='Wdate' type='text' value='' onclick="WdatePicker({ dateFmt: 'yyyy-M', isShowToday: false, isShowClear: false })" />
<input id="txtGL" type="button" value="过滤" onclick="ShowMessage()" />
排序:<select id="rcontactsort">
<option value=""></option>
<option value="ctime_asc">客户添加时间倒序↓</option>
<option value="ctime_desc">客户添加时间顺序↑</option>
<option value="lastchattime_asc">最后聊天时间倒序↓</option>
<option value="lastchattime_desc">最后聊天时间顺序↑</option>
</select>
<input type="button" value="导出" id="export" />
<input type="hidden" value="添加合规信息" id="messageCompliance" onclick="MessageCompliance_Click();" />
<span id="henniubai"></span>
</div>
<div id="recordPlayerWin"></div>
<script type="text/javascript">
function GetIframeHtml(src) {
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
}
function MessageCompliance_Click() {
var jobUserName = "@Html.Raw(Request.QueryString["workusername"])";
var username = $(clickValue).attr("nvalue");
$("#modalwindow").html(GetIframeHtml("/WeiXin/WorkAccount/AddCompliance?jobUserName=" + jobUserName + "&Ieguid=" + GetGuid()));
$("#modalwindow").window({ title: '添加', width: 700, height: 600, iconCls: 'icon-edit' }).window('open');
}
</script>