ComplianceServer/oldcode/WEB/Views/TS/WebChatAssistant/Index.cshtml

187 lines
6.8 KiB
Plaintext
Raw Permalink 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.

@using WX.CRM.WebHelper
@{
ViewBag.Title = "微信小助手";
Layout = "~/Views/Shared/_Index_Layout2.cshtml";
}
<script src="~/Scripts/jquery.cookie.js"></script>
<div class="mvctool">
@Html.ToolButton("btnQuery", "icon-search", "刷新", true)
@Html.ToolButton("btnApply", "icon-lookup", "申请白板资源", true)
@Html.ToolButton("btnMsg", "icon-WebChat", "消息助手", true)
@Html.ToolButton("btnLog", "icon-edit", "加人日志", true)
@Html.ToolButton("btnHelp", "icon-unknow", "详细教程", true)
</div>
<table style="width: 100%; ">
<tr>
<td>
<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;">
&nbsp;&nbsp;
<input type="button" value="删除选择项" id="DeleteItem">
&nbsp;&nbsp;
<input type="button" value="提交至手机" id="UploadItem">
<br />
<br />
</div>
</div>
<span style="color:red">提示:点击"提交推送"按钮会进入下一步,会对这个列表的所有资源进行提交,勾选功能只是进行选择删除编辑操作。</span>
</td>
</tr>
<tr>
<td style="height:5px;">&nbsp;</td>
</tr>
<tr>
<td>客户ID添加</td>
</tr>
<tr>
<td>
<form id="CreateForm">
<textarea id="addResTxt" name="addResTxt" cols="70" rows="8"></textarea>
</form>
</td>
</tr>
<tr>
<td>
<input type="button" value="添加" id="AddRes" />
<br />
<span style="color:red">提示多个客户ID换行即可</span>
<br />
@*<span style="color:red">图示:</span>
<br />
<img src="~/Content/Images/execemple.png"/>*@
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<script type="text/javascript">
var eid = "@Html.Raw(ViewBag.Eid)";
var cookieName = "WebChatAssistant_" + eid;
$(function () {
$('#tablis1').tablegrid({
url: '/TS/WebChatAssistant/GetHtmlList',
height: $(window).height() - 350,
loadNow: true,
isCheckMore: true,
onLoadSuccess: function (data) {
//成功
}, onLoadError: function (ex) {
//失败
}
});
$("#btnQuery").click(function () {//搜索按钮点击事件
var cookieName = "WebChatAssistant_" + eid;
var cookieValue = $.cookie(cookieName);
//alert("获取ResId:" + cookieValue);
$('#tablis1').tablegrid("Search");
});
$("#DeleteItem").click(function () {
var selectRow = $('#tablis1').tablegrid('getSelections');
$(selectRow).each(function (i, row) {
DeleteCookies(row.resid);
});
$('#tablis1').tablegrid("Search");
});
$("#AddRes").click(function () {
$.r_ajax({
url: "/TS/WebChatAssistant/AddRes",
type: "Post",
data: $("#CreateForm").serialize(),
dataType: "json",
loading: true,
success: function (data) {
if (data.type == 1) {
$("#addResTxt").val("");
$.cookie(cookieName, data.okResid, {
expires: 7,
path: '/',
})
$.messager.alert('提醒', "已成功添加到上面的已选资源列表!" + data.erroResid, 'info');
}
else {
$("#addResTxt").val(data.erroResid);
$.cookie(cookieName, data.okResid, {
expires: 7,
path: '/',
})
$.messager.alert('提醒', "正确的客户ID已经加入上面的已选列表部分不正确或当天加过或被加次数过多的客户ID" + data.erroResid, 'info');
}
$('#tablis1').tablegrid("Search");
}
});
});
$("#UploadItem").click(function () {
$("#modalwindow").html(GetIframeHtml("/TS/WebChatAssistant/SendToPhone"));
$("#modalwindow").window({ title: '提交至手机', width: 700, height: 500, iconCls: 'icon-edit' }).window('open');
});
$("#btnHelp").click(function () {
parent.ChildAddTab('微信助手详细教程', '/Help.html', 'icon-unknow')
});
$("#btnLog").click(function () {
parent.ChildAddTab('加人日志', '/TS/WebChatAssistant/TsLog', 'icon-edit')
});
$("#btnApply").click(function () {
$("#modalwindow").html(GetIframeHtml("/TS/WebChatAssistant/WhiteResApply"));
$("#modalwindow").window({ title: '申请白板资源', width: 700, height: 500, iconCls: 'icon-lookup' }).window('open');
});
$("#btnMsg").click(function () {
parent.ChildAddTab("消息助手", "/TS/MsgAssistant/Index", "icon-WebChat");
});
});
function GetIframeHtml(src) {
return "<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='" + src + "'></iframe>";
}
function frameReturnByMes(mes) {
$.messageBox5s('提示', mes);
}
function frameReturnByClose() {
$("#modalwindow").window('close');
}
function frameReturnByReload(flag) {
$("#tablis1").tablegrid("Load");
}
function ClearCookie() {
$.cookie(cookieName, "", {
expires: 7,
path: '/',
})
}
function DeleteCookies(resid) {
var cookieValue = $.cookie(cookieName);
if (cookieValue.indexOf(resid) > -1) {//不要有重复的Resid
cookieValue = cookieValue.replace(new RegExp(resid + ",", "gm"), "");
cookieValue = cookieValue.replace(new RegExp(resid, "gm"), "");
//alert(cookieValue);
$.cookie(cookieName, cookieValue, {
expires: 7,
path: '/',
})
}
}
function ClearAllRightData() {
$.messager.confirm('提示', '您确定要全部清除右边所选数据吗?', function (r) {
if (r) {
$('#tablis2').tablegrid('Clear');
}
});
}
//重建序号
function RebuildIndex() {
$("#tablis2").find("tbody tr").each(function (i, n) {
$(this).find("td:first-child").html(i + 1);
});
}
</script>