ComplianceServer/oldcode/Core.Web/Views/QwMessage/Index.cshtml

442 lines
21 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 = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="~/Scripts/jquery.highlight.js"></script>
<form class="layui-form" action="">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">时间过滤:</label>
<div class="layui-input-inline" style="width:100px;vertical-align: middle;">
<input type="text" class="layui-input" id="stime" value="@Html.Raw(DateTime.Now.AddYears(-1).ToString("yyyy-MM"))" placeholder="yyyy-MM">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width:100px;vertical-align: middle;">
<input type="text" class="layui-input" id="etime" value="@Html.Raw(DateTime.Now.ToString("yyyy-MM"))" placeholder="yyyy-MM">
</div>
<div class="layui-input-inline">
<input type="button" class="layui-btn layui-btn-sm" lay-filter="demo2" id="dataGL" value="确定" />
</div>
</div>
</div>
</form>
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<ul class="layui-tab-title">
<li class="layui-this">聊天记录</li>
</ul>
<div class="layui-tab-content" style="height: 100px;">
<div class="layui-tab-item layui-show">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
<legend id="msg_title">聊天记录:</legend>
</fieldset>
<ul class="layui-timeline" id="contentBody"></ul>
</div>
</div>
</div>
<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>
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 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;
}
//JavaScript代码区域
layui.use('element', function () {
var element = layui.element;
});
layui.use(['form', 'layedit', 'laydate'], function () {
var form = layui.form
, layer = layui.layer
, layedit = layui.layedit
, laydate = layui.laydate;
//日期
laydate.render({
elem: '#stime'
, type: 'month'
});
//日期
laydate.render({
elem: '#etime'
, type: 'month'
});
});
var host = "@Html.Raw(System.Configuration.ConfigurationManager.AppSettings["WxMessage_" + @Request.QueryString["companyCode"]])";
$(function () {
//$(".layui-nav-child a").click(function () {
// var username = $(this).attr("nvalue");
// $("#msg_title").html($(this).attr("title"));
// $("#msg_title2").html($(this).attr("title"));
// ShowMessage(username);
//});
$("#btnSearch").click(function () {
$(".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;
$("#allfriend dd").each(function () {
var html = $(this).children("a").html();
//console.log(html);
html = html.replace(txt, "<b ntitle=\"" + txt + "\" class=\"redColor\">" + txt + "</b>");
$(this).children("a").html(html);
if (html.indexOf("redColor") == -1) {
$(this).addClass("displayLi");
}
});
});
//$("#dataGL").click(function () {
// var choosedd = $("#allfriend .layui-this");
// if (choosedd.length==0) {
// layer.msg('请选择微信好友!');
// } else {
// var username = $(choosedd).children().attr("nvalue")
// ShowMessage(username);
// }
//});
ShowMessage();
var keywork = "承诺;保证;预期;收益;幅度;达到;超过;至少;最少;不低于;必然;涨停;私下;操盘;损失;赔偿;盈利;抱怨;投诉;退;推;荐;比例;收益率;准确率;加仓;减仓;解套";
var keyworkArr = keywork.split(";");
$(this.body).highlight(keyworkArr);
});
function ShowMessage() {
$("#contentBody").html("");
var nomessage = "<li class='layui-timeline-item' id='nomessage'>"+
"<i class='layui-icon layui-timeline-axis'></i >" +
"<div class='layui-timeline-content layui-text'>" +
"<h4 class='layui-timeline-title' style='color:red; '>温馨提示:</h4>" +
"<p>无聊天记录。(时间范围内无聊天记录)</p></div></li >";
//var qunfanomessage = "<li class='layui-timeline-item' id='nomessage'>" +
// "<i class='layui-icon layui-timeline-axis'></i >" +
// "<div class='layui-timeline-content layui-text'>" +
// "<h4 class='layui-timeline-title' style='color:red; '>温馨提示:</h4>" +
// "<p>无群发记录。</p></div></li >";
$("#contentBody").html(nomessage);
//$("#qunfabody").html(qunfanomessage);
var stime = $("#stime").val();
var etime = $("#etime").val();
var arrayObj = new Array(); //创建一个数组
var needrun = true;
var o = 0;
var stime_int = parseInt(stime.replace('-', ''));//起始时间转换成Int
var etime_int = parseInt(etime.replace('-', ''));//结束时间转换成Int
var rawtime_int = stime_int;//中间时间
if (stime_int > etime_int) {
return;
}
else if (stime_int == etime_int) {
arrayObj[0] = stime_int.toString();
} else {
arrayObj[o] = stime_int.toString();
while (needrun) {
o++;
var rawtime_str = rawtime_int.toString();
var year = rawtime_str.substring(0, 4);
var month = rawtime_str.substring(4, 6);
if (month == "12") {//如果是12月份
rawtime_int = parseInt("" + (parseInt(year) + 1) + "01");
} else {
rawtime_int++;
}
arrayObj[o] = rawtime_int.toString();
if (rawtime_int >= etime_int) {
needrun = false;
}
}
}
var vid = "@Html.Raw(Request.QueryString["vid"])";
var vname = "@Html.Raw(Request.QueryString["vname"])";
var remoteid = "@Html.Raw(Request.QueryString["remoteid"])";
var remotename = "@Html.Raw(Request.QueryString["remotename"])";
$(arrayObj).each(function (i, n) {
var url = host + "/WeWorkMessage/" + n + "/" + vid + "/" + remoteid + ".json?i=" + GetGuid();
GetMessageByUrl(url, "contentBody", vid, vname, remoteid, remotename);
});
}
var selftemplete="<li class='layui-timeline-item'>"+
"<i class='layui-icon layui-timeline-axis'></i>"+
"<div class='layui-timeline-content layui-text'> "+
"<h4 class='layui-timeline-title' style='color:#42B475;'>[title]</h4> "+
"<p>[content]</div></li>";
var outtemplete = "<li class='layui-timeline-item'>" +
"<i class='layui-icon layui-timeline-axis'></i>" +
"<div class='layui-timeline-content layui-text'> " +
"<h4 class='layui-timeline-title' style='color:#006EFE;'>[title]</h4> " +
"<p>[content]</p></div></li>";
function GetMessageByUrl(url, tabName, vid, vname, remoteid, remotename) {
$.ajax({
type: "GET",
url: url,
dataType: "text",
async: false,
success: function (data) {
//console.log(data);
var workAccountName = vname;
var json = JSON.parse("[" + data + "]");
json.sort(sortBy('createTime', false, parseInt));
if (json.length > 0) {
$("#" + tabName).find("#nomessage").remove();
}
$(json).each(function (i, da) {
//var newDate = new Date();
//newDate.setTime(da.createTime);
var dataStr = da.sendTime;//聊天时间
var html = "";
if (da.sender == vid) {
html = selftemplete.replace("[title]", workAccountName + " " + dataStr);
} else {
html = outtemplete.replace("[title]", ReplaceMobile(remotename) + " " + dataStr);
}
if (da.contentType == 101 || da.contentType == 14) {
html = html.replace("[content]", "[图片]<img onclick='openImg(this)' style='max-width:300px; cursor: Pointer;' id='file_" + da.id + "' src='' md5='" + da.fileMd5 + "' maxMd5='" + da.maxMd5 + "' smallMd5='" + da.smallMd5 + "'>");
$("#" + tabName).append(html);
GetFilPath(da);
} else if (da.contentType == 16) {
html = html.replace("[content]", "<a id='file_" + da.id + "' maxMd5='" + da.maxMd5 + "' smallMd5='" + da.smallMd5 + "'>[语音]<a>");
$("#" + tabName).append(html);
GetFilPath(da);
} else if (da.contentType == 103 || da.contentType == 23) {
html = html.replace("[content]", "<a id='file_" + da.id + "' md5='" + da.fileMd5 + "' maxMd5='" + da.maxMd5 + "' smallMd5='" + da.smallMd5 + "'>[视频]<a>");
$("#" + tabName).append(html);
GetFilPath(da);
} else if (da.contentType == 104 || da.contentType == 29) {
html = html.replace("[content]", "<img style='max-width:100px' id='file_" + da.id + "' src='" + da.url + "'>")
$("#" + tabName).append(html);
}
else {//普通文本
html = html.replace("[content]", replaceFace(da.content));
$("#" + tabName).append(ReplaceMobile(html));
}
});
}
});
}
function GetFilPath(da) {
if (da.maxMd5 == null || da.maxMd5=="")
return;
var maxmd5 = da.maxMd5;
var smallmd5 = da.smallMd5;
if (da.smallMd5 == null || da.smallMd5 == "") {
smallmd5 = "-1";
}
$.ajax({
url: host + "/WeWorkFilePath.svc/Search/" + maxmd5 + "/" + smallmd5 + "?i=" + GetGuid(),
type: "GET",
dataType: "json",
loading: true,
success: function (data) {
if (data.result == true) {
var maxmd5= data.maxMd5;
var smallMd5 = data.smallMd5;
var maxPath = data.maxPath;
var smallPath = data.smallPath;
if (maxPath != "" && maxPath != undefined && maxPath != null) {
maxPath = maxPath.replace(/^http:\/\/[^/]+/, host);
};
if (smallPath != "" && smallPath != undefined && smallPath != null) {
smallPath = smallPath.replace(/^http:\/\/[^/]+/, host);
}
if (da.contentType == 16) {//语音
if (maxmd5 != null && maxmd5 != "" && maxPath != null && maxPath != "") {
$("[maxMd5='" + maxmd5 + "']").attr("href", "javascript:void(0);").attr("onclick", "PalyRecord('" + maxPath + "');");
}
} else if (da.contentType == 101 || da.contentType == 14 || da.contentType == 7) {//图片
if (smallPath != null && smallPath != "") {
$("[maxMd5='" + maxmd5 + "']").attr("src", smallPath);
$("[maxMd5='" + maxmd5 + "']").attr("href", smallPath);
$("[maxMd5='" + maxmd5 + "']").attr("target", "_blank");
} else {
$("[maxMd5='" + maxmd5 + "']").attr("src", maxPath);
$("[maxMd5='" + maxmd5 + "']").attr("href", maxPath);
$("[maxMd5='" + maxmd5 + "']").attr("target", "_blank");
}
if (maxPath != null && maxPath != "") {//大图存在,详细显示大图,没办法就只能显示小图
$("[maxMd5='" + maxmd5 + "']").attr("showPath", maxPath);
} else {
$("[maxMd5='" + maxmd5 + "']").attr("showPath", smallPath);
}
} else if (da.contentType == 103 || da.contentType == 23) {//视频
$("[maxMd5='" + maxmd5 + "']").attr("src", maxPath);
$("[maxMd5='" + maxmd5 + "']").attr("href", maxPath);
$("[maxMd5='" + maxmd5 + "']").attr("target", "_blank");
if (smallPath != null && smallPath != "") {
$("[maxMd5='" + maxmd5 + "']").html("[视频]:<img style='max-width:100px' id='file_" + da.id + "' src='" + smallPath + "'>");
}
}
}
}
});
}
//替换表情
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 findTxt() {
//var reg2 = new RegExp("\\" + escape(txt), "g");
}
function openImg(img) {
var path = $(img).attr("showpath")
window.open(path);
}
function PalyRecord(url) {
$.get(host + "/WxMessageSvr.svc/QxAudio/Get?url=" + url, function (result) {
if (result.result) {
var data = result.retmsg;
if (data != '') {
layui.use('layer', function () {
var layer = layui.layer;
layer.open({
title: '播放语音',
type: 1,
content: '<video src=' + data + ' controls autoplay />',
area: ['300px', '200px']
});
});
}
else {
layer.alert("未能找到文件");
}
} else {
layer.alert("转换失败,请稍后重试!");
}
});
}
function PalyVideo(url) {
layer.open({
title: '播放视频',
type: 1,
content: '<video width="400" height="300" src=' + url + ' controls autoplay />',
resize: true,
maxmin: true,
area: ['410px', '350px']
});
}
</script>