<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>物业报修-填写信息</title>
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="yes" name="apple-touch-fullscreen">
<meta content="telephone=no" name="format-detection">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
<link rel="stylesheet" type="text/css" href="http://static.17shihui.com/pageapp/css/comact/mobile.common.css?static_version=1438944758593">
<link rel="stylesheet" type="text/css" href="http://static.17shihui.com/communitym/cm1.10/css/mobile.alert.css">
<link rel="stylesheet" type="text/css" href="../css/style.css">
</head>
<body>
<div class="fill_wrap">
<label class="name ipt">
<input type="text" placeholder="请输入您的姓名" id="name">
<p class="name_in"></p>
</label>
<label class="tel ipt">
<input type="tel" placeholder="请输入您的电话" id="tel">
<p class="tel_in"></p>
</label>
<textarea class="int_des" id="description" placeholder="请将情况描述的尽量清晰,包括具体位置,损坏物品等。"></textarea>
<p class="des_in"></p>
<a href="javascript:void(0)" class="btns" id="btns">反馈</a>
</div>
<script src="http://static.17shihui.cn/libs/zepto/zepto.min.js"></script>
<script src="http://static.17shihui.com/communitym/cm1.10/js/mobile.alert.js"></script>
<script type="text/javascript">
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return r[2];
return null;
};
function fillCome(ele) {
var name = $("#name").val();
var tel = $("#tel").val();
var description = $("#description").val();
var app_id = getQueryString(‘app_id‘);
var gid = getQueryString(‘gid‘)
if (!fillTab()) {
return;
}
ele.addClass("box");
$.ajax({
type: ‘POST‘,
url: ‘/saasapi/main/saas/repair/add‘,
data: { name: name, tel: tel, description: description, app_id: app_id, gid: gid },
dataType: ‘json‘,
headers: { Authorization: getQueryString(‘mauth‘).replace("+", " ") },
success: function(data) {
if (data.apistatus == 1) {
alert("感谢您的帮助和反馈,物业会尽快处理");
}
ele.removeClass("box");
}
})
}
function fillShow() {
$.ajax({
type: ‘GET‘,
url: ‘/saasapi/main/saas/repair/get_by_id‘,
data: { id: getQueryString(‘id‘) },
dataType: ‘json‘,
headers: { mauth: getQueryString(‘mauth‘).replace("+", " ") },
success: function(data) {
var rel = data.result;
if (data.apistatus == 1) {
$(".ipt input").hide();
$(".int_des").hide();
$("#btns").hide();
$(".name_in").show().html(rel.name);
$(".tel_in").show().html(rel.tel);
$(".des_in").show().html(rel.description);
}
}
})
}
if (getQueryString("id")) {
fillShow();
} else {
$("#btns").click(function() {
var _this = $(this);
if (!_this.hasClass("box")) {
fillCome(_this);
}
})
}
function fillTab() {
var flag = false;
var name = $("#name").val();
var tel = $("#tel").val();
var description = $("#description").val();
var str2 = /^[\u4e00-\u9fa5A-Za-z]{2,8}$/;
var str3 = /^1[0-9]{10}$/;
if (name == "") {
alert("请输入您的姓名");
return false;
}
if (!str2.test(name)) {
alert("姓名格式不对");
return false;
}
if (tel == "") {
alert("请输入您的电话");
return false;
}
if (!str3.test(tel)) {
alert("手机格式不对");
return false;
}
if (description == "") {
alert("问题描述不能为空");
return false;
}
return true;
}
</script>
</body>
</html>