<?php if (!defined('ROOT')) exit; ?>
<!DOCTYPE html>
<html>

	<head>
		<title>举报</title>
		<meta name="description" content="">
		<meta name="keywords" content="">
		<?php
			include 'Inc_files.php';
		?>
		<link rel="stylesheet" href="/static/uhome/css/style.css" />
		<link rel="stylesheet" href="/static/uhome/css/report_add.css" />
	</head>
	<body data-type="index">
		<div class="content">
			<!--顶部导航-->
			<div id="content">
				<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-body am-fr">
                            <form action="/v/add" method="post" class="am-form tpl-form-border-form tpl-form-border-br">
                            	<input type="hidden" name="model_id" value="40" />
                            	<input type="hidden" name="uid" value="<?php echo I('uid');?>" />
                            	<input type="hidden" name="pk" value="<?php echo I('pk');?>" />
                            	<input type="hidden" name="ctime" value="<?php echo time();?>" />
                                <div class="am-form-group">
                                    <label for="user-phone" class="am-u-sm-3 am-form-label">举报类型</label>
                                    <div class="am-u-sm-9">
                                    	<?php 
                                    	$extra=M('attribute')->where(array('model_id'=>40,'name'=>type))->getField('extra');
                                    	$extra=preg_split("/[\r\n]+/s",$extra,-1,PREG_SPLIT_NO_EMPTY);
                                		foreach($extra as $k=>&$v){
                                			$v = preg_split("/[:]+/s", $v,-1,PREG_SPLIT_NO_EMPTY);
                                		}
                                    	?>
                                        <select name="type" data-am-selected="{searchBox: 0}" style="width: 200px;">
										  	<?php foreach($extra as $k=>&$v){?>
											  	<option value="<?php echo $v[0];?>"><?php echo $v[1];?></option>
											<?php }?>
										</select>
                                    </div>
                                </div> 
                                <div class="am-form-group">
                                    <label for="user-name" class="am-u-sm-3 am-form-label">联系信息 </label>
                                    <div class="am-u-sm-9">
                                    	<input type="text" name="linkinfo" class="" id="doc-ipt-email-1" placeholder="联系QQ或联系手机">
                                        <small></small>
                                    </div>
                                </div>
                                <div class="am-form-group" style="height: 210px;">
                                    <label for="user-name" class="am-u-sm-3 am-form-label">举报备注 </label>
                                    <div class="am-u-sm-9">
                                        <textarea name="notes" rows="10" cols="5"></textarea>
                                        <small></small>
                                    </div>
                                </div>
                               
                                <div class="am-form-group">
                                    <div class="am-u-sm-9 am-u-sm-push-3">
                                        <button type="button" class="am-btn am-btn-primary tpl-btn-bg-color-success btn_submit">
                                        	提交
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
			</div>
			</div>
		</div>
		<?php
			include 'Inc_files_boot.php';
		?>
		<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
		  <div class="am-modal-dialog">
		    <div class="am-modal-hd">Amaze UI</div>
		    <div class="am-modal-bd">
		      你，确定要删除这条记录吗？
		    </div>
		    <div class="am-modal-footer">
		      <span class="am-modal-btn" data-am-modal-cancel>取消</span>
		      <span class="am-modal-btn" data-am-modal-confirm>确定</span>
		    </div>
		  </div>
		</div>
		<script type="text/javascript">
		jQuery(document).on('click','.btn_submit',function () {
		    var the=jQuery(this);
		    jQuery.ajax({
		    	url:"/v/add",
		        data:jQuery('form').serializeArray(),
		        dataType: "json",
		        type: "post",
		        timeout: 10000,
		        success: function(data) {
		        	if (data.status==1) {
		        		wd_alert({msg:'举报成功，我们将尽快处理'});
		        	}else{
		        		wd_alert({msg:data.info,background:'#f00'});
		        	}
		        	setTimeout(function () {
		        		parent.$.fancybox.close();
		        	},2000);
		        },
		        error: function() {
		            mui.toast("网络连接超时");
		        }
		    });          
		})
		</script>
	</body>
</html>