| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
-
- @{
- ViewBag.Title = "盐中校友会——留言";
- var nickName = string.IsNullOrEmpty(ViewBag.NickName) ? "" : ViewBag.NickName;
- var avatar = string.IsNullOrEmpty(ViewBag.Avatar) ? "" : ViewBag.Avatar;
- var gender = string.IsNullOrEmpty(ViewBag.Gender) ? "" : ViewBag.Gender;
- var openId = string.IsNullOrEmpty(ViewBag.OpenId) ? "" : ViewBag.OpenId;
- }
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="renderer" content="webkit">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta http-equiv="Cache-Control" content="no-siteapp" />
- <title>@ViewBag.Title</title>
- <meta name="keywords" content="盐城中学,盐中校友会,校友会,盐中">
- <meta name="description" content="">
- <link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
- <link href="~/Content/css/font-awesome.min.css" rel="stylesheet" />
- <link href="~/Content/css/animate.min.css" rel="stylesheet" />
- <link href="~/Content/css/style.min.css" rel="stylesheet" />
- <link href="~/Content/css/plugins/toastr/toastr.min.css" rel="stylesheet" />
- <script src="~/Content/js/jquery.min.js"></script>
- <script src="~/Content/js/bootstrap.min.js"></script>
- <script src="~/Content/js/plugins/toastr/toastr.min.js"></script>
- <script src="~/Content/js/content.min.js"></script>
- <script src="~/Content/js/plugins/validate/jquery.validate.min.js"></script>
- <script src="~/Content/js/plugins/validate/messages_zh.min.js"></script>
- <script src="~/Content/js/jquery.unobtrusive-ajax.min.js"></script>
- <script>
- //if (window.top !== window.self) { window.top.location = window.location };
- </script>
- <link href="~/Content/css/YZXYH.css" rel="stylesheet" />
- <style>
- .toast-center-center {
- top: 50%;
- left: 50%;
- margin-top: -30px;
- margin-left: -150px;
- }
- .count-info label {
- display: none;
- }
- body {
- background: linear-gradient(180deg, #3bb3c3, #3bb3c3);
- min-height: 100vh;
- overflow: hidden;
- padding-top: 15px;
- margin: 0 auto;
- width: 100vw;
- }
- form {
- margin-top: 5vh;
- }
- form .form-group {
- margin-bottom: 10px;
- }
- form label {
- color: #fff;
- }
- form .form-control {
- border-radius: 4px;
- }
- form textarea.form-control {
- min-height: 100px;
- height: 20vh;
- }
- form .checkbox, form .radio {
- position: relative;
- display: block;
- margin-top: 0px;
- margin-bottom: 10px;
- }
- #Save {
- background-color: #02569c;
- border-color: #02569c;
- color: #eee;
- transition: all .5s linear;
- }
- #Save.help {
- background-color: #ed5565;
- border-color: #ed5565;
- font-weight: 600;
- }
- #Save:hover {
- color: #fff;
- }
- .help-link {
- text-align: center;
- color: #ddd;
- margin-top: 5px;
- }
- .help-link a {
- padding: 10px 15px 5px;
- color: inherit;
- display: inline-block;
- }
- .help-link a:hover {
- color: #fff;
- }
- </style>
- </head>
- <body>
- <section class="hidden">
- <input id="hid_MemberPage" type="hidden" value="2" autocomplete="off" />
- </section>
- <div id="Home" style="">
- <div class="container">
- <form id="form" enctype="multipart/form-data">
- <h3 style="text-align: center; color: #fff;">愿望墙留言</h3>
- <div class="form-group">
- <label for="msgContent">想说的话</label>
- <textarea class="form-control required" id="msgContent" placeholder="请输入您想说的话..." autocomplete="off"></textarea>
- </div>
- <div class="checkbox ">
- @*<label>
- <input type="checkbox" id="isHide" style="margin-top: 0px;" autocomplete="off"> 匿名留言
- </label>*@
- <label style=" margin-left: 20px; color: #fff; font-weight: 600;">
- <input type="checkbox" id="isHelp" style="margin-top: 0px" autocomplete="off"> 我要求助
- </label>
- </div>
- <div class="form-group mobile" style="display: none">
- <label for="mobile">手机号码</label>
- <input type="text" class="form-control" placeholder="请留下联系方式" id="mobile" name="mobile" autocomplete="off" value="@(ViewBag.Mobile)">
- </div>
- <div class="form-group ">
- <label for="mobile">上传图片</label>
- <input type="file" class="form-control" placeholder="上传图片" id="image" name="image" autocomplete="off" value=" " accept="image/*" />
- </div>
- <div class="form-group nickName">
- <label for="nickName">留言昵称</label>
- <input type="text" class="form-control" placeholder="留言昵称" id="nickName" nickName="nickName" value="@(nickName)" autocomplete="off">
- </div>
- <button id="Save" type="button" class="btn " style="width: 100%">发布留言</button>
- </form>
- <div class="help-link">
- <a href="@Url.Action("Reply","MessageWall")">求助信息</a>
- |
- <a href="@Url.Action("ReplyDetail","MessageWall")">我的求助</a>
- </div>
- </div>
- </div>
- <script src="~/Content/js/content.min.js"></script>
- <script>
- var nickName = "@(nickName)",msgType=0;
- $(function() {
- $('#isHide').on("change",function() {
- if ($(this).is(':checked')) {
- $('#nickName').val(nickName);
- $('.nickName').hide();
- } else {
- $('.nickName').show();
- }
- });
- $('#isHelp').on("change",function() {
- if ($(this).is(':checked')) {
- $('#Save').text("发布求助信息").addClass('help');
- $('#mobile').addClass('required');
- $('.mobile').show();
- msgType = 1;
- } else {
- $('#Save').text("留言").removeClass('help');
- $('#mobile').removeClass('required');
- $('.mobile').hide();
- msgType = 0;
- }
- });
- $('#Save').on('click', WriteMsg);
- $('#form .form-control').keypress(function(e) {
- if (e.keyCode === 13) {
- WriteMsg();
- }
- });
- });
- var toastrOptions={
- "closeButton": true,
- "progressBar": true,
- "positionClass": "toast-center-center",
- "showDuration": "400",
- "hideDuration": "1000",
- "timeOut": "5000",
- "extendedTimeOut": "1000",
- "showEasing": "swing",
- "hideEasing": "linear",
- "showMethod": "fadeIn",
- "hideMethod": "fadeOut"
- }
- function WriteMsg() {
- $('#Save').prop("disabled", true);
-
- var formData= new FormData();
- formData.append('MsgContent' , $('#msgContent').val());
- formData.append('Mobile' , $('#mobile').val());
- formData.append('NickName' , $('#nickName').val());
- formData.append('OpenId' , '@(openId)');
- formData.append('Avatar' , '@(avatar)');
- formData.append('Gender' , '@(gender)');
- formData.append('Image',$('#image')[0].files[0]);
- formData.append('MsgType' , msgType);
- $.ajax({
- url: "@Url.Action("WriteMsg", "MessageWall")",
- type: "post",
- processData: false,
- contentType: false,
- beforeSend: function () {
- var form = $("#form");
- form.validate({
- errorPlacement: function (error, element) {
- element.parent().after(error);
- }
- });
- return form.valid();
- },
- data:formData,
- success: function (msg) {
- window.toastr.options = toastrOptions;
- if (msg && msg.Success) {
- $("#form")[0].reset();
- window.toastr["success"]("留言成功");
- } else {
- if (msg.Msg) {
- window.toastr["error"]("留言失败:" + msg.Msg);
- } else {
- window.toastr["error"]("留言失败");
- }
- }
- },
- error: function (xmlHttpRequest, errMsg) {
- window.toastr["error"]("留言失败");
- }
- });
- var delay = 10;
- var timer = setInterval(function df() {
- delay--;
- $('#Save').html("等待 " +delay+ "s")
- if (delay == 0) {
- $('#Save').html("发布留言")
- $('#Save').prop("disabled", false);
- clearInterval(timer);
- }
- }, 1000)
- }
- </script>
- </body>
- </html>
|