703 lines
32 KiB
Plaintext
703 lines
32 KiB
Plaintext
|
||
@{
|
||
ViewBag.Title = "MessageDetial";
|
||
Layout = "~/Areas/Admin/Views/Shared/_content.cshtml";
|
||
}
|
||
<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>
|
||
<div class="layui-tab" lay-filter="msc_ex" style="margin:0;height:calc(100% - 50px);background-color: white;">
|
||
@{
|
||
string isShowHG = (string)ViewBag.IsShowHG;
|
||
string username = ViewBag.username;
|
||
bool isGroup = false;
|
||
if (username != null)
|
||
{
|
||
isGroup = username.EndsWith("chatroom");
|
||
}
|
||
}
|
||
@if (isShowHG == "1")
|
||
{
|
||
|
||
@*<div style="left:320px;top:8px;z-index:500;display:block;position:absolute;">
|
||
<span>合规关键词<a id="hgnowcount">0</a>/<a id="hgallcount" style="color:red">0</a></span>
|
||
<a href="javascript:NextHgWords()">下一个</a>
|
||
<a href="javascript:PrvHgWords()">上一个</a>
|
||
</div>*@
|
||
}
|
||
<ul class="layui-tab-title" id="msc_ex">
|
||
@if (!isGroup)
|
||
{
|
||
<li class="layui-this">聊天记录</li>
|
||
<li>群发助手</li>
|
||
}
|
||
else
|
||
{
|
||
<li class="layui-this">微信群聊</li>
|
||
}
|
||
</ul>
|
||
<div class="layui-tab-content" style="height:calc(100% - 65px);width:100%;">
|
||
<div class="layui-tab-item layui-show" style="height:100%;width:100%;">
|
||
<div id="mycontent1" class="layui-side-scroll" style="width:calc(100% - 10px);">
|
||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
|
||
<legend id="msg_title">聊天记录:</legend>
|
||
</fieldset>
|
||
<ul class="layui-timeline" id="contentBody">
|
||
<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:red;">温馨提示:</h4>
|
||
<p>
|
||
请选中左边列表中的好友查看聊天记录。
|
||
</p>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
@if (isGroup != true)
|
||
{
|
||
<div class="layui-tab-item" style="height:100%;width:100%;">
|
||
<div id="mycontent2" class="layui-side-scroll" style="width:calc(100% - 10px);">
|
||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
|
||
<legend id="msg_title2">群发助手:</legend>
|
||
</fieldset>
|
||
<ul class="layui-timeline" id="qunfabody">
|
||
<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:red;">温馨提示:</h4>
|
||
<p>
|
||
请选中左边列表中的好友查看群发记录。
|
||
</p>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
}
|
||
</div>
|
||
|
||
</div>
|
||
<form class="layui-form" action="" style="height:50px;background-color:white;">
|
||
<div class="layui-form-item" style="margin-bottom:0;border-top: 1px solid #dad5d5;padding-top: 10px;">
|
||
<div class="layui-inline" id="guolvshow">
|
||
<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" style="height:32px;" value="@Html.Raw(DateTime.Now.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" style="height:32px;" value="@Html.Raw(DateTime.Now.ToString("yyyy-MM"))" placeholder="yyyy-MM">
|
||
</div>
|
||
<div class="layui-input-inline" style="width:120px;">
|
||
<input type="button" class="layui-btn layui-btn-sm layui-btn-ok" lay-filter="demo2" id="dataGL" value="确定" />
|
||
@if (ViewBag.type == "MessageList")
|
||
{
|
||
@*<input type="button" class="layui-btn layui-btn-sm layui-btn-normal" lay-filter="demo3" id="export" value="导出" />*@
|
||
}
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</form>
|
||
<style>
|
||
.hgguanjianci {
|
||
background-color: #FF9800;
|
||
color: white;
|
||
}
|
||
|
||
.hgguanjianci_choose {
|
||
background-color: red;
|
||
color: white;
|
||
}
|
||
</style>
|
||
<script>
|
||
var headurl = "@Html.Raw(ViewBag.CoreInterfaceUrl)";
|
||
var jobusername = "@Html.Raw(ViewBag.workusername)";
|
||
var jobnickname = "@Html.Raw(ViewBag.workAccountName)";
|
||
var cs_username = "@Html.Raw(ViewBag.username)";
|
||
var cs_nickname = "@Html.Raw(ViewBag.nickname)";
|
||
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;
|
||
}
|
||
};
|
||
//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;
|
||
}
|
||
|
||
layui.use(['form', 'element', 'layedit', 'laydate'], function () {
|
||
var form = layui.form
|
||
, layer = layui.layer
|
||
, layedit = layui.layedit
|
||
, laydate = layui.laydate;
|
||
var element = layui.element;
|
||
|
||
//日期
|
||
laydate.render({
|
||
elem: '#stime'
|
||
, type: 'month'
|
||
});
|
||
//日期
|
||
laydate.render({
|
||
elem: '#etime'
|
||
, type: 'month'
|
||
});
|
||
element.on('tab(msc_ex)', function (data) {
|
||
if (data.index == 1) {
|
||
$("#guolvshow").hide();
|
||
} else {
|
||
$("#guolvshow").show();
|
||
}
|
||
if (show_Config["show_" + data.index] == false) {
|
||
ShowMessage(cs_username);
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
$(function () {
|
||
if (cs_username != null && cs_username != '') {
|
||
$("#msg_title").html(cs_nickname);
|
||
$("#msg_title2").html(cs_nickname);
|
||
ShowMessage(cs_username);
|
||
}
|
||
|
||
|
||
$("#dataGL").click(function () {
|
||
if (cs_username == null || cs_username == '') {
|
||
layer.msg('请选择微信好友!');
|
||
} else {
|
||
ShowMessage(cs_username);
|
||
}
|
||
});
|
||
$("#export").click(function () {
|
||
if (cs_username == "") {
|
||
layer.msg('请选择一个客户!');
|
||
return;
|
||
}
|
||
if (jobusername === "" || cs_username === "" || jobnickname === "" || cs_nickname === "") {
|
||
layer.msg('参数错误!');
|
||
return;
|
||
}
|
||
var href = "Export?workusername=" + jobusername + "&username=" + cs_username + "&worknickname=" + jobnickname + "&nickname=" + $.trim(cs_nickname);
|
||
window.open(href);
|
||
});
|
||
$("#qunfatxt li").click(function () {
|
||
var chooseBodyId = $(this).attr("nvalue");
|
||
console.log(chooseBodyId);
|
||
$(".layui-body").addClass("displayBody");
|
||
$("#body" + chooseBodyId).removeClass("displayBody");
|
||
});
|
||
|
||
|
||
});
|
||
var allpost = 0;
|
||
var nowpost = 0;
|
||
var loadingindex;
|
||
var isGroup = "@Html.Raw(isGroup)";
|
||
var show_Config = { "show_0": false, "show_1": false }
|
||
var dataMsgSvrIdKey = {};
|
||
function ShowMessage(username) {
|
||
dataMsgSvrIdKey = {};
|
||
|
||
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 >";
|
||
|
||
|
||
var stime = $("#stime").val();
|
||
var etime = $("#etime").val();
|
||
|
||
if (isGroup != "True") {
|
||
var showa= $("#msc_ex .layui-this").html();
|
||
var startDate = stime;
|
||
var endDate = etime;
|
||
if (showa == "聊天记录") {//从当前判断加载那哪个Json
|
||
$("#contentBody").html(nomessage);
|
||
show_Config["show_" + 0] = true;
|
||
var url = headurl + "JsonMessage/Message/Get?weixincrmaccount=@Html.Raw(ViewBag.weixincrmaccount)&jobusername=" + jobusername + "&username=" + username + "&startDate=" + startDate + "&endDate=" + endDate;
|
||
GetMessageByUrl(url, "contentBody");
|
||
} else {
|
||
$("#qunfabody").html(qunfanomessage);
|
||
show_Config["show_" + 1] = true;
|
||
var nurl = headurl + "JsonMessage/QunFaMessage/Get?weixincrmaccount=@Html.Raw(ViewBag.weixincrmaccount)&jobusername=" + jobusername + "&username=" + username;
|
||
GetMessageByUrl(nurl, "qunfabody");
|
||
}
|
||
} else {
|
||
$("#contentBody").html(nomessage);
|
||
var nrul = "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;
|
||
});
|
||
|
||
//$(arrayObj).each(function (i, n) {
|
||
// var month = n.toString();
|
||
// month = n.substring(0, 4) + parseInt(month.substring(4, 6)).toString();
|
||
// var url = "/Message/" + username + "/" + username + "_" + month + ".json?i=" + GetGuid();
|
||
// //GetMessageByUrl(url, "contentBody");
|
||
// GetGroupMessage(url, "contentBody")
|
||
//});
|
||
var startDate = stime;
|
||
var endDate = etime;
|
||
var url = headurl + "JsonMessage/GroupMessage/Get?weixincrmaccount=@Html.Raw(ViewBag.weixincrmaccount)&chatroom=" + chatName + "&startDate=" + startDate + "&endDate=" + endDate;
|
||
GetGroupMessage(url, "contentBody");
|
||
|
||
}
|
||
});
|
||
|
||
}
|
||
}
|
||
|
||
var selftemplete ="<li class='layui-timeline-item' msgsvrid='[msgsvrid]'>"+
|
||
"<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' msgsvrid='[msgsvrid]'>" +
|
||
"<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>";
|
||
|
||
var chatRoomNumber;
|
||
var chatName = cs_username;
|
||
|
||
function GetGroupMessage(url, tabName) {
|
||
//ajaxLoading();
|
||
//=======================获取群成员信息================================================
|
||
|
||
//alert("微信号:"+chatRoomNumber["wxid_h1sph8q2rgo722"]);
|
||
//=========================获取群消息文件==================================================
|
||
$.ajax({
|
||
type: "GET",
|
||
url: "GeJsontPath?weixincrmaccount=@Html.Raw(ViewBag.weixincrmaccount)&url=" + encodeURIComponent(url) + "&guid=" + GetGuid(),
|
||
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) {
|
||
if (da.msgSvrId && !!dataMsgSvrIdKey[da.msgSvrId]) {
|
||
return true;
|
||
}
|
||
dataMsgSvrIdKey[da.msgSvrId] = 1;
|
||
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 (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 == cs_username) {
|
||
//html += "<tr><td class=\"isSelf\">" + ShowName + " " + dataStr + "</td></tr>";
|
||
html = selftemplete.replace("[title]", ShowName + " " + dataStr);
|
||
} else {
|
||
|
||
//html += "<tr><td class=\"isFriend\">" + ShowName + " " + dataStr + "</td></tr>";
|
||
html = outtemplete.replace("[title]", ShowName + " " + dataStr);
|
||
}
|
||
|
||
|
||
//if (da.isSend == 1) {
|
||
// html = selftemplete.replace("[title]", jobnickname + " " + dataStr);
|
||
//} else {
|
||
// html = outtemplete.replace("[title]", ReplaceMobile(da.nickname) + " " + dataStr);
|
||
//}
|
||
//}
|
||
html = html.replace("[msgsvrid]", da.msgSvrId);
|
||
if (da.type == 3) {
|
||
html = html.replace("[content]", "[图片]:<img style='max-width:300px' id='file_" + da.msgSvrId + "' src=''>");
|
||
$("#" + tabName).append(html);
|
||
GetImage(da);
|
||
} else if (da.type == 47) {
|
||
if (da.url != "" && da.url != "null") {
|
||
html = html.replace("[content]", "<img style='max-width:100px' id='file_" + da.msgSvrId + "' src='" + da.url + "'>");
|
||
$("#" + tabName).append(html);
|
||
} else {
|
||
html = html.replace("[content]", "<img style='max-width:100px' id='file_" + da.msgSvrId + "' src=''>");
|
||
$("#" + tabName).append(html);
|
||
GetImage(da);
|
||
}
|
||
} else if (da.type == 34) {
|
||
html = html.replace("[content]", "<span id='file_" + da.msgSvrId + "' >[语音]<span>");
|
||
$("#" + tabName).append(html);
|
||
GetImage(da);
|
||
} else if (da.type == 43) {
|
||
html = html.replace("[content]", "<span id='file_" + da.msgSvrId + "' >[视频]<span>");
|
||
$("#" + tabName).append(html);
|
||
GetImage(da);
|
||
} else if (da.type == 49) {
|
||
html = html.replace("[content]", "<span id='file_" + da.msgSvrId + "' >[文件]<span>");
|
||
$("#" + tabName).append(html);
|
||
GetImage(da);
|
||
}
|
||
else {//普通文本
|
||
html = html.replace("[content]", SetKeyWords(replaceFace(da.content)));
|
||
$("#" + tabName).append(ReplaceMobile(html));
|
||
}
|
||
|
||
|
||
});
|
||
}
|
||
});
|
||
|
||
|
||
|
||
//ajaxLoadEnd();
|
||
}
|
||
function GetMessageByUrl(url, tabName) {
|
||
$.ajax({
|
||
type: "GET",
|
||
url: "GeJsontPath?weixincrmaccount=@Html.Raw(ViewBag.weixincrmaccount)&url=" + encodeURIComponent(url + "&nguid=" + GetGuid()) + "&guid=" + GetGuid(),
|
||
dataType: "text",
|
||
async: false,
|
||
success: function (data) {
|
||
nowpost++;
|
||
//var workAccountName = "@Html.Raw(ViewBag.workAccountName)";
|
||
var json = JSON.parse("[" + data + "]");
|
||
json.sort(sortBy('createTime', false, parseInt));
|
||
console.log("数据量:" + json.length);
|
||
if (json.length > 0) {
|
||
$("#" + tabName).find("#nomessage").remove();
|
||
}
|
||
$(json).each(function (i, da) {
|
||
if (da.msgSvrId && !!dataMsgSvrIdKey[da.msgSvrId]) {
|
||
return true;
|
||
}
|
||
dataMsgSvrIdKey[da.msgSvrId] = 1;
|
||
var newDate = new Date();
|
||
newDate.setTime(da.createTime);
|
||
var dataStr = getNowFormatDate(newDate);//聊天时间
|
||
var html = "";
|
||
if (da.isSend == 1) {
|
||
html = selftemplete.replace("[title]", jobnickname + " " + dataStr);
|
||
} else {
|
||
html = outtemplete.replace("[title]", ReplaceMobile(da.nickname) + " " + dataStr);
|
||
}
|
||
if (da.type == 3) {
|
||
html = html.replace("[content]", "[图片]:<img style='max-width:300px' id='file_" + da.msgSvrId + "' src=''>");
|
||
$("#" + tabName).append(html);
|
||
GetImage(da);
|
||
} else if (da.type == 47) {
|
||
if (da.url != "" && da.url != "null") {
|
||
html = html.replace("[content]", "<img style='max-width:100px' id='file_" + da.msgSvrId + "' src='" + da.url + "'>");
|
||
$("#" + tabName).append(html);
|
||
} else {
|
||
html = html.replace("[content]", "<img style='max-width:100px' id='file_" + da.msgSvrId + "' src=''>");
|
||
$("#" + tabName).append(html);
|
||
GetImage(da);
|
||
}
|
||
} else if (da.type == 34) {
|
||
html = html.replace("[content]", "<span id='file_" + da.msgSvrId + "' >[语音]<span>");
|
||
$("#" + tabName).append(html);
|
||
GetImage(da);
|
||
} else if (da.type == 43) {
|
||
html = html.replace("[content]", "<span id='file_" + da.msgSvrId + "' >[视频]<span>");
|
||
$("#" + tabName).append(html);
|
||
GetImage(da);
|
||
} else if (da.type == 49) {
|
||
html = html.replace("[content]", "<span id='file_" + da.msgSvrId + "' >[文件]<span>");
|
||
$("#" + tabName).append(html);
|
||
GetImage(da);
|
||
}
|
||
else {//普通文本
|
||
html = html.replace("[content]", SetKeyWords(replaceFace(da.content)));
|
||
$("#" + tabName).append(ReplaceMobile(html));
|
||
}
|
||
});
|
||
//console.log("成功:"+nowpost);
|
||
//if (nowpost == allpost)
|
||
// layer.close(loadingindex);
|
||
GetAllHgGuanJianCi()
|
||
}, error: function () {
|
||
nowpost++;
|
||
//console.log("失败:" + nowpost);
|
||
//if (nowpost == allpost)
|
||
// layer.close(loadingindex);
|
||
}
|
||
});
|
||
}
|
||
var contetndivname = "mycontent1";
|
||
var keywords = "@Html.Raw(ViewBag.KeyWords)";
|
||
var isShowHg = "@Html.Raw(ViewBag.IsShowHG)";
|
||
var HgWords = keywords.split(';');
|
||
var alnn = 0;
|
||
function SetKeyWords(content) {
|
||
if (isShowHg != "1")
|
||
return content;
|
||
$(HgWords).each(function (i, key) {
|
||
if (key) {
|
||
alnn++;
|
||
content = content.replace(key, "<span class='hgguanjianci' id='hgwords_" + alnn + "'>" + key + "</span>");
|
||
}
|
||
});
|
||
return content;
|
||
|
||
}
|
||
var arrHgKey = new Array(); //
|
||
function GetAllHgGuanJianCi() {
|
||
//if (isShowHg != "1")
|
||
// return;
|
||
//arrHgKey = new Array(); //
|
||
//hgNowIndex - 1;
|
||
//topac = 0;
|
||
//$(".hgguanjianci").each(function (my, span) {
|
||
// arrHgKey[my] = $(span).attr("id");
|
||
//});
|
||
//console.log(arrHgKey);
|
||
//$("#hgallcount").html(arrHgKey.length);
|
||
}
|
||
var hgNowIndex = -1;
|
||
var topac = 0;
|
||
function PrvHgWords() {
|
||
console.log(hgNowIndex);
|
||
if (hgNowIndex - 1 < 0) {
|
||
layer.open({
|
||
title: '提醒'
|
||
, content: '没有了哦!'
|
||
, icon: '5'
|
||
, time: '1000'
|
||
});
|
||
return;
|
||
}
|
||
console.log("上一个:");
|
||
hgNowIndex--;
|
||
$("#hgnowcount").html(hgNowIndex+1);
|
||
var kongjian = $("#" + arrHgKey[hgNowIndex]);
|
||
$(".hgguanjianci_choose").removeClass("hgguanjianci_choose");
|
||
$(kongjian).addClass("hgguanjianci_choose");
|
||
console.log(kongjian.offset());
|
||
console.log(kongjian.position());
|
||
topac = topac + (kongjian.offset().top + 30) - 200;
|
||
if (topac < 0)
|
||
topac = 0;
|
||
console.log("scrollTop:" + topac);
|
||
$("#" + contetndivname).animate({ scrollTop: topac }, 100)
|
||
|
||
}
|
||
function NextHgWords() {
|
||
if (arrHgKey.length < hgNowIndex + 2) {
|
||
layer.open({
|
||
title: '提醒'
|
||
, content: '没有了哦!'
|
||
, icon: '5'
|
||
, time: '1000'
|
||
});
|
||
return;
|
||
}
|
||
console.log("下一个:");
|
||
hgNowIndex++;
|
||
var kongjian = $("#" + arrHgKey[hgNowIndex]);
|
||
if (kongjian==null||kongjian.length==0)
|
||
return;
|
||
$("#hgnowcount").html(hgNowIndex + 1);
|
||
$(".hgguanjianci_choose").removeClass("hgguanjianci_choose");
|
||
$(kongjian).addClass("hgguanjianci_choose");
|
||
console.log(kongjian.offset());
|
||
console.log(kongjian.position());
|
||
topac += kongjian.offset().top - 180;
|
||
$("#" + contetndivname).animate({ scrollTop: topac }, 100)
|
||
}
|
||
function GetImage(da) {
|
||
var url = headurl + "FilePath.svc/GetPath/" + da.msgSvrId + "?guid" + GetGuid();
|
||
$.ajax({
|
||
url: "GeJsontPath?weixincrmaccount=@Html.Raw(ViewBag.weixincrmaccount)&url=" + encodeURIComponent(url),
|
||
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);
|
||
var myurl = headurl + "FilePath.svc/GetImag/" + da.msgSvrId + "/" + da.type + "/" + path;
|
||
if (da.type == 34) {
|
||
$("#file_" + msgsId).after("<a id='file_" + msgsId + "' href='javascript:void(0);' onclick=\"PalyRecord('" + myurl + "');\">[语音]<a>").remove();
|
||
} else if (da.type == 43) {
|
||
$("#file_" + msgsId).after("<a id='file_" + msgsId + "' href='javascript:void(0);' onclick=\"PalyVideo('" + myurl + "');\">[视频]<a>").remove();
|
||
//$("#file_" + msgsId).attr("href", "javascript:void(0);").attr("onclick", "PalyVideo('" + path + "');");
|
||
} else if (da.type == 49) {
|
||
$("#file_" + msgsId).after("<a id='file_" + msgsId + "' src='" + myurl + "' href='" + myurl + "' target='_blank'>[文件]<a>").remove();
|
||
}
|
||
else {
|
||
$("#file_" + msgsId).attr("src", myurl);
|
||
$("#file_" + msgsId).attr("href", myurl);
|
||
$("#file_" + msgsId).attr("target", "_blank");
|
||
}
|
||
}
|
||
}, error: function (n) {
|
||
console.log(n);
|
||
}
|
||
});
|
||
}
|
||
//替换表情
|
||
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 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)) {
|
||
//console.log("内容:" + content);
|
||
var res = txt.match(reg);
|
||
//console.log(res);
|
||
//$(res).each(function (i, m) {
|
||
var mm = res[0].replace(/(\d{3})\d{5}(\d{3})/, '$1*****$2');
|
||
txt = ReplaceMobile(txt.replace(res[0], mm));//再做一次match
|
||
//})
|
||
}
|
||
return txt;
|
||
}
|
||
function PalyRecord(url) {
|
||
//$.ajax({
|
||
// url: "Audio?i=" + GetGuid(),
|
||
// type: "POST",
|
||
// dataType: "json",
|
||
// loading: true,
|
||
// data:{ url: url },
|
||
// success: function (da) {
|
||
// if (da.result === true) {
|
||
// var data = da.retmsg;
|
||
layui.use('layer', function () {
|
||
var layer = layui.layer;
|
||
layer.open({
|
||
title: '播放语音',
|
||
type: 1,
|
||
content: '<video src=' + url + ' controls autoplay />',
|
||
area: ['300px', '200px']
|
||
});
|
||
});
|
||
|
||
// } else {
|
||
// layer.alert(da.retmsg, { icon: 2 });
|
||
// }
|
||
// }, error: function (n) {
|
||
// }
|
||
//});
|
||
}
|
||
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']
|
||
});
|
||
}
|
||
function resizeWindow() {
|
||
var height = $(window).height();
|
||
$("#leftdiv").height(height - 60);
|
||
$("#mycontent1").height(height - 120);
|
||
$("#mycontent2").height(height - 120);
|
||
|
||
}
|
||
</script> |