hothouseadd.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. use backend\assets\AppAsset;
  3. ?>
  4. <style>
  5. .layui_box {
  6. width: 80%;
  7. margin: 0 auto;
  8. margin-top: 25px;
  9. }
  10. .layui-code, .layui-upload-list {
  11. margin-top: 0;
  12. }
  13. hr {
  14. width: 100%;
  15. margin: 0 auto;
  16. }
  17. .mt {
  18. text-align: center;
  19. margin-top: 15px;
  20. }
  21. .The_house {
  22. background: #FBFBFB;
  23. color: #333;
  24. }
  25. .The_house:hover {
  26. border: 1px solid #a9a9a9;
  27. color: #333;
  28. }
  29. .xm_xcxqTc_button {
  30. margin-top: -20px;
  31. }
  32. </style>
  33. <form class="layui-form layui-form-pane">
  34. <div class="layui_box">
  35. <div class="layui-form-item">
  36. <label class="layui-form-label "><span style="color:red">*</span>选择楼盘:</label>
  37. <div class="layui-input-inline" style="width:43%">
  38. <input type="text" id="house_name" name="house_name" required lay-verify="required" disabled
  39. placeholder="请输入楼盘名称" autocomplete="off" class="layui-input">
  40. </div>
  41. <div class="layui-inline"><a class="layui-btn layui-btn-primary The_house" href="javascript:;">选择所属楼盘</a>
  42. </div>
  43. </div>
  44. <input type="hidden" name="type" value="<?php echo $type ?>">
  45. <div class="layui-form-item mt">
  46. <button class="layui-btn" lay-submit="" lay-filter="add">提交</button>
  47. </div>
  48. </div>
  49. </form>
  50. <script>
  51. layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () {
  52. var laypage = layui.laypage //分页
  53. , $ = layui.jquery
  54. , layer = layui.layer //弹层
  55. , table = layui.table //表格
  56. , element = layui.element //元素操作
  57. , form = layui.form
  58. , upload = layui.upload;
  59. var tableIds = 'videolist'; //表格ID
  60. var type_id = $('input[name="typeid"]').val();
  61. $('.The_house').focus(function () {
  62. // $('form').append('<input type="hidden" name="aa" value="aaa">');
  63. indexOpen = parent.layui.layer.open({
  64. type: 2,
  65. title: '选择需要添加的楼盘',
  66. area: ['', '100%'],
  67. content: '/publicuse/housenamecn',
  68. success: function (layero, index) {
  69. },
  70. end: function () {
  71. }
  72. });
  73. parent.layui.layer.full(indexOpen);
  74. //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
  75. $(window).on("resize", function () {
  76. parent.layui.layer.full(indexOpen);
  77. })
  78. })
  79. //添加页面提交数据
  80. form.on('submit(add)', function (data) {
  81. var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8}); //数据提交提示
  82. var formData = new FormData($('form')[0]);
  83. $.ajax({
  84. cache: false,
  85. type: "post",
  86. url: "/china/push/hothouseaddform",
  87. data: formData, // 你的formid
  88. contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
  89. processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
  90. error: function (request) {
  91. layer.close(index);
  92. layer.msg("请联系管理员");
  93. },
  94. success: function (data) {
  95. if (data.data != null) {
  96. layer.msg(ReturnInfo(data.data), {icon: 5});
  97. return;
  98. }
  99. layer.msg(data.msg);
  100. parent.layer.close(oindex); //再执行关闭
  101. }
  102. });
  103. return false;
  104. });
  105. })
  106. </script>