417 lines
17 KiB
Plaintext
417 lines
17 KiB
Plaintext
@{
|
||
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" src="~/Scripts/wxface.js"></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 nickname = "@Html.Raw(Request.QueryString["nickname"])";
|
||
if (nickname != "")
|
||
{
|
||
$("#findTxt").val(nickname);
|
||
findTxt();
|
||
}
|
||
});
|
||
var clickValue;
|
||
//排序
|
||
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 GetMessage() {
|
||
ajaxLoading();
|
||
var txtDate = $("#txtDate").val();
|
||
if (txtDate != "") {
|
||
$("#contentBody").html("");
|
||
var getDate = txtDate.replace("-", "");
|
||
var url = "/MessageGh/@Html.Raw(Request.QueryString["accountNum"])/" + $(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("yyyyMM"))";//当前月2017/2
|
||
arrayObj[5] = "@Html.Raw(DateTime.Now.AddMonths(-1).ToString("yyyyMM"))";//前一个月2017/1
|
||
arrayObj[4] = "@Html.Raw(DateTime.Now.AddMonths(-2).ToString("yyyyMM"))";//前两个月2016/12
|
||
arrayObj[3] = "@Html.Raw(DateTime.Now.AddMonths(-3).ToString("yyyyMM"))";//前三个月2016/11
|
||
arrayObj[2] = "@Html.Raw(DateTime.Now.AddMonths(-4).ToString("yyyyMM"))";//前四个月2016/10
|
||
arrayObj[1] = "@Html.Raw(DateTime.Now.AddMonths(-5).ToString("yyyyMM"))";//前五个月2016/9
|
||
arrayObj[0] = "@Html.Raw(DateTime.Now.AddMonths(-6).ToString("yyyyMM"))";//前六个月2016/8
|
||
$(arrayObj).each(function (i, n) {
|
||
var url = "/MessageGh/@Html.Raw(Request.QueryString["accountNum"])/" + $(clickValue).attr("nvalue") + "/" + n + ".json?i=" + GetGuid();
|
||
GetMessageByUrl(url, "contentBody");
|
||
});
|
||
|
||
}
|
||
ajaxLoadEnd();
|
||
}
|
||
function GetMessageByUrl(url, tabName) {
|
||
|
||
$.ajax({
|
||
type: "GET",
|
||
url: url,
|
||
dataType: "text",
|
||
async: false,
|
||
success: function (data) {
|
||
var nickName = "";
|
||
for(var name in customerList)
|
||
{
|
||
if(customerList[name].OpenId == $(clickValue).attr("nvalue"))
|
||
{
|
||
nickname = customerList[name].NickName;
|
||
}
|
||
}
|
||
var workAccountName = "@Html.Raw(ViewBag.SaleUserName)";
|
||
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 {
|
||
html += "<tr><td class=\"isFriend\">" + nickname + " " + dataStr + "</td></tr>";
|
||
}
|
||
|
||
if (da.MsgType == "image") {
|
||
html += "<tr><td class=\"message\"><img style='max-width:250px;' src='http://192.168.1.132/weappfile/" + da.Path + "' /></td><tr>"
|
||
} else {
|
||
html += "<tr><td class=\"message\">" + replaceFace(da.Content) + "</td></tr>";
|
||
}
|
||
|
||
//html += "<tr><td class=\"message\">" + da.Content + "</td></tr>";
|
||
$("#" + tabName).append(html);
|
||
});
|
||
}
|
||
});
|
||
}
|
||
|
||
function GetImage(da) {
|
||
$.ajax({
|
||
url: "@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 = 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 + "');");
|
||
}
|
||
}
|
||
}, error: function () {
|
||
|
||
}
|
||
});
|
||
}
|
||
//替换表情
|
||
function replaceFace(cotent) {
|
||
var txt = cotent;
|
||
$(face).each(function (i, n) {
|
||
while (txt.indexOf(n.code) > -1) {
|
||
txt = txt.replace(n.code, "<img src=\"/Face/" + n.imgpath + "\">");
|
||
}
|
||
});
|
||
return 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) {
|
||
$.post("/Weixin/WorkAccount/Audio", { url: url }, function (result) {
|
||
if (result.result === "ok") {
|
||
var data = result.data;
|
||
$('#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("转换失败,请稍后重试!");
|
||
}
|
||
});
|
||
|
||
}
|
||
var customerList = @Html.Raw(ViewBag.customerList)
|
||
</script>
|
||
|
||
<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">
|
||
@{
|
||
foreach (var item in ViewBag.GroupList)
|
||
{
|
||
<div title="@item.GroupName" style="background-color: #536484;">
|
||
<ul>
|
||
@foreach (var user in item.UserGroupList)
|
||
{
|
||
@*<li isgroup="false" nvalue="@Html.Raw(user.OpenId)" title="@Html.Raw("最近聊天:" + (rcontact.LASTCHARTIME == 0 ? "无" : DateTimeTool.GetTimeFromLinuxTime(Convert.ToInt64(rcontact.LASTCHARTIME)).ToString("yyyy-MM-dd")))">
|
||
<span> @Html.Raw(WX.CRM.WEB.Handler.WxMessageHandler.GetRcontactNickName(rcontact))</span>
|
||
</li>*@
|
||
<li isgroup="false" nvalue="@Html.Raw(user.OpenId)"><span>@Html.Raw(user.NickName)</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>
|
||
|
||
</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-MM', 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>
|
||
|
||
|