2 Star 0 Fork 0

流行守望者/school

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
leavemsg.html 2.79 KB
一键复制 编辑 原始数据 按行查看 历史
丿W丶F丿 提交于 2022-02-24 19:31 . 聊天,新闻
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>发送留言</title>
<link rel="stylesheet" type="text/css" href="css/reset.css"/>
<link rel="stylesheet" type="text/css" href="css/layui.css"/>
<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/layer/layer.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
.sub-btn{
display: block;
color: white;
}
body{
padding: 0.3125rem;
background-color: #F3F4F6;
}
.tips{
margin: 0.625rem 0rem;
color: #C9C9C9;
}
.star{
color: red;
margin-left: 0.325rem;
}
.layui-form-item>div{
margin-bottom: 0.25rem;
color: #4E5465;
}
</style>
</head>
<body>
<div class="layui-form">
<div class="tips">请填写以下信息,我们会尽快和您联系。</div>
<div class="layui-form-item">
<div>您的姓名 <span class="star">*</span></div>
<input type="text" class="layui-input" required lay-verify="required" id="name" placeholder="您的姓名">
</div>
<div class="layui-form-item">
<div>电话号码<span class="star">*</span></div>
<input type="number" class="layui-input" id="tel" lay-verify="phone" placeholder="电话号码">
</div>
<div class="layui-form-item">
<div>电子邮箱</div>
<input type="text" class="layui-input" id="email" placeholder="电子邮箱">
</div>
<div class="layui-form-item">
<div>留言内容</div>
<textarea name="desc" placeholder="请输入内容" id="content" class="layui-textarea"></textarea>
</div>
<button class="layui-btn layui-btn-fluid">提交</button>
</div>
</body>
<script src="js/config.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(".layui-btn").click(function(){
let name = $("#name").val(),tel = $("#tel").val(),email = $("#email").val(),content= $("#content").val();
if(name.length<1){
layer.msg("请填写您的姓名");
return;
}
if(tel.length<1){
layer.msg("请填写您的手机号码");
return;
}
let reg = /^1(3\d|4[5-8]|5[0-35-9]|6[567]|7[01345-8]|8\d|9[025-9])\d{8}$/;
if(!reg.test(tel)){
layer.msg("请填写正确的手机号");
return;
}
var d = {"zxphone":tel,"zxname":name,"zxemail":email,"zxmsg":content};
$.ajax({
url:HOST+"/h5/zixunadd",
type:"post",
data:JSON.stringify(d),
// data:{"zxname":name },
contentType: 'application/json',
success: (res) => {
console.log(res);
if(res.code==200){
layer.msg("提交成功,我们会尽快安排人联系您!")
window.history.back();
}else{
console.log("请求失败");
}
}
})
})
</script>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liuxingshouwangzhe/school.git
[email protected]:liuxingshouwangzhe/school.git
liuxingshouwangzhe
school
school
master

搜索帮助