<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>KGCMS企业应用管理平台 - Powered by KGCMS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<!-- <meta http-equiv="cache-control" content="no-siteapp" /> -->
<link rel="stylesheet" href="{{ kg['tpl_url'] }}style/message_manage.css">
<script src="{{ kg['tpl_url'] }}script/jquery.min.js"></script>
<script src="{{ kg['server']['HTTP_HOST'] }}/tools/amazeui/js/amazeui.min.js"></script>
<script src="{{kg['tpl_url']}}script/common.js"></script>
<script src="{{ kg['tpl_url'] }}script/message_manage.js"></script>
</head>
<body data-type="generalComponents">
	{% include 'component_header.tpl' %}
	<div class="tpl-page-container tpl-page-header-fixed">
		<div class="scrollbar-wrap">
		{% include 'component_left.tpl' %}
		<div class="tpl-content-wrapper">
			<div class="tpl-content-page-title">
				在线客服
			</div>
			<ol class="am-breadcrumb">
				<li><a href="./" class="am-icon-home">首页</a></li>
				<li class="am-active">在线客服</li>
			</ol>
			<div class="tpl-portlet-components">
				<div class="portlet-title">
					<div class="caption font-green bold">
						<span class="am-icon-code"></span>&nbsp;在线客服
					</div>
					<ul class="list-inline ngsty-boxR">
						<li>
							<div class="am-no-marginbtm am-select-hover  am-no-outline">
								<select onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-am-selected="{btnSize: 'sm'}" class="" style="display: none;" id="selected-search">
									<option value="message_manage?{{url['type']}}">全部类型数据</option>
									<option {% if type == 0 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=0">用户事件及系统日志</option>
									<option {% if type == 'general' %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=general">普通消息</option>
									<option {% if type == 'administrator' %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=administrator">管理员回复消息</option>
									<option {% if type == 1 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=1">文本消息</option>
									<option {% if type == 2 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=2">图片消息</option>
									<option {% if type == 3 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=3">语音消息</option>
									<option {% if type == 4 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=4">视频消息</option>
									<option {% if type == 5 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=5">位置信息</option>
									<option {% if type == 6 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=6">链接消息</option>
									<option {% if type == 7 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=8">现场签到记录(成功)</option>
									<option {% if type == 8 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=7">现场签到记录(失败)</option>
									<option {% if type == 9 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=9">现场抽奖中奖记录</option>
									<option {% if type == 10 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=17">对对碰中奖记录</option>
									<option {% if type == 11 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=18">摇一摇中奖记录</option>
									<option {% if type == 12 %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=19">竞拍记录</option>
									<option {% if type == 'push' %}selected="selected"{% endif %}value="message_manage?{{url['type']}}type=push">素材推送记录</option>
								</select>
							</div>
						</li>
						<li>
							<div class="am-select-hover  am-no-outline">
								<select onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-am-selected="{btnSize: 'sm'}" style="display: none;">
									<option value="message_manage?{{url['time']}}">全部日期</option>
									<option {% if time == 1 %}selected="selected"{% endif %}value="message_manage?{{url['time']}}time=1">今日</option>
									<option {% if time == 2 %}selected="selected"{% endif %}value="message_manage?{{url['time']}}time=2">最近3天</option>
									<option {% if time == 3 %}selected="selected"{% endif %}value="message_manage?{{url['time']}}time=3">最近7天</option>
									<option {% if time == 4 %}selected="selected"{% endif %}value="message_manage?{{url['time']}}time=4">最近30天</option>
								</select>
							</div>
						</li>
						<li>
							<div class="am-select-hover  am-no-outline">
								<select onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-am-selected="{btnSize: 'sm'}" style="display: none;">
									<option value="message_manage?{{url['activity']}}">全部活动</option>
									{% for row in activity_list %}
							        <option {% if activity == row['id'] %}selected="selected"{% endif %}value="message_manage?{{url['activity']}}activity={{row['id']}}">{{row['title']}}</option>
									{% endfor %}
								</select>
							</div>
						</li>
						<li>
							<div class="portlet-input input-small">
								<form action="" method="get" id="search">
									<div class="input-icon right">
										<i class="am-icon-search log-search"></i>
										<input type="text" class="form-control form-control-solid am-hover ngar-Vxiugai-radius ngco-Alo-Noborder" placeholder="搜索..." name="word" value="{{word}}" id="">
									</div>
								</form>
							</div>
						</li>
						<li>
							<div class="am-btn-group am-btn-group-xs">
								<a href="message_manage?{{kg['run_start_time'][1]}}" class="am-btn am-btn-secondary ng-add-hightB"><span class="am-icon-search"></span>&nbsp;刷新</a>
							</div>
						</li>
					</ul>
				</div>
				<div class="tpl-block ngALL-AFenyeFu-marginT none_paddingT none_paddingB">
					<div class="am-g">
						<div class="am-u-sm-12 ngco-No-paddingR">
							<div class="information rounded hide" id="NewsInformation" style="display: none;background-color: rgba(162,180,238,0.2);"><span><a href="message_manage" style="font-size:14px;">你有 <font color="#FF6600">2</font> 条新消息，点击查看</a></span></div>
							<form action="" method="post" class="am-form" id="am-form">
								<table class="ngco-Kfubox am-table am-table-striped am-table-hover table-main ngco-Esz-mgibdr">
									<thead>
										<tr>
											<!-- 1 -->
											<th class="table-check">
												<div class="ngjs-ziLi1 ngco-inbl-display"><input type="checkbox" id="all" onclick="kg.select_all(this.form);" class="tpl-table-fz-check" style="margin-top: 0;vertical-align: middle;"></div>
											</th>
											<!-- 2 -->
											<th class="table-id">
												<div class="ngjs-ziLi2 ngco-inbl-display">ID</div>
											</th>
											<!-- 3 -->
											<th class="table-title">
												<div class="ngjs-ziLi3 ngco-inbl-display">用户及消息内容</div>
											</th>
											<!-- 4 -->
											<th class="table-type">
												<div class="ngjs-ziLi4 ngco-inbl-display">时间</div>
											</th>
											<th class="table-set">
												<div class="ngjs-ziLi8 ngco-inbl-display">操作</div>
											</th>
										</tr>
									</thead>
									<tbody>
									{% for row in data %}
										<tr>
											<td><input type="checkbox" name="id[]" value="{{row['id']}}"></td>
											<td>{{row['id']}}</td>
											<td>
												<ul data-am-widget="gallery" class="am-gallery sm-block-grid-2 md-block-grid-3 lg-block-grid-4 am-gallery-bordered  am-no-layout" data-am-gallery="{ pureview: true }" style="display: inline-block">
													<li><img src="{% if row['type_msg'] == '管理员' %}{{kg['tpl_url']}}images/member.png{% else %}{{row['headimgurl']}}{% endif %}" alt="" style="height: 46px" ></li>
												</ul>
												<div style="display: inline-block; vertical-align: middle;">
													<div>
                                                        {% if row['type_msg'] == '管理员' %}<a href="message_manage?type=administrator">[{{row['type_msg']}}] - {{row['nickname']}}</a>{% else %}<a href="message_manage?message={{row['id']}}">{{row['nickname']}} - [{{row['type_msg']}}]</a>{% endif %}
                                                        <a href="#">立即回复</a>
                                                    </div>
                                                    <div>
														{%- if row['type'] == 2 -%}
														图片消息：<img src="{{row['content']}}" style="height: 40px;">
														{%- elif row['type'] == 3 -%}
														语音消息：<a href="{{row['content']}}" download="">{{row['content']}}</a>
														{%- elif row['type'] == 4 -%}
														视频消息：<a href="{{row['content']}}" target="_blank">视频</a>
														{%- else -%}
														{{row['content']}}
														{%- endif -%}
													</div>
												</div>
											</td>
											<td>{{row['addtime']}}</td>
											<td>
												<div class="am-btn-toolbar li-div7">
													<div class="am-btn-group am-btn-group-xs">
														<div class="am-btn-group am-btn-group-xs ngco-TNo-paddingLR">
															<a href="message_manage_reply?id={{row['id']}}" title="" class="am-btn am-btn-default am-btn-xs am-text-secondary title2div" style="cursor: pointer;"><span class="am-icon-comments"></span>&nbsp;回复消息</a>
															{% if row['audit'] %}
															<a href="message_manage?action=unaudit&id={{row['id']}}" title="已经审核，点击取消审核" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-audit-bright title2div" style="cursor: pointer;"><span class="am-icon-pencil "></span>&nbsp;审核</a>
                                                            {% else %}
															<a href="message_manage?action=audit&id={{row['id']}}" title="未审核，点击审核" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-audit-bright title2div" style="cursor: pointer;"><span class="am-icon-pencil "></span>&nbsp;未审</a>
															{% endif %}
															{% if row['recom'] %}
															<a href="message_manage?action=unrecom&id={{row['id']}}" title="已经推荐，点击取消推荐" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-recom-bright title2div" style="cursor: pointer;"><span class="am-icon-star-o "></span>&nbsp;推荐</a>
															{% else %}
															<a href="message_manage?action=recom&id={{row['id']}}" title="未推荐，点击推荐" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-recom-bright title2div" style="cursor: pointer;"><span class="am-icon-star-o "></span>&nbsp;未推</a>
                                                            {% endif %}
															<a href="message_manage?action=del&id={{row['id']}}" title="" class="am-btn am-btn-default am-btn-xs am-text-danger ngro-Jclick-shanchubi title2div" style="cursor: pointer;"><span class="am-icon-trash-o"></span>&nbsp;删除 </a>
                                                        </div>
													</div>
												</div>
											</td>
										</tr>
									{% endfor %}
									</tbody>
								</table>
								{% if not data %}<div class="no-data"><ul>没有相关数据</ul></div>{% endif %}
								{% if page_data['total_rows'] %}
								<div class="am-u-sm-12 am-u-md-6">
									<div class="am-btn-toolbar ng-xno-borderL" id="select-handle">
										<span class="am-input-group-btn add-span">
											<a class="add am-btn am-btn-default am-select am-back ngco-Ono-radiusR" href="javascript:; ">全选</a>
										</span>
										<input type="hidden" name="action" value="" id="action">
										<select class="am-select-hover" data-am-selected="{btnSize: 'sm'}" style="display: none;">
											<option value='0'>将选中项</option>
											<option value='del'>删除</option>
                                            <option value="audit">审核</option>
                                            <option value="unaudit">取消审核</option>
                                            <option value="recom">推荐</option>
                                            <option value="unrecom">取消推荐</option>
										</select>
									</div>
								</div>
								{% endif %}
								{% if page_data['total_page'] > 1 %}
								{{page_html}}
								{% endif %}
							</form>
						</div>
					</div>
				</div>
				<div class="am-alert am-alert-warning">
					<ul>
                        <li>1、本模块需高级接口支持，并且需要开启高级接口以下服务（在微信公众平台“我的服务”中开启）：</li>
                        <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OAuth2.0网页授权：授权回调页面域名请填写当前域名，即：<span class="col-039">{{kg['server']['HTTP_HOST']}}</span></li>
                        <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;语音识别：语音识别功能，用户发送语音消息时会自动识别。</li>
                        <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;获取用户地理位置：开启后可以获取用户地理位置信息。</li>
                        <li>2、推荐消息：推荐的消息可以用于大屏幕显示，如婚庆祝福、公司会议等现场大屏幕展示。</li>
                        <li>3、审核消息：这取决于你的模板，审核后的消息可以用于照片墙、微信墙等前台页面显示。</li>
                        <li>4、黑名单：恶意发布信息者可以将其移到黑名单组屏蔽其消息。</li>
					</ul>
				</div>
			</div>
			{% include 'component_footer.tpl' %}
		</div>
		</div><!-- /.scrollbar-wrap -->
	</div>
</body>
<script>
	$(function(){
		var msg_count = {{count}}
		setInterval(function(){
            var formData = new FormData();
			formData.append("action", 'getcount');
			formData.append("count", msg_count);
			$.ajax({
				scriptCharset: 'UTF-8',
				type: 'post',
				url: '',
				data: formData,
				cache: false,
				processData: false,
				contentType: false,
				dataType : "json",
			}).success(function(data) {
				console.log(data.new)
				if(data.new > 0){
					$('#NewsInformation').show();
					$('#NewsInformation font').html(data.new)
				}
			}).error(function() {
				alert("请求失败");
			});
        }, 1000);
	})
</script>
</html>