TG.WXCRM.V4/WxService/MessageHtml.html

177 lines
6.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<style type="text/css">
body {
margin: 0;
padding: 0;
}
table.gridtable {
width: 99%;
font-family: verdana,arial,sans-serif;
font-size: 11px;
color: #333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}
table.gridtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
</style>
<script src="http://192.168.1.132:808/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
function withjQuery(callback) {
if (!(window.jQuery)) {
var js = document.createElement('script');
js.setAttribute('src', 'http://' + window.location.host + '/Scripts/jquery-1.8.2.min.js');
js.setAttribute('type', 'text/javascript');
js.onload = js.onreadystatechange = function () {
if (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') {
if (callback && typeof callback === "function") {
callback();
}
js.onload = js.onreadystatechange = null;
}
};
document.getElementsByTagName('head')[0].appendChild(js);
}
}
withjQuery(
function () {
$(function () { alert("jQuery loaded"); })();
}
);
function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
function formatDate(time) {
var date = new Date(time);
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() + ' ';
var h = date.getHours() + ':';
var m = date.getMinutes() + ':';
var s = date.getSeconds();
return Y + M + D + h + m + s;
}
function go() {
var oList = document.getElementsByTagName("a");
for (var i = 0; i < oList.length; i++) {
var c = oList[i].innerHTML;
if (c != "") {
oList[i].innerHTML = "查看";
}
}
};
//判断一个url是否可以访问
function IsLoad(_url, fun) {
$.ajax({
url: _url,
type: "get",
success: function () {
//说明请求的url存在并且可以访问
if ($.isFunction(fun)) {
fun(true);
}
},
statusCode: {
404: function () {
//说明请求的url不存在
if ($.isFunction(fun)) {
fun(false);
}
}
}
});
}
function GetMessageHis(username) {
$.ajax({
type: "get",
dataType: "json",
url: "http://" + window.location.host + "/WxMessageSvr.svc/Message/Get/" + username,
success: function (msg) {
if (msg.result) {
var msgBody = "";
$.each(msg.retmsg, function (i, j) {
msgBody += "<tr>";
msgBody += "<td style=\"display:none;\">" + j.MSGSVRID + "</td>";
msgBody += "<td>" + j.NICKNAME + "</td>";
msgBody += "<td>" + j.USERNAME + "</td>";
msgBody += "<td>" + formatDate(j.CREATETIME) + "</td>";
msgBody += "<td>" + j.TALKER + "</td>";
msgBody += "<td>" + j.MSG_CONTENT + "</td>";
msgBody += "<td><a target=\"_blank\" href=\"" + j.MSG_URL + "\">" + j.MSG_URL + "</a></td>";
msgBody += "<td style=\"display:none;\">" + j.MSG_TYPE + "</td>";
msgBody += "</tr>";
});
$("#wxTab tbody").html(msgBody);
go();
$("#wxTab").show();
}
else {
alert("出错了,请联系管理员" + msg.message);
}
}
});
}
$(function () {
var ifm = document.getElementById("iframe1");
ifm.height = document.documentElement.clientHeight;
var username = GetQueryString("username");
//GetMessageHis(username);
if (username != null) {
var url = "http://" + window.location.host + "/html/k/" + username + "/n001.html";
IsLoad(url, function (res) {
if (res) {
$("#iframe1").attr("src", url);
} else {
GetMessageHis(username);
}
});
}
});
</script>
</head>
<body>
<table id="wxTab" class="gridtable" align="center" style="display: none;">
<thead>
<tr>
<th style="display: none;">ID</th>
<th>昵称</th>
<th>用户名</th>
<th>时间</th>
<th>用户微信号</th>
<th>信息内容</th>
<th>URL</th>
<th style="display: none;">信息类型</th>
</tr>
</thead>
<tbody></tbody>
</table>
<iframe id="iframe1" width="100%" height="100%" scrolling='auto' frameborder='0' src=''></iframe>
</body>
</html>