215 lines
8.0 KiB
Plaintext
215 lines
8.0 KiB
Plaintext
@{
|
||
ViewBag.Title = "消息助手";
|
||
Layout = "~/Views/Shared/_EasyU_Index_Layout.cshtml";
|
||
}
|
||
|
||
|
||
<div data-options="region:'north',title:'切换微信',split:true" style="height:70px;">
|
||
@{
|
||
System.Data.DataTable table = ViewBag.AliasTab as System.Data.DataTable;
|
||
int x = 0;
|
||
}
|
||
@foreach (System.Data.DataRow row in table.Rows)
|
||
{
|
||
string version = row["version"].ToString();
|
||
if (version.Contains("A2S"))
|
||
{
|
||
x++;
|
||
<input type="radio" name="raz" id="raz_@x" value="@row["username"]" onclick="return SwitchAliasAnddClick(this)" nvalue="@row["alias"]" /><label for="raz_@x">@Html.Raw(row["nickname"].ToString() + "--" + @row["alias"].ToString())</label>
|
||
}
|
||
}
|
||
<input type="hidden" id="hid_chooseusername" value="" />
|
||
</div>
|
||
<div data-options="region:'west',title:'已选好友',split:true" style="width:580px;">
|
||
<div class="bas_datagrid">
|
||
<div id="tb" style="padding:5px;height:auto" class="grid_toolbar">
|
||
已选择:
|
||
</div>
|
||
@Html.Raw(ViewBag.gridTable2)
|
||
|
||
<div id="foot" style="vertical-align:middle;background-color:antiquewhite; height:50px;padding-top:10px;">
|
||
|
||
<input type="button" value="添加" id="btn_Add" title="选择更多的好友到列表中!" />
|
||
|
||
<input type="button" value="删除" id="Remove" title="删除选中的好友!" />
|
||
|
||
<input type="button" value="清空" id="ClearAll" title="清空列表中所有的好友!" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div data-options="region:'center',title:'发送消息'" style="padding:5px;background:#eee;">
|
||
<div class=".test">
|
||
<textarea rows="20" cols="50" id="txt_sendmsg"></textarea>
|
||
<a href="javascript:void();"><img src="~/Content/Images/biaoqing.png" /></a>
|
||
</div>
|
||
<div>
|
||
<input type="button" value="发送消息" id="btnSendMsg" />
|
||
|
||
<input type="button" value="查看日志" id="lookLog" />
|
||
</div>
|
||
<div style="color:red; line-height:26px;font-size:16px">
|
||
<p>
|
||
注意:<br />
|
||
1.消息助手现在只支持A2S的手机,其他版本需要后期开发
|
||
<br />
|
||
2.执行速度:每10分钟执行45个
|
||
</p>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
$(function () {
|
||
$('#tablis1').tablegrid({
|
||
url: '',
|
||
height: $(window).height() - 200,
|
||
loadNow: false,
|
||
isCheckMore: true,
|
||
onLoadSuccess: function (data) {
|
||
//成功
|
||
}, onLoadError: function (ex) {
|
||
//失败
|
||
}
|
||
});
|
||
$(window).resize(function () {//自动适应大小
|
||
$('#tablis1').tablegrid('resize', {
|
||
height: $(window).height() - 200
|
||
});
|
||
});
|
||
|
||
$("#btn_Add").click(function () {
|
||
var xwidth = $(window).width() - 100;
|
||
var xheight = $(window).height() - 100;
|
||
var jobusername = $('input[name="raz"]:checked').val();
|
||
if (jobusername == null) {
|
||
alert("请选择你的微信!")
|
||
return;
|
||
}
|
||
$("#modalwindow").html(GetIframeHtml("/TS/MsgAssistant/ChooseRcontact?jobWxUserName=" + jobusername));
|
||
$("#modalwindow").window({ title: '选择好友', width: xwidth, height: xheight, iconCls: 'icon-qunfawebchat' }).window('open');
|
||
});
|
||
$("#ClearAll").click(function () {
|
||
ClearAllRightData();
|
||
});
|
||
$("#Remove").click(function () {
|
||
RemoveChooseData();
|
||
});
|
||
$("#lookLog").click(function () {
|
||
parent.ChildAddTab('发送消息日志', '/TS/MsgAssistant/TsLog', 'icon-edit')
|
||
});
|
||
//发送消息
|
||
$("#btnSendMsg").click(function () {
|
||
var list = $('#tablis1').tablegrid('getAllRows');
|
||
if (list == null || list.length == 0) {
|
||
alert("请选择要发送的好友!");
|
||
return;
|
||
}
|
||
|
||
var sendmsg = $("#txt_sendmsg").val();
|
||
if (sendmsg == "") {
|
||
alert("内容不能为空!");
|
||
return;
|
||
}
|
||
|
||
var jobusername = $('input[name="raz"]:checked').val();
|
||
if (jobusername == null) {
|
||
alert("请选择你的微信!")
|
||
return;
|
||
}
|
||
var alias = $('input[name="raz"]:checked').attr("nvalue");
|
||
var rids = "";
|
||
$(list).each(function (x, w) {
|
||
if (rids == "")
|
||
rids += w.PKID;
|
||
else
|
||
rids += "," + w.PKID;
|
||
});
|
||
|
||
$.r_ajax({
|
||
url: "/TS/MsgAssistant/SendMsg",
|
||
type: "Post",
|
||
data: { alias: alias, rids: rids, sendmsg: sendmsg },
|
||
dataType: "json",
|
||
loading: true,
|
||
success: function (data) {
|
||
if (data.type == 1) {
|
||
frameReturnByMes('发送成功!');
|
||
$.messager.confirm('提示', '消息发送成功,是否清空已选择好友列表?', function (r) {
|
||
if (r) {
|
||
$('#tablis1').tablegrid('Clear');
|
||
}
|
||
});
|
||
$("#txt_sendmsg").val("");
|
||
}
|
||
else {
|
||
frameReturnByMes(data.message);
|
||
}
|
||
}
|
||
});
|
||
});
|
||
});
|
||
function GetIframeHtml(src) {
|
||
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
|
||
}
|
||
function GetAllRows() {
|
||
var list = $('#tablis1').tablegrid('getAllRows');
|
||
return list;
|
||
}
|
||
//重建序号
|
||
function RebuildIndex() {
|
||
$("#tablis1").find("tbody tr").each(function (i, n) {
|
||
$(this).find("td:first-child").html(i + 1);
|
||
});
|
||
}
|
||
function AddRow(pkid, username, nickname, conremark) {
|
||
var html = "<tr>" +
|
||
"<td style=\"width:25px;\">0</td>" +
|
||
"<td style=\"width:25px;\"> <input type=\"checkbox\"></td>" +
|
||
"<td field=\"PKID\" style=\"display: none;\">" + pkid + "</td>" +
|
||
"<td field=\"USERNAME\">" + username + "</td>" +
|
||
"<td field=\"NICKNAME\">" + nickname + "</td>" +
|
||
"<td field=\"CONREMARK\">" + conremark + "</td>" +
|
||
"</tr>";
|
||
$("#tablis1").find("tbody").append(html);
|
||
}
|
||
function ClearAllRightData() {
|
||
$.messager.confirm('提示', '您确定你要清空列表所有的已选好友吗?', function (r) {
|
||
if (r) {
|
||
$('#tablis1').tablegrid('Clear');
|
||
}
|
||
});
|
||
|
||
}
|
||
function SwitchAliasAnddClick(xn) {
|
||
//var jobusername = $('input[name="raz"]:checked').val();
|
||
var listvalue = $(xn).val();
|
||
var prochoose = $("#hid_chooseusername").val();
|
||
var list = $('#tablis1').tablegrid('getAllRows');
|
||
if (prochoose != "" && listvalue != prochoose && list != null && list.length > 0) {//有数据,需要发出确定选择
|
||
if (confirm("切换不同工作微信,当前工作微信已选好友将被清空!")) {
|
||
$('#tablis1').tablegrid('Clear');
|
||
$("#hid_chooseusername").val(listvalue);
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
$("#hid_chooseusername").val(listvalue);
|
||
return true;
|
||
}
|
||
function RemoveChooseData() {
|
||
var rightRow = $('#tablis1').tablegrid('getSelections');
|
||
$("#tablis1").find("tbody tr").each(function (i, n) {
|
||
var nrow = $(this);
|
||
var npkid = $(nrow).find("td:[field='PKID']").text()
|
||
$(rightRow).each(function (x, w) {
|
||
if (w.PKID == npkid) {
|
||
$(nrow).remove()
|
||
}
|
||
});
|
||
});
|
||
RebuildIndex()
|
||
}
|
||
function frameReturnByMes(mes) {
|
||
$.messageBox5s('提示', mes);
|
||
}
|
||
</script> |