Browse Source

优化代码

廖泽华 4 years ago
parent
commit
f293188e4d
100 changed files with 23572 additions and 1158 deletions
  1. 20 0
      backend/controllers/PushController.php
  2. 1082 1158
      backend/controllers/PushmController.php
  3. 207 0
      backend/views/pushm/hothouse.php
  4. 127 0
      backend/views/pushm/hothouseadd.php
  5. 177 0
      backend/web/js/adpositioncategory.js
  6. 259 0
      backend/web/js/adviser/adviser.js
  7. 342 0
      backend/web/js/allpush/advertisement/home.js
  8. 276 0
      backend/web/js/brand/brand.js
  9. 162 0
      backend/web/js/brand/house.js
  10. 404 0
      backend/web/js/china/bottom.js
  11. 296 0
      backend/web/js/china/brand/brand.js
  12. 161 0
      backend/web/js/china/brand/house.js
  13. 336 0
      backend/web/js/china/city.js
  14. 119 0
      backend/web/js/china/dictionarya/architecture.js
  15. 116 0
      backend/web/js/china/dictionarya/houselabel.js
  16. 161 0
      backend/web/js/china/dictionarya/label.js
  17. 136 0
      backend/web/js/china/dictionarya/price.js
  18. 174 0
      backend/web/js/china/dictionarya/renovation.js
  19. 113 0
      backend/web/js/china/dictionarya/theme.js
  20. 257 0
      backend/web/js/china/facilities.js
  21. 654 0
      backend/web/js/china/house.js
  22. 146 0
      backend/web/js/china/house_select_city.js
  23. 289 0
      backend/web/js/china/housealbum.js
  24. 230 0
      backend/web/js/china/housenews.js
  25. 253 0
      backend/web/js/china/housepeitao.js
  26. 271 0
      backend/web/js/china/houseprice.js
  27. 166 0
      backend/web/js/china/housetype.js
  28. 296 0
      backend/web/js/china/housetypebinding.js
  29. 510 0
      backend/web/js/china/knowledge.js
  30. 264 0
      backend/web/js/china/live.js
  31. 746 0
      backend/web/js/china/news.js
  32. 166 0
      backend/web/js/china/newscategory.js
  33. 219 0
      backend/web/js/china/newslabel/knowledge.js
  34. 56 0
      backend/web/js/china/other/about.js
  35. 318 0
      backend/web/js/china/other/houses.js
  36. 146 0
      backend/web/js/china/other/link.js
  37. 138 0
      backend/web/js/china/other/mail.js
  38. 233 0
      backend/web/js/china/other/setsite.js
  39. 180 0
      backend/web/js/china/other/sync.js
  40. 110 0
      backend/web/js/china/other/syncOperate.js
  41. 236 0
      backend/web/js/china/other/tel.js
  42. 67 0
      backend/web/js/china/other/watermark.js
  43. 297 0
      backend/web/js/china/photoalbum.js
  44. 279 0
      backend/web/js/china/presell.js
  45. 136 0
      backend/web/js/china/pricetrend/city_price_record.js
  46. 278 0
      backend/web/js/china/pricetrend/housingprice.js
  47. 268 0
      backend/web/js/china/pricetrend/price.js
  48. 277 0
      backend/web/js/china/pushnews/column.js
  49. 279 0
      backend/web/js/china/pushnews/columncontent.js
  50. 319 0
      backend/web/js/china/pushnews/news.js
  51. 334 0
      backend/web/js/china/pushnews/pone.js
  52. 114 0
      backend/web/js/china/pushnews/pushnews.js
  53. 319 0
      backend/web/js/china/pushnews/quicknews.js
  54. 378 0
      backend/web/js/china/timelimitsgroup.js
  55. 137 0
      backend/web/js/china/usersignup/label.js
  56. 205 0
      backend/web/js/china/usersignup/signup.js
  57. 0 0
      backend/web/js/china/usersignup/userdetails.js
  58. 147 0
      backend/web/js/city/currency.js
  59. 397 0
      backend/web/js/city/overview.js
  60. 115 0
      backend/web/js/dictionarya/bottomlabel.js
  61. 120 0
      backend/web/js/housech/dictionarya/architecture.js
  62. 117 0
      backend/web/js/housech/dictionarya/houselabel.js
  63. 116 0
      backend/web/js/housech/dictionarya/label.js
  64. 137 0
      backend/web/js/housech/dictionarya/price.js
  65. 175 0
      backend/web/js/housech/dictionarya/renovation.js
  66. 114 0
      backend/web/js/housech/dictionarya/theme.js
  67. 245 0
      backend/web/js/housech/facilities.js
  68. 288 0
      backend/web/js/housech/housealbum.js
  69. 202 0
      backend/web/js/housech/housebatchsave.js
  70. 232 0
      backend/web/js/housech/housenews.js
  71. 235 0
      backend/web/js/housech/housepeitao.js
  72. 274 0
      backend/web/js/housech/houseprice.js
  73. 789 0
      backend/web/js/housech/houses.js
  74. 146 0
      backend/web/js/housech/houses_select_city.js
  75. 156 0
      backend/web/js/housech/housetype.js
  76. 293 0
      backend/web/js/housech/housetypebinding.js
  77. 291 0
      backend/web/js/housech/photoalbum.js
  78. 284 0
      backend/web/js/housech/presell.js
  79. 137 0
      backend/web/js/housech/usersignup/label.js
  80. 196 0
      backend/web/js/housech/usersignup/signup.js
  81. 0 0
      backend/web/js/housech/usersignup/userdetails.js
  82. 256 0
      backend/web/js/investhot/investhot.js
  83. 424 0
      backend/web/js/knowledge/cityintro.js
  84. 139 0
      backend/web/js/knowledge/label.js
  85. 279 0
      backend/web/js/knowledge/pone.js
  86. 148 0
      backend/web/js/other/fixedinfo.js
  87. 228 0
      backend/web/js/other/telrecord.js
  88. 149 0
      backend/web/js/publicuse/cncity.js
  89. 114 0
      backend/web/js/publicuse/cnnews.js
  90. 154 0
      backend/web/js/publicuse/housecn.js
  91. 282 0
      backend/web/js/push/hotrotation.js
  92. 255 0
      backend/web/js/push/newshotactivity.js
  93. 212 0
      backend/web/js/pushm/averageprice.js
  94. 282 0
      backend/web/js/pushm/hotrotation.js
  95. 194 0
      backend/web/js/pushm/hotsaleyahu.js
  96. 331 0
      backend/web/js/pushm/yahucity.js
  97. 215 0
      backend/web/js/pushm/zttime.js
  98. 280 0
      backend/web/js/pushnews/floorinfo.js
  99. 185 0
      backend/web/js/routine/rent.js
  100. 0 0
      backend/web/js/routine/terms.js

+ 20 - 0
backend/controllers/PushController.php

@@ -12,6 +12,7 @@ use backend\base\CommonController;
12 12
 use backend\base\Help;
13 13
 use backend\server\NewsInformation;
14 14
 use common\models\CategoryCity;
15
+use common\models\PushHothouse;
15 16
 use common\models\HomeDiscount;
16 17
 use common\models\PushBottom;
17 18
 use common\models\PushCityprice;
@@ -1278,4 +1279,23 @@ class PushController extends CommonController
1278 1279
         $cityModel = $city->getList([]);
1279 1280
         return $cityModel;
1280 1281
     }
1282
+	
1283
+	
1284
+	/**
1285
+	 * 推送楼盘数据
1286
+	 * @return mixed
1287
+	 */
1288
+	public function actionHothouseform()
1289
+	{
1290
+		$model = new PushHothouse();
1291
+		$input = Yii::$app->request->post();
1292
+		$result = $model->getList($input);
1293
+		if ($result != null) {
1294
+			foreach ($result as &$val) {
1295
+				$val['create_at'] = date('Y-m-d H:i', $val['create_at']);
1296
+			}
1297
+			return Help::JsonData(0, Yii::t('app', 'get_success'), $model->Total($input), $result);
1298
+		}
1299
+		return Help::JsonCode(Help::ERROR, Yii::t('app', 'get_error'));
1300
+	}
1281 1301
 }

File diff suppressed because it is too large
+ 1082 - 1158
backend/controllers/PushmController.php


+ 207 - 0
backend/views/pushm/hothouse.php

@@ -0,0 +1,207 @@
1
+<?php
2
+
3
+
4
+use backend\assets\AppAsset;
5
+
6
+?>
7
+<style>
8
+    body {
9
+        padding: 15px;
10
+    }
11
+
12
+    .layui-elem-quote {
13
+        margin-bottom: 0;
14
+        border-left: none;
15
+        padding: 10px;
16
+    }
17
+
18
+    .layui-table-page .layui-laypage {
19
+        float: right;
20
+        margin-right: 1%;
21
+    }
22
+
23
+    .layui-table-view .layui-form-switch {
24
+        right: 0px
25
+    }
26
+
27
+</style>
28
+
29
+<form action="" class="layui-form">
30
+    <fieldset class="layui-elem-field">
31
+        <legend>搜索信息</legend>
32
+        <div class="layui-field-box">
33
+            <blockquote class="quoteBox demoTable">
34
+                <div class="layui-inline">
35
+                    <span>楼盘:</span>
36
+                    <div class="layui-input-inline">
37
+                        <input type="text" name="input_house_text" class="layui-input searchVal"
38
+                               placeholder="请输入需要搜索的楼盘"/>
39
+                    </div>
40
+                </div>
41
+                <div class="layui-inline">
42
+                    <a class="layui-btn search_btn" data-type="reload"><i class="layui-icon layui-icon-search"></i>搜索</a>
43
+                </div>
44
+                <input type="hidden" name="typeid" value="<?php echo $type ?>">
45
+
46
+            </blockquote>
47
+        </div>
48
+    </fieldset>
49
+</form>
50
+<blockquote class="layui-elem-quote quoteBox demoTable">
51
+    <div class="layui-btn-group demoTable">
52
+        <a class="layui-btn" data-type="addData">新增</a>
53
+    </div>
54
+</blockquote>
55
+<table id="videolist" lay-filter="videolist"></table>
56
+
57
+
58
+<script type="text/html" id="operate">
59
+
60
+    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
61
+</script>
62
+<!-- 排序 -->
63
+<script type="text/html" id="sortBox">
64
+    {{#  if(d.sort){ }}
65
+    <div style="border:1px solid #E6E6E6;height:27px;line-height:27px;box-shadow:1px 1px 1px 1px rgba(224, 224, 224, 0.76);">
66
+        {{ d.sort }}
67
+    </div>
68
+    {{#  } }}
69
+</script>
70
+
71
+<script>
72
+    window.onload = function(){
73
+        layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () {
74
+
75
+            var laypage = layui.laypage //分页
76
+                , $ = layui.jquery
77
+                , layer = layui.layer //弹层
78
+                , table = layui.table //表格
79
+                , element = layui.element //元素操作
80
+                , form = layui.form
81
+                , upload = layui.upload;
82
+
83
+
84
+            var tableIds = 'videolist';  //表格ID
85
+            var type_id = $('input[name="typeid"]').val();
86
+            //第一个实例
87
+            table.render({
88
+                elem: '#' + tableIds
89
+                , url: '/push/hothouseform' //数据接口
90
+                , where: {token: csrfToken, type: type_id}
91
+                , method: 'post'
92
+                , page: true //开启分页
93
+                , text: '数据加载中'
94
+                , id: 'tablerReload'
95
+                , cols: [[ //表头
96
+                    {type: 'numbers', title: '序号', width: 50},
97
+                    {field: 'name', title: '楼盘名称', align: 'center'},
98
+                    {
99
+                        field: 'sort',
100
+                        title: '排序',
101
+                        width: 100,
102
+                        event: 'sortData',
103
+                        edit: 'text',
104
+                        align: 'center',
105
+                        sort: true,
106
+                        templet: "#sortBox"
107
+                    },
108
+                    {field: 'create_at', title: '添加时间', width: 150, align: 'center'},
109
+                    {
110
+                        field: 'state', title: '审核', align: 'center', width: 100, templet: function (d) {
111
+                            if (d.state == 2) {
112
+                                return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
113
+                            } else {
114
+                                return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
115
+                            }
116
+                        }
117
+                    }
118
+                    , {fixed: 'right', title: '操作', width: 100, align: 'center', toolbar: '#operate'}
119
+
120
+                ]]
121
+            });
122
+
123
+            //监听指定开关
124
+            form.on('switch(switchTest)', function (data) {
125
+                layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
126
+                    $.post('/push/hothousedelshow', {id: data.value, type: 'show'}, function (data) {
127
+                        layer.msg(data.msg);
128
+                        table.reload('tablerReload');
129
+                    })
130
+                }, function (aa) {
131
+                    table.reload('tablerReload');        //重新加载
132
+                })
133
+            });
134
+
135
+
136
+            //列表操作
137
+            table.on('tool(' + tableIds + ')', function (obj) {
138
+                var layEvent = obj.event,
139
+                    data = obj.data;
140
+                if (layEvent === 'sortData') {       //修改排序
141
+                    table.on('edit(' + tableIds + ')', function (obj) {
142
+                        var data = obj.data;
143
+                        // console.log(data)
144
+                        $.post('/push/hothousedelshow', {
145
+                            id: data.id,
146
+                            type: 'sort',
147
+                            sort: data.sort
148
+                        }, function (data) {
149
+                            if (data.code == 200) {
150
+                                layer.msg(data.msg);
151
+                            } else if (data.code == 300) {
152
+                                layer.msg(data.msg);
153
+                            }
154
+                        })
155
+                    })
156
+
157
+                }
158
+                if (layEvent === 'del') {
159
+                    layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
160
+                        $.post('/push/hothousedelshow', {id: data.id, type: 'del'}, function (data) {
161
+                            layer.msg(data.msg);
162
+                            table.reload('tablerReload');
163
+                        })
164
+                    })
165
+                }
166
+
167
+            });
168
+
169
+            // 新增
170
+            var $ = layui.$, active = {
171
+                addData: function () { //获取选中数据
172
+                    var index = layui.layer.open({
173
+                        type: 2,
174
+                        title: '添加楼盘',
175
+                        closeBtn: 1, //不显示关闭按钮
176
+                        area: ['600px', '300px'],
177
+                        content: '/pushm/hothouseadd?type=' + type_id
178
+                        , success: function (layero, index) {
179
+                            // indexOpen = layer.getChildFrame('body', index)  ;
180
+                            // console.log(indexOpen);
181
+                        },
182
+                        end: function () {
183
+                            table.reload('tablerReload');
184
+                        }
185
+                    });
186
+                },
187
+                reload: function () {
188
+                    var form = pfgs_serialize($('form'));
189
+
190
+                    table.reload('tablerReload', {
191
+                        where: {
192
+                            name: form.input_house_text
193
+                        }
194
+                    })
195
+                }
196
+            };
197
+            $('.demoTable .layui-btn').on('click', function () {
198
+                var type = $(this).data('type');
199
+                active[type] ? active[type].call(this) : '';
200
+            });
201
+
202
+
203
+        })
204
+    }
205
+    
206
+    
207
+</script>

+ 127 - 0
backend/views/pushm/hothouseadd.php

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

+ 177 - 0
backend/web/js/adpositioncategory.js

@@ -0,0 +1,177 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form
8
+        ,upload = layui.upload;
9
+
10
+    var tableIds = 'adCategoryList';
11
+    //第一个实例
12
+    table.render({
13
+        elem: '#'+tableIds
14
+        ,url: '/dictionary/adpositionform' //数据接口
15
+        ,where:{token:csrfToken}
16
+        ,method:'post'
17
+        ,page: true //开启分页
18
+        ,height:600
19
+        ,text:'数据加载中'
20
+        ,cols: [[ //表头
21
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
22
+            {field: 'news_name', title: '资讯名称', width:200,align:'center'}
23
+            ,{field: 'sort', title: '排序', width:80,align:'center'}
24
+            ,{field: 'state', title: '状态', width:80,align:'center'}
25
+            ,{field: 'recommend', title: '是否推荐', width:120,align:'center'}
26
+            ,{field: 'update_at', title: '更新时间', width:150,align:'center'}
27
+            ,{field: 'create_at', title: '添加时间', width:150,align:'center'}
28
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
29
+
30
+        ]]
31
+    });
32
+
33
+    //列表操作
34
+    table.on('tool('+tableIds+')', function(obj){
35
+        var layEvent = obj.event,
36
+            data = obj.data;
37
+        if(layEvent === 'edit'){
38
+            layer.open({
39
+                type: 2,
40
+                title: '修改户型',
41
+                closeBtn: 1, //不显示关闭按钮
42
+                shade: [0],
43
+                area: ['600px', '500px'],
44
+                anim: 2,
45
+                content: ['/dictionary/adpositionedit?id='+data.id, 'yes'], //iframe的url,no代表不显示滚动条
46
+            });
47
+        } else if(layEvent === 'del') {
48
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
49
+                $.post('/dictionary/adpositiondel',{'id':data.id},function (data) {
50
+                    if(data.code == 200)
51
+                    {
52
+                        layer.msg(data.msg);
53
+                        table.reload(tableIds);
54
+                    } else if(data.code == 300 ) {
55
+                        layer.msg(data.msg);
56
+                    }
57
+                })
58
+            })
59
+        }
60
+
61
+
62
+    });
63
+
64
+    var $ = layui.$, active = {
65
+        addData: function(){ //获取选中数据
66
+
67
+            layer.open({
68
+                type: 2,
69
+                title: '添加资讯分类',
70
+                closeBtn: 1, //不显示关闭按钮
71
+                shade: [0],
72
+                area: ['600px', '500px'],
73
+                anim: 2,
74
+                content: ['/dictionary/adpositionadd', 'yes'], //iframe的url,no代表不显示滚动条
75
+            });
76
+
77
+            // var checkStatus = table.checkStatus('idTest')
78
+            //     ,data = checkStatus.data;
79
+            // layer.alert(JSON.stringify(data));
80
+        }
81
+    };
82
+
83
+    $('.demoTable .layui-btn').on('click', function(){
84
+        var type = $(this).data('type');
85
+        active[type] ? active[type].call(this) : '';
86
+    });
87
+
88
+    //修改
89
+    form.on('submit(editnews)', function(data){
90
+        var formData = new FormData($('form')[0]);
91
+        $.ajax({
92
+            cache : true,
93
+            type : "post",
94
+            url : '/dictionary/adpositioneditform',
95
+            data : formData,  // 你的formid
96
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
97
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
98
+            error : function(request) {
99
+                layer.close(index);         //关闭数据提交信息
100
+                layer.alert("网络超时");
101
+            },
102
+            success : function(data) {
103
+                if(data.data != null){
104
+                    layer.msg(ReturnInfo(data.data),{icon:5});
105
+                    return ;
106
+                }
107
+                layer.msg(data.msg);
108
+            }
109
+        });
110
+        // $.post('/dictionary/newseditform',{'data':data.field,'token':csrfToken},function (data) {
111
+        //     if(data.code == 200)
112
+        //     {
113
+        //         layer.msg(data.msg);
114
+        //         parent.layui.table.reload(tableIds);
115
+        //         TableClose();
116
+        //     } else if(data.code == 300 ) {
117
+        //         layer.msg(data.msg);
118
+        //     }
119
+        // })
120
+        return false;
121
+    });
122
+
123
+    //添加
124
+    form.on('submit(addnews)', function(data){
125
+
126
+        var formData = new FormData($('form')[0]);
127
+        $.ajax({
128
+            cache : true,
129
+            type : "post",
130
+            url : '/dictionary/adpositionaddform',
131
+            data : formData,  // 你的formid
132
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
133
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
134
+            error : function(request) {
135
+                layer.close(index);         //关闭数据提交信息
136
+                layer.alert("网络超时");
137
+            },
138
+            success : function(data) {
139
+                if(data.data != null){
140
+                    layer.msg(ReturnInfo(data.data),{icon:5});
141
+                    return ;
142
+                }
143
+                layer.msg(data.msg);
144
+            }
145
+        });
146
+        return false;
147
+
148
+        // $.post('/dictionary/newsaddform',{'data':data.field,'token':csrfToken},function (data) {
149
+        //     if(data.code == 200)
150
+        //     {
151
+        //         layer.msg(data.msg);
152
+        //         parent.layui.table.reload(tableIds);
153
+        //     } else if(data.code == 300 ) {
154
+        //         layer.msg(data.msg);
155
+        //     }
156
+        // })
157
+        // return false;
158
+    });
159
+
160
+    //上传图片
161
+    upload.render({
162
+        elem: '#test1'
163
+        ,url: '/house/createimg'
164
+        ,data:{token:csrfToken}
165
+        ,field:'img'
166
+        ,size:1000              //限制上传图片的大小,单位为KB
167
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
168
+        ,auto:false
169
+        ,bindAction:'#addcity'
170
+        ,choose: function(obj){
171
+            obj.preview(function(index, file, result){
172
+                $('#demo1').attr('src', result); //图片链接(base64)
173
+            });
174
+        }
175
+    });
176
+
177
+});

+ 259 - 0
backend/web/js/adviser/adviser.js

@@ -0,0 +1,259 @@
1
+layui.use([ 'laypage', 'layer', 'laydate', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,laydate = layui.laydate
7
+        ,table = layui.table //表格
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+
12
+
13
+    var tableIds = 'videolist';  //表格ID
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#'+tableIds
17
+        ,url: '/adviser/indexform' //数据接口
18
+        ,where:{token:csrfToken}
19
+        ,method:'post'
20
+        ,page: true //开启分页
21
+        ,height:600
22
+        ,text:'数据加载中'
23
+        ,id:'tablerReload'
24
+        ,cols: [[ //表头
25
+            {type:'numbers',title:'序号',width:50},
26
+            {field: 'name', title: '名称', align:'center'},
27
+            {field: 'tel', title: '电话', align:'center'},
28
+            {field: 'img', title: '头像',width:200, align:'center',templet:function(d){
29
+                    return '<img class="layui_magnify" src="'+d.img+'"/>'
30
+                }}
31
+            // {field: 'sort', title: '排序',width:100, event:'sortData', align:'center',sort: true,templet:"#sortBox"}
32
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
33
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
34
+                    if(d.is_show == 2){
35
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
36
+                    } else {
37
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
38
+                    }
39
+                }}
40
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
41
+
42
+        ]]
43
+    });
44
+
45
+    // 列表点击放大图片
46
+    $('.layui-table-main').on('click','.layui_magnify', function(){
47
+        var _src = $(this).attr('src');
48
+        layui.layer.open({
49
+            type: 1,
50
+            title: false,           //是否显示标题
51
+            area: ['95%', '55%'],
52
+            shade: 0.6,           //透明度
53
+            closeBtn: 1,         //按钮 1有,0无
54
+            shadeClose: true,
55
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
56
+        });
57
+    });
58
+
59
+
60
+    //监听指定开关
61
+    form.on('switch(switchTest)', function(data){
62
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
63
+            $.post('/adviser/indexdelandsow',{id:data.value,type:'show'},function (data) {
64
+                layer.msg(data.msg);
65
+                table.reload('tablerReload');
66
+
67
+            })
68
+        },function (aa) {
69
+            table.reload('tablerReload');        //重新加载
70
+        })
71
+    });
72
+
73
+    form.on('select(selcity)', function(data){
74
+       var city=data.elem[data.elem.selectedIndex].text;
75
+       $('#cityName').val(city);
76
+    });
77
+
78
+    //列表操作
79
+    table.on('tool('+tableIds+')', function(obj){
80
+        var layEvent = obj.event,
81
+            data = obj.data;
82
+
83
+        if(layEvent === 'sortData'){       //修改排序
84
+            layer.prompt({
85
+                formType: 2
86
+                ,title: '排序特色类型:<span style="color:red">'+data.name+'</span>'
87
+                ,value: data.sort
88
+            }, function(value, index){
89
+
90
+                $.post('/adviser/indexdelshow',{id:data.id,type:'sort',sort:value},function (data) {
91
+                    layer.msg(data.msg);
92
+                    table.reload('tablerReload');
93
+                })
94
+            });
95
+        }else if(layEvent === 'del') {
96
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
97
+                $.post('/adviser/indexdelandsow',{id:data.id,type:'del'},function (data) {
98
+                    layer.msg(data.msg);
99
+                    table.reload('tablerReload');
100
+                })
101
+            })
102
+        } else if(layEvent === 'edit'){
103
+            var index = layer.open({
104
+                type: 2,
105
+                title: '修改',
106
+                area:['800px','500px'],
107
+                content: '/adviser/indexedit?id='+data.id,
108
+                end:function () {
109
+                    table.reload('tablerReload');        //重新加载
110
+                }
111
+            });
112
+        }
113
+    });
114
+
115
+    //添加图片上传
116
+    upload.render({
117
+        elem: '#test1'
118
+        ,url: '/house/createimg'
119
+        ,data:{token:csrfToken}
120
+        ,field:'img'
121
+        ,size:1500              //限制上传图片的大小,单位为KB
122
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
123
+        ,auto:false
124
+        ,bindAction:'#addcity'
125
+        ,choose: function(obj){
126
+            obj.preview(function(index, file, result){
127
+                $('#breviary_img').attr('src', result); //图片链接(base64)
128
+            });
129
+        }
130
+    });
131
+    // 图片放大浏览
132
+    $('.layui_magnify').click(function(){
133
+        var _src = $(this).attr('src');
134
+        layui.layer.open({
135
+            type: 1,
136
+            title: false,           //是否显示标题
137
+            area: ['60%', '80%'],
138
+            shade: 0.6,           //透明度
139
+            closeBtn: 1,         //按钮 1有,0无
140
+            shadeClose: true,
141
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
142
+        });
143
+    })
144
+
145
+    // 新增
146
+    var $ = layui.$, active = {
147
+        addData: function(){ //获取选中数据
148
+            var index = layui.layer.open({
149
+                type: 2,
150
+                title: '添加',
151
+                closeBtn: 1, //不显示关闭按钮
152
+                area: ['800px','500px'],
153
+                content: '/adviser/indexadd' //iframe的url,no代表不显示滚动条
154
+                ,success:function (layero, index) {
155
+                },
156
+                end:function () {
157
+                    table.reload('tablerReload');
158
+                }
159
+            });
160
+        },
161
+        reload:function(){//搜索
162
+            var form = pfgs_serialize($('form'));
163
+            var name = '';
164
+            var house_name   = '';
165
+            if(form.input_house == 'name'){
166
+                name = form.input_house_text;
167
+            } else if(form.input_house == 'house_name'){
168
+                house_name = form.input_house_text;
169
+            }
170
+            table.reload('tablerReload',{
171
+                where:{
172
+                    title:name,
173
+                    house_name:house_name,
174
+                    city:form.input_city,
175
+                    type_name:form.type_name
176
+                }
177
+            })
178
+        },
179
+    };
180
+    $('.demoTable .layui-btn').on('click', function(){
181
+        var type = $(this).data('type');
182
+        active[type] ? active[type].call(this) : '';
183
+    });
184
+
185
+    //
186
+    // $('.The_house').focus(function(){
187
+    //     indexOpen = parent.layui.layer.open({
188
+    //         type: 2,
189
+    //         title: '选择需要添加的楼盘特色类型',
190
+    //         area: ['','100%'],
191
+    //         content: '/publicuse/ctype',
192
+    //         success:function (layero, index) {
193
+    //         },
194
+    //         end:function(){
195
+    //         }
196
+    //     });
197
+    //     parent.layui.layer.full(indexOpen);
198
+    //     //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
199
+    //     $(window).on("resize",function(){
200
+    //         parent.layui.layer.full(indexOpen);
201
+    //     })
202
+    // })
203
+
204
+// 日期
205
+    laydate.render({
206
+      elem: '#s_date'
207
+    });
208
+
209
+    //添加页面提交数据
210
+    form.on('submit(add)', function(data){
211
+        var formData = new FormData($('form')[0]);
212
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
213
+        $.ajax({
214
+            type : "post",
215
+            url : "/adviser/indexaddform",
216
+            data : formData,
217
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
218
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
219
+            error : function(request) {
220
+                layer.close(index);
221
+                layer.msg("请联系管理员");
222
+            },
223
+            success : function(data) {
224
+                if(data.data != null){
225
+                    layer.msg(ReturnInfo(data.data),{icon:5});
226
+                    return ;
227
+                }
228
+                layer.msg(data.msg);
229
+                parent.layer.close(oindex); //再执行关闭
230
+            }
231
+        });
232
+        return false;
233
+    });
234
+
235
+    form.on('submit(edit)', function(data){
236
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
237
+        var formData = new FormData($('form')[0]);
238
+        $.ajax({
239
+            type : "post",
240
+            url : "/adviser/indexeditform",
241
+            data : formData,
242
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
243
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
244
+            error : function(request) {
245
+                layer.close(index);
246
+                layer.msg("请联系管理员");
247
+            },
248
+            success : function(data) {
249
+                if(data.data != null){
250
+                    layer.msg(ReturnInfo(data.data),{icon:5});
251
+                    return ;
252
+                }
253
+                layer.msg(data.msg);
254
+                parent.layer.close(oindex); //再执行关闭
255
+            }
256
+        });
257
+        return false;
258
+    });
259
+})

+ 342 - 0
backend/web/js/allpush/advertisement/home.js

@@ -0,0 +1,342 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'videolist';  //表格ID
13
+    //第一个实例
14
+    table.render({
15
+        elem: '#'+tableIds
16
+        ,url: '/pushadvertisement/homeform' //数据接口
17
+        ,where:{token:csrfToken,type:1}
18
+        ,method:'post'
19
+        ,page: true //开启分页
20
+        ,height:600
21
+        ,text:'数据加载中'
22
+        ,id:'tablerReload'
23
+        ,cols: [[ //表头
24
+            {type:'numbers',title:'序号',width:50}
25
+            ,{field: 'city_name', title: '区域',align:'center',sort: true}
26
+            ,{field: 'img', title: '图片', align:'center',templet:function(d){
27
+                return '<img class="layui_magnify" src="'+d.img+'"/>'
28
+            }}
29
+            ,{field: 'img_ft', title: '繁体图片', align:'center',templet:function(d){
30
+                return '<img class="layui_magnify" src="'+d.img_ft+'"/>'
31
+            }}
32
+            ,{field: 'img_small', title: '小图标', align:'center',templet:function(d){
33
+                return '<img class="layui_magnify" src="'+d.img_small+'"/>'
34
+            }}
35
+            ,{field: 'samll_show', title: '小图审核',align:'center',width:100, templet:function (d) {
36
+                if(d.samll_show == 2){
37
+                    return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchShow" lay-text="|">'
38
+                } else {
39
+                    return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchShow" lay-text="|">'
40
+                }
41
+            }}
42
+            ,    {field: 'url', title: '地址',align:'center',templet:function(d){
43
+                    return '<a href="'+d.url+'" target="_blank">'+d.url+'</a>';
44
+                }}
45
+            ,{field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"}
46
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
47
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
48
+                    if(d.is_show == 2){
49
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
50
+                    } else {
51
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
52
+                    }
53
+                }}
54
+            ,{field: 'state', title: '报名',align:'center',width:100, templet:function (d) {
55
+                if(d.state == 2){
56
+                    return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchState" lay-text="|">'
57
+                } else {
58
+                    return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchState" lay-text="|">'
59
+                }
60
+            }}    
61
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
62
+
63
+        ]]
64
+    });
65
+
66
+    table.reload('tablerReload');        //重新加载
67
+
68
+    // 列表点击放大图片
69
+    $('.layui-table-main').on('click','.layui_magnify', function(){
70
+        var _src = $(this).attr('src');
71
+        layui.layer.open({
72
+            type: 1,
73
+            title: false,           //是否显示标题
74
+            area: ['95%', '55%'],
75
+            shade: 0.6,           //透明度
76
+            closeBtn: 1,         //按钮 1有,0无
77
+            shadeClose: true,
78
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
79
+        });
80
+    });
81
+
82
+
83
+    //监听指定开关
84
+    form.on('switch(switchTest)', function(data){
85
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
86
+            $.post('/pushadvertisement/delandshow',{id:data.value,edit_type:'show'},function (data) {
87
+                layer.msg(data.msg);
88
+                table.reload('tablerReload');
89
+
90
+            })
91
+        },function (aa) {
92
+            table.reload('tablerReload');        //重新加载
93
+        })
94
+    });
95
+
96
+    //监听指定开关
97
+    form.on('switch(switchShow)', function(data){
98
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
99
+            $.post('/pushadvertisement/delandshow',{id:data.value,edit_type:'small_show'},function (data) {
100
+                layer.msg(data.msg);
101
+                table.reload('tablerReload');
102
+
103
+            })
104
+        },function (aa) {
105
+            table.reload('tablerReload');        //重新加载
106
+        })
107
+    });
108
+    //监听指定开关
109
+    form.on('switch(switchState)', function(data){
110
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
111
+            $.post('/pushadvertisement/delandshow',{id:data.value,edit_type:'state'},function (data) {
112
+                layer.msg(data.msg);
113
+                table.reload('tablerReload');
114
+
115
+            })
116
+        },function (aa) {
117
+            table.reload('tablerReload');        //重新加载
118
+        })
119
+    });
120
+
121
+
122
+     //列表操作
123
+    table.on('tool('+tableIds+')', function(obj){
124
+        var layEvent = obj.event,
125
+            data = obj.data;
126
+        if(layEvent === 'edit'){
127
+           var index = layer.open({
128
+                type: 2,
129
+                title: '修改轮播图',
130
+                area:['800px','500px'],
131
+                content: '/pushadvertisement/edit?id='+data.id,
132
+                end:function () {
133
+                    table.reload('tablerReload');        //重新加载
134
+                }
135
+            });
136
+        } else if(layEvent === 'del') {
137
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
138
+                $.post('/pushadvertisement/delandshow',{id:data.id,edit_type:'del'},function (data) {
139
+                    layer.msg(data.msg);
140
+                    table.reload('tablerReload');
141
+                })
142
+            })
143
+        }else if(layEvent === 'sortData'){       //修改排序
144
+             table.on('edit('+tableIds+')', function(obj){
145
+                var data = obj.data;
146
+                $.post('/pushadvertisement/delandshow',{id:data.id,edit_type:'sort',sort:data.sort},function (data) {
147
+                    if(data.code == 200)
148
+                    {
149
+                        layer.msg(data.msg);
150
+                    } else if(data.code == 300 ) {
151
+                        layer.msg(data.msg);
152
+                    }
153
+                })
154
+            })
155
+        }
156
+
157
+    });
158
+
159
+
160
+
161
+    //添加图片上传
162
+    upload.render({
163
+         elem: '#test1'
164
+        ,url: '/house/createimg'
165
+        ,data:{token:csrfToken}
166
+        ,field:'img'
167
+        ,size:1000              //限制上传图片的大小,单位为KB
168
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
169
+        ,auto:false
170
+        ,bindAction:'#addcity'
171
+        ,choose: function(obj){
172
+            obj.preview(function(index, file, result){
173
+                $('#breviary_img').attr('src', result); //图片链接(base64)
174
+            });
175
+        }
176
+    });
177
+        //添加图片上传
178
+    upload.render({
179
+         elem: '#test2'
180
+        ,url: '/house/createimg'
181
+        ,data:{token:csrfToken}
182
+        ,field:'img_ft'
183
+        ,size:1000              //限制上传图片的大小,单位为KB
184
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
185
+        ,auto:false
186
+        ,bindAction:'#addcity'
187
+        ,choose: function(obj){
188
+            obj.preview(function(index, file, result){
189
+                $('#breviary_imgft').attr('src', result); //图片链接(base64)
190
+            });
191
+        }
192
+    });
193
+
194
+    //添加图片上传
195
+    upload.render({
196
+        elem: '#test3'
197
+        ,url: '/house/createimg'
198
+        ,data:{token:csrfToken}
199
+        ,field:'img_small'
200
+        ,size:1000              //限制上传图片的大小,单位为KB
201
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
202
+        ,auto:false
203
+        ,bindAction:'#addcity'
204
+        ,choose: function(obj){
205
+            obj.preview(function(index, file, result){
206
+                $('#breviary_imgsmall').attr('src', result); //图片链接(base64)
207
+            });
208
+        }
209
+    });
210
+    
211
+    // 图片放大浏览
212
+    $('.layui_magnify').click(function(){
213
+        var _src = $(this).attr('src');
214
+        layui.layer.open({
215
+            type: 1,
216
+            title: false,           //是否显示标题
217
+            area: ['60%', '80%'],
218
+            shade: 0.6,           //透明度
219
+            closeBtn: 1,         //按钮 1有,0无
220
+            shadeClose: true,
221
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
222
+        });
223
+    })
224
+
225
+     // 新增
226
+     var $ = layui.$, active = {
227
+        addData: function(){ //获取选中数据
228
+            var index = layui.layer.open({
229
+                type: 2,
230
+                title: '添加广告位置',
231
+                closeBtn: 1, //不显示关闭按钮
232
+                area: ['800px','500px'],
233
+                content: '/pushadvertisement/create' //iframe的url,no代表不显示滚动条
234
+                ,success:function (layero, index) {
235
+                },
236
+                end:function () {
237
+                    table.reload('tablerReload');
238
+                }
239
+            });
240
+        },
241
+        reload:function(){//搜索
242
+            var form = pfgs_serialize($('form'));
243
+            var name = '';
244
+            var house_name   = '';
245
+            if(form.input_house == 'name'){
246
+                name = form.input_house_text;
247
+            } else if(form.input_house == 'house_name'){
248
+                house_name = form.input_house_text;
249
+            }
250
+            table.reload('tablerReload',{
251
+                where:{
252
+                    title:name,
253
+                    house_name:house_name,
254
+                    city:form.input_city,
255
+                    type_name:form.type_name
256
+                }
257
+            })
258
+        },
259
+    };
260
+    $('.demoTable .layui-btn').on('click', function(){
261
+        var type = $(this).data('type');
262
+        active[type] ? active[type].call(this) : '';
263
+    });
264
+
265
+    //
266
+    // $('.The_house').focus(function(){
267
+    //     // $('form').append('<input type="hidden" name="aa" value="aaa">');
268
+    //     indexOpen = parent.layui.layer.open({
269
+    //         type: 2,
270
+    //         title: '选择需要添加的楼盘',
271
+    //         area: ['','100%'],
272
+    //         content: '/publicuse/housename',
273
+    //         success:function (layero, index) {
274
+    //         },
275
+    //         end:function(){
276
+    //         }
277
+    //     });
278
+    //     parent.layui.layer.full(indexOpen);
279
+    //     //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
280
+    //     $(window).on("resize",function(){
281
+    //         parent.layui.layer.full(indexOpen);
282
+    //     })
283
+    // })
284
+    //
285
+
286
+
287
+    //添加页面提交数据
288
+    form.on('submit(adds)', function(data){
289
+        var formData = new FormData($('form')[0]);
290
+       if(formData.getAll('img')[0].size == 0){
291
+           layer.msg('请选择图片');
292
+           return false;
293
+       }
294
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
295
+        $.ajax({
296
+            cache : false,
297
+            type : "post",
298
+            url : "/pushadvertisement/createform",
299
+            data : formData,  // 你的formid
300
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
301
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
302
+            error : function(request) {
303
+                layer.close(index);
304
+                layer.msg("请联系管理员");
305
+            },
306
+            success : function(data) {
307
+                if(data.data != null){
308
+                    layer.msg(ReturnInfo(data.data),{icon:5});
309
+                    return ;
310
+                }
311
+                layer.msg(data.msg);
312
+            }
313
+        });
314
+        return false;
315
+    });
316
+
317
+    form.on('submit(edit)', function(data){
318
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
319
+        // var oindex = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
320
+        var formData = new FormData($('form')[0]);
321
+        $.ajax({
322
+            type : "post",
323
+            url : "/pushadvertisement/editform",
324
+            data : formData,
325
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
326
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
327
+            error : function(request) {
328
+                layer.close(index);
329
+                layer.msg("请联系管理员");
330
+            },
331
+            success : function(data) {
332
+                if(data.data != null){
333
+                    layer.msg(ReturnInfo(data.data),{icon:5});
334
+                    return ;
335
+                }
336
+                layer.msg(data.msg);
337
+                parent.layer.close(oindex); //再执行关闭   
338
+            }
339
+        });
340
+        return false;
341
+    });
342
+})

+ 276 - 0
backend/web/js/brand/brand.js

@@ -0,0 +1,276 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'brandlist';  //表格ID
13
+
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#'+tableIds
17
+        ,url: '/brand/brandform' //数据接口
18
+        ,where:{token:csrfToken}
19
+        ,method:'post'
20
+        ,page: true //开启分页
21
+        ,height:600
22
+        ,text:'数据加载中'
23
+        ,id:'tablerReload'
24
+        ,limit:20
25
+        ,cols: [[ //表头
26
+            {type:'numbers',title:'序号',width:50},
27
+            {field: 'name', title: '品牌', align:'center'},
28
+            {field: 'img', title: '品牌图片',width:300, align:'center',templet:function(d){
29
+                    return '<img class="layui_magnify" src="'+d.img+'"/>'
30
+                }},
31
+            {field: 'create_at', title: '添加时间',width:150, align:'center'},
32
+            {field: 'sort', title: '排序',width:100, event:'sortData',edit:'text', align:'center',sort: true,templet:"#sortBox"},
33
+            {field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
34
+                if(d.is_show == 2){
35
+                    return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
36
+                } else {
37
+                    return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
38
+                }
39
+            }},
40
+            {fixed: 'right',title:'操作', width: 300, align:'center', toolbar: '#operate'}
41
+
42
+        ]]
43
+    });
44
+
45
+
46
+    // 列表点击放大图片
47
+    $('.layui-table-main').on('click','.layui_magnify', function(){
48
+        var _src = $(this).attr('src');
49
+        layui.layer.open({
50
+            type: 1,
51
+            title: false,           //是否显示标题
52
+            area: ['95%', '55%'],
53
+            shade: 0.6,           //透明度
54
+            closeBtn: 1,         //按钮 1有,0无
55
+            shadeClose: true,
56
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
57
+        });
58
+    });
59
+
60
+
61
+    //监听指定开关
62
+    form.on('switch(switchTest)', function(data){
63
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
64
+            $.post('/brand/brandoperation',{id:data.value,type:'show'},function (data) {
65
+                layer.msg(data.msg);
66
+                table.reload('tablerReload');
67
+
68
+            })
69
+        },function (aa) {
70
+            table.reload('tablerReload');        //重新加载
71
+        })
72
+    });
73
+
74
+
75
+    //列表操作
76
+    table.on('tool('+tableIds+')', function(obj){
77
+        var layEvent = obj.event,
78
+            data = obj.data;
79
+
80
+        if(layEvent === 'sortData'){       //修改排序
81
+
82
+            table.on('edit('+tableIds+')', function(obj){
83
+                var data = obj.data;
84
+
85
+                $.post('/brand/brandoperation',{id:data.id,type:'sort',sort:data.sort},function (data) {
86
+                    if(data.code == 200)
87
+                    {
88
+                        layer.msg(data.msg);
89
+                    } else if(data.code == 300 ) {
90
+                        layer.msg(data.msg);
91
+                    }
92
+                })
93
+            })
94
+
95
+        }else if(layEvent === 'del'){
96
+
97
+            layer.confirm('您确定要删除该品牌以及所有相关楼盘吗?',{btn: ['确定', '取消']},function () {
98
+
99
+                $.post('/brand/brandoperation',{id:data.id,type:'del'},function (data) {
100
+                    layer.msg(data.msg);
101
+                    table.reload('tablerReload');
102
+                })
103
+            })
104
+
105
+        }else if(layEvent === 'edit'){
106
+
107
+            var index = layer.open({
108
+                type: 2,
109
+                title: '编辑品牌',
110
+                area:['700px','500px'],
111
+                content: '/brand/brandedit?id='+data.id,
112
+                end:function () {
113
+                    table.reload('tablerReload');        //重新加载
114
+                }
115
+            });
116
+
117
+        }else if(layEvent === 'relation'){
118
+
119
+            var index =layui.layer.open({
120
+                title :'<span style="color:red" >['+data.name+']</span>品牌相关楼盘',
121
+                type : 2,
122
+                area:['','100%'],
123
+                maxmin: true,
124
+                content : "/brand/house?bid="+data.id,
125
+                end:function () {
126
+                    table.reload('tablerReload');
127
+                }
128
+            })
129
+
130
+            layui.layer.full(index);
131
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
132
+            $(window).on("resize",function(){
133
+                layui.layer.full(index);
134
+            })
135
+
136
+        }else if(layEvent === 'set'){
137
+
138
+            layer.confirm('是否将相关楼盘关联至该品牌下?',{btn: ['确定', '取消']},function () {
139
+
140
+                $.post('/brand/brandoperation',{id:data.id,type:'set'},function (data) {
141
+                    layer.msg(data.msg);
142
+                    table.reload('tablerReload');
143
+                })
144
+            })
145
+        }
146
+
147
+
148
+    });
149
+
150
+    //添加图片上传
151
+    upload.render({
152
+        elem: '#test1'
153
+        ,url: '/house/createimg'
154
+        ,data:{token:csrfToken}
155
+        ,field:'img'
156
+        ,size:400              //限制上传图片的大小,单位为KB
157
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
158
+        ,auto:false
159
+        ,bindAction:'#addcity'
160
+        ,choose: function(obj){
161
+            obj.preview(function(index, file, result){
162
+                $('#breviary_img').attr('src', result); //图片链接(base64)
163
+            });
164
+        }
165
+    });
166
+
167
+    // 图片放大浏览
168
+    $('.layui_magnify').click(function(){
169
+        var _src = $(this).attr('src');
170
+        layui.layer.open({
171
+            type: 1,
172
+            title: false,           //是否显示标题
173
+            area: ['60%', '80%'],
174
+            shade: 0.6,           //透明度
175
+            closeBtn: 1,         //按钮 1有,0无
176
+            shadeClose: true,
177
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
178
+        });
179
+    })
180
+
181
+    // 新增
182
+    var $ = layui.$, active = {
183
+
184
+        addData: function(){ //获取选中数据
185
+            var index = layui.layer.open({
186
+                type: 2,
187
+                title: '新增品牌',
188
+                closeBtn: 1, //不显示关闭按钮
189
+                area: ['700px','500px'],
190
+                content: '/brand/brandadd' //iframe的url,no代表不显示滚动条
191
+                ,success:function (layero, index) {
192
+                },
193
+                end:function () {
194
+                    table.reload('tablerReload');
195
+                }
196
+            });
197
+        },
198
+
199
+        reload:function(){//搜索
200
+            var form = pfgs_serialize($('form'));
201
+            var name = '';
202
+
203
+            table.reload('tablerReload',{
204
+                where:{
205
+                    name:form.input_name_text,
206
+                },
207
+                page:{
208
+                    curr:1
209
+                }
210
+            })
211
+        },
212
+    };
213
+
214
+    $('.demoTable .layui-btn').on('click', function(){
215
+        var type = $(this).data('type');
216
+        active[type] ? active[type].call(this) : '';
217
+    });
218
+
219
+
220
+
221
+    //添加页面提交数据
222
+    form.on('submit(add_brand)', function(data){
223
+        var formData = new FormData($('form')[0]);
224
+
225
+        layer.confirm('您确定添加该品牌吗?',{btn: ['确定', '取消']},function () {
226
+
227
+            layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
228
+            $.ajax({
229
+                type: "post",
230
+                url: "/brand/brandaddform",
231
+                data: formData,
232
+                contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
233
+                processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
234
+                error: function (request) {
235
+                    layer.close(index);
236
+                    layer.msg("请联系管理员");
237
+                },
238
+                success: function (data) {
239
+                    if (data.data != null) {
240
+                        layer.msg(ReturnInfo(data.data), {icon: 5});
241
+                        return;
242
+                    }
243
+                    layer.msg(data.msg);
244
+                    parent.layer.close(oindex); //再执行关闭
245
+                }
246
+            });
247
+        })
248
+        return false;
249
+    });
250
+
251
+
252
+    form.on('submit(edit_brand)', function(data){
253
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
254
+        var formData = new FormData($('form')[0]);
255
+        $.ajax({
256
+            type : "post",
257
+            url : "/brand/brandeditform",
258
+            data : formData,
259
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
260
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
261
+            error : function(request) {
262
+                layer.close(index);
263
+                layer.msg("请联系管理员");
264
+            },
265
+            success : function(data) {
266
+                if(data.data != null){
267
+                    layer.msg(ReturnInfo(data.data),{icon:5});
268
+                    return ;
269
+                }
270
+                layer.msg(data.msg);
271
+                parent.layer.close(oindex); //再执行关闭
272
+            }
273
+        });
274
+        return false;
275
+    });
276
+})

+ 162 - 0
backend/web/js/brand/house.js

@@ -0,0 +1,162 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+    var inputId = $('input[name="Bid"]').val();
12
+    var tableIds = 'houselist';  //表格ID
13
+
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#'+tableIds
17
+        ,url: '/brand/houseform' //数据接口
18
+        ,where:{token:csrfToken,bid:inputId}
19
+        ,method:'post'
20
+        ,page: true //开启分页
21
+        ,height:600
22
+        ,text:'数据加载中'
23
+        ,id:'tablerReload'
24
+        ,limit:20
25
+        ,cols: [[ //表头
26
+            {type:'numbers',title:'序号',width:50},
27
+            {field: 'city_name', title: '所属区域', width:180,align:'center'},
28
+            {field: 'name', title: '楼盘名称',width:400,align:'center'},
29
+            {field: 'developers', title: '开发商',align:'center'},
30
+            {field: 'create_at', title: '添加时间',width:150, align:'center'},
31
+            {field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
32
+                if(d.is_show == 2){
33
+                    return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
34
+                } else {
35
+                    return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
36
+                }
37
+                }},
38
+            {fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
39
+
40
+        ]]
41
+    });
42
+
43
+    table.reload('tablerReload');        //重新加载
44
+
45
+
46
+    //监听指定开关
47
+    form.on('switch(switchTest)', function(data){
48
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
49
+            $.post('/brand/sethouse',{id:data.value,type:'show'},function (data) {
50
+                layer.msg(data.msg);
51
+                table.reload('tablerReload');
52
+
53
+            })
54
+        },function (aa) {
55
+            table.reload('tablerReload');        //重新加载
56
+        })
57
+    });
58
+
59
+     //列表操作
60
+    table.on('tool('+tableIds+')', function(obj){
61
+        var layEvent = obj.event,
62
+            data = obj.data;
63
+
64
+        if(layEvent === 'del'){
65
+
66
+            layer.confirm('您确定要删除该楼盘吗?',{btn: ['确定', '取消']},function () {
67
+                $.post('/brand/sethouse',{id:data.id,type:'del'},function (data) {
68
+                    layer.msg(data.msg);
69
+                    table.reload('tablerReload');
70
+                })
71
+            })
72
+
73
+        }
74
+
75
+    });
76
+
77
+
78
+     // 新增
79
+     var $ = layui.$, active = {
80
+        addData: function(){ //获取选中数据
81
+            var index = layui.layer.open({
82
+                type: 2,
83
+                title: '新增品牌楼盘',
84
+                closeBtn: 1, //不显示关闭按钮
85
+                area: ['700px','500px'],
86
+                content: '/brand/houseadd?bid='+inputId //iframe的url,no代表不显示滚动条
87
+                ,success:function (layero, index) {
88
+                },
89
+                end:function () {
90
+                    table.reload('tablerReload');
91
+                }
92
+            });
93
+
94
+        },
95
+
96
+         reload:function(){//搜索
97
+            var form = pfgs_serialize($('form'));
98
+
99
+            table.reload('tablerReload',{
100
+                where:{
101
+                    name:form.input_house_text,
102
+                    city:form.input_city,
103
+                }
104
+            })
105
+        },
106
+    };
107
+
108
+
109
+     $('.demoTable .layui-btn').on('click', function(){
110
+        var type = $(this).data('type');
111
+        active[type] ? active[type].call(this) : '';
112
+    });
113
+
114
+
115
+
116
+    $('.The_house').focus(function(){
117
+        indexOpen = parent.layui.layer.open({
118
+            type: 2,
119
+            title: '选择需要添加的楼盘',
120
+            area: ['','100%'],
121
+            content: '/publicuse/housename',
122
+            success:function (layero, index) {
123
+            },
124
+            end:function(){
125
+            }
126
+        });
127
+        parent.layui.layer.full(indexOpen);
128
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
129
+        $(window).on("resize",function(){
130
+            parent.layui.layer.full(indexOpen);
131
+        })
132
+    })
133
+
134
+
135
+
136
+    //新增页面提交数据
137
+    form.on('submit(add_house)', function(data){
138
+        var formData = new FormData($('form')[0]);
139
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
140
+        $.ajax({
141
+            cache : false,
142
+            type : "post",
143
+            url : "/brand/houseaddform",
144
+            data : formData,  // 你的formid
145
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
146
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
147
+            error : function(request) {
148
+                layer.close(index);
149
+                layer.msg("请联系管理员");
150
+            },
151
+            success : function(data) {
152
+                if(data.data != null){
153
+                    layer.msg(ReturnInfo(data.data),{icon:5});
154
+                    return ;
155
+                }
156
+                layer.msg(data.msg);
157
+            }
158
+        });
159
+        return false;
160
+    });
161
+
162
+})

+ 404 - 0
backend/web/js/china/bottom.js

@@ -0,0 +1,404 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , layer = layui.layer //弹层
6
+        , table = layui.table //表格
7
+        , element = layui.element //元素操作
8
+        , form = layui.form
9
+        , upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'videolist';  //表格ID
13
+    //第一个实例
14
+    table.render({
15
+        elem: '#' + tableIds
16
+        , url: '/push/bottomform' //数据接口
17
+        , where: {token: csrfToken}
18
+        , method: 'post'
19
+        , page: true //开启分页
20
+        ,height:600
21
+        , text: '数据加载中'
22
+        , id: 'tablerReload'
23
+        , cols: [[ //表头
24
+            {type: "checkbox", width: 50},
25
+            {type: 'numbers', title: '序号', width: 50},
26
+            {field: 'title', title: '标题', width: 300, align: 'center'}
27
+            // {field: 'name', title: '楼盘', width:180, align:'center'},
28
+            // {field: 'city_name', title: '区域', width:150, align:'center'}
29
+            , {
30
+                field: 'img', title: '图片', width: 300, align: 'center', templet: function (d) {
31
+                    return '<img class="layui_magnify" src="' + d.img + '"/>'
32
+                }
33
+            }
34
+            , {
35
+                field: 'url', title: '跳转地址', align: 'center', templet: function (d) {
36
+                    return '<a href="' + d.url + '" target="_blank">' + d.url + '</a>';
37
+                }
38
+            }
39
+            , {
40
+                field: 'sort',
41
+                title: '排序',
42
+                width: 100,
43
+                event: 'sortData',
44
+                edit: 'text',
45
+                align: 'center',
46
+                sort: true,
47
+                templet: "#sortBox"
48
+            }
49
+            , {
50
+                field: 'img_small', title: '小图标', width: 110, align: 'center', templet: function (d) {
51
+                    return '<img class="layui_magnify" src="' + d.img_small + '"/>'
52
+                }
53
+            }
54
+            , {
55
+                field: 'img_show', title: '审核图标', align: 'center', width: 100, templet: function (d) {
56
+                    if (d.img_show == 2) {
57
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest2" lay-text="|">'
58
+                    } else {
59
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest2" lay-text="|">'
60
+                    }
61
+                }
62
+            }
63
+            , {
64
+                field: 'is_show', title: '审核', align: 'center', width: 100, templet: function (d) {
65
+                    if (d.is_show == 2) {
66
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
67
+                    } else {
68
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
69
+                    }
70
+                }
71
+            }
72
+            , {
73
+                field: 'state', title: '报名', align: 'center', width: 100, templet: function (d) {
74
+                    if (d.state == 2) {
75
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest3" lay-text="|">'
76
+                    } else {
77
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest3" lay-text="|">'
78
+                    }
79
+                }
80
+            }
81
+            , {field: 'create_at', title: '添加时间', width: 150, align: 'center'}
82
+            , {fixed: 'right', title: '操作', width: 165, align: 'center', toolbar: '#operate'}
83
+
84
+        ]]
85
+    });
86
+
87
+    table.reload('tablerReload');        //重新加载
88
+
89
+    // 列表点击放大图片
90
+    $('.layui-table-main').on('click', '.layui_magnify', function () {
91
+        var _src = $(this).attr('src');
92
+        layui.layer.open({
93
+            type: 1,
94
+            title: false,           //是否显示标题
95
+            area: ['95%', '55%'],
96
+            shade: 0.6,           //透明度
97
+            closeBtn: 1,         //按钮 1有,0无
98
+            shadeClose: true,
99
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
100
+        });
101
+    });
102
+
103
+
104
+    //监听指定开关
105
+    form.on('switch(switchTest)', function (data) {
106
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
107
+            $.post('/push/bottomdelshow', {id: data.value, type: 'show'}, function (data) {
108
+                layer.msg(data.msg);
109
+                table.reload('tablerReload');
110
+
111
+            })
112
+        }, function (aa) {
113
+            table.reload('tablerReload');        //重新加载
114
+        })
115
+    });
116
+
117
+    //监听指定开关
118
+    form.on('switch(switchTest2)', function (data) {
119
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
120
+            $.post('/push/bottomdelshow', {id: data.value, type: 'img_show'}, function (data) {
121
+                layer.msg(data.msg);
122
+                table.reload('tablerReload');
123
+
124
+            })
125
+        }, function (aa) {
126
+            table.reload('tablerReload');        //重新加载
127
+        })
128
+    });
129
+
130
+    //监听指定开关
131
+    form.on('switch(switchTest3)', function (data) {
132
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
133
+            $.post('/push/bottomdelshow', {id: data.value, type: 'state'}, function (data) {
134
+                layer.msg(data.msg);
135
+                table.reload('tablerReload');
136
+
137
+            })
138
+        }, function (aa) {
139
+            table.reload('tablerReload');        //重新加载
140
+        })
141
+    });
142
+
143
+    //监听指定开关
144
+    form.on('switch(switchTest2)', function (data) {
145
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
146
+            $.post('/push/bottomdelshow', {id: data.value, type: 'img_show'}, function (data) {
147
+                layer.msg(data.msg);
148
+                table.reload('tablerReload');
149
+
150
+            })
151
+        }, function (aa) {
152
+            table.reload('tablerReload');        //重新加载
153
+        })
154
+    });
155
+
156
+
157
+    //列表操作
158
+    table.on('tool(' + tableIds + ')', function (obj) {
159
+        var layEvent = obj.event,
160
+            data = obj.data;
161
+        if (layEvent === 'edit') {
162
+            var index = layer.open({
163
+                type: 2,
164
+                title: '修改横幅图',
165
+                area: ['800px', '800px'],
166
+                content: '/push/bottomedit?id=' + data.id + '&house_name=' + data.name,
167
+                end: function () {
168
+                    table.reload('tablerReload');        //重新加载
169
+                }
170
+            });
171
+        } else if (layEvent === 'del') {
172
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
173
+                $.post('/push/bottomdelshow', {id: data.id, type: 'del'}, function (data) {
174
+                    layer.msg(data.msg);
175
+                    table.reload('tablerReload');
176
+                })
177
+            })
178
+        } else if (layEvent === 'sortData') {       //修改排序
179
+            /* 列表操作  edit  修改后执行  2018.7.24*/
180
+            table.on('edit(' + tableIds + ')', function (obj) {
181
+                var data = obj.data;
182
+                $.post('/push/bottomdelshow', {id: data.id, type: 'sort', sort: data.sort}, function (data) {
183
+                    if (data.code == 200) {
184
+                        layer.msg(data.msg);
185
+                    } else if (data.code == 300) {
186
+                        layer.msg(data.msg);
187
+                    }
188
+                })
189
+            })
190
+
191
+        }
192
+
193
+    });
194
+
195
+    //添加图片上传
196
+    upload.render({
197
+        elem: '#test1'
198
+        , url: '/house/createimg'
199
+        , data: {token: csrfToken}
200
+        , field: 'img'
201
+        , size: 1000              //限制上传图片的大小,单位为KB
202
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
203
+        , auto: false
204
+        , bindAction: '#addcity'
205
+        , choose: function (obj) {
206
+            obj.preview(function (index, file, result) {
207
+                $('#breviary_img').attr('src', result); //图片链接(base64)
208
+            });
209
+        }
210
+    });
211
+
212
+    //添加小图标上传
213
+    upload.render({
214
+        elem: '#test2'
215
+        , url: '/house/createimg'
216
+        , data: {token: csrfToken}
217
+        , field: 'img_small'
218
+        , size: 1000              //限制上传图片的大小,单位为KB
219
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
220
+        , auto: false
221
+        , bindAction: '#addcity'
222
+        , choose: function (obj) {
223
+            obj.preview(function (index, file, result) {
224
+                $('#breviary_img2').attr('src', result); //图片链接(base64)
225
+            });
226
+        }
227
+    });
228
+
229
+    // 图片放大浏览
230
+    $('.layui_magnify').click(function () {
231
+        var _src = $(this).attr('src');
232
+        layui.layer.open({
233
+            type: 1,
234
+            title: false,           //是否显示标题
235
+            area: ['60%', '80%'],
236
+            shade: 0.6,           //透明度
237
+            closeBtn: 1,         //按钮 1有,0无
238
+            shadeClose: true,
239
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
240
+        });
241
+    })
242
+
243
+    // 新增
244
+    var $ = layui.$, active = {
245
+        addData: function () { //获取选中数据
246
+            var index = layui.layer.open({
247
+                type: 2,
248
+                title: '添加横幅图',
249
+                closeBtn: 1, //不显示关闭按钮
250
+                area: ['800px', '800px'],
251
+                content: '/push/bottomadd' //iframe的url,no代表不显示滚动条
252
+                , success: function (layero, index) {
253
+                },
254
+                end: function () {
255
+                    table.reload('tablerReload');
256
+                }
257
+            });
258
+        },
259
+        reload: function () {//搜索
260
+            var form = pfgs_serialize($('form'));
261
+            var name = '';
262
+            var house_name = '';
263
+            if (form.input_house == 'name') {
264
+                name = form.input_house_text;
265
+            } else if (form.input_house == 'house_name') {
266
+                house_name = form.input_house_text;
267
+            }
268
+            table.reload('tablerReload', {
269
+                where: {
270
+                    title: name,
271
+                    house_name: house_name,
272
+                    city_pid: form.input_city,
273
+                    type_name: form.type_name
274
+                }
275
+            })
276
+        },
277
+    };
278
+    $('.demoTable .layui-btn').on('click', function () {
279
+        var type = $(this).data('type');
280
+        active[type] ? active[type].call(this) : '';
281
+    });
282
+
283
+
284
+    $('.The_house').focus(function () {
285
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
286
+        indexOpen = parent.layui.layer.open({
287
+            type: 2,
288
+            title: '选择需要添加的楼盘',
289
+            area: ['800px', '800px'],
290
+            content: '/publicuse/housenamecn',
291
+            success: function (layero, index) {
292
+            },
293
+            end: function () {
294
+            }
295
+        });
296
+        // parent.layui.layer.full(indexOpen);
297
+        // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
298
+        // $(window).on("resize",function(){
299
+        //     parent.layui.layer.full(indexOpen);
300
+        // })
301
+    })
302
+
303
+
304
+    //添加页面提交数据
305
+    form.on('submit(adds)', function (data) {
306
+        var formData = new FormData($('form')[0]);
307
+        if (formData.getAll('img')[0].size == 0) {
308
+            layer.msg('请上传横幅图');
309
+            return false;
310
+        }
311
+        // if(formData.getAll('img_small')[0].size == 0){
312
+        //     layer.msg('请上传小图标');
313
+        //     return false;
314
+        // }
315
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
316
+        $.ajax({
317
+            cache: false,
318
+            type: "post",
319
+            url: "/push/bottomaddform",
320
+            data: formData,  // 你的formid
321
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
322
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
323
+            error: function (request) {
324
+                layer.close(index);
325
+                layer.msg("请联系管理员");
326
+            },
327
+            success: function (data) {
328
+                if (data.data != null) {
329
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
330
+                    return;
331
+                }
332
+                layer.msg(data.msg);
333
+                TableClose();
334
+            }
335
+        });
336
+        return false;
337
+    });
338
+
339
+    form.on('submit(edit)', function (data) {
340
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
341
+        // var oindex = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
342
+        var formData = new FormData($('form')[0]);
343
+        $.ajax({
344
+            type: "post",
345
+            url: "/push/bottomeditform",
346
+            data: formData,
347
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
348
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
349
+            error: function (request) {
350
+                layer.close(index);
351
+                layer.msg("请联系管理员");
352
+            },
353
+            success: function (data) {
354
+                if (data.data != null) {
355
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
356
+                    return;
357
+                }
358
+                layer.msg(data.msg);
359
+                TableClose();
360
+                parent.layer.close(oindex); //再执行关闭   
361
+            }
362
+        });
363
+        return false;
364
+    });
365
+
366
+    //批量删除
367
+    form.on('submit(del_alls_push)', function (data) {
368
+        var checkStatus = table.checkStatus('tablerReload');
369
+        if (typeof  checkStatus.data[0] == 'object') {
370
+            layer.confirm('您确定要删除吗?', {btn: ['确认', '取消']}, function () {
371
+                var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
372
+                var formdat = new FormData();
373
+                $.each(checkStatus.data, function (key, val) {
374
+                    formdat.append('id[]', val.id);
375
+                })
376
+                $.ajax({
377
+                    cache: true,
378
+                    type: "post",
379
+                    url: "/push/bottomdelall",
380
+                    data: formdat,  // 你的formid
381
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
382
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
383
+                    error: function (request) {
384
+                        layer.close(index);         //关闭数据提交信息
385
+                        layer.alert("网络超时");
386
+                    },
387
+                    success: function (data) {
388
+                        if (data.code == 200) {
389
+                            layer.msg(data.msg);
390
+                            table.reload('tablerReload')
391
+                        } else {
392
+                            layer.msg(data.msg);
393
+
394
+                        }
395
+                    }
396
+                });
397
+
398
+            })
399
+            return false;
400
+        }
401
+        layer.msg('请选择需要删除的内容', {icon: 5});
402
+        return false;
403
+    });
404
+})

+ 296 - 0
backend/web/js/china/brand/brand.js

@@ -0,0 +1,296 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , layer = layui.layer //弹层
6
+        , table = layui.table //表格
7
+        , element = layui.element //元素操作
8
+        , form = layui.form
9
+        , upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'brandlist';  //表格ID
13
+
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#' + tableIds
17
+        , url: '/brand/brandform' //数据接口
18
+        , where: {token: csrfToken}
19
+        , method: 'post'
20
+        , page: true //开启分页
21
+        , text: '数据加载中'
22
+        , id: 'tablerReload'
23
+        , limit: 20
24
+        , cols: [[ //表头
25
+            {type: 'numbers', title: '序号', width: 50},
26
+            {field: 'name', title: '品牌', align: 'center'},
27
+            {
28
+                field: 'img', title: '品牌图片', width: 300, align: 'center', templet: function (d) {
29
+                    return '<img class="layui_magnify" src="' + d.img + '"/>'
30
+                }
31
+            },
32
+            {field: 'create_at', title: '添加时间', width: 150, align: 'center'},
33
+            {
34
+                field: 'sort',
35
+                title: '排序',
36
+                width: 100,
37
+                event: 'sortData',
38
+                edit: 'text',
39
+                align: 'center',
40
+                sort: true,
41
+                templet: "#sortBox"
42
+            },
43
+            {
44
+                field: 'is_show', title: '审核', align: 'center', width: 100, templet: function (d) {
45
+                    if (d.is_show == 2) {
46
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
47
+                    } else {
48
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
49
+                    }
50
+                }
51
+            },
52
+            {fixed: 'right', title: '操作', width: 300, align: 'center', toolbar: '#operate'}
53
+
54
+        ]]
55
+    });
56
+
57
+
58
+    // 列表点击放大图片
59
+    $('.layui-table-main').on('click', '.layui_magnify', function () {
60
+        var _src = $(this).attr('src');
61
+        layui.layer.open({
62
+            type: 1,
63
+            title: false,           //是否显示标题
64
+            area: ['95%', '55%'],
65
+            shade: 0.6,           //透明度
66
+            closeBtn: 1,         //按钮 1有,0无
67
+            shadeClose: true,
68
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
69
+        });
70
+    });
71
+
72
+
73
+    //监听指定开关
74
+    form.on('switch(switchTest)', function (data) {
75
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
76
+            $.post('/brand/brandoperation', {id: data.value, type: 'show'}, function (data) {
77
+                layer.msg(data.msg);
78
+                table.reload('tablerReload');
79
+
80
+            })
81
+        }, function (aa) {
82
+            table.reload('tablerReload');        //重新加载
83
+        })
84
+    });
85
+
86
+
87
+    //列表操作
88
+    table.on('tool(' + tableIds + ')', function (obj) {
89
+        var layEvent = obj.event,
90
+            data = obj.data;
91
+
92
+        if (layEvent === 'sortData') {       //修改排序
93
+
94
+            table.on('edit(' + tableIds + ')', function (obj) {
95
+                var data = obj.data;
96
+
97
+                $.post('/brand/brandoperation', {id: data.id, type: 'sort', sort: data.sort}, function (data) {
98
+                    if (data.code == 200) {
99
+                        layer.msg(data.msg);
100
+                    } else if (data.code == 300) {
101
+                        layer.msg(data.msg);
102
+                    }
103
+                })
104
+            })
105
+
106
+        } else if (layEvent === 'del') {
107
+
108
+            layer.confirm('您确定要删除该品牌以及所有相关楼盘吗?', {btn: ['确定', '取消']}, function () {
109
+
110
+                $.post('/brand/brandoperation', {id: data.id, type: 'del'}, function (data) {
111
+                    layer.msg(data.msg);
112
+                    table.reload('tablerReload');
113
+                })
114
+            })
115
+
116
+        } else if (layEvent === 'edit') {
117
+
118
+            var index = layer.open({
119
+                type: 2,
120
+                title: '编辑品牌',
121
+                area: ['700px', '500px'],
122
+                content: '/brand/brandedit?id=' + data.id,
123
+                end: function () {
124
+                    table.reload('tablerReload');        //重新加载
125
+                }
126
+            });
127
+
128
+        } else if (layEvent === 'relation') {
129
+
130
+            var index = layui.layer.open({
131
+                title: '<span style="color:red" >[' + data.name + ']</span>品牌相关楼盘',
132
+                type: 2,
133
+                area: ['', '100%'],
134
+                maxmin: true,
135
+                content: "/brand/house?bid=" + data.id,
136
+                end: function () {
137
+                    table.reload('tablerReload');
138
+                }
139
+            })
140
+
141
+            layui.layer.full(index);
142
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
143
+            $(window).on("resize", function () {
144
+                layui.layer.full(index);
145
+            })
146
+
147
+        } else if (layEvent === 'set') {
148
+
149
+            layer.confirm('是否将相关楼盘关联至该品牌下?', {btn: ['确定', '取消']}, function () {
150
+
151
+                $.post('/brand/brandoperation', {id: data.id, type: 'set'}, function (data) {
152
+                    layer.msg(data.msg);
153
+                    table.reload('tablerReload');
154
+                })
155
+            })
156
+        }
157
+
158
+
159
+    });
160
+
161
+    //添加图片上传
162
+    upload.render({
163
+        elem: '#test1'
164
+        , url: '/house/createimg'
165
+        , data: {token: csrfToken}
166
+        , field: 'img'
167
+        , size: 400              //限制上传图片的大小,单位为KB
168
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
169
+        , auto: false
170
+        , bindAction: '#addcity'
171
+        , choose: function (obj) {
172
+            obj.preview(function (index, file, result) {
173
+                $('#breviary_img').attr('src', result); //图片链接(base64)
174
+            });
175
+        }
176
+    });
177
+
178
+    // 图片放大浏览
179
+    $('.layui_magnify').click(function () {
180
+        var _src = $(this).attr('src');
181
+        layui.layer.open({
182
+            type: 1,
183
+            title: false,           //是否显示标题
184
+            area: ['60%', '80%'],
185
+            shade: 0.6,           //透明度
186
+            closeBtn: 1,         //按钮 1有,0无
187
+            shadeClose: true,
188
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
189
+        });
190
+    })
191
+
192
+    // 新增
193
+    var $ = layui.$, active = {
194
+
195
+        addData: function () { //获取选中数据
196
+            var index = layui.layer.open({
197
+                type: 2,
198
+                title: '新增品牌',
199
+                closeBtn: 1, //不显示关闭按钮
200
+                area: ['700px', '500px'],
201
+                content: '/brand/brandadd' //iframe的url,no代表不显示滚动条
202
+                , success: function (layero, index) {
203
+                },
204
+                end: function () {
205
+                    table.reload('tablerReload');
206
+                }
207
+            });
208
+        },
209
+
210
+        reload: function () {//搜索
211
+            var form = pfgs_serialize($('form'));
212
+            var name = '';
213
+
214
+            table.reload('tablerReload', {
215
+                where: {
216
+                    name: form.input_name_text,
217
+                },
218
+                page: {
219
+                    curr: 1
220
+                }
221
+            })
222
+        },
223
+    };
224
+
225
+    $('.demoTable .layui-btn').on('click', function () {
226
+        var type = $(this).data('type');
227
+        active[type] ? active[type].call(this) : '';
228
+    });
229
+
230
+
231
+    //添加页面提交数据
232
+    form.on('submit(add_brand)', function (data) {
233
+        var formData = new FormData($('form')[0]);
234
+
235
+        layer.confirm('您确定添加该品牌吗?', {btn: ['确定', '取消']}, function () {
236
+
237
+            layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
238
+            $.ajax({
239
+                type: "post",
240
+                url: "/brand/brandaddform",
241
+                data: formData,
242
+                contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
243
+                processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
244
+                error: function (request) {
245
+                    layer.close(index);
246
+                    layer.msg("请联系管理员");
247
+                },
248
+                success: function (data) {
249
+                    if (data.data != null) {
250
+                        layer.msg(ReturnInfo(data.data), {icon: 5});
251
+                        return;
252
+                    }
253
+                    layer.msg(data.msg);
254
+                    parent.layer.close(oindex); //再执行关闭
255
+                }
256
+            });
257
+        })
258
+        return false;
259
+    });
260
+
261
+
262
+    form.on('submit(edit_brand)', function (data) {
263
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
264
+        var formData = new FormData($('form')[0]);
265
+        $.ajax({
266
+            type: "post",
267
+            url: "/brand/brandeditform",
268
+            data: formData,
269
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
270
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
271
+            error: function (request) {
272
+                layer.close(index);
273
+                layer.msg("请联系管理员");
274
+            },
275
+            success: function (data) {
276
+                if (data.data != null) {
277
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
278
+                    return;
279
+                }
280
+                layer.msg(data.msg);
281
+                parent.layer.close(oindex); //再执行关闭
282
+            }
283
+        });
284
+        return false;
285
+    });
286
+
287
+    form.on('select(position)', function (data) {
288
+        console.log(data.value);
289
+        var type = data.value;
290
+        table.reload('tablerReload', {
291
+            url: 'brandform'
292
+            , where: {token: csrfToken, abroad: type}
293
+            , method: 'post'
294
+        });
295
+    });
296
+})

+ 161 - 0
backend/web/js/china/brand/house.js

@@ -0,0 +1,161 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , layer = layui.layer //弹层
6
+        , table = layui.table //表格
7
+        , element = layui.element //元素操作
8
+        , form = layui.form
9
+        , upload = layui.upload;
10
+
11
+    var inputId = $('input[name="Bid"]').val();
12
+    var tableIds = 'houselist';  //表格ID
13
+
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#' + tableIds
17
+        , url: '/brand/houseform' //数据接口
18
+        , where: {token: csrfToken, bid: inputId}
19
+        , method: 'post'
20
+        , page: true //开启分页
21
+        , text: '数据加载中'
22
+        , id: 'tablerReload'
23
+        , limit: 20
24
+        , cols: [[ //表头
25
+            {type: 'numbers', title: '序号', width: 50},
26
+            {field: 'city_name', title: '所属区域', width: 180, align: 'center'},
27
+            {field: 'name', title: '楼盘名称', width: 400, align: 'center'},
28
+            {field: 'developers', title: '开发商', align: 'center'},
29
+            {field: 'create_at', title: '添加时间', width: 150, align: 'center'},
30
+            {
31
+                field: 'is_show', title: '审核', align: 'center', width: 100, templet: function (d) {
32
+                    if (d.is_show == 2) {
33
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
34
+                    } else {
35
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
36
+                    }
37
+                }
38
+            },
39
+            {fixed: 'right', title: '操作', width: 165, align: 'center', toolbar: '#operate'}
40
+
41
+        ]]
42
+    });
43
+
44
+    table.reload('tablerReload');        //重新加载
45
+
46
+
47
+    //监听指定开关
48
+    form.on('switch(switchTest)', function (data) {
49
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
50
+            $.post('/brand/sethouse', {id: data.value, type: 'show'}, function (data) {
51
+                layer.msg(data.msg);
52
+                table.reload('tablerReload');
53
+
54
+            })
55
+        }, function (aa) {
56
+            table.reload('tablerReload');        //重新加载
57
+        })
58
+    });
59
+
60
+    //列表操作
61
+    table.on('tool(' + tableIds + ')', function (obj) {
62
+        var layEvent = obj.event,
63
+            data = obj.data;
64
+
65
+        if (layEvent === 'del') {
66
+
67
+            layer.confirm('您确定要删除该楼盘吗?', {btn: ['确定', '取消']}, function () {
68
+                $.post('/brand/sethouse', {id: data.id, type: 'del'}, function (data) {
69
+                    layer.msg(data.msg);
70
+                    table.reload('tablerReload');
71
+                })
72
+            })
73
+
74
+        }
75
+
76
+    });
77
+
78
+
79
+    // 新增
80
+    var $ = layui.$, active = {
81
+        addData: function () { //获取选中数据
82
+            var index = layui.layer.open({
83
+                type: 2,
84
+                title: '新增品牌楼盘',
85
+                closeBtn: 1, //不显示关闭按钮
86
+                area: ['700px', '500px'],
87
+                content: '/brand/houseadd?bid=' + inputId //iframe的url,no代表不显示滚动条
88
+                , success: function (layero, index) {
89
+                },
90
+                end: function () {
91
+                    table.reload('tablerReload');
92
+                }
93
+            });
94
+
95
+        },
96
+
97
+        reload: function () {//搜索
98
+            var form = pfgs_serialize($('form'));
99
+
100
+            table.reload('tablerReload', {
101
+                where: {
102
+                    name: form.input_house_text,
103
+                    city: form.input_city,
104
+                }
105
+            })
106
+        },
107
+    };
108
+
109
+
110
+    $('.demoTable .layui-btn').on('click', function () {
111
+        var type = $(this).data('type');
112
+        active[type] ? active[type].call(this) : '';
113
+    });
114
+
115
+
116
+    $('.The_house').focus(function () {
117
+        indexOpen = parent.layui.layer.open({
118
+            type: 2,
119
+            title: '选择需要添加的楼盘',
120
+            area: ['', '100%'],
121
+            content: '/publicuse/housenamecn',
122
+            success: function (layero, index) {
123
+            },
124
+            end: function () {
125
+            }
126
+        });
127
+        parent.layui.layer.full(indexOpen);
128
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
129
+        $(window).on("resize", function () {
130
+            parent.layui.layer.full(indexOpen);
131
+        })
132
+    })
133
+
134
+
135
+    //新增页面提交数据
136
+    form.on('submit(add_house)', function (data) {
137
+        var formData = new FormData($('form')[0]);
138
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
139
+        $.ajax({
140
+            cache: false,
141
+            type: "post",
142
+            url: "/brand/houseaddform",
143
+            data: formData,  // 你的formid
144
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
145
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
146
+            error: function (request) {
147
+                layer.close(index);
148
+                layer.msg("请联系管理员");
149
+            },
150
+            success: function (data) {
151
+                if (data.data != null) {
152
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
153
+                    return;
154
+                }
155
+                layer.msg(data.msg);
156
+            }
157
+        });
158
+        return false;
159
+    });
160
+
161
+})

+ 336 - 0
backend/web/js/china/city.js

@@ -0,0 +1,336 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'treetable'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , layer = layui.layer //弹层
6
+        , table = layui.table //表格
7
+        , form = layui.form
8
+        , treetable = layui.treetable;
9
+
10
+    var tableId = 'citylist';
11
+
12
+    if ($('#citylist').attr('lay-filter') == 'citylist') {
13
+        var renderTable = function (wheres = {}) {
14
+            layer.load(2);
15
+            treetable.render({
16
+                treeColIndex: 1,
17
+                treeSpid: 0,
18
+                treeIdName: 'id',
19
+                treePidName: 'pid',
20
+                treeDefaultClose: true,
21
+                height:600,
22
+                treeLinkage: false,
23
+                elem: '#citylist',
24
+                url: '/categorycity/cityhomeform',
25
+                page: false,
26
+                where: wheres,
27
+                id: 'tablerReload',
28
+                cols: [[
29
+                    {type: 'numbers'}
30
+                    // {field: 'id', title: 'ID', width:80, sort: true,align:'center'}
31
+                    , {field: 'city_name', title: '区域名称', align: 'center', width: 500},
32
+                    {
33
+                        field: 'sort',
34
+                        title: '排序',
35
+                        width: 80,
36
+                        edit: 'text',
37
+                        align: 'center',
38
+                        sort: true,
39
+                        templet: "#sortBox"
40
+                    },
41
+                    // ,{field: 'sort', title: '排序',align:'center',sort: true},
42
+                    {
43
+                        field: 'state',
44
+                        title: '审核',
45
+                        width: 100,
46
+                        align: 'center',
47
+                        templet: "#Toexamine",
48
+                        templet: function (d) {
49
+                            if (d.state == 2) {
50
+                                return '<input type="checkbox"  value="' + d.id + '" name="' + d.state + '"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
51
+                            } else {
52
+                                return '<input type="checkbox" checked  value="' + d.id + '" name="' + d.state + '"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
53
+                            }
54
+                        }
55
+                    }
56
+                    , {field: 'create_at', title: '添加时间', width: 200, align: 'center'}
57
+                    , {fixed: 'right', title: '操作', width: 200, align: 'center', toolbar: '#operate'}
58
+                ]],
59
+                done: function () {
60
+                    layer.closeAll('loading');
61
+
62
+                    var sz = false;
63
+                    $('.treeTable-icon').on('click', function () {
64
+                        if ($(this).attr('lay-tpid') == 0) {
65
+                            sessionStorage.setItem("key", $(this).attr('lay-tid'));
66
+                            if (sz) {
67
+                                // var elaytid = sessionStorage.getItem("erzi");
68
+                                // alert(elaytid);
69
+                                // $('span[lay-tpid='+elaytid+']').each(function(){
70
+                                //      $(this).parents().parents().parents().attr('style','display:none;');
71
+                                // });
72
+                                sessionStorage.removeItem("erzi");
73
+                            }
74
+                        } else {
75
+                            sz = true;
76
+
77
+                            if ($(this).attr('lay-tid') == sessionStorage.getItem("erzi")) {
78
+                                // alert(1111);
79
+                                sessionStorage.removeItem("erzi");
80
+                            } else {
81
+                                sessionStorage.setItem("erzi", $(this).attr('lay-tid'));
82
+                            }
83
+
84
+                        }
85
+                    });
86
+                    if (sessionStorage.getItem("key") != null) {
87
+                        var laytid = sessionStorage.getItem("key");
88
+
89
+                        // alert(laytid);
90
+                        $('span[lay-tid=' + laytid + ']').addClass('open');
91
+
92
+                        if (sessionStorage.getItem("erzi") != null) {
93
+                            var elaytid = sessionStorage.getItem("erzi");
94
+                            sz = true;
95
+                        }
96
+
97
+                        $('span[lay-tpid=' + laytid + ']').each(function () {
98
+                            $(this).parents().parents().parents().attr('style', '');
99
+                            if (sz) {
100
+                                $('span[lay-tid=' + elaytid + ']').addClass('open');
101
+                                $('span[lay-tpid=' + elaytid + ']').each(function () {
102
+                                    $(this).parents().parents().parents().attr('style', '');
103
+                                });
104
+                            }
105
+                        });
106
+                    }
107
+                }
108
+            });
109
+        };
110
+
111
+        renderTable();
112
+    }
113
+
114
+    //列表操作
115
+    table.on('tool(' + tableId + ')', function (obj) {
116
+        var layEvent = obj.event,
117
+            data = obj.data;
118
+        switch (layEvent) {
119
+            case 'edit':
120
+                layer.open({
121
+                    type: 2,
122
+                    title: '修改区域',
123
+                    closeBtn: 1, //不显示关闭按钮
124
+                    shade: [0],
125
+                    area: ['780px', '550px'],
126
+                    anim: 2,
127
+                    content: ['/categorycity/edithome?id=' + data.id, 'yes'],
128
+                    end: function () {
129
+                        renderTable();
130
+                    }
131
+                });
132
+                break;
133
+            case 'del':
134
+                // layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
135
+                //     $.post('/categorycity/editall',{'id':data.id,'del':2},function (data) {
136
+                //         if(data.data != null){
137
+                //             layer.msg(ReturnInfo(data.data),{icon:5});
138
+                //             return false;
139
+                //         }
140
+                //         layer.msg(data.msg);
141
+                //         renderTable();
142
+                //     });
143
+                // });
144
+                layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
145
+                    $.post('/categorycity/delcity', {id: data.id, type: 'del'}, function (data) {
146
+                        if (data.data != null) {
147
+                            layer.msg(ReturnInfo(data.data), {icon: 5});
148
+                            return false;
149
+                        }
150
+                        layer.msg(data.msg);
151
+                        renderTable();
152
+                    })
153
+                });
154
+                break;
155
+            case 'addson':
156
+                layer.open({
157
+                    type: 2,
158
+                    title: '添加区域',
159
+                    closeBtn: 1, //不显示关闭按钮
160
+                    shade: [0],
161
+                    area: ['780px', '550px'],
162
+                    anim: 2,
163
+                    content: '/categorycity/addhome?id=' + data.id + '&name=' + data.city_name,
164
+                    end: function () {
165
+                        renderTable();
166
+                    }
167
+                });
168
+                break;
169
+        }
170
+
171
+    });
172
+
173
+
174
+    var $ = layui.$, active = {
175
+        addData: function () { //获取选中数据
176
+            layer.open({
177
+                type: 2,
178
+                title: '添加区域',
179
+                closeBtn: 1, //不显示关闭按钮
180
+                shade: [0],
181
+                area: ['780px', '550px'],
182
+                anim: 2,
183
+                content: '/categorycity/addhome?son=1',
184
+            });
185
+        },
186
+        reload: function () {
187
+            var form = pfgs_serialize($('form'));
188
+            var city = '';
189
+            if (form.province != '') {
190
+                city = form.province;
191
+            }
192
+
193
+            if (form.city != '') {
194
+                city = form.city;
195
+            }
196
+            renderTable({id: city});
197
+        }
198
+    };
199
+
200
+    $('.demoTable .layui-btn').on('click', function () {
201
+        var type = $(this).data('type');
202
+        active[type] ? active[type].call(this) : '';
203
+    });
204
+
205
+    //显示或隐藏
206
+    form.on('switch(switchTest)', function (data) {
207
+        var state = '';
208
+        if (data.elem.name == 1) {
209
+            state = 2;
210
+        } else if (data.elem.name == 2) {
211
+            state = 1;
212
+        }
213
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
214
+            $.post('/categorycity/editall', {id: data.value, state: state}, function (data) {
215
+                if (data.data != null) {
216
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
217
+                    return false;
218
+                }
219
+                layer.msg(data.msg);
220
+                renderTable();
221
+            })
222
+        }, function (aa) {
223
+            renderTable();
224
+        })
225
+    });
226
+
227
+    //修改排序
228
+    table.on('edit(' + tableId + ')', function (obj) {
229
+        var data = obj.data;
230
+        $.post('/categorycity/editall', {id: data.id, sort: data.sort}, function (data) {
231
+            if (data.data != null) {
232
+                layer.msg(ReturnInfo(data.data), {icon: 5});
233
+                return false;
234
+            }
235
+            layer.msg(data.msg);
236
+        })
237
+
238
+    })
239
+
240
+    form.on('submit(editcity)', function (data) {
241
+
242
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
243
+
244
+        var formData = new FormData($('form')[0]);
245
+        $.ajax({
246
+            cache: true,
247
+            type: "post",
248
+            url: '/categorycity/edithomeform',
249
+            data: formData,  // 你的formid
250
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
251
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
252
+            error: function (request) {
253
+                layer.close(index);         //关闭数据提交信息
254
+                layer.alert("网络超时");
255
+            },
256
+            success: function (data) {
257
+                if (data.data != null) {
258
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
259
+                    return;
260
+                }
261
+                layer.msg(data.msg);
262
+                renderTable();
263
+
264
+            }
265
+        });
266
+        return false;
267
+    });
268
+
269
+    //添加
270
+    form.on('submit(addcity)', function (data) {
271
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
272
+        $.post('/categorycity/addcityform', {'data': data.field}, function (data) {
273
+            if (data.data != null) {
274
+                layer.msg(ReturnInfo(data.data), {icon: 5});
275
+                return;
276
+            }
277
+            layer.msg(data.msg);
278
+            renderTable();
279
+        })
280
+        return false;
281
+    });
282
+
283
+    //加载省数据
284
+    function loadProvince() {
285
+
286
+        $.ajax({
287
+            url: '/categorycity/citypid',
288
+            type: 'post',
289
+            async: false,//使用同步的方式,true为异步方式
290
+            data: {'pid': 0},//这里使用json对象
291
+            success: function (data) {
292
+                console.log(data);
293
+                var areaData = data.data;
294
+                var proHtml = '';
295
+                for (var i = 0; i < areaData.length; i++) {
296
+                    proHtml += '<option value="' + areaData[i].id + '">' + areaData[i].city_name + '</option>';
297
+                }
298
+                //初始化省数据
299
+                $('select[name=province]').append(proHtml);
300
+                form.render();
301
+            },
302
+            fail: function () {
303
+
304
+            }
305
+        });
306
+
307
+
308
+    }
309
+
310
+    loadProvince();
311
+
312
+    form.on('select(province)', function (data) {
313
+        $.post('/categorycity/citypid', {'pid': data.value}, function (data) {
314
+            var areaData = data.data;
315
+            var proHtml = '';
316
+            $('select[name=city]').html('');
317
+            proHtml = '<option value="">请选择市/区/县</option>';
318
+            for (var i = 0; i < areaData.length; i++) {
319
+
320
+                proHtml += '<option value="' + areaData[i].id + '">' + areaData[i].city_name + '</option>';
321
+            }
322
+            //初始化省数据
323
+            $('select[name=city]').append(proHtml);
324
+            form.render();
325
+        })
326
+    })
327
+
328
+    // 转换拼音
329
+    $('.layui_w_name').on('keyup ', function () {
330
+        var _txt = $(this).val();
331
+        var _convert = pinyinUtil.getPinyin(_txt, ' ', false).replace(/\s/g, "");
332
+        $('.layui_w_spell').val(_convert)
333
+    })
334
+
335
+});
336
+

+ 119 - 0
backend/web/js/china/dictionarya/architecture.js

@@ -0,0 +1,119 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var layer = layui.layer //弹层
4
+        ,table = layui.table //表格
5
+        ,element = layui.element //元素操作
6
+        ,form = layui.form;
7
+
8
+    var tableIds = 'architecturelist';  //表格ID
9
+    //第一个实例
10
+     table.render({
11
+        elem: '#'+tableIds
12
+        ,url: '/dictionarya/architectureform' //数据接口
13
+        ,where:{token:csrfToken}
14
+        ,method:'post'
15
+        ,page: true //开启分页
16
+        ,text:'数据加载中'
17
+        ,id:'architecturelistId'
18
+        ,cols: [[ //表头
19
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
20
+            {type:'numbers'},
21
+            {field: 'name', title: '建筑类别名称',align:'center'}
22
+            ,{field: 'update_at', title: '更新时间', width:150,align:'center'}
23
+            ,{field: 'create_at', title: '添加时间', width:150,align:'center'}
24
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
25
+
26
+        ]]
27
+    });
28
+
29
+    table.reload('architecturelistId');        //重新加载
30
+
31
+    //列表操作
32
+    table.on('tool('+tableIds+')', function(obj){
33
+        var layEvent = obj.event,
34
+            data = obj.data;
35
+        if(layEvent === 'edit'){
36
+            layer.open({
37
+                type: 2,
38
+                title: '修改建筑类别',
39
+                area: ['600px', '500px'],
40
+                anim: 2,
41
+                content:'/dictionarya/labeledit?id='+data.id, //iframe的url,no代表不显示滚动条
42
+                end:function () {
43
+                    table.reload('architecturelistId');
44
+                }
45
+            });
46
+        } else if(layEvent === 'del') {
47
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
48
+                $.post('/dictionarya/labeldel',{'id':data.id},function (data) {
49
+                    if(data.code == 200)
50
+                    {
51
+                        layer.msg(data.msg);
52
+                        table.reload('architecturelistId');
53
+                    } else if(data.code == 300 ) {
54
+                        layer.msg(data.msg);
55
+                    }
56
+                })
57
+            })
58
+        }
59
+
60
+
61
+    });
62
+
63
+    var $ = layui.$, active = {
64
+        addData: function(){ //获取选中数据
65
+
66
+            layer.open({
67
+                type: 2,
68
+                title: '建筑类型',
69
+                closeBtn: 1, //不显示关闭按钮
70
+                shade: [0],
71
+                area: ['600px', '500px'],
72
+                anim: 2,
73
+                content: '/dictionarya/architectureadd',
74
+                end:function () {
75
+                    table.reload('architecturelistId');
76
+                }//iframe的url,no代表不显示滚动条
77
+            });
78
+
79
+            // var checkStatus = table.checkStatus('idTest')
80
+            //     ,data = checkStatus.data;
81
+            // layer.alert(JSON.stringify(data));
82
+        }
83
+    };
84
+
85
+    $('.demoTable .layui-btn').on('click', function(){
86
+        var type = $(this).data('type');
87
+        active[type] ? active[type].call(this) : '';
88
+    });
89
+
90
+    //修改
91
+    // form.on('submit(editlabel)', function(data){
92
+    //     $.post('/dictionarya/labeleditform',{'data':data.field,'token':csrfToken},function (data) {
93
+    //         if(data.code == 200)
94
+    //         {
95
+    //             layer.msg(data.msg);
96
+    //             parent.layui.table.reload(tableIds);
97
+    //             TableClose();
98
+    //         } else if(data.code == 300 ) {
99
+    //             layer.msg(data.msg);
100
+    //         }
101
+    //     })
102
+    //     return false;
103
+    // });
104
+    //
105
+    // //添加
106
+    // form.on('submit(addlabel)', function(data){
107
+    //     $.post('/dictionarya/labeladdform',{'data':data.field,'token':csrfToken},function (data) {
108
+    //         if(data.code == 200)
109
+    //         {
110
+    //             layer.msg(data.msg);
111
+    //             parent.layui.table.reload(tableIds);
112
+    //         } else if(data.code == 300 ) {
113
+    //             layer.msg(data.msg);
114
+    //         }
115
+    //     })
116
+    //     return false;
117
+    // });
118
+
119
+});

+ 116 - 0
backend/web/js/china/dictionarya/houselabel.js

@@ -0,0 +1,116 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var layer = layui.layer //弹层
4
+        ,table = layui.table //表格
5
+        ,element = layui.element //元素操作
6
+        ,form = layui.form;
7
+
8
+    var tableIds = 'houselabellist';  //表格ID
9
+    //第一个实例
10
+    table.render({
11
+        elem: '#'+tableIds
12
+        ,url: '/dictionarya/houselabelform' //数据接口
13
+        ,where:{token:csrfToken}
14
+        ,method:'post'
15
+        ,page: true //开启分页
16
+        ,text:'数据加载中'
17
+        ,id:'houselabellist'
18
+        ,cols: [[ //表头
19
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
20
+            {field: 'name', title: '楼盘标签名称',align:'center'}
21
+            ,{field: 'update_at', title: '更新时间', width:150,align:'center'}
22
+            ,{field: 'create_at', title: '添加时间', width:150,align:'center'}
23
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
24
+
25
+        ]]
26
+    });
27
+
28
+    //列表操作
29
+    table.on('tool('+tableIds+')', function(obj){
30
+        var layEvent = obj.event,
31
+            data = obj.data;
32
+        if(layEvent === 'edit'){
33
+            layer.open({
34
+                type: 2,
35
+                title: '修改建筑类别',
36
+                area: ['600px', '500px'],
37
+                anim: 2,
38
+                content:'/dictionarya/labeledit?id='+data.id, //iframe的url,no代表不显示滚动条
39
+                end:function () {
40
+                    table.reload('houselabellist');
41
+                }
42
+            });
43
+        } else if(layEvent === 'del') {
44
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
45
+                $.post('/dictionarya/labeldel',{'id':data.id},function (data) {
46
+                    if(data.code == 200)
47
+                    {
48
+                        layer.msg(data.msg);
49
+                        table.reload('houselabellist');
50
+                    } else if(data.code == 300 ) {
51
+                        layer.msg(data.msg);
52
+                    }
53
+                })
54
+            })
55
+        }
56
+
57
+
58
+    });
59
+
60
+    var $ = layui.$, active = {
61
+        addData: function(){ //获取选中数据
62
+
63
+            layer.open({
64
+                type: 2,
65
+                title: '添加楼盘标签',
66
+                closeBtn: 1, //不显示关闭按钮
67
+                shade: [0],
68
+                area: ['600px', '500px'],
69
+                anim: 2,
70
+                content: '/dictionarya/houselabeladd',
71
+                end:function () {
72
+                    table.reload('houselabellist');
73
+                }//iframe的url,no代表不显示滚动条
74
+            });
75
+
76
+            // var checkStatus = table.checkStatus('idTest')
77
+            //     ,data = checkStatus.data;
78
+            // layer.alert(JSON.stringify(data));
79
+        }
80
+    };
81
+
82
+    $('.demoTable .layui-btn').on('click', function(){
83
+        var type = $(this).data('type');
84
+        active[type] ? active[type].call(this) : '';
85
+    });
86
+
87
+    //修改
88
+    // form.on('submit(editlabel)', function(data){
89
+    //     $.post('/dictionarya/labeleditform',{'data':data.field,'token':csrfToken},function (data) {
90
+    //         if(data.code == 200)
91
+    //         {
92
+    //             layer.msg(data.msg);
93
+    //             parent.layui.table.reload(tableIds);
94
+    //             TableClose();
95
+    //         } else if(data.code == 300 ) {
96
+    //             layer.msg(data.msg);
97
+    //         }
98
+    //     })
99
+    //     return false;
100
+    // });
101
+    //
102
+    // //添加
103
+    // form.on('submit(addlabel)', function(data){
104
+    //     $.post('/dictionarya/labeladdform',{'data':data.field,'token':csrfToken},function (data) {
105
+    //         if(data.code == 200)
106
+    //         {
107
+    //             layer.msg(data.msg);
108
+    //             parent.layui.table.reload(tableIds);
109
+    //         } else if(data.code == 300 ) {
110
+    //             layer.msg(data.msg);
111
+    //         }
112
+    //     })
113
+    //     return false;
114
+    // });
115
+
116
+});

+ 161 - 0
backend/web/js/china/dictionarya/label.js

@@ -0,0 +1,161 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , layer = layui.layer //弹层
5
+        , table = layui.table //表格
6
+        , element = layui.element //元素操作
7
+        , form = layui.form
8
+        , $ = layui.jquery;
9
+
10
+    var tableIds = 'laballist';  //表格ID
11
+    var reloadId = 'tablerReload';
12
+    var type = $('input[name=type]').val();
13
+    //第一个实例
14
+    var tableIns = table.render({
15
+        elem: '#' + tableIds
16
+        , url: '/dictionarya/labelform' //数据接口
17
+        , where: {token: csrfToken, type: type}
18
+        , method: 'post'
19
+        , page: true //开启分页
20
+        , text: '数据加载中'
21
+        , id: reloadId
22
+        , limit: 20
23
+        , cols: [[ //表头
24
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
25
+            {type: 'numbers'},
26
+            {field: 'name', title: '物业类型', align: 'center'}
27
+            , {
28
+                field: 'sort',
29
+                title: '排序',
30
+                width: 200,
31
+                align: 'center',
32
+                event: 'sortData',
33
+                edit: 'text',
34
+                sort: true,
35
+                templet: "#sortBox"
36
+            }
37
+            , {
38
+                field: 'state', title: '审核', align: 'center', width: 100, templet: function (d) {
39
+                    if (d.state == 2) {
40
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
41
+                    } else {
42
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
43
+                    }
44
+                }
45
+            }
46
+            , {fixed: 'right', title: '操作', width: 180, align: 'center', toolbar: '#operate'}
47
+
48
+        ]]
49
+    });
50
+
51
+    table.reload('tablerReload');        //重新加载
52
+
53
+
54
+    //监听指定开关
55
+    form.on('switch(switchTest)', function (data) {
56
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
57
+            $.post('/dictionarya/setlabel', {id: data.value, type: 'show'}, function (data) {
58
+                layer.msg(data.msg);
59
+                table.reload('tablerReload');
60
+
61
+            })
62
+        }, function (aa) {
63
+            table.reload('tablerReload');        //重新加载
64
+        })
65
+    });
66
+
67
+
68
+    //列表操作
69
+    table.on('tool(' + tableIds + ')', function (obj) {
70
+        var layEvent = obj.event,
71
+            data = obj.data;
72
+        if (layEvent === 'edit') {
73
+            layer.open({
74
+                type: 2,
75
+                title: '修改标签',
76
+                area: ['600px', '500px'],
77
+                content: '/dictionarya/labeledit?id=' + data.id, //iframe的url,no代表不显示滚动条
78
+                end: function () {
79
+                    table.reload('tablerReload');
80
+                }
81
+            });
82
+        } else if (layEvent === 'del') {
83
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
84
+                $.post('/dictionarya/labeldel', {'id': data.id}, function (data) {
85
+                    if (data.code == 200) {
86
+                        layer.msg(data.msg);
87
+                        table.reload('tablerReload');
88
+                    } else if (data.code == 300) {
89
+                        layer.msg(data.msg);
90
+                    }
91
+                })
92
+            })
93
+        } else if (layEvent === 'sortData') {       //修改排序
94
+            /* 列表操作  edit  修改后执行  2018.7.24*/
95
+            table.on('edit(' + tableIds + ')', function (obj) {
96
+                var data = obj.data;
97
+                $.post('/dictionarya/setlabel', {id: data.id, type: 'sort', sort: data.sort}, function (data) {
98
+                    if (data.code == 200) {
99
+                        layer.msg(data.msg);
100
+                    } else if (data.code == 300) {
101
+                        layer.msg(data.msg);
102
+                    }
103
+                })
104
+            })
105
+
106
+        }
107
+
108
+
109
+    });
110
+
111
+    var $ = layui.$, active = {
112
+        addData: function () { //获取选中数据
113
+
114
+            layer.open({
115
+                type: 2,
116
+                title: '添加标签',
117
+                area: ['600px', '500px'],
118
+                content: '/dictionarya/labeladd?type=' + type, //iframe的url,no代表不显示滚动条
119
+                end: function () {
120
+                    table.reload('tablerReload');
121
+                }
122
+            });
123
+
124
+            // var checkStatus = table.checkStatus('idTest')
125
+            //     ,data = checkStatus.data;
126
+            // layer.alert(JSON.stringify(data));
127
+        }
128
+    };
129
+
130
+    $('.demoTable .layui-btn').on('click', function () {
131
+        var type = $(this).data('type');
132
+        active[type] ? active[type].call(this) : '';
133
+    });
134
+
135
+    //修改
136
+    form.on('submit(editlabel)', function (data) {
137
+        $.post('/dictionarya/labeleditform', {'data': data.field, 'token': csrfToken}, function (data) {
138
+            if (data.code == 200) {
139
+                layer.msg(data.msg);
140
+
141
+            } else if (data.code == 300) {
142
+                layer.msg(data.msg);
143
+            }
144
+        })
145
+        return false;
146
+    });
147
+
148
+    //添加
149
+    form.on('submit(addlabel)', function (data) {
150
+        $.post('/dictionarya/labeladdform', {'data': data.field, 'token': csrfToken}, function (data) {
151
+            if (data.code == 200) {
152
+                layer.msg(data.msg);
153
+                $("input[name='name']").val('');
154
+            } else if (data.code == 300) {
155
+                layer.msg(data.msg);
156
+            }
157
+        })
158
+        return false;
159
+    });
160
+
161
+});

+ 136 - 0
backend/web/js/china/dictionarya/price.js

@@ -0,0 +1,136 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+
9
+    var tableIds = 'pricelist';  //表格ID
10
+    var reloadId = 'tablerReload';
11
+    //第一个实例
12
+    var tableIns = table.render({
13
+        elem: '#'+tableIds
14
+        ,url: '/dictionarya/priceform' //数据接口
15
+        ,where:{token:csrfToken}
16
+        ,method:'post'
17
+        ,page: true //开启分页
18
+        ,text:'数据加载中'
19
+        ,id:reloadId
20
+        ,cols: [[ //表头
21
+            {type:'numbers'},
22
+            {field: 'price', title: '价格',align:'center'},
23
+            {field: 'state', title: '状态', width:200,align:'center'}
24
+            ,{field: 'sort', title: '排序', width:200,align:'center',event:'sortData',edit: 'text',sort: true,templet:"#sortBox"}
25
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
26
+
27
+        ]]
28
+    });
29
+
30
+    table.reload('tablerReload');        //重新加载
31
+
32
+    //列表操作
33
+    table.on('tool('+tableIds+')', function(obj){
34
+        var layEvent = obj.event,
35
+            data = obj.data;
36
+        if(layEvent === 'edit'){
37
+            layer.open({
38
+                type: 2,
39
+                title: '修改户型',
40
+                area: ['600px', '500px'],
41
+                content: '/dictionarya/priceedit?id='+data.id, //iframe的url,no代表不显示滚动条
42
+                end:function () {
43
+                    table.reload('tablerReload');        //重新加载
44
+                }
45
+            });
46
+        } else if(layEvent === 'del') {
47
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
48
+                $.post('/dictionarya/pricedel',{'id':data.id},function (data) {
49
+                    if(data.code == 200)
50
+                    {
51
+                        layer.msg(data.msg);
52
+                        table.reload('tablerReload');        //重新加载
53
+                    } else if(data.code == 300 ) {
54
+                        layer.msg(data.msg);
55
+                    }
56
+                })
57
+            })
58
+        }else if(layEvent === 'sortData'){       //修改排序
59
+            /* 列表操作  edit  修改后执行  2018.7.24*/
60
+            table.on('edit('+tableIds+')', function(obj){
61
+                var data = obj.data;
62
+                $.post('/dictionarya/pricesort',{id:data.id,type:'sort',sort:data.sort},function (data) {
63
+                    if(data.code == 200)
64
+                    {
65
+                        layer.msg(data.msg);
66
+                    } else if(data.code == 300 ) {
67
+                        layer.msg(data.msg);
68
+                    }
69
+                })
70
+            })
71
+            // layer.prompt({
72
+            //     formType: 2
73
+            //     ,title: '价格排序'
74
+            //     ,value: data.sort
75
+            // }, function(value, index){
76
+            //     $.post('/dictionarya/pricesort',{id:data.id,type:'sort',sort:value},function (data) {
77
+            //         layer.msg(data.msg);
78
+            //         table.reload('tablerReload');
79
+            //     })
80
+            // });
81
+        }
82
+
83
+
84
+    });
85
+
86
+    var $ = layui.$, active = {
87
+        addData: function(){ //获取选中数据
88
+
89
+            layer.open({
90
+                type: 2,
91
+                title: '添加区间价格',
92
+                area: ['600px', '500px'],
93
+                content: '/dictionarya/priceadd', //iframe的url,no代表不显示滚动条
94
+                end:function () {
95
+                    table.reload('tablerReload');        //重新加载
96
+                }
97
+            });
98
+
99
+            // var checkStatus = table.checkStatus('idTest')
100
+            //     ,data = checkStatus.data;
101
+            // layer.alert(JSON.stringify(data));
102
+        }
103
+    };
104
+
105
+    $('.demoTable .layui-btn').on('click', function(){
106
+        var type = $(this).data('type');
107
+        active[type] ? active[type].call(this) : '';
108
+    });
109
+
110
+    //修改
111
+    form.on('submit(editprice)', function(data){
112
+        $.post('/dictionarya/priceeditform',{'data':data.field,'token':csrfToken},function (data) {
113
+            if(data.code == 200)
114
+            {
115
+                layer.msg(data.msg);
116
+            } else if(data.code == 300 ) {
117
+                layer.msg(data.msg);
118
+            }
119
+        })
120
+        return false;
121
+    });
122
+
123
+    //添加
124
+    form.on('submit(addprice)', function(data){
125
+        $.post('/dictionarya/priceaddform',{'data':data.field,'token':csrfToken},function (data) {
126
+            if(data.code == 200)
127
+            {
128
+                layer.msg(data.msg);
129
+            } else if(data.code == 300 ) {
130
+                layer.msg(data.msg);
131
+            }
132
+        })
133
+        return false;
134
+    });
135
+
136
+});

+ 174 - 0
backend/web/js/china/dictionarya/renovation.js

@@ -0,0 +1,174 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form
8
+        ,upload = layui.upload;
9
+
10
+    var tableIds = 'Renovation';  //表格ID
11
+    var reloadId = 'tablerReload';
12
+    //第一个实例
13
+    var tableIns = table.render({
14
+        elem: '#'+tableIds
15
+        ,url: '/dictionarya/renovationform' //数据接口
16
+        ,where:{token:csrfToken,type:4}
17
+        ,method:'post'
18
+        ,page: true //开启分页
19
+        ,text:'数据加载中'
20
+        ,id:reloadId
21
+        ,limit:20
22
+        ,cols: [[ //表头
23
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
24
+            {type:'numbers'},
25
+            {field: 'name', title: '品鉴栏目', align:'center'}
26
+            ,{fixed: 'right',title:'操作', width: 180, align:'center', toolbar: '#operate'}
27
+
28
+        ]]
29
+    });
30
+
31
+    table.reload('tablerReload');        //重新加载
32
+
33
+    //列表操作
34
+    table.on('tool('+tableIds+')', function(obj){
35
+        var layEvent = obj.event,
36
+            data = obj.data;
37
+        if(layEvent === 'edit'){
38
+            layer.open({
39
+                type: 2,
40
+                title: '修改标签',
41
+                area: ['600px', '500px'],
42
+                content: '/dictionarya/renovationedit?id='+data.id, //iframe的url,no代表不显示滚动条
43
+                end:function(){
44
+                    table.reload('tablerReload');
45
+                }
46
+            });
47
+        } else if(layEvent === 'del') {
48
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
49
+                $.post('/dictionarya/labeldel',{'id':data.id},function (data) {
50
+                    if(data.code == 200)
51
+                    {
52
+                        layer.msg(data.msg);
53
+                        table.reload('tablerReload');
54
+                    } else if(data.code == 300 ) {
55
+                        layer.msg(data.msg);
56
+                    }
57
+                })
58
+            })
59
+        }
60
+
61
+
62
+    });
63
+
64
+    var $ = layui.$, active = {
65
+        addData: function(){ //获取选中数据
66
+
67
+            layer.open({
68
+                type: 2,
69
+                title: '添加装修品鉴栏目',
70
+                area: ['600px', '500px'],
71
+                content: '/dictionarya/renovationadd', //iframe的url,no代表不显示滚动条
72
+                end:function(){
73
+                    table.reload('tablerReload');
74
+                }
75
+            });
76
+
77
+            // var checkStatus = table.checkStatus('idTest')
78
+            //     ,data = checkStatus.data;
79
+            // layer.alert(JSON.stringify(data));
80
+        }
81
+    };
82
+
83
+    $('.demoTable .layui-btn').on('click', function(){
84
+        var type = $(this).data('type');
85
+        active[type] ? active[type].call(this) : '';
86
+    });
87
+
88
+    //添加图片上传
89
+    upload.render({
90
+        elem: '#test1'
91
+        ,url: '/house/createimg'
92
+        ,data:{token:csrfToken}
93
+        ,field:'img'
94
+        ,size:1000              //限制上传图片的大小,单位为KB
95
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
96
+        ,auto:false
97
+        ,bindAction:'#addcity'
98
+        ,choose: function(obj){
99
+            obj.preview(function(index, file, result){
100
+                $('#breviary_img').attr('src', result); //图片链接(base64)
101
+            });
102
+        }
103
+    });
104
+
105
+    //添加图片上传
106
+    upload.render({
107
+        elem: '#test2'
108
+        ,url: '/house/createimg'
109
+        ,data:{token:csrfToken}
110
+        ,field:'img1'
111
+        ,size:1000              //限制上传图片的大小,单位为KB
112
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
113
+        ,auto:false
114
+        ,bindAction:'#addcity'
115
+        ,choose: function(obj){
116
+            obj.preview(function(index, file, result){
117
+                $('#breviary_img1').attr('src', result); //图片链接(base64)
118
+            });
119
+        }
120
+    });
121
+
122
+    //修改
123
+    form.on('submit(edittheme)', function(data){
124
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
125
+        var formData = new FormData($('form')[0]);
126
+        $.ajax({
127
+            type : "post",
128
+            url :'/dictionarya/renovationeditform',
129
+            data : formData,
130
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
131
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
132
+            error : function(request) {
133
+                layer.close(index);
134
+                layer.msg("请联系管理员");
135
+            },
136
+            success : function(data) {
137
+                if(data.data != null){
138
+                    layer.msg(ReturnInfo(data.data),{icon:5});
139
+                    return ;
140
+                }
141
+                layer.msg(data.msg);
142
+                parent.layer.close(oindex); //再执行关闭
143
+            }
144
+        });
145
+        return false;
146
+    });
147
+
148
+    //添加
149
+    form.on('submit(addtheme)', function(data){
150
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
151
+        var formData = new FormData($('form')[0]);
152
+        $.ajax({
153
+            type : "post",
154
+            url :'/dictionarya/renovationaddform',
155
+            data : formData,
156
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
157
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
158
+            error : function(request) {
159
+                layer.close(index);
160
+                layer.msg("请联系管理员");
161
+            },
162
+            success : function(data) {
163
+                if(data.data != null){
164
+                    layer.msg(ReturnInfo(data.data),{icon:5});
165
+                    return ;
166
+                }
167
+                layer.msg(data.msg);
168
+                parent.layer.close(oindex); //再执行关闭
169
+            }
170
+        });
171
+        return false;
172
+    });
173
+
174
+});

+ 113 - 0
backend/web/js/china/dictionarya/theme.js

@@ -0,0 +1,113 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+
9
+    var tableIds = 'themelist';  //表格ID
10
+    var reloadId = 'tablerReload';
11
+    //第一个实例
12
+    table.render({
13
+        elem: '#'+tableIds
14
+        ,url: '/dictionarya/themeform' //数据接口
15
+        ,where:{token:csrfToken}
16
+        ,method:'post'
17
+        ,page: true //开启分页
18
+        ,text:'数据加载中'
19
+        ,id:reloadId
20
+        ,cols: [[ //表头
21
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
22
+            {type:'numbers'},
23
+            {field: 'name', title: '特色主题',align:'center'}
24
+            ,{field: 'update_at', title: '更新时间', width:150,align:'center'}
25
+            ,{field: 'create_at', title: '添加时间', width:150,align:'center'}
26
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
27
+
28
+        ]]
29
+    });
30
+
31
+    table.reload('tablerReload');        //重新加载
32
+
33
+    //列表操作
34
+    table.on('tool('+tableIds+')', function(obj){
35
+        var layEvent = obj.event,
36
+            data = obj.data;
37
+        if(layEvent === 'edit'){
38
+            layer.open({
39
+                type: 2,
40
+                title: '修改特色主题',
41
+                closeBtn: 1, //不显示关闭按钮
42
+                shade: [0],
43
+                area: ['600px', '500px'],
44
+                anim: 2,
45
+                content: '/dictionarya/themeedit?id='+data.id, //iframe的url,no代表不显示滚动条
46
+                end:function(){
47
+                    table.reload('tablerReload');
48
+                }
49
+            });
50
+        } else if(layEvent === 'del') {
51
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
52
+                $.post('/dictionarya/themedel',{'id':data.id},function (data) {
53
+                    if(data.code == 200)
54
+                    {
55
+                        layer.msg(data.msg);
56
+                        table.reload('tablerReload');
57
+                    } else if(data.code == 300 ) {
58
+                        layer.msg(data.msg);
59
+                    }
60
+                })
61
+            })
62
+        }
63
+
64
+
65
+    });
66
+
67
+    var $ = layui.$, active = {
68
+        addData: function(){ //获取选中数据
69
+            layer.open({
70
+                type: 2,
71
+                title: '添加特色主题',
72
+                area: ['600px', '500px'],
73
+                content: '/dictionarya/themeadd', //iframe的url,no代表不显示滚动条
74
+                end:function(){
75
+                    table.reload('tablerReload');
76
+                }
77
+            });
78
+        }
79
+    };
80
+
81
+    $('.demoTable .layui-btn').on('click', function(){
82
+        var type = $(this).data('type');
83
+        active[type] ? active[type].call(this) : '';
84
+    });
85
+
86
+    //修改
87
+    form.on('submit(edittheme)', function(data){
88
+        $.post('/dictionarya/themeeditform',{'data':data.field},function (data) {
89
+            if(data.code == 200)
90
+            {
91
+                layer.msg(data.msg);
92
+            } else if(data.code == 300 ) {
93
+                layer.msg(data.msg);
94
+            }
95
+        })
96
+        return false;
97
+    });
98
+
99
+    //添加
100
+    form.on('submit(addtheme)', function(data){
101
+        $.post('/dictionarya/themeaddform',{'data':data.field},function (data) {
102
+            if(data.code == 200)
103
+            {
104
+                layer.msg(data.msg);
105
+                $('input').val('');
106
+            } else if(data.code == 300 ) {
107
+                layer.msg(data.msg);
108
+            }
109
+        })
110
+        return false;
111
+    });
112
+
113
+});

+ 257 - 0
backend/web/js/china/facilities.js

@@ -0,0 +1,257 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () {
2
+
3
+    var layer = layui.layer //弹层
4
+        , table = layui.table //表格
5
+        , element = layui.element //元素操作
6
+        , form = layui.form
7
+        , upload = layui.upload;
8
+    //第一个实例
9
+    var indexTtable = table.render({
10
+        elem: '#housefacilitieslist'
11
+        , url: '/dictionary/facilitiesform' //数据接口
12
+        , where: {token: csrfToken}
13
+        , method: 'post'
14
+        , page: true //开启分页
15
+        , text: '数据加载中'
16
+        , id: 'tablerReload'
17
+        , cols: [[ //表头
18
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
19
+            {type: 'numbers'},
20
+            {field: 'name', title: '户型', align: 'center'}
21
+            , {
22
+                field: 'sort',
23
+                title: '排序',
24
+                width: 200,
25
+                event: 'sortData',
26
+                edit: 'text',
27
+                align: 'center',
28
+                sort: true,
29
+                templet: "#sortBox"
30
+            }
31
+            , {
32
+                field: 'is_show', title: '审核', align: 'center', width: 200, templet: function (d) {
33
+                    if (d.is_show == 2) {
34
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
35
+                    } else {
36
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
37
+                    }
38
+                }
39
+            }
40
+            , {field: 'create_at', title: '添加时间', width: 120, align: 'center'}
41
+            , {fixed: 'right', title: '操作', width: 165, align: 'center', toolbar: '#operate'}
42
+
43
+        ]]
44
+    });
45
+
46
+    indexTtable.reload('tablerReload');        //重新加载
47
+
48
+    //监听指定开关
49
+    form.on('switch(switchTest)', function (data) {
50
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
51
+            $.post('/dictionary/facilitiesstate', {id: data.value, type: 'is_show'}, function (data) {
52
+                layer.msg(data.msg);
53
+                table.reload('tablerReload');
54
+
55
+            })
56
+        }, function (aa) {
57
+            indexTtable.reload('tablerReload');        //重新加载
58
+        })
59
+    });
60
+
61
+    //列表操作
62
+    table.on('tool(housefacilitieslist)', function (obj) {
63
+        var layEvent = obj.event,
64
+            data = obj.data;
65
+        if (layEvent === 'edit') {
66
+            layer.open({
67
+                type: 2,
68
+                title: '修改配套信息',
69
+                closeBtn: 1, //不显示关闭按钮
70
+                shade: [0],
71
+                area: ['600px', '500px'],
72
+                anim: 2,
73
+                content: ['/dictionary/facilitiessave?id=' + data.id, 'yes'], //iframe的url,no代表不显示滚动条
74
+            });
75
+        } else if (layEvent === 'del') {
76
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
77
+                $.post('/dictionary/facilitiesdel', {'id': data.id}, function (data) {
78
+                    if (data.code == 200) {
79
+                        layer.msg(data.msg);
80
+                        table.reload('tablerReload');
81
+                    } else if (data.code == 300) {
82
+                        layer.msg(data.msg);
83
+                    }
84
+                })
85
+            })
86
+        } else if (layEvent === 'sortData') {       //修改排序
87
+            table.on('edit(housefacilitieslist)', function (obj) {
88
+                var data = obj.data;
89
+                $.post('/dictionary/facilitiessort', {
90
+                    id: data.id,
91
+                    type: 'sort',
92
+                    sort: data.sort
93
+                }, function (data) {
94
+                    if (data.code == 200) {
95
+                        layer.msg(data.msg);
96
+                    } else if (data.code == 300) {
97
+                        layer.msg(data.msg);
98
+                    }
99
+                })
100
+            })
101
+        }
102
+    });
103
+
104
+    var $ = layui.$, active = {
105
+        addData: function () { //获取选中数据
106
+
107
+            layer.open({
108
+                type: 2,
109
+                title: '添加配套信息',
110
+                closeBtn: 1, //不显示关闭按钮
111
+                shade: [0],
112
+                area: ['600px', '500px'],
113
+                anim: 2,
114
+                content: ['/dictionary/facilitiesadd', 'yes'], //iframe的url,no代表不显示滚动条
115
+            });
116
+
117
+            // var checkStatus = table.checkStatus('idTest')
118
+            //     ,data = checkStatus.data;
119
+            // layer.alert(JSON.stringify(data));
120
+        }
121
+    };
122
+
123
+    $('.demoTable .layui-btn').on('click', function () {
124
+        var type = $(this).data('type');
125
+        active[type] ? active[type].call(this) : '';
126
+    });
127
+
128
+
129
+    //添加图片上传
130
+    upload.render({
131
+        elem: '#test1'
132
+        , url: '/house/createimg'
133
+        , data: {token: csrfToken}
134
+        , field: 'img'
135
+        , size: 1000              //限制上传图片的大小,单位为KB
136
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
137
+        , auto: false
138
+        , bindAction: '#addcity'
139
+        , choose: function (obj) {
140
+            obj.preview(function (index, file, result) {
141
+                $('#demo1').attr('src', result); //图片链接(base64)
142
+            });
143
+        }
144
+    });
145
+
146
+    //添加图片上传
147
+    upload.render({
148
+        elem: '#test2'
149
+        , url: '/house/createimg'
150
+        , data: {token: csrfToken}
151
+        , field: 'mobile_img'
152
+        , size: 1000              //限制上传图片的大小,单位为KB
153
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
154
+        , auto: false
155
+        , bindAction: '#addcity'
156
+        , choose: function (obj) {
157
+            obj.preview(function (index, file, result) {
158
+                $('#demo2').attr('src', result); //图片链接(base64)
159
+            });
160
+        }
161
+    });
162
+
163
+    //添加图片上传
164
+    upload.render({
165
+        elem: '#test3'
166
+        , url: '/house/createimg'
167
+        , data: {token: csrfToken}
168
+        , field: 'map_img'
169
+        , size: 1000              //限制上传图片的大小,单位为KB
170
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
171
+        , auto: false
172
+        , bindAction: '#addcity'
173
+        , choose: function (obj) {
174
+            obj.preview(function (index, file, result) {
175
+                $('#demo3').attr('src', result); //图片链接(base64)
176
+            });
177
+        }
178
+    });
179
+
180
+
181
+    //修改
182
+    form.on('submit(save_form)', function (data) {
183
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
184
+
185
+        var formData = new FormData($('#facilities_form')[0]);
186
+        $.ajax({
187
+            cache: true,
188
+            type: "post",
189
+            url: '/dictionary/facilitiessaveform',
190
+            data: formData,  // 你的formid
191
+            // async : false,          //async 默认为true异步,修改为false为同步
192
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
193
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
194
+            error: function (request) {
195
+                layer.close(index);         //关闭数据提交信息
196
+                layer.alert("网络超时");
197
+            },
198
+            success: function (data) {
199
+                if (data.code == 200) {
200
+                    layer.msg(data.msg);
201
+                    parent.layui.table.reload('housefacilitieslist');
202
+                    TableClose();
203
+                } else if (data.code == 300) {
204
+                    layer.msg(data.msg);
205
+                    layer.msg(ReturnInfo(data.data));
206
+                }
207
+            }
208
+        });
209
+        return false;
210
+    });
211
+
212
+    // 点击放大图片
213
+    $('.layui_magnify').on('click', function () {
214
+        var _src = $(this).attr('src');
215
+        layui.layer.open({
216
+            type: 1,
217
+            title: false,           //是否显示标题
218
+            area: ['60%', '80%'],
219
+            shade: 0.6,           //透明度
220
+            closeBtn: 1,         //按钮 1有,0无
221
+            shadeClose: true,
222
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
223
+        });
224
+    });
225
+
226
+
227
+    //添加
228
+    form.on('submit(add_form)', function (data) {
229
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
230
+        var formData = new FormData($('#facilities_form')[0]);
231
+        $.ajax({
232
+            cache: true,
233
+            type: "post",
234
+            url: '/dictionary/facilitiesaddform',
235
+            data: formData,  // 你的formid
236
+            // async : false,          //async 默认为true异步,修改为false为同步
237
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
238
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
239
+            error: function (request) {
240
+                layer.close(index);         //关闭数据提交信息
241
+                layer.alert("网络超时");
242
+            },
243
+            success: function (data) {
244
+                if (data.code == 200) {
245
+                    layer.msg(data.msg);
246
+                    parent.layui.table.reload('tablerReload');
247
+                    // TableClose();
248
+                } else if (data.code == 300) {
249
+                    layer.msg(data.msg);
250
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
251
+                }
252
+            }
253
+        });
254
+        return false;
255
+    });
256
+
257
+});

+ 654 - 0
backend/web/js/china/house.js

@@ -0,0 +1,654 @@
1
+layui.use(['form', 'layer', 'laydate', 'table', 'laytpl', 'layedit', 'upload'], function () {
2
+    var form = layui.form,
3
+        // layer = parent.layer === undefined ? layui.layer : top.layer,
4
+        layer = layui.layer,
5
+        $ = layui.jquery,
6
+        laydate = layui.laydate,
7
+        laytpl = layui.laytpl,
8
+        table = layui.table,
9
+        layedit = layui.layedit
10
+        , upload = layui.upload;
11
+
12
+    //调用编辑器
13
+    var tableIds = 'housesList';
14
+    var reloadId = 'tablerReload';
15
+    //楼盘列表
16
+    var tableIns = table.render({
17
+        elem: '#' + tableIds,
18
+        url: '/house/indexform',
19
+        cellMinWidth: 95,
20
+        method: 'post',
21
+        page: true,
22
+        height: 600,
23
+        limit: 20,
24
+        id: reloadId,
25
+        // limits : [10,15,20,25],is_view
26
+        cols: [[
27
+            {type: "checkbox", width: 50},
28
+            {field: 'id', title: 'ID', width: 80, align: "center", sort: true},
29
+            {
30
+                field: 'name', title: '标题', align: "center", templet: function (d) {
31
+                    var html = '<ul style="width:200px;float:left;">';
32
+                    if (d.is_push == 2) {
33
+                        html += '<li style="float:left; padding: 0 5px;"><img src="/img/house/housezhutui.png"></li>';
34
+                    }
35
+                    if (d.thumb != null && d.thumb != "") {
36
+                        html += '<li style="float:left;padding: 0 5px;"><img  src="/img/house/housetu.png"></li>';
37
+                    }
38
+                    if (d.evaluating != null && d.evaluating != "") {
39
+                        html += '<li style="float:left;padding: 0 5px;"><img  src="/img/house/houseping.png"></li>';
40
+                    }
41
+                    if (d.video == 1) {
42
+                        html += '<li style="float:left;padding: 0 5px;"><img  src="/img/house/hangpai.png"></li>';
43
+                    }
44
+
45
+                    if (d.permit != 0) {
46
+                        html += '<li style="float:left;padding: 0 5px;position:relative;"><img src="/img/house/houseyushouzheng.png"><span style="font-size:12px;;position:absolute;right:7px;top:1px;display:inline-block;width:22px;text-align:center;color:#fff;">' + d.permit + '</span></li>';
47
+                    }
48
+
49
+                    html += '</ul>';
50
+                    html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.pinfanghw.com/house/' + d.id + '" target="_blank">' + d.name + '</a>';
51
+                    return html;
52
+                }
53
+            },
54
+            {field: 'city_name', title: '区域', width: 90, sort: true, align: 'center'},
55
+            {
56
+                field: 'album_num',
57
+                title: '相册',
58
+                width: 80,
59
+                event: 'housesPhoto',
60
+                align: 'center',
61
+                templet: "#housesPhoto",
62
+                templet: function (d) {
63
+                    return '<a href="javascript:;">[' + d.album_num + ']</a>'
64
+                }
65
+            },
66
+            {field: 'news_num', title: '资讯',width:70, event:'housesNews',  align:'center',templet:"#housesNews",templet:function(d){
67
+                    return '<a href="javascript:;">['+d.news_num+']</a>'
68
+                }},
69
+            {
70
+                field: 'type_num',
71
+                title: '户型',
72
+                width: 80,
73
+                event: 'housesType',
74
+                align: 'center',
75
+                templet: "#housesType",
76
+                templet: function (d) {
77
+                    return '<a href="#">[' + d.type_num + ']</a>'
78
+                }
79
+            },
80
+            {
81
+                field: 'peitao_num',
82
+                title: '周边配套',
83
+                width: 90,
84
+                event: 'houseFacilities',
85
+                align: 'center',
86
+                templet: "#houseFacilities",
87
+                templet: function (d) {
88
+                    return '<a href="#">[' + d.peitao_num + ']</a>'
89
+                }
90
+            },
91
+
92
+            {field: 'click_num', title: '点击', width: 80, align: 'center', sort: true},
93
+            {field: 'sort', title: '排序', width: 80, edit: 'text', align: 'center', sort: true, templet: "#sortBox"},
94
+            {field: 'create_at', title: '添加时间', width: 150, align: 'center'},
95
+            {
96
+                field: 'is_view',
97
+                title: '审核',
98
+                width: 70,
99
+                align: 'center',
100
+                templet: "#Toexamine",
101
+                templet: function (d) {
102
+                    switch (d.is_view) {
103
+                        case '2':
104
+                            return '<input type="checkbox"  value="' + d.id + '" name="' + d.is_view + '" house="' + d.name + '"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
105
+                            break;
106
+                        case '1':
107
+                            return '<input type="checkbox" checked  value="' + d.id + '" name="' + d.is_view + '" house="' + d.name + '"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
108
+                            break;
109
+                    }
110
+                }
111
+            },
112
+            {title: '操作', width: 200, templet: '#housesListBar', fixed: "right", align: "center"}
113
+
114
+        ]]
115
+    });
116
+
117
+    tableIns.reload('tablerReload');        //重新加载
118
+
119
+    var $ = layui.$, active = {
120
+
121
+        reload: function () {
122
+            var form = pfgs_serialize($('form'));
123
+            var name = '';
124
+            var id = '';
125
+            if (form.input_house == 'name') {
126
+                name = form.input_house_text;
127
+            } else if (form.input_house == 'id') {
128
+                id = form.input_house_text;
129
+            }
130
+
131
+            var city = '';
132
+            if (form.province != '') {
133
+                city = form.province;
134
+            }
135
+
136
+            if (form.city != '') {
137
+                city = form.city;
138
+            }
139
+            table.reload('tablerReload', {
140
+                where: {
141
+                    sort: form.input_sort,
142
+                    id: id,
143
+                    name: name,
144
+                    city: city,
145
+                    is_view: form.show,
146
+                    end_time: form.end_time,
147
+                    start_time: form.start_time,
148
+                    is_push: form.is_push
149
+                },
150
+                page: {
151
+                    curr: 1
152
+                }
153
+            })
154
+        },
155
+
156
+    };
157
+
158
+    $('.demoTable .layui-btn').on('click', function () {
159
+        var type = $(this).data('type');
160
+        active[type] ? active[type].call(this) : '';
161
+    });
162
+
163
+    //日期
164
+    laydate.render({
165
+        elem: '#date1'
166
+    });
167
+    laydate.render({
168
+        elem: '#date2'
169
+    });
170
+
171
+    //选项卡切换
172
+    $('.layui-tab-title .site-demo-active').on('click', function () {
173
+        $(this).addClass('layui-this').siblings().removeClass('layui-this');
174
+        var lay_id = $(this).attr('lay-id');
175
+        $('.layui-tab-item').removeClass('layui-show')
176
+        $('.layui-tab-content #' + lay_id).addClass('layui-show')
177
+    });
178
+
179
+
180
+    //监听指定开关
181
+    form.on('switch(switchTest)', function (data) {
182
+        var house = data.elem.attributes.house.value;
183
+        layer.open({
184
+            title: '修改<span style="color:red" >[' + house + ']</span>状态',
185
+            type: 2,
186
+            area: ['50%', '80%'],
187
+            maxmin: true,
188
+            content: "/house/openstate?hid=" + data.value + "&name=" + house,
189
+            end: function () {
190
+                table.reload('tablerReload');
191
+            }
192
+        })
193
+    });
194
+
195
+    form.on('submit(del_alls_house)', function (data) {
196
+        var checkStatus = table.checkStatus('tablerReload');
197
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
198
+        if (typeof checkStatus.data[0] == 'object') {
199
+            layer.confirm('您确定要删除吗?', {btn: ['确认', '取消']}, function () {
200
+                var formdat = new FormData();
201
+                $.each(checkStatus.data, function (key, val) {
202
+                    formdat.append('hid[]', val.id);
203
+                })
204
+                $.ajax({
205
+                    cache: true,
206
+                    type: "post",
207
+                    url: "/house/housedel",
208
+                    data: formdat,  // 你的formid
209
+                    // async : false,          //async 默认为true异步,修改为false为同步
210
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
211
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
212
+                    error: function (request) {
213
+                        layer.close(index);         //关闭数据提交信息
214
+                        layer.alert("网络超时");
215
+                    },
216
+                    success: function (data) {
217
+                        if (data.code == 200) {
218
+                            layer.msg(data.msg);
219
+                            reloadTable(reloadId);
220
+                        } else {
221
+                            layer.msg(data.msg);
222
+                        }
223
+                    }
224
+                });
225
+
226
+            })
227
+            return false;
228
+        }
229
+        layer.msg('请选择需要删除的楼盘', {icon: 5});
230
+        return false;
231
+    })
232
+
233
+    //检测关键词
234
+    form.on('submit(check_words)',function (data) {
235
+        var content=UE.getEditor('editor').getContentTxt();
236
+        var centhtml = UE.getEditor('editor').getContent();
237
+        $.ajax({
238
+            //cache : false,
239
+            type : "post",
240
+            url : "/sensitivewords/checkword",
241
+            data:{content:content},  // 你的formid
242
+            //contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
243
+            //processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
244
+            error : function(request) {
245
+                layer.close(index);
246
+                layer.alert("网络超时");
247
+            },
248
+            success : function(data) {
249
+                if(data.data!=null){
250
+                    var index=layer.open({
251
+                        type: 1,
252
+                        // skin: 'layui-layer-rim', //加上边框
253
+                        title:'违禁词信息',
254
+                        area: ['420px', '240px'], //宽高
255
+                        content: '<div style="color:red;">'+data.data+'</div>'
256
+                    });
257
+                    for(var i=0;i<data.data.length;i++){
258
+                        centhtml = centhtml.replace(data.data[i],"<span style='color: rgb(255, 0, 0);'>"+data.data[i]+"</span>");
259
+                    }
260
+                    UE.getEditor('editor_content').setContent(centhtml);
261
+                    layer.msg(data.msg)
262
+                }else{
263
+                    layer.msg(data.msg)
264
+                }
265
+            }
266
+        });
267
+        return false;
268
+    })
269
+
270
+    /* 列表操作  edit  修改后执行  */
271
+    table.on('edit(' + tableIds + ')', function (obj) {
272
+        var data = obj.data;
273
+        $.post('/house/housesortedit', {id: data.id, sort: data.sort}, function (data) {
274
+            if (data.code == 200) {
275
+                layer.msg(data.msg);
276
+            } else if (data.code == 300) {
277
+                layer.msg(data.msg);
278
+            }
279
+        })
280
+
281
+    })
282
+
283
+
284
+    /* 列表操作  tool  点击执行  */
285
+    table.on('tool(' + tableIds + ')', function (obj) {
286
+        var data = obj.data;
287
+
288
+        if (obj.event === 'edit') {
289
+            var index = layui.layer.open({
290
+                title: '<span style="color:red" >[' + data.name + ']</span>修改楼盘信息',
291
+                type: 2,
292
+                area: ['', '100%'],
293
+                maxmin: true,
294
+                content: "/house/edit?id=" + data.id,
295
+                end: function () {
296
+                    layui.table.reload('tablerReload');
297
+                }
298
+            })
299
+
300
+            layui.layer.full(index);
301
+            // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
302
+            $(window).on("resize", function () {
303
+                layui.layer.full(index);
304
+            })
305
+        } else if (obj.event === 'del') {
306
+
307
+            layer.confirm('您确认要删除吗?', {btn: ['确认', '取消']}, function () {
308
+                $.post('/house/housedel', {id: data.id}, function (data) {
309
+                    if (data.code == 200) {
310
+                        layer.msg(data.msg);
311
+                        // parent.layui.
312
+                        table.reload('tablerReload');
313
+                        // TableClose();
314
+                    } else {
315
+                        layer.msg(data.msg);
316
+                    }
317
+                })
318
+            })
319
+        }else if(obj.event === 'housesNews'){
320
+            var index =layui.layer.open({
321
+                title :'<span style="color:red" >['+data.name+']</span>楼盘资讯',
322
+                type : 2,
323
+                area:['','100%'],
324
+                maxmin: true,
325
+                content : "/house/newslist?id="+data.id+"&name="+data.name,
326
+                end:function () {
327
+                    table.reload('tablerReload');
328
+                }
329
+            })
330
+            layui.layer.full(index);
331
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
332
+            $(window).on("resize",function(){
333
+                layui.layer.full(index);
334
+            })
335
+        } else if (obj.event === 'housesPhoto') {
336
+            var index = layui.layer.open({
337
+                title: '<span style="color:red" >[' + data.name + ']</span>楼盘相册',
338
+                type: 2,
339
+                area: ['', '100%'],
340
+                maxmin: true,
341
+                content: "/house/album?id=" + data.id + "&name=" + data.name,
342
+                end: function () {
343
+                    table.reload('tablerReload');
344
+                }
345
+            })
346
+            layui.layer.full(index);
347
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
348
+            $(window).on("resize", function () {
349
+                layui.layer.full(index);
350
+            })
351
+        } else if (obj.event === 'housesType') {
352
+            var index = layui.layer.open({
353
+                title: '<span style="color:red" >[' + data.name + ']</span>楼盘户型',
354
+                type: 2,
355
+                area: ['', '100%'],
356
+                maxmin: true,
357
+                content: "/house/housetype?id=" + data.id + "&name=" + data.name,
358
+                end: function () {
359
+                    table.reload('tablerReload');
360
+                }
361
+            })
362
+            layui.layer.full(index);
363
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
364
+            $(window).on("resize", function () {
365
+                layui.layer.full(index);
366
+            })
367
+        } else if (obj.event === 'house_price') {
368
+            var index = layui.layer.open({
369
+                title: '<span style="color:red" >[' + data.name + ']</span>楼盘历史价格',
370
+                type: 2,
371
+                area: ['', '100%'],
372
+                maxmin: true,
373
+                content: "/house/priceview?id=" + data.id + "&name=" + data.name + '&price=' + data.sale_price,
374
+                end: function () {
375
+                    table.reload('tablerReload');
376
+                }
377
+            })
378
+            layui.layer.full(index);
379
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
380
+            $(window).on("resize", function () {
381
+                layui.layer.full(index);
382
+            })
383
+        } else if (obj.event === 'houseFacilities') {
384
+            var index = layui.layer.open({
385
+                title: '<span style="color:red" >[' + data.name + ']</span>楼盘周边配套',
386
+                type: 2,
387
+                area: ['', '100%'],
388
+                maxmin: true,
389
+                content: "/house/peitao?id=" + data.id + "&name=" + data.name,
390
+                end: function () {
391
+                    table.reload('tablerReload');
392
+                }
393
+            })
394
+            layui.layer.full(index);
395
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
396
+            $(window).on("resize", function () {
397
+                layui.layer.full(index);
398
+            })
399
+        } else if (obj.event === 'house_presell') {
400
+            var index = layui.layer.open({
401
+                title: '<span style="color:red" >[' + data.name + ']</span>预售许可证',
402
+                type: 2,
403
+                area: ['', '100%'],
404
+                maxmin: true,
405
+                content: "/house/presell?id=" + data.id + "&name=" + data.name,
406
+                end: function () {
407
+                    table.reload('tablerReload');
408
+                }
409
+            })
410
+            layui.layer.full(index);
411
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
412
+            $(window).on("resize", function () {
413
+                layui.layer.full(index);
414
+            })
415
+        }
416
+    });
417
+
418
+    //楼盘名称,区域, 注释装修情况
419
+    //添加图片上传
420
+    upload.render({
421
+        elem: '#test1'
422
+        , url: '/house/createimg'
423
+        , data: {token: csrfToken}
424
+        , field: 'img'
425
+        , size: 1000              //限制上传图片的大小,单位为KB
426
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
427
+        , auto: false
428
+        , bindAction: '#addcity'
429
+        , choose: function (obj) {
430
+            obj.preview(function (index, file, result) {
431
+                $('#demo1').attr('src', result); //图片链接(base64)
432
+            });
433
+        }
434
+    });
435
+
436
+    // 点击放大图片
437
+    $('#demo1').on('click', function () {
438
+        var _src = $(this).attr('src');
439
+        layui.layer.open({
440
+            type: 1,
441
+            title: false,           //是否显示标题
442
+            area: ['60%', '80%'],
443
+            shade: 0.6,           //透明度
444
+            closeBtn: 1,         //按钮 1有,0无
445
+            shadeClose: true,
446
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
447
+        });
448
+    });
449
+
450
+    //判断是否需要编辑,需要才加载
451
+    var verdict = $('#editor').html();
452
+    if (typeof verdict == "string") {
453
+        var ue = UE.getEditor('editor');  //编辑器
454
+    }
455
+
456
+
457
+    //重载表格
458
+    function reloadTable(obj) {
459
+        table.reload(obj);
460
+    }
461
+
462
+
463
+    //编辑楼盘
464
+    form.on('submit(edit)', function (data) {
465
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
466
+        var formData = new FormData($('#house_edit_form')[0]);
467
+        $.ajax({
468
+            cache: true,
469
+            type: "post",
470
+            url: "/house/editfrom",
471
+            data: formData,  // 你的formid
472
+            // async : false,          //async 默认为true异步,修改为false为同步
473
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
474
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
475
+            error: function (request) {
476
+                layer.close(index);         //关闭数据提交信息
477
+                layer.alert("请联系管理员");
478
+            },
479
+            success: function (data) {
480
+                if (data.code == 200) {
481
+                    layer.msg(data.msg);
482
+                } else if (data.code == 300) {
483
+                    layer.msg(data.msg);
484
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
485
+                }
486
+            }
487
+        });
488
+        return false;
489
+    });
490
+
491
+    //楼盘上架下架操作
492
+    form.on('submit(openstate)', function (data) {
493
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
494
+        $.ajax({
495
+            cache: true,
496
+            type: "post",
497
+            url: "/house/openstateform",
498
+            data: data.field,  // 你的formid
499
+            // async : false,          //async 默认为true异步,修改为false为同步
500
+            // contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
501
+            // processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
502
+            error: function (request) {
503
+                layer.close(index);         //关闭数据提交信息
504
+                layer.alert("请联系管理员");
505
+            },
506
+            success: function (data) {
507
+                if (data.data != null) {
508
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
509
+                    return;
510
+                }
511
+                layer.msg(data.msg);
512
+            }
513
+        });
514
+        return false;
515
+    });
516
+
517
+
518
+    //加载省数据
519
+    function loadProvince(data) {
520
+        $.ajax({
521
+            url: '/categorycity/citypid',
522
+            type: 'post',
523
+            async: false,//使用同步的方式,true为异步方式
524
+            data: {'pid': 0},//这里使用json对象
525
+            success: function (data) {
526
+                // console.log(data);
527
+                var areaData = data.data;
528
+                var proHtml = '';
529
+                for (var i = 0; i < areaData.length; i++) {
530
+                    proHtml += '<option value="' + areaData[i].id + '">' + areaData[i].city_name + '</option>';
531
+                }
532
+                //初始化省数据
533
+                $('select[name=province]').append(proHtml);
534
+                form.render();
535
+            },
536
+            fail: function () {
537
+
538
+            }
539
+        });
540
+    }
541
+
542
+    loadProvince();
543
+    form.on('select(province)', function (data) {
544
+        $.post('/categorycity/citypid', {'pid': data.value}, function (data) {
545
+            var areaData = data.data;
546
+            var proHtml = '';
547
+            $('select[name=city]').html('');
548
+            proHtml = '<option value="">请选择市/区/县</option>';
549
+            for (var i = 0; i < areaData.length; i++) {
550
+
551
+                proHtml += '<option value="' + areaData[i].id + '">' + areaData[i].city_name + '</option>';
552
+            }
553
+            //初始化省数据
554
+            $('select[name=city]').append(proHtml);
555
+            form.render();
556
+        })
557
+    })
558
+
559
+
560
+    // 添加楼盘评测
561
+
562
+    var leng = 50;
563
+    $('.layui_w_addbtn').on('click', function () {
564
+        datumInsert(leng)
565
+        $('body').append('<script id="ue' + leng + '">UE.getEditor("evaluating' + leng + '")</script>')  //编辑器
566
+        var ue = UE.getEditor("evaluating" + leng);
567
+        ue.ready(function () {
568
+            // ue.setContent('<p>编辑器1的内容</p>', true);
569
+        });
570
+        leng++;
571
+    })
572
+    //展示数据删除按钮
573
+    $('.layui_w_licence table.layui-table tbody.mai').on('click', '.del', function () {
574
+        var _this = $(this)
575
+        var oid = _this.parents('.otr').attr('id');
576
+
577
+        var index = layer.confirm('确定要删除吗?', {btn: ['确定', '取消']}, function () {
578
+            // layer.close(index)
579
+            _this.parents('#' + oid).remove();
580
+            $('body script#' + oid).remove();
581
+            layer.msg('已成功删除!');
582
+        })
583
+
584
+    })
585
+
586
+
587
+})
588
+
589
+$(function () {
590
+    $('.editmai tr.otr').each(function () {
591
+        var _ind = $(this).attr('data-id');
592
+        UE.getEditor("evaluating" + _ind);
593
+        // console.log(_ind)
594
+    })
595
+
596
+    //选项卡切换
597
+    $('.layui-tab-title .site-demo-active').on('click', function () {
598
+        $(this).addClass('layui-this').siblings().removeClass('layui-this');
599
+        var lay_id = $(this).attr('lay-id');
600
+        $('.layui-tab-item').removeClass('layui-show')
601
+        $('.layui-tab-content #' + lay_id).addClass('layui-show')
602
+    });
603
+    // 转换拼音
604
+    $('.layui_w_name').on('keyup ', function () {
605
+        var _txt = $(this).val();
606
+        var _convert = pinyinUtil.getPinyin(_txt, ' ', false).replace(/\s/g, "");
607
+        $('.layui_w_spell').val(_convert)
608
+    })
609
+
610
+    // 动态添加批量删除按钮
611
+    var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
612
+        + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_house">批量删除</a>'
613
+        + '</div>'
614
+    $('.layui-form').append(_btn)
615
+
616
+
617
+    // 修改楼盘编辑高度问题
618
+    var i = 0;
619
+    $('li[lay-id="assign_4"]').on('click', function () {
620
+        var _text = UE.getEditor('editor').getContent()
621
+        if (_text != '') {
622
+            if (i < 1) {
623
+                var editorHeight = UE.getEditor('editor').iframe.clientHeight;
624
+                if (editorHeight > 400) {
625
+                    var _setHeight = parseInt(UE.getEditor('editor').iframe.clientHeight / 7.5);
626
+                    $('#assign_4').find('#edui1_iframeholder').css('height', _setHeight);
627
+                }
628
+                i++;
629
+            }
630
+        }
631
+    })
632
+
633
+})
634
+
635
+//楼盘评测 添加
636
+function datumInsert(leng) {
637
+    // var leng = $(".layui_w_licence table.layui-table tbody tr").length;
638
+    // console.log(leng)
639
+    var tr = '<tr class="otr" id="ue' + leng + '">'
640
+        + '<td lay-event="del">'
641
+        + '<div class="layui-table-cell del" lay-oid=""><i class="layui-icon" style="font-size: 30px; color: #1E9FFF;cursor: pointer">&#xe640;</i></div>'
642
+        + '</td>'
643
+        + '<td data-field="matingName" align="center" data-content="">'
644
+        + '<div class="editor_box layui-form-item" style="width:99%;height:400">'
645
+        + '<textarea name="evaluating[]" id="evaluating' + leng + '" cols="20" rows="10" style="width:100%;float:left;"></textarea>'
646
+        + '</div>'
647
+        + '</td>'
648
+        + '</tr>';
649
+    $(".layui_w_licence table.layui-table tbody.mai").append(tr);
650
+}
651
+
652
+
653
+
654
+                       

+ 146 - 0
backend/web/js/china/house_select_city.js

@@ -0,0 +1,146 @@
1
+//查询赋值
2
+function query(form) {
3
+    var _vals = $('input[name=select_province]').val();
4
+    var _vals1 = $('input[name=select_city]').val();
5
+    var _vals2 = $('input[name=select_area]').val();
6
+    provinceChange(form, _vals, _vals1, _vals2);
7
+}
8
+
9
+function loadProvince(pid = 0) {
10
+    $.ajax({
11
+        url: '/categorycity/citypid',
12
+        type: 'post',
13
+        async: false,//使用同步的方式,true为异步方式
14
+        data: {'pid': pid},//这里使用json对象
15
+        success: function (data) {
16
+            // console.log(data);
17
+            var areaData = data.data;
18
+            provinceChange(form, areaData, data_.city, data_.county);
19
+        },
20
+        fail: function () {
21
+
22
+        }
23
+    });
24
+}
25
+
26
+
27
+/**
28
+ * 初始化省
29
+ */
30
+function provinceChange(form, provinceValue, cityValue, countyValue) {
31
+    $.ajax({
32
+        url: '/categorycity/citypid',
33
+        type: 'post',
34
+        async: false,//使用同步的方式,true为异步方式
35
+        data: {'pid': 0},//这里使用json对象
36
+        success: function (data) {
37
+            // console.log(data);
38
+            var provinces = data.data;
39
+            var province = $('select[name=province]');
40
+            province.empty();
41
+            province.append('<option value="' + "" + '">' + "请选择省" + '</option>');
42
+            for (var i = 0; i < provinces.length; i++) {
43
+                if (provinces[i].id == provinceValue) {
44
+                    province.append('<option selected value="' + provinces[i].id + '">' + provinces[i].city_name + '</option>');
45
+                } else {
46
+                    province.append('<option value="' + provinces[i].id + '">' + provinces[i].city_name + '</option>');
47
+                }
48
+            }
49
+            form.render('select');
50
+            cityChange(form, provinceValue, cityValue, countyValue);
51
+        },
52
+        fail: function () {
53
+
54
+        }
55
+    });
56
+}
57
+
58
+/**
59
+ * 初始化市
60
+ */
61
+function cityChange(form, provinceValue, cityValue, countyValue) {
62
+    //改变市
63
+    var province = $('select[name=city]');
64
+    province.empty();
65
+    province.append('<option value="' + "" + '">' + "请选择市" + '</option>');
66
+    if (provinceValue) {
67
+        $.ajax({
68
+            url: '/categorycity/citypid',
69
+            type: 'post',
70
+            async: false,//使用同步的方式,true为异步方式
71
+            data: {'pid': provinceValue},//这里使用json对象
72
+            success: function (data) {
73
+                // console.log(data);
74
+                var provinces = data.data;
75
+
76
+
77
+                for (var i = 0; i < provinces.length; i++) {
78
+                    if (provinces[i].id == cityValue) {
79
+                        province.append('<option selected value="' + provinces[i].id + '">' + provinces[i].city_name + '</option>');
80
+                    } else {
81
+                        province.append('<option value="' + provinces[i].id + '">' + provinces[i].city_name + '</option>');
82
+                    }
83
+                }
84
+                form.render('select');
85
+                countyChange(form, cityValue, countyValue);
86
+            },
87
+            fail: function () {
88
+
89
+            }
90
+        });
91
+    }
92
+
93
+}
94
+
95
+/**
96
+ * 初始化县/区
97
+ */
98
+function countyChange(form, cityValue, countyValue) {
99
+    //改变县/区
100
+    var province = $('select[name=area]');
101
+    province.empty();
102
+    province.append('<option value="' + "" + '">' + "请选择县/区" + '</option>');
103
+    if (cityValue) {
104
+        $.ajax({
105
+            url: '/categorycity/citypid',
106
+            type: 'post',
107
+            async: false,//使用同步的方式,true为异步方式
108
+            data: {'pid': cityValue},//这里使用json对象
109
+            success: function (data) {
110
+                // console.log(data);
111
+                var provinces = data.data;
112
+                for (var i = 0; i < provinces.length; i++) {
113
+                    if (provinces[i].id == countyValue) {
114
+                        province.append('<option selected value="' + provinces[i].id + '">' + provinces[i].city_name + '</option>');
115
+                    } else {
116
+                        province.append('<option value="' + provinces[i].id + '">' + provinces[i].city_name + '</option>');
117
+                    }
118
+                }
119
+                form.render('select');
120
+            },
121
+            fail: function () {
122
+
123
+            }
124
+        });
125
+    }
126
+
127
+}
128
+
129
+layui.use(['form'], function () {
130
+    var $ = layui.$
131
+        , layer = layui.layer
132
+        , form = layui.form;
133
+
134
+    //查询赋值
135
+    query(form);
136
+
137
+    /*监听省select*/
138
+    form.on('select(provinceone)', function (data) {
139
+        cityChange(form, data.value, "", "")
140
+    });
141
+
142
+    /*监听市select*/
143
+    form.on('select(cityone)', function (data) {
144
+        countyChange(form, data.value, "")
145
+    });
146
+});

File diff suppressed because it is too large
+ 289 - 0
backend/web/js/china/housealbum.js


+ 230 - 0
backend/web/js/china/housenews.js

@@ -0,0 +1,230 @@
1
+layui.use(['form','layer','laydate','table','laytpl','layedit'],function(){
2
+    var form = layui.form,
3
+        layer = parent.layer === undefined ? layui.layer : top.layer,
4
+        $ = layui.jquery,
5
+        table = layui.table;
6
+
7
+    var tableIds = 'newsList';
8
+    var tableIns = table.render({
9
+        elem: '#'+tableIds,
10
+        url : '/house/newslistform',
11
+        where:{hid:$('#houseId').val()},
12
+        method:'post',
13
+        page : true,
14
+        limit : 20,
15
+        id:'tablerReload',
16
+        cols : [[
17
+            {type:'numbers'},
18
+            {type: "checkbox", width:50},
19
+            {field: 'id', title: 'ID', width:80, align:"center",sort: true},
20
+            {field: 'subject', title: '标题',align:'left'},
21
+            // {field: 'city_name', title: '区域',width:80, align:'center'},
22
+            {field: 'news_name', title: '栏目',width:150, align:'center'},
23
+            // {field: 'is_view', title: '审核',width:80, event:'housesNews',  align:'center',templet:'#sexTpl'},
24
+            // {field: 'comment', title: '评论',width:80, align:'center',templet:"#comment",templet:function(d){
25
+            //         return '<a href="#">['+d.comment+']</a>'
26
+            //     }},
27
+            {field: 'clicks', title: '点击数',width:100, align:'center',sort: true},
28
+            // {field: 'create_at', title: '添加时间',width:180, event:'sortData', align:'center',sort: true},
29
+            {title: '操作', width:200, templet:'#housesListBar',fixed:"right",align:"center"}
30
+
31
+        ]]
32
+    });
33
+
34
+    
35
+    tableIns.reload('tablerReload');        //重新加载
36
+
37
+
38
+    $('.demoTable .layui-btn').on('click', function(){
39
+        var type = $(this).data('type');
40
+        active[type] ? active[type].call(this) : '';
41
+    });
42
+
43
+    var $ = layui.$, active = {
44
+        loadnews: function(){ //获取选中数据
45
+            var index = parent.layui.layer.open({
46
+                title : "加载资讯",
47
+                type : 2,
48
+                area:['','100%'],
49
+                maxmin: true,
50
+                content : "/house/loadnews",
51
+            })
52
+
53
+            parent.layui.layer.full(index);
54
+            // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
55
+            $(window).on("resize",function(){
56
+                parent.layui.layer.full(index);
57
+            })
58
+        },//筛选
59
+        reload:function () {
60
+            var form = pfgs_serialize($('form'));
61
+            var name = '';
62
+            var id = '';
63
+            // console.log($('form').serializeArray());
64
+            if(form.input_house == 'name'){
65
+                name = form.input_house_text;
66
+            } else if(form.input_house == 'id'){
67
+                id = form.input_house_text;
68
+            }
69
+            table.reload('tablerReload',{
70
+                where:{
71
+                    sort:form.input_sort,
72
+                    id:id,
73
+                    name:name,
74
+                    category:form.category
75
+                }
76
+            })
77
+        },  //加载资讯的搜索
78
+        load_news_reload:function () {
79
+            var form = pfgs_serialize($('form'));
80
+            var name = '';
81
+            var id = '';
82
+            // console.log($('form').serializeArray());
83
+            if(form.input_house == 'name'){
84
+                name = form.input_house_text;
85
+            } else if(form.input_house == 'id'){
86
+                id = form.input_house_text;
87
+            }
88
+            table.reload('loadnewsId',{
89
+                where:{
90
+                    id:id,
91
+                    name:name,
92
+                    news:form.category
93
+                }
94
+            })
95
+        }
96
+
97
+    };
98
+
99
+
100
+
101
+
102
+    //列表操作
103
+    table.on('tool('+tableIds+')', function(obj){
104
+        var data = obj.data;
105
+        if(obj.event === 'del'){		//删除楼盘文章
106
+            layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function () {
107
+                $.post('/house/housenewsdelgai',{nid:data.id},function (data) {
108
+                    if(data.code == 200){
109
+                        layer.msg(data.msg);
110
+                        table.reload('tablerReload');
111
+                    }else if(data.code == 300){
112
+                        layer.msg(data.msg);
113
+                    }
114
+
115
+                })
116
+
117
+            })
118
+
119
+        }else if(obj.event === 'Relieve'){
120
+            var _this = $(this);
121
+
122
+            layer.confirm('您确定要解审吗?',{btn:['确认','取消']},function () {
123
+                $.post('/house/housenewsdel',{dataid:data.hnid,type:2},function (data) {
124
+                    if(data.code == 200){
125
+                       // _this.text('aa');
126
+                        layer.msg('操作成功');
127
+                        table.reload('tablerReload');
128
+                    }else if(data.code == 300){
129
+                        layer.msg('操作失败');
130
+                    }
131
+
132
+                })
133
+
134
+            })
135
+
136
+        }
137
+    });
138
+
139
+
140
+    //加载资讯
141
+    $('.loadnews').click(function () {
142
+        var index = parent.layui.layer.open({
143
+            title :'<span style="color:red" >'+$('.house_name').html()+'</span>加载资讯',
144
+            type : 2,
145
+            area:['','100%'],
146
+            maxmin: true,
147
+            content : "/house/loadnews?hid="+$('#houseId').val(),
148
+            end:function () {
149
+                layui.table.reload('tablerReload');
150
+            }
151
+        })
152
+
153
+        parent.layui.layer.full(index);
154
+        // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
155
+        $(window).on("resize",function(){
156
+            parent.layui.layer.full(index);
157
+        })
158
+    })
159
+
160
+    //资讯列表
161
+    table.render({
162
+        elem: '#loadnewsList',
163
+        url : '/house/loadnewslist',
164
+        method:'post',
165
+        where:{hid:$('#houseId').val()},    //接口的其它参数。如:where: {token: 'sasasas', id: 123}
166
+        // height:'380px',         //容器高度
167
+        id:'loadnewsId',
168
+        page : true,
169
+        limit : 20,         //注意:请务必确保 limit 参数(默认:10)是与你服务端限定的数据条数一致
170
+        cols : [[
171
+            {type: "checkbox", fixed:"left", width:50},
172
+            {field: 'id', title: 'ID', width:80, align:"center",sort: true},
173
+            {field: 'subject', title: '标题',align:'left'},
174
+            // {field: 'city_name', title: '区域',width:80, align:'center'},
175
+            // {field: 'news_name', title: '栏目',width:150, align:'center'},
176
+            {field: 'state', title: '审核',width:80, event:'housesNews',  align:'center'},
177
+            // {field: 'comment', title: '评论',width:80, align:'center',templet:"#comment",templet:function(d){
178
+            //         return '<a href="#">['+d.comment+']</a>'
179
+            //     }},
180
+            {field: 'clicks', title: '点击数',width:100, align:'center',sort: true},
181
+            {field: 'create_at', title: '添加时间',width:150, event:'sortData', align:'center',sort: true},
182
+            // {title: '操作', width:200, templet:'#housesListBar',fixed:"right",align:"center"}
183
+
184
+        ]]
185
+    });
186
+
187
+    form.on('submit(add_load_news)',function (data) {
188
+        var checkStatus = table.checkStatus('loadnewsId');
189
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
190
+        // console.log(checkStatus.length);
191
+        // console.log(typeof checkStatus.data[0]);
192
+        // return false;
193
+        if(typeof  checkStatus.data[0] == 'object'){
194
+             var Hid = $('#houseId').val();
195
+            var formdat = new FormData();
196
+            $.each(checkStatus.data,function (key,val) {
197
+                formdat.append('nid[]',val.id);
198
+            })
199
+            formdat.append('hid',Hid);
200
+            $.ajax({
201
+                cache : true,
202
+                type : "post",
203
+                url : "/house/relationnews",
204
+                data : formdat,  // 你的formid
205
+                // async : false,          //async 默认为true异步,修改为false为同步
206
+                contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
207
+                processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
208
+                error : function(request) {
209
+                    layer.close(index);         //关闭数据提交信息
210
+                    layer.alert("网络超时");
211
+                },
212
+                success : function(data) {
213
+                    if (data.code == 200) {
214
+                        layer.msg(data.msg);
215
+
216
+                        // table.reload('loadnewsId');
217
+                        TableClose();
218
+                    } else {
219
+                        layer.msg(data.msg);
220
+                        TableClose();
221
+                    }
222
+                }
223
+            });
224
+            return false;
225
+        }
226
+            layer.msg('请选择资讯');
227
+            return false;
228
+    })
229
+
230
+})

+ 253 - 0
backend/web/js/china/housepeitao.js

@@ -0,0 +1,253 @@
1
+// var delFiles = []; //用于删除图片
2
+// var filesContainer= {};  //存储最终要上传的图片
3
+// var files ;     //存储选择图片的数量
4
+var trNum = [];
5
+var trIndex;
6
+var delNum = [];
7
+var dataId = new Array();
8
+layui.use(['form', 'layer', 'upload', 'table'], function () {
9
+    var form = layui.form,
10
+        // layer = parent.layer === undefined ? layui.layer : top.layer,
11
+        layer = layui.layer,
12
+        table = layui.table,
13
+        $ = layui.jquery;
14
+
15
+    var inputId = $('input[name="hid"]').val();
16
+    var inputName = $('input[name="name"]').val();
17
+    var longitude_latitude = $('input[name="longitude_latitude"]').val();
18
+    //楼盘列表
19
+    var indexTtable = table.render({
20
+        elem: '#housepeitaolist',
21
+        url: '/house/peitaoform',
22
+        where: {hid: inputId},
23
+        method: 'post',
24
+        id: 'tablerReload',
25
+        cols: [[
26
+            // {type: "checkbox", fixed:"left", width:50},
27
+            {type: 'numbers'},
28
+            {field: 'name', title: '配套类目', align: "center", sort: true},
29
+            {field: 'num', title: '数量', align: "center", sort: true, width: 100},
30
+            {title: '操作', width: 200, templet: '#housesalbumListBar', fixed: "right", align: "center"}
31
+
32
+        ]]
33
+    });
34
+
35
+    indexTtable.reload('tablerReload');        //重新加载
36
+
37
+
38
+    // var  onerange = getRandom(99);
39
+
40
+
41
+    //配套设施修改
42
+    var inputFid = $('input[name="fid"]').val();
43
+    var editTable = table.render({
44
+        elem: '#facilitysss',
45
+        url: '/house/peitaoedit',
46
+        method: 'post',
47
+        cellMinWidth: 98,
48
+        where: {fid: inputFid, hid: inputId},
49
+        id: "facility",
50
+        cols: [[
51
+            {
52
+                type: "", fixed: "left", width: 50, event: 'del', templet: function (d) {
53
+                    return '<i class="layui-icon" style="font-size: 30px; color: #1E9FFF;">&#xe640;</i>'
54
+                }
55
+            },
56
+            {
57
+                field: "id", title: "ID", width: 100, display: "none", align: "center", templet: function (d) {
58
+                    return '<input type="text" style="display: none;" name="edit_id" value="' + d.id + '" autocomplete="off" class="layui-input" >'
59
+                }
60
+            },
61
+            {
62
+                field: "name", title: "配套名称", width: 250, align: "center", templet: function (d) {
63
+                    return '<input type="text" name="matingName[' + d.id + ']"  value="' + d.name + '" autocomplete="off" class="layui-input" >'
64
+                }
65
+            },
66
+            {
67
+                field: "distance", title: "距离", width: 150, align: "center", templet: function (d) {
68
+                    return '<input type="text" name="distance[' + d.id + ']" value="' + d.distance + '" autocomplete="off" class="layui-input" >'
69
+                }
70
+            },
71
+            {
72
+                field: "latitude_longitude",
73
+                title: "经纬度",
74
+                width: 200,
75
+                align: "center",
76
+                sort: true,
77
+                templet: function (d) {
78
+                    return '<input type="text" id="jwd' + d.id + '"  name="longitude[' + d.id + ']" value="' + d.latitude_longitude + '" autocomplete="off" class="layui-input" >';
79
+                }
80
+            }
81
+        ]], done: function (res, curr, count) {
82
+            $("[data-field='id']").css('display', 'none');
83
+        }
84
+    })
85
+
86
+
87
+    //修改的工具条
88
+    table.on('tool(facilitysss)', function (obj) {
89
+        var data = obj.data;
90
+        var _this = $(this);
91
+        if (obj.event === 'del') {
92
+            layer.confirm('确定删除数据?', function (index) {
93
+                if (data.id > 0) {
94
+                    dataId.push(data.id);
95
+                }
96
+                if (typeof data.id == 'undefined') {
97
+                    _this.parents('tr').remove();
98
+                }
99
+                obj.del();
100
+                layer.close(index);
101
+            });
102
+        }
103
+    });
104
+
105
+    //监听工具条
106
+    table.on('tool(housepeitaolist)', function (obj) {
107
+        var data = obj.data;
108
+        if (obj.event === 'edit') {
109
+            var index = parent.layui.layer.open({
110
+                title: '<span style="color:red" >[' + inputName + ']</span> 楼盘周边配套修改',
111
+                type: 2,
112
+                maxmin: true,
113
+                area: ['', '100%'],
114
+                content: "/house/peitaoedit?id=" + inputId + '&fid=' + data.fid + '&name=' + data.name + '&ll=' + longitude_latitude,
115
+                end: function () {
116
+                    layui.table.reload('tablerReload');
117
+                }
118
+            })
119
+            parent.layui.layer.full(index);
120
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
121
+            $(window).on("resize", function () {
122
+                parent.layui.layer.full(index);
123
+            })
124
+        } else if (obj.event === 'del') {
125
+            var index = layui.layer.confirm('确定要删除吗?', {btn: ['确定', '取消']}, function () {
126
+                $.post('/house/peitaodel', {hid: inputId, type_id: data.fid}, function (data) {
127
+                    if (data.code == 200) {
128
+                        layer.msg(data.msg);
129
+                        table.reload('tablerReload');
130
+                    } else if (data.code == 300) {
131
+                        layer.msg(data.msg);
132
+                    }
133
+                })
134
+            })
135
+        }
136
+    });
137
+
138
+    $('.layui_map .layui_close').on('click', function () {
139
+        location.reload(); // 父页面刷新
140
+    })
141
+
142
+
143
+    /*
144
+    *   弹出添加配套页面
145
+    * */
146
+    function addAlbum(edit) {
147
+        var index = parent.layui.layer.open({
148
+            title: '<span style="color:red" >[' + inputName + ']</span> 楼盘添加周边配套',
149
+            type: 2,
150
+            maxmin: true,
151
+            area: ['', '100%'],
152
+            content: "/house/peitaoadd?id=" + inputId + '&name=' + inputName + '&ll=' + longitude_latitude,
153
+            end: function () {
154
+                layui.table.reload('tablerReload');
155
+            }
156
+        })
157
+        parent.layui.layer.full(index);
158
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
159
+        $(window).on("resize", function () {
160
+            parent.layui.layer.full(index);
161
+        })
162
+    }
163
+
164
+    //添加配套
165
+    $("#add-album").click(function () {
166
+        addAlbum()
167
+    });
168
+
169
+    // 添加页面提交
170
+    form.on('submit(add_load_mating)', function (data) {
171
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
172
+        var form = pfgs_serialize($('#peitao_form'));
173
+        var trArry = $('.layui-input-block table.layui-table tbody tr');
174
+        var dataObj = [{}];
175
+        var dataArry = new Array();
176
+        $.each(trArry, function (key, val) {
177
+            var _title = $(this).find('input[name="matingName"]').val();
178
+            var _rout = $(this).find('input[name="distance"]').val();
179
+            var _point = $(this).find('input[name="longitude"]').val();
180
+            dataObj[key] = {title: _title, rout: _rout, point: _point}        //把数据以数组对象的方式保存
181
+            dataArry.push(dataObj[key])
182
+        })
183
+        $.post("/house/peitaoaddform", {data: dataArry, hid: inputId, type_id: form.city}, function (data) {
184
+            if (data.code == 200) {
185
+                layer.msg(data.msg);
186
+                indexTtable.reload('tablerReload');
187
+                TableClose();
188
+            } else if (data.code == 300) {
189
+                layer.msg(data.msg);
190
+                if (data.data.length > 0) {
191
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
192
+                }
193
+            }
194
+        })
195
+
196
+        return false;
197
+    })
198
+
199
+    // 修改提交
200
+    form.on('submit(edit_load_mating)', function (data) {
201
+
202
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
203
+        var form = pfgs_serialize($('#peitao_form'));
204
+        var trArry = $('.layui-table-main table.layui-table tbody tr');
205
+        var dataObj = [{}];
206
+        var dataArry = new Array();
207
+        $.each(trArry, function (key, val) {
208
+            var _title = $(this).find('input[name="matingName"]').val();
209
+            var _rout = $(this).find('input[name="distance"]').val();
210
+            var _point = $(this).find('input[name="longitude"]').val();
211
+            dataObj[key] = {title: _title, rout: _rout, point: _point}        //把数据以数组对象的方式保存
212
+            dataArry.push(dataObj[key])
213
+        })
214
+        $.post("/house/peitaoeditform", {
215
+            data: dataArry,
216
+            dataId: dataId,
217
+            hid: inputId,
218
+            type_id: form.fid
219
+        }, function (data) {
220
+            layer.msg(data.msg);
221
+            // if (data.code == 200) {
222
+            //     layer.msg(data.msg);
223
+            //     indexTtable.reload('tablerReload');
224
+            //
225
+            // } else if(data.code == 300){
226
+            //     layer.msg(data.msg);
227
+            //     if(data.data.length > 0){
228
+            //         layer.msg(ReturnInfo(data.data),{icon:5});
229
+            //     }
230
+            // }
231
+        })
232
+
233
+        return false;
234
+    })
235
+
236
+});
237
+
238
+//生产随机数
239
+// function getRandom(n) {
240
+//     return Math.floor(Math.random() * n + 1)
241
+// }
242
+//
243
+// function uniqueidArr(arr) {
244
+//     var newArr = {};
245
+//     console.log(newArr);
246
+//     if(arr.length >0){
247
+//         $.each(arr,function (k,v) {
248
+//             newArr[v] = v;
249
+//         })
250
+//         return newArr;
251
+//     }
252
+//
253
+// }

+ 271 - 0
backend/web/js/china/houseprice.js

@@ -0,0 +1,271 @@
1
+layui.use(['form', 'layer', 'laydate', 'table', 'laytpl', 'layedit', 'upload'], function () {
2
+    var form = layui.form,
3
+        layer = parent.layer === undefined ? layui.layer : top.layer,
4
+        $ = layui.jquery,
5
+        laydate = layui.laydate,
6
+        laytpl = layui.laytpl,
7
+        table = layui.table,
8
+        layedit = layui.layedit
9
+        , upload = layui.upload;
10
+
11
+    var houid = $('input[name=hid]').val();
12
+    var houname = $('input[name=name]').val();
13
+    //调用编辑器
14
+    var tableIds = 'housespriceList';
15
+    //楼盘列表
16
+    var tableIns = table.render({
17
+        elem: '#' + tableIds,
18
+        url: '/house/priceviewform',
19
+        cellMinWidth: 95,
20
+        where: {hid: houid},
21
+        method: 'post',
22
+        page: true,
23
+        height: 600,
24
+        limit: 20,
25
+        id: 'pricetablerReload',
26
+        cols: [[
27
+            {type: 'numbers', fixed: "left"},
28
+            // {type: "checkbox", fixed: "left", width: 50},
29
+            {field: 'create_time', title: '记录时间', align: "center", sort: true},
30
+            {field: 'min_price', title: '最低价', width: 120, align: "center", sort: true},
31
+            {field: 'price', title: '均价', width: 120, align: "center", sort: true},
32
+            {field: 'price_unit', title: '单位', width: 120, align: "center", sort: true},
33
+            {field: 'explain', title: '价格说明', width: 500, align: "center", sort: true},
34
+            // {title: '操作', width: 150, templet: '#housesListBar', fixed: "right", align: "center"}
35
+        ]]
36
+    });
37
+
38
+    tableIns.reload('pricetablerReload');        //重新加载
39
+
40
+    var $ = layui.$, active = {
41
+        addData: function () { //获取选中数据
42
+            var index = parent.layui.layer.open({
43
+                title: "添加新价格",
44
+                type: 2,
45
+                area: ['', '100%'],
46
+                maxmin: true,
47
+                content: "/house/priceadd?hid=" + houid + '&name=' + houname,
48
+                end: function () {
49
+                    layui.table.reload('pricetablerReload');
50
+                }
51
+            })
52
+
53
+            parent.layui.layer.full(index);
54
+            // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
55
+            $(window).on("resize", function () {
56
+                parent.layui.layer.full(index);
57
+            })
58
+        },
59
+        reload: function () {
60
+            var form = pfgs_serialize($('form'));
61
+            var name = '';
62
+            var id = '';
63
+            // console.log($('form').serializeArray());
64
+            if (form.input_house == 'name') {
65
+                name = form.input_house_text;
66
+            } else if (form.input_house == 'id') {
67
+                id = form.input_house_text;
68
+            }
69
+            table.reload('tablerReload', {
70
+                where: {
71
+                    sort: form.input_sort,
72
+                    id: id,
73
+                    name: name,
74
+                    city: form.input_city
75
+                }
76
+            })
77
+        }
78
+
79
+    };
80
+
81
+    $('.demoTable .layui-btn').on('click', function () {
82
+        var type = $(this).data('type');
83
+        active[type] ? active[type].call(this) : '';
84
+    });
85
+
86
+    //日期
87
+    laydate.render({
88
+        elem: '#date1'
89
+    });
90
+
91
+
92
+    //列表操作
93
+    table.on('tool(' + tableIds + ')', function (obj) {
94
+        var data = obj.data;
95
+        if (obj.event === 'edit') {
96
+            var index = parent.layui.layer.open({
97
+                title: "修改价格信息",
98
+                type: 2,
99
+                area: ['', '100%'],
100
+                maxmin: true,
101
+                content: "/house/priceedit?id=" + data.id + '&name=' + houname,
102
+                end: function () {
103
+                    layui.table.reload('pricetablerReload');
104
+                }
105
+            })
106
+
107
+            parent.layui.layer.full(index);
108
+            // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
109
+            $(window).on("resize", function () {
110
+                parent.layui.layer.full(index);
111
+            })
112
+        } else if (obj.event === 'del') {
113
+
114
+            layer.confirm('您确认要删除吗?', {btn: ['确认', '取消']}, function () {
115
+                $.post('/house/housedel', {id: data.id}, function (data) {
116
+                    if (data.code == 200) {
117
+                        layer.msg(data.msg);
118
+                        // parent.layui.
119
+                        table.reload('tablerReload');
120
+                        // TableClose();
121
+                    } else {
122
+                        layer.msg(data.msg);
123
+                    }
124
+                })
125
+            })
126
+        }
127
+    });
128
+
129
+
130
+    form.on('submit(pricetijiao)', function (data) {
131
+
132
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
133
+
134
+        var formData = new FormData($('#price_form')[0]);
135
+        console.log(formData)
136
+
137
+        $.ajax({
138
+            cache: true,
139
+            type: "post",
140
+            url: "/house/priceaddform",
141
+            data: formData,  // 你的formid
142
+            // async : false,          //async 默认为true异步,修改为false为同步,
143
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
144
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
145
+            error: function (request) {
146
+                layer.close(index);         //关闭数据提交信息
147
+                layer.alert("网络超时");
148
+            },
149
+            success: function (data) {
150
+                if (data.code == 200) {
151
+                    layer.msg(data.msg);
152
+                    TableClose();
153
+
154
+                } else if (data.code == 300) {
155
+                    layer.msg(data.msg);
156
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
157
+                }
158
+            }
159
+        });
160
+        return false;
161
+    })
162
+
163
+
164
+    form.on('submit(priceSave)', function (data) {
165
+        //aaaaa
166
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
167
+
168
+        var formData = new FormData($('#price_form')[0]);
169
+        $.ajax({
170
+            cache: true,
171
+            type: "post",
172
+            url: "/house/priceeditform",
173
+            data: formData,  // 你的formid
174
+            // async : false,          //async 默认为true异步,修改为false为同步,
175
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
176
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
177
+            error: function (request) {
178
+                layer.close(index);         //关闭数据提交信息
179
+                layer.alert("网络超时");
180
+            },
181
+            success: function (data) {
182
+                layer.close(index);         //关闭数据提交信息
183
+                if (data.code == 200) {
184
+                    layer.msg(data.msg);
185
+                    // parent.layui.table.reload('pricetablerReload');
186
+                    TableClose();
187
+                } else if (data.code == 300) {
188
+                    layer.msg(data.msg);
189
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
190
+
191
+                }
192
+            }
193
+        });
194
+        return false;
195
+    })
196
+
197
+
198
+    form.on('submit(del_price)', function (data) {
199
+        //aaaaa
200
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
201
+
202
+        var checkStatus = table.checkStatus('pricetablerReload');
203
+        if (typeof checkStatus.data[0] == 'object') {
204
+            // var Hid = $('#houseId').val();
205
+            var formdat = new FormData();
206
+            $.each(checkStatus.data, function (key, val) {
207
+                formdat.append('id[]', val.id);
208
+            })
209
+            $.ajax({
210
+                cache: true,
211
+                type: "post",
212
+                url: "/house/pricedel",
213
+                data: formdat,  // 你的formid
214
+                // async : false,          //async 默认为true异步,修改为false为同步,
215
+                contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
216
+                processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
217
+                error: function (request) {
218
+                    layer.close(index);         //关闭数据提交信息
219
+                    layer.alert("网络超时");
220
+                },
221
+                success: function (data) {
222
+                    if (data.code == 200) {
223
+                        layer.msg(data.msg);
224
+                        layui.table.reload('pricetablerReload');
225
+                    } else if (data.code == 300) {
226
+                        layer.msg(data.msg);
227
+                        layer.msg(ReturnInfo(data.data), {icon: 5});
228
+                    }
229
+                }
230
+            });
231
+            return false;
232
+        }
233
+        layer.msg('请选择需要删除的行');
234
+        return false;
235
+        // $.ajax({
236
+        //     cache : true,
237
+        //     type : "post",
238
+        //     url : "/house/priceeditform",
239
+        //     data : formData,  // 你的formid
240
+        //     // async : false,          //async 默认为true异步,修改为false为同步,
241
+        //     contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
242
+        //     processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
243
+        //     error : function(request) {
244
+        //         layer.close(index);         //关闭数据提交信息
245
+        //         layer.alert("网络超时");
246
+        //     },
247
+        //     success : function(data) {
248
+        //         if (data.code == 200) {
249
+        //             layer.msg(data.msg);
250
+        //             // parent.layui.table.reload('pricetablerReload');
251
+        //             TableClose();
252
+        //         } else if(data.code == 300){
253
+        //             layer.msg(data.msg);
254
+        //             layer.msg(ReturnInfo(data.data),{icon:5});
255
+        //
256
+        //         }
257
+        //     }
258
+        // });
259
+        // return false;
260
+    })
261
+
262
+
263
+})
264
+
265
+// $(function () {
266
+//     // 动态添加批量删除按钮
267
+//     var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
268
+//         + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_price">删除</a>'
269
+//         + '</div>'
270
+//     $('.layui-form').append(_btn)
271
+// })

+ 166 - 0
backend/web/js/china/housetype.js

@@ -0,0 +1,166 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , layer = layui.layer //弹层
5
+        , table = layui.table //表格
6
+        , element = layui.element //元素操作
7
+        , form = layui.form;
8
+    //第一个实例
9
+    table.render({
10
+        elem: '#housetypelist'
11
+        , url: '/dictionary/housetypeform' //数据接口
12
+        , where: {token: csrfToken}
13
+        , method: 'post'
14
+        , page: true //开启分页
15
+        , text: '数据加载中'
16
+        , id: 'tablerReload'
17
+        , cols: [[ //表头
18
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
19
+            {type: 'numbers'},
20
+            {field: 'huxing_name', title: '户型', align: 'center'}
21
+            , {
22
+                field: 'sort',
23
+                title: '排序',
24
+                width: 200,
25
+                event: 'sortData',
26
+                edit: 'text',
27
+                align: 'center',
28
+                sort: true,
29
+                templet: "#sortBox"
30
+            }
31
+            // ,{field: 'state', title: '地址', width:200,align:'center'}
32
+            // ,{field: 'update_at', title: '更新时间', width:200,align:'center'}
33
+            // ,{field: 'create_at', title: '添加时间', width:200,align:'center'}
34
+            , {
35
+                field: 'state', title: '审核', align: 'center', width: 200, templet: function (d) {
36
+                    if (d.state == 2) {
37
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
38
+                    } else {
39
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
40
+                    }
41
+                }
42
+            }
43
+            , {fixed: 'right', title: '操作', width: 180, align: 'center', toolbar: '#operate'}
44
+
45
+        ]]
46
+    });
47
+
48
+    table.reload('tablerReload');        //重新加载
49
+
50
+    //监听指定开关
51
+    form.on('switch(switchTest)', function (data) {
52
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
53
+            $.post('/dictionary/housetypestate', {id: data.value, type: 'state'}, function (data) {
54
+                layer.msg(data.msg);
55
+                table.reload('tablerReload');
56
+
57
+            })
58
+        }, function (aa) {
59
+            table.reload('tablerReload');        //重新加载
60
+        })
61
+    });
62
+
63
+    //列表操作
64
+    table.on('tool(housetypelist)', function (obj) {
65
+        var layEvent = obj.event,
66
+            data = obj.data;
67
+        if (layEvent === 'edit') {
68
+            layer.open({
69
+                type: 2,
70
+                title: '修改户型',
71
+                area: ['600px', '500px'],
72
+                content: '/dictionary/housetypeedit?id=' + data.id,
73
+                end: function () {
74
+                    table.reload('tablerReload');        //重新加载
75
+                }
76
+            });
77
+        } else if (layEvent === 'del') {
78
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
79
+                $.post('/dictionary/hosttypedel', {'id': data.id}, function (data) {
80
+                    if (data.code == 200) {
81
+                        layer.msg(data.msg);
82
+                        table.reload('tablerReload');        //重新加载
83
+                    } else if (data.code == 300) {
84
+                        layer.msg(data.msg);
85
+                    }
86
+                })
87
+            })
88
+        } else if (layEvent === 'sortData') {       //修改排序
89
+            table.on('edit(housetypelist)', function (obj) {
90
+                var data = obj.data;
91
+                $.post('/dictionary/housetypesort', {
92
+                    id: data.id,
93
+                    type: 'sort',
94
+                    sort: data.sort
95
+                }, function (data) {
96
+                    if (data.code == 200) {
97
+                        layer.msg(data.msg);
98
+                    } else if (data.code == 300) {
99
+                        layer.msg(data.msg);
100
+                    }
101
+                })
102
+            })
103
+        }
104
+
105
+
106
+    });
107
+
108
+    var $ = layui.$, active = {
109
+        addData: function () { //获取选中数据
110
+
111
+            layer.open({
112
+                type: 2,
113
+                title: '添加户型',
114
+                area: ['600px', '500px'],
115
+                content: '/dictionary/housetypeadd',
116
+                end: function () {
117
+                    table.reload('tablerReload');        //重新加载
118
+                }
119
+            });
120
+
121
+            // var checkStatus = table.checkStatus('idTest')
122
+            //     ,data = checkStatus.data;
123
+            // layer.alert(JSON.stringify(data));
124
+        }
125
+    };
126
+
127
+    $('.demoTable .layui-btn').on('click', function () {
128
+        var type = $(this).data('type');
129
+        active[type] ? active[type].call(this) : '';
130
+    });
131
+
132
+    //修改
133
+    form.on('submit(edithousetype)', function (data) {
134
+        var index = top.layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
135
+
136
+        $.post('/dictionary/housetypeeditform', {'data': data.field, 'token': csrfToken}, function (data) {
137
+            top.layer.close(index);         //关闭数据提交信息
138
+            if (data.code == 200) {
139
+                layer.msg(data.msg);
140
+                // parent.layui.table.reload('housetypelist');
141
+                // TableClose();
142
+            } else if (data.code == 300) {
143
+                layer.msg(data.msg);
144
+                layer.msg(ReturnInfo(data.data));
145
+            }
146
+        })
147
+        return false;
148
+    });
149
+
150
+    //添加
151
+    form.on('submit(addhousetype)', function (data) {
152
+        var index = top.layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
153
+
154
+        $.post('/dictionary/housetypeaddform', {'data': data.field}, function (data) {
155
+            top.layer.close(index);         //关闭数据提交信息
156
+            if (data.code == 200) {
157
+                layer.msg(data.msg);
158
+            } else if (data.code == 300) {
159
+                layer.msg(data.msg);
160
+                layer.msg(ReturnInfo(data.data), {icon: 5});
161
+            }
162
+        })
163
+        return false;
164
+    });
165
+
166
+});

+ 296 - 0
backend/web/js/china/housetypebinding.js

@@ -0,0 +1,296 @@
1
+var delFiles = []; //用于删除图片
2
+var filesContainer = {};  //存储最终要上传的图片
3
+var files;     //存储选择图片的数量
4
+layui.use(['form', 'layer', 'upload', 'table'], function () {
5
+    var form = layui.form,
6
+        layer = layui.layer,
7
+        upload = layui.upload,
8
+        table = layui.table,
9
+        $ = layui.jquery;
10
+
11
+    var inputId = $('input[name="hid"]').val();
12
+    var inputName = $('input[name="name"]').val();
13
+    //楼盘列表
14
+    var indexTtable = table.render({
15
+        elem: '#housetypelist',
16
+        url: '/house/housetypeform',
17
+        where: {hid: inputId},
18
+        method: 'post',
19
+        id: 'tablerReload',
20
+        cols: [[
21
+            {type: 'numbers'},
22
+            {field: 'huxing_name', title: '户型', align: "center", sort: true},
23
+            // {field: 'state', title: '审核',width:80, align:'center',templet:'#examineTpl'},
24
+            {field: 'num', title: '数量', align: 'center', width: 100},
25
+            {title: '操作', templet: '#housesalbumListBar', fixed: "right", align: "center", width: 200}
26
+
27
+        ]]
28
+    });
29
+
30
+    indexTtable.reload('tablerReload');        //重新加载
31
+
32
+    table.on('tool(housetypelist)', function (obj) {
33
+        var data = obj.data;
34
+        if (obj.event === 'edit') {
35
+            var index = parent.layui.layer.open({
36
+                title: '<span style="color:red" >[' + inputName + ']</span> 楼盘修改户型',
37
+                type: 2,
38
+                maxmin: true,
39
+                area: ['', '100%'],
40
+                content: "/house/housetypeedit?id=" + inputId + '&name=' + inputName + '&type=' + data.type_id,
41
+                end: function () {
42
+                    layui.table.reload('tablerReload');
43
+                }
44
+            })
45
+            parent.layui.layer.full(index);
46
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
47
+            $(window).on("resize", function () {
48
+                parent.layui.layer.full(index);
49
+            })
50
+        } else if (obj.event === 'examine') { //关闭
51
+            var examineName = '';
52
+            // console.log(data.state);
53
+            switch (data.state) {
54
+                case 'Y':
55
+                    examineName = '驳回审核';
56
+                    break;
57
+
58
+                case 'N':
59
+                    examineName = '审核通过';
60
+                    break;
61
+            }
62
+            layer.confirm('确定要' + examineName + '吗?', {btn: ['确定', '取消']}, function () {
63
+                $.post('/house/typetatesave', {
64
+                    id: data.id,
65
+                    state: data.state,
66
+                    type_id: data.type_id,
67
+                    hid: inputId
68
+                }, function (data) {
69
+                    if (data.code == 200) {
70
+                        layer.msg(data.msg);
71
+                        table.reload('tablerReload');
72
+                    } else if (data.code == 300) {
73
+                        layer.msg(data.msg);
74
+                    }
75
+                })
76
+            })
77
+        } else if (obj.event === 'del') {
78
+            layer.confirm('确定要删除吗?', {btn: ['确定', '取消']}, function () {
79
+                $.post('/house/typedel', {id: data.id, type_id: data.type_id, hid: inputId}, function (data) {
80
+                    if (data.code == 200) {
81
+                        layer.msg(data.msg);
82
+                        table.reload('tablerReload');
83
+                    } else if (data.code == 300) {
84
+                        layer.msg(data.msg);
85
+                    }
86
+                })
87
+            })
88
+        }
89
+    })
90
+
91
+    /*
92
+    * 添加相册
93
+    * */
94
+    function addAlbum(edit) {
95
+        var index = parent.layui.layer.open({
96
+            title: '<span style="color:red" >[' + inputName + ']</span> 楼盘添加户型',
97
+            type: 2,
98
+            maxmin: true,
99
+            area: ['', '100%'],
100
+            content: "/house/housetypeadd?id=" + inputId + '&name=' + inputName,
101
+            end: function () {
102
+                layui.table.reload('tablerReload');
103
+            }
104
+        })
105
+        parent.layui.layer.full(index);
106
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
107
+        $(window).on("resize", function () {
108
+            parent.layui.layer.full(index);
109
+        })
110
+    }
111
+
112
+    //添加相册
113
+    $("#add-album").click(function () {
114
+        addAlbum()
115
+    });
116
+
117
+    //多图片上传
118
+    upload.render({
119
+        elem: '#upload_edit'
120
+        , url: '/upload/'
121
+        , multiple: true
122
+        , auto: false
123
+        , number: 30
124
+        , choose: function (obj) {
125
+            //将每次选择的文件追加到文件队列
126
+            files = obj.pushFile();
127
+            //预读本地文件示例,不支持ie8
128
+            obj.preview(function (index, file, result) {
129
+                filesContainer[index] = file; //将每次选择的文件追加到文件队列
130
+                var _html = '<div class="layui-upload-img layer-photos-demo" id="layer-photos-demo">'
131
+                    + '<div class="info_box">'
132
+                    + '<input type="text" name="aa"  placeholder="如A户型" autocomplete="off" class="layui-input">'
133
+                    + '<input type="text" name="bb"  placeholder="厅卫厨" autocomplete="off" class="layui-input">'
134
+                    + '<input type="text" name="cc"  placeholder="建筑面积" autocomplete="off" class="layui-input">'
135
+                    + '</div>'
136
+                    + '<div class="picture_box">'
137
+                    + '<div class="delete-list" id="delimg" ><i class="layui-icon fa-trash-o" >&#xe640;</i></div>'
138
+                    + '<img delIdentification="' + index + '" layer-pid="' + index + '" layer-src="' + result + '"  src="' + result + '" alt="' + file.name + '" id="hhhh">'
139
+                    + '</div>'
140
+                    + '</div>';
141
+                $('#demo2').append(_html);
142
+                layer.photos({
143
+                    photos: '#demo2'
144
+                    , anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
145
+                });
146
+            });
147
+        }
148
+    });
149
+
150
+
151
+    form.on('submit(tijiao)', function (data) {
152
+
153
+        var formData = new FormData($('#album_form')[0]);
154
+        formData.delete('file'); //删除添加图片组件自带的FILE文件
155
+        var index = layer.msg('数据提交中,请稍候。。。', {icon: 16, time: false, shade: 0.8});      //数据提交提示
156
+        var a = $('#demo2');
157
+        $.each(a.find('input[name=aa]'), function () {
158
+            formData.append('title[]', $(this).val());
159
+            // console.log($(this).val());
160
+        })
161
+
162
+        $.each(a.find('input[name=bb]'), function () {
163
+            formData.append('indoor_info[]', $(this).val());
164
+            // console.log($(this).val());
165
+        })
166
+
167
+        $.each(a.find('input[name=cc]'), function () {
168
+            formData.append('area[]', $(this).val());
169
+        })
170
+
171
+        $.each(filesContainer, function (k, v) {
172
+            if (v != null) {
173
+                formData.append('img[]', v);
174
+            }
175
+        })
176
+
177
+        $.ajax({
178
+            cache: true,
179
+            type: "post",
180
+            url: "/house/housetypeaddform",
181
+            data: formData,  // 你的formid
182
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
183
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
184
+            error: function (request) {
185
+                layer.close(index);         //关闭数据提交信息
186
+                layer.alert("网络超时");
187
+            },
188
+            success: function (data) {
189
+                layer.close(index);         //关闭数据提交信息
190
+                if (data.code == 200) {
191
+
192
+                    layer.msg(data.msg);
193
+                    indexTtable.reload('tablerReload');
194
+                    // table.reload('tablerReload');
195
+                    TableClose();
196
+                    // layui.table.reload('housealbumlistReload');
197
+
198
+                } else if (data.code == 300) {
199
+                    layer.msg(data.msg);
200
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
201
+                }
202
+            }
203
+        });
204
+        return false;
205
+    })
206
+
207
+
208
+    form.on('submit(editAlbum)', function (data) {
209
+        var index = layer.msg('数据提交中,请稍候。。。', {icon: 16, time: false, shade: 0.8});      //数据提交提示
210
+        var formData = new FormData($('#album_form')[0]);
211
+        formData.delete('file'); //删除添加图片组件自带的FILE文件
212
+        var a = $('#demo2');
213
+        $.each(a.find('input[name=aa]'), function () {
214
+            formData.append('title[]', $(this).val());
215
+        })
216
+
217
+        $.each(a.find('input[name=bb]'), function () {
218
+            formData.append('indoor_info[]', $(this).val());
219
+        })
220
+
221
+        $.each(a.find('input[name=cc]'), function () {
222
+            formData.append('area[]', $(this).val());
223
+        })
224
+
225
+        $.each(a.find('img'), function () {
226
+            formData.append('editid[]', $(this).attr('imgname'));
227
+        })
228
+
229
+        //需要添加的图片
230
+        $.each(filesContainer, function (k, v) {
231
+            if (v != null) {
232
+                formData.append('img[]', v);
233
+            }
234
+        })
235
+
236
+        //需要删除的图片
237
+        if (delFiles.length > 0) {
238
+            $.each(delFiles, function (k, v) {
239
+                formData.append('delimg[]', v);
240
+            })
241
+        }
242
+
243
+        $.ajax({
244
+            cache: true,
245
+            type: "post",
246
+            url: "/house/housetypeeditform",
247
+            data: formData,  // 你的formid
248
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
249
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
250
+            error: function (request) {
251
+                //layer.close(index);         //关闭数据提交信息
252
+                layer.alert("网络超时");
253
+            },
254
+            success: function (data) {
255
+                filesContainer = {};
256
+                layer.close(index);         //关闭数据提交信息
257
+                if (data.code == 200) {
258
+                    layer.msg(data.msg);
259
+
260
+                } else if (data.code == 300) {
261
+                    layer.msg(data.msg);
262
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
263
+                }
264
+            }
265
+        });
266
+        return false;
267
+    })
268
+
269
+    layer.photos({
270
+        photos: '#demo2'
271
+        , anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
272
+    });
273
+    //设置图片的高度
274
+    $(window).resize(function () {
275
+        $("#Images li img").height($("#Images li img").width());
276
+    });
277
+
278
+});
279
+
280
+
281
+//删除图片
282
+$('#demo2').on("click", "#delimg", function () {
283
+    var name = $(this).next().attr("imgname");
284
+    var delIdentification = $(this).next().attr("delIdentification");
285
+    if (typeof (delIdentification) != 'undefined') {
286
+        delete filesContainer[delIdentification];
287
+        delete files[delIdentification];
288
+        // imgnumber -= 1;
289
+    }
290
+    if (typeof (name) != 'undefined') {
291
+        delFiles.push(name);
292
+    }
293
+    // $(this).parent().remove();
294
+    $(this).parents('#layer-photos-demo').remove();
295
+})
296
+

+ 510 - 0
backend/web/js/china/knowledge.js

@@ -0,0 +1,510 @@
1
+var delFiles = []; //用于删除图片
2
+var filesContainer= {};  //存储最终要上传的图片
3
+var files ;     //存储选择图片的数量
4
+
5
+var fContainer= {}; //用于传父级传变量,格式 parent.fContainer
6
+var depositImg =[];//用于存放弹窗图片
7
+layui.use(['form','layer','laydate','table','upload'],function(){
8
+    var form = layui.form,
9
+        layer = layui.layer,
10
+        $ = layui.jquery,
11
+        table = layui.table,
12
+        upload = layui.upload;
13
+    var tableIds = 'newsList';
14
+    //楼盘列表
15
+    var tableIns = table.render({
16
+        elem: '#'+tableIds,
17
+        url : '/newsknowledge/homeform',
18
+        cellMinWidth : 95,
19
+        method:'post',
20
+        page : true,
21
+        height : 600,
22
+        limit : 20,
23
+        id:'tablerReload',
24
+        cols : [[
25
+            {type: "checkbox", width:50},
26
+            {type:'numbers'},
27
+            {field: 'id', title: 'ID', width:80, align:"center",sort: true},
28
+            {field: 'subject', title: '标题',align:'center',templet:function(d){
29
+                // return '<a href="http://www.taofangwang.com/news/details/'+d.id+'/" target="_blank">'+d.subject+'</a>'
30
+                return '<span>'+d.subject+'</span>'
31
+            }},
32
+            {field: 'name', title: '栏目',width:120, align:'center'},
33
+            {field: 'clicks', title: '点击数',width:100, edit: 'text',align:'center',clicks: true,templet:"#clicksBox"},
34
+            {field: 'sort', title: '排序',width:100, edit: 'text',align:'center',clicks: true,templet:"#sortBox"},
35
+            {field: 'true_click', title: '真实点击数',width:120, align:'center',sort: true},
36
+
37
+            {field: 'create_at', title: '添加时间',width:120, event:'sortData', align:'center',sort: true},
38
+            {field: 'is_show', title: '审核',width:75, event:'housesNews',  align:'center',templet:function (d) {
39
+                    if(d.is_show == 2){
40
+                        return  '<input type="checkbox"  value="'+d.id+'" name="'+d.is_show+'"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
41
+                    } else {
42
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="'+d.is_show+'"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
43
+                    }
44
+                }},
45
+            {title: '操作', width:100, templet:'#housesListBar',fixed:"right",align:"center"}
46
+        ]]
47
+    });
48
+    
49
+    table.reload('tablerReload');        //重新加载
50
+
51
+    //加载省数据
52
+    function loadProvince() {
53
+        $.ajax({
54
+            url : '/dictionarynews/pidlist',
55
+            type : 'post',
56
+            data : {'pid':0},//这里使用json对象
57
+            success : function(data){
58
+
59
+                var areaData = data.data;
60
+                var proHtml = '';
61
+                $.each(areaData,function (k,v) {
62
+                    proHtml += '<option value="' + v.id +'">' + v.name + '</option>';
63
+                })
64
+
65
+                //初始化省数据
66
+                $('select[name=province]').append(proHtml);
67
+                form.render();
68
+            },
69
+            fail:function(){
70
+
71
+            }
72
+        });
73
+
74
+
75
+    }
76
+
77
+    loadProvince();
78
+
79
+    form.on('select(province)',function (data) {
80
+        $.post('/dictionarynews/pidlist',{'pid':data.value},function (data) {
81
+            $('select[name=label_id]').html('');
82
+            var proHtml = '<option value="">请选择子类栏目</option>';
83
+            if(data.code == 200){
84
+                var areaData = data.data;
85
+                for (var i = 0; i < areaData.length; i++) {
86
+                    proHtml += '<option value="' + areaData[i].id +'">' + areaData[i].name + '</option>';
87
+                }
88
+                //初始化省数据
89
+                $('select[name=label_id]').append(proHtml);
90
+            }
91
+            form.render();
92
+        })
93
+    })
94
+
95
+
96
+    //表格头部操作菜单
97
+    var $ = layui.$, active = {
98
+        addData: function(){ //获取选中数据
99
+            var index = layui.layer.open({
100
+                title : "添加资讯",
101
+                type : 2,
102
+                area:['80%','100%'],
103
+                maxmin: true,
104
+                content : "/newsknowledge/create",
105
+                end:function () {
106
+                    table.reload('tablerReload');
107
+                }
108
+            })
109
+            layui.layer.full(index);
110
+        },
111
+        reload:function () {
112
+            var form = pfgs_serialize($('form'));
113
+            console.log(form);
114
+            var name = '';
115
+            var id   = '';
116
+            if(form.input_house == 'name'){
117
+                name = form.input_house_text;
118
+            } else if(form.input_house == 'id'){
119
+                id = form.input_house_text;
120
+            }
121
+
122
+            var city = '';
123
+            if(form.province != ''){
124
+
125
+                city = form.province;
126
+            }
127
+
128
+            if(form.label_id != '' && typeof form.label_id != 'undefined'){ //父类存在 子类不存在的情况
129
+                city = form.label_id;
130
+            }
131
+
132
+            table.reload('tablerReload',{
133
+                where:{
134
+                    id:id,
135
+                    name:name,
136
+                    city:city
137
+                },
138
+                page:{
139
+                    curr:1
140
+                }
141
+            })
142
+        }
143
+    };
144
+
145
+
146
+    //监听指定开关
147
+    form.on('switch(switchTest)', function(data){
148
+        var state = '';
149
+        if(data.elem.name == 1){
150
+            state = 2;
151
+        }else if(data.elem.name == 2){
152
+            state = 1;
153
+        }
154
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
155
+            $.post('/newsknowledge/editfrom',{id:data.value,is_show:state},function (data) {
156
+                if(data.data != null){
157
+                    layer.msg(ReturnInfo(data.data),{icon:5});
158
+                    return false;
159
+                }
160
+                layer.msg(data.msg);
161
+            })
162
+        },function (aa) {
163
+            table.reload('tablerReload');        //重新加载
164
+        })
165
+    });
166
+
167
+
168
+    $('.demoTable .layui-btn').on('click', function(){
169
+        var type = $(this).data('type');
170
+        active[type] ? active[type].call(this) : '';
171
+    });
172
+
173
+
174
+
175
+    /* 列表操作  edit  修改后执行  2018.7.24*/
176
+    table.on('edit('+tableIds+')', function(obj){
177
+        var data = obj.data;
178
+        var event = obj.field;
179
+        switch (event){
180
+            case 'clicks':
181
+                $.post("/newsknowledge/editfrom",{id:data.id,clicks:obj.value,},function (data) {
182
+                    if(data.data != null){
183
+                        layer.msg(ReturnInfo(data.data),{icon:5});
184
+                        return false;
185
+                    }
186
+                    layer.msg(data.msg)
187
+                })
188
+                break;
189
+            case 'sort':
190
+                $.post("/newsknowledge/editfrom",{id:data.id,sort:obj.value,},function (data) {
191
+                    if(data.data != null){
192
+                        layer.msg(ReturnInfo(data.data),{icon:5});
193
+                        return false;
194
+                    }
195
+                    layer.msg(data.msg)
196
+                })
197
+                break;
198
+        }
199
+
200
+
201
+    })
202
+
203
+
204
+    //表格右边操作栏目
205
+    table.on('tool('+tableIds+')', function(obj){
206
+        var data = obj.data;
207
+            if(obj.event  === 'edit'){  //编辑操作
208
+            var index = layui.layer.open({
209
+                title : "编辑资讯",
210
+                type : 2,
211
+                area:['','100%'],
212
+                maxmin: true,
213
+                content : "/newsknowledge/edit?id="+data.id
214
+            })
215
+
216
+            layui.layer.full(index);
217
+        }
218
+    });
219
+
220
+
221
+    //添加and修改图片
222
+     upload.render({
223
+        elem: '#upload_edit',
224
+        url: '/news/newseditform'
225
+        ,data:{token:csrfToken}
226
+        ,multiple: true
227
+        ,number:3
228
+        ,auto:false
229
+        ,size:1000              //限制上传图片的大小,单位为KB
230
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
231
+        ,bindAction:'#addcity'
232
+        ,choose: function(obj){
233
+            //将每次选择的文件追加到文件队列
234
+             files = obj.pushFile();
235
+            //预读本地文件,如果是多文件,则会遍历。(不支持ie8/9)
236
+            obj.preview(function(index, file, result){
237
+                depositImg.push({src:result,data:file});
238
+                filesContainer[index] = file;
239
+                $('#popup_1_imgBox').append('<div class="layui-upload-img"><div class="delete-list" id="delimg"><i class="layui-icon fa-trash-o" >&#xe640;</i></div><img delIdentification="'+index+'" src="'+ result +'" alt="'+ file.name +'"></div>');
240
+            });
241
+
242
+        }
243
+    });
244
+    layer.photos({
245
+        photos: '#demo2',
246
+        closeBtn: 1
247
+        ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
248
+    });
249
+
250
+      // 正文上传事件
251
+    $('#popup_2').on('click','.layui-upload-img',function(){
252
+        // 处理选中与取消
253
+        $(this).find('.layui_w_triangle').toggle('30',function(){
254
+            $(this).parent().attr('data-id','pitch')
255
+            if($(this).is(":hidden")){
256
+                $(this).parent().removeAttr('data-id');
257
+                var _fsrc = $(this).parents('.layui-upload-img').find('img.pitch_img').attr('src');
258
+                for(i in depositImg){
259
+                    if(depositImg[i] == _fsrc){
260
+                        depositImg.splice(i, 1);        //取消选择时,从数组中删除
261
+                    }
262
+                }
263
+            }else{
264
+                $(this).parent().attr('data-id','pitch')
265
+                var _fsrc = $(this).parents('.layui-upload-img').find('img.pitch_img').attr('src');
266
+                depositImg.push(_fsrc);     //选中的图片,把src地址存入数组
267
+            }
268
+        });
269
+    })
270
+
271
+
272
+
273
+    // 封面图功能
274
+    $('.upload_box').on('click',function(){
275
+        var txtData = UE.getEditor('editor_content').getContent();
276
+        var imgReg = /<img.*?(?:>|\/>)/gi;          //匹配图片(g表示匹配所有结果i表示区分大小写)
277
+        var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i;        //匹配src属性 
278
+        var txtImg = txtData.match(imgReg);
279
+        var index = layer.open({
280
+             type: 2,
281
+             title:'选择封面',
282
+             skin: 'layui-layer-rim', //加上边框
283
+             area: ['650px', '500px'], //宽高
284
+             content : "/news/popup",
285
+             success: function(layero, index){
286
+               var poupBody = layer.getChildFrame('body', index);       //获取当前弹窗的doc
287
+                for(i in txtImg){
288
+                   var _src = txtImg[i].match(srcReg)[0];
289
+                   poupBody.find('#popup_2').append('<div class="layui-upload-img"><div class="layui_w_triangle"><img src="/static/images/triangle.png" alt="" /></div><img class="pitch_img" '+_src+'/></div>');
290
+                }
291
+             }
292
+        })
293
+
294
+    })
295
+
296
+    $('#layui_confirm').on('click',function(){
297
+       var doc = $('#demo2', window.parent.document);        //JQ获取弹窗父层doc
298
+       var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
299
+        if(depositImg.length > 3){
300
+            layer.msg('封面图只能选择3张!!',{time:1000,shade:0.5})
301
+            return false;
302
+        }
303
+        var _leng = doc.find('.layui-upload-img').length;
304
+        if(_leng < 3){
305
+            for(i in depositImg){
306
+                if(typeof depositImg[i] == "object"){
307
+                    doc.append('<div class="layui-upload-img"><div class="delete-list" id="delimg"><i class="layui-icon fa-trash-o" >&#xe640;</i></div><img  src="'+ depositImg[i].src +'" ></div>');
308
+                    parent.fContainer[i]=depositImg[i].data
309
+                }else{
310
+                    doc.append('<div class="layui-upload-img"><div class="delete-list" id="delimg"><i class="layui-icon fa-trash-o" >&#xe640;</i></div><img src="'+ depositImg[i] +'" ></div>')
311
+                    parent.fContainer[i]=depositImg[i];
312
+                }
313
+            }
314
+
315
+        }else if(_leng >3){
316
+             layer.msg('封面图只能选择3张!!',{time:1000,shade:0.5})
317
+        }
318
+        parent.layer.close(index);  //关闭iframe页面
319
+        
320
+    })
321
+    
322
+    delImg("popup_1_imgBox","delimg");     // 删除图片
323
+
324
+
325
+    //添加
326
+    form.on('submit(tijiao)',function (data) {
327
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
328
+
329
+        var formData = new FormData($( "#signupForm" )[0]);
330
+        for(i in fContainer){
331
+           formData.append('img[]',fContainer[i]);     
332
+        }
333
+
334
+        $.ajax({
335
+            cache : true,
336
+            type : "post",
337
+            url : "/newsknowledge/createform",
338
+            data : formData,  // 你的formid
339
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
340
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
341
+            error : function(request) {
342
+                layer.close(index);
343
+                layer.alert("网络超时");
344
+            },
345
+            success : function(data) {
346
+                if(data.data != null){
347
+                    layer.msg(ReturnInfo(data.data),{icon:5});
348
+                    return false;
349
+                }
350
+                layer.msg(data.msg)
351
+            }
352
+        });
353
+        return false;
354
+    })
355
+
356
+    //修改
357
+    form.on('submit(edit)',function (data) {
358
+       layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
359
+        var formData = new FormData($( "#signupForm" )[0]);
360
+        for(i in fContainer){
361
+            formData.append('img[]',fContainer[i]);
362
+        }
363
+        //需要删除的图片
364
+        if(delFiles.length > 0){
365
+                $.each(delFiles,function (k,v) {
366
+                    formData.append('delimg[]',v);
367
+                })
368
+        }
369
+        $.ajax({
370
+            cache : true,
371
+            type : "post",
372
+            url : "/newsknowledge/editfrom",
373
+            data : formData,  // 你的formid
374
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
375
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
376
+            error : function(request) {
377
+                layer.alert("网络超时");
378
+            },
379
+            success : function(data) {
380
+                if(data.data != null){
381
+                    layer.msg(ReturnInfo(data.data),{icon:5});
382
+                    return false;
383
+                }
384
+                layer.msg(data.msg)
385
+            }
386
+        });
387
+        return false;
388
+    })
389
+
390
+    //批量删除
391
+    form.on('submit(del_alls_news)',function (data) {
392
+        var checkStatus = table.checkStatus('tablerReload');
393
+        if(typeof  checkStatus.data[0] == 'object'){
394
+            layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
395
+               layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
396
+                var formdat = new FormData();
397
+                $.each(checkStatus.data,function (key,val) {
398
+                    formdat.append('id[]',val.id);
399
+                })
400
+                $.ajax({
401
+                    cache : true,
402
+                    type : "post",
403
+                    url : "/newsknowledge/dels",
404
+                    data : formdat,  // 你的formid
405
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
406
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
407
+                    error : function(request) {
408
+                        layer.msg("请联系管理员");
409
+                    },
410
+                    success : function(data) {
411
+                        layer.msg(data.msg);
412
+                        table.reload('tablerReload');
413
+                    }
414
+                });
415
+
416
+            })
417
+            return false;
418
+        }
419
+        layer.msg('请选择需要删除的内容',{icon:5});
420
+        return false;
421
+    })
422
+
423
+});
424
+
425
+//删除图片
426
+$('#demo2').on("click","#delimg",function () {
427
+    var name = $(this).next().attr("imgname");
428
+    console.log(name);
429
+    var delIdentification = $(this).next().attr("delIdentification");
430
+        if(typeof(delIdentification) != 'undefined'){
431
+            delete filesContainer[delIdentification];
432
+            delete files[delIdentification] ;
433
+        }
434
+        if(typeof(name) != 'undefined'){
435
+            delFiles.push(name);
436
+        }
437
+    $(this).parent().remove();
438
+})
439
+
440
+
441
+$(function(){
442
+    // 动态添加批量删除按钮
443
+    var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
444
+              + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_news">批量删除</a>'
445
+              + '</div>'
446
+    $('.layui-form').append(_btn)
447
+
448
+})
449
+    //判断是否需要编辑,需要才加载
450
+    var verdict = $('#editor_content').html();
451
+    if(typeof verdict == "string"){
452
+        var ue = UE.getEditor('editor_content');  //编辑器
453
+    }
454
+
455
+
456
+
457
+// 选择封面图弹窗选择项卡
458
+$('.layui-tab-title .site-demo-active').on('click', function(){
459
+     $(this).addClass('layui-this').siblings().removeClass('layui-this');
460
+     var lay_id = $(this).attr('lay-id');
461
+     $('.layui-tab-item').removeClass('layui-show')
462
+     $('.layui-tab-content #'+lay_id).addClass('layui-show')
463
+});
464
+
465
+
466
+// 弹窗本地选择图片删除功能
467
+function delImg (oid,delId){
468
+    $('#' +oid).on("click","#"+delId,function () {
469
+    
470
+    var name = $(this).next().attr("imgname");
471
+    var delIdentification = $(this).next().attr("delIdentification");
472
+        if(typeof(delIdentification) != 'undefined'){
473
+            delete filesContainer[delIdentification];
474
+            delete files[delIdentification] ;
475
+        }
476
+        if(typeof(name) != 'undefined'){
477
+            delFiles.push(name);
478
+        }
479
+        var _ksrc = $(this).parents('.layui-upload-img').find('img').attr('src');
480
+        for(i in depositImg){
481
+            if(typeof depositImg[i] == "object"){
482
+                if(depositImg[i].src == _ksrc){
483
+                    depositImg.splice(i, 1);        //取消选择时,从数组中删除
484
+                }
485
+            }else if(depositImg[i] == _ksrc){
486
+                 depositImg.splice(i, 1);        //取消选择时,从数组中删除
487
+            }
488
+            
489
+        }
490
+    $(this).parent().remove();
491
+})
492
+}
493
+//获取标题
494
+$("#keywords").blur(function(){
495
+    var title=$(this).val();
496
+    var keyword='';
497
+    $.ajax({
498
+        url:"/newsknowledge/participle",
499
+        type:"POST",
500
+        data:{title:title},
501
+        dataType:"json",
502
+        success:function(data){
503
+            $.each(data.data, function (i, data) {
504
+                keyword+=data.word+'、';
505
+                $('input[name="keywords"]').val(keyword);
506
+            })
507
+        }
508
+    });
509
+    //$('input[name="keywords"]').val(tex);
510
+});

+ 264 - 0
backend/web/js/china/live.js

@@ -0,0 +1,264 @@
1
+layui.use(['laypage', 'layer', 'laydate', 'table', 'element', 'form', 'upload'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , layer = layui.layer //弹层
6
+        , table = layui.table //表格
7
+        , element = layui.element //元素操作
8
+        , form = layui.form
9
+        , laydate = layui.laydate
10
+        , upload = layui.upload;
11
+
12
+    var tableIds = 'videolist';  //表格ID
13
+
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#' + tableIds
17
+        , url: '/live/liveform' //数据接口
18
+        , where: {token: csrfToken}
19
+        , method: 'post'
20
+        , page: true //开启分页
21
+        ,height:600
22
+        , text: '数据加载中'
23
+        , id: 'tablerReload'
24
+        , cols: [[ //表头
25
+            // {type: "checkbox", width:50},
26
+            {type: 'numbers', title: '序号', width: 50},
27
+            {field: 'title', title: '直播标题', align: 'center'},
28
+            {field: 'city_name', width: 120, title: '所属区域', align: 'center'},
29
+            {field: 'name', title: '所属楼盘', align: 'center'}
30
+            // {
31
+            //     field: 'img', title: '封面图', width: 300, align: 'center', templet: function (d) {
32
+            //         return '<img class="layui_magnify" src="' + d.img + '"/>'
33
+            //     }
34
+            // }
35
+            , {field: 'img', title: '图片路径', align: 'center'}
36
+            , {field: 'time', title: '直播时间', width: 200, align: 'center'}
37
+            , {
38
+                field: 'sort',
39
+                title: '排序',
40
+                width: 100,
41
+                event: 'sortData',
42
+                edit: 'text',
43
+                align: 'center',
44
+                sort: true,
45
+                templet: "#sortBox"
46
+            }
47
+            , {field: 'create_at', title: '添加时间', width: 200, align: 'center'}
48
+            , {fixed: 'right', title: '操作', width: 180, align: 'center', toolbar: '#operate'}
49
+
50
+        ]]
51
+    });
52
+
53
+    table.reload('tablerReload');        //重新加载
54
+
55
+    // 列表点击放大图片
56
+    $('.layui-table-main').on('click', '.layui_magnify', function () {
57
+        var _src = $(this).attr('src');
58
+        layui.layer.open({
59
+            type: 1,
60
+            title: false,           //是否显示标题
61
+            area: ['95%', '55%'],
62
+            shade: 0.6,           //透明度
63
+            closeBtn: 1,         //按钮 1有,0无
64
+            shadeClose: true,
65
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
66
+        });
67
+    });
68
+
69
+    //日期
70
+    laydate.render({
71
+        elem: '#date1',
72
+        trigger: 'click',
73
+        type: 'datetime'
74
+    });
75
+
76
+
77
+    //列表操作
78
+    table.on('tool(' + tableIds + ')', function (obj) {
79
+        var layEvent = obj.event,
80
+            data = obj.data;
81
+        if (layEvent === 'edit') {
82
+            var index = layer.open({
83
+                type: 2,
84
+                title: '修改直播信息',
85
+                area: ['50%', '80%'],
86
+                content: '/live/liveedit?id=' + data.id + '&house_name=' + data.name,
87
+                end: function () {
88
+                    table.reload('tablerReload');        //重新加载
89
+                }
90
+            });
91
+        } else if (layEvent === 'del') {
92
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
93
+                $.post('/live/setlive', {id: data.id, type: 'del'}, function (data) {
94
+                    layer.msg(data.msg);
95
+                    table.reload('tablerReload');
96
+                })
97
+            })
98
+        } else if (layEvent === 'remark') {
99
+            var index = layer.open({
100
+                type: 2,
101
+                title: '直播评论信息',
102
+                area: ['100%', '100%'],
103
+                content: '/live/liveremark?id=' + data.id,
104
+                end: function () {
105
+                    table.reload('tablerReload');        //重新加载
106
+                }
107
+            });
108
+        } else if (layEvent === 'sortData') {       //修改排序
109
+            table.on('edit(' + tableIds + ')', function (obj) {
110
+                var data = obj.data;
111
+                $.post('/live/setlive', {id: data.id, type: 'sort', sort: data.sort}, function (data) {
112
+                    if (data.code == 200) {
113
+                        layer.msg(data.msg);
114
+                    } else if (data.code == 300) {
115
+                        layer.msg(data.msg);
116
+                    }
117
+                })
118
+            })
119
+        }
120
+    });
121
+
122
+    //添加图片上传
123
+    upload.render({
124
+        elem: '#test1'
125
+        , url: '/house/createimg'
126
+        , data: {token: csrfToken}
127
+        , field: 'img'
128
+        , size: 500              //限制上传图片的大小,单位为KB
129
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
130
+        , auto: false
131
+        , bindAction: '#addcity'
132
+        , choose: function (obj) {
133
+            obj.preview(function (index, file, result) {
134
+                $('#breviary_img').attr('src', result); //图片链接(base64)
135
+            });
136
+        }
137
+    });
138
+    // 图片放大浏览
139
+    $('.layui_magnify').click(function () {
140
+        var _src = $(this).attr('src');
141
+        layui.layer.open({
142
+            type: 1,
143
+            title: false,           //是否显示标题
144
+            area: ['60%', '80%'],
145
+            shade: 0.6,           //透明度
146
+            closeBtn: 1,         //按钮 1有,0无
147
+            shadeClose: true,
148
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
149
+        });
150
+    })
151
+
152
+    // 新增
153
+    var $ = layui.$, active = {
154
+        addData: function () { //获取选中数据
155
+            var index = layui.layer.open({
156
+                type: 2,
157
+                title: '添加直播信息',
158
+                closeBtn: 1, //不显示关闭按钮
159
+                area: ['50%', '80%'],
160
+                content: '/live/liveadd' //iframe的url,no代表不显示滚动条
161
+                , success: function (layero, index) {
162
+                },
163
+                end: function () {
164
+                    table.reload('tablerReload');
165
+                }
166
+            });
167
+        },
168
+        reload: function () {//搜索
169
+            var form = pfgs_serialize($('form'));
170
+
171
+            table.reload('tablerReload', {
172
+                where: {
173
+                    title: form.input_house_text,
174
+                    city: form.input_city,
175
+                },
176
+                page: {
177
+                    curr: 1
178
+                }
179
+            })
180
+        },
181
+    };
182
+    $('.demoTable .layui-btn').on('click', function () {
183
+        var type = $(this).data('type');
184
+        active[type] ? active[type].call(this) : '';
185
+    });
186
+
187
+
188
+    $('.The_house').focus(function () {
189
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
190
+        indexOpen = parent.layui.layer.open({
191
+            type: 2,
192
+            title: '选择需要添加的楼盘',
193
+            area: ['', '100%'],
194
+            content: '/publicuse/housenamecn',
195
+            success: function (layero, index) {
196
+            },
197
+            end: function () {
198
+            }
199
+        });
200
+        parent.layui.layer.full(indexOpen);
201
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
202
+        $(window).on("resize", function () {
203
+            parent.layui.layer.full(indexOpen);
204
+        })
205
+    })
206
+
207
+
208
+    //添加页面提交数据
209
+    form.on('submit(adds)', function (data) {
210
+        var formData = new FormData($('form')[0]);
211
+        // if (formData.getAll('img')[0].size == 0) {
212
+        //     layer.msg('请选择图片');
213
+        //     return false;
214
+        // }
215
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
216
+        $.ajax({
217
+            cache: false,
218
+            type: "post",
219
+            url: "/live/liveaddform",
220
+            data: formData,  // 你的formid
221
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
222
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
223
+            error: function (request) {
224
+                layer.close(index);
225
+                layer.msg("请联系管理员");
226
+            },
227
+            success: function (data) {
228
+                if (data.data != null) {
229
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
230
+                    return;
231
+                }
232
+                layer.msg(data.msg);
233
+            }
234
+        });
235
+        return false;
236
+    });
237
+
238
+    form.on('submit(edit)', function (data) {
239
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
240
+        // var oindex = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
241
+        var formData = new FormData($('form')[0]);
242
+        $.ajax({
243
+            type: "post",
244
+            url: "/live/liveeditform",
245
+            data: formData,
246
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
247
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
248
+            error: function (request) {
249
+                layer.close(index);
250
+                layer.msg("请联系管理员");
251
+            },
252
+            success: function (data) {
253
+                if (data.data != null) {
254
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
255
+                    return;
256
+                }
257
+                layer.msg(data.msg);
258
+                parent.layer.close(oindex); //再执行关闭
259
+            }
260
+        });
261
+        return false;
262
+    });
263
+
264
+})

+ 746 - 0
backend/web/js/china/news.js

@@ -0,0 +1,746 @@
1
+var delFiles = []; //用于删除图片
2
+var filesContainer = {};  //存储最终要上传的图片
3
+var files;     //存储选择图片的数量
4
+
5
+var fContainer = {}; //用于传父级传变量,格式 parent.fContainer
6
+var depositImg = [];//用于存放弹窗图片
7
+var hideImg = [];   //用于存放从正文图片路径
8
+layui.use(['form', 'layer', 'laydate', 'table', 'laytpl', 'layedit', 'upload'], function () {
9
+    var form = layui.form,
10
+        // layer = parent.layer === undefined ? layui.layer : top.layer,
11
+        layer = layui.layer,
12
+        $ = layui.jquery,
13
+        laydate = layui.laydate,
14
+        laytpl = layui.laytpl,
15
+        table = layui.table,
16
+        layedit = layui.layedit
17
+        , upload = layui.upload;
18
+
19
+
20
+    var tableIds = 'newsList';
21
+    //楼盘列表
22
+    var tableIns = table.render({
23
+        elem: '#' + tableIds,
24
+        url: '/news/newsform',
25
+        cellMinWidth: 95,
26
+        method: 'post',
27
+        page: true,
28
+        height: 600,
29
+        limit: 20,
30
+        id: 'tablerReload',
31
+        cols: [[
32
+            {type: "checkbox", width: 50},
33
+            {type: 'numbers'},
34
+            {field: 'id', title: 'ID', width: 80, align: "center", sort: true},
35
+            {
36
+                field: 'subject', title: '标题', align: 'center', templet: function (d) {
37
+                    return '<a href="http://www.pinfanghw.com/news/details/' + d.id + '" target="_blank">' + d.subject + '</a>'
38
+                }
39
+            },
40
+            {field: 'city_name', title: '区域', width: 100, align: 'center'},
41
+            {field: 'news_name', title: '栏目', width: 120, align: 'center'},
42
+            // {field: 'house_name', title: '楼盘', width: 170, align: 'center'},
43
+            // {
44
+            //     field: 'hstate',
45
+            //     title: '推送楼盘',
46
+            //     width: 100,
47
+            //     event: 'housesNews',
48
+            //     align: 'center',
49
+            //     templet: function (d) {
50
+            //         if (d.hstate == 2) {
51
+            //             return '<input type="checkbox" value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchHid" lay-text="|">'
52
+            //         } else {
53
+            //             return '<input type="checkbox" checked value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchHid" lay-text="|">'
54
+            //         }
55
+            //     }
56
+            // },
57
+            {
58
+                field: 'clicks',
59
+                title: '点击数',
60
+                width: 100,
61
+                edit: 'text',
62
+                align: 'center',
63
+                clicks: true,
64
+                templet: "#clicksBox"
65
+            },
66
+            {field: 'true_click', title: '真实点击数', width: 120, align: 'center', sort: true},
67
+            {field: 'sort', title: '排序', width: 100, edit: 'text', align: 'center', sort: true, templet: "#sortBox"},
68
+            {
69
+                field: 'top', title: '置顶', width: 75, event: 'housesNews', align: 'center', templet: function (d) {
70
+                    if (d.top == 2) {
71
+                        return '<input type="checkbox" checked value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTop" lay-text="|">'
72
+                    } else {
73
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTop" lay-text="|">'
74
+                    }
75
+                }
76
+            },
77
+            {field: 'create_at', title: '添加时间', width: 120, event: 'sortData', align: 'center', sort: true},
78
+            {
79
+                field: 'state', title: '审核', width: 75, event: 'housesNews', align: 'center', templet: function (d) {
80
+                    if (d.state === 'N') {
81
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
82
+                    } else {
83
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
84
+                    }
85
+                }
86
+            },
87
+
88
+            {title: '操作', width: 100, templet: '#housesListBar', fixed: "right", align: "center"}
89
+
90
+        ]]
91
+    });
92
+
93
+    table.reload('tablerReload');        //重新加载
94
+
95
+    // 日期
96
+    laydate.render({
97
+        elem: '#EventDate'
98
+    });
99
+    laydate.render({
100
+        elem: '#ModificationDate'
101
+    });
102
+
103
+
104
+    //表格头部操作菜单
105
+    var $ = layui.$, active = {
106
+        addData: function () { //获取选中数据
107
+            var index = layui.layer.open({
108
+                title: "添加资讯",
109
+                type: 2,
110
+                area: ['80%', '100%'],
111
+                maxmin: true,
112
+                content: "/news/add",
113
+            })
114
+            layui.layer.full(index);
115
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
116
+            $(window).on("resize", function () {
117
+                layui.layer.full(index);
118
+            })
119
+        },
120
+        reload: function () {
121
+            var form = pfgs_serialize($('form'));
122
+            var name = '';
123
+            var id = '';
124
+            if (form.input_house == 'name') {
125
+                name = form.input_house_text;
126
+            } else if (form.input_house == 'id') {
127
+                id = form.input_house_text;
128
+            }
129
+            table.reload('tablerReload', {
130
+                where: {
131
+                    sort: form.input_sort,
132
+                    id: id,
133
+                    name: name,
134
+                    news: form.input_news,
135
+                    city: form.input_city
136
+                }
137
+            })
138
+        }, batch_sync: function () {
139
+            var checkStatus = table.checkStatus('tablerReload');
140
+            if (typeof  checkStatus.data[0] == 'object') {
141
+                var nid = '';
142
+                $.each(checkStatus.data, function (key, val) {
143
+                    nid += val.id + ',';
144
+                })
145
+                var index = layui.layer.open({
146
+                    title: "批量操作",
147
+                    type: 2,
148
+                    area: ['50%', '100%'],
149
+                    maxmin: true,
150
+                    content: "/news/batchsync?nid=" + nid,
151
+                })
152
+                return false;
153
+            }
154
+            layer.msg('请选择需要同步的资讯');
155
+
156
+        }
157
+    };
158
+
159
+
160
+    //监听指定开关
161
+    form.on('switch(switchTest)', function (data) {
162
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
163
+            $.post('/house/housesortedit', {id: data.value, examineid: 1}, function (data) {
164
+                if (data.code == 200) {
165
+                    layer.msg(data.msg);
166
+                    table.reload('tablerReload');
167
+                } else if (data.code == 300) {
168
+                    layer.msg(data.msg);
169
+                }
170
+            })
171
+        }, function (aa) {
172
+            table.reload('tablerReload');        //重新加载
173
+        })
174
+    });
175
+
176
+
177
+    $('.demoTable .layui-btn').on('click', function () {
178
+        var type = $(this).data('type');
179
+        active[type] ? active[type].call(this) : '';
180
+    });
181
+
182
+
183
+    /* 列表操作  edit  修改后执行  2018.7.24*/
184
+    table.on('edit(' + tableIds + ')', function (obj) {
185
+        var data = obj.data;
186
+        if (obj.field === 'clicks') {
187
+            $.post('/news/editclicks', {id: data.id, type: 'clicks', clicks: data.clicks}, function (data) {
188
+                if (data.code == 200) {
189
+                    layer.msg(data.msg);
190
+                    // obj.update({
191
+                    //     sort: data.sort
192
+                    // });
193
+                    // TableClose();
194
+                } else if (data.code == 300) {
195
+                    layer.msg(data.msg);
196
+                }
197
+            })
198
+        } else if (obj.field === 'sort') {
199
+            $.post('/news/editclicks', {id: data.id, type: 'sort', sort: data.sort}, function (data) {
200
+                if (data.code == 200) {
201
+                    layer.msg(data.msg);
202
+                    // obj.update({
203
+                    //     sort: data.sort
204
+                    // });
205
+                    // TableClose();
206
+                } else if (data.code == 300) {
207
+                    layer.msg(data.msg);
208
+                }
209
+            })
210
+        }
211
+
212
+    })
213
+
214
+    // if(obj.event  === 'clicksData'){
215
+    //       layer.prompt({
216
+    //            formType: 2
217
+    //            ,title: '点击数'
218
+    //            ,value: data.clicks
219
+    //        }, function(value, index){
220
+
221
+    //            $.post('/news/editclicks',{id:data.id,type:'clicks',clicks:value},function (data) {
222
+    //                layer.msg(data.msg);
223
+    //                layer.close(index);
224
+    //                table.reload('tablerReload');
225
+    //            })
226
+    //        });
227
+    //    } else
228
+
229
+
230
+    //表格右边操作栏目
231
+    table.on('tool(' + tableIds + ')', function (obj) {
232
+        var data = obj.data;
233
+        if (obj.event === 'del') {    //删除操作
234
+            layer.confirm('确定要删除吗?', {btn: ['确定', '取消']}, function () {
235
+                $.post('/news/newsdel', {id: data.id}, function (data) {
236
+                    if (data.code == 200) {
237
+                        layer.msg(data.msg);
238
+                        table.reload('tablerReload');
239
+                    } else if (data.code == 300) {
240
+                        layer.msg(data.msg);
241
+                    }
242
+                })
243
+            })
244
+
245
+        } else if (obj.event === 'edit') {  //编辑操作
246
+            var index = layui.layer.open({
247
+                title: "编辑资讯",
248
+                type: 2,
249
+                area: ['', '100%'],
250
+                maxmin: true,
251
+                content: '/news/newsedit?id=' + data.id + '&house_name=' + data.house_name,
252
+            })
253
+
254
+            layui.layer.full(index);
255
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
256
+            $(window).on("resize", function () {
257
+                layui.layer.full(index);
258
+            })
259
+
260
+        } else if (obj.event === 'sortData') {       //修改排序
261
+            layer.prompt({
262
+                formType: 2
263
+                , title: '修改'
264
+                , value: data.sort
265
+            }, function (value, index) {
266
+                $.post('/house/housesortedit', {id: data.id, sort: value}, function (data) {
267
+                    if (data.code == 200) {
268
+                        layer.msg(data.msg);
269
+                        layer.close(index);
270
+                        obj.update({
271
+                            sort: value
272
+                        });
273
+                        // TableClose();
274
+                    } else if (data.code == 300) {
275
+                        layer.msg(data.msg);
276
+                    }
277
+                })
278
+
279
+
280
+            });
281
+        }
282
+    });
283
+
284
+    //监听指定开关
285
+    form.on('switch(switchTest)', function (data) {
286
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
287
+            $.post('/news/newsviewcontrol', {id: data.value}, function (data) {
288
+                if (data.code == 200) {
289
+                    layer.msg(data.msg);
290
+                    table.reload('tablerReload');
291
+                } else if (data.code == 300) {
292
+                    layer.msg(data.msg);
293
+                }
294
+            })
295
+        }, function (aa) {
296
+            table.reload('tablerReload');
297
+        })
298
+    });
299
+    //监听指定开关
300
+    form.on('switch(switchTop)', function (data) {
301
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
302
+            $.post('/news/topnews', {id: data.value}, function (data) {
303
+                if (data.code == 200) {
304
+                    layer.msg(data.msg);
305
+                    table.reload('tablerReload');
306
+                } else if (data.code == 300) {
307
+                    layer.msg(data.msg);
308
+                }
309
+            })
310
+        }, function (aa) {
311
+            table.reload('tablerReload');
312
+        })
313
+    });
314
+
315
+    //监听指定开关
316
+    form.on('switch(switchHid)', function (data) {
317
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
318
+            $.post('/news/newhouse', {id: data.value}, function (data) {
319
+                if (data.code == 200) {
320
+                    layer.msg(data.msg);
321
+                    table.reload('tablerReload');
322
+                } else if (data.code == 300) {
323
+                    layer.msg(data.msg);
324
+                }
325
+            })
326
+        }, function (aa) {
327
+            table.reload('tablerReload');
328
+        })
329
+    });
330
+
331
+    //添加and修改图片
332
+    upload.render({
333
+        elem: '#upload_edit',
334
+        url: '/news/newseditform'
335
+        , data: {token: csrfToken}
336
+        , multiple: true
337
+        , number: 3
338
+        , auto: false
339
+        , size: 1000              //限制上传图片的大小,单位为KB
340
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
341
+        , bindAction: '#addcity'
342
+        , choose: function (obj) {
343
+            //将每次选择的文件追加到文件队列
344
+            files = obj.pushFile();
345
+            //预读本地文件,如果是多文件,则会遍历。(不支持ie8/9)
346
+            obj.preview(function (index, file, result) {
347
+                depositImg.push({src: result, data: file});
348
+                filesContainer[index] = file;
349
+                $('#popup_1_imgBox').append('<div class="layui-upload-img"><div class="delete-list" id="delimg"><i class="layui-icon fa-trash-o" >&#xe640;</i></div><img delIdentification="' + index + '" src="' + result + '" alt="' + file.name + '"></div>');
350
+            });
351
+
352
+        }
353
+    });
354
+    layer.photos({
355
+        photos: '#demo2'
356
+        , anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
357
+    });
358
+
359
+    $('.The_house').focus(function () {
360
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
361
+        indexOpen = parent.layui.layer.open({
362
+            type: 2,
363
+            title: '选择需要添加的楼盘',
364
+            area: ['', '100%'],
365
+            content: '/publicuse/housename',
366
+            success: function (layero, index) {
367
+            },
368
+            end: function () {
369
+            }
370
+        });
371
+        parent.layui.layer.full(indexOpen);
372
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
373
+        $(window).on("resize", function () {
374
+            parent.layui.layer.full(indexOpen);
375
+        })
376
+    })
377
+
378
+    // 正文上传事件
379
+    $('#popup_2').on('click', '.layui-upload-img', function () {
380
+        // 处理选中与取消
381
+        $(this).find('.layui_w_triangle').toggle('30', function () {
382
+            $(this).parent().attr('data-id', 'pitch')
383
+            if ($(this).is(":hidden")) {
384
+                $(this).parent().removeAttr('data-id');
385
+                var _fsrc = $(this).parents('.layui-upload-img').find('img.pitch_img').attr('src');
386
+                var _furl = "pc/" + _fsrc.split("//")[2]
387
+                for (i in depositImg) {
388
+                    if (depositImg[i] == _fsrc) {
389
+                        depositImg.splice(i, 1);        //取消选择时,从数组中删除
390
+                    }
391
+                    if (hideImg[i] == _furl) {
392
+                        parent.hideImg.splice(i, 1);
393
+                    }
394
+                }
395
+            } else {
396
+                $(this).parent().attr('data-id', 'pitch')
397
+                var _fsrc = $(this).parents('.layui-upload-img').find('img.pitch_img').attr('src');
398
+                var _furl = "pc/" + _fsrc.split("//")[2]
399
+                depositImg.push(_fsrc);     //选中的图片,把src地址存入数组
400
+                parent.hideImg.push(_furl);     //选中的图片,把src地址存入数组
401
+
402
+            }
403
+        });
404
+    })
405
+
406
+
407
+    // 封面图功能
408
+    $('.upload_box').on('click', function () {
409
+        var txtData = UE.getEditor('editor_content').getContent();
410
+        var imgReg = /<img.*?(?:>|\/>)/gi;          //匹配图片(g表示匹配所有结果i表示区分大小写)
411
+        var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i;        //匹配src属性 
412
+        var txtImg = txtData.match(imgReg);
413
+        var index = layer.open({
414
+            type: 2,
415
+            title: '选择封面',
416
+            skin: 'layui-layer-rim', //加上边框
417
+            area: ['650px', '500px'], //宽高
418
+            content: "/news/popup",
419
+            success: function (layero, index) {
420
+                var poupBody = layer.getChildFrame('body', index);       //获取当前弹窗的doc
421
+                for (i in txtImg) {
422
+                    var _src = txtImg[i].match(srcReg)[0];
423
+                    poupBody.find('#popup_2').append('<div class="layui-upload-img"><div class="layui_w_triangle"><img src="/static/images/triangle.png" alt="" /></div><img class="pitch_img" ' + _src + '/></div>');
424
+                }
425
+            }
426
+        })
427
+
428
+    })
429
+    $('#layui_confirm').on('click', function () {
430
+        var doc = $('#demo2', window.parent.document);        //JQ获取弹窗父层doc
431
+        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
432
+        if (depositImg.length > 3) {
433
+            layer.msg('封面图只能选择3张!!', {time: 1000, shade: 0.5})
434
+            return false;
435
+        }
436
+        var _leng = doc.find('.layui-upload-img').length;
437
+        if (_leng < 3) {
438
+            for (i in depositImg) {
439
+                if (typeof depositImg[i] == "object") {
440
+                    doc.append('<div class="layui-upload-img"><div class="delete-list" id="delimg"><i class="layui-icon fa-trash-o" >&#xe640;</i></div><img  src="' + depositImg[i].src + '" ></div>');
441
+                    parent.fContainer[i] = depositImg[i].data
442
+                } else {
443
+                    doc.append('<div class="layui-upload-img"><div class="delete-list" id="delimg"><i class="layui-icon fa-trash-o" >&#xe640;</i></div><img src="' + depositImg[i] + '" ></div>')
444
+                    parent.fContainer[i] = depositImg[i];
445
+                }
446
+            }
447
+
448
+        } else if (_leng > 3) {
449
+            layer.msg('封面图只能选择3张!!', {time: 1000, shade: 0.5})
450
+        }
451
+        parent.layer.close(index);  //关闭iframe页面
452
+
453
+    })
454
+
455
+    delImg("popup_1_imgBox", "delimg");     // 删除图片
456
+
457
+
458
+    layer.photos({
459
+        photos: '#demo2'
460
+        , closeBtn: 1
461
+        , anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
462
+    });
463
+
464
+    //添加
465
+    form.on('submit(tijiao)', function (data) {
466
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
467
+
468
+        var formData = new FormData($("#signupForm")[0]);
469
+        for (i in fContainer) {
470
+            formData.append('img[]', fContainer[i]);
471
+        }
472
+
473
+        //从正文上传文件图片
474
+        if (hideImg.length > 0) {
475
+            $.each(hideImg, function (k, v) {
476
+                formData.append('mainImg[]', v);
477
+            })
478
+        }
479
+
480
+        $.ajax({
481
+            cache: true,
482
+            type: "post",
483
+            url: "/news/addform",
484
+            data: formData,  // 你的formid
485
+            // async : false,          //async 默认为true异步,修改为false为同步,
486
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
487
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
488
+            error: function (request) {
489
+                layer.close(index);
490
+                layer.alert("网络超时");
491
+            },
492
+            success: function (data) {
493
+                if (data.code == 200) {
494
+                    layer.msg(data.msg);
495
+                    parent.layui.table.reload('tablerReload');
496
+                    TableClose();
497
+                } else if (data.code == 300) {
498
+                    layer.msg(data.msg)
499
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
500
+                }
501
+            }
502
+        });
503
+        return false;
504
+    })
505
+
506
+    //修改
507
+    form.on('submit(edit)', function (data) {
508
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
509
+        var formData = new FormData($("#signupForm")[0]);
510
+        // $.each(filesContainer,function (k,v) {
511
+        //     if(v != null){
512
+        //         formData.append('img[]',v);
513
+        //     }
514
+        // })
515
+
516
+        for (i in fContainer) {
517
+            formData.append('img[]', fContainer[i]);
518
+        }
519
+
520
+        //需要删除的图片
521
+        if (delFiles.length > 0) {
522
+            $.each(delFiles, function (k, v) {
523
+                formData.append('delimg[]', v);
524
+            })
525
+        }
526
+
527
+        //从正文上传文件图片
528
+        if (hideImg.length > 0) {
529
+            $.each(hideImg, function (k, v) {
530
+                formData.append('mainImg[]', v);
531
+            })
532
+        }
533
+
534
+
535
+        $.ajax({
536
+            cache: true,
537
+            type: "post",
538
+            url: "/news/newseditform",
539
+            data: formData,  // 你的formid
540
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
541
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
542
+            error: function (request) {
543
+                layer.close(index);         //关闭数据提交信息
544
+                layer.alert("网络超时");
545
+            },
546
+            success: function (data) {
547
+                if (data.code == 200) {
548
+                    layer.msg(data.msg);
549
+
550
+                    parent.layui.table.reload('tablerReload');
551
+                    TableClose();
552
+                } else {
553
+                    layer.msg(data.msg)
554
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
555
+                }
556
+            }
557
+        });
558
+        return false;
559
+    })
560
+//检测关键词
561
+    form.on('submit(check_words)', function (data) {
562
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
563
+        var content = UE.getEditor('editor_content').getContentTxt();
564
+        var centhtml = UE.getEditor('editor_content').getContent();
565
+        $.ajax({
566
+            //cache : false,
567
+            type: "post",
568
+            url: "/sensitivewords/checkword",
569
+            data: {content: content},  // 你的formid
570
+            //contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
571
+            //processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
572
+            error: function (request) {
573
+                layer.close(index);
574
+                layer.alert("网络超时");
575
+            },
576
+            success: function (data) {
577
+                if (data.data != null) {
578
+                    var index = layer.open({
579
+                        type: 1,
580
+                        // skin: 'layui-layer-rim', //加上边框
581
+                        title: '违禁词信息',
582
+                        area: ['420px', '240px'], //宽高
583
+                        content: '<div style="color:red;">' + data.data + '</div>'
584
+                    });
585
+                    for (var i = 0; i < data.data.length; i++) {
586
+                        centhtml = centhtml.replace(data.data[i], "<span style='color: rgb(255, 0, 0);'>" + data.data[i] + "</span>");
587
+                    }
588
+                    UE.getEditor('editor_content').setContent(centhtml);
589
+                    layer.msg(data.msg)
590
+                } else {
591
+                    layer.msg(data.msg)
592
+                }
593
+            }
594
+        });
595
+        return false;
596
+    })
597
+    //批量删除
598
+    form.on('submit(del_alls_news)', function (data) {
599
+        var checkStatus = table.checkStatus('tablerReload');
600
+        if (typeof  checkStatus.data[0] == 'object') {
601
+            layer.confirm('您确定要删除吗?', {btn: ['确认', '取消']}, function () {
602
+                var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
603
+                var formdat = new FormData();
604
+                $.each(checkStatus.data, function (key, val) {
605
+                    formdat.append('id[]', val.id);
606
+                })
607
+                $.ajax({
608
+                    cache: true,
609
+                    type: "post",
610
+                    url: "/news/newsdel",
611
+                    data: formdat,  // 你的formid
612
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
613
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
614
+                    error: function (request) {
615
+                        layer.close(index);         //关闭数据提交信息
616
+                        layer.alert("网络超时");
617
+                    },
618
+                    success: function (data) {
619
+                        if (data.code == 200) {
620
+                            layer.msg(data.msg);
621
+                            table.reload('tablerReload')
622
+                        } else {
623
+                            layer.msg(data.msg);
624
+                        }
625
+                    }
626
+                });
627
+
628
+            })
629
+            return false;
630
+        }
631
+        layer.msg('请选择需要删除的资讯', {icon: 5});
632
+        return false;
633
+    })
634
+
635
+    //
636
+    // //同步资料
637
+    // form.on('submit(batch_sync_submit)', function (data) {
638
+    //     var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
639
+    //     $.ajax({
640
+    //         cache: true,
641
+    //         type: "post",
642
+    //         url: "/news/confirmsync",
643
+    //         data: data.field,  // 你的formid
644
+    //         success: function (data) {
645
+    //             if (data.code == 200) {
646
+    //                 layer.msg(data.msg);
647
+    //                 parent.layui.table.reload('tablerReload');
648
+    //                 TableClose();
649
+    //             } else if (data.code == 300) {
650
+    //                 layer.msg(data.msg)
651
+    //             }
652
+    //         }
653
+    //     });
654
+    //     return false;
655
+    // })
656
+
657
+});
658
+
659
+//删除图片
660
+$('#demo2').on("click", "#delimg", function () {
661
+    var name = $(this).next().attr("imgname");
662
+    var delIdentification = $(this).next().attr("delIdentification");
663
+    if (typeof(delIdentification) != 'undefined') {
664
+        delete filesContainer[delIdentification];
665
+        delete files[delIdentification];
666
+    }
667
+    if (typeof(name) != 'undefined') {
668
+        delFiles.push(name);
669
+    }
670
+    $(this).parent().remove();
671
+})
672
+
673
+function RestrictImgNum() {
674
+    var imgNum = $('.layui-w-img').children('img').length;
675
+    if (imgNum > 3 || imgNum == 3) {
676
+        return false;
677
+    }
678
+}
679
+
680
+$(function () {
681
+    // 动态添加批量删除按钮
682
+    var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
683
+        + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_news">批量删除</a>'
684
+        + '</div>'
685
+    $('.layui-form').append(_btn)
686
+
687
+})
688
+//判断是否需要编辑,需要才加载
689
+var verdict = $('#editor_content').html();
690
+if (typeof verdict == "string") {
691
+    var ue = UE.getEditor('editor_content');  //编辑器
692
+
693
+    // 2018
694
+    ue.addListener("keyup", function () {
695
+        var arr = (UE.getEditor('editor_content').getContentTxt());
696
+        console.log(arr)
697
+
698
+    })
699
+
700
+}
701
+
702
+
703
+// 选择封面图弹窗选择项卡
704
+$('.layui-tab-title .site-demo-active').on('click', function () {
705
+    $(this).addClass('layui-this').siblings().removeClass('layui-this');
706
+    var lay_id = $(this).attr('lay-id');
707
+    $('.layui-tab-item').removeClass('layui-show')
708
+    $('.layui-tab-content #' + lay_id).addClass('layui-show')
709
+});
710
+
711
+
712
+// 弹窗本地选择图片删除功能
713
+function delImg(oid, delId) {
714
+    $('#' + oid).on("click", "#" + delId, function () {
715
+
716
+        var name = $(this).next().attr("imgname");
717
+        var delIdentification = $(this).next().attr("delIdentification");
718
+        if (typeof(delIdentification) != 'undefined') {
719
+            delete filesContainer[delIdentification];
720
+            delete files[delIdentification];
721
+        }
722
+        if (typeof(name) != 'undefined') {
723
+            delFiles.push(name);
724
+        }
725
+        var _ksrc = $(this).parents('.layui-upload-img').find('img').attr('src');
726
+        for (i in depositImg) {
727
+            if (typeof depositImg[i] == "object") {
728
+                if (depositImg[i].src == _ksrc) {
729
+                    depositImg.splice(i, 1);        //取消选择时,从数组中删除
730
+                }
731
+            } else if (depositImg[i] == _ksrc) {
732
+                depositImg.splice(i, 1);        //取消选择时,从数组中删除
733
+            }
734
+
735
+        }
736
+        $(this).parent().remove();
737
+    })
738
+
739
+
740
+    // 监听短标题输入的字符数
741
+    $('.w-slug').on('input', function () {
742
+        var count = $(this).val().length;
743
+        $('.w-count').html(count)
744
+    });
745
+
746
+}

+ 166 - 0
backend/web/js/china/newscategory.js

@@ -0,0 +1,166 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , layer = layui.layer //弹层
5
+        , table = layui.table //表格
6
+        , element = layui.element //元素操作
7
+        , form = layui.form
8
+
9
+    var tableIds = 'newsCategoryList';
10
+    //第一个实例
11
+    table.render({
12
+        elem: '#' + tableIds
13
+        , url: '/dictionary/newsform' //数据接口
14
+        , where: {token: csrfToken}
15
+        , method: 'post'
16
+        , page: true //开启分页
17
+        , height: 600
18
+        , text: '数据加载中'
19
+        , cols: [[ //表头
20
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
21
+            {field: 'news_name', title: '资讯名称', align: 'center'}
22
+            , {field: 'sort', title: '排序', width: 80, edit: 'text', align: 'center', sort: true, templet: "#sortBox"}
23
+            // ,{field: 'state', title: '状态', width:80,align:'center'}
24
+            , {
25
+                field: 'state',
26
+                title: '是否下架',
27
+                width: 100,
28
+                align: 'center',
29
+                templet: "#Toexamine",
30
+                templet: function (d) {
31
+                    if (d.state == 2) {
32
+                        return '<input type="checkbox"  value="' + d.id + '" name="' + d.state + '"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
33
+                    } else {
34
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="' + d.state + '"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
35
+                    }
36
+                }
37
+            }
38
+            // ,{field: 'recommend', title: '是否推荐', width:120,align:'center'}
39
+            , {field: 'create_at', title: '添加时间', width: 150, align: 'center'}
40
+            , {field: 'update_at', title: '更新时间', width: 150, align: 'center'}
41
+            , {fixed: 'right', title: '操作', width: 165, align: 'center', toolbar: '#operate'}
42
+
43
+        ]]
44
+    });
45
+
46
+    //列表操作
47
+    table.on('tool(' + tableIds + ')', function (obj) {
48
+        var layEvent = obj.event,
49
+            data = obj.data;
50
+        if (layEvent === 'edit') {
51
+            layer.open({
52
+                type: 2,
53
+                title: '修改户型',
54
+                closeBtn: 1, //不显示关闭按钮
55
+                shade: [0],
56
+                area: ['600px', '500px'],
57
+                anim: 2,
58
+                content: ['/dictionary/newsedit?id=' + data.id, 'yes'], //iframe的url,no代表不显示滚动条
59
+            });
60
+        } else if (layEvent === 'del') {
61
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
62
+                $.post('/dictionary/newsdel', {'id': data.id, type: 'del'}, function (data) {
63
+                    if (data.code == 200) {
64
+                        layer.msg(data.msg);
65
+                        table.reload(tableIds);
66
+                    } else if (data.code == 300) {
67
+                        layer.msg(data.msg);
68
+                    }
69
+                })
70
+            })
71
+        }
72
+    });
73
+
74
+    var $ = layui.$, active = {
75
+        addData: function () { //获取选中数据
76
+
77
+            layer.open({
78
+                type: 2,
79
+                title: '添加资讯分类',
80
+                closeBtn: 1, //不显示关闭按钮
81
+                shade: [0],
82
+                area: ['600px', '500px'],
83
+                anim: 2,
84
+                content: ['/dictionary/newsadd', 'yes'], //iframe的url,no代表不显示滚动条
85
+            });
86
+
87
+            // var checkStatus = table.checkStatus('idTest')
88
+            //     ,data = checkStatus.data;
89
+            // layer.alert(JSON.stringify(data));
90
+        }
91
+    };
92
+
93
+    $('.demoTable .layui-btn').on('click', function () {
94
+        var type = $(this).data('type');
95
+        active[type] ? active[type].call(this) : '';
96
+    });
97
+
98
+
99
+    //显示或隐藏
100
+    form.on('switch(switchTest)', function (data) {
101
+        var state = '';
102
+        if (data.elem.name == 1) {
103
+            state = 2;
104
+        } else if (data.elem.name == 2) {
105
+            state = 1;
106
+        }
107
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
108
+            $.post('/dictionary/newsdel', {id: data.value, type: 'state', state: state}, function (data) {
109
+                if (data.data != null) {
110
+                    layer.msg(data.msg);
111
+                    return false;
112
+                }
113
+                layer.msg(data.msg);
114
+                table.reload(tableIds);
115
+            })
116
+        }, function (aa) {
117
+            table.reload(tableIds);
118
+        })
119
+    });
120
+
121
+
122
+    table.on('edit(' + tableIds + ')', function (obj) {
123
+        var data = obj.data;
124
+        if (obj.field == "sort") {
125
+            $.post('/dictionary/newsdel', {id: data.id, sort: data.sort, type: 'sort'}, function (data) {
126
+                if (data.code == 200) {
127
+                    layer.msg(data.msg);
128
+                } else if (data.code == 300) {
129
+                    layer.msg(data.msg);
130
+                }
131
+            })
132
+        }
133
+    })
134
+
135
+
136
+    //修改
137
+    form.on('submit(editnews)', function (data) {
138
+        $.post('/dictionary/newseditform', {'data': data.field, 'token': csrfToken}, function (data) {
139
+            if (data.code == 200) {
140
+                layer.msg(data.msg);
141
+                parent.layui.table.reload(tableIds);
142
+                TableClose();
143
+            } else if (data.code == 300) {
144
+                layer.msg(data.msg);
145
+            }
146
+        })
147
+        return false;
148
+    });
149
+
150
+
151
+    //添加
152
+    form.on('submit(addnews)', function (data) {
153
+        $.post('/dictionary/newsaddform', {'data': data.field, 'token': csrfToken}, function (data) {
154
+            if (data.code == 200) {
155
+                layer.msg(data.msg);
156
+                parent.layui.table.reload(tableIds);
157
+                TableClose();
158
+            } else if (data.code == 300) {
159
+                layer.msg(data.msg);
160
+            }
161
+        })
162
+        return false;
163
+    });
164
+
165
+
166
+});

+ 219 - 0
backend/web/js/china/newslabel/knowledge.js

@@ -0,0 +1,219 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','treetable'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,form = layui.form
8
+        ,treetable = layui.treetable;
9
+
10
+
11
+  if($('#menulist').attr('lay-filter') == 'menulist'){
12
+      var renderTable = function (wheres = {}) {
13
+          treetable.render({
14
+              treeColIndex: 1,
15
+              treeSpid:0,
16
+              treeIdName: 'id',
17
+              treePidName: 'pid',
18
+              treeDefaultClose: true,
19
+              treeLinkage: false,
20
+              elem: '#menulist',
21
+              url: '/dictionarynews/labelform',
22
+              page: false,
23
+              height:600,
24
+              where:wheres,
25
+              id:'tablerReload',
26
+              cols: [[
27
+                  {type:'numbers'}
28
+                  // {field: 'id', title: 'ID', width:80, sort: true,align:'center'}
29
+                  ,{field: 'name', title: '栏目名称',align:'center'},
30
+                  {field: 'sort', title: '排序',width:80, edit: 'text',align:'center',sort: true,templet:"#sortBox"},
31
+                  // ,{field: 'sort', title: '排序',align:'center',sort: true},
32
+                  {field: 'is_show', title: '审核',width:100, align:'center', templet:"#Toexamine",templet:function(d){
33
+                          if(d.is_show == 2){
34
+                              return  '<input type="checkbox"  value="'+d.id+'" name="'+d.is_show+'"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
35
+                          } else {
36
+                              return  '<input type="checkbox" checked  value="'+d.id+'" name="'+d.is_show+'"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
37
+                          }
38
+                      }}
39
+                  ,{field: 'create_at', title: '添加时间', width:200,align:'center'}
40
+                  ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
41
+              ]],
42
+              done: function () {
43
+                  layer.closeAll('loading');
44
+              }
45
+          });
46
+      };
47
+
48
+      renderTable();
49
+  }
50
+
51
+    //列表操作
52
+    table.on('tool(menulist)', function(obj){
53
+        var layEvent = obj.event,
54
+            data = obj.data;
55
+        if(layEvent === 'edit'){
56
+            layer.open({
57
+                type: 2,
58
+                title: '编辑',
59
+                closeBtn: 1, //不显示关闭按钮
60
+                shade: [0],
61
+                area: ['600px', '500px'],
62
+                anim: 2,
63
+                content: '/dictionarynews/editlabel?id='+data.id, //iframe的url,no代表不显示滚动条
64
+                end:function () {
65
+                    renderTable();
66
+                }
67
+            });
68
+        } else if(layEvent === 'del') {
69
+            layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
70
+            $.post('/dictionarynews/editlabelform',{data:{id:data.id,del:2}},function (data) {
71
+                if(data.data != null){
72
+                    layer.msg(ReturnInfo(data.data),{icon:5});
73
+                    return false;
74
+                }
75
+                layer.msg(data.msg);
76
+                renderTable();
77
+                 })
78
+            })
79
+        }
80
+
81
+
82
+    });
83
+
84
+    var $ = layui.$, active = {
85
+        addDatas: function(){ //获取选中数据
86
+                layer.open({
87
+                    type: 2,
88
+                    title: '新增栏目',
89
+                    closeBtn: 1, //不显示关闭按钮
90
+                    shade: [0],
91
+                    area: ['600px', '500px'],
92
+                    anim: 2,
93
+                    content: '/dictionarynews/labelcreate',
94
+                    end: function(){
95
+                        renderTable();
96
+                    }
97
+                });
98
+        },
99
+        reload:function () {
100
+            var form = pfgs_serialize($('form'));
101
+            var city = '';
102
+            if(form.province != ''){
103
+                city = form.province;
104
+            }
105
+
106
+            if(form.city != ''){
107
+                city = form.city;
108
+            }
109
+            renderTable({id:city});
110
+        }
111
+    };
112
+
113
+    $('.demoTable .layui-btn').on('click', function(){
114
+        var type = $(this).data('type');
115
+        active[type] ? active[type].call(this) : '';
116
+    });
117
+
118
+    //修改排序
119
+    table.on('edit(menulist)', function(obj){
120
+        var data = obj.data;
121
+        $.post('/dictionarynews/editlabelform',{data:{id:data.id,sort:data.sort}},function (data) {
122
+            if(data.data != null){
123
+                layer.msg(ReturnInfo(data.data),{icon:5});
124
+                return false;
125
+            }
126
+            layer.msg(data.msg);
127
+            renderTable();
128
+        })
129
+
130
+    })
131
+
132
+    //显示或隐藏
133
+    form.on('switch(switchTest)', function(data){
134
+        var state = '';
135
+        if(data.elem.name == 1){
136
+            state = 2;
137
+        }else if(data.elem.name == 2){
138
+            state = 1;
139
+        }
140
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
141
+            $.post('/dictionarynews/editlabelform',{data:{id:data.value,is_show:state}},function (data) {
142
+                if(data.data != null){
143
+                    layer.msg(ReturnInfo(data.data),{icon:5});
144
+                    return false;
145
+                }
146
+                layer.msg(data.msg);
147
+                renderTable();
148
+            })
149
+        },function (aa) {
150
+            renderTable();
151
+        })
152
+    });
153
+
154
+    //修改
155
+    form.on('submit(editlabel)', function(data){
156
+        $.post('/dictionarynews/editlabelform',{'data':data.field},function (data) {
157
+            layer.msg(data.msg);
158
+        })
159
+        return false;
160
+    });
161
+
162
+    //添加
163
+    form.on('submit(addlabel)', function(data){
164
+        $.post('/dictionarynews/labelcreateform',{'data':data.field},function (data) {
165
+            if(data.data != null){
166
+                layer.msg(ReturnInfo(data.data),{icon:5});
167
+                return ;
168
+            }
169
+            layer.msg(data.msg);
170
+        })
171
+        return false;
172
+    });
173
+
174
+
175
+    //加载省数据
176
+    function loadProvince() {
177
+
178
+        $.ajax({
179
+            url : '/dictionarynews/pidlist',
180
+            type : 'post',
181
+            async: false,//使用同步的方式,true为异步方式
182
+            data : {'pid':0},//这里使用json对象
183
+            success : function(data){
184
+
185
+                var areaData = data.data;
186
+                var proHtml = '';
187
+                for (var i = 0; i < areaData.length; i++) {
188
+                    proHtml += '<option value="' + areaData[i].id +'">' + areaData[i].name + '</option>';
189
+                }
190
+                //初始化省数据
191
+                $('select[name=province]').append(proHtml);
192
+                form.render();
193
+            },
194
+            fail:function(){
195
+
196
+            }
197
+        });
198
+
199
+
200
+    }
201
+
202
+    loadProvince();
203
+
204
+    form.on('select(province)',function (data) {
205
+        $.post('/dictionarynews/pidlist',{'pid':data.value},function (data) {
206
+            $('select[name=city]').html('');
207
+            var proHtml = '<option value="">请选择子栏目</option>';
208
+            if(data.code == 200){
209
+                var areaData = data.data;
210
+                for (var i = 0; i < areaData.length; i++) {
211
+                    proHtml += '<option value="' + areaData[i].id +'">' + areaData[i].name + '</option>';
212
+                }
213
+                //初始化省数据
214
+                $('select[name=city]').append(proHtml);
215
+            }
216
+            form.render();
217
+        })
218
+    })
219
+});

+ 56 - 0
backend/web/js/china/other/about.js

@@ -0,0 +1,56 @@
1
+layui.use(['form','layer','laydate','table','laytpl','layedit','upload'],function(){
2
+    var form = layui.form,
3
+        // layer = parent.layer === undefined ? layui.layer : top.layer,
4
+        layer = layui.layer,
5
+        $ = layui.jquery,
6
+        laydate = layui.laydate,
7
+        laytpl = layui.laytpl,
8
+        table = layui.table,
9
+        layedit = layui.layedit
10
+        ,upload = layui.upload;
11
+
12
+
13
+        var ue = UE.getEditor('editor');   //编辑器
14
+        var ue = UE.getEditor('editor1');  //编辑器
15
+        var ue = UE.getEditor('editor2');  //编辑器
16
+        var ue = UE.getEditor('editor3');  //编辑器
17
+
18
+        form.on('submit(tijiao)',function (data) {
19
+        	var index = layer.msg('数据提交中,请稍候',{icon: 16,time:true,shade:0.8});      //数据提交提示
20
+        	var formData = new FormData($('#house_form')[0]);
21
+        	$.ajax({
22
+            	// cache : true,
23
+            	type : "post",
24
+            	url : "/othersiteset/addform",
25
+            	data : formData,  // 你的formid
26
+            	// async : false,          //async 默认为true异步,修改为false为同步
27
+            	contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
28
+            	processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
29
+            	error : function(request) {
30
+            	    layer.close(index);         //关闭数据提交信息
31
+            	    layer.alert("网络超时");
32
+            	},
33
+            	success : function(data) {
34
+            	    if (data.code == 200) {
35
+            	        layer.msg(data.msg);
36
+            	        parent.layui.table.reload('tablerReload');
37
+            	        TableClose();
38
+            	    } else if(data.code == 300){
39
+            	        layer.msg(data.msg);
40
+            	        layer.msg(ReturnInfo(data.data),{icon:5});
41
+            	    }
42
+            	}
43
+        	});
44
+                return false;
45
+        })
46
+
47
+})
48
+$(function(){
49
+	 //选项卡切换
50
+    $('.layui-tab-title .site-demo-active').on('click', function(){
51
+        $(this).addClass('layui-this').siblings().removeClass('layui-this');
52
+        var lay_id = $(this).attr('lay-id');
53
+        $('.layui-tab-item').removeClass('layui-show')
54
+        $('.layui-tab-content #'+lay_id).addClass('layui-show')
55
+    });
56
+})

+ 318 - 0
backend/web/js/china/other/houses.js

@@ -0,0 +1,318 @@
1
+
2
+layui.use(['form','layer','laydate','table','laytpl','layedit','upload'],function(){
3
+    var form = layui.form,
4
+        // layer = parent.layer === undefined ? layui.layer : top.layer,
5
+        layer = layui.layer,
6
+        $ = layui.jquery,
7
+        laydate = layui.laydate,
8
+        laytpl = layui.laytpl,
9
+        table = layui.table,
10
+        layedit = layui.layedit
11
+        ,upload = layui.upload;
12
+
13
+    //调用编辑器
14
+    var tableIds = 'housesList';
15
+    var reloadId = 'tablerReload';
16
+    //楼盘列表
17
+    var tableIns = table.render({
18
+        elem: '#'+tableIds,
19
+        url : '/otherwatermark/housrform',
20
+        cellMinWidth : 95,
21
+        method:'post',
22
+        page : true,
23
+        height : 600,
24
+        limit : 20,
25
+        id:reloadId,
26
+        // limits : [10,15,20,25],is_view
27
+        cols : [[
28
+            {type: "checkbox", width:50},
29
+            {field: 'id', title: 'ID', width:80, align:"center",sort: true},
30
+            {field: 'name', title: '标题', align:"center",templet:function(d){
31
+                    var html =  '<a href="http://www.pinfangw.com/house/'+d.id+'/" target="_blank">'+d.name+'</a>';
32
+                    return html;
33
+                }},
34
+            {field: 'status', title: '推广状态',width:200,sort:true, align:'center',templet:function (d) {
35
+                    if(d.status == 1){
36
+                        return  '<input type="checkbox" style="width:200px;"  checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="已推|未推">'
37
+                    } else {
38
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="已推|未推">'
39
+                    }
40
+                }},
41
+            {field: 'is_view', title: '楼盘状态',width:200,sort:true, align:'center',templet:function (d) {
42
+                        if(d.del == 2){
43
+                            return '<span style="color:red;">已删除</span>';
44
+                        }
45
+                        if(d.is_view == 1){
46
+                            return '上架';
47
+                        }else{
48
+                            return '<span style="color: yellow;">下架</span>';
49
+                        }
50
+                }},
51
+            {field: 'city_name', title: '区域',width:200,sort:true, align:'center'},
52
+            {field: 'create_at', title: '添加时间',width:150, align:'center'},
53
+
54
+            // {title: '操作', width:200, templet:'#housesListBar',fixed:"right",align:"center"}
55
+
56
+        ]]
57
+    });
58
+
59
+    tableIns.reload('tablerReload');        //重新加载
60
+
61
+
62
+    var $ = layui.$, active = {
63
+        reload:function () {
64
+            var form = pfgs_serialize($('form'));
65
+            var name = '';
66
+            var id   = '';
67
+            // console.log($('form').serializeArray());
68
+            if(form.input_house == 'name'){
69
+                name = form.input_house_text;
70
+            } else if(form.input_house == 'id'){
71
+                id = form.input_house_text;
72
+            }
73
+
74
+            var city = '';
75
+            if(form.province != ''){
76
+                city = form.province;
77
+            }
78
+
79
+            if(form.city != ''){
80
+                city = form.city;
81
+            }
82
+            table.reload('tablerReload',{
83
+                where:{
84
+                    sort:form.input_sort,
85
+                    id:id,
86
+                    name:name,
87
+                    city:city,
88
+                    start_time:form.start_time,
89
+                    end_time:form.end_time,
90
+                    housestatus:form.housestatus,
91
+                    status:form.status
92
+                },
93
+                page:{
94
+                    curr:1
95
+                }
96
+            })
97
+        },
98
+        export:function () {
99
+
100
+           var index = layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
101
+                var form = pfgs_serialize($('form'));
102
+
103
+                var para  = {};
104
+
105
+                if(form.input_house == 'name'){
106
+
107
+                    para.name = form.input_house_text;
108
+                }
109
+
110
+                if(form.input_house == 'id'){
111
+
112
+                    para.id = form.input_house_text
113
+                }
114
+
115
+                if(form.province != ''){
116
+
117
+                    para.city = form.province;
118
+                }
119
+
120
+                if(form.city != ''){
121
+
122
+                    para.city = form.city;
123
+                }
124
+
125
+                if(form.start_time != ''){
126
+                    para.start_time = form.start_time;
127
+                }
128
+
129
+                if(form.end_time != ''){
130
+                    para.end_time = form.end_time;
131
+                }
132
+
133
+                if(form.housestatus != ''){
134
+                    para.housestatus = form.housestatus;
135
+                }
136
+
137
+                if(form.status != ''){
138
+                    para.status = form.status;
139
+                }
140
+
141
+                var paraStr = '';
142
+                $.each(para,function (k,v) {
143
+                    if(v != ''){
144
+                        paraStr += k+'='+v+'&';
145
+                    }
146
+                })
147
+                paraStr = paraStr.substring(0,paraStr.length - 1);
148
+               layer.close(index);
149
+                window.open('/otherwatermark/export?'+paraStr);
150
+
151
+            })
152
+
153
+        }
154
+    };
155
+
156
+    $('.demoTable .layui-btn').on('click', function(){
157
+        var type = $(this).data('type');
158
+        active[type] ? active[type].call(this) : '';
159
+    });
160
+
161
+    //日期
162
+    laydate.render({
163
+        elem: '#date2'
164
+    });
165
+    laydate.render({
166
+        elem: '#date1'
167
+    });
168
+
169
+    //监听指定开关
170
+    form.on('switch(switchTest)', function(data){
171
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
172
+            $.post('/otherwatermark/pushstatus',{id:data.value,examineid:1},function (data) {
173
+                layer.msg(data.msg);
174
+                // parent.layui.
175
+                table.reload('tablerReload');
176
+            })
177
+        },function (aa) {
178
+            table.reload('tablerReload');        //重新加载
179
+        })
180
+    });
181
+
182
+
183
+    form.on('submit(del_alls_house)',function (data) {
184
+        var checkStatus = table.checkStatus('tablerReload');
185
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
186
+        if(typeof  checkStatus.data[0] == 'object'){
187
+            layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
188
+                var formdat = new FormData();
189
+                $.each(checkStatus.data,function (key,val) {
190
+                    formdat.append('hid[]',val.id);
191
+                })
192
+                $.ajax({
193
+                    cache : true,
194
+                    type : "post",
195
+                    url : "/house/housedel",
196
+                    data : formdat,  // 你的formid
197
+                    // async : false,          //async 默认为true异步,修改为false为同步
198
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
199
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
200
+                    error : function(request) {
201
+                        layer.close(index);         //关闭数据提交信息
202
+                        layer.alert("网络超时");
203
+                    },
204
+                    success : function(data) {
205
+                        if (data.code == 200) {
206
+                            layer.msg(data.msg);
207
+                            reloadTable(reloadId);
208
+                        } else {
209
+                            layer.msg(data.msg);
210
+                        }
211
+                    }
212
+                });
213
+
214
+            })
215
+            return false;
216
+        }
217
+        layer.msg('请选择需要删除的楼盘',{icon:5});
218
+        return false;
219
+    })
220
+
221
+
222
+    //加载省数据
223
+    function loadProvince() {
224
+
225
+        $.ajax({
226
+            url : '/categorycity/citypid',
227
+            type : 'post',
228
+            async: false,//使用同步的方式,true为异步方式
229
+            data : {'pid':0},//这里使用json对象
230
+            success : function(data){
231
+                var areaData = data.data;
232
+                var proHtml = '';
233
+                for (var i = 0; i < areaData.length; i++) {
234
+                    proHtml += '<option value="' + areaData[i].id +'">' + areaData[i].city_name + '</option>';
235
+                }
236
+                //初始化省数据
237
+                $('select[name=province]').append(proHtml);
238
+                form.render();
239
+            },
240
+            fail:function(){
241
+
242
+            }
243
+        });
244
+
245
+
246
+    }
247
+
248
+    loadProvince();
249
+
250
+    form.on('select(province)',function (data) {
251
+        $.post('/categorycity/citypid',{'pid':data.value},function (data) {
252
+            var areaData = data.data;
253
+            var proHtml = '';
254
+            $('select[name=city]').html('');
255
+            proHtml = '<option value="">请选择市/区/县</option>';
256
+            for (var i = 0; i < areaData.length; i++) {
257
+
258
+                proHtml += '<option value="' + areaData[i].id +'">' + areaData[i].city_name + '</option>';
259
+            }
260
+            //初始化省数据
261
+            $('select[name=city]').append(proHtml);
262
+            form.render();
263
+        })
264
+    })
265
+
266
+
267
+    // 动态添加批量删除按钮
268
+    var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
269
+        + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_house">推广状态</a>'
270
+        + '</div>'
271
+    $('.layui-form').append(_btn)
272
+
273
+
274
+    //批量修改状态
275
+    form.on('submit(del_alls_house)',function (data) {
276
+        var checkStatus = table.checkStatus('tablerReload');
277
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
278
+        if(typeof  checkStatus.data[0] == 'object'){
279
+            layer.confirm('您确定要修改的楼盘推广状态吗?',{btn:['确认','取消']},function(){
280
+                var formdat = new FormData();
281
+                var state = '';
282
+                $.each(checkStatus.data,function (key,val) {
283
+                    formdat.append('hid[]',val.id);
284
+                })
285
+                $.ajax({
286
+                    cache : true,
287
+                    type : "post",
288
+                    url : "/otherwatermark/pushstatuss",
289
+                    data : formdat,  // 你的formid
290
+                    // async : false,          //async 默认为true异步,修改为false为同步
291
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
292
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
293
+                    error : function(request) {
294
+                        layer.close(index);         //关闭数据提交信息
295
+                        layer.alert("网络超时");
296
+                    },
297
+                    success : function(data) {
298
+                        tableIns.reload('tablerReload');        //重新加载
299
+                        if (data.code == 200) {
300
+                            layer.msg(data.msg);
301
+                            reloadTable(reloadId);
302
+                        } else {
303
+                            layer.msg(data.msg);
304
+                        }
305
+
306
+
307
+                    }
308
+                });
309
+
310
+            })
311
+            return false;
312
+        }
313
+        layer.msg('请选择需要修改的楼盘推广状态',{icon:5});
314
+        return false;
315
+    })
316
+
317
+
318
+})

+ 146 - 0
backend/web/js/china/other/link.js

@@ -0,0 +1,146 @@
1
+
2
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
3
+
4
+    var laypage = layui.laypage //分页
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form;
9
+    //第一个实例
10
+    table.render({
11
+        elem: '#menulist'
12
+        ,url: '/othersiteset/friendshiplinkform' //数据接口
13
+        ,where:{token:csrfToken}
14
+        ,method:'post'
15
+        ,page: true //开启分页
16
+        ,height:600
17
+        ,text:'数据加载中'
18
+        ,id:'linkId'
19
+        ,cols: [[ //表头
20
+            {type:'numbers'}
21
+            ,{field: 'title', title: '标题', align:'center'}
22
+            ,{field: 'url', title: '地址', align:'center'}
23
+            ,{field: 'city_name', title: '区域', align:'center'}
24
+            ,{field: 'sys_name', title: '位置', align:'center'}
25
+            ,{fixed: 'right',title:'操作', width: 200, align:'center', toolbar: '#operate'}
26
+        ]]
27
+    });
28
+
29
+
30
+    //列表操作
31
+    table.on('tool(menulist)', function(obj){
32
+        var layEvent = obj.event,
33
+            data = obj.data;
34
+        if(layEvent === 'edit'){
35
+            layer.open({
36
+                type: 2,
37
+                title: '修改友情链接',
38
+                closeBtn: 1, //不显示关闭按钮
39
+                shade: [0],
40
+                area: ['600px', '500px'],
41
+                anim: 2,
42
+                content:'/othersiteset/friendshiplinkedit?id='+data.id,
43
+                end:function () {
44
+                        table.reload('linkId');
45
+                }
46
+            });
47
+        } else if(layEvent === 'del') {
48
+
49
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
50
+                $.post('/othersiteset/friendshiplinkdel',{'id':data.id},function (data) {
51
+                    if(data.data != null){
52
+                        layer.msg(ReturnInfo(data.data),{icon:5});
53
+                        return ;
54
+                    }
55
+                    layer.msg(data.msg);
56
+                    table.reload('linkId');
57
+                })
58
+            })
59
+
60
+        }
61
+    });
62
+
63
+
64
+
65
+
66
+    var $ = layui.$, active = {
67
+        addData: function(){ //获取选中数据
68
+            layer.open({
69
+                type: 2,
70
+                title: '添加友情链接',
71
+                closeBtn: 1, //不显示关闭按钮
72
+                shade: [0],
73
+                area: ['600px', '500px'],
74
+                anim: 2,
75
+                content: '/othersiteset/friendshiplinkadd', //iframe的url,no代表不显示滚动条
76
+                end: function(){ //此处用于演示
77
+                    table.reload('linkId');
78
+                }
79
+            });
80
+        }
81
+    };
82
+
83
+    $('.demoTable .layui-btn').on('click', function(){
84
+        var type = $(this).data('type');
85
+        active[type] ? active[type].call(this) : '';
86
+    });
87
+
88
+    form.on('submit(save_link)', function(data){
89
+        $.post('/othersiteset/friendshiplinkeditform',{'data':data.field},function (data) {
90
+            if(data.data != null){
91
+                layer.msg(ReturnInfo(data.data),{icon:5});
92
+                return ;
93
+            }
94
+            layer.msg(data.msg);
95
+        })
96
+        return false;
97
+    });
98
+
99
+    form.on('submit(tijiao)', function(data){
100
+        $.post('/othersiteset/friendshiplinkaddform',{'data':data.field},function (data) {
101
+            if(data.data != null){
102
+                layer.msg(ReturnInfo(data.data),{icon:5});
103
+                return ;
104
+            }
105
+            layer.msg(data.msg);
106
+        })
107
+        return false;
108
+    });
109
+
110
+
111
+
112
+    // form.on('submit(unload_tel)', function(data){
113
+    //     var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
114
+    //
115
+    //     var formData = new FormData($('#cityForm')[0]);
116
+    //
117
+    //     $.ajax({
118
+    //         cache : true,
119
+    //         type : "post",
120
+    //         url : "/othertel/addcityascription",
121
+    //         data : formData,  // 你的formid
122
+    //         // async : false,          //async 默认为true异步,修改为false为同步,
123
+    //         contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
124
+    //         processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
125
+    //         error : function(request) {
126
+    //             layer.close(index);         //关闭数据提交信息
127
+    //             layer.alert("网络超时");
128
+    //         },
129
+    //         success : function(data) {
130
+    //             if (data.code == 200) {
131
+    //                 layer.msg(data.msg);
132
+    //                 parent.layui.table.reload('menulist');
133
+    //                 // TableClose();
134
+    //
135
+    //             } else if(data.code == 300){
136
+    //                 layer.msg(data.msg);
137
+    //                 if(data.data.length > 0){
138
+    //                     layer.msg(ReturnInfo(data.data),{icon:5});
139
+    //                 }
140
+    //             }
141
+    //         }
142
+    //     });
143
+    //     return false;
144
+    // });
145
+
146
+});

+ 138 - 0
backend/web/js/china/other/mail.js

@@ -0,0 +1,138 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , layer = layui.layer //弹层
5
+        , table = layui.table //表格
6
+        , element = layui.element //元素操作
7
+        , form = layui.form;
8
+    //第一个实例
9
+    table.render({
10
+        elem: '#emailList'
11
+        , url: '/othermail/collecthomeform' //数据接口
12
+        , method: 'post'
13
+        , page: true //开启分页
14
+        ,height:600
15
+        , text: '数据加载中'
16
+        , limit: 20
17
+        , id: 'actionemail'
18
+        , cols: [[ //表头
19
+            {type: 'numbers'}
20
+            , {field: 'email', title: '邮箱', align: 'center'}
21
+            , {field: 'city_name', title: '区域', align: 'center'}
22
+            , {field: 'name', title: '姓名', align: 'center'}
23
+            , {fixed: 'right', title: '操作', width: 200, align: 'center', toolbar: '#operate'}
24
+        ]]
25
+    });
26
+
27
+
28
+    //列表操作
29
+    table.on('tool(emailList)', function (obj) {
30
+        var layEvent = obj.event,
31
+            data = obj.data;
32
+        if (layEvent === 'edit') {
33
+            layer.open({
34
+                type: 2,
35
+                title: '修改邮箱',
36
+                area: ['600px', '500px'],
37
+                content: '/othermail/collectedit?id=' + data.id, //iframe的url,no代表不显示滚动条
38
+                end: function () {
39
+                    table.reload('actionemail');
40
+                }
41
+            });
42
+        } else if (layEvent === 'del') {
43
+
44
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
45
+                $.post('/othermail/collectdel', {'id': data.id}, function (data) {
46
+                    layer.msg(data.msg);
47
+                    table.reload('actionemail');
48
+                })
49
+            })
50
+        }
51
+
52
+    });
53
+
54
+
55
+    var $ = layui.$, active = {
56
+        addData: function () { //获取选中数据
57
+            layer.open({
58
+                type: 2,
59
+                title: '添加邮箱',
60
+                area: ['600px', '500px'],
61
+                content: '/othermail/collectadd', //iframe的url,no代表不显示滚动条
62
+                end: function () {
63
+                    table.reload('actionemail');
64
+                }
65
+            });
66
+        },
67
+        reload: function () {//搜索
68
+            var form = pfgs_serialize($('form'));
69
+            var name = '';
70
+            var email = '';
71
+            if (form.input_house == 'name') {
72
+                name = form.input_house_text;
73
+            } else if (form.input_house == 'email') {
74
+                email = form.input_house_text;
75
+            }
76
+            table.reload('actionemail', {
77
+                    where: {
78
+                        name: name,
79
+                        email: email,
80
+                        city: form.input_city,
81
+                    },
82
+                    page: {
83
+                        curr: 1
84
+                    }
85
+                }
86
+            )
87
+        },
88
+    };
89
+
90
+    $('.demoTable .layui-btn').on('click', function () {
91
+        var type = $(this).data('type');
92
+        active[type] ? active[type].call(this) : '';
93
+    });
94
+
95
+    $('.imputSelect').find('input').removeAttr("readonly");
96
+    //发件人设置
97
+    form.on('submit(tijiao)', function (data) {
98
+        $.post('/othermail/homemailform', {'data': data.field}, function (data) {
99
+            layer.msg(data.msg);
100
+        })
101
+        return false;
102
+    });
103
+
104
+    //接受邮件测试
105
+    form.on('submit(add_send_email)', function (data) {
106
+        $.post('/othermail/testemail', {'data': data.field}, function (data) {
107
+            layer.msg(data.msg);
108
+        })
109
+        return false;
110
+    });
111
+
112
+
113
+    //收件人添加
114
+    form.on('submit(email_tijiao)', function (data) {
115
+        $.post('/othermail/collectaddform', {'data': data.field}, function (data) {
116
+            if (data.data != null) {
117
+                layer.msg(ReturnInfo(data.data), {icon: 5});
118
+                return;
119
+            }
120
+            layer.msg(data.msg);
121
+        })
122
+        return false;
123
+    });
124
+
125
+
126
+    //收件人修改
127
+    form.on('submit(email_edit)', function (data) {
128
+        $.post('/othermail/collecteditform', {'data': data.field}, function (data) {
129
+            if (data.data != null) {
130
+                layer.msg(ReturnInfo(data.data), {icon: 5});
131
+                return;
132
+            }
133
+            layer.msg(data.msg);
134
+        })
135
+        return false;
136
+    });
137
+
138
+});

+ 233 - 0
backend/web/js/china/other/setsite.js

@@ -0,0 +1,233 @@
1
+
2
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
3
+
4
+    var laypage = layui.laypage //分页
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+    //第一个实例
11
+    table.render({
12
+        elem: '#menulist'
13
+        ,url: '/othertel/homeform' //数据接口
14
+        ,where:{token:csrfToken}
15
+        ,method:'post'
16
+        ,page: true //开启分页
17
+        ,height:600
18
+        ,text:'数据加载中'
19
+        ,cols: [[ //表头
20
+            {type:'numbers'}
21
+            ,{field: 'name', title: '方案名称', align:'center'}
22
+            ,{field: 'tel', title: '内容', align:'center'}
23
+            ,{fixed: 'right',title:'操作', width: 200, align:'center', toolbar: '#operate'}
24
+        ]]
25
+    });
26
+
27
+    //添加图片上传
28
+    upload.render({
29
+        elem: '#weixin'
30
+        ,url: '/house/createimg'
31
+        ,data:{token:csrfToken}
32
+        ,field:'wechat'
33
+        ,size:1000              //限制上传图片的大小,单位为KB
34
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
35
+        ,auto:false
36
+        ,bindAction:'#addcity'
37
+        ,choose: function(obj){
38
+            obj.preview(function(index, file, result){
39
+                $('#weixin_img').attr('src', result); //图片链接(base64)
40
+            });
41
+        }
42
+    });
43
+
44
+    //添加图片上传
45
+    upload.render({
46
+        elem: '#logo'
47
+        ,url: '/house/createimg'
48
+        ,data:{token:csrfToken}
49
+        ,field:'logo'
50
+        ,size:1000              //限制上传图片的大小,单位为KB
51
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
52
+        ,auto:false
53
+        ,bindAction:'#addcity'
54
+        ,choose: function(obj){
55
+            obj.preview(function(index, file, result){
56
+                $('#logo_img').attr('src', result); //图片链接(base64)
57
+            });
58
+        }
59
+    });
60
+
61
+
62
+
63
+    //列表操作
64
+    table.on('tool(menulist)', function(obj){
65
+        var layEvent = obj.event,
66
+            data = obj.data;
67
+        if(layEvent === 'edit'){
68
+            layer.open({
69
+                type: 2,
70
+                title: '修改方案',
71
+                closeBtn: 1, //不显示关闭按钮
72
+                shade: [0],
73
+                area: ['600px', '500px'],
74
+                anim: 2,
75
+                content:'/othertel/edit?id='+data.id, //iframe的url,no代表不显示滚动条
76
+            });
77
+        } else if(layEvent === 'del') {
78
+
79
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
80
+                $.post('/othertel/del',{'id':data.id},function (data) {
81
+                    if(data.code == 200)
82
+                    {
83
+                        layer.msg(data.msg);
84
+                        table.reload('menulist');
85
+                    } else if(data.code == 300 ) {
86
+                        layer.msg(data.msg);
87
+                    }
88
+                })
89
+            })
90
+
91
+        }else if(layEvent === 'tel_city'){
92
+            layer.open({
93
+                type: 2,
94
+                title: '添加区域',
95
+                closeBtn: 1, //不显示关闭按钮
96
+                shade: [0],
97
+                area: ['600px', '500px'],
98
+                anim: 2,
99
+                content:'/othertel/cityascription?id='+data.id, //iframe的url,no代表不显示滚动条
100
+            });
101
+        }
102
+
103
+
104
+    });
105
+
106
+
107
+
108
+    var $ = layui.$, active = {
109
+        addData: function(){ //获取选中数据
110
+
111
+            layer.open({
112
+                type: 2,
113
+                title: '添加电话',
114
+                closeBtn: 1, //不显示关闭按钮
115
+                shade: [0],
116
+                area: ['600px', '500px'],
117
+                anim: 2,
118
+                content: '/othertel/add' //iframe的url,no代表不显示滚动条
119
+                // end: function(){ //此处用于演示
120
+                //     layer.open({
121
+                //         type: 2,
122
+                //         title: '很多时候,我们想最大化看,比如像这个页面。',
123
+                //         shadeClose: true,
124
+                //         shade: false,
125
+                //         maxmin: true, //开启最大化最小化按钮
126
+                //         area: ['893px', '600px'],
127
+                //         content: '//fly.layui.com/'
128
+                //     });
129
+                // }
130
+            });
131
+
132
+            // var checkStatus = table.checkStatus('idTest')
133
+            //     ,data = checkStatus.data;
134
+            // layer.alert(JSON.stringify(data));
135
+        }
136
+    };
137
+
138
+    $('.demoTable .layui-btn').on('click', function(){
139
+        var type = $(this).data('type');
140
+        active[type] ? active[type].call(this) : '';
141
+    });
142
+
143
+    form.on('submit(edittel)', function(data){
144
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
145
+        $.post('/othertel/editform',{'data':data.field},function (data) {
146
+            if(data.code == 200)
147
+            {
148
+                layer.msg(data.msg);
149
+                parent.layui.table.reload('menulist');
150
+            } else if(data.code == 300 ) {
151
+                layer.msg(data.msg);
152
+                layer.msg(ReturnInfo(data.data),{icon:5});
153
+            }
154
+        })
155
+        return false;
156
+    });
157
+
158
+    form.on('submit(tijiao)', function(data){
159
+
160
+        var formData = new FormData($('form')[0]);
161
+        $.ajax({
162
+            cache : true,
163
+            type : "post",
164
+            url : "/othersiteset/editform",
165
+            data : formData,  // 你的formid
166
+            // async : false,          //async 默认为true异步,修改为false为同步,
167
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
168
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
169
+            error : function(request) {
170
+                layer.close(index);         //关闭数据提交信息
171
+                layer.alert("网络超时");
172
+            },
173
+            success : function(data) {
174
+                if (data.code == 200) {
175
+                    layer.msg(data.msg);
176
+                } else if(data.code == 300){
177
+                    layer.msg(data.msg);
178
+                    if(data.data.length > 0){
179
+                        layer.msg(ReturnInfo(data.data),{icon:5});
180
+                    }
181
+                }
182
+            }
183
+        });
184
+        return false;
185
+    });
186
+
187
+
188
+
189
+    form.on('submit(unload_tel)', function(data){
190
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
191
+
192
+        var formData = new FormData($('#cityForm')[0]);
193
+
194
+        $.ajax({
195
+            cache : true,
196
+            type : "post",
197
+            url : "/othertel/addcityascription",
198
+            data : formData,  // 你的formid
199
+           // async : false,          //async 默认为true异步,修改为false为同步,
200
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
201
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
202
+            error : function(request) {
203
+                layer.close(index);         //关闭数据提交信息
204
+                layer.alert("网络超时");
205
+            },
206
+            success : function(data) {
207
+                if (data.code == 200) {
208
+                    layer.msg(data.msg);
209
+                    parent.layui.table.reload('menulist');
210
+                    // TableClose();
211
+
212
+                } else if(data.code == 300){
213
+                    layer.msg(data.msg);
214
+                    if(data.data.length > 0){
215
+                        layer.msg(ReturnInfo(data.data),{icon:5});
216
+                    }
217
+                }
218
+            }
219
+        });
220
+        return false;
221
+    });
222
+
223
+});
224
+
225
+$(function(){
226
+    //选项卡切换
227
+    $('.layui-tab-title .site-demo-active').on('click', function(){
228
+        $(this).addClass('layui-this').siblings().removeClass('layui-this');
229
+        var lay_id = $(this).attr('lay-id');
230
+        $('.layui-tab-item').removeClass('layui-show')
231
+        $('.layui-tab-content #'+lay_id).addClass('layui-show')
232
+    });
233
+})

+ 180 - 0
backend/web/js/china/other/sync.js

@@ -0,0 +1,180 @@
1
+layui.use(['layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+    //第一个实例
9
+    table.render({
10
+        elem: '#menulist'
11
+        ,url: '/othersync/indexform' //数据接口
12
+        ,where:{token:csrfToken}
13
+        ,method:'post'
14
+        ,page: true //开启分页
15
+        ,height:600
16
+        ,id:'tablerReload'
17
+        ,limit:20
18
+        ,text:'数据加载中'
19
+        ,cols: [[ //表头
20
+            {type:'numbers',title:'序号'}
21
+            ,{field: 'name', title: '楼盘名称', align:'center',width:200}
22
+            ,{field: 'city_name', title: '区域', align:'center',width:150}
23
+            ,{field: 'create_at', title: '添加时间', align:'left',width: 200}
24
+            ,{field: 'update_at', title: '修改时间', align:'left',width: 200}
25
+            ,{fixed: 'right',title:'操作', align:'center', toolbar: '#operate'}
26
+        ]]
27
+    });
28
+
29
+
30
+    //列表操作
31
+    table.on('tool(menulist)', function(obj){
32
+        var layEvent = obj.event,
33
+            data = obj.data;
34
+        if(layEvent === 'edit'){
35
+            var index = layui.layer.open({
36
+                title : '同步 [<span style="color:red">'+data.name+'</span>] 楼盘',
37
+                type : 2,
38
+                area:['','100%'],
39
+                maxmin: true,
40
+                content : "/othersync/houseinfo?hid="+data.id,
41
+            })
42
+
43
+            layui.layer.full(index);
44
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
45
+            $(window).on("resize",function(){
46
+                layui.layer.full(index);
47
+            })
48
+        }else if(layEvent === 'house_album'){
49
+            var index = layui.layer.open({
50
+                title : '同步 [<span style="color:red">'+data.name+'</span>] 楼盘-相册',
51
+                type : 2,
52
+                area:['','100%'],
53
+                maxmin: true,
54
+                content : "/othersync/housealbum?hid="+data.id,
55
+            })
56
+
57
+            layui.layer.full(index);
58
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
59
+            $(window).on("resize",function(){
60
+                layui.layer.full(index);
61
+            })
62
+        }else if(layEvent === 'house_type'){
63
+
64
+        }else if(layEvent === 'house_peitao'){
65
+
66
+        }
67
+
68
+    });
69
+
70
+
71
+    table.on('tool(citytellist)', function(obj){
72
+        var layEvent = obj.event,
73
+            data = obj.data;
74
+       if(layEvent === 'tel_city'){
75
+            layer.open({
76
+                type: 2,
77
+                title: '添加区域',
78
+                closeBtn: 1, //不显示关闭按钮
79
+                shade: [0],
80
+                area: ['600px', '500px'],
81
+                anim: 2,
82
+                content:'/othertel/cityascription?id='+data.id, //iframe的url,no代表不显示滚动条
83
+            });
84
+        }
85
+
86
+
87
+    });
88
+
89
+    var $ = layui.$, active = {
90
+        addData: function(){ //获取选中数据
91
+
92
+            layer.open({
93
+                type: 2,
94
+                title: '添加电话',
95
+                closeBtn: 1, //不显示关闭按钮
96
+                shade: [0],
97
+                area: ['600px', '500px'],
98
+                anim: 2,
99
+                content: '/othertel/add', //iframe的url,no代表不显示滚动条
100
+                end: function(){ //此处用于演示
101
+                    table.reload('tablerReload');
102
+                }
103
+            });
104
+        }
105
+    };
106
+
107
+    $('.demoTable .layui-btn').on('click', function(){
108
+        var type = $(this).data('type');
109
+        active[type] ? active[type].call(this) : '';
110
+    });
111
+
112
+    form.on('submit(edittel)', function(data){
113
+        $.post('/othertel/editform',{'data':data.field},function (data) {
114
+            if(data.code == 200)
115
+            {
116
+                layer.msg(data.msg);
117
+                parent.layui.table.reload('menulist');
118
+            } else if(data.code == 300 ) {
119
+                layer.msg(data.msg);
120
+                layer.msg(ReturnInfo(data.data),{icon:5});
121
+            }
122
+        })
123
+        return false;
124
+    });
125
+
126
+    form.on('submit(tijiao)', function(data){
127
+        $.post('/othertel/addform',{'data':data.field},function (data) {
128
+            if(data.code == 200)
129
+            {
130
+                layer.msg(data.msg);
131
+                parent.layui.table.reload('menulist');
132
+                // TableClose();
133
+            } else if(data.code == 300 ) {
134
+                layer.msg(data.msg);
135
+                layer.msg(ReturnInfo(data.data),{icon:5});
136
+            }
137
+        })
138
+        return false;
139
+    });
140
+
141
+
142
+
143
+    form.on('submit(unload_tel)', function(data){
144
+        var index = top.layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
145
+
146
+        var formData = new FormData($('#cityForm')[0]);
147
+
148
+        $.ajax({
149
+            cache : true,
150
+            type : "post",
151
+            url : "/othertel/addcityascription",
152
+            data : formData,  // 你的formid
153
+            async : false,
154
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
155
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
156
+            error : function(request) {
157
+                top.layer.close(index);         //关闭数据提交信息
158
+                layer.alert("网络超时");
159
+            },
160
+            success : function(data) {
161
+                top.layer.close(index);       //关闭数据提交信息
162
+                if (data.code == 200) {
163
+                    layer.msg(data.msg);
164
+                    parent.layui.table.reload('menulist');
165
+                    // TableClose();
166
+
167
+                } else if(data.code == 300){
168
+                    layer.msg(data.msg);
169
+                    if(data.data.length > 0){
170
+                        layer.msg(ReturnInfo(data.data),{icon:5});
171
+                    }
172
+                }
173
+            }
174
+        });
175
+        return false;
176
+    });
177
+
178
+
179
+
180
+});

+ 110 - 0
backend/web/js/china/other/syncOperate.js

@@ -0,0 +1,110 @@
1
+layui.use(['layer','element','form','table'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+
9
+    layer.photos({
10
+        photos: '#demo2',
11
+        closeBtn: 1
12
+        ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
13
+    });
14
+
15
+    //选项卡切换
16
+    $('.layui-tab-title .site-demo-active').on('click', function(){
17
+        $(this).addClass('layui-this').siblings().removeClass('layui-this');
18
+        var lay_id = $(this).attr('lay-id');
19
+        $('.layui-tab-item').removeClass('layui-show');
20
+        $('.layui-tab-content #'+lay_id).addClass('layui-show');
21
+    });
22
+
23
+    var verdict = $('#editor').html();
24
+    if(typeof verdict == "string"){
25
+        var ue = UE.getEditor('editor');  //编辑器
26
+    }
27
+
28
+
29
+    form.on('submit(sync_edit)', function(data){
30
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
31
+
32
+        var formData = new FormData($('#house_edit_form')[0]);
33
+
34
+        $.ajax({
35
+            cache : true,
36
+            type : "post",
37
+            url : "/othersync/houseadd",
38
+            data : formData,  // 你的formid
39
+            async : false,
40
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
41
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
42
+            error : function(request) {
43
+                layer.alert("请联系管理员");
44
+            },
45
+            success : function(data) {
46
+                if(data.data != null)
47
+                {
48
+                    layer.msg(ReturnInfo(data.data),{icon:5});
49
+                    return false;
50
+                }
51
+                layer.msg(data.msg);
52
+                TableClose();
53
+
54
+            }
55
+        });
56
+        return false;
57
+    });
58
+    var data = {};
59
+    form.on('checkbox(editlist)', function(obj){
60
+            var paren = $(this).parent().parent().parent();
61
+            var name = paren.attr('name');
62
+            if(obj.elem.checked == true){
63
+                var arr = [];
64
+                data[name] = paren.find("input[name="+name+"]").val();
65
+                $.each(paren.find('input:checkbox:checked'),function(){
66
+                    if($(this).val() != 'on'){
67
+                        arr.push($(this).val());
68
+                    }
69
+                });
70
+                if(arr.length>0){
71
+                    data[name] = arr;
72
+                }
73
+            }else if(obj.elem.checked == false){
74
+                delete data[name];
75
+            }
76
+            // console.log( console.log(data));
77
+    });
78
+
79
+    // 添加页面提交
80
+    form.on('submit(sync_infoedit)',function (arr) {
81
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
82
+        var formData = new FormData($('#house_edit_form')[0]);
83
+        $.post("/othersync/houseadd",{data:data,unid:formData.get('uniqid'),hid:formData.get('hid'),sync:formData.get('sync')},function(datas){
84
+            if(datas.data != null)
85
+            {
86
+                layer.msg(ReturnInfo(datas.data),{icon:5});
87
+                return false;
88
+            }
89
+            layer.msg(datas.msg);
90
+            // TableClose();
91
+        })
92
+        return false;
93
+    })
94
+
95
+    // 添加页面提交
96
+    form.on('submit(edit_Album)',function (data) {
97
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
98
+        $.post("/othersync/houseallbumform",{data:data.field,},function(datas){
99
+            if(datas.data != null)
100
+            {
101
+                layer.msg(ReturnInfo(datas.data),{icon:5});
102
+                return false;
103
+            }
104
+            layer.msg(datas.msg);
105
+            // TableClose();
106
+        })
107
+        return false;
108
+    })
109
+
110
+});

+ 236 - 0
backend/web/js/china/other/tel.js

@@ -0,0 +1,236 @@
1
+
2
+layui.use([ 'laypage', 'layer', 'table',  'element','form','treetable'], function(){
3
+
4
+    var laypage = layui.laypage //分页
5
+        ,$ = layui.jquery
6
+        ,layer = layui.layer //弹层
7
+        ,table = layui.table //表格
8
+        ,element = layui.element //元素操作
9
+        ,form = layui.form
10
+        ,treetable = layui.treetable;
11
+
12
+
13
+
14
+
15
+    //第一个实例
16
+    table.render({
17
+        elem: '#menulist'
18
+        ,url: '/othertel/homeform' //数据接口
19
+        ,where:{token:csrfToken}
20
+        ,method:'post'
21
+        ,page: true //开启分页
22
+        ,height:600
23
+        ,id:'tablerReload'
24
+        ,limit:20
25
+        ,text:'数据加载中'
26
+        ,cols: [[ //表头
27
+            {type:'numbers',title:'序号'}
28
+            ,{field: 'name', title: '方案名称', align:'center',width:200}
29
+            ,{field: 'tel', title: '内容',align:'left'}
30
+            ,{title:'操作', width: 200 ,align:'center', toolbar: '#operate'}
31
+        ]]
32
+    });
33
+
34
+    table.reload('tablerReload');        //重新加载
35
+
36
+    if($('#citytellist').attr('lay-filter') == 'citytellist'){
37
+        var renderTable = function (wheres = {}) {
38
+            treetable.render({
39
+                treeColIndex: 1,
40
+                treeSpid:0,
41
+                treeIdName: 'id',
42
+                treePidName: 'pid',
43
+                treeDefaultClose: true,
44
+                treeLinkage: false,
45
+                elem: '#citytellist',
46
+                url: '/othertel/citytelhomeform',
47
+                page: false,
48
+                height:600,
49
+                where:wheres,
50
+                id:'tablerReload',
51
+                cols: [[
52
+                    {type:'numbers'}
53
+                    // {field: 'id', title: 'ID', width:80, sort: true,align:'center'}
54
+                    ,{field: 'city_name', title: '区域名称',align:'center'}
55
+                    ,{field: 'name', title: '方案名称',align:'center'}
56
+                    ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
57
+                ]],
58
+                done: function () {
59
+                    layer.closeAll('loading');
60
+                }
61
+            });
62
+        };
63
+
64
+        renderTable();
65
+    }
66
+
67
+    //列表操作
68
+    table.on('tool(menulist)', function(obj){
69
+        var layEvent = obj.event,
70
+            data = obj.data;
71
+        if(layEvent === 'edit'){
72
+            layer.open({
73
+                type: 2,
74
+                title: '修改方案',
75
+                closeBtn: 1, //不显示关闭按钮
76
+                shade: [0],
77
+                area: ['600px', '500px'],
78
+                anim: 2,
79
+                content:'/othertel/edit?id='+data.id,
80
+                end:function () {
81
+                    table.reload('tablerReload');
82
+                }
83
+            });
84
+        } else if(layEvent === 'del') {
85
+
86
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
87
+                $.post('/othertel/del',{'id':data.id},function (data) {
88
+                    layer.msg(data.msg);
89
+                    table.reload('tablerReload');
90
+                })
91
+            })
92
+
93
+        }else if(layEvent === 'tel_city'){
94
+            layer.open({
95
+                type: 2,
96
+                title: '添加区域',
97
+                closeBtn: 1, //不显示关闭按钮
98
+                shade: [0],
99
+                area: ['600px', '500px'],
100
+                anim: 2,
101
+                content:'/othertel/cityascription?id='+data.id, //iframe的url,no代表不显示滚动条
102
+            });
103
+        }
104
+
105
+
106
+    });
107
+
108
+
109
+    table.on('tool(citytellist)', function(obj){
110
+        var layEvent = obj.event,
111
+            data = obj.data;
112
+       if(layEvent === 'tel_city'){
113
+            layer.open({
114
+                type: 2,
115
+                title: '加载方案',
116
+                closeBtn: 1, //不显示关闭按钮
117
+                shade: [0],
118
+                area: ['600px', '500px'],
119
+                anim: 2,
120
+                content:'/othertel/cityascription?id='+data.id,
121
+                end:function () {
122
+                    renderTable();
123
+                }
124
+            });
125
+        }
126
+    });
127
+
128
+    var $ = layui.$, active = {
129
+        addData: function(){ //获取选中数据
130
+
131
+            layer.open({
132
+                type: 2,
133
+                title: '添加电话',
134
+                closeBtn: 1, //不显示关闭按钮
135
+                shade: [0],
136
+                area: ['600px', '500px'],
137
+                anim: 2,
138
+                content: '/othertel/add', //iframe的url,no代表不显示滚动条
139
+                end: function(){ //此处用于演示
140
+                    table.reload('tablerReload');
141
+                }
142
+            });
143
+        },
144
+        reloadb:function () {
145
+            var form = pfgs_serialize($('form'));
146
+            var city = '';
147
+            var name = '';
148
+            if(form.province != ''){
149
+                city = form.province;
150
+            }
151
+
152
+            if(form.name != ''){
153
+                name = form.name;
154
+            }
155
+
156
+            // if(form.city != ''){
157
+            //     city = form.city;
158
+            // }
159
+            renderTable({id:city,name:name});
160
+        }
161
+    };
162
+
163
+    $('.demoTable .layui-btn').on('click', function(){
164
+        var type = $(this).data('type');
165
+        active[type] ? active[type].call(this) : '';
166
+    });
167
+
168
+    form.on('submit(edittel)', function(data){
169
+        $.post('/othertel/editform',{'data':data.field},function (data) {
170
+            if(data.code == 200)
171
+            {
172
+                layer.msg(data.msg);
173
+                parent.layui.table.reload('menulist');
174
+            } else if(data.code == 300 ) {
175
+                layer.msg(data.msg);
176
+                layer.msg(ReturnInfo(data.data),{icon:5});
177
+            }
178
+        })
179
+        return false;
180
+    });
181
+
182
+    form.on('submit(tijiao)', function(data){
183
+        $.post('/othertel/addform',{'data':data.field},function (data) {
184
+            if(data.code == 200)
185
+            {
186
+                layer.msg(data.msg);
187
+                parent.layui.table.reload('menulist');
188
+                // TableClose();
189
+            } else if(data.code == 300 ) {
190
+                layer.msg(data.msg);
191
+                layer.msg(ReturnInfo(data.data),{icon:5});
192
+            }
193
+        })
194
+        return false;
195
+    });
196
+
197
+
198
+
199
+    form.on('submit(unload_tel)', function(data){
200
+        var index = top.layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
201
+
202
+        var formData = new FormData($('#cityForm')[0]);
203
+
204
+        $.ajax({
205
+            cache : true,
206
+            type : "post",
207
+            url : "/othertel/addcityascription",
208
+            data : formData,  // 你的formid
209
+            async : false,
210
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
211
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
212
+            error : function(request) {
213
+                top.layer.close(index);         //关闭数据提交信息
214
+                layer.alert("网络超时");
215
+
216
+            },
217
+            success : function(data) {
218
+                top.layer.close(index);       //关闭数据提交信息
219
+                if (data.code == 200) {
220
+                    layer.msg(data.msg);
221
+                    parent.layui.table.reload('menulist');
222
+                    // TableClose();
223
+
224
+                } else if(data.code == 300){
225
+                    layer.msg(data.msg);
226
+                    if(data.data.length > 0){
227
+                        layer.msg(ReturnInfo(data.data),{icon:5});
228
+                    }
229
+                }
230
+            }
231
+        });
232
+        return false;
233
+    });
234
+
235
+
236
+});

+ 67 - 0
backend/web/js/china/other/watermark.js

@@ -0,0 +1,67 @@
1
+layui.use(['form','layer','laytpl','layedit','upload'],function(){
2
+    var form = layui.form,
3
+        layer =  layui.layer ,
4
+        $ = layui.jquery,
5
+        upload = layui.upload;
6
+
7
+
8
+    //添加图片上传
9
+     upload.render({
10
+        elem: '#test1'
11
+        ,url: '/house/createimg'
12
+        ,data:{token:csrfToken}
13
+        ,field:'template'
14
+        ,size:1000              //限制上传图片的大小,单位为KB
15
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
16
+        ,auto:false
17
+        ,bindAction:'#addcity'
18
+        ,choose: function(obj){
19
+            obj.preview(function(index, file, result){
20
+                $('#demo1').attr('src', result); //图片链接(base64)
21
+            });
22
+        }
23
+    });
24
+
25
+     // 点击放大图片
26
+    $('#demo1').on('click', function(){
27
+        var _src = $(this).attr('src');
28
+        layui.layer.open({
29
+            type: 1,
30
+            title: false,           //是否显示标题
31
+            area: ['50%', '40%'],
32
+            shade: 0.6,           //透明度
33
+            closeBtn: 1,         //按钮 1有,0无
34
+            shadeClose: true,
35
+            content: '<img style="width:90%;background:rgba(0,0,0,0.5);display:block;margin:13% auto 0" src="'+_src+'">',
36
+        });
37
+    });
38
+
39
+    form.on('submit(watermark)',function (data) {
40
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
41
+        var formData = new FormData($('#start_form')[0]);
42
+        $.ajax({
43
+            cache : true,
44
+            type : "post",
45
+            url : "/othersiteset/editwatermarkform",
46
+            data : formData,  // 你的formid
47
+            // async : false,          //async 默认为true异步,修改为false为同步
48
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
49
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
50
+            error : function(request) {
51
+                layer.close(index);         //关闭数据提交信息
52
+                layer.alert("网络超时");
53
+            },
54
+            success : function(data) {
55
+                if (data.code == 200) {
56
+                    layer.msg(data.msg);
57
+                } else if(data.code == 300){
58
+                    layer.msg(data.msg);
59
+                    layer.msg(ReturnInfo(data.data),{icon:5});
60
+                }
61
+            }
62
+        });
63
+                return false;
64
+    })
65
+
66
+})
67
+

+ 297 - 0
backend/web/js/china/photoalbum.js

@@ -0,0 +1,297 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , layer = layui.layer //弹层
5
+        , table = layui.table //表格
6
+        , element = layui.element //元素操作
7
+        , form = layui.form
8
+        , upload = layui.upload;
9
+
10
+    var tableIds = 'photoalbumlist';
11
+    //第一个实例
12
+    table.render({
13
+        elem: '#' + tableIds
14
+        , url: '/dictionary/photoalbumform' //数据接口
15
+        , where: {token: csrfToken}
16
+        , method: 'post'
17
+        , page: true //开启分页
18
+        , text: '数据加载中'
19
+        , id: 'tablerReload'
20
+        , cols: [[ //表头
21
+            // {type: "checkbox", width:50}
22
+            {type: 'numbers'}
23
+            , {field: 'name', title: '相册分类名称', align: 'center'}
24
+            , {field: 'sort', title: '排序', width: 80, edit: 'text', align: 'center', sort: true, templet: "#sortBox"}
25
+            , {
26
+                field: 'check_img', title: '选中', width: 150, align: 'center', templet: function (d) {
27
+                    return '<img class="layui_magnify" src="' + d.check_img + '">';
28
+                }
29
+            }
30
+            , {
31
+                field: 'uncheck_img', title: '未选中', width: 150, align: 'center', templet: function (d) {
32
+                    return '<img class="layui_magnify" src="' + d.uncheck_img + '">';
33
+                }
34
+            }
35
+            , {
36
+                field: 'is_show',
37
+                title: '是否下架',
38
+                width: 100,
39
+                align: 'center',
40
+                templet: "#Toexamine",
41
+                templet: function (d) {
42
+                    if (d.is_show == 2) {
43
+                        return '<input type="checkbox"  value="' + d.id + '" name="' + d.is_show + '"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
44
+                    } else {
45
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="' + d.is_show + '"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
46
+                    }
47
+                }
48
+            }
49
+            , {field: 'create_at', title: '添加时间', width: 200, align: 'center'}
50
+            , {field: 'update_at', title: '更新时间', width: 200, align: 'center'}
51
+            , {fixed: 'right', title: '操作', width: 180, align: 'center', toolbar: '#operate'}
52
+
53
+        ]]
54
+    });
55
+
56
+    table.reload('tablerReload');        //重新加载
57
+
58
+    //列表操作
59
+    table.on('tool(' + tableIds + ')', function (obj) {
60
+        var layEvent = obj.event,
61
+            data = obj.data;
62
+        if (layEvent === 'edit') {
63
+            layer.open({
64
+                type: 2,
65
+                title: '修改户型',
66
+                closeBtn: 1, //不显示关闭按钮
67
+                shade: [0],
68
+                area: ['600px', '500px'],
69
+                anim: 2,
70
+                content: ['/dictionary/photoalbumedit?id=' + data.id, 'yes'], //iframe的url,no代表不显示滚动条
71
+            });
72
+        } else if (layEvent === 'del') {
73
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
74
+                $.post('/dictionary/photoalbumdel', {'id': data.id, type: 'del'}, function (data) {
75
+                    if (data.code == 200) {
76
+                        layer.msg(data.msg);
77
+                        table.reload('tablerReload');
78
+                    } else if (data.code == 300) {
79
+                        layer.msg(data.msg);
80
+                    }
81
+                })
82
+            })
83
+        }
84
+
85
+
86
+    });
87
+
88
+    /* 列表操作  edit  修改后执行  */
89
+    table.on('edit(' + tableIds + ')', function (obj) {
90
+        var data = obj.data;
91
+        if (obj.field == "sort") {
92
+            $.post('/dictionary/photoalbumdel', {id: data.id, sort: data.sort, type: 'sort'}, function (data) {
93
+                if (data.code == 200) {
94
+                    layer.msg(data.msg);
95
+                } else if (data.code == 300) {
96
+                    layer.msg(data.msg);
97
+                }
98
+            })
99
+        }
100
+    })
101
+
102
+    //显示或隐藏
103
+    form.on('switch(switchTest)', function (data) {
104
+        var state = '';
105
+        if (data.elem.name == 1) {
106
+            state = 2;
107
+        } else if (data.elem.name == 2) {
108
+            state = 1;
109
+        }
110
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
111
+            $.post('/dictionary/photoalbumdel', {
112
+                id: data.value,
113
+                type: 'is_show',
114
+                is_show: state
115
+            }, function (data) {
116
+                if (data.data != null) {
117
+                    layer.msg(data.msg);
118
+                    return false;
119
+                }
120
+                layer.msg(data.msg);
121
+                table.reload('tablerReload');
122
+            })
123
+        }, function (aa) {
124
+            table.reload('tablerReload');
125
+        })
126
+    });
127
+
128
+
129
+    var $ = layui.$, active = {
130
+        addData: function () { //获取选中数据
131
+            layer.open({
132
+                type: 2,
133
+                title: '添加相册分类',
134
+                closeBtn: 1, //不显示关闭按钮
135
+                shade: [0],
136
+                area: ['600px', '500px'],
137
+                anim: 2,
138
+                content: ['/dictionary/photoalbumadd', 'yes'], //iframe的url,no代表不显示滚动条
139
+            });
140
+
141
+            // var checkStatus = table.checkStatus('idTest')
142
+            //     ,data = checkStatus.data;
143
+            // layer.alert(JSON.stringify(data));
144
+        }
145
+    };
146
+
147
+    $('.demoTable .layui-btn').on('click', function () {
148
+        var type = $(this).data('type');
149
+        active[type] ? active[type].call(this) : '';
150
+    });
151
+
152
+    // //修改
153
+    // form.on('submit(editphotoalbum)', function(data){
154
+    //     $.post('/dictionary/photoalbumeditform',{'data':data.field,'token':csrfToken},function (data) {
155
+    //         if(data.code == 200)
156
+    //         {
157
+    //             layer.msg(data.msg);
158
+    //             parent.layui.table.reload('tablerReload');
159
+    //             TableClose();
160
+    //             // parent.layui.table.reload(tableIds);
161
+    //         } else if(data.code == 300 ) {
162
+    //             layer.msg(data.msg);
163
+    //         }
164
+    //     })
165
+    //     return false;
166
+    // });
167
+
168
+    // //添加
169
+    // form.on('submit(addphotoalbum)', function(data){
170
+    //     $.post('/dictionary/photoalbumaddform',{'data':data.field,'token':csrfToken},function (data) {
171
+    //         if(data.code == 200)
172
+    //         {
173
+    //             layer.msg(data.msg);
174
+    //             // parent.layui.table.reload(tableIds);
175
+    //             parent.layui.table.reload('tablerReload');
176
+    //             TableClose();
177
+    //         } else if(data.code == 300 ) {
178
+    //             layer.msg(data.msg);
179
+    //         }
180
+    //     })
181
+    //     return false;
182
+    // });
183
+
184
+
185
+    //添加图片上传
186
+    upload.render({
187
+        elem: '#test1'
188
+        , url: '/house/createimg'
189
+        , data: {token: csrfToken}
190
+        , field: 'check_img'
191
+        , size: 1000              //限制上传图片的大小,单位为KB
192
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
193
+        , auto: false
194
+        , bindAction: '#addcity'
195
+        , choose: function (obj) {
196
+            obj.preview(function (index, file, result) {
197
+                $('#demo1').attr('src', result); //图片链接(base64)
198
+            });
199
+        }
200
+    });
201
+
202
+    //添加图片上传
203
+    upload.render({
204
+        elem: '#test2'
205
+        , url: '/house/createimg'
206
+        , data: {token: csrfToken}
207
+        , field: 'uncheck_img'
208
+        , size: 1000              //限制上传图片的大小,单位为KB
209
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
210
+        , auto: false
211
+        , bindAction: '#addcity'
212
+        , choose: function (obj) {
213
+            obj.preview(function (index, file, result) {
214
+                $('#demo2').attr('src', result); //图片链接(base64)
215
+            });
216
+        }
217
+    });
218
+
219
+
220
+    // 点击放大图片
221
+    $('.layui_magnify').on('click', function () {
222
+        var _src = $(this).attr('src');
223
+        layui.layer.open({
224
+            type: 1,
225
+            title: false,           //是否显示标题
226
+            area: ['60%', '80%'],
227
+            shade: 0.6,           //透明度
228
+            closeBtn: 1,         //按钮 1有,0无
229
+            shadeClose: true,
230
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
231
+        });
232
+    });
233
+
234
+
235
+    //添加
236
+    form.on('submit(addphotoalbum)', function (data) {
237
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
238
+        var formData = new FormData($('#add_photo')[0]);
239
+        //layer.msg(data.msg);
240
+        $.ajax({
241
+            cache: true,
242
+            type: "post",
243
+            url: '/dictionary/photoalbumaddform',
244
+            data: formData,  // 你的formid
245
+            // async : false,          //async 默认为true异步,修改为false为同步
246
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
247
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
248
+            // error : function(request) {
249
+            //     layer.close(index);         //关闭数据提交信息
250
+            //     layer.alert("网络超时");
251
+            // },
252
+            success: function (data) {
253
+                if (data.code == 200) {
254
+                    layer.msg(data.msg);
255
+                    parent.layui.table.reload('tablerReload');
256
+                    TableClose();
257
+                } else if (data.code == 300) {
258
+                    layer.msg(data.msg);
259
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
260
+                }
261
+            }
262
+        });
263
+        return false;
264
+    });
265
+
266
+
267
+    //修改
268
+    form.on('submit(editphotoalbum)', function (data) {
269
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
270
+
271
+        var formData = new FormData($('#photo_form')[0]);
272
+        $.ajax({
273
+            cache: true,
274
+            type: "post",
275
+            url: '/dictionary/photoalbumeditform',
276
+            data: formData,  // 你的formid
277
+            // async : false,          //async 默认为true异步,修改为false为同步
278
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
279
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
280
+            error: function (request) {
281
+                layer.close(index);         //关闭数据提交信息
282
+                layer.alert("网络超时");
283
+            },
284
+            success: function (data) {
285
+                if (data.code == 200) {
286
+                    layer.msg(data.msg);
287
+                    parent.layui.table.reload('tablerReload');
288
+                    TableClose();
289
+                } else if (data.code == 300) {
290
+                    layer.msg(data.msg);
291
+                    layer.msg(ReturnInfo(data.data));
292
+                }
293
+            }
294
+        });
295
+        return false;
296
+    });
297
+});

+ 279 - 0
backend/web/js/china/presell.js

@@ -0,0 +1,279 @@
1
+layui.use(['form', 'layer', 'laydate', 'table', 'laytpl', 'layedit', 'upload'], function () {
2
+    var form = layui.form,
3
+        // layer = parent.layer === undefined ? layui.layer : top.layer,
4
+        layer = layui.layer,
5
+        $ = layui.jquery,
6
+        laydate = layui.laydate,
7
+        laytpl = layui.laytpl,
8
+        table = layui.table,
9
+        layedit = layui.layedit
10
+        , upload = layui.upload;
11
+    var house_id = $('input[name="house_id"]').val();
12
+
13
+    //调用编辑器
14
+    var tableIds = 'presellList';
15
+    var reloadId = 'tablerReload';
16
+    //楼盘列表
17
+    var tableIns = table.render({
18
+        elem: '#' + tableIds,
19
+        url: '/house/presellform',
20
+        cellMinWidth: 90,
21
+        method: 'post',
22
+        where: {hid: house_id},
23
+        page: true,
24
+        height: 600,
25
+        limit: 20,
26
+        id: reloadId,
27
+        cols: [[
28
+            // {type: "checkbox", width:50},
29
+            {type: 'numbers', title: '序号', width: 100},
30
+            // {field: 'id', title: 'ID', width:100, align:"center",sort: true},
31
+            {field: 'permit', title: '预售许可证', width: 250, sort: true, align: 'center'},
32
+            {field: 'time', title: '发证时间', width: 200, sort: true, align: 'center'},
33
+            {field: 'building_num', title: '绑定楼栋', sort: true, align: 'center'},
34
+
35
+            // {title: '操作', width: 150, templet: '#housesListBar', fixed: "right", align: "center"}
36
+
37
+        ]]
38
+    });
39
+
40
+    tableIns.reload('tablerReload');        //重新加载
41
+
42
+
43
+    var $ = layui.$, active = {
44
+        addData: function () { //获取选中数据
45
+            var index = parent.layui.layer.open({
46
+                title: "添加预售证",
47
+                type: 2,
48
+                area: ['600px', '500px'],
49
+                content: "/house/preselladd?hid=" + house_id,
50
+                end: function () {
51
+                    layui.table.reload('tablerReload');
52
+                }
53
+            })
54
+
55
+            // parent.layui.layer.full(index);
56
+            // // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
57
+            // $(window).on("resize",function(){
58
+            //     parent.layui.layer.full(index);
59
+            // })
60
+        }
61
+    };
62
+    $('.demoTable .layui-btn').on('click', function () {
63
+        var type = $(this).data('type');
64
+        active[type] ? active[type].call(this) : '';
65
+    });
66
+
67
+
68
+    //列表操作
69
+    table.on('tool(' + tableIds + ')', function (obj) {
70
+        var data = obj.data;
71
+        if (obj.event === 'presellEdit') {       //修改排序
72
+            var index = layui.layer.open({
73
+                type: 2,
74
+                title: '修改用户信息',
75
+                area: ['600px', '500px'],
76
+                anim: 2,
77
+                content: '/house/preselledit?id=' + data.id //iframe的url,no代表不显示滚动条
78
+                , end: function () {
79
+                    layui.table.reload('tablerReload');
80
+                }
81
+            })
82
+        } else if (obj.event === 'presellDel') {
83
+
84
+            layer.confirm('您确认要删除吗?', {btn: ['确认', '取消']}, function () {
85
+                $.post('/house/preselldel', {id: data.id}, function (data) {
86
+                    if (data.code == 200) {
87
+                        layer.msg(data.msg);
88
+                        // parent.layui.
89
+                        table.reload('tablerReload');
90
+                        // TableClose();
91
+                    } else {
92
+                        layer.msg(data.msg);
93
+                    }
94
+                })
95
+            })
96
+            // $.post('/house/preselldel',{id:data.id},function (data) {
97
+            //     if (data.code == 200) {
98
+            //         layer.msg(data.msg);
99
+            //         // parent.layui.
100
+            //         table.reload('tablerReload');
101
+            //         // TableClose();
102
+            //     } else {
103
+            //         layer.msg(data.msg);
104
+            //     }
105
+            // })
106
+        }
107
+    })
108
+    //修改页面显示插件
109
+    laydate.render({
110
+        elem: '#test1'
111
+    });
112
+
113
+
114
+    // // 批量删除
115
+    // form.on('submit(del_alls_house)',function (data) {
116
+    //     var checkStatus = table.checkStatus('tablerReload');
117
+    //     var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
118
+    //     if(typeof  checkStatus.data[0] == 'object'){
119
+    //         layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
120
+    //             var formdat = new FormData();
121
+    //             $.each(checkStatus.data,function (key,val) {
122
+    //                 formdat.append('hid[]',val.id);
123
+    //             })
124
+    //             $.ajax({
125
+    //                 cache : true,
126
+    //                 type : "post",
127
+    //                 url : "/house/housede",
128
+    //                 data : formdat,  // 你的formid
129
+    //                 // async : false,          //async 默认为true异步,修改为false为同步
130
+    //                 contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
131
+    //                 processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
132
+    //                 error : function(request) {
133
+    //                     layer.close(index);         //关闭数据提交信息
134
+    //                     layer.alert("网络超时");
135
+    //                 },
136
+    //                 success : function(data) {
137
+    //                     if (data.code == 200) {
138
+    //                         layer.msg(data.msg);
139
+    //                         reloadTable(reloadId);
140
+    //                     } else {
141
+    //                         layer.msg(data.msg);
142
+    //                     }
143
+    //                 }
144
+    //             });
145
+    //
146
+    //         })
147
+    //         return false;
148
+    //
149
+    //     }
150
+    //     layer.msg('请选择需要删除的楼盘',{icon:5});
151
+    //     return false;
152
+    // })   // 批量删除 END
153
+
154
+
155
+    // 添加预售证
156
+    $('.layui_w_addbtn').on('click', function () {
157
+        datumInsert()
158
+        // alert(516)
159
+    })
160
+    //展示数据删除按钮
161
+    $('table.layui-table tbody').on('click', '.del', function () {
162
+        var _this = $(this)
163
+        var oid = _this.attr('lay-oid');
164
+
165
+        var index = layer.confirm('确定要删除吗?', {btn: ['确定', '取消']}, function () {
166
+            // layer.close(index)
167
+
168
+            if (oid != '') {
169
+                $.post('/house/peitaodel', {data: oid}, function (data) {
170
+                    if (data.code == 200) {
171
+                        _this.parents('tr').remove();
172
+                        layer.msg(data.msg);
173
+                        table.reload('tablerReload');
174
+                    } else if (data.code == 300) {
175
+                        layer.msg(data.msg);
176
+                    }
177
+                })
178
+            } else {
179
+                _this.parents('tr').remove();
180
+                layer.msg('已成功删除!');
181
+            }
182
+
183
+        })
184
+    })
185
+
186
+
187
+    // 数据提交
188
+    form.on('submit(preselladd)', function (data) {
189
+
190
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
191
+
192
+        var formData = new FormData($('#preselladd')[0]);
193
+
194
+        $.ajax({
195
+            cache: true,
196
+            type: "post",
197
+            url: "/house/preselladdform",
198
+            data: formData,  // 你的formid
199
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
200
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
201
+            error: function (request) {
202
+                layer.close(index);         //关闭数据提交信息
203
+                layer.alert("网络超时");
204
+            },
205
+            success: function (data) {
206
+                if (data.data != null) {
207
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
208
+                    return;
209
+                }
210
+                $('input[name="permit"]').val('');
211
+                $('input[name="time"]').val('');
212
+                $('input[name="building_num"]').val('');
213
+                layer.msg(data.msg);
214
+
215
+            }
216
+        });
217
+        return false;
218
+    })
219
+
220
+    // 修改页面数据提交
221
+    form.on('submit(presellEditSubmit)', function (data) {
222
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
223
+
224
+        var formData = new FormData($('#preselledit')[0]);
225
+        $.ajax({
226
+            cache: true,
227
+            type: "post",
228
+            url: "/house/preselleditform",
229
+            data: formData,  // 你的formid
230
+            // async : false,          //async 默认为true异步,修改为false为同步
231
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
232
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
233
+            error: function (request) {
234
+                layer.close(index);         //关闭数据提交信息
235
+                layer.alert("请联系管理员");
236
+            },
237
+            success: function (data) {
238
+                if (data.data != null) {
239
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
240
+                    return;
241
+                }
242
+                layer.msg(data.msg);
243
+            }
244
+        });
245
+        return false;
246
+    });
247
+
248
+
249
+})
250
+
251
+
252
+// $(function(){
253
+// 	// 动态添加批量删除按钮
254
+//     var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
255
+//               + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_house">批量删除</a>'
256
+//               + '</div>'
257
+//         $('.layui-form').append(_btn)
258
+//
259
+// })
260
+
261
+
262
+//预售许可证 添加
263
+function datumInsert() {
264
+    var tr = '<tr>'
265
+        + '<td lay-event="del">'
266
+        + '<div class="layui-table-cell del" lay-oid=""><i class="layui-icon" style="font-size: 30px; color: #1E9FFF;cursor: pointer">&#xe640;</i></div>'
267
+        + '</td>'
268
+        + '<td data-field="matingName" align="center" data-content="">'
269
+        + '<div class="layui-table-cell"><input type="text" name="licenseKey" value="" autocomplete="off" class="layui-input" ></div>'
270
+        + '</td>'
271
+        + '<td data-field="distance" align="center" data-content="">'
272
+        + '<div class="layui-table-cell"><input type="text" name="issueDate" value="" autocomplete="off" class="layui-input" ></div>'
273
+        + '</td>'
274
+        + '<td data-field="longitude" align="center" data-content="">'
275
+        + '<div class="layui-table-cell"><input type="text" id="jwd" name="buildingName" value="" autocomplete="off" class="layui-input" ></div>'
276
+        + '</td>'
277
+        + '</tr>';
278
+    $(".layui_w_licence table.layui-table tbody").append(tr);
279
+}

+ 136 - 0
backend/web/js/china/pricetrend/city_price_record.js

@@ -0,0 +1,136 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload', 'laydate'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , layer = layui.layer //弹层
6
+        , table = layui.table //表格
7
+        , form = layui.form
8
+        , laydate = layui.laydate;
9
+
10
+    var cid = $('input[name="cid"]').val();
11
+    //第二个实例--区域历史价格记录
12
+    table.render({
13
+        elem: '#recordcity'
14
+        , url: '/pricetrend/recordpriceform' //数据接口
15
+        , where: {token: csrfToken, city_id: cid}
16
+        , method: 'post'
17
+        , page: true //开启分页
18
+        , text: '数据加载中'
19
+        , id: 'tablerReloadss'
20
+        , limit: 20
21
+        , cols: [[ //表头
22
+            {type: 'numbers'}
23
+            , {field: 'price', title: '价格', align: 'center'}
24
+            , {field: 'price_at', title: '时间', align: 'center'}
25
+            , {field: 'contrast', title: '对比上月', align: 'center'}
26
+            , {field: 'trend', title: '比上月趋势', align: 'center'}
27
+            , {field: 'lastyear', title: '对比去年', align: 'center'}
28
+            , {field: 'yeartrend', title: '比去年趋势', align: 'center'}
29
+            , {fixed: 'right', title: '操作', width: 165, align: 'center', toolbar: '#operate'}
30
+        ]]
31
+    });
32
+
33
+    //列表操作
34
+    var indexs = table.on('tool(recordcity)', function (obj) {
35
+        var layEvent = obj.event,
36
+            data = obj.data;
37
+        if (layEvent === 'edit') {
38
+            layer.open({
39
+                type: 2,
40
+                title: '修改',
41
+                closeBtn: 1, //不显示关闭按钮
42
+                area: ['600px', '600px'],
43
+                anim: 2,
44
+                content: '/pricetrend/priceedit?id=' + data.id,
45
+                end: function () {
46
+                    table.reload('tablerReloadss');
47
+                }
48
+            });
49
+        } else if (layEvent === 'del') {
50
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
51
+                $.post('/pricetrend/pricedel', {'id': data.id}, function (data) {
52
+
53
+                    if (data.data != null) {
54
+                        layer.msg(ReturnInfo(data.data), {icon: 5});
55
+                        return;
56
+                    }
57
+                    layer.msg(data.msg);
58
+                    table.reload('tablerReloadss');
59
+                });
60
+            });
61
+        }
62
+    });
63
+
64
+
65
+    //
66
+    //
67
+    // var $ = layui.$, active = {
68
+    //     addData: function(){ //获取选中数据
69
+    //         layer.open({
70
+    //             type: 2,
71
+    //             title: '添加价格',
72
+    //             closeBtn: 1, //不显示关闭按钮
73
+    //             shade: [0],
74
+    //             area: ['780px', '550px'],
75
+    //             anim: 2,
76
+    //             content: '/pricetrend/priceadd',
77
+    //         });
78
+    //     }
79
+    // };
80
+    //日期
81
+    laydate.render({
82
+        elem: '#date1'
83
+    });
84
+    $('.demoTable .layui-btn').on('click', function () {
85
+        var type = $(this).data('type');
86
+        active[type] ? active[type].call(this) : '';
87
+    });
88
+
89
+    // $('.The_house').focus(function(){
90
+    //     indexOpen = parent.layui.layer.open({
91
+    //         type: 2,
92
+    //         title: '选择需要添加的区域',
93
+    //         area: ['','100%'],
94
+    //         content: '/publicuse/city?type=1',
95
+    //         success:function (layero, index) {
96
+    //         },
97
+    //         end:function(){
98
+    //         }
99
+    //     });
100
+    //     parent.layui.layer.full(indexOpen);
101
+    //     //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
102
+    //     $(window).on("resize",function(){
103
+    //         parent.layui.layer.full(indexOpen);
104
+    //     })
105
+    // })
106
+
107
+
108
+    form.on('submit(editcity)', function (data) {
109
+
110
+        layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
111
+
112
+        var formData = new FormData($('form')[0]);
113
+        $.ajax({
114
+            cache: true,
115
+            type: "post",
116
+            url: '/pricetrend/priceeditform',
117
+            data: formData,  // 你的formid
118
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
119
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
120
+            error: function (request) {
121
+                layer.alert("网络超时");
122
+            },
123
+            success: function (data) {
124
+                if (data.data != null) {
125
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
126
+                    return;
127
+                }
128
+                layer.msg(data.msg);
129
+
130
+            }
131
+        });
132
+        return false;
133
+    });
134
+
135
+
136
+});

+ 278 - 0
backend/web/js/china/pricetrend/housingprice.js

@@ -0,0 +1,278 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'treetable'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , layer = layui.layer //弹层
6
+        , table = layui.table //表格
7
+        , form = layui.form
8
+        , treetable = layui.treetable;
9
+
10
+    var tableId = 'citylist';
11
+
12
+    if ($('#citylist').attr('lay-filter') == 'citylist') {
13
+        var renderTable = function (wheres = {}) {
14
+            layer.load(2);
15
+            treetable.render({
16
+                treeColIndex: 1,
17
+                treeSpid: 0,
18
+                treeIdName: 'id',
19
+                treePidName: 'pid',
20
+                treeDefaultClose: true,
21
+                treeLinkage: false,
22
+                elem: '#citylist',
23
+                url: '/pricetrend/housingpriceform',
24
+                page: false,
25
+                where: wheres,
26
+                id: 'tablerReload',
27
+                cols: [[
28
+                    {type: 'numbers'}
29
+                    , {field: 'city_name', title: '区域名称', align: 'center', width:1200}
30
+                    // , {field: 'update_at', title: '更新时间', width: 300, align: 'center'}
31
+                    , {fixed: 'right', title: '操作', width: 300, align: 'center', toolbar: '#operate'}
32
+                ]],
33
+                done: function () {
34
+                    layer.closeAll('loading');
35
+
36
+                    var sz = false;
37
+                    $('.treeTable-icon').on('click', function () {
38
+                        if ($(this).attr('lay-tpid') == 0) {
39
+                            sessionStorage.setItem("key", $(this).attr('lay-tid'));
40
+                            if (sz) {
41
+                                sessionStorage.removeItem("erzi");
42
+                            }
43
+                        } else {
44
+                            sz = true;
45
+
46
+                            if ($(this).attr('lay-tid') == sessionStorage.getItem("erzi")) {
47
+                                sessionStorage.removeItem("erzi");
48
+                            } else {
49
+                                sessionStorage.setItem("erzi", $(this).attr('lay-tid'));
50
+                            }
51
+
52
+                        }
53
+                    });
54
+                    if (sessionStorage.getItem("key") != null) {
55
+                        var laytid = sessionStorage.getItem("key");
56
+
57
+                        $('span[lay-tid=' + laytid + ']').addClass('open');
58
+
59
+                        if (sessionStorage.getItem("erzi") != null) {
60
+                            var elaytid = sessionStorage.getItem("erzi");
61
+                            sz = true;
62
+                        }
63
+
64
+                        $('span[lay-tpid=' + laytid + ']').each(function () {
65
+                            $(this).parents().parents().parents().attr('style', '');
66
+                            if (sz) {
67
+                                $('span[lay-tid=' + elaytid + ']').addClass('open');
68
+                                $('span[lay-tpid=' + elaytid + ']').each(function () {
69
+                                    $(this).parents().parents().parents().attr('style', '');
70
+                                });
71
+                            }
72
+                        });
73
+                    }
74
+                }
75
+            });
76
+        };
77
+
78
+        renderTable();
79
+    }
80
+
81
+    //列表操作
82
+    table.on('tool(' + tableId + ')', function (obj) {
83
+        var layEvent = obj.event,
84
+            data = obj.data;
85
+        switch (layEvent) {
86
+            case 'add':
87
+                layer.open({
88
+                    type: 2,
89
+                    title: '新增区域价格走势',
90
+                    closeBtn: 1, //不显示关闭按钮
91
+                    shade: [0],
92
+                    area: ['800px', '600px'],
93
+                    anim: 2,
94
+                    content: ['/pricetrend/housingpriceadd?cid=' + data.id + '&city_name=' + data.city_name, 'yes'],
95
+                    end: function () {
96
+                        renderTable();
97
+                    }
98
+                });
99
+                break;
100
+
101
+            case 'see':
102
+                layer.open({
103
+                    type: 2,
104
+                    title: '[<span style="color:red">'+data.city_name+'</span>]区域价格走势',
105
+                    area: ['100%','100%'],
106
+                    content: '/pricetrend/recordprice?cid='+data.id,
107
+                    success:function (layero, index) {
108
+                    }
109
+                });
110
+                break;
111
+        }
112
+
113
+    });
114
+
115
+
116
+    var $ = layui.$, active = {
117
+        addData: function () { //获取选中数据
118
+            layer.open({
119
+                type: 2,
120
+                title: '添加区域',
121
+                closeBtn: 1, //不显示关闭按钮
122
+                shade: [0],
123
+                area: ['780px', '550px'],
124
+                anim: 2,
125
+                content: '/categorycity/addhome?son=1',
126
+            });
127
+        },
128
+        reload: function () {
129
+            var form = pfgs_serialize($('form'));
130
+            var city = '';
131
+            if (form.province != '') {
132
+                city = form.province;
133
+            }
134
+
135
+            if (form.city != '') {
136
+                city = form.city;
137
+            }
138
+            renderTable({id: city});
139
+        }
140
+    };
141
+
142
+    $('.demoTable .layui-btn').on('click', function () {
143
+        var type = $(this).data('type');
144
+        active[type] ? active[type].call(this) : '';
145
+    });
146
+
147
+    //显示或隐藏
148
+    form.on('switch(switchTest)', function (data) {
149
+        var state = '';
150
+        if (data.elem.name == 1) {
151
+            state = 2;
152
+        } else if (data.elem.name == 2) {
153
+            state = 1;
154
+        }
155
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
156
+            $.post('/categorycity/editall', {id: data.value, state: state}, function (data) {
157
+                if (data.data != null) {
158
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
159
+                    return false;
160
+                }
161
+                layer.msg(data.msg);
162
+                renderTable();
163
+            })
164
+        }, function (aa) {
165
+            renderTable();
166
+        })
167
+    });
168
+
169
+    //修改排序
170
+    table.on('edit(' + tableId + ')', function (obj) {
171
+        var data = obj.data;
172
+        $.post('/categorycity/editall', {id: data.id, sort: data.sort}, function (data) {
173
+            if (data.data != null) {
174
+                layer.msg(ReturnInfo(data.data), {icon: 5});
175
+                return false;
176
+            }
177
+            layer.msg(data.msg);
178
+        })
179
+
180
+    })
181
+
182
+    form.on('submit(editcity)', function (data) {
183
+
184
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
185
+
186
+        var formData = new FormData($('form')[0]);
187
+        $.ajax({
188
+            cache: true,
189
+            type: "post",
190
+            url: '/categorycity/edithomeform',
191
+            data: formData,  // 你的formid
192
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
193
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
194
+            error: function (request) {
195
+                layer.close(index);         //关闭数据提交信息
196
+                layer.alert("网络超时");
197
+            },
198
+            success: function (data) {
199
+                if (data.data != null) {
200
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
201
+                    return;
202
+                }
203
+                layer.msg(data.msg);
204
+                renderTable();
205
+
206
+            }
207
+        });
208
+        return false;
209
+    });
210
+
211
+    //添加
212
+    form.on('submit(addcity)', function (data) {
213
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
214
+        $.post('/categorycity/addcityform', {'data': data.field}, function (data) {
215
+            if (data.data != null) {
216
+                layer.msg(ReturnInfo(data.data), {icon: 5});
217
+                return;
218
+            }
219
+            layer.msg(data.msg);
220
+            renderTable();
221
+        })
222
+        return false;
223
+    });
224
+
225
+    //加载省数据
226
+    function loadProvince() {
227
+
228
+        $.ajax({
229
+            url: '/categorycity/citypid',
230
+            type: 'post',
231
+            async: false,//使用同步的方式,true为异步方式
232
+            data: {'pid': 0},//这里使用json对象
233
+            success: function (data) {
234
+                // console.log(data);
235
+                var areaData = data.data;
236
+                var proHtml = '';
237
+                for (var i = 0; i < areaData.length; i++) {
238
+                    proHtml += '<option value="' + areaData[i].id + '">' + areaData[i].city_name + '</option>';
239
+                }
240
+                //初始化省数据
241
+                $('select[name=province]').append(proHtml);
242
+                form.render();
243
+            },
244
+            fail: function () {
245
+
246
+            }
247
+        });
248
+
249
+
250
+    }
251
+
252
+    loadProvince();
253
+
254
+    form.on('select(province)', function (data) {
255
+        $.post('/categorycity/citypid', {'pid': data.value}, function (data) {
256
+            var areaData = data.data;
257
+            var proHtml = '';
258
+            $('select[name=city]').html('');
259
+            proHtml = '<option value="">请选择市/区/县</option>';
260
+            for (var i = 0; i < areaData.length; i++) {
261
+
262
+                proHtml += '<option value="' + areaData[i].id + '">' + areaData[i].city_name + '</option>';
263
+            }
264
+            //初始化省数据
265
+            $('select[name=city]').append(proHtml);
266
+            form.render();
267
+        })
268
+    })
269
+
270
+    // 转换拼音
271
+    $('.layui_w_name').on('keyup ', function () {
272
+        var _txt = $(this).val();
273
+        var _convert = pinyinUtil.getPinyin(_txt, ' ', false).replace(/\s/g, "");
274
+        $('.layui_w_spell').val(_convert)
275
+    })
276
+
277
+});
278
+

+ 268 - 0
backend/web/js/china/pricetrend/price.js

@@ -0,0 +1,268 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload', 'laydate'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , layer = layui.layer //弹层
6
+        , table = layui.table //表格
7
+        , form = layui.form
8
+        , laydate = layui.laydate;
9
+
10
+    var tableId = 'citylist';
11
+    //第一个实例
12
+    table.render({
13
+        elem: '#' + tableId
14
+        , url: '/pricetrend/homeform' //数据接口
15
+        , where: {token: csrfToken}
16
+        , method: 'post'
17
+        , page: true //开启分页
18
+        , height: 600
19
+        , text: '数据加载中'
20
+        , id: 'tablerReload'
21
+        , limit: 15
22
+        , cols: [[ //表头
23
+            {type: "checkbox", width: 50},
24
+            {field: 'city_id', title: '区域ID', align: 'center', width: 50}
25
+            , {field: 'city_name', title: '区域名称', align: 'center'}
26
+            , {fixed: 'right', title: '操作', width: 165, align: 'center', toolbar: '#operate'}
27
+        ]],
28
+        done: function (res, curr, count) {
29
+            var _btn = '<div class="layui-inline " style="float:left;position:absolute;left:10px;bottom:6px">'
30
+                + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_Pricetrends">批量删除</a>'
31
+                + '</div>'
32
+            $('.layui-border-box').append(_btn)
33
+        }
34
+    });
35
+
36
+    //列表操作
37
+    table.on('tool(' + tableId + ')', function (obj) {
38
+        var layEvent = obj.event,
39
+            data = obj.data;
40
+        if (layEvent === 'edit') {
41
+            indexOpen = layui.layer.open({
42
+                type: 2,
43
+                title: '[<span style="color:red">' + data.city_name + '</span>]区域历史价格',
44
+                area: ['', '100%'],
45
+                content: '/pricetrend/recordprice?cid=' + data.city_id,
46
+                success: function (layero, index) {
47
+                }
48
+            });
49
+            layui.layer.full(indexOpen);
50
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
51
+            $(window).on("resize", function () {
52
+                layui.layer.full(indexOpen);
53
+            })
54
+        }
55
+        // else if (layEvent === 'del') {
56
+        //     layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
57
+        //         $.post('/categorycity/delform', {'id': data.id}, function (data) {
58
+        //
59
+        //             if (data.code == 200) {
60
+        //                 layer.msg(data.msg);
61
+        //                 table.reload('tablerReload');
62
+        //
63
+        //             } else if (data.code == 300) {
64
+        //                 layer.msg(data.msg);
65
+        //             }
66
+        //         });
67
+        //     });
68
+        // }
69
+        else if (layEvent === 'add') {
70
+            layer.open({
71
+                type: 2,
72
+                title: '添加价格',
73
+                closeBtn: 1, //不显示关闭按钮
74
+                shade: [0],
75
+                area: ['780px', '550px'],
76
+                anim: 2,
77
+                content: '/pricetrend/lineadd?cid=' + data.city_id + '&city_name=' + data.city_name,
78
+            });
79
+        }
80
+    });
81
+
82
+    var $ = layui.$, active = {
83
+        addData: function () { //获取选中数据
84
+            layer.open({
85
+                type: 2,
86
+                title: '添加价格',
87
+                closeBtn: 1, //不显示关闭按钮
88
+                shade: [0],
89
+                area: ['780px', '550px'],
90
+                anim: 2,
91
+                content: '/pricetrend/priceadd.html',
92
+            });
93
+        },
94
+        reload: function () {//搜索
95
+            var form = pfgs_serialize($('form'));
96
+            var name = '';
97
+            var house_name = '';
98
+            if (form.input_house == 'name') {
99
+                name = form.input_house_text;
100
+            } else if (form.input_house == 'house_name') {
101
+                house_name = form.input_house_text;
102
+            }
103
+            table.reload('tablerReload', {
104
+                where: {
105
+                    title: name,
106
+                    house_name: form.input_house_text,
107
+                    city: form.province,
108
+                    type_name: form.type_name
109
+                }
110
+            })
111
+        }
112
+    };
113
+    //日期
114
+    laydate.render({
115
+        elem: '#date1'
116
+    });
117
+    $('.demoTable .layui-btn').on('click', function () {
118
+        var type = $(this).data('type');
119
+        active[type] ? active[type].call(this) : '';
120
+    });
121
+
122
+    $('.The_house').focus(function () {
123
+        indexOpen = parent.layui.layer.open({
124
+            type: 2,
125
+            title: '选择需要添加的区域',
126
+            area: ['', '100%'],
127
+            content: '/publicuse/cncity?type=1',
128
+            success: function (layero, index) {
129
+            },
130
+            end: function () {
131
+            }
132
+        });
133
+        parent.layui.layer.full(indexOpen);
134
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
135
+        $(window).on("resize", function () {
136
+            parent.layui.layer.full(indexOpen);
137
+        })
138
+    })
139
+
140
+
141
+    form.on('submit(editcity)', function (data) {
142
+
143
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
144
+
145
+        var formData = new FormData($('form')[0]);
146
+        $.ajax({
147
+            cache: true,
148
+            type: "post",
149
+            url: '/categorycity/edithomeform',
150
+            data: formData,  // 你的formid
151
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
152
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
153
+            error: function (request) {
154
+                layer.close(index);         //关闭数据提交信息
155
+                layer.alert("网络超时");
156
+            },
157
+            success: function (data) {
158
+                if (data.data != null) {
159
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
160
+                    return;
161
+                }
162
+                layer.msg(data.msg);
163
+                parent.layui.table.reload('tablerReload');
164
+
165
+            }
166
+        });
167
+        return false;
168
+    });
169
+
170
+    //添加
171
+    form.on('submit(addcity)', function (data) {
172
+        layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
173
+
174
+        var formData = new FormData($('form')[0]);
175
+        $.ajax({
176
+            cache: true,
177
+            type: "post",
178
+            url: '/pricetrend/priceaddform',
179
+            data: formData,  // 你的formid
180
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
181
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
182
+            error: function (request) {
183
+                layer.alert("网络超时");
184
+            },
185
+            success: function (data) {
186
+                if (data.data != null) {
187
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
188
+                    return;
189
+                }
190
+                layer.msg(data.msg);
191
+                parent.layui.table.reload('tablerReload');
192
+            }
193
+        });
194
+        return false;
195
+    });
196
+
197
+
198
+    form.on('submit(del_alls_Pricetrends)', function (data) {
199
+        var checkStatus = table.checkStatus('tablerReload');
200
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
201
+        if (typeof checkStatus.data[0] == 'object') {
202
+            layer.confirm('您确定要删除吗?', {btn: ['确认', '取消']}, function () {
203
+                var formdat = new FormData();
204
+                $.each(checkStatus.data, function (key, val) {
205
+                    formdat.append('hid[]', val.city_id);
206
+                })
207
+                $.ajax({
208
+                    cache: true,
209
+                    type: "post",
210
+                    url: "/pricetrend/pricecityalldell",
211
+                    data: formdat,  // 你的formid
212
+                    // async : false,          //async 默认为true异步,修改为false为同步
213
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
214
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
215
+                    error: function (request) {
216
+                        layer.close(index);         //关闭数据提交信息
217
+                        layer.alert("网络超时");
218
+                    },
219
+                    success: function (data) {
220
+                        if (data.code == 200) {
221
+                            layer.msg(data.msg);
222
+                            // reloadTable(reloadId);
223
+                            table.reload('tablerReload');
224
+                        } else {
225
+                            layer.msg(data.msg);
226
+                        }
227
+                    }
228
+                });
229
+
230
+            })
231
+            return false;
232
+        }
233
+        layer.msg('请选择需要删除的楼盘', {icon: 5});
234
+        return false;
235
+    })
236
+
237
+
238
+//加载省数据
239
+    function loadProvince() {
240
+
241
+        $.ajax({
242
+            url: '/categorycity/citypid',
243
+            type: 'post',
244
+            async: false,//使用同步的方式,true为异步方式
245
+            data: {'pid': 0},//这里使用json对象
246
+            success: function (data) {
247
+                // console.log(data);
248
+                var areaData = data.data;
249
+                var proHtml = '';
250
+                for (var i = 0; i < areaData.length; i++) {
251
+                    proHtml += '<option value="' + areaData[i].id + '">' + areaData[i].city_name + '</option>';
252
+                }
253
+                //初始化省数据
254
+                $('select[name=province]').append(proHtml);
255
+                form.render();
256
+            },
257
+            fail: function () {
258
+
259
+            }
260
+        });
261
+
262
+
263
+    }
264
+
265
+    loadProvince();
266
+
267
+
268
+});

+ 277 - 0
backend/web/js/china/pushnews/column.js

@@ -0,0 +1,277 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+    var type_id = $('input[name="type"]').val();
12
+    var tableIds = 'videolist';  //表格ID
13
+    //第一个实例
14
+    table.render({
15
+        elem: '#'+tableIds
16
+        ,url: '/pushnews/homenewscolumnform' //数据接口
17
+        ,where:{token:csrfToken}
18
+        ,method:'post'
19
+        ,page: true //开启分页
20
+        ,height:600
21
+        ,text:'数据加载中'
22
+        ,id:'tablerReload'
23
+        ,cols: [[ //表头
24
+            {type:'numbers',title:'序号',width:50},
25
+            {field: 'news_name', title: '栏目名称', align:'center'},
26
+            {field: 'short', title: '栏目短标题', align:'center'},
27
+            {field: 'sort', title: '排序',width:100, event:'sortData', edit: 'text',align:'center',sort: true,templet:"#sortBox"}
28
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
29
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
30
+                    if(d.is_show == 2){
31
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
32
+                    } else {
33
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
34
+                    }
35
+                }}
36
+            ,{fixed: 'right',title:'操作', width: 200, align:'center', toolbar: '#operate'}
37
+
38
+        ]]
39
+    });
40
+
41
+    // 列表点击放大图片
42
+    $('.layui-table-main').on('click','.layui_magnify', function(){
43
+        var _src = $(this).attr('src');
44
+        layui.layer.open({
45
+            type: 1,
46
+            title: false,           //是否显示标题
47
+            area: ['95%', '55%'],
48
+            shade: 0.6,           //透明度
49
+            closeBtn: 1,         //按钮 1有,0无
50
+            shadeClose: true,
51
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
52
+        });
53
+    });
54
+
55
+
56
+    //监听指定开关
57
+    form.on('switch(switchTest)', function(data){
58
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
59
+            $.post('/pushnews/newscolumndelandshow',{id:data.value,type:'show'},function (data) {
60
+                layer.msg(data.msg);
61
+                table.reload('tablerReload');
62
+
63
+            })
64
+        },function (aa) {
65
+            table.reload('tablerReload');        //重新加载
66
+        })
67
+    });
68
+
69
+
70
+    //列表操作
71
+    table.on('tool('+tableIds+')', function(obj){
72
+        var layEvent = obj.event,
73
+            data = obj.data;
74
+
75
+        if(layEvent === 'sortData'){       //修改排序
76
+            table.on('edit('+tableIds+')', function(obj){
77
+                var data = obj.data;
78
+                // console.log(data)
79
+                $.post('/pushnews/newscolumndelandshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
80
+                    if(data.code == 200)
81
+                    {
82
+                        layer.msg(data.msg);
83
+                    } else if(data.code == 300 ) {
84
+                        layer.msg(data.msg);
85
+                    }
86
+                })
87
+            })
88
+            // layer.prompt({
89
+            //     formType: 2
90
+            //     ,title: '排序'
91
+            //     ,value: data.sort
92
+            // }, function(value, index){
93
+
94
+            //     $.post('/pushnews/newscolumndelandshow',{id:data.id,type:'sort',sort:value},function (data) {
95
+            //         layer.msg(data.msg);
96
+            //         table.reload('tablerReload');
97
+            //     })
98
+            // });
99
+        }else if(layEvent === 'del') {
100
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
101
+                $.post('/pushnews/newscolumndelandshow',{id:data.id,type:'del'},function (data) {
102
+                    layer.msg(data.msg);
103
+                    table.reload('tablerReload');
104
+                })
105
+            })
106
+        } else if(layEvent === 'edit'){
107
+            var index = layer.open({
108
+                type: 2,
109
+                title: '编辑',
110
+                area:['800px','500px'],
111
+                content: '/pushnews/newscolumnedit?id='+data.id+'&name='+data.news_name,
112
+                end:function () {
113
+                    table.reload('tablerReload');        //重新加载
114
+                }
115
+            });
116
+
117
+        } else if(layEvent === 'upload'){
118
+            var index =layui.layer.open({
119
+                title :'<span style="color:red" >['+data.news_name+']</span>栏目相关资讯',
120
+                type : 2,
121
+                area:['','100%'],
122
+                maxmin: true,
123
+                content : "/pushnews/newcontent?cid="+data.id,
124
+                end:function () {
125
+                    table.reload('tablerReload');
126
+                }
127
+            })
128
+            layui.layer.full(index);
129
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
130
+            $(window).on("resize",function(){
131
+                layui.layer.full(index);
132
+            })
133
+        }
134
+
135
+
136
+    });
137
+
138
+    //添加图片上传
139
+    upload.render({
140
+        elem: '#test1'
141
+        ,url: '/house/createimg'
142
+        ,data:{token:csrfToken}
143
+        ,field:'img'
144
+        ,size:1000              //限制上传图片的大小,单位为KB
145
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
146
+        ,auto:false
147
+        ,bindAction:'#addcity'
148
+        ,choose: function(obj){
149
+            obj.preview(function(index, file, result){
150
+                $('#breviary_img').attr('src', result); //图片链接(base64)
151
+            });
152
+        }
153
+    });
154
+    // 图片放大浏览
155
+    $('.layui_magnify').click(function(){
156
+        var _src = $(this).attr('src');
157
+        layui.layer.open({
158
+            type: 1,
159
+            title: false,           //是否显示标题
160
+            area: ['60%', '80%'],
161
+            shade: 0.6,           //透明度
162
+            closeBtn: 1,         //按钮 1有,0无
163
+            shadeClose: true,
164
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
165
+        });
166
+    })
167
+
168
+    // 新增
169
+    var $ = layui.$, active = {
170
+        addData: function(){ //获取选中数据
171
+            var index = layui.layer.open({
172
+                type: 2,
173
+                title: '添加栏目',
174
+                closeBtn: 1, //不显示关闭按钮
175
+                area: ['800px','500px'],
176
+                content: '/pushnews/newscolumnadd?type='+type_id //iframe的url,no代表不显示滚动条
177
+                ,success:function (layero, index) {
178
+                },
179
+                end:function () {
180
+                    table.reload('tablerReload');
181
+                }
182
+            });
183
+        },
184
+        reload:function(){//搜索
185
+            var form = pfgs_serialize($('form'));
186
+            var name = '';
187
+            var house_name   = '';
188
+            if(form.input_house == 'name'){
189
+                name = form.input_house_text;
190
+            } else if(form.input_house == 'house_name'){
191
+                house_name = form.input_house_text;
192
+            }
193
+            table.reload('tablerReload',{
194
+                where:{
195
+                    title:name,
196
+                    house_name:house_name,
197
+                    city:form.input_city,
198
+                    type_name:form.type_name
199
+                }
200
+            })
201
+        },
202
+    };
203
+    $('.demoTable .layui-btn').on('click', function(){
204
+        var type = $(this).data('type');
205
+        active[type] ? active[type].call(this) : '';
206
+    });
207
+
208
+
209
+    $('.The_house').focus(function(){
210
+        indexOpen = parent.layui.layer.open({
211
+            type: 2,
212
+            title: '选择需要添加的资讯栏目',
213
+            area: ['','100%'],
214
+            content: '/publicuse/newscolumn?type=1', //1单选
215
+            success:function (layero, index) {
216
+            },
217
+            end:function(){
218
+            }
219
+        });
220
+        parent.layui.layer.full(indexOpen);
221
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
222
+        $(window).on("resize",function(){
223
+            parent.layui.layer.full(indexOpen);
224
+        })
225
+    })
226
+
227
+
228
+
229
+    //添加页面提交数据
230
+    form.on('submit(add)', function(data){
231
+        var formData = new FormData($('form')[0]);
232
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
233
+        $.ajax({
234
+            type : "post",
235
+            url : "/pushnews/newscolumnaddform",
236
+            data : formData,
237
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
238
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
239
+            error : function(request) {
240
+                layer.msg("请联系管理员");
241
+            },
242
+            success : function(data) {
243
+                if(data.data != null){
244
+                    layer.msg(ReturnInfo(data.data),{icon:5});
245
+                    return ;
246
+                }
247
+                layer.msg(data.msg);
248
+                parent.layer.close(oindex); //再执行关闭
249
+            }
250
+        });
251
+        return false;
252
+    });
253
+
254
+    form.on('submit(edit)', function(data){
255
+         layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
256
+        var formData = new FormData($('form')[0]);
257
+        $.ajax({
258
+            type : "post",
259
+            url : "/pushnews/newscolumnaeditform",
260
+            data : formData,
261
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
262
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
263
+            error : function(request) {
264
+                layer.msg("请联系管理员");
265
+            },
266
+            success : function(data) {
267
+                if(data.data != null){
268
+                    layer.msg(ReturnInfo(data.data),{icon:5});
269
+                    return ;
270
+                }
271
+                layer.msg(data.msg);
272
+                parent.layer.close(oindex); //再执行关闭
273
+            }
274
+        });
275
+        return false;
276
+    });
277
+})

+ 279 - 0
backend/web/js/china/pushnews/columncontent.js

@@ -0,0 +1,279 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+    var type_id = $('input[name="type"]').val();
12
+    var tableIds = 'videolist';  //表格ID
13
+    //第一个实例
14
+    table.render({
15
+        elem: '#'+tableIds
16
+        ,url: '/pushnews/newcontentform' //数据接口
17
+        ,where:{token:csrfToken,cid:type_id,type:4}
18
+        ,method:'post'
19
+        ,page: true //开启分页
20
+        ,height:600
21
+        ,text:'数据加载中'
22
+        ,id:'tablerReload'
23
+        ,cols: [[ //表头
24
+            {type:'numbers',title:'序号',width:50},
25
+            {field: 'subject', title: '标题', align:'center'},
26
+            {field: 'sort', title: '排序',width:100,edit: 'text', event:'sortData', align:'center',sort: true,templet:"#sortBox"}
27
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
28
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
29
+                    if(d.is_show == 2){
30
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
31
+                    } else {
32
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
33
+                    }
34
+                }}
35
+            ,{fixed: 'right',title:'操作', width: 200, align:'center', toolbar: '#operate'}
36
+        ]]
37
+    });
38
+
39
+    // 列表点击放大图片
40
+    $('.layui-table-main').on('click','.layui_magnify', function(){
41
+        var _src = $(this).attr('src');
42
+        layui.layer.open({
43
+            type: 1,
44
+            title: false,           //是否显示标题
45
+            area: ['95%', '55%'],
46
+            shade: 0.6,           //透明度
47
+            closeBtn: 1,         //按钮 1有,0无
48
+            shadeClose: true,
49
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
50
+        });
51
+    });
52
+
53
+
54
+    //监听指定开关
55
+    form.on('switch(switchTest)', function(data){
56
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
57
+            $.post('/pushnews/newcontentdelandshow',{id:data.value,type:'show'},function (data) {
58
+                layer.msg(data.msg);
59
+                table.reload('tablerReload');
60
+
61
+            })
62
+        },function (aa) {
63
+            table.reload('tablerReload');        //重新加载
64
+        })
65
+    });
66
+
67
+
68
+    //列表操作
69
+    table.on('tool('+tableIds+')', function(obj){
70
+        var layEvent = obj.event,
71
+            data = obj.data;
72
+
73
+        if(layEvent === 'sortData'){       //修改排序
74
+            // layer.prompt({
75
+            //     formType: 2
76
+            //     ,title: '排序'
77
+            //     ,value: data.sort
78
+            // }, function(value, index){
79
+
80
+            //     $.post('/pushnews/newcontentdelandshow',{id:data.id,type:'sort',sort:value},function (data) {
81
+            //         layer.msg(data.msg);
82
+            //         table.reload('tablerReload');
83
+            //     })
84
+            // });
85
+            
86
+             table.on('edit('+tableIds+')', function(obj){
87
+                var data = obj.data;
88
+                // console.log(data)
89
+                $.post('/pushnews/newcontentdelandshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
90
+                    if(data.code == 200)
91
+                    {
92
+                        layer.msg(data.msg);
93
+                    } else if(data.code == 300 ) {
94
+                        layer.msg(data.msg);
95
+                    }
96
+                })
97
+            })
98
+            
99
+
100
+        }else if(layEvent === 'del') {
101
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
102
+                $.post('/pushnews/newcontentdelandshow',{id:data.id,type:'del'},function (data) {
103
+                    layer.msg(data.msg);
104
+                    table.reload('tablerReload');
105
+                })
106
+            })
107
+        } else if(layEvent === 'edit'){
108
+            var index = layer.open({
109
+                type: 2,
110
+                title: '编辑',
111
+                area:['800px','500px'],
112
+                content: '/pushfresh/freshcityedit?id='+data.id+'&name='+data.city_name,
113
+                end:function () {
114
+                    table.reload('tablerReload');        //重新加载
115
+                }
116
+            });
117
+
118
+        } else if(layEvent === 'upload'){
119
+            var index =layui.layer.open({
120
+                title :'<span style="color:red" >['+data.news_name+']</span>栏目相关资讯',
121
+                type : 2,
122
+                area:['','100%'],
123
+                maxmin: true,
124
+                content : "/pushfresh/cityhouse?id="+data.city_id,
125
+                end:function () {
126
+                    table.reload('tablerReload');
127
+                }
128
+            })
129
+            layui.layer.full(index);
130
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
131
+            $(window).on("resize",function(){
132
+                layui.layer.full(index);
133
+            })
134
+        }
135
+
136
+
137
+    });
138
+
139
+    //添加图片上传
140
+    upload.render({
141
+        elem: '#test1'
142
+        ,url: '/house/createimg'
143
+        ,data:{token:csrfToken}
144
+        ,field:'img'
145
+        ,size:1000              //限制上传图片的大小,单位为KB
146
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
147
+        ,auto:false
148
+        ,bindAction:'#addcity'
149
+        ,choose: function(obj){
150
+            obj.preview(function(index, file, result){
151
+                $('#breviary_img').attr('src', result); //图片链接(base64)
152
+            });
153
+        }
154
+    });
155
+    // 图片放大浏览
156
+    $('.layui_magnify').click(function(){
157
+        var _src = $(this).attr('src');
158
+        layui.layer.open({
159
+            type: 1,
160
+            title: false,           //是否显示标题
161
+            area: ['60%', '80%'],
162
+            shade: 0.6,           //透明度
163
+            closeBtn: 1,         //按钮 1有,0无
164
+            shadeClose: true,
165
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
166
+        });
167
+    })
168
+
169
+    // 新增
170
+    var $ = layui.$, active = {
171
+        addData: function(){ //获取选中数据
172
+            var index = layui.layer.open({
173
+                type: 2,
174
+                title: '添加资讯',
175
+                closeBtn: 1, //不显示关闭按钮
176
+                area: ['800px','500px'],
177
+                content: '/pushnews/newcontentadd?type='+type_id //iframe的url,no代表不显示滚动条
178
+                ,success:function (layero, index) {
179
+                },
180
+                end:function () {
181
+                    table.reload('tablerReload');
182
+                }
183
+            });
184
+        },
185
+        reload:function(){//搜索
186
+            var form = pfgs_serialize($('form'));
187
+            var name = '';
188
+            var house_name   = '';
189
+            if(form.input_house == 'name'){
190
+                name = form.input_house_text;
191
+            } else if(form.input_house == 'house_name'){
192
+                house_name = form.input_house_text;
193
+            }
194
+            table.reload('tablerReload',{
195
+                where:{
196
+                    title:name,
197
+                    house_name:house_name,
198
+                    city:form.input_city,
199
+                    type_name:form.type_name
200
+                }
201
+            })
202
+        },
203
+    };
204
+    $('.demoTable .layui-btn').on('click', function(){
205
+        var type = $(this).data('type');
206
+        active[type] ? active[type].call(this) : '';
207
+    });
208
+
209
+
210
+    $('.The_house').focus(function(){
211
+        indexOpen = parent.layui.layer.open({
212
+            type: 2,
213
+            title: '选择需要添加的资讯',
214
+            area: ['','100%'],
215
+            content: '/publicuse/news?type=1', //1单选
216
+            success:function (layero, index) {
217
+            },
218
+            end:function(){
219
+            }
220
+        });
221
+        parent.layui.layer.full(indexOpen);
222
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
223
+        $(window).on("resize",function(){
224
+            parent.layui.layer.full(indexOpen);
225
+        })
226
+    })
227
+
228
+
229
+
230
+    //添加页面提交数据
231
+    form.on('submit(addcontent)', function(data){
232
+        var formData = new FormData($('form')[0]);
233
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
234
+        $.ajax({
235
+            type : "post",
236
+            url : "/pushnews/newcontentaddform",
237
+            data : formData,
238
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
239
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
240
+            error : function(request) {
241
+                layer.msg("请联系管理员");
242
+            },
243
+            success : function(data) {
244
+                if(data.data != null){
245
+                    layer.msg(ReturnInfo(data.data),{icon:5});
246
+                    return ;
247
+                }
248
+                layer.msg(data.msg);
249
+                parent.layer.close(oindex); //再执行关闭
250
+            }
251
+        });
252
+        return false;
253
+    });
254
+
255
+    form.on('submit(edit_city)', function(data){
256
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
257
+        var formData = new FormData($('form')[0]);
258
+        $.ajax({
259
+            type : "post",
260
+            url : "/pushfresh/freshcityeditform",
261
+            data : formData,
262
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
263
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
264
+            error : function(request) {
265
+                layer.close(index);
266
+                layer.msg("请联系管理员");
267
+            },
268
+            success : function(data) {
269
+                if(data.data != null){
270
+                    layer.msg(ReturnInfo(data.data),{icon:5});
271
+                    return ;
272
+                }
273
+                layer.msg(data.msg);
274
+                parent.layer.close(oindex); //再执行关闭
275
+            }
276
+        });
277
+        return false;
278
+    });
279
+})

+ 319 - 0
backend/web/js/china/pushnews/news.js

@@ -0,0 +1,319 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+    var type_id = $('input[name="type"]').val();
12
+    var tableIds = 'videolist';  //表格ID
13
+    var oindex = 0;
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#'+tableIds
17
+        ,url: '/pushnews/poneform' //数据接口
18
+        ,where:{token:csrfToken,type:type_id}
19
+        ,method:'post'
20
+        ,page: false //开启分页
21
+        ,height:600
22
+        ,text:'数据加载中'
23
+        ,id:'tablerReload'
24
+        ,cols: [[ //表头
25
+            {type:'numbers',title:'序号',width:50},
26
+            {field: 'subject', title: '标题', align:'center'},
27
+           /*{field: 'img', title: '图片',width:200, align:'center',templet:function(d){
28
+                    return '<img class="layui_magnify" src="'+d.img+'"/>'
29
+                }},*/
30
+            {field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"}
31
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
32
+         /*   ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
33
+                    if(d.is_show == 2){
34
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
35
+                    } else {
36
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
37
+                    }
38
+                }}*/
39
+          //  ,{fixed: 'right',title:'操作', width: 200, align:'center', toolbar: '#operate'}
40
+
41
+        ]]
42
+    });
43
+
44
+    // 列表点击放大图片
45
+    $('.layui-table-main').on('click','.layui_magnify', function(){
46
+        var _src = $(this).attr('src');
47
+        layui.layer.open({
48
+            type: 1,
49
+            title: false,           //是否显示标题
50
+            area: ['95%', '55%'],
51
+            shade: 0.6,           //透明度
52
+            closeBtn: 1,         //按钮 1有,0无
53
+            shadeClose: true,
54
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
55
+        });
56
+    });
57
+
58
+
59
+    //监听指定开关
60
+    form.on('switch(switchTest)', function(data){
61
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
62
+            $.post('/pushnews/newsdelandshow',{id:data.value,type:'show'},function (data) {
63
+                layer.msg(data.msg);
64
+                table.reload('tablerReload');
65
+
66
+            })
67
+        },function (aa) {
68
+            table.reload('tablerReload');        //重新加载
69
+        })
70
+    });
71
+
72
+    //列表操作
73
+    table.on('tool('+tableIds+')', function(obj){
74
+        var layEvent = obj.event,
75
+            data = obj.data;
76
+
77
+        if(layEvent === 'sortData'){       //修改排序
78
+             table.on('edit('+tableIds+')', function(obj){
79
+                var data = obj.data;
80
+                // console.log(data)
81
+                $.post('/pushnews/newsdelandshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
82
+                    if(data.code == 200)
83
+                    {
84
+                        layer.msg(data.msg);
85
+                    } else if(data.code == 300 ) {
86
+                        layer.msg(data.msg);
87
+                    }
88
+                })
89
+            })
90
+            // layer.prompt({
91
+            //     formType: 2
92
+            //     ,title: '排序'
93
+            //     ,value: data.sort
94
+            // }, function(value, index){
95
+
96
+            //     $.post('/pushnews/newsdelandshow',{id:data.id,type:'sort',sort:value},function (data) {
97
+            //         layer.msg(data.msg);
98
+            //         table.reload('tablerReload');
99
+            //     })
100
+            // });
101
+        }else if(layEvent === 'del') {
102
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
103
+                $.post('/pushnews/newsdelandshow',{id:data.id,type:'del'},function (data) {
104
+                    layer.msg(data.msg);
105
+                    table.reload('tablerReload');
106
+                })
107
+            })
108
+        } else if(layEvent === 'edit'){
109
+            var index = layer.open({
110
+                type: 2,
111
+                title: '编辑',
112
+                area:['800px','500px'],
113
+                content: '/pushfresh/freshcityedit?id='+data.id+'&name='+data.city_name,
114
+                end:function () {
115
+                    table.reload('tablerReload');        //重新加载
116
+                }
117
+            });
118
+        } else if(layEvent === 'Relation'){
119
+            var index =layui.layer.open({
120
+                title :'<span style="color:red" >['+data.city_name+']</span>区域相关楼盘',
121
+                type : 2,
122
+                area:['','100%'],
123
+                maxmin: true,
124
+                content : "/pushfresh/cityhouse?id="+data.city_id,
125
+                end:function () {
126
+                    table.reload('tablerReload');
127
+                }
128
+            })
129
+            layui.layer.full(index);
130
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
131
+            $(window).on("resize",function(){
132
+                layui.layer.full(index);
133
+            })
134
+        }
135
+
136
+
137
+    });
138
+
139
+    //添加图片上传
140
+    upload.render({
141
+        elem: '#test1'
142
+        ,url: '/house/createimg'
143
+        ,data:{token:csrfToken}
144
+        ,field:'img'
145
+        ,size:1000              //限制上传图片的大小,单位为KB
146
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
147
+        ,auto:false
148
+        ,bindAction:'#addcity'
149
+        ,choose: function(obj){
150
+            obj.preview(function(index, file, result){
151
+                $('#breviary_img').attr('src', result); //图片链接(base64)
152
+            });
153
+        }
154
+    });
155
+    // 图片放大浏览
156
+    $('.layui_magnify').click(function(){
157
+        var _src = $(this).attr('src');
158
+        layui.layer.open({
159
+            type: 1,
160
+            title: false,           //是否显示标题
161
+            area: ['60%', '80%'],
162
+            shade: 0.6,           //透明度
163
+            closeBtn: 1,         //按钮 1有,0无
164
+            shadeClose: true,
165
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
166
+        });
167
+    })
168
+
169
+    // 新增
170
+    var $ = layui.$, active = {
171
+        addData: function(){ //获取选中数据
172
+            oindex = layui.layer.open({
173
+                type: 2,
174
+                title: '添加',
175
+                closeBtn: 1, //不显示关闭按钮
176
+                area: ['800px','500px'],
177
+                content: '/pushnews/newsadd?type='+type_id //iframe的url,no代表不显示滚动条
178
+                ,success:function (layero, index) {
179
+                },
180
+                end:function () {
181
+                    table.reload('tablerReload');
182
+                }
183
+            });
184
+        },
185
+        reload:function(){//搜索
186
+            var form = pfgs_serialize($('form'));
187
+            var name = '';
188
+            var house_name   = '';
189
+            if(form.input_house == 'name'){
190
+                name = form.input_house_text;
191
+            } else if(form.input_house == 'house_name'){
192
+                house_name = form.input_house_text;
193
+            }
194
+            table.reload('tablerReload',{
195
+                where:{
196
+                    title:name,
197
+                    house_name:house_name,
198
+                    city:form.input_city,
199
+                    type_name:form.type_name
200
+                }
201
+            })
202
+        },
203
+    };
204
+    $('.demoTable .layui-btn').on('click', function(){
205
+        var type = $(this).data('type');
206
+        active[type] ? active[type].call(this) : '';
207
+    });
208
+
209
+
210
+    $('.The_house').focus(function(){
211
+        indexOpen = parent.layui.layer.open({
212
+            type: 2,
213
+            /*title: '选择需要添加的资讯',*/
214
+            area: ['','100%'],
215
+            content: '/publicuse/news?type=1', //1单选
216
+            success:function (layero, index) {
217
+            },
218
+            end:function(){
219
+            }
220
+        });
221
+        parent.layui.layer.full(indexOpen);
222
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
223
+        $(window).on("resize",function(){
224
+            parent.layui.layer.full(indexOpen);
225
+        })
226
+    })
227
+
228
+
229
+
230
+    //添加页面提交数据
231
+    form.on('submit(add)', function(data){
232
+        var formData = new FormData($('form')[0]);
233
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
234
+        $.ajax({
235
+            type : "post",
236
+            url : "/pushnews/newsaddform",
237
+            data : formData,
238
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
239
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
240
+            error : function(request) {
241
+                layer.close(index);
242
+                layer.msg("请联系管理员");
243
+            },
244
+            success : function(data) {
245
+                if(data.data != null){
246
+                    layer.msg(ReturnInfo(data.data),{icon:5});
247
+                    return ;
248
+                }
249
+                layer.msg(data.msg);
250
+                parent.layer.closeAll(); //再执行关闭
251
+
252
+            }
253
+        });
254
+        return false;
255
+    });
256
+
257
+form.on('submit(del_alls_house)',function (data) {
258
+        var checkStatus = table.checkStatus('tablerReload');
259
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
260
+        if(typeof  checkStatus.data[0] == 'object'){
261
+            layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
262
+                var formdat = new FormData();
263
+                $.each(checkStatus.data,function (key,val) {
264
+                    formdat.append('hid[]',val.id);
265
+                })
266
+                $.ajax({
267
+                    cache : true,
268
+                    type : "post",
269
+                    url : "/pushnews/newpdel",
270
+                    data : formdat,  // 你的formid
271
+                    // async : false,          //async 默认为true异步,修改为false为同步
272
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
273
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
274
+                    error : function(request) {
275
+                        layer.close(index);         //关闭数据提交信息
276
+                        layer.alert("网络超时");
277
+                    },
278
+                    success : function(data) {
279
+                        if (data.code == 200) {
280
+                            layer.msg(data.msg);
281
+                            reloadTable(reloadId);
282
+                        } else {
283
+                            layer.msg(data.msg);
284
+                        }
285
+                    }
286
+                });
287
+
288
+            })
289
+            return false;
290
+        }
291
+        layer.msg('请选择需要删除的楼盘',{icon:5});
292
+        return false;
293
+    })
294
+
295
+    form.on('submit(edit_city)', function(data){
296
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
297
+        var formData = new FormData($('form')[0]);
298
+        $.ajax({
299
+            type : "post",
300
+            url : "/pushfresh/freshcityeditform",
301
+            data : formData,
302
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
303
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
304
+            error : function(request) {
305
+                layer.close(index);
306
+                layer.msg("请联系管理员");
307
+            },
308
+            success : function(data) {
309
+                if(data.data != null){
310
+                    layer.msg(ReturnInfo(data.data),{icon:5});
311
+                    return ;
312
+                }
313
+                layer.msg(data.msg);
314
+                parent.layer.close(oindex); //再执行关闭
315
+            }
316
+        });
317
+        return false;
318
+    });
319
+})

+ 334 - 0
backend/web/js/china/pushnews/pone.js

@@ -0,0 +1,334 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , layer = layui.layer //弹层
6
+        , table = layui.table //表格
7
+        , element = layui.element //元素操作
8
+        , form = layui.form
9
+        , upload = layui.upload;
10
+
11
+    var type_id = $('input[name="type"]').val();
12
+    var tableIds = 'videolist';  //表格ID
13
+    var oindex = 0;
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#' + tableIds
17
+        , url: '/pushnews/poneform' //数据接口
18
+        , where: {token: csrfToken, type: type_id}
19
+        , method: 'post'
20
+        , page: true //开启分页
21
+        ,height:600
22
+        , text: '数据加载中'
23
+        , id: 'tablerReload'
24
+        , cols: [[ //表头
25
+            {type: 'numbers', title: '序号', width: 50},
26
+            {type: "checkbox", width: 50},
27
+            {field: 'subject', title: '标题', align: 'center'},
28
+            /*{field: 'img', title: '图片',width:200, align:'center',templet:function(d){
29
+                     return '<img class="layui_magnify" src="'+d.img+'"/>'
30
+                 }},*/
31
+            {
32
+                field: 'sort',
33
+                title: '排序',
34
+                width: 100,
35
+                event: 'sortData',
36
+                edit: 'text',
37
+                align: 'center',
38
+                sort: true,
39
+                templet: "#sortBox"
40
+            }
41
+            , {field: 'create_at', title: '添加时间', width: 150, align: 'center'}
42
+            , {
43
+                field: 'is_show', title: '审核', align: 'center', width: 100, templet: function (d) {
44
+                    if (d.is_show == 2) {
45
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
46
+                    } else {
47
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
48
+                    }
49
+                }
50
+            }
51
+            , {fixed: 'right', title: '操作', width: 200, align: 'center', toolbar: '#operate'}
52
+
53
+        ]]
54
+    });
55
+
56
+    // 列表点击放大图片
57
+    $('.layui-table-main').on('click', '.layui_magnify', function () {
58
+        var _src = $(this).attr('src');
59
+        layui.layer.open({
60
+            type: 1,
61
+            title: false,           //是否显示标题
62
+            area: ['95%', '55%'],
63
+            shade: 0.6,           //透明度
64
+            closeBtn: 1,         //按钮 1有,0无
65
+            shadeClose: true,
66
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
67
+        });
68
+    });
69
+
70
+
71
+    //监听指定开关
72
+    form.on('switch(switchTest)', function (data) {
73
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
74
+            $.post('/pushnews/newsdelandshow', {id: data.value, type: 'show'}, function (data) {
75
+                layer.msg(data.msg);
76
+                table.reload('tablerReload');
77
+
78
+            })
79
+        }, function (aa) {
80
+            table.reload('tablerReload');        //重新加载
81
+        })
82
+    });
83
+// 动态添加批量删除按钮
84
+    var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
85
+        + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_house">批量删除</a>'
86
+        + '</div>'
87
+    $('.layui-form').eq(1).append(_btn)
88
+
89
+    //列表操作
90
+    table.on('tool(' + tableIds + ')', function (obj) {
91
+        var layEvent = obj.event,
92
+            data = obj.data;
93
+
94
+        if (layEvent === 'sortData') {       //修改排序
95
+            table.on('edit(' + tableIds + ')', function (obj) {
96
+                var data = obj.data;
97
+                // console.log(data)
98
+                $.post('/pushnews/newsdelandshow', {id: data.id, type: 'sort', sort: data.sort}, function (data) {
99
+                    if (data.code == 200) {
100
+                        layer.msg(data.msg);
101
+                    } else if (data.code == 300) {
102
+                        layer.msg(data.msg);
103
+                    }
104
+                })
105
+            })
106
+            // layer.prompt({
107
+            //     formType: 2
108
+            //     ,title: '排序'
109
+            //     ,value: data.sort
110
+            // }, function(value, index){
111
+
112
+            //     $.post('/pushnews/newsdelandshow',{id:data.id,type:'sort',sort:value},function (data) {
113
+            //         layer.msg(data.msg);
114
+            //         table.reload('tablerReload');
115
+            //     })
116
+            // });
117
+        } else if (layEvent === 'del') {
118
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
119
+                $.post('/pushnews/newsdelandshow', {id: data.id, type: 'del'}, function (data) {
120
+                    layer.msg(data.msg);
121
+                    table.reload('tablerReload');
122
+                })
123
+            })
124
+        } else if (layEvent === 'edit') {
125
+            var index = layer.open({
126
+                type: 2,
127
+                title: '编辑',
128
+                area: ['800px', '500px'],
129
+                content: '/pushfresh/freshcityedit?id=' + data.id + '&name=' + data.city_name,
130
+                end: function () {
131
+                    table.reload('tablerReload');        //重新加载
132
+                }
133
+            });
134
+        } else if (layEvent === 'Relation') {
135
+            var index = layui.layer.open({
136
+                title: '<span style="color:red" >[' + data.city_name + ']</span>区域相关楼盘',
137
+                type: 2,
138
+                area: ['', '100%'],
139
+                maxmin: true,
140
+                content: "/pushfresh/cityhouse?id=" + data.city_id,
141
+                end: function () {
142
+                    table.reload('tablerReload');
143
+                }
144
+            })
145
+            layui.layer.full(index);
146
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
147
+            $(window).on("resize", function () {
148
+                layui.layer.full(index);
149
+            })
150
+        }
151
+
152
+
153
+    });
154
+
155
+    //添加图片上传
156
+    upload.render({
157
+        elem: '#test1'
158
+        , url: '/house/createimg'
159
+        , data: {token: csrfToken}
160
+        , field: 'img'
161
+        , size: 1000              //限制上传图片的大小,单位为KB
162
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
163
+        , auto: false
164
+        , bindAction: '#addcity'
165
+        , choose: function (obj) {
166
+            obj.preview(function (index, file, result) {
167
+                $('#breviary_img').attr('src', result); //图片链接(base64)
168
+            });
169
+        }
170
+    });
171
+    // 图片放大浏览
172
+    $('.layui_magnify').click(function () {
173
+        var _src = $(this).attr('src');
174
+        layui.layer.open({
175
+            type: 1,
176
+            title: false,           //是否显示标题
177
+            area: ['60%', '80%'],
178
+            shade: 0.6,           //透明度
179
+            closeBtn: 1,         //按钮 1有,0无
180
+            shadeClose: true,
181
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
182
+        });
183
+    })
184
+
185
+    // 新增
186
+    var $ = layui.$, active = {
187
+        addData: function () { //获取选中数据
188
+            oindex = layui.layer.open({
189
+                type: 2,
190
+                title: '添加',
191
+                closeBtn: 1, //不显示关闭按钮
192
+                area: ['800px', '500px'],
193
+                content: '/pushnews/poneadd?type=' + type_id //iframe的url,no代表不显示滚动条
194
+                , success: function (layero, index) {
195
+                },
196
+                end: function () {
197
+                    table.reload('tablerReload');
198
+                }
199
+            });
200
+        },
201
+        reload: function () {//搜索
202
+            var form = pfgs_serialize($('form'));
203
+            var name = '';
204
+            var house_name = '';
205
+            if (form.input_house == 'name') {
206
+                name = form.input_house_text;
207
+            } else if (form.input_house == 'house_name') {
208
+                house_name = form.input_house_text;
209
+            }
210
+            table.reload('tablerReload', {
211
+                where: {
212
+                    title: name,
213
+                    house_name: house_name,
214
+                    city: form.input_city,
215
+                    type_name: form.type_name
216
+                }
217
+            })
218
+        },
219
+    };
220
+    $('.demoTable .layui-btn').on('click', function () {
221
+        var type = $(this).data('type');
222
+        active[type] ? active[type].call(this) : '';
223
+    });
224
+
225
+
226
+    $('.The_house').focus(function () {
227
+        indexOpen = parent.layui.layer.open({
228
+            type: 2,
229
+            /*title: '选择需要添加的资讯',*/
230
+            area: ['', '100%'],
231
+            content: '/pushnews/pushnews?type=1', //1单选
232
+            success: function (layero, index) {
233
+            },
234
+            end: function () {
235
+            }
236
+        });
237
+        parent.layui.layer.full(indexOpen);
238
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
239
+        $(window).on("resize", function () {
240
+            parent.layui.layer.full(indexOpen);
241
+        })
242
+    })
243
+
244
+
245
+    //添加页面提交数据
246
+    form.on('submit(add)', function (data) {
247
+        var formData = new FormData($('form')[0]);
248
+        layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
249
+        $.ajax({
250
+            type: "post",
251
+            url: "/pushnews/poneaddform",
252
+            data: formData,
253
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
254
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
255
+            error: function (request) {
256
+                layer.close(index);
257
+                layer.msg("请联系管理员");
258
+            },
259
+            success: function (data) {
260
+                if (data.data != null) {
261
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
262
+                    return;
263
+                }
264
+                layer.msg(data.msg);
265
+                parent.layer.closeAll(); //再执行关闭
266
+
267
+            }
268
+        });
269
+        return false;
270
+    });
271
+
272
+    form.on('submit(del_alls_house)', function (data) {
273
+        var checkStatus = table.checkStatus('tablerReload');
274
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
275
+        if (typeof  checkStatus.data[0] == 'object') {
276
+            layer.confirm('您确定要删除吗?', {btn: ['确认', '取消']}, function () {
277
+                var formdat = new FormData();
278
+                $.each(checkStatus.data, function (key, val) {
279
+                    formdat.append('hid[]', val.id);
280
+                })
281
+                $.ajax({
282
+                    cache: true,
283
+                    type: "post",
284
+                    url: "/pushnews/newpdel",
285
+                    data: formdat,  // 你的formid
286
+                    // async : false,          //async 默认为true异步,修改为false为同步
287
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
288
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
289
+                    error: function (request) {
290
+                        layer.close(index);         //关闭数据提交信息
291
+                        layer.alert("网络超时");
292
+                    },
293
+                    success: function (data) {
294
+                        if (data.code == 200) {
295
+                            layer.msg(data.msg);
296
+                            reloadTable(reloadId);
297
+                        } else {
298
+                            layer.msg(data.msg);
299
+                        }
300
+                    }
301
+                });
302
+
303
+            })
304
+            return false;
305
+        }
306
+        layer.msg('请选择需要删除的楼盘', {icon: 5});
307
+        return false;
308
+    })
309
+
310
+    form.on('submit(edit_city)', function (data) {
311
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
312
+        var formData = new FormData($('form')[0]);
313
+        $.ajax({
314
+            type: "post",
315
+            url: "/pushfresh/freshcityeditform",
316
+            data: formData,
317
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
318
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
319
+            error: function (request) {
320
+                layer.close(index);
321
+                layer.msg("请联系管理员");
322
+            },
323
+            success: function (data) {
324
+                if (data.data != null) {
325
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
326
+                    return;
327
+                }
328
+                layer.msg(data.msg);
329
+                parent.layer.close(oindex); //再执行关闭
330
+            }
331
+        });
332
+        return false;
333
+    });
334
+})

+ 114 - 0
backend/web/js/china/pushnews/pushnews.js

@@ -0,0 +1,114 @@
1
+var indexOpen;
2
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
3
+
4
+    var laypage = layui.laypage //分页
5
+        ,$ = layui.jquery
6
+        ,layer = layui.layer //弹层
7
+        ,table = layui.table //表格
8
+
9
+
10
+    var tableIds = 'videolist';  //表格ID
11
+
12
+    var $ = layui.$, active = {
13
+        house_reload:function(){
14
+            var form = pfgs_serialize($('form'));
15
+            console.log(form);
16
+            table.reload('houseReload',{
17
+                where:{
18
+                    subject:form.input_house_text
19
+                }
20
+            })
21
+        }
22
+    };
23
+
24
+    $('.demoTable .layui-btn').on('click', function(){
25
+        var type = $(this).data('type');
26
+        active[type] ? active[type].call(this) : '';
27
+    });
28
+
29
+    var indexO = table.render({
30
+        elem: '#houselist'
31
+        ,url: '/pushnews/pushnewsform' //数据接口
32
+        ,where:{token:csrfToken}
33
+        ,method:'post'
34
+        ,page: true //开启分页
35
+        ,text:'数据加载中'
36
+        ,id:'houseReload'
37
+        ,limit : 20
38
+        ,cols: [[ //表头
39
+            {type: "checkbox", width:50},
40
+            // {title:'选择',event:'checkbox',width:50,align:'center',templet:"#checkBox",templet:function(d){
41
+            //         return '<div class="layui-inline" style="width: 100%"><input type="checkbox" name="sex" ></div>'
42
+            //     }},
43
+            {type:'numbers',title:'序号'},
44
+            {field: 'subject', title: '资讯名称', align:'center'},
45
+        ]]
46
+    });
47
+
48
+    //选择所属楼盘添加
49
+    var _data = [];
50
+
51
+    table.on('checkbox(houselist)', function(obj){
52
+
53
+        if(obj.checked == true){
54
+                _data.push(obj.data);
55
+        }
56
+        if(obj.checked == false){
57
+            var del = [];
58
+            $.each(_data,function(key,val){
59
+                console.log(val.subject);
60
+                    if(val.subject == obj.data.subject){
61
+                        del.push(key);
62
+                    }
63
+            })
64
+
65
+            if(del.length >0){
66
+                $.each(del,function(key,val){
67
+                    console.log(key);
68
+                    _data.splice(key,1);
69
+                })
70
+            }
71
+        }
72
+    });
73
+
74
+
75
+    // 提交按钮
76
+    $('.xuanzhouse').click(function () {
77
+        var a =  parent.layer.getChildFrame('body', indexOpen);
78
+
79
+        var type = $('#types').html();
80
+        // console.log(type);
81
+        if(type == 1){
82
+            var _length = a.find('input#hiddenBox[type="hidden"]');
83
+
84
+            if(_length.length > 0){
85
+                _length.remove();
86
+            }
87
+            if(_data.length > 1){
88
+                layer.msg('请勿选择多个');
89
+                return ;
90
+            }
91
+            console.log(_data[0].subject);
92
+            a.find('#house_name').val(_data[0].subject)
93
+            a.find('form').append('<input type="hidden" id="hiddenBox" name="nid" value="'+_data[0].id+'" />');
94
+        } else {
95
+            a.find('tbody').html('');
96
+            if(typeof _data == 'object'){
97
+                for(var i=0;i<_data.length;i++){
98
+                    var tr ='<tr>'
99
+                        +'<td lay-event="del">'
100
+                        +'<div class="layui-table-cell del"><i class="layui-icon" style="font-size: 30px; color: #1E9FFF;cursor: pointer">&#xe640;</i></div>'
101
+                        +'</td>'
102
+                        +'<td data-field="matingName" align="center" data-content="">'
103
+                        +'<div class="layui-table-cell"><input type="text" name="matingName" value="'+_data[i].city_name+'" autocomplete="off" class="layui-input" ><input type="hidden" name="id" value="'+_data[i].id+'"></div>'
104
+                        +'</td>'
105
+                        +'</tr>'
106
+                    a.find('tbody').append(tr);
107
+                }
108
+             }
109
+        }
110
+        TableClose();
111
+    })
112
+
113
+
114
+});

+ 319 - 0
backend/web/js/china/pushnews/quicknews.js

@@ -0,0 +1,319 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+    var type_id = $('input[name="type"]').val();
12
+    var tableIds = 'videolist';  //表格ID
13
+    var oindex = 0;
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#'+tableIds
17
+        ,url: '/pushnews/poneform' //数据接口
18
+        ,where:{token:csrfToken,type:type_id}
19
+        ,method:'post'
20
+        ,page: false //开启分页
21
+        ,height:600
22
+        ,text:'数据加载中'
23
+        ,id:'tablerReload'
24
+        ,cols: [[ //表头
25
+            {type:'numbers',title:'序号',width:50},
26
+            {field: 'subject', title: '标题', align:'center'},
27
+            /*{field: 'img', title: '图片',width:200, align:'center',templet:function(d){
28
+             return '<img class="layui_magnify" src="'+d.img+'"/>'
29
+             }},*/
30
+            {field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"}
31
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
32
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
33
+                if(d.is_show == 2){
34
+                    return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
35
+                } else {
36
+                    return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
37
+                }
38
+            }}
39
+              ,{fixed: 'right',title:'操作', width: 200, align:'center', toolbar: '#operate'}
40
+
41
+        ]]
42
+    });
43
+
44
+    // 列表点击放大图片
45
+    $('.layui-table-main').on('click','.layui_magnify', function(){
46
+        var _src = $(this).attr('src');
47
+        layui.layer.open({
48
+            type: 1,
49
+            title: false,           //是否显示标题
50
+            area: ['95%', '55%'],
51
+            shade: 0.6,           //透明度
52
+            closeBtn: 1,         //按钮 1有,0无
53
+            shadeClose: true,
54
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
55
+        });
56
+    });
57
+
58
+
59
+    //监听指定开关
60
+    form.on('switch(switchTest)', function(data){
61
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
62
+            $.post('/pushnews/newsdelandshow',{id:data.value,type:'show'},function (data) {
63
+                layer.msg(data.msg);
64
+                table.reload('tablerReload');
65
+
66
+            })
67
+        },function (aa) {
68
+            table.reload('tablerReload');        //重新加载
69
+        })
70
+    });
71
+
72
+    //列表操作
73
+    table.on('tool('+tableIds+')', function(obj){
74
+        var layEvent = obj.event,
75
+            data = obj.data;
76
+
77
+        if(layEvent === 'sortData'){       //修改排序
78
+            table.on('edit('+tableIds+')', function(obj){
79
+                var data = obj.data;
80
+                // console.log(data)
81
+                $.post('/pushnews/newsdelandshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
82
+                    if(data.code == 200)
83
+                    {
84
+                        layer.msg(data.msg);
85
+                    } else if(data.code == 300 ) {
86
+                        layer.msg(data.msg);
87
+                    }
88
+                })
89
+            })
90
+            // layer.prompt({
91
+            //     formType: 2
92
+            //     ,title: '排序'
93
+            //     ,value: data.sort
94
+            // }, function(value, index){
95
+
96
+            //     $.post('/pushnews/newsdelandshow',{id:data.id,type:'sort',sort:value},function (data) {
97
+            //         layer.msg(data.msg);
98
+            //         table.reload('tablerReload');
99
+            //     })
100
+            // });
101
+        }else if(layEvent === 'del') {
102
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
103
+                $.post('/pushnews/newsdelandshow',{id:data.id,type:'del'},function (data) {
104
+                    layer.msg(data.msg);
105
+                    table.reload('tablerReload');
106
+                })
107
+            })
108
+        } else if(layEvent === 'edit'){
109
+            var index = layer.open({
110
+                type: 2,
111
+                title: '编辑',
112
+                area:['800px','500px'],
113
+                content: '/pushfresh/freshcityedit?id='+data.id+'&name='+data.city_name,
114
+                end:function () {
115
+                    table.reload('tablerReload');        //重新加载
116
+                }
117
+            });
118
+        } else if(layEvent === 'Relation'){
119
+            var index =layui.layer.open({
120
+                title :'<span style="color:red" >['+data.city_name+']</span>区域相关楼盘',
121
+                type : 2,
122
+                area:['','100%'],
123
+                maxmin: true,
124
+                content : "/pushfresh/cityhouse?id="+data.city_id,
125
+                end:function () {
126
+                    table.reload('tablerReload');
127
+                }
128
+            })
129
+            layui.layer.full(index);
130
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
131
+            $(window).on("resize",function(){
132
+                layui.layer.full(index);
133
+            })
134
+        }
135
+
136
+
137
+    });
138
+
139
+    //添加图片上传
140
+    upload.render({
141
+        elem: '#test1'
142
+        ,url: '/house/createimg'
143
+        ,data:{token:csrfToken}
144
+        ,field:'img'
145
+        ,size:1000              //限制上传图片的大小,单位为KB
146
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
147
+        ,auto:false
148
+        ,bindAction:'#addcity'
149
+        ,choose: function(obj){
150
+            obj.preview(function(index, file, result){
151
+                $('#breviary_img').attr('src', result); //图片链接(base64)
152
+            });
153
+        }
154
+    });
155
+    // 图片放大浏览
156
+    $('.layui_magnify').click(function(){
157
+        var _src = $(this).attr('src');
158
+        layui.layer.open({
159
+            type: 1,
160
+            title: false,           //是否显示标题
161
+            area: ['60%', '80%'],
162
+            shade: 0.6,           //透明度
163
+            closeBtn: 1,         //按钮 1有,0无
164
+            shadeClose: true,
165
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
166
+        });
167
+    })
168
+
169
+    // 新增
170
+    var $ = layui.$, active = {
171
+        addData: function(){ //获取选中数据
172
+            oindex = layui.layer.open({
173
+                type: 2,
174
+                title: '添加',
175
+                closeBtn: 1, //不显示关闭按钮
176
+                area: ['800px','500px'],
177
+                content: '/pushnews/quicknewsadd?type='+type_id //iframe的url,no代表不显示滚动条
178
+                ,success:function (layero, index) {
179
+                },
180
+                end:function () {
181
+                    table.reload('tablerReload');
182
+                }
183
+            });
184
+        },
185
+        reload:function(){//搜索
186
+            var form = pfgs_serialize($('form'));
187
+            var name = '';
188
+            var house_name   = '';
189
+            if(form.input_house == 'name'){
190
+                name = form.input_house_text;
191
+            } else if(form.input_house == 'house_name'){
192
+                house_name = form.input_house_text;
193
+            }
194
+            table.reload('tablerReload',{
195
+                where:{
196
+                    title:name,
197
+                    house_name:house_name,
198
+                    city:form.input_city,
199
+                    type_name:form.type_name
200
+                }
201
+            })
202
+        },
203
+    };
204
+    $('.demoTable .layui-btn').on('click', function(){
205
+        var type = $(this).data('type');
206
+        active[type] ? active[type].call(this) : '';
207
+    });
208
+
209
+
210
+    $('.The_house').focus(function(){
211
+        indexOpen = parent.layui.layer.open({
212
+            type: 2,
213
+            /*title: '选择需要添加的资讯',*/
214
+            area: ['','100%'],
215
+            content: '/publicuse/news?type=1', //1单选
216
+            success:function (layero, index) {
217
+            },
218
+            end:function(){
219
+            }
220
+        });
221
+        parent.layui.layer.full(indexOpen);
222
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
223
+        $(window).on("resize",function(){
224
+            parent.layui.layer.full(indexOpen);
225
+        })
226
+    })
227
+
228
+
229
+
230
+    //添加页面提交数据
231
+    form.on('submit(add)', function(data){
232
+        var formData = new FormData($('form')[0]);
233
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
234
+        $.ajax({
235
+            type : "post",
236
+            url : "/pushnews/Quicknewsaddform",
237
+            data : formData,
238
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
239
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
240
+            error : function(request) {
241
+                layer.close(index);
242
+                layer.msg("请联系管理员");
243
+            },
244
+            success : function(data) {
245
+                if(data.data != null){
246
+                    layer.msg(ReturnInfo(data.data),{icon:5});
247
+                    return ;
248
+                }
249
+                layer.msg(data.msg);
250
+                parent.layer.closeAll(); //再执行关闭
251
+
252
+            }
253
+        });
254
+        return false;
255
+    });
256
+
257
+    form.on('submit(del_alls_house)',function (data) {
258
+        var checkStatus = table.checkStatus('tablerReload');
259
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
260
+        if(typeof  checkStatus.data[0] == 'object'){
261
+            layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
262
+                var formdat = new FormData();
263
+                $.each(checkStatus.data,function (key,val) {
264
+                    formdat.append('hid[]',val.id);
265
+                })
266
+                $.ajax({
267
+                    cache : true,
268
+                    type : "post",
269
+                    url : "/pushnews/newpdel",
270
+                    data : formdat,  // 你的formid
271
+                    // async : false,          //async 默认为true异步,修改为false为同步
272
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
273
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
274
+                    error : function(request) {
275
+                        layer.close(index);         //关闭数据提交信息
276
+                        layer.alert("网络超时");
277
+                    },
278
+                    success : function(data) {
279
+                        if (data.code == 200) {
280
+                            layer.msg(data.msg);
281
+                            reloadTable(reloadId);
282
+                        } else {
283
+                            layer.msg(data.msg);
284
+                        }
285
+                    }
286
+                });
287
+
288
+            })
289
+            return false;
290
+        }
291
+        layer.msg('请选择需要删除的楼盘',{icon:5});
292
+        return false;
293
+    })
294
+
295
+    form.on('submit(edit_city)', function(data){
296
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
297
+        var formData = new FormData($('form')[0]);
298
+        $.ajax({
299
+            type : "post",
300
+            url : "/pushfresh/freshcityeditform",
301
+            data : formData,
302
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
303
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
304
+            error : function(request) {
305
+                layer.close(index);
306
+                layer.msg("请联系管理员");
307
+            },
308
+            success : function(data) {
309
+                if(data.data != null){
310
+                    layer.msg(ReturnInfo(data.data),{icon:5});
311
+                    return ;
312
+                }
313
+                layer.msg(data.msg);
314
+                parent.layer.close(oindex); //再执行关闭
315
+            }
316
+        });
317
+        return false;
318
+    });
319
+})

+ 378 - 0
backend/web/js/china/timelimitsgroup.js

@@ -0,0 +1,378 @@
1
+layui.use(['laypage', 'layer', 'laydate', 'table', 'element', 'form', 'upload'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , laydate = layui.laydate
6
+        , layer = layui.layer //弹层
7
+        , table = layui.table //表格
8
+        , element = layui.element //元素操作
9
+        , form = layui.form
10
+        , upload = layui.upload;
11
+
12
+
13
+    var tableIds = 'videolist';  //表格ID
14
+    var type_id = $('input[name="typeid"]').val();
15
+    //第一个实例
16
+    table.render({
17
+        elem: '#' + tableIds
18
+        , url: '/push/timelimitsgroupform' //数据接口
19
+        , where: {token: csrfToken, type: type_id}
20
+        , method: 'post'
21
+        , page: true //开启分页
22
+        ,height:600
23
+        , text: '数据加载中'
24
+        , id: 'tablerReload'
25
+        , limit: 15
26
+        , cols: [[ //表头
27
+            {type: 'numbers', title: '序号', width: 50},
28
+            {field: 'name', title: '楼盘名称', align: 'center'},
29
+            {field: 'province', title: '区域', align: 'center'},
30
+            {
31
+                field: 'click',
32
+                title: '关注度',
33
+                width: 100,
34
+                event: 'clickData',
35
+                edit: 'text',
36
+                align: 'center',
37
+                sort: true,
38
+                templet: "#clickBox"
39
+            },
40
+            {
41
+                field: 'group_num',
42
+                title: '抢购数',
43
+                width: 100,
44
+                event: 'groupnumData',
45
+                edit: 'text',
46
+                align: 'center',
47
+                sort: true,
48
+                templet: "#groupnumBox"
49
+            },
50
+            {
51
+                field: 'sort',
52
+                title: '排序',
53
+                width: 100,
54
+                event: 'sortData',
55
+                edit: 'text',
56
+                align: 'center',
57
+                sort: true,
58
+                templet: "#sortBox"
59
+            },
60
+            {field: 'create_at', title: '添加时间', width: 150, align: 'center'},
61
+            {
62
+                field: 'is_show', title: '审核', align: 'center', width: 100, templet: function (d) {
63
+                    if (d.is_show == 2) {
64
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
65
+                    } else {
66
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open" title="' + d.is_show + '" lay-skin="switch" lay-filter="switchTest" lay-text="|">'
67
+                    }
68
+                }
69
+            }
70
+            , {fixed: 'right', title: '操作', width: 120, align: 'center', toolbar: '#operate'}
71
+
72
+        ]]
73
+    });
74
+
75
+    //监听指定开关
76
+    form.on('switch(switchTest)', function (data) {
77
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
78
+            $.post('/push/timelimitsgroupdelandshow', {id: data.value, type: 'show'}, function (data) {
79
+                layer.msg(data.msg);
80
+                table.reload('tablerReload');
81
+            })
82
+        }, function (aa) {
83
+            table.reload('tablerReload');        //重新加载
84
+        })
85
+    });
86
+
87
+// 日期
88
+    laydate.render({
89
+        elem: '#EventDate'
90
+    });
91
+    laydate.render({
92
+        elem: '#ModificationDate'
93
+    });
94
+
95
+    //列表操作
96
+    table.on('tool(' + tableIds + ')', function (obj) {
97
+        var layEvent = obj.event,
98
+            data = obj.data;
99
+        if (layEvent === 'sortData') {       //修改排序
100
+            /* 列表操作  edit  修改后执行  2018.7.24*/
101
+            table.on('edit(' + tableIds + ')', function (obj) {
102
+                var data = obj.data;
103
+                $.post('/push/timelimitsgroupdelandshow', {
104
+                    id: data.id,
105
+                    type: 'sort',
106
+                    sort: data.sort
107
+                }, function (data) {
108
+                    if (data.code == 200) {
109
+                        layer.msg(data.msg);
110
+                    } else if (data.code == 300) {
111
+                        layer.msg(data.msg);
112
+                    }
113
+                })
114
+            })
115
+            // layer.prompt({
116
+            //     formType: 2
117
+            //     ,title: '排序热销楼盘:<span style="color:red">'+data.name+'</span>'
118
+            //     ,value: data.sort
119
+            // }, function(value, index){
120
+
121
+            //         $.post('/pushm/saledelshow',{id:data.id,type:'sort',sort:value},function (data) {
122
+            //             layer.msg(data.msg);
123
+            //             table.reload('tablerReload');
124
+            //         })pfg_pushm_hothousesort
125
+            // });
126
+        }
127
+
128
+        if (layEvent === 'clickData') {       //修改排序
129
+            /* 列表操作  edit  修改后执行  2018.7.24*/
130
+            table.on('edit(' + tableIds + ')', function (obj) {
131
+                var data = obj.data;
132
+                $.post('/push/timelimitsgroupdelandshow', {
133
+                    id: data.id,
134
+                    type: 'click',
135
+                    click: data.click
136
+                }, function (data) {
137
+                    if (data.code == 200) {
138
+                        layer.msg(data.msg);
139
+                    } else if (data.code == 300) {
140
+                        layer.msg(data.msg);
141
+                    }
142
+                })
143
+            })
144
+
145
+            // layer.prompt({
146
+            //     formType: 2
147
+            //     ,title: '排序热销楼盘:<span style="color:red">'+data.name+'</span>'
148
+            //     ,value: data.sort
149
+            // }, function(value, index){
150
+
151
+            //         $.post('/pushm/saledelshow',{id:data.id,type:'sort',sort:value},function (data) {
152
+            //             layer.msg(data.msg);
153
+            //             table.reload('tablerReload');
154
+            //         })
155
+            // });
156
+        }
157
+
158
+        if (layEvent === 'groupnumData') {       //修改排序
159
+            /* 列表操作  edit  修改后执行  2018.7.24*/
160
+            table.on('edit(' + tableIds + ')', function (obj) {
161
+                var data = obj.data;
162
+                $.post('/push/timelimitsgroupdelandshow', {
163
+                    id: data.id,
164
+                    type: 'group_num',
165
+                    group_num: data.group_num
166
+                }, function (data) {
167
+                    if (data.code == 200) {
168
+                        layer.msg(data.msg);
169
+                    } else if (data.code == 300) {
170
+                        layer.msg(data.msg);
171
+                    }
172
+                })
173
+            })
174
+
175
+            // layer.prompt({
176
+            //     formType: 2
177
+            //     ,title: '排序热销楼盘:<span style="color:red">'+data.name+'</span>'
178
+            //     ,value: data.sort
179
+            // }, function(value, index){
180
+
181
+            //         $.post('/pushm/saledelshow',{id:data.id,type:'sort',sort:value},function (data) {
182
+            //             layer.msg(data.msg);
183
+            //             table.reload('tablerReload');
184
+            //         })
185
+            // });
186
+        }
187
+
188
+        if (layEvent === 'del') {
189
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
190
+                $.post('/push/timelimitsgroupdelandshow', {id: data.id, type: 'del'}, function (data) {
191
+                    layer.msg(data.msg);
192
+                    table.reload('tablerReload');
193
+                })
194
+            })
195
+        }
196
+        if (layEvent === 'edit') {
197
+            var index = layer.open({
198
+                type: 2,
199
+                title: '修改限时团购',
200
+                area: ['800px', '500px'],
201
+                content: '/push/timelimitsgroupedit?id=' + data.id + '&house_name=' + data.name,
202
+                end: function () {
203
+                    table.reload('tablerReload');        //重新加载
204
+                }
205
+            });
206
+        }
207
+
208
+    });
209
+
210
+    // 新增
211
+    var $ = layui.$, active = {
212
+        addData: function () { //获取选中数据
213
+            var index = layui.layer.open({
214
+                type: 2,
215
+                title: '添加楼盘',
216
+                closeBtn: 1, //不显示关闭按钮
217
+                area: ['600px', '345px'],
218
+                content: '/push/timelimitsgroupadd?type=' + type_id
219
+                , success: function (layero, index) {
220
+                    // indexOpen = layer.getChildFrame('body', index)  ;
221
+                    // console.log(indexOpen);
222
+                },
223
+                end: function () {
224
+                    table.reload('tablerReload');
225
+                }
226
+            });
227
+        },
228
+        reload: function () {
229
+            var form = pfgs_serialize($('form'));
230
+            // var name = '';
231
+            // var house_name   = '';
232
+            // if(form.input_house == 'name'){
233
+            //     name = form.input_house_text;
234
+            // } else if(form.input_house == 'house_name'){
235
+            //     house_name = form.input_house_text;
236
+            // }
237
+            table.reload('tablerReload', {
238
+                where: {
239
+                    house_name: form.input_house_text,
240
+                    province: form.province
241
+                }
242
+            })
243
+        },
244
+
245
+        alledit: function () { //获取选中数据
246
+            var index = layui.layer.open({
247
+                type: 2,
248
+                title: '批量修改时间',
249
+                closeBtn: 1, //不显示关闭按钮
250
+                area: ['600px', '345px'],
251
+                content: '/push/timealledit'
252
+                , success: function (layero, index) {
253
+                    // indexOpen = layer.getChildFrame('body', index)  ;
254
+                    // console.log(indexOpen);
255
+                },
256
+                end: function () {
257
+                    table.reload('tablerReload');
258
+                }
259
+            });
260
+        },
261
+    };
262
+    $('.demoTable .layui-btn').on('click', function () {
263
+        var type = $(this).data('type');
264
+        active[type] ? active[type].call(this) : '';
265
+    });
266
+
267
+// select 选中
268
+    form.on('select(cityname)', function (data) {
269
+        var city = $(this).html();
270
+        $('.mt input').val(city);
271
+    })
272
+    $('.The_house').focus(function () {
273
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
274
+        indexOpen = parent.layui.layer.open({
275
+            type: 2,
276
+            title: '选择需要添加的楼盘',
277
+            area: ['', '100%'],
278
+            content: '/publicuse/housenamecn',
279
+            success: function (layero, index) {
280
+            },
281
+            end: function () {
282
+            }
283
+        });
284
+        parent.layui.layer.full(indexOpen);
285
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
286
+        $(window).on("resize", function () {
287
+            parent.layui.layer.full(indexOpen);
288
+        })
289
+    })
290
+
291
+    //添加页面提交数据
292
+    form.on('submit(add)', function (data) {
293
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
294
+
295
+        var formData = new FormData($('form')[0]);
296
+        $.ajax({
297
+            cache: false,
298
+            type: "post",
299
+            url: "/push/timelimitsgroupaddform",
300
+            data: formData,  // 你的formid
301
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
302
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
303
+            error: function (request) {
304
+                layer.close(index);
305
+                layer.msg("请联系管理员");
306
+            },
307
+            success: function (data) {
308
+                if (data.data != null) {
309
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
310
+                    return;
311
+                }
312
+                layer.msg(data.msg);
313
+                parent.layer.close(oindex); //再执行关闭   
314
+            }
315
+        });
316
+        return false;
317
+    });
318
+
319
+
320
+//修改页面提交数据
321
+    form.on('submit(edit)', function (data) {
322
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
323
+
324
+        var formData = new FormData($('form')[0]);
325
+        $.ajax({
326
+            cache: false,
327
+            type: "post",
328
+            url: "/push/timelimitsgroupeditform",
329
+            data: formData,  // 你的formid
330
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
331
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
332
+            error: function (request) {
333
+                layer.close(index);
334
+                layer.msg("请联系管理员");
335
+            },
336
+            success: function (data) {
337
+                if (data.data != null) {
338
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
339
+                    return;
340
+                }
341
+                layer.msg(data.msg);
342
+                parent.layer.close(oindex); //再执行关闭   
343
+                //layer.close(index);
344
+            }
345
+        });
346
+        return false;
347
+    });
348
+
349
+    //批量修改页面提交数据
350
+    form.on('submit(alledit)', function (data) {
351
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
352
+
353
+        var formData = new FormData($('form')[0]);
354
+        $.ajax({
355
+            cache: false,
356
+            type: "post",
357
+            url: "/push/timealleditform",
358
+            data: formData,  // 你的formid
359
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
360
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
361
+            error: function (request) {
362
+                layer.close(index);
363
+                layer.msg("请联系管理员");
364
+            },
365
+            success: function (data) {
366
+                if (data.data != null) {
367
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
368
+                    return;
369
+                }
370
+                layer.msg(data.msg);
371
+                parent.layer.close(oindex); //再执行关闭
372
+            }
373
+        });
374
+        return false;
375
+    });
376
+
377
+
378
+})

+ 137 - 0
backend/web/js/china/usersignup/label.js

@@ -0,0 +1,137 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+
9
+    var tableIds = 'newsCategoryList';
10
+    //第一个实例
11
+    table.render({
12
+        elem: '#'+tableIds
13
+        ,url: '/usersignup/labelform' //数据接口
14
+        ,where:{token:csrfToken}
15
+        ,method:'post'
16
+        ,page: true //开启分页
17
+        ,height:600
18
+        ,text:'数据加载中'
19
+        ,id:'tablereload'
20
+        ,cols: [[ //表头
21
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
22
+            {field: 'name', title: '来源名称', align:'center'}
23
+            ,{field: 'type', title: '来源设备', align:'center'}
24
+            ,{field: 'source_id', title: '文档ID',align:'center'}
25
+            ,{field: 'create_at', title: '添加时间', align:'center'}
26
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
27
+
28
+        ]]
29
+    });
30
+
31
+    //列表操作
32
+    table.on('tool('+tableIds+')', function(obj){
33
+        var layEvent = obj.event,
34
+            data = obj.data;
35
+        if(layEvent === 'edit'){
36
+            layer.open({
37
+                type: 2,
38
+                title: '编辑报名来源信息',
39
+                closeBtn: 1, //不显示关闭按钮
40
+                shade: [0],
41
+                area: ['600px', '500px'],
42
+                anim: 2,
43
+                content: '/usersignup/labeledit?id='+data.id, //iframe的url,no代表不显示滚动条
44
+                end:function () {
45
+                    table.reload('tablereload');
46
+                }
47
+            });
48
+        } else if(layEvent === 'del') {
49
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
50
+                data.del = 2;
51
+                $.post('/usersignup/labeleditform',{data:data},function (data) {
52
+                    layer.msg(data.msg);
53
+                    table.reload('tablereload');
54
+                })
55
+            })
56
+        }
57
+
58
+
59
+    });
60
+
61
+    var $ = layui.$, active = {
62
+        addData: function(){ //获取选中数据
63
+
64
+            layer.open({
65
+                type: 2,
66
+                title: '添加资讯分类',
67
+                closeBtn: 1, //不显示关闭按钮
68
+                shade: [0],
69
+                area: ['600px', '500px'],
70
+                anim: 2,
71
+                content: '/usersignup/labeladd', //iframe的url,no代表不显示滚动条
72
+                end:function () {
73
+                    table.reload('tablereload');
74
+                }
75
+            });
76
+
77
+            // var checkStatus = table.checkStatus('idTest')
78
+            //     ,data = checkStatus.data;
79
+            // layer.alert(JSON.stringify(data));
80
+        },
81
+        reload:function () {
82
+            var form = pfgs_serialize($('form'));
83
+            var name = '';
84
+            var id   = '';
85
+            if(form.input_house == 'name'){
86
+                name = form.input_house_text;
87
+            } else if(form.input_house == 'id'){
88
+                id = form.input_house_text;
89
+            }
90
+
91
+            table.reload('tablereload',{
92
+                where:{
93
+                    type:form.type,
94
+                    name:name,
95
+                    source_id:id
96
+                },
97
+                page:{
98
+                    curr:1
99
+                }
100
+            })
101
+        }
102
+    };
103
+
104
+    $('.demoTable .layui-btn').on('click', function(){
105
+        var type = $(this).data('type');
106
+        active[type] ? active[type].call(this) : '';
107
+    });
108
+
109
+    //修改
110
+    form.on('submit(editnews)', function(data){
111
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
112
+        $.post('/usersignup/labeleditform',{'data':data.field,'token':csrfToken},function (data) {
113
+            if(data.data != null){
114
+                layer.msg(ReturnInfo(data.data),{icon:5});
115
+                return ;
116
+            }
117
+            layer.msg(data.msg);
118
+            TableClose();
119
+        })
120
+        return false;
121
+    });
122
+
123
+    //添加
124
+    form.on('submit(addnews)', function(data){
125
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
126
+        $.post('/usersignup/labeladdform',{'data':data.field,'token':csrfToken},function (data) {
127
+                    if(data.data != null){
128
+                        layer.msg(ReturnInfo(data.data),{icon:5});
129
+                        return ;
130
+                    }
131
+                    layer.msg(data.msg);
132
+            TableClose();
133
+        })
134
+        return false;
135
+    });
136
+
137
+});

+ 205 - 0
backend/web/js/china/usersignup/signup.js

@@ -0,0 +1,205 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'laydate'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , layer = layui.layer //弹层
5
+        , table = layui.table //表格
6
+        , element = layui.element //元素操作
7
+        , form = layui.form,
8
+        laydate = layui.laydate;
9
+
10
+
11
+    laydate.render({
12
+        elem: '#date1'
13
+    });
14
+    laydate.render({
15
+        elem: '#date2'
16
+    });
17
+    //第一个实例
18
+    var tableIns = table.render({
19
+        elem: '#userlist'
20
+        , url: '/usersignup/homeform' //数据接口
21
+        , where: {token: csrfToken}
22
+        , method: 'post'
23
+        , id: 'tablerReload'
24
+        , page: true //开启分页
25
+        ,height:600
26
+        , limit: 20
27
+        , text: '数据加载中'
28
+        , cols: [[ //表头
29
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
30
+            {type: 'numbers', fixed: "left", title: '序号'},
31
+            {type: "checkbox", width: 50},
32
+            {
33
+                field: 'equipment',
34
+                title: '设备',
35
+                width: 110,
36
+                align: 'center',
37
+                templet: "#equipment",
38
+                templet: function (d) {
39
+                    if (d.equipment == 'PC') {
40
+                        return '<div class="layui-table-cell" style="color:red;">' + d.equipment + '</div>'
41
+                    } else {
42
+                        return '<div class="layui-table-cell" style="color:#009688;">' + d.equipment + '</div>'
43
+                    }
44
+                }
45
+            }
46
+            , {field: 'ip', title: 'ip', width: 150, align: 'center'}
47
+            , {field: 'source', title: '来源', align: 'center'}
48
+            // ,{field: 'name', title: '姓名',width:100,align:'center'}
49
+            , {field: 'mobile', title: '手机号码', width: 150, align: 'center'}
50
+            , {
51
+                field: 'city_name', title: '区域', width: 150, align: 'center', templet: function (d) {
52
+                    if (d.city_name != null) {
53
+                        return '<div class="layui-table-cell" style="color:#c8601f;font-weight:600">' + d.city_name + '</div>'
54
+                    } else {
55
+                        return '<div class="layui-table-cell" style="font-weight:600">-----</div>'
56
+                    }
57
+                }
58
+            }
59
+            , {
60
+                field: 'house_name', title: '归属', width: 200, align: 'center', templet: function (d) {
61
+                    if (d.house_name != null) {
62
+                        return '<div class="layui-table-cell" style="font-weight:600">' + d.house_name + '</div>'
63
+                    } else {
64
+                        return '<div class="layui-table-cell" style="font-weight:600">-----</div>'
65
+                    }
66
+                }
67
+            }
68
+            , {field: 'state', title: '发送状态', width: 150, align: 'center'}
69
+            , {field: 'send_email', title: '发送邮箱', width: 150, align: 'center'}
70
+            , {field: 'create_at', title: '日期', width: 150, align: 'center'}
71
+            // ,{field: 'city', title: '用户区域',width:80,align:'center'}
72
+            // ,{field: 'send_email', title: '发送邮箱',width:180,align:'center'}
73
+            // ,{field: 'state', title: '发送状态',width:100,align:'center',templet:"#state",templet:function(d){
74
+            //         if(d.state == '成功'){
75
+            //             return '<div class="layui-table-cell" style="color:#00960b;font-weight:600">'+d.state+'</div>'
76
+            //         }else {
77
+            //             return '<div class="layui-table-cell" style="color:red;font-weight:600">'+d.state+'</div>'
78
+            //         }
79
+            //     }}
80
+
81
+            , {fixed: 'right', title: '操作', width: 150, align: 'center', toolbar: '#signupBar'}
82
+
83
+        ]]
84
+    });
85
+
86
+    // tableIns.reload('tablerReload');        //重新加载
87
+
88
+    //列表操作
89
+    table.on('tool(userlist)', function (obj) {
90
+        var layEvent = obj.event,
91
+            data = obj.data;
92
+        if (layEvent === 'edit') {
93
+            layer.open({
94
+                type: 2,
95
+                title: '用户详情',
96
+                area: ['600px', '500px'],
97
+                anim: 2,
98
+                content: '/usersignup/userdetails?id=' + data.id,
99
+                end: function () {
100
+                    table.reload('tablerReload');
101
+                }//iframe的url,no代表不显示滚动条
102
+            });
103
+        } else if (layEvent === 'del') {
104
+            layer.confirm('您确认要删除吗?', {btn: ['确认', '取消']}, function () {
105
+                console.log(data.id)
106
+                $.post('/usersignup/signupdel', {id: data.id}, function (data) {
107
+                    layer.msg(data.msg);
108
+                    // parent.layui.
109
+                    table.reload('tablerReload');
110
+
111
+                })
112
+            })
113
+        }
114
+
115
+    });
116
+
117
+    var $ = layui.$, active = {
118
+        addData: function () { //获取选中数据
119
+            layer.open({
120
+                type: 2,
121
+                title: '添加账号',
122
+                closeBtn: 1, //不显示关闭按钮
123
+                shade: [0],
124
+                area: ['600px', '500px'],
125
+                anim: 2,
126
+                content: ['/user/adduser', 'no'], //iframe的url,no代表不显示滚动条
127
+            });
128
+        },
129
+        sendEmail: function () {
130
+            var checkStatus = table.checkStatus('tablerReload');
131
+            var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
132
+            if (typeof  checkStatus.data[0] == 'object') {
133
+                layer.confirm('确定要发送吗?', {btn: ['确认', '取消']}, function () {
134
+                    var formdat = new FormData();
135
+                    $.each(checkStatus.data, function (key, val) {
136
+                        formdat.append('hid[]', val.id);
137
+                    })
138
+                    $.ajax({
139
+                        cache: true,
140
+                        type: "post",
141
+                        url: "/usersignup/emailsend",
142
+                        data: formdat,  // 你的formid
143
+                        // async : false,          //async 默认为true异步,修改为false为同步
144
+                        contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
145
+                        processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
146
+                        error: function (request) {
147
+                            layer.close(index);         //关闭数据提交信息
148
+                            layer.alert("网络超时");
149
+                        },
150
+                        success: function (data) {
151
+                            if (data.code == 200) {
152
+                                layer.msg(data.msg);
153
+                                reloadTable(reloadId);
154
+                            } else {
155
+                                layer.msg(data.msg);
156
+                            }
157
+                        }
158
+                    });
159
+
160
+                })
161
+                return false;
162
+            }
163
+            layer.msg('请选择需要重新发送的报名信息', {icon: 5});
164
+            return false;
165
+        },
166
+        reload: function () {
167
+            var form = pfgs_serialize($('form'));
168
+
169
+            var a = compareTime(form.start_time, form.end_time);
170
+            if (a === false) {
171
+                layer.msg('开始时间不能大于结束时间');
172
+                return;
173
+            }
174
+            table.reload('tablerReload', {
175
+                where: {
176
+                    equipment: form.equipment,
177
+                    start_time: form.start_time,
178
+                    end_time: form.end_time,
179
+                    source_id: form.source,
180
+                    state: form.state
181
+                },
182
+                page: {      //重载分页
183
+                    curr: 1
184
+                }
185
+            })
186
+        }
187
+    };
188
+
189
+    function compareTime(a, b) {
190
+        var arr = a.split("-"); //log [2016,04,06]
191
+        var start = new Date(arr[0], (arr[1] - 1), arr[2]);
192
+        var starts = start.getTime(); //输出时间戳进行对比
193
+        var arrs = b.split("-");
194
+        var end = new Date(arrs[0], (arrs[1] - 1), arrs[2]);
195
+        var ends = end.getTime();
196
+        if (starts > ends) return false;
197
+    }
198
+
199
+    $('.demoTable .layui-btn').on('click', function () {
200
+        var type = $(this).data('type');
201
+        active[type] ? active[type].call(this) : '';
202
+    });
203
+
204
+
205
+});

+ 0 - 0
backend/web/js/china/usersignup/userdetails.js


+ 147 - 0
backend/web/js/city/currency.js

@@ -0,0 +1,147 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var layer = layui.layer //弹层
4
+        ,table = layui.table //表格
5
+        ,element = layui.element //元素操作
6
+        ,form = layui.form
7
+        ,upload = layui.upload;
8
+    //第一个实例
9
+    var indexTtable =table.render({
10
+        elem: '#citylist'
11
+        ,url: '/categorycity/currencyform' //数据接口
12
+        ,where:{token:csrfToken}
13
+        ,method:'post'
14
+        ,page: true //开启分页
15
+        ,height:600
16
+        ,text:'数据加载中'
17
+        ,id:'tablerReload'
18
+        ,cols: [[ //表头
19
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
20
+            {type:'numbers'},
21
+            {field: 'city_name', title: '区域',align:'center'}
22
+            ,{field: 'currency', title: '货币标识',align:'center'}
23
+            ,{field: 'nickname', title: '货币名称',align:'center'}
24
+            ,{field: 'exchange', title: '汇率',align:'center'}
25
+            ,{field: 'create_at', title: '添加时间', width:120,align:'center'}
26
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
27
+
28
+        ]]
29
+    });
30
+
31
+    indexTtable.reload('tablerReload');        //重新加载
32
+
33
+    //列表操作
34
+    table.on('tool(citylist)', function(obj){
35
+        var layEvent = obj.event,
36
+            data = obj.data;
37
+        if(layEvent === 'edit'){
38
+            layer.open({
39
+                type: 2,
40
+                title: '修改配套信息',
41
+                closeBtn: 1, //不显示关闭按钮
42
+                shade: [0],
43
+                area: ['600px', '500px'],
44
+                anim: 2,
45
+                content: ['/categorycity/editcurrency?id='+data.id, 'yes'], //iframe的url,no代表不显示滚动条
46
+            });
47
+        } else if(layEvent === 'del') {
48
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
49
+                $.post('/categorycity/delcurrency',{'id':data.id},function (data) {
50
+                    if(data.code == 200)
51
+                    {
52
+                        layer.msg(data.msg);
53
+                        table.reload('tablerReload');
54
+                    } else if(data.code == 300 ) {
55
+                        layer.msg(data.msg);
56
+                    }
57
+                })
58
+            })
59
+        }
60
+    });
61
+
62
+    var $ = layui.$, active = {
63
+        addData: function(){ //获取选中数据
64
+
65
+            layer.open({
66
+                type: 2,
67
+                title: '添加',
68
+                closeBtn: 1, //不显示关闭按钮
69
+                shade: [0],
70
+                area: ['600px', '500px'],
71
+                anim: 2,
72
+                content: '/categorycity/addcurrency', //iframe的url,no代表不显示滚动条
73
+            });
74
+        }
75
+    };
76
+
77
+    $('.demoTable .layui-btn').on('click', function(){
78
+        var type = $(this).data('type');
79
+        active[type] ? active[type].call(this) : '';
80
+    });
81
+
82
+
83
+    //修改
84
+    form.on('submit(editcity)', function(data){
85
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
86
+
87
+        var formData = new FormData($('form')[0]);
88
+        $.ajax({
89
+            cache : true,
90
+            type : "post",
91
+            url : '/categorycity/editcurrencyform',
92
+            data : formData,  // 你的formid
93
+            // async : false,          //async 默认为true异步,修改为false为同步
94
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
95
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
96
+            error : function(request) {
97
+                layer.close(index);         //关闭数据提交信息
98
+                layer.alert("网络超时");
99
+            },
100
+            success : function(data) {
101
+                if (data.code == 200) {
102
+                    layer.msg(data.msg);
103
+                    parent.layui.table.reload('housefacilitieslist');
104
+                    TableClose();
105
+                } else if(data.code == 300){
106
+                    layer.msg(data.msg);
107
+                    layer.msg(ReturnInfo(data.data));
108
+                }
109
+            }
110
+        });
111
+        return false;
112
+    });
113
+
114
+
115
+
116
+
117
+    //添加
118
+    form.on('submit(addcity)', function(data){
119
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
120
+        var formData = new FormData($('form')[0]);
121
+        $.ajax({
122
+            cache : true,
123
+            type : "post",
124
+            url : '/categorycity/addcurrencyform',
125
+            data : formData,  // 你的formid
126
+            // async : false,          //async 默认为true异步,修改为false为同步
127
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
128
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
129
+            error : function(request) {
130
+                layer.close(index);         //关闭数据提交信息
131
+                layer.alert("网络超时");
132
+            },
133
+            success : function(data) {
134
+                if (data.code == 200) {
135
+                    layer.msg(data.msg);
136
+                    parent.layui.table.reload('tablerReload');
137
+                    // TableClose();
138
+                } else if(data.code == 300){
139
+                    layer.msg(data.msg);
140
+                    layer.msg(ReturnInfo(data.data),{icon:5});
141
+                }
142
+            }
143
+        });
144
+        return false;
145
+    });
146
+
147
+});

+ 397 - 0
backend/web/js/city/overview.js

@@ -0,0 +1,397 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+    var tableIds = 'videolist';  //表格ID
12
+    var type_id = $('input[name="typeid"]').val();
13
+
14
+    switch (type_id)
15
+    {
16
+        case '1':
17
+
18
+            var tab1 = [ //表头
19
+                // {field:'city_pid',title:'ID',width:50},
20
+                {field:'city_id',title:'ID',width:50},
21
+                {field: 'city_name', title: '城市', align:'center',width:150},
22
+                {field: 'population_size', title: '人口数量', width:150,align:'center'},
23
+                {field: 'livable_index', title: '宜居指数', width:150,align:'center'},
24
+                {field: 'rental_rate', title: '租房率', width:150,align:'center'},
25
+                {field: 'rentalrate_return', title: '租金回报率', width:150,align:'center'},
26
+                {field: 'salerental_ratio', title: '租售比', width:150,align:'center'},
27
+                {field: 'url', title: '跳转地址', width:150,align:'center'},
28
+                {field: 'create_at', title: '添加时间',width:150, align:'center'},
29
+                {field: 'is_show', title: '审核',align:'center',width:150, templet:function (d) {
30
+                    if(d.is_show == 2){
31
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
32
+                    } else {
33
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
34
+                    }
35
+                }}
36
+                ,{fixed: 'right',title:'操作', width: 300, align:'center', toolbar: '#operate'}
37
+
38
+            ];
39
+            break;
40
+        case '2':
41
+
42
+            var tab1 = [ //表头
43
+                // {type:'numbers',title:'序号',width:50},
44
+                // {field: 'remark', title: '城市', align:'center',width:250,edit: 'text'},
45
+                // {field: 'population_size', title: '人口数量', width:250,align:'center',edit: 'text'},
46
+                // {field: 'livable_index', title: '宜居指数', width:250,align:'center',edit: 'text'},
47
+                // {field: 'rental_rate', title: '租房率', width:250,align:'center',edit: 'text'},
48
+                // {field: 'rentalrate_return', title: '租金回报率', width:250,align:'center',edit: 'text'},
49
+                // {field: 'salerental_ratio', title: '租售比', width:250,align:'center',edit: 'text'},
50
+            ];
51
+            break;
52
+    }
53
+    //第一个实例
54
+    table.render({
55
+        elem: '#'+tableIds
56
+        ,url: '/categorycity/cityoverviewform' //数据接口
57
+        ,where:{token:csrfToken,type:type_id}
58
+        ,method:'post'
59
+        ,page: true //开启分页
60
+        ,text:'数据加载中'
61
+        ,id:'tablerReload'
62
+        ,limit:15
63
+        ,cols: [tab1],
64
+        done: function () {
65
+            $("[data-field='city_pid']").css("display","none");
66
+        }
67
+    });
68
+
69
+    //监听指定开关
70
+    form.on('switch(switchTest)', function(data){
71
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
72
+            $.post('/categorycity/viewdelshow',{id:data.value,type:'show'},function (data) {
73
+                layer.msg(data.msg);
74
+                table.reload('tablerReload');
75
+            })
76
+        },function (aa) {
77
+            table.reload('tablerReload');        //重新加载
78
+        })
79
+    });
80
+
81
+
82
+
83
+     //列表操作
84
+    table.on('tool('+tableIds+')', function(obj){
85
+        var layEvent = obj.event,
86
+            data = obj.data;
87
+        if(layEvent === 'sortData'){       //修改排序
88
+            /* 列表操作  edit  修改后执行  2018.7.24*/
89
+            table.on('edit('+tableIds+')', function(obj){
90
+                var data = obj.data;
91
+                $.post('/pushm/',{id:data.id,type:'sort',sort:data.sort},function (data) {
92
+                    if(data.code == 200)
93
+                    {
94
+                        layer.msg(data.msg);
95
+                    } else if(data.code == 300 ) {
96
+                        layer.msg(data.msg);
97
+                    }
98
+                })
99
+            })
100
+            // layer.prompt({
101
+            //     formType: 2
102
+            //     ,title: '排序热销楼盘:<span style="color:red">'+data.name+'</span>'
103
+            //     ,value: data.sort
104
+            // }, function(value, index){
105
+
106
+            //         $.post('/pushm/saledelshow',{id:data.id,type:'sort',sort:value},function (data) {
107
+            //             layer.msg(data.msg);
108
+            //             table.reload('tablerReload');
109
+            //         })
110
+            // });
111
+        }else if(layEvent === 'edit'){
112
+            var index = layer.open({
113
+                type: 2,
114
+                title: '编辑',
115
+                area:['100%','100%'],
116
+                content: '/categorycity/overviewedit?id='+data.city_pid,
117
+                end:function () {
118
+                    table.reload('tablerReload');        //重新加载
119
+                }
120
+            });
121
+        }else if(layEvent === 'del') {
122
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
123
+                $.post('/categorycity/viewdelshow',{id:data.city_id,type:'del'},function (data) {
124
+                    layer.msg(data.msg);
125
+                    table.reload('tablerReload');
126
+                })
127
+            })
128
+        }else if(layEvent === 'produce'){
129
+            //
130
+            var index = layer.open({
131
+                type: 2,
132
+                title: '生成['+data.remark+']控制模板代码',
133
+                closeBtn: 1, //不显示关闭按钮
134
+                shade: [0],
135
+                area: ['600px', '500px'],
136
+                anim: 2,
137
+                content: '/pushm/produce?id='+data.id+'&name='+data.name, //iframe的url,no代表不显示滚动条
138
+                end:function () {
139
+                    renderTable();
140
+                }
141
+            });
142
+        }
143
+
144
+    });
145
+
146
+    table.on('edit(videolist)', function(obj){
147
+        var value = obj.value //得到修改后的值
148
+            ,data = obj.data //得到所在行所有键值
149
+            ,field = obj.field; //得到字段
150
+        layer.msg('[ID: '+ data.id +'] ' + field + ' 字段更改为:'+ value);
151
+    });
152
+
153
+     // 新增
154
+     var $ = layui.$, active = {
155
+        addData: function(){ //获取选中数据
156
+            var index = layui.layer.open({
157
+                type: 2,
158
+                title: '添加时间',
159
+                closeBtn: 1, //不显示关闭按钮
160
+                area: ['100%','100%'],
161
+                content: '/categorycity/create'
162
+                ,success:function (layero, index) {
163
+                    // indexOpen = layer.getChildFrame('body', index)  ;
164
+                    // console.log(indexOpen);
165
+                },
166
+                end:function () {
167
+                    table.reload('tablerReload');
168
+                }
169
+            });
170
+        },
171
+        reload:function(){
172
+            var form = pfgs_serialize($('form'));
173
+            // var name = '';
174
+            // var house_name   = '';
175
+            // if(form.input_house == 'name'){
176
+            //     name = form.input_house_text;
177
+            // } else if(form.input_house == 'house_name'){
178
+            //     house_name = form.input_house_text;
179
+            // }
180
+            table.reload('tablerReload',{
181
+                where:{
182
+                    house_name: form.input_house_text
183
+                }
184
+            })
185
+        }
186
+    };
187
+    $('.demoTable .layui-btn').on('click', function(){
188
+        var type = $(this).data('type');
189
+        active[type] ? active[type].call(this) : '';
190
+    });
191
+
192
+
193
+    $('.The_house').focus(function(){
194
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
195
+        indexOpen = parent.layui.layer.open({
196
+            type: 2,
197
+            title: '选择需要添加的楼盘',
198
+            area: ['','100%'],
199
+            content: '/publicuse/housename',
200
+            success:function (layero, index) {
201
+            },
202
+            end:function(){
203
+            }
204
+        });
205
+        parent.layui.layer.full(indexOpen);
206
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
207
+        $(window).on("resize",function(){
208
+            parent.layui.layer.full(indexOpen);
209
+        })
210
+    })
211
+
212
+
213
+
214
+    //加载省数据
215
+    function loadProvince() {
216
+
217
+        $.ajax({
218
+            url : '/categorycity/citypid',
219
+            type : 'post',
220
+            async: false,//使用同步的方式,true为异步方式
221
+            data : {'pid':0},//这里使用json对象
222
+            success : function(data){
223
+                var areaData = data.data;
224
+                var proHtml = '';
225
+                for (var i = 0; i < areaData.length; i++) {
226
+                    proHtml += '<option value="' + areaData[i].id +'">' + areaData[i].city_name + '</option>';
227
+                }
228
+                //初始化省数据
229
+                $('select[name=country]').append(proHtml);
230
+                form.render();
231
+            },
232
+            fail:function(){
233
+
234
+            }
235
+        });
236
+
237
+
238
+    }
239
+
240
+    loadProvince();
241
+
242
+    form.on('select(country)',function (data) {
243
+
244
+       table.render({
245
+            elem: '#overlist'
246
+            ,url: '/categorycity/citypidajax' //数据接口
247
+            ,where:{token:csrfToken,pid:data.value}
248
+            ,method:'post'
249
+            // ,page: true //开启分页
250
+            ,text:'数据加载中'
251
+            ,id:'overlist1'
252
+            ,limit:5
253
+            ,cols: [[ //表头
254
+                {type:'numbers',title:'序号',width:50},
255
+                // {field: 'city_name', title: '城市', align:'center',width:250,edit: 'text',name:'sn'},
256
+                // {field: 'population_size', title: '人口数量', width:250,align:'center',edit: 'text',name:'sn0'},
257
+                // {field: 'livable_index', title: '宜居指数', width:250,align:'center',edit: 'text',name:'sn1'},
258
+                // {field: 'rental_rate', title: '租房率', width:250,align:'center',edit: 'text',name:'sn3'},
259
+                // {field: 'rentalrate_return', title: '租金回报率', width:250,align:'center',edit: 'text',name:'sn4'},
260
+                // {field: 'salerental_ratio', title: '租售比', width:250,align:'center',edit: 'text',name:'sn5'}
261
+                {field: 'city_name', title: '城市', align:'center',width:150},
262
+                {field: 'population_size', title: '人口数量', width:150,align:'center',edit: 'text'},
263
+                {field: 'livable_index', title: '宜居指数', width:150,align:'center',edit: 'text'},
264
+                {field: 'rental_rate', title: '租房率', width:150,align:'center',edit: 'text'},
265
+                {field: 'rentalrate_return', title: '租金回报率', width:150,align:'center',edit: 'text'},
266
+                {field: 'salerental_ratio', title: '租售比', width:150,align:'center',edit: 'text'},
267
+                // {field: 'url', title: '跳转地址', width:150,align:'center',edit: 'text'},
268
+            ]]
269
+        });
270
+
271
+        $('#reason').css('display','block');
272
+        $('#url').css('display','block');
273
+
274
+    })
275
+
276
+    //添加页面提交数据
277
+    form.on('submit(add)', function(data){
278
+        var dh = layui.table.cache.overlist1;
279
+
280
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
281
+
282
+        var formData = new FormData($('.layui-form')[0]);
283
+        // console.log(formData)
284
+        // formData.push(dh);
285
+        // console.log(dh);
286
+
287
+        $.each(dh,function(k,v){
288
+            // console.log(v);
289
+            var arr=[];
290
+            $.each(v,function (key,val) {
291
+                arr[key] = val;
292
+                formData.append('as['+k+']['+key+']',val);
293
+            })
294
+
295
+        })
296
+
297
+        $.ajax({
298
+            cache : false,
299
+            type : "post",
300
+            url : "/categorycity/overviewaddform",
301
+            data : formData,  // 你的formid
302
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
303
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
304
+            error : function(request) {
305
+                layer.close(index);
306
+                layer.msg("请联系管理员");
307
+            },
308
+            success : function(data) {
309
+                // console.log(formData)
310
+                // console.log(dh)
311
+                if(data.data != null){
312
+                    // layer.msg(ReturnInfo(data.data),{icon:5});
313
+                    // return ;
314
+                }
315
+                layer.msg(data.msg);
316
+                // parent.layer.close(oindex); //再执行关闭
317
+            }
318
+        });
319
+        return false;
320
+    });
321
+
322
+
323
+    var obj = $('select[name=country]');
324
+    var pid = obj.attr('data-pid');
325
+    // alert(pid);
326
+    if(pid != "" && pid !=null && pid != 'undefined' && pid != undefined ){
327
+        // alert(1111111);
328
+        $('option[value='+pid+']').attr('selected',true);
329
+        obj.parent().find('input').val($('option[value='+pid+']').text());
330
+        $('#reason').css('display','block');
331
+        $('#url').css('display','block');
332
+        table.render({
333
+            elem: '#overlist'
334
+            ,url: '/categorycity/cityoverviewform' //数据接口
335
+            ,where:{token:csrfToken,pid:pid}
336
+            ,method:'post'
337
+            // ,page: true //开启分页
338
+            ,text:'数据加载中'
339
+            ,id:'overlist1'
340
+            ,limit:5
341
+            ,cols: [[ //表头
342
+                {type:'numbers',title:'序号',width:50},
343
+                {field: 'city_name', title: '城市', align:'center',width:250,edit: 'text',name:'sn'},
344
+                {field: 'population_size', title: '人口数量', width:250,align:'center',edit: 'text',name:'sn0'},
345
+                {field: 'livable_index', title: '宜居指数', width:250,align:'center',edit: 'text',name:'sn1'},
346
+                {field: 'rental_rate', title: '租房率', width:250,align:'center',edit: 'text',name:'sn3'},
347
+                {field: 'rentalrate_return', title: '租金回报率', width:250,align:'center',edit: 'text',name:'sn4'},
348
+                {field: 'salerental_ratio', title: '租售比', width:250,align:'center',edit: 'text',name:'sn5'}
349
+            ]]
350
+        });
351
+    }
352
+    //修改页面提交数据
353
+    form.on('submit(edit)', function(data){
354
+        var dh = layui.table.cache.overlist1;
355
+
356
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
357
+
358
+        var formData = new FormData($('.layui-form')[0]);
359
+        // console.log(formData)
360
+        // formData.push(dh);
361
+        // console.log(dh);
362
+
363
+        $.each(dh,function(k,v){
364
+            // console.log(v);
365
+            var arr=[];
366
+            $.each(v,function (key,val) {
367
+                arr[key] = val;
368
+                formData.append('as['+k+']['+key+']',val);
369
+            })
370
+
371
+        })
372
+
373
+        $.ajax({
374
+            cache : false,
375
+            type : "post",
376
+            url : "/categorycity/overvieweditform",
377
+            data : formData,  // 你的formid
378
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
379
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
380
+            error : function(request) {
381
+                layer.close(index);
382
+                layer.msg("请联系管理员");
383
+            },
384
+            success : function(data) {
385
+                // console.log(formData)
386
+                // console.log(dh)
387
+                if(data.data != null){
388
+                    // layer.msg(ReturnInfo(data.data),{icon:5});
389
+                    // return ;
390
+                }
391
+                layer.msg(data.msg);
392
+                // parent.layer.close(oindex); //再执行关闭
393
+            }
394
+        });
395
+        return false;
396
+    });
397
+})

+ 115 - 0
backend/web/js/dictionarya/bottomlabel.js

@@ -0,0 +1,115 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+
9
+    var tableIds = 'themelist';  //表格ID
10
+    var reloadId = 'tablerReload';
11
+    //第一个实例
12
+    table.render({
13
+        elem: '#'+tableIds
14
+        ,url: '/dictionarya/bottomlabelform' //数据接口
15
+        ,where:{token:csrfToken}
16
+        ,method:'post'
17
+        ,page: true //开启分页
18
+        ,height:600
19
+        ,text:'数据加载中'
20
+        ,id:reloadId
21
+        ,cols: [[ //表头
22
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
23
+            {type:'numbers'},
24
+            {field: 'name', title: '标签名',align:'center'}
25
+            ,{field: 'update_at', title: '更新时间', width:150,align:'center'}
26
+            ,{field: 'create_at', title: '添加时间', width:150,align:'center'}
27
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
28
+
29
+        ]]
30
+    });
31
+
32
+    table.reload('tablerReload');        //重新加载
33
+
34
+    //列表操作
35
+    table.on('tool('+tableIds+')', function(obj){
36
+        var layEvent = obj.event,
37
+            data = obj.data;
38
+        if(layEvent === 'edit'){
39
+            layer.open({
40
+                type: 2,
41
+                title: '修改标签',
42
+                closeBtn: 1, //不显示关闭按钮
43
+                shade: [0],
44
+                area: ['600px', '500px'],
45
+                anim: 2,
46
+                content: '/dictionarya/bottomlabeledit?id='+data.id, //iframe的url,no代表不显示滚动条
47
+                end:function(){
48
+                    table.reload('tablerReload');
49
+                }
50
+            });
51
+        } else if(layEvent === 'del') {
52
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
53
+                $.post('/dictionarya/bottomlabeldel',{'id':data.id},function (data) {
54
+                    if(data.code == 200)
55
+                    {
56
+                        layer.msg(data.msg);
57
+                        table.reload('tablerReload');
58
+                    } else if(data.code == 300 ) {
59
+                        layer.msg(data.msg);
60
+                    }
61
+                })
62
+            })
63
+        }
64
+
65
+
66
+    });
67
+
68
+    var $ = layui.$, active = {
69
+        addData: function(){ //获取选中数据
70
+            layer.open({
71
+                type: 2,
72
+                title: '添加底部标签',
73
+                area: ['600px', '500px'],
74
+                content: '/dictionarya/bottomlabeladd', //iframe的url,no代表不显示滚动条
75
+                end:function(){
76
+                    table.reload('tablerReload');
77
+                }
78
+            });
79
+        }
80
+    };
81
+
82
+    $('.demoTable .layui-btn').on('click', function(){
83
+        var type = $(this).data('type');
84
+        active[type] ? active[type].call(this) : '';
85
+    });
86
+
87
+    //修改
88
+    form.on('submit(editbottomlabel)', function(data){
89
+        $.post('/dictionarya/bottomlabeleditform',{'data':data.field},function (data) {
90
+            if(data.code == 200)
91
+            {
92
+                layer.msg(data.msg);
93
+            } else if(data.code == 300 ) {
94
+                layer.msg(data.msg);
95
+            }
96
+        })
97
+        return false;
98
+    });
99
+
100
+    //添加
101
+    form.on('submit(addbottomlabel)', function(data){
102
+
103
+        $.post('/dictionarya/bottomlabeladdform',{'data':data.field},function (data) {
104
+            if(data.code == 200)
105
+            {
106
+                layer.msg(data.msg);
107
+                $('input').val('');
108
+            } else if(data.code == 300 ) {
109
+                layer.msg(data.msg);
110
+            }
111
+        })
112
+        return false;
113
+    });
114
+
115
+});

+ 120 - 0
backend/web/js/housech/dictionarya/architecture.js

@@ -0,0 +1,120 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var layer = layui.layer //弹层
4
+        ,table = layui.table //表格
5
+        ,element = layui.element //元素操作
6
+        ,form = layui.form;
7
+
8
+    var tableIds = 'architecturelist';  //表格ID
9
+    //第一个实例
10
+     table.render({
11
+        elem: '#'+tableIds
12
+        ,url: '/dictionarya/architectureform' //数据接口
13
+        ,where:{token:csrfToken}
14
+        ,method:'post'
15
+        ,page: true //开启分页
16
+         ,height:600
17
+        ,text:'数据加载中'
18
+        ,id:'architecturelistId'
19
+        ,cols: [[ //表头
20
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
21
+            {type:'numbers'},
22
+            {field: 'name', title: '建筑类别名称',align:'center'}
23
+            ,{field: 'update_at', title: '更新时间', width:150,align:'center'}
24
+            ,{field: 'create_at', title: '添加时间', width:150,align:'center'}
25
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
26
+
27
+        ]]
28
+    });
29
+
30
+    table.reload('architecturelistId');        //重新加载
31
+
32
+    //列表操作
33
+    table.on('tool('+tableIds+')', function(obj){
34
+        var layEvent = obj.event,
35
+            data = obj.data;
36
+        if(layEvent === 'edit'){
37
+            layer.open({
38
+                type: 2,
39
+                title: '修改建筑类别',
40
+                area: ['600px', '500px'],
41
+                anim: 2,
42
+                content:'/dictionarya/labeledit?id='+data.id, //iframe的url,no代表不显示滚动条
43
+                end:function () {
44
+                    table.reload('architecturelistId');
45
+                }
46
+            });
47
+        } else if(layEvent === 'del') {
48
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
49
+                $.post('/dictionarya/labeldel',{'id':data.id},function (data) {
50
+                    if(data.code == 200)
51
+                    {
52
+                        layer.msg(data.msg);
53
+                        table.reload('architecturelistId');
54
+                    } else if(data.code == 300 ) {
55
+                        layer.msg(data.msg);
56
+                    }
57
+                })
58
+            })
59
+        }
60
+
61
+
62
+    });
63
+
64
+    var $ = layui.$, active = {
65
+        addData: function(){ //获取选中数据
66
+
67
+            layer.open({
68
+                type: 2,
69
+                title: '建筑类型',
70
+                closeBtn: 1, //不显示关闭按钮
71
+                shade: [0],
72
+                area: ['600px', '500px'],
73
+                anim: 2,
74
+                content: '/dictionarya/architectureadd',
75
+                end:function () {
76
+                    table.reload('architecturelistId');
77
+                }//iframe的url,no代表不显示滚动条
78
+            });
79
+
80
+            // var checkStatus = table.checkStatus('idTest')
81
+            //     ,data = checkStatus.data;
82
+            // layer.alert(JSON.stringify(data));
83
+        }
84
+    };
85
+
86
+    $('.demoTable .layui-btn').on('click', function(){
87
+        var type = $(this).data('type');
88
+        active[type] ? active[type].call(this) : '';
89
+    });
90
+
91
+    //修改
92
+    // form.on('submit(editlabel)', function(data){
93
+    //     $.post('/dictionarya/labeleditform',{'data':data.field,'token':csrfToken},function (data) {
94
+    //         if(data.code == 200)
95
+    //         {
96
+    //             layer.msg(data.msg);
97
+    //             parent.layui.table.reload(tableIds);
98
+    //             TableClose();
99
+    //         } else if(data.code == 300 ) {
100
+    //             layer.msg(data.msg);
101
+    //         }
102
+    //     })
103
+    //     return false;
104
+    // });
105
+    //
106
+    // //添加
107
+    // form.on('submit(addlabel)', function(data){
108
+    //     $.post('/dictionarya/labeladdform',{'data':data.field,'token':csrfToken},function (data) {
109
+    //         if(data.code == 200)
110
+    //         {
111
+    //             layer.msg(data.msg);
112
+    //             parent.layui.table.reload(tableIds);
113
+    //         } else if(data.code == 300 ) {
114
+    //             layer.msg(data.msg);
115
+    //         }
116
+    //     })
117
+    //     return false;
118
+    // });
119
+
120
+});

+ 117 - 0
backend/web/js/housech/dictionarya/houselabel.js

@@ -0,0 +1,117 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var layer = layui.layer //弹层
4
+        ,table = layui.table //表格
5
+        ,element = layui.element //元素操作
6
+        ,form = layui.form;
7
+
8
+    var tableIds = 'houselabellist';  //表格ID
9
+    //第一个实例
10
+    table.render({
11
+        elem: '#'+tableIds
12
+        ,url: '/dictionarya/houselabelform' //数据接口
13
+        ,where:{token:csrfToken}
14
+        ,method:'post'
15
+        ,page: true //开启分页
16
+        ,height:600
17
+        ,text:'数据加载中'
18
+        ,id:'houselabellist'
19
+        ,cols: [[ //表头
20
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
21
+            {field: 'name', title: '楼盘标签名称',align:'center'}
22
+            ,{field: 'update_at', title: '更新时间', width:150,align:'center'}
23
+            ,{field: 'create_at', title: '添加时间', width:150,align:'center'}
24
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
25
+
26
+        ]]
27
+    });
28
+
29
+    //列表操作
30
+    table.on('tool('+tableIds+')', function(obj){
31
+        var layEvent = obj.event,
32
+            data = obj.data;
33
+        if(layEvent === 'edit'){
34
+            layer.open({
35
+                type: 2,
36
+                title: '修改建筑类别',
37
+                area: ['600px', '500px'],
38
+                anim: 2,
39
+                content:'/dictionarya/labeledit?id='+data.id, //iframe的url,no代表不显示滚动条
40
+                end:function () {
41
+                    table.reload('houselabellist');
42
+                }
43
+            });
44
+        } else if(layEvent === 'del') {
45
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
46
+                $.post('/dictionarya/labeldel',{'id':data.id},function (data) {
47
+                    if(data.code == 200)
48
+                    {
49
+                        layer.msg(data.msg);
50
+                        table.reload('houselabellist');
51
+                    } else if(data.code == 300 ) {
52
+                        layer.msg(data.msg);
53
+                    }
54
+                })
55
+            })
56
+        }
57
+
58
+
59
+    });
60
+
61
+    var $ = layui.$, active = {
62
+        addData: function(){ //获取选中数据
63
+
64
+            layer.open({
65
+                type: 2,
66
+                title: '添加楼盘标签',
67
+                closeBtn: 1, //不显示关闭按钮
68
+                shade: [0],
69
+                area: ['600px', '500px'],
70
+                anim: 2,
71
+                content: '/dictionarya/houselabeladd',
72
+                end:function () {
73
+                    table.reload('houselabellist');
74
+                }//iframe的url,no代表不显示滚动条
75
+            });
76
+
77
+            // var checkStatus = table.checkStatus('idTest')
78
+            //     ,data = checkStatus.data;
79
+            // layer.alert(JSON.stringify(data));
80
+        }
81
+    };
82
+
83
+    $('.demoTable .layui-btn').on('click', function(){
84
+        var type = $(this).data('type');
85
+        active[type] ? active[type].call(this) : '';
86
+    });
87
+
88
+    //修改
89
+    // form.on('submit(editlabel)', function(data){
90
+    //     $.post('/dictionarya/labeleditform',{'data':data.field,'token':csrfToken},function (data) {
91
+    //         if(data.code == 200)
92
+    //         {
93
+    //             layer.msg(data.msg);
94
+    //             parent.layui.table.reload(tableIds);
95
+    //             TableClose();
96
+    //         } else if(data.code == 300 ) {
97
+    //             layer.msg(data.msg);
98
+    //         }
99
+    //     })
100
+    //     return false;
101
+    // });
102
+    //
103
+    // //添加
104
+    // form.on('submit(addlabel)', function(data){
105
+    //     $.post('/dictionarya/labeladdform',{'data':data.field,'token':csrfToken},function (data) {
106
+    //         if(data.code == 200)
107
+    //         {
108
+    //             layer.msg(data.msg);
109
+    //             parent.layui.table.reload(tableIds);
110
+    //         } else if(data.code == 300 ) {
111
+    //             layer.msg(data.msg);
112
+    //         }
113
+    //     })
114
+    //     return false;
115
+    // });
116
+
117
+});

+ 116 - 0
backend/web/js/housech/dictionarya/label.js

@@ -0,0 +1,116 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+
9
+    var tableIds = 'laballist';  //表格ID
10
+    var reloadId = 'tablerReload';
11
+    //第一个实例
12
+    var tableIns = table.render({
13
+        elem: '#'+tableIds
14
+        ,url: '/dictionarya/labelform' //数据接口
15
+        ,where:{token:csrfToken}
16
+        ,method:'post'
17
+        ,page: true //开启分页
18
+        ,height:600
19
+        ,text:'数据加载中'
20
+        ,id:reloadId
21
+        ,limit:20
22
+        ,cols: [[ //表头
23
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
24
+            {type:'numbers'},
25
+            {field: 'name', title: '物业类型', align:'center'}
26
+            ,{fixed: 'right',title:'操作', width: 180, align:'center', toolbar: '#operate'}
27
+
28
+        ]]
29
+    });
30
+
31
+    table.reload('tablerReload');        //重新加载
32
+
33
+    //列表操作
34
+    table.on('tool('+tableIds+')', function(obj){
35
+        var layEvent = obj.event,
36
+            data = obj.data;
37
+        if(layEvent === 'edit'){
38
+            layer.open({
39
+                type: 2,
40
+                title: '修改标签',
41
+                area: ['600px', '500px'],
42
+                content: '/dictionarya/labeledit?id='+data.id, //iframe的url,no代表不显示滚动条
43
+                end:function(){
44
+                    table.reload('tablerReload');
45
+                }
46
+            });
47
+        } else if(layEvent === 'del') {
48
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
49
+                $.post('/dictionarya/labeldel',{'id':data.id},function (data) {
50
+                    if(data.code == 200)
51
+                    {
52
+                        layer.msg(data.msg);
53
+                        table.reload('tablerReload');
54
+                    } else if(data.code == 300 ) {
55
+                        layer.msg(data.msg);
56
+                    }
57
+                })
58
+            })
59
+        }
60
+
61
+
62
+    });
63
+
64
+    var $ = layui.$, active = {
65
+        addData: function(){ //获取选中数据
66
+
67
+            layer.open({
68
+                type: 2,
69
+                title: '添加标签',
70
+                area: ['600px', '500px'],
71
+                content: '/dictionarya/labeladd', //iframe的url,no代表不显示滚动条
72
+                end:function(){
73
+                    table.reload('tablerReload');
74
+                }
75
+            });
76
+
77
+            // var checkStatus = table.checkStatus('idTest')
78
+            //     ,data = checkStatus.data;
79
+            // layer.alert(JSON.stringify(data));
80
+        }
81
+    };
82
+
83
+    $('.demoTable .layui-btn').on('click', function(){
84
+        var type = $(this).data('type');
85
+        active[type] ? active[type].call(this) : '';
86
+    });
87
+
88
+    //修改
89
+    form.on('submit(editlabel)', function(data){
90
+        $.post('/dictionarya/labeleditform',{'data':data.field,'token':csrfToken},function (data) {
91
+            if(data.code == 200)
92
+            {
93
+                layer.msg(data.msg);
94
+
95
+            } else if(data.code == 300 ) {
96
+                layer.msg(data.msg);
97
+            }
98
+        })
99
+        return false;
100
+    });
101
+
102
+    //添加
103
+    form.on('submit(addlabel)', function(data){
104
+        $.post('/dictionarya/labeladdform',{'data':data.field,'token':csrfToken},function (data) {
105
+            if(data.code == 200)
106
+            {
107
+                layer.msg(data.msg);
108
+                $("input[name='name']").val('');
109
+            } else if(data.code == 300 ) {
110
+                layer.msg(data.msg);
111
+            }
112
+        })
113
+        return false;
114
+    });
115
+
116
+});

+ 137 - 0
backend/web/js/housech/dictionarya/price.js

@@ -0,0 +1,137 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+
9
+    var tableIds = 'pricelist';  //表格ID
10
+    var reloadId = 'tablerReload';
11
+    //第一个实例
12
+    var tableIns = table.render({
13
+        elem: '#'+tableIds
14
+        ,url: '/dictionarya/priceform' //数据接口
15
+        ,where:{token:csrfToken}
16
+        ,method:'post'
17
+        ,page: true //开启分页
18
+        ,height:600
19
+        ,text:'数据加载中'
20
+        ,id:reloadId
21
+        ,cols: [[ //表头
22
+            {type:'numbers'},
23
+            {field: 'price', title: '价格',align:'center'},
24
+            {field: 'state', title: '状态', width:200,align:'center'}
25
+            ,{field: 'sort', title: '排序', width:200,align:'center',event:'sortData',edit: 'text',sort: true,templet:"#sortBox"}
26
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
27
+
28
+        ]]
29
+    });
30
+
31
+    table.reload('tablerReload');        //重新加载
32
+
33
+    //列表操作
34
+    table.on('tool('+tableIds+')', function(obj){
35
+        var layEvent = obj.event,
36
+            data = obj.data;
37
+        if(layEvent === 'edit'){
38
+            layer.open({
39
+                type: 2,
40
+                title: '修改户型',
41
+                area: ['600px', '500px'],
42
+                content: '/dictionarya/priceedit?id='+data.id, //iframe的url,no代表不显示滚动条
43
+                end:function () {
44
+                    table.reload('tablerReload');        //重新加载
45
+                }
46
+            });
47
+        } else if(layEvent === 'del') {
48
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
49
+                $.post('/dictionarya/pricedel',{'id':data.id},function (data) {
50
+                    if(data.code == 200)
51
+                    {
52
+                        layer.msg(data.msg);
53
+                        table.reload('tablerReload');        //重新加载
54
+                    } else if(data.code == 300 ) {
55
+                        layer.msg(data.msg);
56
+                    }
57
+                })
58
+            })
59
+        }else if(layEvent === 'sortData'){       //修改排序
60
+            /* 列表操作  edit  修改后执行  2018.7.24*/
61
+            table.on('edit('+tableIds+')', function(obj){
62
+                var data = obj.data;
63
+                $.post('/dictionarya/pricesort',{id:data.id,type:'sort',sort:data.sort},function (data) {
64
+                    if(data.code == 200)
65
+                    {
66
+                        layer.msg(data.msg);
67
+                    } else if(data.code == 300 ) {
68
+                        layer.msg(data.msg);
69
+                    }
70
+                })
71
+            })
72
+            // layer.prompt({
73
+            //     formType: 2
74
+            //     ,title: '价格排序'
75
+            //     ,value: data.sort
76
+            // }, function(value, index){
77
+            //     $.post('/dictionarya/pricesort',{id:data.id,type:'sort',sort:value},function (data) {
78
+            //         layer.msg(data.msg);
79
+            //         table.reload('tablerReload');
80
+            //     })
81
+            // });
82
+        }
83
+
84
+
85
+    });
86
+
87
+    var $ = layui.$, active = {
88
+        addData: function(){ //获取选中数据
89
+
90
+            layer.open({
91
+                type: 2,
92
+                title: '添加区间价格',
93
+                area: ['600px', '500px'],
94
+                content: '/dictionarya/priceadd', //iframe的url,no代表不显示滚动条
95
+                end:function () {
96
+                    table.reload('tablerReload');        //重新加载
97
+                }
98
+            });
99
+
100
+            // var checkStatus = table.checkStatus('idTest')
101
+            //     ,data = checkStatus.data;
102
+            // layer.alert(JSON.stringify(data));
103
+        }
104
+    };
105
+
106
+    $('.demoTable .layui-btn').on('click', function(){
107
+        var type = $(this).data('type');
108
+        active[type] ? active[type].call(this) : '';
109
+    });
110
+
111
+    //修改
112
+    form.on('submit(editprice)', function(data){
113
+        $.post('/dictionarya/priceeditform',{'data':data.field,'token':csrfToken},function (data) {
114
+            if(data.code == 200)
115
+            {
116
+                layer.msg(data.msg);
117
+            } else if(data.code == 300 ) {
118
+                layer.msg(data.msg);
119
+            }
120
+        })
121
+        return false;
122
+    });
123
+
124
+    //添加
125
+    form.on('submit(addprice)', function(data){
126
+        $.post('/dictionarya/priceaddform',{'data':data.field,'token':csrfToken},function (data) {
127
+            if(data.code == 200)
128
+            {
129
+                layer.msg(data.msg);
130
+            } else if(data.code == 300 ) {
131
+                layer.msg(data.msg);
132
+            }
133
+        })
134
+        return false;
135
+    });
136
+
137
+});

+ 175 - 0
backend/web/js/housech/dictionarya/renovation.js

@@ -0,0 +1,175 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form
8
+        ,upload = layui.upload;
9
+
10
+    var tableIds = 'Renovation';  //表格ID
11
+    var reloadId = 'tablerReload';
12
+    //第一个实例
13
+    var tableIns = table.render({
14
+        elem: '#'+tableIds
15
+        ,url: '/dictionarya/renovationform' //数据接口
16
+        ,where:{token:csrfToken,type:4}
17
+        ,method:'post'
18
+        ,page: true //开启分页
19
+        ,height:600
20
+        ,text:'数据加载中'
21
+        ,id:reloadId
22
+        ,limit:20
23
+        ,cols: [[ //表头
24
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
25
+            {type:'numbers'},
26
+            {field: 'name', title: '品鉴栏目', align:'center'}
27
+            ,{fixed: 'right',title:'操作', width: 180, align:'center', toolbar: '#operate'}
28
+
29
+        ]]
30
+    });
31
+
32
+    table.reload('tablerReload');        //重新加载
33
+
34
+    //列表操作
35
+    table.on('tool('+tableIds+')', function(obj){
36
+        var layEvent = obj.event,
37
+            data = obj.data;
38
+        if(layEvent === 'edit'){
39
+            layer.open({
40
+                type: 2,
41
+                title: '修改标签',
42
+                area: ['600px', '500px'],
43
+                content: '/dictionarya/renovationedit?id='+data.id, //iframe的url,no代表不显示滚动条
44
+                end:function(){
45
+                    table.reload('tablerReload');
46
+                }
47
+            });
48
+        } else if(layEvent === 'del') {
49
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
50
+                $.post('/dictionarya/labeldel',{'id':data.id},function (data) {
51
+                    if(data.code == 200)
52
+                    {
53
+                        layer.msg(data.msg);
54
+                        table.reload('tablerReload');
55
+                    } else if(data.code == 300 ) {
56
+                        layer.msg(data.msg);
57
+                    }
58
+                })
59
+            })
60
+        }
61
+
62
+
63
+    });
64
+
65
+    var $ = layui.$, active = {
66
+        addData: function(){ //获取选中数据
67
+
68
+            layer.open({
69
+                type: 2,
70
+                title: '添加装修品鉴栏目',
71
+                area: ['600px', '500px'],
72
+                content: '/dictionarya/renovationadd', //iframe的url,no代表不显示滚动条
73
+                end:function(){
74
+                    table.reload('tablerReload');
75
+                }
76
+            });
77
+
78
+            // var checkStatus = table.checkStatus('idTest')
79
+            //     ,data = checkStatus.data;
80
+            // layer.alert(JSON.stringify(data));
81
+        }
82
+    };
83
+
84
+    $('.demoTable .layui-btn').on('click', function(){
85
+        var type = $(this).data('type');
86
+        active[type] ? active[type].call(this) : '';
87
+    });
88
+
89
+    //添加图片上传
90
+    upload.render({
91
+        elem: '#test1'
92
+        ,url: '/house/createimg'
93
+        ,data:{token:csrfToken}
94
+        ,field:'img'
95
+        ,size:1000              //限制上传图片的大小,单位为KB
96
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
97
+        ,auto:false
98
+        ,bindAction:'#addcity'
99
+        ,choose: function(obj){
100
+            obj.preview(function(index, file, result){
101
+                $('#breviary_img').attr('src', result); //图片链接(base64)
102
+            });
103
+        }
104
+    });
105
+
106
+    //添加图片上传
107
+    upload.render({
108
+        elem: '#test2'
109
+        ,url: '/house/createimg'
110
+        ,data:{token:csrfToken}
111
+        ,field:'img1'
112
+        ,size:1000              //限制上传图片的大小,单位为KB
113
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
114
+        ,auto:false
115
+        ,bindAction:'#addcity'
116
+        ,choose: function(obj){
117
+            obj.preview(function(index, file, result){
118
+                $('#breviary_img1').attr('src', result); //图片链接(base64)
119
+            });
120
+        }
121
+    });
122
+
123
+    //修改
124
+    form.on('submit(edittheme)', function(data){
125
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
126
+        var formData = new FormData($('form')[0]);
127
+        $.ajax({
128
+            type : "post",
129
+            url :'/dictionarya/renovationeditform',
130
+            data : formData,
131
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
132
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
133
+            error : function(request) {
134
+                layer.close(index);
135
+                layer.msg("请联系管理员");
136
+            },
137
+            success : function(data) {
138
+                if(data.data != null){
139
+                    layer.msg(ReturnInfo(data.data),{icon:5});
140
+                    return ;
141
+                }
142
+                layer.msg(data.msg);
143
+                parent.layer.close(oindex); //再执行关闭
144
+            }
145
+        });
146
+        return false;
147
+    });
148
+
149
+    //添加
150
+    form.on('submit(addtheme)', function(data){
151
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
152
+        var formData = new FormData($('form')[0]);
153
+        $.ajax({
154
+            type : "post",
155
+            url :'/dictionarya/renovationaddform',
156
+            data : formData,
157
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
158
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
159
+            error : function(request) {
160
+                layer.close(index);
161
+                layer.msg("请联系管理员");
162
+            },
163
+            success : function(data) {
164
+                if(data.data != null){
165
+                    layer.msg(ReturnInfo(data.data),{icon:5});
166
+                    return ;
167
+                }
168
+                layer.msg(data.msg);
169
+                parent.layer.close(oindex); //再执行关闭
170
+            }
171
+        });
172
+        return false;
173
+    });
174
+
175
+});

+ 114 - 0
backend/web/js/housech/dictionarya/theme.js

@@ -0,0 +1,114 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+
9
+    var tableIds = 'themelist';  //表格ID
10
+    var reloadId = 'tablerReload';
11
+    //第一个实例
12
+    table.render({
13
+        elem: '#'+tableIds
14
+        ,url: '/dictionarya/themeform' //数据接口
15
+        ,where:{token:csrfToken}
16
+        ,method:'post'
17
+        ,page: true //开启分页
18
+        ,height:600
19
+        ,text:'数据加载中'
20
+        ,id:reloadId
21
+        ,cols: [[ //表头
22
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
23
+            {type:'numbers'},
24
+            {field: 'name', title: '特色主题',align:'center'}
25
+            ,{field: 'update_at', title: '更新时间', width:150,align:'center'}
26
+            ,{field: 'create_at', title: '添加时间', width:150,align:'center'}
27
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
28
+
29
+        ]]
30
+    });
31
+
32
+    table.reload('tablerReload');        //重新加载
33
+
34
+    //列表操作
35
+    table.on('tool('+tableIds+')', function(obj){
36
+        var layEvent = obj.event,
37
+            data = obj.data;
38
+        if(layEvent === 'edit'){
39
+            layer.open({
40
+                type: 2,
41
+                title: '修改特色主题',
42
+                closeBtn: 1, //不显示关闭按钮
43
+                shade: [0],
44
+                area: ['600px', '500px'],
45
+                anim: 2,
46
+                content: '/dictionarya/themeedit?id='+data.id, //iframe的url,no代表不显示滚动条
47
+                end:function(){
48
+                    table.reload('tablerReload');
49
+                }
50
+            });
51
+        } else if(layEvent === 'del') {
52
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
53
+                $.post('/dictionarya/themedel',{'id':data.id},function (data) {
54
+                    if(data.code == 200)
55
+                    {
56
+                        layer.msg(data.msg);
57
+                        table.reload('tablerReload');
58
+                    } else if(data.code == 300 ) {
59
+                        layer.msg(data.msg);
60
+                    }
61
+                })
62
+            })
63
+        }
64
+
65
+
66
+    });
67
+
68
+    var $ = layui.$, active = {
69
+        addData: function(){ //获取选中数据
70
+            layer.open({
71
+                type: 2,
72
+                title: '添加特色主题',
73
+                area: ['600px', '500px'],
74
+                content: '/dictionarya/themeadd', //iframe的url,no代表不显示滚动条
75
+                end:function(){
76
+                    table.reload('tablerReload');
77
+                }
78
+            });
79
+        }
80
+    };
81
+
82
+    $('.demoTable .layui-btn').on('click', function(){
83
+        var type = $(this).data('type');
84
+        active[type] ? active[type].call(this) : '';
85
+    });
86
+
87
+    //修改
88
+    form.on('submit(edittheme)', function(data){
89
+        $.post('/dictionarya/themeeditform',{'data':data.field},function (data) {
90
+            if(data.code == 200)
91
+            {
92
+                layer.msg(data.msg);
93
+            } else if(data.code == 300 ) {
94
+                layer.msg(data.msg);
95
+            }
96
+        })
97
+        return false;
98
+    });
99
+
100
+    //添加
101
+    form.on('submit(addtheme)', function(data){
102
+        $.post('/dictionarya/themeaddform',{'data':data.field},function (data) {
103
+            if(data.code == 200)
104
+            {
105
+                layer.msg(data.msg);
106
+                $('input').val('');
107
+            } else if(data.code == 300 ) {
108
+                layer.msg(data.msg);
109
+            }
110
+        })
111
+        return false;
112
+    });
113
+
114
+});

+ 245 - 0
backend/web/js/housech/facilities.js

@@ -0,0 +1,245 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var layer = layui.layer //弹层
4
+        ,table = layui.table //表格
5
+        ,element = layui.element //元素操作
6
+        ,form = layui.form
7
+        ,upload = layui.upload;
8
+    //第一个实例
9
+    var indexTtable =table.render({
10
+        elem: '#housefacilitieslist'
11
+        ,url: '/dictionary/facilitiesform' //数据接口
12
+        ,where:{token:csrfToken}
13
+        ,method:'post'
14
+        ,page: true //开启分页
15
+        ,height:600
16
+        ,text:'数据加载中'
17
+        ,id:'tablerReload'
18
+        ,cols: [[ //表头
19
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
20
+            {type:'numbers'},
21
+            {field: 'name', title: '配套',align:'center'}
22
+            ,{field: 'sort', title: '排序',width:200, event:'sortData',edit: 'text',align:'center',sort: true,templet:"#sortBox"}
23
+            ,{field: 'is_show', title: '审核',align:'center',width:200, templet:function (d) {
24
+                if(d.is_show == 2){
25
+                    return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
26
+                } else {
27
+                    return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
28
+                }
29
+            }}
30
+            ,{field: 'create_at', title: '添加时间', width:120,align:'center'}
31
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
32
+
33
+        ]]
34
+    });
35
+
36
+    indexTtable.reload('tablerReload');        //重新加载
37
+
38
+    //监听指定开关
39
+    form.on('switch(switchTest)', function(data){
40
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
41
+            $.post('/dictionary/facilitiesstate',{id:data.value,type:'is_show'},function (data) {
42
+                layer.msg(data.msg);
43
+                table.reload('tablerReload');
44
+
45
+            })
46
+        },function (aa) {
47
+            indexTtable.reload('tablerReload');        //重新加载
48
+        })
49
+    });
50
+
51
+    //列表操作
52
+    table.on('tool(housefacilitieslist)', function(obj){
53
+        var layEvent = obj.event,
54
+            data = obj.data;
55
+        if(layEvent === 'edit'){
56
+            layer.open({
57
+                type: 2,
58
+                title: '修改配套信息',
59
+                closeBtn: 1, //不显示关闭按钮
60
+                shade: [0],
61
+                area: ['600px', '500px'],
62
+                anim: 2,
63
+                content: ['/dictionary/facilitiessave?id='+data.id, 'yes'], //iframe的url,no代表不显示滚动条
64
+            });
65
+        } else if(layEvent === 'del') {
66
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
67
+                $.post('/dictionary/facilitiesdel',{'id':data.id},function (data) {
68
+                    if(data.code == 200)
69
+                    {
70
+                        layer.msg(data.msg);
71
+                        table.reload('tablerReload');
72
+                    } else if(data.code == 300 ) {
73
+                        layer.msg(data.msg);
74
+                    }
75
+                })
76
+            })
77
+        }else if(layEvent === 'sortData'){       //修改排序
78
+            table.on('edit(housefacilitieslist)', function(obj){
79
+                var data = obj.data;
80
+                $.post('/dictionary/facilitiessort',{id:data.id,type:'sort',sort:data.sort},function (data) {
81
+                    if(data.code == 200)
82
+                    {
83
+                        layer.msg(data.msg);
84
+                    } else if(data.code == 300 ) {
85
+                        layer.msg(data.msg);
86
+                    }
87
+                })
88
+            })
89
+        }
90
+    });
91
+
92
+    var $ = layui.$, active = {
93
+        addData: function(){ //获取选中数据
94
+
95
+            layer.open({
96
+                type: 2,
97
+                title: '添加配套信息',
98
+                closeBtn: 1, //不显示关闭按钮
99
+                shade: [0],
100
+                area: ['600px', '500px'],
101
+                anim: 2,
102
+                content: ['/dictionary/facilitiesadd', 'yes'], //iframe的url,no代表不显示滚动条
103
+            });
104
+
105
+            // var checkStatus = table.checkStatus('idTest')
106
+            //     ,data = checkStatus.data;
107
+            // layer.alert(JSON.stringify(data));
108
+        }
109
+    };
110
+
111
+    $('.demoTable .layui-btn').on('click', function(){
112
+        var type = $(this).data('type');
113
+        active[type] ? active[type].call(this) : '';
114
+    });
115
+
116
+
117
+    //添加图片上传
118
+    upload.render({
119
+        elem: '#test1'
120
+        ,url: '/house/createimg'
121
+        ,data:{token:csrfToken}
122
+        ,field:'img'
123
+        ,size:1000              //限制上传图片的大小,单位为KB
124
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
125
+        ,auto:false
126
+        ,bindAction:'#addcity'
127
+        ,choose: function(obj){
128
+            obj.preview(function(index, file, result){
129
+                $('#demo1').attr('src', result); //图片链接(base64)
130
+            });
131
+        }
132
+    });
133
+
134
+    //添加图片上传
135
+    upload.render({
136
+        elem: '#test2'
137
+        ,url: '/house/createimg'
138
+        ,data:{token:csrfToken}
139
+        ,field:'mobile_img'
140
+        ,size:1000              //限制上传图片的大小,单位为KB
141
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
142
+        ,auto:false
143
+        ,bindAction:'#addcity'
144
+        ,choose: function(obj){
145
+            obj.preview(function(index, file, result){
146
+                $('#demo2').attr('src', result); //图片链接(base64)
147
+            });
148
+        }
149
+    });
150
+
151
+    //添加图片上传
152
+    upload.render({
153
+        elem: '#test3'
154
+        ,url: '/house/createimg'
155
+        ,data:{token:csrfToken}
156
+        ,field:'map_img'
157
+        ,size:1000              //限制上传图片的大小,单位为KB
158
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
159
+        ,auto:false
160
+        ,bindAction:'#addcity'
161
+        ,choose: function(obj){
162
+            obj.preview(function(index, file, result){
163
+                $('#demo3').attr('src', result); //图片链接(base64)
164
+            });
165
+        }
166
+    });
167
+
168
+
169
+    //修改
170
+    form.on('submit(save_form)', function(data){
171
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
172
+
173
+        var formData = new FormData($('#facilities_form')[0]);
174
+        $.ajax({
175
+            cache : true,
176
+            type : "post",
177
+            url : '/dictionary/facilitiessaveform',
178
+            data : formData,  // 你的formid
179
+            // async : false,          //async 默认为true异步,修改为false为同步
180
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
181
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
182
+            error : function(request) {
183
+                layer.close(index);         //关闭数据提交信息
184
+                layer.alert("网络超时");
185
+            },
186
+            success : function(data) {
187
+                if (data.code == 200) {
188
+                    layer.msg(data.msg);
189
+                    parent.layui.table.reload('housefacilitieslist');
190
+                    TableClose();
191
+                } else if(data.code == 300){
192
+                    layer.msg(data.msg);
193
+                    layer.msg(ReturnInfo(data.data));
194
+                }
195
+            }
196
+        });
197
+        return false;
198
+    });
199
+
200
+    // 点击放大图片
201
+    $('.layui_magnify').on('click', function(){
202
+        var _src = $(this).attr('src');
203
+        layui.layer.open({
204
+            type: 1,
205
+            title: false,           //是否显示标题
206
+            area: ['60%', '80%'],
207
+            shade: 0.6,           //透明度
208
+            closeBtn: 1,         //按钮 1有,0无
209
+            shadeClose: true,
210
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
211
+        });
212
+    });
213
+
214
+
215
+    //添加
216
+    form.on('submit(add_form)', function(data){
217
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
218
+        var formData = new FormData($('#facilities_form')[0]);
219
+        $.ajax({
220
+            cache : true,
221
+            type : "post",
222
+            url : '/dictionary/facilitiesaddform',
223
+            data : formData,  // 你的formid
224
+            // async : false,          //async 默认为true异步,修改为false为同步
225
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
226
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
227
+            error : function(request) {
228
+                layer.close(index);         //关闭数据提交信息
229
+                layer.alert("网络超时");
230
+            },
231
+            success : function(data) {
232
+                if (data.code == 200) {
233
+                    layer.msg(data.msg);
234
+                    parent.layui.table.reload('tablerReload');
235
+                    // TableClose();
236
+                } else if(data.code == 300){
237
+                    layer.msg(data.msg);
238
+                    layer.msg(ReturnInfo(data.data),{icon:5});
239
+                }
240
+            }
241
+        });
242
+        return false;
243
+    });
244
+
245
+});

File diff suppressed because it is too large
+ 288 - 0
backend/web/js/housech/housealbum.js


+ 202 - 0
backend/web/js/housech/housebatchsave.js

@@ -0,0 +1,202 @@
1
+
2
+layui.use(['form','layer','laydate','table','laytpl','layedit','upload'],function(){
3
+    var form = layui.form,
4
+        // layer = parent.layer === undefined ? layui.layer : top.layer,
5
+        layer = layui.layer,
6
+        $ = layui.jquery,
7
+        laydate = layui.laydate,
8
+        laytpl = layui.laytpl,
9
+        table = layui.table,
10
+        layedit = layui.layedit
11
+        ,upload = layui.upload;
12
+
13
+    //调用编辑器
14
+    var tableIds = 'housesList';
15
+    var reloadId = 'tablerReload';
16
+
17
+
18
+    //日期
19
+    laydate.render({
20
+        elem: '#date1'
21
+    });
22
+    laydate.render({
23
+        elem: '#date2'
24
+    });
25
+
26
+
27
+    $('.demoTable .layui-btn').on('click', function(){
28
+        var type = $(this).data('type');
29
+        active[type] ? active[type].call(this) : '';
30
+    });
31
+
32
+
33
+    form.on('submit(del_alls_house)',function (data) {
34
+        var checkStatus = table.checkStatus('tablerReload');
35
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
36
+        if(typeof  checkStatus.data[0] == 'object'){
37
+            layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
38
+                var formdat = new FormData();
39
+                $.each(checkStatus.data,function (key,val) {
40
+                    formdat.append('hid[]',val.id);
41
+                })
42
+                $.ajax({
43
+                    cache : true,
44
+                    type : "post",
45
+                    url : "/housech/housedel",
46
+                    data : formdat,  // 你的formid
47
+                    // async : false,          //async 默认为true异步,修改为false为同步
48
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
49
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
50
+                    error : function(request) {
51
+                        layer.close(index);         //关闭数据提交信息
52
+                        layer.alert("网络超时");
53
+                    },
54
+                    success : function(data) {
55
+                        if (data.code == 200) {
56
+                            layer.msg(data.msg);
57
+                            reloadTable(reloadId);
58
+                        } else {
59
+                            layer.msg(data.msg);
60
+                        }
61
+                    }
62
+                });
63
+
64
+            })
65
+            return false;
66
+        }
67
+        layer.msg('请选择需要删除的楼盘',{icon:5});
68
+        return false;
69
+    })
70
+
71
+
72
+
73
+
74
+
75
+    form.on('submit(xia)',function (data) {
76
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
77
+        var formData = new FormData($('form')[0]);
78
+        $.ajax({
79
+            cache : true,
80
+            type : "post",
81
+            url : "/housech/batchsaveform",
82
+            data : formData,  // 你的formid
83
+            // async : false,          //async 默认为true异步,修改为false为同步
84
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
85
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
86
+            error : function(request) {
87
+
88
+                layer.msg("网络超时");
89
+            },
90
+            success : function(data) {
91
+                if(data.data != null){
92
+                    layer.msg(ReturnInfo(data.data),{icon:5});
93
+                    return ;
94
+                }
95
+                layer.msg(data.msg);
96
+            }
97
+        });
98
+        return false;
99
+    })
100
+
101
+
102
+    form.on('submit(edit)',function (data) {
103
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
104
+
105
+        var formData = new FormData($('#house_edit_form')[0]);
106
+
107
+        // var trArry = $('.layui_w_licence table.layui-table tbody tr');
108
+        // $.each(trArry,function(i,v){
109
+        //     var _licenseKey =$(this).find('input[name="licenseKey"]').val();
110
+        //     if(_licenseKey !=""){           //判断许可证号是否为空
111
+        //         formData.append('licenseKey[]',_licenseKey);
112
+        //         formData.append('issueDate[]',$(this).find('input[name="issueDate"]').val());
113
+        //         formData.append('buildingName[]',$(this).find('input[name="buildingName"]').val());
114
+        //     }
115
+        // })
116
+
117
+
118
+        $.ajax({
119
+            cache : true,
120
+            type : "post",
121
+            url : "/housech/editfrom",
122
+            data : formData,  // 你的formid
123
+            // async : false,          //async 默认为true异步,修改为false为同步
124
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
125
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
126
+            error : function(request) {
127
+                layer.close(index);         //关闭数据提交信息
128
+                layer.alert("请联系管理员");
129
+            },
130
+            success : function(data) {
131
+                if (data.code == 200) {
132
+                    layer.msg(data.msg);
133
+                } else if(data.code == 300){
134
+                    layer.msg(data.msg);
135
+                    layer.msg(ReturnInfo(data.data),{icon:5});
136
+
137
+                }
138
+            }
139
+        });
140
+        return false;
141
+    });
142
+
143
+
144
+
145
+
146
+    //加载省数据
147
+    function loadProvince() {
148
+
149
+        $.ajax({
150
+            url : '/categorycity/citypid',
151
+            type : 'post',
152
+            async: false,//使用同步的方式,true为异步方式
153
+            data : {'pid':0},//这里使用json对象
154
+            success : function(data){
155
+                console.log(data);
156
+                var areaData = data.data;
157
+                var proHtml = '';
158
+                for (var i = 0; i < areaData.length; i++) {
159
+                    proHtml += '<option value="' + areaData[i].id +'">' + areaData[i].city_name + '</option>';
160
+                }
161
+                //初始化省数据
162
+                $('select[name=province]').append(proHtml);
163
+                form.render();
164
+            },
165
+            fail:function(){
166
+
167
+            }
168
+        });
169
+
170
+
171
+    }
172
+
173
+    loadProvince();
174
+
175
+    form.on('select(province)',function (data) {
176
+        $.post('/categorycity/citypid',{'pid':data.value},function (data) {
177
+            var areaData = data.data;
178
+            var proHtml = '';
179
+            $('select[name=city]').html('');
180
+            proHtml = '<option value="">请选择市/区/县</option>';
181
+            for (var i = 0; i < areaData.length; i++) {
182
+
183
+                proHtml += '<option value="' + areaData[i].id +'">' + areaData[i].city_name + '</option>';
184
+            }
185
+            //初始化省数据
186
+            $('select[name=city]').append(proHtml);
187
+            form.render();
188
+        })
189
+    })
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+})
199
+
200
+
201
+
202
+                       

+ 232 - 0
backend/web/js/housech/housenews.js

@@ -0,0 +1,232 @@
1
+layui.use(['form','layer','laydate','table','laytpl','layedit'],function(){
2
+    var form = layui.form,
3
+        layer = parent.layer === undefined ? layui.layer : top.layer,
4
+        $ = layui.jquery,
5
+        table = layui.table;
6
+
7
+    var tableIds = 'newsList';
8
+    var tableIns = table.render({
9
+        elem: '#'+tableIds,
10
+        url : '/housech/newslistform',
11
+        where:{hid:$('#houseId').val()},
12
+        method:'post',
13
+        page : true,
14
+        height:600,
15
+        limit : 20,
16
+        id:'tablerReload',
17
+        cols : [[
18
+            {type:'numbers'},
19
+            {type: "checkbox", width:50},
20
+            {field: 'id', title: 'ID', width:80, align:"center",sort: true},
21
+            {field: 'subject', title: '标题',align:'left'},
22
+            // {field: 'city_name', title: '区域',width:80, align:'center'},
23
+            {field: 'name', title: '添加人',width:75,  align:'center'},
24
+            {field: 'news_name', title: '栏目',width:150, align:'center'},
25
+            // {field: 'is_view', title: '审核',width:80, event:'housesNews',  align:'center',templet:'#sexTpl'},
26
+            // {field: 'comment', title: '评论',width:80, align:'center',templet:"#comment",templet:function(d){
27
+            //         return '<a href="#">['+d.comment+']</a>'
28
+            //     }},
29
+            {field: 'clicks', title: '点击数',width:100, align:'center',sort: true},
30
+            {field: 'create_at', title: '添加时间',width:180, event:'sortData', align:'center',sort: true},
31
+            {title: '操作', width:200, templet:'#housesListBar',fixed:"right",align:"center"}
32
+
33
+        ]]
34
+    });
35
+
36
+    
37
+    tableIns.reload('tablerReload');        //重新加载
38
+
39
+
40
+    $('.demoTable .layui-btn').on('click', function(){
41
+        var type = $(this).data('type');
42
+        active[type] ? active[type].call(this) : '';
43
+    });
44
+
45
+    var $ = layui.$, active = {
46
+        loadnews: function(){ //获取选中数据
47
+            var index = parent.layui.layer.open({
48
+                title : "加载资讯",
49
+                type : 2,
50
+                area:['','100%'],
51
+                maxmin: true,
52
+                content : "/housech/loadnews",
53
+            })
54
+
55
+            parent.layui.layer.full(index);
56
+            // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
57
+            $(window).on("resize",function(){
58
+                parent.layui.layer.full(index);
59
+            })
60
+        },//筛选
61
+        reload:function () {
62
+            var form = pfgs_serialize($('form'));
63
+            var name = '';
64
+            var id = '';
65
+            // console.log($('form').serializeArray());
66
+            if(form.input_house == 'name'){
67
+                name = form.input_house_text;
68
+            } else if(form.input_house == 'id'){
69
+                id = form.input_house_text;
70
+            }
71
+            table.reload('tablerReload',{
72
+                where:{
73
+                    sort:form.input_sort,
74
+                    id:id,
75
+                    name:name,
76
+                    category:form.category
77
+                }
78
+            })
79
+        },  //加载资讯的搜索
80
+        load_news_reload:function () {
81
+            var form = pfgs_serialize($('form'));
82
+            var name = '';
83
+            var id = '';
84
+            // console.log($('form').serializeArray());
85
+            if(form.input_house == 'name'){
86
+                name = form.input_house_text;
87
+            } else if(form.input_house == 'id'){
88
+                id = form.input_house_text;
89
+            }
90
+            table.reload('loadnewsId',{
91
+                where:{
92
+                    id:id,
93
+                    name:name,
94
+                    news:form.category
95
+                }
96
+            })
97
+        }
98
+
99
+    };
100
+
101
+
102
+
103
+
104
+    //列表操作
105
+    table.on('tool('+tableIds+')', function(obj){
106
+        var data = obj.data;
107
+        if(obj.event === 'del'){		//删除楼盘文章
108
+            layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function () {
109
+                $.post('/housech/housenewsdel',{dataid:data.hnid},function (data) {
110
+                    if(data.code == 200){
111
+                        layer.msg(data.msg);
112
+                        table.reload('tablerReload');
113
+                    }else if(data.code == 300){
114
+                        layer.msg(data.msg);
115
+                    }
116
+
117
+                })
118
+
119
+            })
120
+
121
+        }else if(obj.event === 'Relieve'){
122
+            var _this = $(this);
123
+
124
+            layer.confirm('您确定要解审吗?',{btn:['确认','取消']},function () {
125
+                $.post('/housech/housenewsdel',{dataid:data.hnid,type:2},function (data) {
126
+                    if(data.code == 200){
127
+                       // _this.text('aa');
128
+                        layer.msg('操作成功');
129
+                        table.reload('tablerReload');
130
+                    }else if(data.code == 300){
131
+                        layer.msg('操作失败');
132
+                    }
133
+
134
+                })
135
+
136
+            })
137
+
138
+        }
139
+    });
140
+
141
+
142
+    //加载资讯
143
+    $('.loadnews').click(function () {
144
+        var index = parent.layui.layer.open({
145
+            title :'<span style="color:red" >'+$('.house_name').html()+'</span>加载资讯',
146
+            type : 2,
147
+            area:['','100%'],
148
+            maxmin: true,
149
+            content : "/housech/loadnews?hid="+$('#houseId').val(),
150
+            end:function () {
151
+                layui.table.reload('tablerReload');
152
+            }
153
+        })
154
+
155
+        parent.layui.layer.full(index);
156
+        // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
157
+        $(window).on("resize",function(){
158
+            parent.layui.layer.full(index);
159
+        })
160
+    })
161
+
162
+    //资讯列表
163
+    table.render({
164
+        elem: '#loadnewsList',
165
+        url : '/housech/loadnewslist',
166
+        method:'post',
167
+        where:{hid:$('#houseId').val()},    //接口的其它参数。如:where: {token: 'sasasas', id: 123}
168
+        // height:'380px',         //容器高度
169
+        id:'loadnewsId',
170
+        page : true,
171
+        limit : 20,         //注意:请务必确保 limit 参数(默认:10)是与你服务端限定的数据条数一致
172
+        cols : [[
173
+            {type: "checkbox", fixed:"left", width:50},
174
+            {field: 'id', title: 'ID', width:80, align:"center",sort: true},
175
+            {field: 'subject', title: '标题',align:'left'},
176
+            // {field: 'city_name', title: '区域',width:80, align:'center'},
177
+            // {field: 'news_name', title: '栏目',width:150, align:'center'},
178
+            {field: 'state', title: '审核',width:80, event:'housesNews',  align:'center'},
179
+            // {field: 'comment', title: '评论',width:80, align:'center',templet:"#comment",templet:function(d){
180
+            //         return '<a href="#">['+d.comment+']</a>'
181
+            //     }},
182
+            {field: 'clicks', title: '点击数',width:100, align:'center',sort: true},
183
+            {field: 'create_at', title: '添加时间',width:150, event:'sortData', align:'center',sort: true},
184
+            // {title: '操作', width:200, templet:'#housesListBar',fixed:"right",align:"center"}
185
+
186
+        ]]
187
+    });
188
+
189
+    form.on('submit(add_load_news)',function (data) {
190
+        var checkStatus = table.checkStatus('loadnewsId');
191
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
192
+        // console.log(checkStatus.length);
193
+        // console.log(typeof checkStatus.data[0]);
194
+        // return false;
195
+        if(typeof  checkStatus.data[0] == 'object'){
196
+             var Hid = $('#houseId').val();
197
+            var formdat = new FormData();
198
+            $.each(checkStatus.data,function (key,val) {
199
+                formdat.append('nid[]',val.id);
200
+            })
201
+            formdat.append('hid',Hid);
202
+            $.ajax({
203
+                cache : true,
204
+                type : "post",
205
+                url : "/housech/relationnews",
206
+                data : formdat,  // 你的formid
207
+                // async : false,          //async 默认为true异步,修改为false为同步
208
+                contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
209
+                processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
210
+                error : function(request) {
211
+                    layer.close(index);         //关闭数据提交信息
212
+                    layer.alert("网络超时");
213
+                },
214
+                success : function(data) {
215
+                    if (data.code == 200) {
216
+                        layer.msg(data.msg);
217
+
218
+                        // table.reload('loadnewsId');
219
+                        TableClose();
220
+                    } else {
221
+                        layer.msg(data.msg);
222
+                        TableClose();
223
+                    }
224
+                }
225
+            });
226
+            return false;
227
+        }
228
+            layer.msg('请选择资讯');
229
+            return false;
230
+    })
231
+
232
+})

+ 235 - 0
backend/web/js/housech/housepeitao.js

@@ -0,0 +1,235 @@
1
+// var delFiles = []; //用于删除图片
2
+// var filesContainer= {};  //存储最终要上传的图片
3
+// var files ;     //存储选择图片的数量
4
+var trNum = [];
5
+var trIndex;
6
+var delNum = [];
7
+var dataId =new Array();
8
+layui.use(['form','layer','upload','table'],function(){
9
+    var form = layui.form,
10
+        // layer = parent.layer === undefined ? layui.layer : top.layer,
11
+        layer =  layui.layer ,
12
+        table = layui.table,
13
+        $ = layui.jquery;
14
+
15
+    var inputId = $('input[name="hid"]').val();
16
+    var inputName = $('input[name="name"]').val();
17
+    var longitude_latitude = $('input[name="longitude_latitude"]').val();
18
+    //楼盘列表
19
+    var indexTtable =  table.render({
20
+        elem: '#housepeitaolist',
21
+        url : '/housech/peitaoform',
22
+        where:{hid:inputId},
23
+        method:'post',
24
+        id:'tablerReload',
25
+        cols : [[
26
+            // {type: "checkbox", fixed:"left", width:50},
27
+            {type:'numbers'},
28
+            {field: 'name', title: '配套类目', align:"center",sort: true},
29
+            {field: 'num', title: '数量', align:"center",sort: true,width:100},
30
+            {title: '操作', width:200, templet:'#housesalbumListBar',fixed:"right",align:"center"}
31
+
32
+        ]]
33
+    });
34
+
35
+    indexTtable.reload('tablerReload');        //重新加载
36
+
37
+
38
+    // var  onerange = getRandom(99);
39
+
40
+
41
+    //配套设施修改
42
+    var inputFid = $('input[name="fid"]').val();
43
+    var editTable = table.render({
44
+        elem: '#facilitysss',
45
+        url: '/housech/peitaoedit',
46
+        method:'post',
47
+        cellMinWidth: 98,
48
+        where: {fid: inputFid, hid: inputId},
49
+        id: "facility",
50
+        cols: [[
51
+            {type: "", fixed: "left", width: 50, event: 'del', templet: function (d) {
52
+                    return '<i class="layui-icon" style="font-size: 30px; color: #1E9FFF;">&#xe640;</i>'
53
+                }},
54
+            { field: "id", title: "ID", width: 100,display:"none",align: "center", templet: function (d) {
55
+                    return '<input type="text" style="display: none;" name="edit_id" value="' + d.id + '" autocomplete="off" class="layui-input" >'
56
+                }},
57
+            {field: "name", title: "配套名称", width: 250, align: "center", templet: function (d) {
58
+                    return '<input type="text" name="matingName['+d.id+']"  value="' + d.name + '" autocomplete="off" class="layui-input" >'
59
+                }},
60
+            {field: "distance", title: "距离", width: 150, align: "center", templet: function (d) {
61
+                    return '<input type="text" name="distance['+d.id+']" value="' + d.distance + '" autocomplete="off" class="layui-input" >'
62
+                }},
63
+            {field: "latitude_longitude",title: "经纬度",width: 200,align: "center",sort: true,templet: function (d) {
64
+                    return '<input type="text" id="jwd' + d.id + '"  name="longitude['+d.id+']" value="' + d.latitude_longitude + '" autocomplete="off" class="layui-input" >';
65
+                }}
66
+        ]],done:function (res, curr, count) {
67
+            $("[data-field='id']").css('display','none');
68
+        }
69
+    })
70
+
71
+
72
+
73
+
74
+    //修改的工具条
75
+    table.on('tool(facilitysss)', function(obj){
76
+        var data = obj.data;
77
+        var _this = $(this);
78
+        if(obj.event === 'del'){
79
+            layer.confirm('确定删除数据?', function(index){
80
+                if(data.id > 0){
81
+                    dataId.push(data.id);
82
+                }
83
+                if(typeof data.id =='undefined'){
84
+                    _this.parents('tr').remove();
85
+                }
86
+                obj.del();
87
+                layer.close(index);
88
+            });
89
+        }
90
+    });
91
+
92
+    //监听工具条
93
+    table.on('tool(housepeitaolist)', function(obj){
94
+        var data = obj.data;
95
+        if(obj.event === 'edit' ){
96
+            var index = parent.layui.layer.open({
97
+                title : '<span style="color:red" >['+inputName+']</span> 楼盘周边配套修改',
98
+                type : 2,
99
+                maxmin: true,
100
+                area: ['', '100%'],
101
+                content : "/housech/peitaoedit?id="+inputId+'&fid='+data.fid+'&name='+data.name +'&ll='+longitude_latitude,
102
+                end:function () {
103
+                    layui.table.reload('tablerReload');
104
+                }
105
+            })
106
+            parent.layui.layer.full(index);
107
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
108
+            $(window).on("resize",function(){
109
+                parent.layui.layer.full(index);
110
+            })
111
+        }else if(obj.event === 'del'){
112
+            var index =layui.layer.confirm('确定要删除吗?',{btn: ['确定', '取消']},function () {
113
+                $.post('/housech/peitaodel',{hid:inputId,type_id:data.fid},function (data) {
114
+                    if(data.code == 200)
115
+                    {
116
+                        layer.msg(data.msg);
117
+                        table.reload('tablerReload');
118
+                    } else if(data.code == 300 ) {
119
+                        layer.msg(data.msg);
120
+                    }
121
+                })
122
+            })
123
+        }
124
+    });
125
+
126
+    $('.layui_map .layui_close').on('click',function(){
127
+        location.reload(); // 父页面刷新
128
+    })
129
+
130
+
131
+    /*
132
+    *   弹出添加配套页面
133
+    * */
134
+    function addAlbum(edit){
135
+        var index = parent.layui.layer.open({
136
+            title : '<span style="color:red" >['+inputName+']</span> 楼盘添加周边配套',
137
+            type : 2,
138
+            maxmin: true,
139
+            area: ['', '100%'],
140
+            content : "/housech/peitaoadd?id="+inputId+'&name='+inputName+'&ll='+longitude_latitude,
141
+            end:function () {
142
+                layui.table.reload('tablerReload');
143
+            }
144
+        })
145
+        parent.layui.layer.full(index);
146
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
147
+        $(window).on("resize",function(){
148
+            parent.layui.layer.full(index);
149
+        })
150
+    }
151
+    //添加配套
152
+    $("#add-album").click(function(){
153
+        addAlbum()
154
+    });
155
+
156
+    // 添加页面提交
157
+    form.on('submit(add_load_mating)',function (data) {
158
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
159
+        var form = pfgs_serialize($('#peitao_form'));
160
+        var trArry = $('.layui-input-block table.layui-table tbody tr');
161
+        var dataObj = [{}];
162
+        var dataArry = new Array();
163
+        $.each(trArry,function(key,val){
164
+            var _title = $(this).find('input[name="matingName"]').val();
165
+            var _rout = $(this).find('input[name="distance"]').val();
166
+            var _point = $(this).find('input[name="longitude"]').val();
167
+            dataObj[key] = {title:_title,rout:_rout,point:_point}        //把数据以数组对象的方式保存
168
+            dataArry.push(dataObj[key])
169
+        })
170
+        $.post("/housech/peitaoaddform",{data:dataArry,hid:inputId,type_id:form.city},function(data){
171
+            if (data.code == 200) {
172
+                layer.msg(data.msg);
173
+                indexTtable.reload('tablerReload');
174
+                TableClose();
175
+            } else if(data.code == 300){
176
+                layer.msg(data.msg);
177
+                if(data.data.length > 0){
178
+                    layer.msg(ReturnInfo(data.data),{icon:5});
179
+                }
180
+            }
181
+        })
182
+
183
+        return false;
184
+    })
185
+
186
+    // 修改提交
187
+    form.on('submit(edit_load_mating)',function (data) {
188
+
189
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
190
+        var form = pfgs_serialize($('#peitao_form'));
191
+        var trArry = $('.layui-table-main table.layui-table tbody tr');
192
+        var dataObj = [{}];
193
+        var dataArry = new Array();
194
+        $.each(trArry,function(key,val){
195
+            var _title = $(this).find('input[name="matingName"]').val();
196
+            var _rout = $(this).find('input[name="distance"]').val();
197
+            var _point = $(this).find('input[name="longitude"]').val();
198
+            dataObj[key] = {title:_title,rout:_rout,point:_point}        //把数据以数组对象的方式保存
199
+            dataArry.push(dataObj[key])
200
+        })
201
+        $.post("/housech/peitaoeditform",{data:dataArry,dataId:dataId,hid:inputId,type_id:form.fid},function(data){
202
+            layer.msg(data.msg);
203
+            // if (data.code == 200) {
204
+            //     layer.msg(data.msg);
205
+            //     indexTtable.reload('tablerReload');
206
+            //
207
+            // } else if(data.code == 300){
208
+            //     layer.msg(data.msg);
209
+            //     if(data.data.length > 0){
210
+            //         layer.msg(ReturnInfo(data.data),{icon:5});
211
+            //     }
212
+            // }
213
+        })
214
+
215
+        return false;
216
+    })
217
+
218
+});
219
+
220
+//生产随机数
221
+// function getRandom(n) {
222
+//     return Math.floor(Math.random() * n + 1)
223
+// }
224
+//
225
+// function uniqueidArr(arr) {
226
+//     var newArr = {};
227
+//     console.log(newArr);
228
+//     if(arr.length >0){
229
+//         $.each(arr,function (k,v) {
230
+//             newArr[v] = v;
231
+//         })
232
+//         return newArr;
233
+//     }
234
+//
235
+// }

+ 274 - 0
backend/web/js/housech/houseprice.js

@@ -0,0 +1,274 @@
1
+
2
+layui.use(['form','layer','laydate','table','laytpl','layedit','upload'],function(){
3
+    var form = layui.form,
4
+        layer = parent.layer === undefined ? layui.layer : top.layer,
5
+        $ = layui.jquery,
6
+        laydate = layui.laydate,
7
+        laytpl = layui.laytpl,
8
+        table = layui.table,
9
+        layedit = layui.layedit
10
+        ,upload = layui.upload;
11
+
12
+    var houid = $('input[name=hid]').val();
13
+    var houname = $('input[name=name]').val();
14
+    //调用编辑器
15
+    var tableIds = 'housespriceList';
16
+    //楼盘列表
17
+    var tableIns = table.render({
18
+        elem: '#'+tableIds,
19
+        url : '/housech/priceviewform',
20
+        cellMinWidth : 95,
21
+        where:{hid:houid},
22
+        method:'post',
23
+        page : true,
24
+        height : 600,
25
+        limit : 20,
26
+        id:'pricetablerReload',
27
+        cols : [[
28
+            {type:'numbers',fixed:"left"},
29
+            {type: "checkbox",fixed:"left", width:50},
30
+            {field: 'create_time', title: '记录时间', align:"center",sort: true},
31
+            {field: 'price', title: '均价', width:120, align:"center",sort: true},
32
+            {field: 'price_unit', title: '单位', width:120, align:"center",sort: true},
33
+            {field: 'min_price', title: '最低价', width:120, align:"center",sort: true},
34
+            {field: 'explain', title: '价格说明', width:200, align:"center",sort: true},
35
+            {title: '操作', width:150, templet:'#housesListBar',fixed:"right",align:"center"}
36
+        ]]
37
+    });
38
+
39
+    tableIns.reload('pricetablerReload');        //重新加载
40
+
41
+    var $ = layui.$, active = {
42
+        addData: function(){ //获取选中数据
43
+            var index = parent.layui.layer.open({
44
+                title : "添加新价格",
45
+                type : 2,
46
+                area:['','100%'],
47
+                maxmin: true,
48
+                content : "/housech/priceadd?hid="+houid+'&name='+houname,
49
+                end:function(){
50
+                    layui.table.reload('pricetablerReload');
51
+                }
52
+            })
53
+
54
+            parent.layui.layer.full(index);
55
+            // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
56
+            $(window).on("resize",function(){
57
+                parent.layui.layer.full(index);
58
+            })
59
+        },
60
+        reload:function () {
61
+            var form = pfgs_serialize($('form'));
62
+            var name = '';
63
+            var id   = '';
64
+            // console.log($('form').serializeArray());
65
+            if(form.input_house == 'name'){
66
+                name = form.input_house_text;
67
+            } else if(form.input_house == 'id'){
68
+                id = form.input_house_text;
69
+            }
70
+            table.reload('tablerReload',{
71
+                where:{
72
+                    sort:form.input_sort,
73
+                    id:id,
74
+                    name:name,
75
+                    city:form.input_city
76
+                }
77
+            })
78
+        }
79
+
80
+    };
81
+
82
+    $('.demoTable .layui-btn').on('click', function(){
83
+        var type = $(this).data('type');
84
+        active[type] ? active[type].call(this) : '';
85
+    });
86
+
87
+    //日期
88
+    laydate.render({
89
+        elem: '#date1'
90
+    });
91
+
92
+
93
+
94
+    //列表操作
95
+    table.on('tool('+tableIds+')', function(obj){
96
+        var data = obj.data;
97
+   if(obj.event  === 'edit'){
98
+            var index = parent.layui.layer.open({
99
+                title : "修改价格信息",
100
+                type : 2,
101
+                area:['','100%'],
102
+                maxmin: true,
103
+                content : "/housech/priceedit?id="+data.id+'&name='+houname,
104
+                end:function(){
105
+                    layui.table.reload('pricetablerReload');
106
+                }
107
+            })
108
+
109
+                 parent.layui.layer.full(index);
110
+            // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
111
+            $(window).on("resize",function(){
112
+                parent.layui.layer.full(index);
113
+            })
114
+        } else if(obj.event === 'del'){
115
+
116
+            layer.confirm('您确认要删除吗?',{btn:['确认','取消']},function () {
117
+                $.post('/housech/housedel',{id:data.id},function (data) {
118
+                    if (data.code == 200) {
119
+                        layer.msg(data.msg);
120
+                        // parent.layui.
121
+                        table.reload('tablerReload');
122
+                        // TableClose();
123
+                    } else {
124
+                        layer.msg(data.msg);
125
+                    }
126
+                })
127
+            })
128
+        }
129
+    });
130
+
131
+
132
+    form.on('submit(pricetijiao)',function (data) {
133
+
134
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
135
+
136
+        var formData = new FormData($('#price_form')[0]);
137
+        console.log(formData)
138
+
139
+        $.ajax({
140
+            cache : true,
141
+            type : "post",
142
+            url : "/housech/priceaddform",
143
+            data : formData,  // 你的formid
144
+            // async : false,          //async 默认为true异步,修改为false为同步,
145
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
146
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
147
+            error : function(request) {
148
+                layer.close(index);         //关闭数据提交信息
149
+                layer.alert("网络超时");
150
+            },
151
+            success : function(data) {
152
+                if (data.code == 200) {
153
+                    layer.msg(data.msg);
154
+                    TableClose();
155
+
156
+                } else if(data.code == 300){
157
+                    layer.msg(data.msg);
158
+                    layer.msg(ReturnInfo(data.data),{icon:5});
159
+                }
160
+            }
161
+        });
162
+        return false;
163
+    })
164
+
165
+
166
+    form.on('submit(priceSave)',function (data) {
167
+        //aaaaa
168
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
169
+
170
+        var formData = new FormData($('#price_form')[0]);
171
+        $.ajax({
172
+            cache : true,
173
+            type : "post",
174
+            url : "/housech/priceeditform",
175
+            data : formData,  // 你的formid
176
+            // async : false,          //async 默认为true异步,修改为false为同步,
177
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
178
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
179
+            error : function(request) {
180
+                layer.close(index);         //关闭数据提交信息
181
+                layer.alert("网络超时");
182
+            },
183
+            success : function(data) {
184
+                layer.close(index);         //关闭数据提交信息
185
+                if (data.code == 200) {
186
+                    layer.msg(data.msg);
187
+                    // parent.layui.table.reload('pricetablerReload');
188
+                    TableClose();
189
+                } else if(data.code == 300){
190
+                    layer.msg(data.msg);
191
+                    layer.msg(ReturnInfo(data.data),{icon:5});
192
+
193
+                }
194
+            }
195
+        });
196
+        return false;
197
+    })
198
+
199
+
200
+
201
+    form.on('submit(del_price)',function (data) {
202
+        //aaaaa
203
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
204
+
205
+        var checkStatus = table.checkStatus('pricetablerReload');
206
+        if(typeof  checkStatus.data[0] == 'object'){
207
+            // var Hid = $('#houseId').val();
208
+            var formdat = new FormData();
209
+            $.each(checkStatus.data,function (key,val) {
210
+                formdat.append('id[]',val.id);
211
+            })
212
+            $.ajax({
213
+                cache : true,
214
+                type : "post",
215
+                url : "/housech/pricedel",
216
+                data : formdat,  // 你的formid
217
+                // async : false,          //async 默认为true异步,修改为false为同步,
218
+                contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
219
+                processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
220
+                error : function(request) {
221
+                    layer.close(index);         //关闭数据提交信息
222
+                    layer.alert("网络超时");
223
+                },
224
+                success : function(data) {
225
+                    if (data.code == 200) {
226
+                        layer.msg(data.msg);
227
+                        layui.table.reload('pricetablerReload');
228
+                    } else if(data.code == 300){
229
+                        layer.msg(data.msg);
230
+                        layer.msg(ReturnInfo(data.data),{icon:5});
231
+                    }
232
+                }
233
+            });
234
+            return false;
235
+        }
236
+        layer.msg('请选择需要删除的行');
237
+        return false;
238
+        // $.ajax({
239
+        //     cache : true,
240
+        //     type : "post",
241
+        //     url : "/house/priceeditform",
242
+        //     data : formData,  // 你的formid
243
+        //     // async : false,          //async 默认为true异步,修改为false为同步,
244
+        //     contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
245
+        //     processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
246
+        //     error : function(request) {
247
+        //         layer.close(index);         //关闭数据提交信息
248
+        //         layer.alert("网络超时");
249
+        //     },
250
+        //     success : function(data) {
251
+        //         if (data.code == 200) {
252
+        //             layer.msg(data.msg);
253
+        //             // parent.layui.table.reload('pricetablerReload');
254
+        //             TableClose();
255
+        //         } else if(data.code == 300){
256
+        //             layer.msg(data.msg);
257
+        //             layer.msg(ReturnInfo(data.data),{icon:5});
258
+        //
259
+        //         }
260
+        //     }
261
+        // });
262
+        // return false;
263
+    })
264
+
265
+
266
+})
267
+
268
+$(function(){
269
+    // 动态添加批量删除按钮
270
+    var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
271
+              + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_price">删除</a>'
272
+              + '</div>'
273
+    $('.layui-form').append(_btn)
274
+})

+ 789 - 0
backend/web/js/housech/houses.js

@@ -0,0 +1,789 @@
1
+
2
+layui.use(['form','layer','laydate','table','laytpl','layedit','upload'],function(){
3
+    var form = layui.form,
4
+        // layer = parent.layer === undefined ? layui.layer : top.layer,
5
+        layer = layui.layer,
6
+        $ = layui.jquery,
7
+        laydate = layui.laydate,
8
+        laytpl = layui.laytpl,
9
+        table = layui.table,
10
+        layedit = layui.layedit
11
+        ,upload = layui.upload;
12
+
13
+    //调用编辑器
14
+    var tableIds = 'housesList';
15
+    var reloadId = 'tablerReload';
16
+    //楼盘列表
17
+    var tableIns = table.render({
18
+        elem: '#'+tableIds,
19
+        url : '/housech/indexform',
20
+        cellMinWidth : 95,
21
+        method:'post',
22
+        page : true,
23
+        height : 600,
24
+        limit : 20,
25
+        id:reloadId,
26
+        // limits : [10,15,20,25],is_view
27
+        cols : [[
28
+            {type: "checkbox", width:50},
29
+            {field: 'id', title: 'ID', width:80, align:"center",sort: true},
30
+            {field: 'name', title: '标题', align:"center",templet:function(d){
31
+                    var html = '<ul style="width:200px;float:left;">';
32
+                    if(d.is_push == 2){
33
+                        html += '<li style="float:left; padding: 0 5px;"><img src="/img/house/housezhutui.png"></li>';
34
+                    }
35
+                    if(d.thumb != null && d.thumb != ""){
36
+                        html += '<li style="float:left;padding: 0 5px;"><img  src="/img/house/housetu.png"></li>';
37
+                    }
38
+                    if(d.evaluating != null && d.evaluating != ""){
39
+                        html += '<li style="float:left;padding: 0 5px;"><img  src="/img/house/houseping.png"></li>';
40
+                    }
41
+                    if(d.video == 1){
42
+                        html += '<li style="float:left;padding: 0 5px;"><img  src="/img/house/hangpai.png"></li>';
43
+                    }
44
+
45
+                    if(d.permit != 0){
46
+                        html += '<li style="float:left;padding: 0 5px;position:relative;"><img src="/img/house/houseyushouzheng.png"><span style="font-size:12px;;position:absolute;right:7px;top:1px;display:inline-block;width:22px;text-align:center;color:#fff;">'+d.permit+'</span></li>';
47
+                    }
48
+
49
+                    html += '</ul>';
50
+                    html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.pinfanghw.com/housech/'+d.id+'/" target="_blank">'+d.name+'</a>';
51
+                    return html;
52
+                }},
53
+            {field: 'city_name', title: '区域',width:90,sort:true, align:'center'},
54
+            // {field: 'news_num', title: '资讯',width:70, event:'housesNews',  align:'center',templet:"#housesNews",templet:function(d){
55
+            //         return '<a href="javascript:;">['+d.news_num+']</a>'
56
+            //     }},
57
+            {field: 'album_num', title: '相册',width:70,  event:'housesPhoto', align:'center',templet:"#housesPhoto",templet:function(d){
58
+                    return '<a href="javascript:;">['+d.album_num+']</a>'
59
+                }},
60
+            {field: 'type_num', title: '户型',width:70,event:'housesType',  align:'center',templet:"#housesType",templet:function(d){
61
+                    return '<a href="#">['+d.type_num+']</a>'
62
+                }},
63
+            {field: 'peitao_num', title: '周边配套',width:85, event:'houseFacilities', align:'center',templet:"#houseFacilities",templet:function(d){
64
+                    return '<a href="#">['+d.peitao_num+']</a>'
65
+                }},
66
+
67
+            {field: 'click_num', title: '点击',width:80, align:'center',sort: true},
68
+            {field: 'sort', title: '排序',width:80, edit: 'text',align:'center',sort: true,templet:"#sortBox"},
69
+            // {field: 'user_name', title: '添加人',width:75,  align:'center'},
70
+            {field: 'create_at', title: '添加时间',width:150, align:'center'},
71
+            {field: 'is_view', title: '审核',width:70, align:'center', templet:"#Toexamine",templet:function(d){
72
+                    switch (d.is_view){
73
+                        case '2':
74
+                            return  '<input type="checkbox"  value="'+d.id+'" name="'+d.is_view+'" house="'+d.name+'"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
75
+                            break;
76
+                        case '1':
77
+                            return  '<input type="checkbox" checked  value="'+d.id+'" name="'+d.is_view+'" house="'+d.name+'"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
78
+                            break;
79
+                    }
80
+                }},
81
+            {title: '操作', width:200, templet:'#housesListBar',fixed:"right",align:"center"}
82
+
83
+        ]]
84
+    });
85
+
86
+    tableIns.reload('tablerReload');        //重新加载
87
+
88
+
89
+    var $ = layui.$, active = {
90
+        addData: function(){ //获取选中数据
91
+            var index = layui.layer.open({
92
+                title : "添加楼盘",
93
+                type : 2,
94
+                area:['','100%'],
95
+                maxmin: true,
96
+                content : "/house/create.html",
97
+            })
98
+
99
+            layui.layer.full(index);
100
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
101
+            $(window).on("resize",function(){
102
+                layui.layer.full(index);
103
+            })
104
+        },saveData:function () {
105
+            var index = layui.layer.open({
106
+                title : "批量操作",
107
+                type : 2,
108
+                area:['50%','100%'],
109
+                maxmin: true,
110
+                content : "/housech/batchsave",
111
+            })
112
+        },
113
+        clearSort:function () {
114
+            var checkStatus = table.checkStatus('tablerReload');
115
+            var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
116
+            if(typeof  checkStatus.data[0] == 'object'){
117
+                layer.confirm('您确定要清零排序吗?',{btn:['确认','取消']},function(){
118
+                    var formdat = new FormData();
119
+                    $.each(checkStatus.data,function (key,val) {
120
+                        formdat.append('hid[]',val.id);
121
+                    })
122
+                    $.ajax({
123
+                        cache : true,
124
+                        type : "post",
125
+                        url : "/housech/clearsort",
126
+                        data : formdat,  // 你的formid
127
+                        // async : false,          //async 默认为true异步,修改为false为同步
128
+                        contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
129
+                        processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
130
+                        error : function(request) {
131
+                            layer.close(index);         //关闭数据提交信息
132
+                            layer.alert("网络超时");
133
+                        },
134
+                        success : function(data) {
135
+                            if (data.code == 200) {
136
+                                layer.msg(data.msg);
137
+                                reloadTable(reloadId);
138
+                            } else {
139
+                                layer.msg(data.msg);
140
+                            }
141
+                        }
142
+                    });
143
+
144
+                })
145
+                return false;
146
+            }
147
+            layer.msg('请选择需要清零的楼盘',{icon:5});
148
+            return false;
149
+        },
150
+        reload:function () {
151
+            var form = pfgs_serialize($('form'));
152
+            var name = '';
153
+            var id   = '';
154
+            // console.log($('form').serializeArray());
155
+            if(form.input_house == 'name'){
156
+                name = form.input_house_text;
157
+            } else if(form.input_house == 'id'){
158
+                id = form.input_house_text;
159
+            }
160
+
161
+            var city = '';
162
+            if(form.province != ''){
163
+                city = form.province;
164
+            }
165
+
166
+            if(form.city != ''){
167
+                city = form.city;
168
+            }
169
+            table.reload('tablerReload',{
170
+                where:{
171
+                    sort:form.input_sort,
172
+                    id:id,
173
+                    name:name,
174
+                    city:city,
175
+                    is_view:form.show,
176
+                    end_time:form.end_time,
177
+                    start_time:form.start_time,
178
+                    is_push:form.is_push
179
+                },
180
+                page:{
181
+                    curr:1
182
+                }
183
+            })
184
+        },
185
+        clearPush:function(){
186
+            var checkStatus = table.checkStatus('tablerReload');
187
+            var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
188
+            if(typeof  checkStatus.data[0] == 'object'){
189
+                layer.confirm('您确定要主推吗?',{btn:['确认','取消']},function(){
190
+                    var formdat = new FormData();
191
+                    $.each(checkStatus.data,function (key,val) {
192
+                        formdat.append('hid[]',val.id);
193
+
194
+                    })
195
+                    $.ajax({
196
+                        cache : true,
197
+                        type : "post",
198
+                        url : "/housech/clearpush",
199
+                        data : formdat,  // 你的formid
200
+                        // async : false,          //async 默认为true异步,修改为false为同步
201
+                        contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
202
+                        processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
203
+                        error : function(request) {
204
+                            layer.close(index);         //关闭数据提交信息
205
+                            layer.alert("网络超时");
206
+                        },
207
+                        success : function(data) {
208
+                            if (data.code == 200) {
209
+                                layer.msg(data.msg);
210
+                                reloadTable(reloadId);
211
+                            } else {
212
+                                layer.msg(data.msg);
213
+                            }
214
+                        }
215
+                    });
216
+
217
+                })
218
+                return false;
219
+            }
220
+            layer.msg('请选择需要操作的楼盘',{icon:5});
221
+            return false;
222
+        }
223
+
224
+    };
225
+
226
+    $('.demoTable .layui-btn').on('click', function(){
227
+        var type = $(this).data('type');
228
+        active[type] ? active[type].call(this) : '';
229
+    });
230
+
231
+    //日期
232
+    laydate.render({
233
+        elem: '#date1'
234
+    });
235
+    laydate.render({
236
+        elem: '#date2'
237
+    });
238
+    //
239
+    // laydate.render({
240
+    //     elem: '#date1_1'
241
+    // });
242
+    // laydate.render({
243
+    //     elem: '#date1_2'
244
+    // });
245
+
246
+    //选项卡切换
247
+    $('.layui-tab-title .site-demo-active').on('click', function(){
248
+        $(this).addClass('layui-this').siblings().removeClass('layui-this');
249
+        var lay_id = $(this).attr('lay-id');
250
+        $('.layui-tab-item').removeClass('layui-show')
251
+        $('.layui-tab-content #'+lay_id).addClass('layui-show')
252
+    });
253
+
254
+
255
+
256
+
257
+    //监听指定开关
258
+    form.on('switch(switchTest)', function(data){
259
+        var house = data.elem.attributes.house.value;
260
+        layer.open({
261
+            title :'修改<span style="color:red" >['+house+']</span>状态',
262
+            type : 2,
263
+            area:['50%','80%'],
264
+            maxmin: true,
265
+            content : "/housech/openstate?hid="+data.value+"&name="+house,
266
+            end:function () {
267
+                table.reload('tablerReload');
268
+            }
269
+        })
270
+    });
271
+
272
+    form.on('submit(del_alls_house)',function (data) {
273
+        var checkStatus = table.checkStatus('tablerReload');
274
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
275
+        if(typeof  checkStatus.data[0] == 'object'){
276
+            layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
277
+                var formdat = new FormData();
278
+                $.each(checkStatus.data,function (key,val) {
279
+                    formdat.append('hid[]',val.id);
280
+                })
281
+                $.ajax({
282
+                    cache : true,
283
+                    type : "post",
284
+                    url : "/housech/housedel",
285
+                    data : formdat,  // 你的formid
286
+                    // async : false,          //async 默认为true异步,修改为false为同步
287
+                    contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
288
+                    processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
289
+                    error : function(request) {
290
+                        layer.close(index);         //关闭数据提交信息
291
+                        layer.alert("网络超时");
292
+                    },
293
+                    success : function(data) {
294
+                        if (data.code == 200) {
295
+                            layer.msg(data.msg);
296
+                            reloadTable(reloadId);
297
+                        } else {
298
+                            layer.msg(data.msg);
299
+                        }
300
+                    }
301
+                });
302
+
303
+            })
304
+            return false;
305
+        }
306
+        layer.msg('请选择需要删除的楼盘',{icon:5});
307
+        return false;
308
+    })
309
+    /* 列表操作  edit  修改后执行  */
310
+    table.on('edit('+tableIds+')', function(obj){
311
+        var data = obj.data;
312
+        $.post('/housech/housesortedit',{id:data.id,sort:data.sort},function (data) {
313
+            if(data.code == 200)
314
+            {
315
+                layer.msg(data.msg);
316
+                // obj.update({
317
+                //     sort: data.sort
318
+                // });
319
+                // TableClose();
320
+            } else if(data.code == 300 ) {
321
+                layer.msg(data.msg);
322
+            }
323
+        })
324
+
325
+    })
326
+
327
+
328
+    /* 列表操作  tool  点击执行  */
329
+    table.on('tool('+tableIds+')', function(obj){
330
+        var data = obj.data;
331
+        // if(obj.event === 'sortData'){       //修改排序
332
+        //     layer.prompt({
333
+        //         formType: 2
334
+        //         ,title: '排序楼盘:'+data.name
335
+        //         ,value: data.sort
336
+        //     }, function(value, index){
337
+        //         $.post('/house/housesortedit',{id:data.id,sort:value},function (data) {
338
+        //             if(data.code == 200)
339
+        //             {
340
+        //                 layer.msg(data.msg);
341
+        //                 layer.close(index);
342
+        //                 obj.update({
343
+        //                     sort: value
344
+        //                 });
345
+        //                 // TableClose();
346
+        //             } else if(data.code == 300 ) {
347
+        //                 layer.msg(data.msg);
348
+        //             }
349
+        //         })
350
+
351
+
352
+        //     });
353
+        // }else 
354
+        if(obj.event === 'housesNews'){
355
+            var index =layui.layer.open({
356
+                title :'<span style="color:red" >['+data.name+']</span>楼盘资讯',
357
+                type : 2,
358
+                area:['','100%'],
359
+                maxmin: true,
360
+                content : "/housech/newslist?id="+data.id+"&name="+data.name,
361
+                end:function () {
362
+                    table.reload('tablerReload');
363
+                }
364
+            })
365
+            layui.layer.full(index);
366
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
367
+            $(window).on("resize",function(){
368
+                layui.layer.full(index);
369
+            })
370
+        } else if(obj.event  === 'edit'){
371
+            var index = layui.layer.open({
372
+                title : '<span style="color:red" >['+data.name+']</span>修改楼盘信息',
373
+                type : 2,
374
+                area:['','100%'],
375
+                maxmin: true,
376
+                content : "/housech/edit?id="+data.id,
377
+                end:function(){
378
+                    layui.table.reload('tablerReload');
379
+                }
380
+            })
381
+
382
+            layui.layer.full(index);
383
+            // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
384
+            $(window).on("resize",function(){
385
+                layui.layer.full(index);
386
+            })
387
+        } else if(obj.event === 'del'){
388
+
389
+            layer.confirm('您确认要删除吗?',{btn:['确认','取消']},function () {
390
+                $.post('/housech/housedel',{id:data.id},function (data) {
391
+                    if (data.code == 200) {
392
+                        layer.msg(data.msg);
393
+                        // parent.layui.
394
+                        table.reload('tablerReload');
395
+                        // TableClose();
396
+                    } else {
397
+                        layer.msg(data.msg);
398
+                    }
399
+                })
400
+            })
401
+        }else if(obj.event === 'housesPhoto'){
402
+            var index =layui.layer.open({
403
+                title :'<span style="color:red" >['+data.name+']</span>楼盘相册',
404
+                type : 2,
405
+                area:['','100%'],
406
+                maxmin: true,
407
+                content : "/housech/album?id="+data.id+"&name="+data.name,
408
+                end:function () {
409
+                    table.reload('tablerReload');
410
+                }
411
+            })
412
+            layui.layer.full(index);
413
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
414
+            $(window).on("resize",function(){
415
+                layui.layer.full(index);
416
+            })
417
+        } else if(obj.event === 'housesType'){
418
+            var index =layui.layer.open({
419
+                title :'<span style="color:red" >['+data.name+']</span>楼盘户型',
420
+                type : 2,
421
+                area:['','100%'],
422
+                maxmin: true,
423
+                content : "/housech/housetype?id="+data.id+"&name="+data.name,
424
+                end:function () {
425
+                    table.reload('tablerReload');
426
+                }
427
+            })
428
+            layui.layer.full(index);
429
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
430
+            $(window).on("resize",function(){
431
+                layui.layer.full(index);
432
+            })
433
+        }else if(obj.event === 'house_price'){
434
+            var index =layui.layer.open({
435
+                title :'<span style="color:red" >['+data.name+']</span>楼盘历史价格',
436
+                type : 2,
437
+                area:['','100%'],
438
+                maxmin: true,
439
+                content : "/housech/priceview?id="+data.id+"&name="+data.name+'&price='+data.sale_price,
440
+                end:function(){
441
+                    table.reload('tablerReload');
442
+                }
443
+            })
444
+            layui.layer.full(index);
445
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
446
+            $(window).on("resize",function(){
447
+                layui.layer.full(index);
448
+            })
449
+        }else if(obj.event === 'houseFacilities'){
450
+            var index =layui.layer.open({
451
+                title :'<span style="color:red" >['+data.name+']</span>楼盘周边配套',
452
+                type : 2,
453
+                area:['','100%'],
454
+                maxmin: true,
455
+                content : "/housech/peitao?id="+data.id+"&name="+data.name,
456
+                end:function () {
457
+                    table.reload('tablerReload');
458
+                }
459
+            })
460
+            layui.layer.full(index);
461
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
462
+            $(window).on("resize",function(){
463
+                layui.layer.full(index);
464
+            })
465
+        }else if(obj.event === 'house_presell'){
466
+            var index =layui.layer.open({
467
+                title :'<span style="color:red" >['+data.name+']</span>预售许可证',
468
+                type : 2,
469
+                area:['','100%'],
470
+                maxmin: true,
471
+                content : "/housech/presell?id="+data.id+"&name="+data.name,
472
+                end:function () {
473
+                    table.reload('tablerReload');
474
+                }
475
+            })
476
+            layui.layer.full(index);
477
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
478
+            $(window).on("resize",function(){
479
+                layui.layer.full(index);
480
+            })
481
+        }
482
+    });
483
+
484
+    //楼盘名称,区域, 注释装修情况
485
+    //添加图片上传
486
+    upload.render({
487
+        elem: '#test1'
488
+        ,url: '/housech/createimg'
489
+        ,data:{token:csrfToken}
490
+        ,field:'img'
491
+        ,size:1000              //限制上传图片的大小,单位为KB
492
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
493
+        ,auto:false
494
+        ,bindAction:'#addcity'
495
+        ,choose: function(obj){
496
+            obj.preview(function(index, file, result){
497
+                $('#demo1').attr('src', result); //图片链接(base64)
498
+            });
499
+        }
500
+    });
501
+
502
+    // 点击放大图片
503
+    $('#demo1').on('click', function(){
504
+        var _src = $(this).attr('src');
505
+        layui.layer.open({
506
+            type: 1,
507
+            title: false,           //是否显示标题
508
+            area: ['60%', '80%'],
509
+            shade: 0.6,           //透明度
510
+            closeBtn: 1,         //按钮 1有,0无
511
+            shadeClose: true,
512
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
513
+        });
514
+    });
515
+
516
+    //判断是否需要编辑,需要才加载
517
+    var verdict = $('#editor').html();
518
+    if(typeof verdict == "string"){
519
+        var ue = UE.getEditor('editor');  //编辑器
520
+    }
521
+
522
+
523
+    //重载表格
524
+    function reloadTable(obj){
525
+        table.reload(obj);
526
+    }
527
+
528
+    form.on('submit(tijiao)',function (data) {
529
+
530
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
531
+
532
+        var formData = new FormData($('#house_form')[0]);
533
+        /*
534
+        *    许可证号提交数据
535
+        */
536
+        // var trArry = $('.layui_w_licence table.layui-table tbody.mai tr.otr');
537
+
538
+        // $.each(trArry,function(i,v){
539
+        //     var _licenseKey =$(this).find('textarea[name="evaluating"]').val();
540
+        //     // if(_licenseKey !=""){           //判断许可证号是否为空
541
+        //         formData.append('evaluating[]',_licenseKey);
542
+        //     // }
543
+        //     console.log(_licenseKey)
544
+        // })
545
+        // console.log(formData)
546
+        $.ajax({
547
+            cache : true,
548
+            type : "post",
549
+            url : "/housech/createfrom",
550
+            data : formData,  // 你的formid
551
+            // async : false,          //async 默认为true异步,修改为false为同步
552
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
553
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
554
+            error : function(request) {
555
+                layer.close(index);         //关闭数据提交信息
556
+                layer.alert("网络超时");
557
+            },
558
+            success : function(data) {
559
+                if (data.code == 200) {
560
+                    layer.msg(data.msg);
561
+                    parent.layui.table.reload('tablerReload');
562
+                    TableClose();
563
+
564
+                } else if(data.code == 300){
565
+                    layer.msg(data.msg);
566
+                    layer.msg(ReturnInfo(data.data),{icon:5});
567
+                }
568
+            }
569
+        });
570
+        return false;
571
+    })
572
+
573
+
574
+    form.on('submit(edit)',function (data) {
575
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
576
+
577
+        var formData = new FormData($('#house_edit_form')[0]);
578
+
579
+        // var trArry = $('.layui_w_licence table.layui-table tbody tr');
580
+        // $.each(trArry,function(i,v){
581
+        //     var _licenseKey =$(this).find('input[name="licenseKey"]').val();
582
+        //     if(_licenseKey !=""){           //判断许可证号是否为空
583
+        //         formData.append('licenseKey[]',_licenseKey);
584
+        //         formData.append('issueDate[]',$(this).find('input[name="issueDate"]').val());
585
+        //         formData.append('buildingName[]',$(this).find('input[name="buildingName"]').val());
586
+        //     }
587
+        // })
588
+
589
+
590
+        $.ajax({
591
+            cache : true,
592
+            type : "post",
593
+            url : "/housech/editfrom",
594
+            data : formData,  // 你的formid
595
+            // async : false,          //async 默认为true异步,修改为false为同步
596
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
597
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
598
+            error : function(request) {
599
+                layer.close(index);         //关闭数据提交信息
600
+                layer.alert("请联系管理员");
601
+            },
602
+            success : function(data) {
603
+                if (data.code == 200) {
604
+                    layer.msg(data.msg);
605
+                } else if(data.code == 300){
606
+                    layer.msg(data.msg);
607
+                    layer.msg(ReturnInfo(data.data),{icon:5});
608
+
609
+                }
610
+            }
611
+        });
612
+        return false;
613
+    });
614
+
615
+    //楼盘上架下架操作
616
+    form.on('submit(openstate)',function (data) {
617
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
618
+
619
+        $.ajax({
620
+            cache : true,
621
+            type : "post",
622
+            url : "/housech/openstateform",
623
+            data : data.field,  // 你的formid
624
+            // async : false,          //async 默认为true异步,修改为false为同步
625
+            // contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
626
+            // processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
627
+            error : function(request) {
628
+                layer.close(index);         //关闭数据提交信息
629
+                layer.alert("请联系管理员");
630
+            },
631
+            success : function(data) {
632
+                if(data.data != null){
633
+                    layer.msg(ReturnInfo(data.data),{icon:5});
634
+                    return ;
635
+                }
636
+                layer.msg(data.msg);
637
+            }
638
+        });
639
+        return false;
640
+    });
641
+
642
+
643
+    //加载省数据
644
+    function loadProvince(data) {
645
+        $.ajax({
646
+            url : '/categorycity/citypid',
647
+            type : 'post',
648
+            async: false,//使用同步的方式,true为异步方式
649
+            data : {'pid':0},//这里使用json对象
650
+            success : function(data){
651
+                // console.log(data);
652
+                var areaData = data.data;
653
+                var proHtml = '';
654
+                for (var i = 0; i < areaData.length; i++) {
655
+                    proHtml += '<option value="' + areaData[i].id +'">' + areaData[i].city_name + '</option>';
656
+                }
657
+                //初始化省数据
658
+                $('select[name=province]').append(proHtml);
659
+                form.render();
660
+            },
661
+            fail:function(){
662
+
663
+            }
664
+        });
665
+    }
666
+    loadProvince();
667
+    form.on('select(province)',function (data) {
668
+        $.post('/categorycity/citypid',{'pid':data.value},function (data) {
669
+            var areaData = data.data;
670
+            var proHtml = '';
671
+            $('select[name=city]').html('');
672
+            proHtml = '<option value="">请选择市/区/县</option>';
673
+            for (var i = 0; i < areaData.length; i++) {
674
+
675
+                proHtml += '<option value="' + areaData[i].id +'">' + areaData[i].city_name + '</option>';
676
+            }
677
+            //初始化省数据
678
+            $('select[name=city]').append(proHtml);
679
+            form.render();
680
+        })
681
+    })
682
+
683
+
684
+
685
+
686
+
687
+
688
+    // 添加楼盘评测
689
+
690
+    var leng =50;
691
+    $('.layui_w_addbtn').on('click',function(){
692
+        datumInsert(leng)
693
+        $('body').append('<script id="ue'+leng+'">UE.getEditor("evaluating'+leng+'")</script>')  //编辑器
694
+        var ue =UE.getEditor("evaluating"+leng);
695
+        ue.ready(function() {
696
+            // ue.setContent('<p>编辑器1的内容</p>', true);
697
+        });
698
+        leng++;
699
+    })
700
+    //展示数据删除按钮
701
+    $('.layui_w_licence table.layui-table tbody.mai').on('click','.del',function(){
702
+        var _this = $(this)
703
+        var oid = _this.parents('.otr').attr('id');
704
+
705
+        var index =layer.confirm('确定要删除吗?',{btn: ['确定', '取消']},function () {
706
+            // layer.close(index)
707
+            _this.parents('#'+oid).remove();
708
+            $('body script#'+oid).remove();
709
+            layer.msg('已成功删除!');
710
+        })
711
+
712
+    })
713
+
714
+
715
+
716
+})
717
+
718
+$(function(){
719
+    $('.editmai tr.otr').each(function(){
720
+        var _ind = $(this).attr('data-id');
721
+        UE.getEditor("evaluating"+_ind);
722
+        // console.log(_ind)
723
+    })
724
+
725
+    //选项卡切换
726
+    $('.layui-tab-title .site-demo-active').on('click', function(){
727
+        $(this).addClass('layui-this').siblings().removeClass('layui-this');
728
+        var lay_id = $(this).attr('lay-id');
729
+        $('.layui-tab-item').removeClass('layui-show')
730
+        $('.layui-tab-content #'+lay_id).addClass('layui-show')
731
+    });
732
+    // 转换拼音
733
+    $('.layui_w_name').on('keyup ',function(){
734
+        var _txt = $(this).val();
735
+        var _convert = pinyinUtil.getPinyin(_txt,' ',false).replace(/\s/g, "");
736
+        $('.layui_w_spell').val(_convert)
737
+    })
738
+
739
+    // 动态添加批量删除按钮
740
+    var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
741
+        + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_house">批量删除</a>'
742
+        + '</div>'
743
+    $('.layui-form').append(_btn)
744
+
745
+
746
+    // 修改楼盘编辑高度问题
747
+    var i=0;
748
+    $('li[lay-id="assign_4"]').on('click',function(){
749
+        var _text = UE.getEditor('editor').getContent()
750
+        if(_text != ''){
751
+            if(i <1){
752
+                var editorHeight = UE.getEditor('editor').iframe.clientHeight;
753
+                if(editorHeight > 400){
754
+                    var _setHeight = parseInt(UE.getEditor('editor').iframe.clientHeight/7.5);
755
+                    $('#assign_4').find('#edui1_iframeholder').css('height',_setHeight);
756
+                }
757
+                i++;
758
+            }
759
+        }
760
+    })
761
+
762
+    // 特色主题   限制checkbox 选中的数量(修改与添加共用)
763
+    // $('.layui_w_acti ').on('click','.layui-form-checkbox[lay-skin=primary]',function(){
764
+    //     var inputArry = $('.layui_w_acti').find('input[name="characteristic[]"]');
765
+    //     check(inputArry,3);    //调用方法,方法定义在csrftoken.js中
766
+    // })
767
+
768
+})
769
+
770
+//楼盘评测 添加
771
+function datumInsert(leng){
772
+    // var leng = $(".layui_w_licence table.layui-table tbody tr").length;
773
+    // console.log(leng)
774
+    var tr ='<tr class="otr" id="ue'+leng+'">'
775
+        +'<td lay-event="del">'
776
+        +'<div class="layui-table-cell del" lay-oid=""><i class="layui-icon" style="font-size: 30px; color: #1E9FFF;cursor: pointer">&#xe640;</i></div>'
777
+        +'</td>'
778
+        +'<td data-field="matingName" align="center" data-content="">'
779
+        +'<div class="editor_box layui-form-item" style="width:99%;height:400">'
780
+        +'<textarea name="evaluating[]" id="evaluating'+leng+'" cols="20" rows="10" style="width:100%;float:left;"></textarea>'
781
+        +'</div>'
782
+        +'</td>'
783
+        +'</tr>';
784
+    $(".layui_w_licence table.layui-table tbody.mai").append(tr);
785
+}
786
+
787
+
788
+
789
+                       

+ 146 - 0
backend/web/js/housech/houses_select_city.js

@@ -0,0 +1,146 @@
1
+//查询赋值
2
+function query(form){
3
+    var _vals = $('input[name=select_province]').val();
4
+    var _vals1 = $('input[name=select_city]').val();
5
+    var _vals2 = $('input[name=select_area]').val();
6
+    provinceChange(form,_vals,_vals1,_vals2);
7
+}
8
+
9
+function loadProvince(pid = 0) {
10
+    $.ajax({
11
+        url : '/categorycity/citypid',
12
+        type : 'post',
13
+        async: false,//使用同步的方式,true为异步方式
14
+        data : {'pid':pid},//这里使用json对象
15
+        success : function(data){
16
+            // console.log(data);
17
+            var areaData = data.data;
18
+            provinceChange(form,areaData,data_.city,data_.county);
19
+        },
20
+        fail:function(){
21
+
22
+        }
23
+    });
24
+}
25
+
26
+
27
+/**
28
+ * 初始化省
29
+ */
30
+function provinceChange(form,provinceValue,cityValue,countyValue){
31
+    $.ajax({
32
+        url : '/categorycity/citypid',
33
+        type : 'post',
34
+        async: false,//使用同步的方式,true为异步方式
35
+        data : {'pid':0},//这里使用json对象
36
+        success : function(data){
37
+            // console.log(data);
38
+            var provinces = data.data;
39
+            var province = $('select[name=province]');
40
+            province.empty();
41
+            province.append('<option value="'+""+'">'+"请选择省"+'</option>');
42
+            for (var i = 0; i < provinces.length; i++) {
43
+                if(provinces[i].id == provinceValue){
44
+                    province.append('<option selected value="'+provinces[i].id+'">'+provinces[i].city_name+'</option>');
45
+                }else{
46
+                    province.append('<option value="'+provinces[i].id+'">'+provinces[i].city_name+'</option>');
47
+                }
48
+            }
49
+            form.render('select');
50
+            cityChange(form,provinceValue,cityValue,countyValue);
51
+        },
52
+        fail:function(){
53
+
54
+        }
55
+    });
56
+}
57
+
58
+/**
59
+ * 初始化市
60
+ */
61
+function cityChange(form,provinceValue,cityValue,countyValue){
62
+    //改变市
63
+    var province = $('select[name=city]');
64
+    province.empty();
65
+    province.append('<option value="'+""+'">'+"请选择市"+'</option>');
66
+    if(provinceValue){
67
+        $.ajax({
68
+            url : '/categorycity/citypid',
69
+            type : 'post',
70
+            async: false,//使用同步的方式,true为异步方式
71
+            data : {'pid':provinceValue},//这里使用json对象
72
+            success : function(data){
73
+                // console.log(data);
74
+                var provinces = data.data;
75
+
76
+
77
+                for (var i = 0; i < provinces.length; i++) {
78
+                    if(provinces[i].id == cityValue){
79
+                        province.append('<option selected value="'+provinces[i].id+'">'+provinces[i].city_name+'</option>');
80
+                    }else{
81
+                        province.append('<option value="'+provinces[i].id+'">'+provinces[i].city_name+'</option>');
82
+                    }
83
+                }
84
+                form.render('select');
85
+                countyChange(form,cityValue,countyValue);
86
+            },
87
+            fail:function(){
88
+
89
+            }
90
+        });
91
+    }
92
+
93
+}
94
+
95
+/**
96
+ * 初始化县/区
97
+ */
98
+function countyChange(form,cityValue,countyValue){
99
+    //改变县/区
100
+    var province = $('select[name=area]');
101
+    province.empty();
102
+    province.append('<option value="'+""+'">'+"请选择县/区"+'</option>');
103
+    if(cityValue){
104
+        $.ajax({
105
+            url : '/categorycity/citypid',
106
+            type : 'post',
107
+            async: false,//使用同步的方式,true为异步方式
108
+            data : {'pid':cityValue},//这里使用json对象
109
+            success : function(data){
110
+                // console.log(data);
111
+                var provinces = data.data;
112
+                for (var i = 0; i < provinces.length; i++) {
113
+                    if(provinces[i].id == countyValue){
114
+                        province.append('<option selected value="'+provinces[i].id+'">'+provinces[i].city_name+'</option>');
115
+                    }else{
116
+                        province.append('<option value="'+provinces[i].id+'">'+provinces[i].city_name+'</option>');
117
+                    }
118
+                }
119
+                form.render('select');
120
+            },
121
+            fail:function(){
122
+
123
+            }
124
+        });
125
+    }
126
+
127
+}
128
+
129
+layui.use(['form'], function(){
130
+    var $ = layui.$
131
+        ,layer = layui.layer
132
+        ,form = layui.form;
133
+
134
+    //查询赋值
135
+    query(form);
136
+
137
+    /*监听省select*/
138
+    form.on('select(provinceone)', function(data){
139
+        cityChange(form,data.value,"","")
140
+    });
141
+
142
+    /*监听市select*/
143
+    form.on('select(cityone)', function(data){
144
+        countyChange(form,data.value,"")
145
+    });
146
+});

+ 156 - 0
backend/web/js/housech/housetype.js

@@ -0,0 +1,156 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+    //第一个实例
9
+    table.render({
10
+        elem: '#housetypelist'
11
+        ,url: '/dictionary/housetypeform' //数据接口
12
+        ,where:{token:csrfToken}
13
+        ,method:'post'
14
+        ,page: true //开启分页
15
+        ,height:600
16
+        ,text:'数据加载中'
17
+        ,id:'tablerReload'
18
+        ,cols: [[ //表头
19
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
20
+            {type:'numbers'},
21
+            {field: 'huxing_name', title: '户型', align:'center'}
22
+            ,{field: 'sort', title: '排序',width:200, event:'sortData',edit: 'text',align:'center',sort: true,templet:"#sortBox"}
23
+            // ,{field: 'state', title: '地址', width:200,align:'center'}
24
+            // ,{field: 'update_at', title: '更新时间', width:200,align:'center'}
25
+            // ,{field: 'create_at', title: '添加时间', width:200,align:'center'}
26
+            ,{field: 'state', title: '审核',align:'center',width:200, templet:function (d) {
27
+                if(d.state == 2){
28
+                    return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
29
+                } else {
30
+                    return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
31
+                }
32
+            }}
33
+            ,{fixed: 'right',title:'操作', width: 180, align:'center', toolbar: '#operate'}
34
+
35
+        ]]
36
+    });
37
+
38
+    table.reload('tablerReload');        //重新加载
39
+
40
+    //监听指定开关
41
+    form.on('switch(switchTest)', function(data){
42
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
43
+            $.post('/dictionary/housetypestate',{id:data.value,type:'state'},function (data) {
44
+                layer.msg(data.msg);
45
+                table.reload('tablerReload');
46
+
47
+            })
48
+        },function (aa) {
49
+            table.reload('tablerReload');        //重新加载
50
+        })
51
+    });
52
+
53
+    //列表操作
54
+    table.on('tool(housetypelist)', function(obj){
55
+        var layEvent = obj.event,
56
+            data = obj.data;
57
+        if(layEvent === 'edit'){
58
+            layer.open({
59
+                type: 2,
60
+                title: '修改户型',
61
+                area: ['600px', '500px'],
62
+                content:'/dictionary/housetypeedit?id='+data.id,
63
+                end:function(){
64
+                    table.reload('tablerReload');        //重新加载
65
+                }
66
+            });
67
+        } else if(layEvent === 'del') {
68
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
69
+                $.post('/dictionary/hosttypedel',{'id':data.id},function (data) {
70
+                    if(data.code == 200)
71
+                    {
72
+                        layer.msg(data.msg);
73
+                        table.reload('tablerReload');        //重新加载
74
+                    } else if(data.code == 300 ) {
75
+                        layer.msg(data.msg);
76
+                    }
77
+                })
78
+            })
79
+        }else if(layEvent === 'sortData'){       //修改排序
80
+            table.on('edit(housetypelist)', function(obj){
81
+                var data = obj.data;
82
+                $.post('/dictionary/housetypesort',{id:data.id,type:'sort',sort:data.sort},function (data) {
83
+                    if(data.code == 200)
84
+                    {
85
+                        layer.msg(data.msg);
86
+                    } else if(data.code == 300 ) {
87
+                        layer.msg(data.msg);
88
+                    }
89
+                })
90
+            })
91
+        }
92
+
93
+
94
+    });
95
+
96
+    var $ = layui.$, active = {
97
+        addData: function(){ //获取选中数据
98
+
99
+            layer.open({
100
+                type: 2,
101
+                title: '添加户型',
102
+                area: ['600px', '500px'],
103
+                content: '/dictionary/housetypeadd',
104
+                end:function(){
105
+                    table.reload('tablerReload');        //重新加载
106
+                }
107
+            });
108
+
109
+            // var checkStatus = table.checkStatus('idTest')
110
+            //     ,data = checkStatus.data;
111
+            // layer.alert(JSON.stringify(data));
112
+        }
113
+    };
114
+
115
+    $('.demoTable .layui-btn').on('click', function(){
116
+        var type = $(this).data('type');
117
+        active[type] ? active[type].call(this) : '';
118
+    });
119
+
120
+    //修改
121
+    form.on('submit(edithousetype)', function(data){
122
+        var index = top.layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
123
+
124
+        $.post('/dictionary/housetypeeditform',{'data':data.field,'token':csrfToken},function (data) {
125
+            top.layer.close(index);         //关闭数据提交信息
126
+            if(data.code == 200)
127
+            {
128
+                layer.msg(data.msg);
129
+                // parent.layui.table.reload('housetypelist');
130
+                // TableClose();
131
+            } else if(data.code == 300 ) {
132
+                layer.msg(data.msg);
133
+                layer.msg(ReturnInfo(data.data));
134
+            }
135
+        })
136
+        return false;
137
+    });
138
+
139
+    //添加
140
+    form.on('submit(addhousetype)', function(data){
141
+        var index = top.layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
142
+
143
+        $.post('/dictionary/housetypeaddform',{'data':data.field},function (data) {
144
+            top.layer.close(index);         //关闭数据提交信息
145
+            if(data.code == 200)
146
+            {
147
+                layer.msg(data.msg);
148
+            } else if(data.code == 300 ) {
149
+                layer.msg(data.msg);
150
+                layer.msg(ReturnInfo(data.data),{icon:5});
151
+            }
152
+        })
153
+        return false;
154
+    });
155
+
156
+});

+ 293 - 0
backend/web/js/housech/housetypebinding.js

@@ -0,0 +1,293 @@
1
+
2
+var delFiles = []; //用于删除图片
3
+var filesContainer= {};  //存储最终要上传的图片
4
+var files ;     //存储选择图片的数量
5
+layui.use(['form','layer','upload','table'],function(){
6
+    var form = layui.form,
7
+        layer = layui.layer,
8
+        upload = layui.upload,
9
+        table = layui.table,
10
+        $ = layui.jquery;
11
+
12
+    var inputId = $('input[name="hid"]').val();
13
+    var inputName = $('input[name="name"]').val();
14
+    //楼盘列表
15
+    var indexTtable =  table.render({
16
+        elem: '#housetypelist',
17
+        url : '/housech/housetypeform',
18
+        where:{hid:inputId},
19
+        method:'post',
20
+        id:'tablerReload',
21
+        cols : [[
22
+            {type:'numbers'},
23
+            {field: 'huxing_name', title: '户型',align:"center",sort: true},
24
+            // {field: 'state', title: '审核',width:80, align:'center',templet:'#examineTpl'},
25
+            {field: 'num', title: '数量', align:'center',width:100},
26
+            {title: '操作', templet:'#housesalbumListBar',fixed:"right",align:"center",width:200}
27
+
28
+        ]]
29
+    });
30
+
31
+    indexTtable.reload('tablerReload');        //重新加载
32
+
33
+    table.on('tool(housetypelist)',function (obj) {
34
+        var data = obj.data;
35
+        if(obj.event === 'edit'){
36
+            var index = parent.layui.layer.open({
37
+                title :  '<span style="color:red" >['+inputName+']</span> 楼盘修改户型',
38
+                type : 2,
39
+                maxmin: true,
40
+                area: ['', '100%'],
41
+                content : "/housech/housetypeedit?id="+inputId+'&name='+inputName+'&type='+data.type_id,
42
+                end:function(){
43
+                    layui.table.reload('tablerReload');
44
+                }
45
+            })
46
+            parent.layui.layer.full(index);
47
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
48
+            $(window).on("resize",function(){
49
+                parent.layui.layer.full(index);
50
+            })
51
+        }else if(obj.event === 'examine'){ //关闭
52
+            var  examineName = '';
53
+            // console.log(data.state);
54
+            switch (data.state){
55
+                case 'Y':
56
+                    examineName = '驳回审核';
57
+                    break;
58
+
59
+                case 'N':
60
+                    examineName =  '审核通过';
61
+                    break;
62
+            }
63
+            layer.confirm('确定要'+examineName+'吗?',{btn: ['确定', '取消']},function () {
64
+                $.post('/housech/typetatesave',{id:data.id,state:data.state,type_id:data.type_id,hid:inputId},function (data) {
65
+                    if(data.code == 200)
66
+                    {
67
+                        layer.msg(data.msg);
68
+                        table.reload('tablerReload');
69
+                    } else if(data.code == 300 ) {
70
+                        layer.msg(data.msg);
71
+                    }
72
+                })
73
+            })
74
+        } else if(obj.event === 'del'){
75
+            layer.confirm('确定要删除吗?',{btn: ['确定', '取消']},function () {
76
+                $.post('/housech/typedel',{id:data.id,type_id:data.type_id,hid:inputId},function (data) {
77
+                    if(data.code == 200)
78
+                    {
79
+                        layer.msg(data.msg);
80
+                        table.reload('tablerReload');
81
+                    } else if(data.code == 300 ) {
82
+                        layer.msg(data.msg);
83
+                    }
84
+                })
85
+            })
86
+        }
87
+    })
88
+
89
+    /*
90
+    * 添加相册
91
+    * */
92
+    function addAlbum(edit){
93
+        var index = parent.layui.layer.open({
94
+            title : '<span style="color:red" >['+inputName+']</span> 楼盘添加户型',
95
+            type : 2,
96
+            maxmin: true,
97
+            area: ['', '100%'],
98
+            content : "/housech/housetypeadd?id="+inputId+'&name='+inputName,
99
+            end:function () {
100
+                layui.table.reload('tablerReload');
101
+            }
102
+        })
103
+        parent.layui.layer.full(index);
104
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
105
+        $(window).on("resize",function(){
106
+            parent.layui.layer.full(index);
107
+        })
108
+    }
109
+    //添加相册
110
+    $("#add-album").click(function(){
111
+        addAlbum()
112
+    });
113
+
114
+    //多图片上传
115
+    upload.render({
116
+        elem: '#upload_edit'
117
+        ,url: '/upload/'
118
+        ,multiple: true
119
+        ,auto: false
120
+        ,number: 30
121
+        ,choose:function(obj){
122
+            //将每次选择的文件追加到文件队列
123
+            files = obj.pushFile();
124
+            //预读本地文件示例,不支持ie8
125
+            obj.preview(function(index, file, result){
126
+                filesContainer[index] = file; //将每次选择的文件追加到文件队列
127
+                var _html ='<div class="layui-upload-img layer-photos-demo" id="layer-photos-demo">'
128
+                    +'<div class="info_box">'
129
+                    +'<input type="text" name="aa"  placeholder="如A户型" autocomplete="off" class="layui-input">'
130
+                    +'<input type="text" name="bb"  placeholder="厅卫厨" autocomplete="off" class="layui-input">'
131
+                    +'<input type="text" name="cc"  placeholder="建筑面积" autocomplete="off" class="layui-input">'
132
+                    +'</div>'
133
+                    +'<div class="picture_box">'
134
+                    +'<div class="delete-list" id="delimg" ><i class="layui-icon fa-trash-o" >&#xe640;</i></div>'
135
+                    +'<img delIdentification="'+index+'" layer-pid="'+index+'" layer-src="'+ result +'"  src="'+ result +'" alt="'+ file.name +'" id="hhhh">'
136
+                    +'</div>'
137
+                    +'</div>';
138
+                $('#demo2').append(_html);
139
+                layer.photos({
140
+                    photos: '#demo2'
141
+                    ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
142
+                });
143
+            });
144
+        }
145
+    });
146
+
147
+
148
+    form.on('submit(tijiao)',function (data) {
149
+
150
+        var formData = new FormData($('#album_form')[0]);
151
+        formData.delete('file'); //删除添加图片组件自带的FILE文件
152
+        var index = layer.msg('数据提交中,请稍候。。。',{icon: 16,time:false,shade:0.8});      //数据提交提示
153
+        var a = $('#demo2');
154
+        $.each(a.find('input[name=aa]'),function () {
155
+            formData.append('title[]',$(this).val());
156
+            // console.log($(this).val());
157
+        })
158
+
159
+        $.each(a.find('input[name=bb]'),function () {
160
+            formData.append('indoor_info[]',$(this).val());
161
+            // console.log($(this).val());
162
+        })
163
+
164
+        $.each(a.find('input[name=cc]'),function () {
165
+            formData.append('area[]',$(this).val());
166
+        })
167
+
168
+        $.each(filesContainer,function (k,v) {
169
+            if(v != null){
170
+                formData.append('img[]',v);
171
+            }
172
+        })
173
+
174
+        $.ajax({
175
+            cache : true,
176
+            type : "post",
177
+            url : "/housech/housetypeaddform",
178
+            data : formData,  // 你的formid
179
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
180
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
181
+            error : function(request) {
182
+                layer.close(index);         //关闭数据提交信息
183
+                layer.alert("网络超时");
184
+            },
185
+            success : function(data) {
186
+                layer.close(index);         //关闭数据提交信息
187
+                if (data.code == 200) {
188
+
189
+                    layer.msg(data.msg);
190
+                    indexTtable.reload('tablerReload');
191
+                    // table.reload('tablerReload');
192
+                    TableClose();
193
+                    // layui.table.reload('housealbumlistReload');
194
+
195
+                } else if(data.code == 300){
196
+                    layer.msg(data.msg);
197
+                    layer.msg(ReturnInfo(data.data),{icon:5});
198
+                }
199
+            }
200
+        });
201
+        return false;
202
+    })
203
+
204
+
205
+    form.on('submit(editAlbum)',function (data) {
206
+        var index = layer.msg('数据提交中,请稍候。。。',{icon: 16,time:false,shade:0.8});      //数据提交提示
207
+        var formData = new FormData($('#album_form')[0]);
208
+        formData.delete('file'); //删除添加图片组件自带的FILE文件
209
+        var a = $('#demo2');
210
+        $.each(a.find('input[name=aa]'),function () {
211
+            formData.append('title[]',$(this).val());
212
+        })
213
+
214
+        $.each(a.find('input[name=bb]'),function () {
215
+            formData.append('indoor_info[]',$(this).val());
216
+        })
217
+
218
+        $.each(a.find('input[name=cc]'),function () {
219
+            formData.append('area[]',$(this).val());
220
+        })
221
+
222
+        $.each(a.find('img'),function () {
223
+            formData.append('editid[]',$(this).attr('imgname'));
224
+        })
225
+
226
+        //需要添加的图片
227
+        $.each(filesContainer,function (k,v) {
228
+            if(v != null){
229
+                formData.append('img[]',v);
230
+            }
231
+        })
232
+
233
+        //需要删除的图片
234
+        if(delFiles.length > 0){
235
+            $.each(delFiles,function (k,v) {
236
+                formData.append('delimg[]',v);
237
+            })
238
+        }
239
+
240
+        $.ajax({
241
+            cache : true,
242
+            type : "post",
243
+            url : "/housech/housetypeeditform",
244
+            data : formData,  // 你的formid
245
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
246
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
247
+            error : function(request) {
248
+                //layer.close(index);         //关闭数据提交信息
249
+                layer.alert("网络超时");
250
+            },
251
+            success : function(data) {
252
+                filesContainer = {};
253
+                layer.close(index);         //关闭数据提交信息
254
+                if (data.code == 200) {
255
+                    layer.msg(data.msg);
256
+
257
+                } else if(data.code == 300){
258
+                    layer.msg(data.msg);
259
+                    layer.msg(ReturnInfo(data.data),{icon:5});
260
+                }
261
+            }
262
+        });
263
+        return false;
264
+    })
265
+
266
+    layer.photos({
267
+        photos: '#demo2'
268
+        ,anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
269
+    });
270
+    //设置图片的高度
271
+    $(window).resize(function(){
272
+        $("#Images li img").height($("#Images li img").width());
273
+    });
274
+
275
+});
276
+
277
+
278
+//删除图片
279
+$('#demo2').on("click","#delimg",function () {
280
+    var name = $(this).next().attr("imgname");
281
+    var delIdentification = $(this).next().attr("delIdentification");
282
+    if(typeof(delIdentification) != 'undefined'){
283
+        delete filesContainer[delIdentification];
284
+        delete files[delIdentification] ;
285
+        // imgnumber -= 1;
286
+    }
287
+    if(typeof(name) != 'undefined'){
288
+        delFiles.push(name);
289
+    }
290
+    // $(this).parent().remove();
291
+    $(this).parents('#layer-photos-demo').remove();
292
+})
293
+

+ 291 - 0
backend/web/js/housech/photoalbum.js

@@ -0,0 +1,291 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form
8
+        ,upload = layui.upload;
9
+
10
+    var tableIds = 'photoalbumlist';
11
+    //第一个实例
12
+    table.render({
13
+        elem: '#'+tableIds
14
+        ,url: '/dictionary/photoalbumform' //数据接口
15
+        ,where:{token:csrfToken}
16
+        ,method:'post'
17
+        ,page: true //开启分页
18
+        ,height:600
19
+        ,text:'数据加载中'
20
+        ,id:'tablerReload'
21
+        ,cols: [[ //表头
22
+            // {type: "checkbox", width:50}
23
+            {type:'numbers'}
24
+            ,{field: 'name', title: '相册分类名称', align:'center'}
25
+            ,{field: 'sort', title: '排序',width:80, edit: 'text',align:'center',sort: true,templet:"#sortBox"}
26
+            ,{field: 'check_img', title: '选中', width:150,align:'center',templet:function(d){
27
+                return '<img class="layui_magnify" src="'+d.check_img+'">';
28
+            }}
29
+            ,{field: 'uncheck_img', title: '未选中', width:150,align:'center',templet:function(d){
30
+                return '<img class="layui_magnify" src="'+d.uncheck_img+'">';
31
+            }}
32
+            ,{field: 'is_show', title: '是否下架',width:100, align:'center', templet:"#Toexamine",templet:function(d){
33
+                if(d.is_show == 2){
34
+                    return  '<input type="checkbox"  value="'+d.id+'" name="'+d.is_show+'"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
35
+                } else {
36
+                    return  '<input type="checkbox" checked  value="'+d.id+'" name="'+d.is_show+'"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
37
+                }
38
+            }}
39
+            ,{field: 'create_at', title: '添加时间', width:200,align:'center'}
40
+            ,{field: 'update_at', title: '更新时间', width:200,align:'center'}
41
+            ,{fixed: 'right',title:'操作', width: 180, align:'center', toolbar: '#operate'}
42
+
43
+        ]]
44
+    });
45
+
46
+    table.reload('tablerReload');        //重新加载
47
+
48
+    //列表操作
49
+    table.on('tool('+tableIds+')', function(obj){
50
+        var layEvent = obj.event,
51
+            data = obj.data;
52
+        if(layEvent === 'edit'){
53
+            layer.open({
54
+                type: 2,
55
+                title: '修改户型',
56
+                closeBtn: 1, //不显示关闭按钮
57
+                shade: [0],
58
+                area: ['600px', '500px'],
59
+                anim: 2,
60
+                content: ['/dictionary/photoalbumedit?id='+data.id, 'yes'], //iframe的url,no代表不显示滚动条
61
+            });
62
+        } else if(layEvent === 'del') {
63
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
64
+                $.post('/dictionary/photoalbumdel',{'id':data.id,type:'del'},function (data) {
65
+                    if(data.code == 200)
66
+                    {
67
+                        layer.msg(data.msg);
68
+                        table.reload('tablerReload');
69
+                    } else if(data.code == 300 ) {
70
+                        layer.msg(data.msg);
71
+                    }
72
+                })
73
+            })
74
+        }
75
+
76
+
77
+    });
78
+
79
+    /* 列表操作  edit  修改后执行  */
80
+    table.on('edit('+tableIds+')', function(obj){
81
+        var data = obj.data;
82
+        if(obj.field=="sort"){
83
+            $.post('/dictionary/photoalbumdel',{id:data.id,sort:data.sort,type:'sort'},function (data) {
84
+                if(data.code == 200)
85
+                {
86
+                    layer.msg(data.msg);
87
+                } else if(data.code == 300 ) {
88
+                    layer.msg(data.msg);
89
+                }
90
+            })
91
+        }
92
+    })
93
+
94
+    //显示或隐藏
95
+    form.on('switch(switchTest)', function(data){
96
+        var state = '';
97
+        if(data.elem.name == 1){
98
+            state = 2;
99
+        }else if(data.elem.name == 2){
100
+            state = 1;
101
+        }
102
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
103
+            $.post('/dictionary/photoalbumdel',{id:data.value,type:'is_show',is_show:state},function (data) {
104
+                if(data.data != null){
105
+                    layer.msg(data.msg);
106
+                    return false;
107
+                }
108
+                layer.msg(data.msg);
109
+                table.reload('tablerReload');
110
+            })
111
+        },function (aa) {
112
+            table.reload('tablerReload');
113
+        })
114
+    });
115
+
116
+
117
+    var $ = layui.$, active = {
118
+        addData: function(){ //获取选中数据
119
+            layer.open({
120
+                type: 2,
121
+                title: '添加相册分类',
122
+                closeBtn: 1, //不显示关闭按钮
123
+                shade: [0],
124
+                area: ['600px', '500px'],
125
+                anim: 2,
126
+                content: ['/dictionary/photoalbumadd', 'yes'], //iframe的url,no代表不显示滚动条
127
+            });
128
+
129
+            // var checkStatus = table.checkStatus('idTest')
130
+            //     ,data = checkStatus.data;
131
+            // layer.alert(JSON.stringify(data));
132
+        }
133
+    };
134
+
135
+    $('.demoTable .layui-btn').on('click', function(){
136
+        var type = $(this).data('type');
137
+        active[type] ? active[type].call(this) : '';
138
+    });
139
+
140
+    // //修改
141
+    // form.on('submit(editphotoalbum)', function(data){
142
+    //     $.post('/dictionary/photoalbumeditform',{'data':data.field,'token':csrfToken},function (data) {
143
+    //         if(data.code == 200)
144
+    //         {
145
+    //             layer.msg(data.msg);
146
+    //             parent.layui.table.reload('tablerReload');
147
+    //             TableClose();
148
+    //             // parent.layui.table.reload(tableIds);
149
+    //         } else if(data.code == 300 ) {
150
+    //             layer.msg(data.msg);
151
+    //         }
152
+    //     })
153
+    //     return false;
154
+    // });
155
+
156
+    // //添加
157
+    // form.on('submit(addphotoalbum)', function(data){
158
+    //     $.post('/dictionary/photoalbumaddform',{'data':data.field,'token':csrfToken},function (data) {
159
+    //         if(data.code == 200)
160
+    //         {
161
+    //             layer.msg(data.msg);
162
+    //             // parent.layui.table.reload(tableIds);
163
+    //             parent.layui.table.reload('tablerReload');
164
+    //             TableClose();
165
+    //         } else if(data.code == 300 ) {
166
+    //             layer.msg(data.msg);
167
+    //         }
168
+    //     })
169
+    //     return false;
170
+    // });
171
+
172
+
173
+
174
+
175
+    //添加图片上传
176
+    upload.render({
177
+        elem: '#test1'
178
+        ,url: '/house/createimg'
179
+        ,data:{token:csrfToken}
180
+        ,field:'check_img'
181
+        ,size:1000              //限制上传图片的大小,单位为KB
182
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
183
+        ,auto:false
184
+        ,bindAction:'#addcity'
185
+        ,choose: function(obj){
186
+            obj.preview(function(index, file, result){
187
+                $('#demo1').attr('src', result); //图片链接(base64)
188
+            });
189
+        }
190
+    });
191
+
192
+    //添加图片上传
193
+    upload.render({
194
+        elem: '#test2'
195
+        ,url: '/house/createimg'
196
+        ,data:{token:csrfToken}
197
+        ,field:'uncheck_img'
198
+        ,size:1000              //限制上传图片的大小,单位为KB
199
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
200
+        ,auto:false
201
+        ,bindAction:'#addcity'
202
+        ,choose: function(obj){
203
+            obj.preview(function(index, file, result){
204
+                $('#demo2').attr('src', result); //图片链接(base64)
205
+            });
206
+        }
207
+    });
208
+
209
+
210
+
211
+    // 点击放大图片
212
+    $('.layui_magnify').on('click', function(){
213
+        var _src = $(this).attr('src');
214
+        layui.layer.open({
215
+            type: 1,
216
+            title: false,           //是否显示标题
217
+            area: ['60%', '80%'],
218
+            shade: 0.6,           //透明度
219
+            closeBtn: 1,         //按钮 1有,0无
220
+            shadeClose: true,
221
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
222
+        });
223
+    });
224
+
225
+
226
+
227
+
228
+    //添加
229
+    form.on('submit(addphotoalbum)', function(data){
230
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
231
+        var formData = new FormData($('#add_photo')[0]);
232
+        //layer.msg(data.msg);
233
+        $.ajax({
234
+            cache : true,
235
+            type : "post",
236
+            url : '/dictionary/photoalbumaddform',
237
+            data : formData,  // 你的formid
238
+            // async : false,          //async 默认为true异步,修改为false为同步
239
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
240
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
241
+            // error : function(request) {
242
+            //     layer.close(index);         //关闭数据提交信息
243
+            //     layer.alert("网络超时");
244
+            // },
245
+            success : function(data) {
246
+                if (data.code == 200) {
247
+                    layer.msg(data.msg);
248
+                    parent.layui.table.reload('tablerReload');
249
+                    TableClose();
250
+                } else if(data.code == 300){
251
+                    layer.msg(data.msg);
252
+                    layer.msg(ReturnInfo(data.data),{icon:5});
253
+                }
254
+            }
255
+        });
256
+        return false;
257
+    });
258
+
259
+
260
+
261
+    //修改
262
+    form.on('submit(editphotoalbum)', function(data){
263
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
264
+
265
+        var formData = new FormData($('#photo_form')[0]);
266
+        $.ajax({
267
+            cache : true,
268
+            type : "post",
269
+            url : '/dictionary/photoalbumeditform',
270
+            data : formData,  // 你的formid
271
+            // async : false,          //async 默认为true异步,修改为false为同步
272
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
273
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
274
+            error : function(request) {
275
+                layer.close(index);         //关闭数据提交信息
276
+                layer.alert("网络超时");
277
+            },
278
+            success : function(data) {
279
+                if (data.code == 200) {
280
+                    layer.msg(data.msg);
281
+                    parent.layui.table.reload('tablerReload');
282
+                    TableClose();
283
+                } else if(data.code == 300){
284
+                    layer.msg(data.msg);
285
+                    layer.msg(ReturnInfo(data.data));
286
+                }
287
+            }
288
+        });
289
+        return false;
290
+    });
291
+});

+ 284 - 0
backend/web/js/housech/presell.js

@@ -0,0 +1,284 @@
1
+
2
+layui.use(['form','layer','laydate','table','laytpl','layedit','upload'],function(){
3
+    var form = layui.form,
4
+        // layer = parent.layer === undefined ? layui.layer : top.layer,
5
+        layer = layui.layer,
6
+        $ = layui.jquery,
7
+        laydate = layui.laydate,
8
+        laytpl = layui.laytpl,
9
+        table = layui.table,
10
+        layedit = layui.layedit
11
+        ,upload = layui.upload;
12
+        var house_id  = $('input[name="house_id"]').val();
13
+
14
+        //调用编辑器
15
+   var tableIds = 'presellList';
16
+   var reloadId = 'tablerReload';
17
+    //楼盘列表
18
+    var tableIns = table.render({
19
+        elem: '#'+tableIds,
20
+        url : '/housech/presellform',
21
+        cellMinWidth : 90,
22
+        method:'post',
23
+        where:{hid:house_id},
24
+        page : true,
25
+        height : 600,
26
+        limit : 20,
27
+        id:reloadId,
28
+        cols : [[
29
+        	// {type: "checkbox", width:50},
30
+            {type:'numbers',title:'序号',width:100},
31
+            // {field: 'id', title: 'ID', width:100, align:"center",sort: true},
32
+            {field: 'permit', title: '预售许可证',width:250,sort:true, align:'center'},
33
+            {field: 'time', title: '发证时间',width:200,sort:true, align:'center'},
34
+            {field: 'building_num', title: '绑定楼栋',sort:true, align:'center'},
35
+            
36
+            {title: '操作', width:150, templet:'#housesListBar',fixed:"right",align:"center"}
37
+
38
+        ]]
39
+    });
40
+
41
+    tableIns.reload('tablerReload');        //重新加载
42
+
43
+
44
+    var $ = layui.$, active = {
45
+        addData: function(){ //获取选中数据
46
+            var index = parent.layui.layer.open({
47
+                title : "添加预售证",
48
+                type : 2,
49
+                area: ['600px', '500px'],
50
+                content : "/housech/preselladd?hid="+house_id,
51
+                end:function(){
52
+                    layui.table.reload('tablerReload');
53
+                }
54
+            })
55
+
56
+            // parent.layui.layer.full(index);
57
+            // // // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
58
+            // $(window).on("resize",function(){
59
+            //     parent.layui.layer.full(index);
60
+            // })
61
+        }
62
+    };
63
+    $('.demoTable .layui-btn').on('click', function(){
64
+        var type = $(this).data('type');
65
+        active[type] ? active[type].call(this) : '';
66
+    });
67
+
68
+
69
+       //列表操作
70
+    table.on('tool('+tableIds+')', function(obj){
71
+        var data = obj.data;
72
+        if(obj.event === 'presellEdit'){       //修改排序
73
+            var index =layui.layer.open({
74
+                type: 2,
75
+                title: '修改用户信息',
76
+                area: ['600px', '500px'],
77
+                anim: 2,
78
+                content: '/housech/preselledit?id='+data.id //iframe的url,no代表不显示滚动条
79
+                ,end:function(){
80
+                    layui.table.reload('tablerReload');
81
+                }
82
+            })
83
+        } else if(obj.event === 'presellDel'){
84
+
85
+            layer.confirm('您确认要删除吗?',{btn:['确认','取消']},function () {
86
+                $.post('/housech/preselldel',{id:data.id},function (data) {
87
+                    if (data.code == 200) {
88
+                        layer.msg(data.msg);
89
+                        // parent.layui.
90
+                        table.reload('tablerReload');
91
+                        // TableClose();
92
+                    } else {
93
+                        layer.msg(data.msg);
94
+                    }
95
+                })
96
+            })
97
+            // $.post('/house/preselldel',{id:data.id},function (data) {
98
+            //     if (data.code == 200) {
99
+            //         layer.msg(data.msg);
100
+            //         // parent.layui.
101
+            //         table.reload('tablerReload');
102
+            //         // TableClose();
103
+            //     } else {
104
+            //         layer.msg(data.msg);
105
+            //     }
106
+            // })
107
+        }
108
+     })
109
+    //修改页面显示插件
110
+  	laydate.render({
111
+  	  elem: '#test1'
112
+  	});
113
+  
114
+
115
+
116
+    // // 批量删除
117
+    // form.on('submit(del_alls_house)',function (data) {
118
+    //     var checkStatus = table.checkStatus('tablerReload');
119
+    //     var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
120
+    //     if(typeof  checkStatus.data[0] == 'object'){
121
+    //         layer.confirm('您确定要删除吗?',{btn:['确认','取消']},function(){
122
+    //             var formdat = new FormData();
123
+    //             $.each(checkStatus.data,function (key,val) {
124
+    //                 formdat.append('hid[]',val.id);
125
+    //             })
126
+    //             $.ajax({
127
+    //                 cache : true,
128
+    //                 type : "post",
129
+    //                 url : "/house/housede",
130
+    //                 data : formdat,  // 你的formid
131
+    //                 // async : false,          //async 默认为true异步,修改为false为同步
132
+    //                 contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
133
+    //                 processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
134
+    //                 error : function(request) {
135
+    //                     layer.close(index);         //关闭数据提交信息
136
+    //                     layer.alert("网络超时");
137
+    //                 },
138
+    //                 success : function(data) {
139
+    //                     if (data.code == 200) {
140
+    //                         layer.msg(data.msg);
141
+    //                         reloadTable(reloadId);
142
+    //                     } else {
143
+    //                         layer.msg(data.msg);
144
+    //                     }
145
+    //                 }
146
+    //             });
147
+    //
148
+    //         })
149
+    //         return false;
150
+    //
151
+    //     }
152
+    //     layer.msg('请选择需要删除的楼盘',{icon:5});
153
+    //     return false;
154
+    // })   // 批量删除 END
155
+
156
+
157
+	// 添加预售证
158
+    $('.layui_w_addbtn').on('click',function(){
159
+        datumInsert()
160
+        // alert(516)
161
+    })
162
+    //展示数据删除按钮
163
+    $('table.layui-table tbody').on('click','.del',function(){
164
+        var _this = $(this)
165
+        var oid = _this.attr('lay-oid');
166
+
167
+        var index =layer.confirm('确定要删除吗?',{btn: ['确定', '取消']},function () {
168
+            // layer.close(index)
169
+
170
+            if(oid != ''){
171
+                $.post('/housech/peitaodel',{data:oid},function (data) {
172
+                    if(data.code == 200){
173
+                        _this.parents('tr').remove();
174
+                        layer.msg(data.msg);
175
+                        table.reload('tablerReload');
176
+                    } else if(data.code == 300 ) {
177
+                        layer.msg(data.msg);
178
+                    }
179
+                })
180
+            }else {
181
+                _this.parents('tr').remove();
182
+                 layer.msg('已成功删除!');
183
+            }
184
+            
185
+         })
186
+    })
187
+
188
+
189
+    // 数据提交
190
+    form.on('submit(preselladd)',function (data) {
191
+
192
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
193
+        
194
+        var formData = new FormData($('#preselladd')[0]);
195
+
196
+        $.ajax({
197
+            cache : true,
198
+            type : "post",
199
+            url : "/housech/preselladdform",
200
+            data : formData,  // 你的formid
201
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
202
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
203
+            error : function(request) {
204
+                layer.close(index);         //关闭数据提交信息
205
+                layer.alert("网络超时");
206
+            },
207
+            success : function(data) {
208
+                if(data.data != null){
209
+                    layer.msg(ReturnInfo(data.data),{icon:5});
210
+                    return ;
211
+                }
212
+                $('input[name="permit"]').val('');
213
+                $('input[name="time"]').val('');
214
+                $('input[name="building_num"]').val('');
215
+                layer.msg(data.msg);
216
+
217
+            }
218
+        });
219
+                return false;
220
+    })
221
+
222
+	// 修改页面数据提交
223
+	form.on('submit(presellEditSubmit)',function (data) {
224
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
225
+
226
+        var formData = new FormData($('#preselledit')[0]);
227
+        $.ajax({
228
+            cache : true,
229
+            type : "post",
230
+            url : "/housech/preselleditform",
231
+            data : formData,  // 你的formid
232
+            // async : false,          //async 默认为true异步,修改为false为同步
233
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
234
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
235
+            error : function(request) {
236
+                layer.close(index);         //关闭数据提交信息
237
+                layer.alert("请联系管理员");
238
+            },
239
+            success : function(data) {
240
+                if(data.data != null){
241
+                    layer.msg(ReturnInfo(data.data),{icon:5});
242
+                    return ;
243
+                }
244
+                layer.msg(data.msg);
245
+            }
246
+        });
247
+        return false;
248
+    });
249
+
250
+
251
+
252
+
253
+       
254
+})
255
+
256
+
257
+// $(function(){
258
+// 	// 动态添加批量删除按钮
259
+//     var _btn = '<div class="layui-inline " style="float:left;position:relative;left:10px;bottom:35px">'
260
+//               + '<a class="layui-btn layui-btn-danger search_btn layui_w_btn" style="height:30px;line-height:30px;font-size:14px;" lay-submit="" lay-filter="del_alls_house">批量删除</a>'
261
+//               + '</div>'
262
+//         $('.layui-form').append(_btn)
263
+//
264
+// })
265
+
266
+
267
+//预售许可证 添加
268
+function datumInsert(){
269
+    var tr ='<tr>'
270
+        +'<td lay-event="del">'
271
+        +'<div class="layui-table-cell del" lay-oid=""><i class="layui-icon" style="font-size: 30px; color: #1E9FFF;cursor: pointer">&#xe640;</i></div>'
272
+        +'</td>'
273
+        +'<td data-field="matingName" align="center" data-content="">'
274
+        +'<div class="layui-table-cell"><input type="text" name="licenseKey" value="" autocomplete="off" class="layui-input" ></div>'
275
+        +'</td>'
276
+        +'<td data-field="distance" align="center" data-content="">'
277
+        +'<div class="layui-table-cell"><input type="text" name="issueDate" value="" autocomplete="off" class="layui-input" ></div>'
278
+        +'</td>'
279
+        +'<td data-field="longitude" align="center" data-content="">'
280
+        +'<div class="layui-table-cell"><input type="text" id="jwd" name="buildingName" value="" autocomplete="off" class="layui-input" ></div>'
281
+        +'</td>'
282
+        +'</tr>';
283
+    $(".layui_w_licence table.layui-table tbody").append(tr);
284
+}

+ 137 - 0
backend/web/js/housech/usersignup/label.js

@@ -0,0 +1,137 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+
9
+    var tableIds = 'newsCategoryList';
10
+    //第一个实例
11
+    table.render({
12
+        elem: '#'+tableIds
13
+        ,url: '/usersignup/labelform' //数据接口
14
+        ,where:{token:csrfToken}
15
+        ,method:'post'
16
+        ,page: true //开启分页
17
+        ,height:600
18
+        ,text:'数据加载中'
19
+        ,id:'tablereload'
20
+        ,cols: [[ //表头
21
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
22
+            {field: 'name', title: '来源名称', align:'center'}
23
+            ,{field: 'type', title: '来源设备', align:'center'}
24
+            ,{field: 'source_id', title: '文档ID',align:'center'}
25
+            ,{field: 'create_at', title: '添加时间', align:'center'}
26
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
27
+
28
+        ]]
29
+    });
30
+
31
+    //列表操作
32
+    table.on('tool('+tableIds+')', function(obj){
33
+        var layEvent = obj.event,
34
+            data = obj.data;
35
+        if(layEvent === 'edit'){
36
+            layer.open({
37
+                type: 2,
38
+                title: '编辑报名来源信息',
39
+                closeBtn: 1, //不显示关闭按钮
40
+                shade: [0],
41
+                area: ['600px', '500px'],
42
+                anim: 2,
43
+                content: '/usersignup/labeledit?id='+data.id, //iframe的url,no代表不显示滚动条
44
+                end:function () {
45
+                    table.reload('tablereload');
46
+                }
47
+            });
48
+        } else if(layEvent === 'del') {
49
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
50
+                data.del = 2;
51
+                $.post('/usersignup/labeleditform',{data:data},function (data) {
52
+                    layer.msg(data.msg);
53
+                    table.reload('tablereload');
54
+                })
55
+            })
56
+        }
57
+
58
+
59
+    });
60
+
61
+    var $ = layui.$, active = {
62
+        addData: function(){ //获取选中数据
63
+
64
+            layer.open({
65
+                type: 2,
66
+                title: '添加资讯分类',
67
+                closeBtn: 1, //不显示关闭按钮
68
+                shade: [0],
69
+                area: ['600px', '500px'],
70
+                anim: 2,
71
+                content: '/usersignup/labeladd', //iframe的url,no代表不显示滚动条
72
+                end:function () {
73
+                    table.reload('tablereload');
74
+                }
75
+            });
76
+
77
+            // var checkStatus = table.checkStatus('idTest')
78
+            //     ,data = checkStatus.data;
79
+            // layer.alert(JSON.stringify(data));
80
+        },
81
+        reload:function () {
82
+            var form = pfgs_serialize($('form'));
83
+            var name = '';
84
+            var id   = '';
85
+            if(form.input_house == 'name'){
86
+                name = form.input_house_text;
87
+            } else if(form.input_house == 'id'){
88
+                id = form.input_house_text;
89
+            }
90
+
91
+            table.reload('tablereload',{
92
+                where:{
93
+                    type:form.type,
94
+                    name:name,
95
+                    source_id:id
96
+                },
97
+                page:{
98
+                    curr:1
99
+                }
100
+            })
101
+        }
102
+    };
103
+
104
+    $('.demoTable .layui-btn').on('click', function(){
105
+        var type = $(this).data('type');
106
+        active[type] ? active[type].call(this) : '';
107
+    });
108
+
109
+    //修改
110
+    form.on('submit(editnews)', function(data){
111
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
112
+        $.post('/usersignup/labeleditform',{'data':data.field,'token':csrfToken},function (data) {
113
+            if(data.data != null){
114
+                layer.msg(ReturnInfo(data.data),{icon:5});
115
+                return ;
116
+            }
117
+            layer.msg(data.msg);
118
+            TableClose();
119
+        })
120
+        return false;
121
+    });
122
+
123
+    //添加
124
+    form.on('submit(addnews)', function(data){
125
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});
126
+        $.post('/usersignup/labeladdform',{'data':data.field,'token':csrfToken},function (data) {
127
+                    if(data.data != null){
128
+                        layer.msg(ReturnInfo(data.data),{icon:5});
129
+                        return ;
130
+                    }
131
+                    layer.msg(data.msg);
132
+            TableClose();
133
+        })
134
+        return false;
135
+    });
136
+
137
+});

+ 196 - 0
backend/web/js/housech/usersignup/signup.js

@@ -0,0 +1,196 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','laydate'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form,
8
+        laydate = layui.laydate;
9
+
10
+
11
+    laydate.render({
12
+        elem: '#date1'
13
+    });
14
+    laydate.render({
15
+        elem: '#date2'
16
+    });
17
+    //第一个实例
18
+    var tableIns = table.render({
19
+        elem: '#userlist'
20
+        ,url: '/usersignup/homeform' //数据接口
21
+        ,where:{token:csrfToken}
22
+        ,method:'post'
23
+        ,id:'tablerReload'
24
+        ,page: true //开启分页
25
+        ,height:600
26
+        ,limit : 20
27
+        ,text:'数据加载中'
28
+        ,cols: [[ //表头
29
+            // {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
30
+            {type:'numbers',fixed:"left",title:'序号'},
31
+			{type: "checkbox", width:50},
32
+            {field: 'equipment', title: '设备',width:110, align:'center',templet:"#equipment",templet:function(d){
33
+                    if(d.equipment == 'PC'){
34
+                        return '<div class="layui-table-cell" style="color:red;">'+d.equipment+'</div>'
35
+                    }else{
36
+                        return '<div class="layui-table-cell" style="color:#009688;">'+d.equipment+'</div>'
37
+                    }
38
+                }}
39
+            ,{field: 'ip', title: 'ip',width:150,align:'center'}
40
+            ,{field: 'source', title: '来源',align:'center'}
41
+            // ,{field: 'name', title: '姓名',width:100,align:'center'}
42
+            ,{field: 'mobile', title: '手机号码',width:150,align:'center'}
43
+            ,{field: 'city_name', title: '区域',width:150,align:'center',templet:function (d) {
44
+                    if(d.city_name != null){
45
+                            return '<div class="layui-table-cell" style="color:#c8601f;font-weight:600">'+d.city_name+'</div>'
46
+                    }else {
47
+                        return '<div class="layui-table-cell" style="font-weight:600">-----</div>'
48
+                    }
49
+                }}
50
+            ,{field: 'house_name', title: '归属',width:200,align:'center',templet:function (d) {
51
+                    if(d.house_name != null){
52
+                        return '<div class="layui-table-cell" style="font-weight:600">'+d.house_name+'</div>'
53
+                    }else {
54
+                        return '<div class="layui-table-cell" style="font-weight:600">-----</div>'
55
+                    }
56
+                }}
57
+            ,{field: 'state', title: '发送状态',width:150,align:'center'}
58
+            ,{field: 'send_email', title: '发送邮箱',width:150,align:'center'}
59
+            ,{field: 'create_at', title: '日期',width:150,align:'center'}
60
+            // ,{field: 'city', title: '用户区域',width:80,align:'center'}
61
+            // ,{field: 'send_email', title: '发送邮箱',width:180,align:'center'}
62
+            // ,{field: 'state', title: '发送状态',width:100,align:'center',templet:"#state",templet:function(d){
63
+            //         if(d.state == '成功'){
64
+            //             return '<div class="layui-table-cell" style="color:#00960b;font-weight:600">'+d.state+'</div>'
65
+            //         }else {
66
+            //             return '<div class="layui-table-cell" style="color:red;font-weight:600">'+d.state+'</div>'
67
+            //         }
68
+            //     }}
69
+
70
+            ,{fixed: 'right',title:'操作', width: 150, align:'center', toolbar: '#signupBar'}
71
+
72
+        ]]
73
+    });
74
+
75
+    // tableIns.reload('tablerReload');        //重新加载
76
+
77
+    //列表操作
78
+    table.on('tool(userlist)', function(obj){
79
+        var layEvent = obj.event,
80
+            data = obj.data;
81
+        if(layEvent === 'edit'){
82
+            layer.open({
83
+                type: 2,
84
+                title: '用户详情',
85
+                area: ['600px', '500px'],
86
+                anim: 2,
87
+                content: '/usersignup/userdetails?id='+data.id,
88
+                end:function () {
89
+                    table.reload('tablerReload');
90
+                }//iframe的url,no代表不显示滚动条
91
+            });
92
+        } else if(layEvent === 'del') {
93
+            layer.confirm('您确认要删除吗?',{btn:['确认','取消']},function () {
94
+                console.log(data.id)
95
+                $.post('/usersignup/signupdel',{id:data.id},function (data) {
96
+                    layer.msg(data.msg);
97
+                    // parent.layui.
98
+                    table.reload('tablerReload');
99
+
100
+                })
101
+            })
102
+        }
103
+
104
+    });
105
+
106
+    var $ = layui.$, active = {
107
+        addData: function(){ //获取选中数据
108
+            layer.open({
109
+                type: 2,
110
+                title: '添加账号',
111
+                closeBtn: 1, //不显示关闭按钮
112
+                shade: [0],
113
+                area: ['600px', '500px'],
114
+                anim: 2,
115
+                content: ['/user/adduser', 'no'], //iframe的url,no代表不显示滚动条
116
+            });
117
+        },
118
+       sendEmail:function () {
119
+            var checkStatus = table.checkStatus('tablerReload');
120
+            var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
121
+            if(typeof  checkStatus.data[0] == 'object'){
122
+                layer.confirm('确定要发送吗?',{btn:['确认','取消']},function(){
123
+                    var formdat = new FormData();
124
+                    $.each(checkStatus.data,function (key,val) {
125
+                        formdat.append('hid[]',val.id);
126
+                    })
127
+                    $.ajax({
128
+                        cache : true,
129
+                        type : "post",
130
+                        url : "/usersignup/emailsend",
131
+                        data : formdat,  // 你的formid
132
+                        // async : false,          //async 默认为true异步,修改为false为同步
133
+                        contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
134
+                        processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
135
+                        error : function(request) {
136
+                            layer.close(index);         //关闭数据提交信息
137
+                            layer.alert("网络超时");
138
+                        },
139
+                        success : function(data) {
140
+                            if (data.code == 200) {
141
+                                layer.msg(data.msg);
142
+                                reloadTable(reloadId);
143
+                            } else {
144
+                                layer.msg(data.msg);
145
+                            }
146
+                        }
147
+                    });
148
+
149
+                })
150
+                return false;
151
+            }
152
+            layer.msg('请选择需要重新发送的报名信息',{icon:5});
153
+            return false;
154
+        },
155
+      reload:function () {
156
+            var form = pfgs_serialize($('form'));
157
+
158
+            var a = compareTime(form.start_time,form.end_time);
159
+            if(a === false) {
160
+                layer.msg('开始时间不能大于结束时间');
161
+                return ;
162
+            }
163
+            table.reload('tablerReload',{
164
+                where:{
165
+                    equipment:form.equipment,
166
+                    start_time:form.start_time,
167
+                    end_time:form.end_time,
168
+                    source_id:form.source,
169
+                    state:form.state
170
+                },
171
+                page:{      //重载分页
172
+                    curr:1
173
+                }
174
+            })
175
+        }
176
+    };
177
+
178
+    function compareTime(a, b) {
179
+        var arr = a.split("-"); //log [2016,04,06]
180
+        var start = new Date(arr[0], (arr[1] - 1), arr[2]);
181
+        var starts = start.getTime(); //输出时间戳进行对比
182
+        var arrs = b.split("-");
183
+        var end = new Date(arrs[0], (arrs[1] - 1), arrs[2]);
184
+        var ends = end.getTime();
185
+        if (starts > ends)  return false ;
186
+    }
187
+
188
+    $('.demoTable .layui-btn').on('click', function(){
189
+        var type = $(this).data('type');
190
+        active[type] ? active[type].call(this) : '';
191
+    });
192
+
193
+
194
+
195
+
196
+});

+ 0 - 0
backend/web/js/housech/usersignup/userdetails.js


+ 256 - 0
backend/web/js/investhot/investhot.js

@@ -0,0 +1,256 @@
1
+layui.use([ 'laypage', 'layer', 'laydate', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+		,laydate = layui.laydate
7
+        ,table = layui.table //表格
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+
12
+
13
+    var tableIds = 'videolist';  //表格ID
14
+	var type_id = $('input[name="typeid"]').val();
15
+    //第一个实例
16
+    table.render({
17
+        elem: '#'+tableIds
18
+        ,url: '/investhot/indexform' //数据接口
19
+        ,where:{token:csrfToken,type:type_id}
20
+        ,method:'post'
21
+        ,page: true //开启分页
22
+        ,height:600
23
+        ,text:'数据加载中'
24
+        ,id:'tablerReload'
25
+        ,cols: [[ //表头
26
+            {type:'numbers',title:'序号',width:50},
27
+            {field: 'title', title: '标题', align:'center'},
28
+            {field: 'url', title: '地址', align:'center'},
29
+            {field: 'img', title: '图片',width:200, align:'center',templet:function(d){
30
+                    return '<img class="layui_magnify" src="'+d.img+'"/>'
31
+                }}
32
+            // {field: 'sort', title: '排序',width:100, event:'sortData', align:'center',sort: true,templet:"#sortBox"}
33
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
34
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
35
+                    if(d.is_show == 2){
36
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
37
+                    } else {
38
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
39
+                    }
40
+                }}
41
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
42
+
43
+        ]]
44
+    });
45
+
46
+    // 列表点击放大图片
47
+    $('.layui-table-main').on('click','.layui_magnify', function(){
48
+        var _src = $(this).attr('src');
49
+        layui.layer.open({
50
+            type: 1,
51
+            title: false,           //是否显示标题
52
+            area: ['95%', '55%'],
53
+            shade: 0.6,           //透明度
54
+            closeBtn: 1,         //按钮 1有,0无
55
+            shadeClose: true,
56
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
57
+        });
58
+    });
59
+
60
+
61
+    //监听指定开关
62
+    form.on('switch(switchTest)', function(data){
63
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
64
+            $.post('/investhot/indexdelandsow',{id:data.value,type:'show'},function (data) {
65
+                layer.msg(data.msg);
66
+                table.reload('tablerReload');
67
+
68
+            })
69
+        },function (aa) {
70
+            table.reload('tablerReload');        //重新加载
71
+        })
72
+    });
73
+
74
+
75
+    //列表操作
76
+    table.on('tool('+tableIds+')', function(obj){
77
+        var layEvent = obj.event,
78
+            data = obj.data;
79
+
80
+        if(layEvent === 'sortData'){       //修改排序
81
+            layer.prompt({
82
+                formType: 2
83
+                ,title: '排序特色类型:<span style="color:red">'+data.name+'</span>'
84
+                ,value: data.sort
85
+            }, function(value, index){
86
+
87
+                $.post('/investhot/indexdelshow',{id:data.id,type:'sort',sort:value},function (data) {
88
+                    layer.msg(data.msg);
89
+                    table.reload('tablerReload');
90
+                })
91
+            });
92
+        }else if(layEvent === 'del') {
93
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
94
+                $.post('/investhot/indexdelandsow',{id:data.id,type:'del'},function (data) {
95
+                    layer.msg(data.msg);
96
+                    table.reload('tablerReload');
97
+                })
98
+            })
99
+        } else if(layEvent === 'edit'){
100
+            var index = layer.open({
101
+                type: 2,
102
+                title: '修改',
103
+                area:['800px','500px'],
104
+                content: '/investhot/indexedit?id='+data.id,
105
+                end:function () {
106
+                    table.reload('tablerReload');        //重新加载
107
+                }
108
+            });
109
+        }
110
+    });
111
+
112
+    //添加图片上传
113
+    upload.render({
114
+        elem: '#test1'
115
+        ,url: '/house/createimg'
116
+        ,data:{token:csrfToken}
117
+        ,field:'img'
118
+        ,size:1500              //限制上传图片的大小,单位为KB
119
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
120
+        ,auto:false
121
+        ,bindAction:'#addcity'
122
+        ,choose: function(obj){
123
+            obj.preview(function(index, file, result){
124
+                $('#breviary_img').attr('src', result); //图片链接(base64)
125
+            });
126
+        }
127
+    });
128
+    // 图片放大浏览
129
+    $('.layui_magnify').click(function(){
130
+        var _src = $(this).attr('src');
131
+        layui.layer.open({
132
+            type: 1,
133
+            title: false,           //是否显示标题
134
+            area: ['60%', '80%'],
135
+            shade: 0.6,           //透明度
136
+            closeBtn: 1,         //按钮 1有,0无
137
+            shadeClose: true,
138
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
139
+        });
140
+    })
141
+
142
+    // 新增
143
+    var $ = layui.$, active = {
144
+        addData: function(){ //获取选中数据
145
+            var index = layui.layer.open({
146
+                type: 2,
147
+                title: '添加',
148
+                closeBtn: 1, //不显示关闭按钮
149
+                area: ['900px','600px'],
150
+                content: '/investhot/indexadd?type='+type_id //iframe的url,no代表不显示滚动条
151
+                ,success:function (layero, index) {
152
+                },
153
+                end:function () {
154
+                    table.reload('tablerReload');
155
+                }
156
+            });
157
+        },
158
+        reload:function(){//搜索
159
+            var form = pfgs_serialize($('form'));
160
+            var name = '';
161
+            var house_name   = '';
162
+            if(form.input_house == 'name'){
163
+                name = form.input_house_text;
164
+            } else if(form.input_house == 'house_name'){
165
+                house_name = form.input_house_text;
166
+            }
167
+            table.reload('tablerReload',{
168
+                where:{
169
+                    title:name,
170
+                    house_name:house_name,
171
+                    city:form.input_city,
172
+                    type_name:form.type_name
173
+                }
174
+            })
175
+        },
176
+    };
177
+    $('.demoTable .layui-btn').on('click', function(){
178
+        var type = $(this).data('type');
179
+        active[type] ? active[type].call(this) : '';
180
+    });
181
+
182
+    //
183
+    // $('.The_house').focus(function(){
184
+    //     indexOpen = parent.layui.layer.open({
185
+    //         type: 2,
186
+    //         title: '选择需要添加的楼盘特色类型',
187
+    //         area: ['','100%'],
188
+    //         content: '/publicuse/ctype',
189
+    //         success:function (layero, index) {
190
+    //         },
191
+    //         end:function(){
192
+    //         }
193
+    //     });
194
+    //     parent.layui.layer.full(indexOpen);
195
+    //     //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
196
+    //     $(window).on("resize",function(){
197
+    //         parent.layui.layer.full(indexOpen);
198
+    //     })
199
+    // })
200
+
201
+// 日期
202
+    laydate.render({
203
+      elem: '#s_date'
204
+    });
205
+
206
+    //添加页面提交数据
207
+    form.on('submit(add)', function(data){
208
+        var formData = new FormData($('form')[0]);
209
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
210
+        $.ajax({
211
+            type : "post",
212
+            url : "/investhot/indexaddform",
213
+            data : formData,
214
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
215
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
216
+            error : function(request) {
217
+                layer.close(index);
218
+                layer.msg("请联系管理员");
219
+            },
220
+            success : function(data) {
221
+                if(data.data != null){
222
+                    layer.msg(ReturnInfo(data.data),{icon:5});
223
+                    return ;
224
+                }
225
+                layer.msg(data.msg);
226
+                parent.layer.close(oindex); //再执行关闭
227
+            }
228
+        });
229
+        return false;
230
+    });
231
+
232
+    form.on('submit(edit)', function(data){
233
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
234
+        var formData = new FormData($('form')[0]);
235
+        $.ajax({
236
+            type : "post",
237
+            url : "/investhot/indexeditform",
238
+            data : formData,
239
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
240
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
241
+            error : function(request) {
242
+                layer.close(index);
243
+                layer.msg("请联系管理员");
244
+            },
245
+            success : function(data) {
246
+                if(data.data != null){
247
+                    layer.msg(ReturnInfo(data.data),{icon:5});
248
+                    return ;
249
+                }
250
+                layer.msg(data.msg);
251
+                parent.layer.close(oindex); //再执行关闭
252
+            }
253
+        });
254
+        return false;
255
+    });
256
+})

+ 424 - 0
backend/web/js/knowledge/cityintro.js

@@ -0,0 +1,424 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'videolist';  //表格ID
13
+    var url = '';
14
+    var where = '';
15
+    var len = $('input[name=cityId]').length;
16
+
17
+    if(len == 0){
18
+        url = '/knowledge/cityintroform';
19
+        where = {token:csrfToken};
20
+    }else{
21
+        url = '/knowledge/subcityintroform';
22
+        where = {city:$('input[name=cityId]').val(),token:csrfToken};
23
+    }
24
+
25
+    //第一个实例
26
+    var wtable = table.render({
27
+        elem: '#'+tableIds
28
+        ,url: url //数据接口
29
+        ,where:where
30
+        ,method:'post'
31
+        ,page: true //开启分页
32
+        ,height:600
33
+        ,text:'数据加载中'
34
+        ,id:'tablerReload'
35
+        ,limit:15
36
+        ,cols: [[ //表头
37
+            {field: 'id',title:'ID',width:50},
38
+            {field: 'city_name', title: '地区', align:'center'},
39
+            {field: 'img', title: '图片', align:'center',templet:function(d){
40
+                return '<img class="layui_magnify" src="'+d.img+'"/>'
41
+            }}
42
+            ,{field: 'url', title: '跳转地址',width:150, align:'center'}
43
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
44
+            ,{field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"}
45
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
46
+                    if(d.is_show == 2){
47
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
48
+                    } else {
49
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
50
+                    }
51
+                }}
52
+            ,{field:'tools',fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
53
+
54
+        ]] ,done:function () {
55
+            var tools = $("[data-field='tools'] :eq(0)").width();
56
+            // console.log(tools);
57
+            if (tools > 500) {
58
+                wtable.reload('tablerReload');        //重新加载
59
+            }
60
+
61
+        }
62
+    });
63
+
64
+    // 列表点击放大图片
65
+    $('.layui-table-main').on('click','.layui_magnify', function(){
66
+        var _src = $(this).attr('src');
67
+        layui.layer.open({
68
+            type: 1,
69
+            title: false,           //是否显示标题
70
+            area: ['95%', '55%'],
71
+            shade: 0.6,           //透明度
72
+            closeBtn: 1,         //按钮 1有,0无
73
+            shadeClose: true,
74
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
75
+        });
76
+    });
77
+
78
+
79
+    //监听指定开关
80
+    form.on('switch(switchTest)', function(data){
81
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
82
+            $.post('/knowledge/introdelshow',{id:data.value,type:'show'},function (data) {
83
+                layer.msg(data.msg);
84
+                table.reload('tablerReload');
85
+
86
+            })
87
+        },function (aa) {
88
+            table.reload('tablerReload');        //重新加载
89
+        })
90
+    });
91
+
92
+
93
+    //列表操作
94
+    table.on('tool('+tableIds+')', function(obj){
95
+        var layEvent = obj.event,
96
+            data = obj.data;
97
+
98
+        if(layEvent === 'sortData'){       //修改排序
99
+            table.on('edit('+tableIds+')', function(obj){
100
+                var data = obj.data;
101
+                // console.log(data)
102
+                $.post('/knowledge/introdelshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
103
+                    if(data.code == 200)
104
+                    {
105
+                        layer.msg(data.msg);
106
+                    } else if(data.code == 300 ) {
107
+                        layer.msg(data.msg);
108
+                    }
109
+                })
110
+            })
111
+            // layer.prompt({
112
+            //     formType: 2
113
+            //     ,title: '排序热门区域:<span style="color:red">'+data.city_name+'</span>'
114
+            //     ,value: data.sort
115
+            // }, function(value, index){
116
+
117
+            //     $.post('/push/citydelshow',{id:data.id,type:'sort',sort:value},function (data) {
118
+            //         layer.msg(data.msg);
119
+            //         table.reload('tablerReload');
120
+            //     })
121
+            // });
122
+        }else if(layEvent === 'del') {
123
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
124
+                $.post('/knowledge/introdelshow',{id:data.id,type:'del'},function (data) {
125
+                    layer.msg(data.msg);
126
+                    table.reload('tablerReload');
127
+                })
128
+            })
129
+        }else if(layEvent === 'edit'){
130
+            var index = layer.open({
131
+                type: 2,
132
+                title: '修改'+data.city_name+'相关内容',
133
+                area:['800px','500px'],
134
+                content: '/knowledge/cityintroedit?id='+data.id,
135
+                end:function () {
136
+                    table.reload('tablerReload');        //重新加载
137
+                }
138
+            });
139
+        }else if(layEvent === 'Relation'){
140
+            var index =layui.layer.open({
141
+                title :'<span style="color:red" >['+data.city_name+']</span>区域相关楼盘',
142
+                type : 2,
143
+                area:['','100%'],
144
+                maxmin: true,
145
+                content : "/knowledge/subcityintro?id="+data.city_id,
146
+                end:function () {
147
+                    table.reload('tablerReload');
148
+                }
149
+            })
150
+            layui.layer.full(index);
151
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
152
+            $(window).on("resize",function(){
153
+                layui.layer.full(index);
154
+            })
155
+        }
156
+
157
+
158
+    });
159
+
160
+    //添加图片上传
161
+    upload.render({
162
+        elem: '#test1'
163
+        ,url: '/house/createimg'
164
+        ,data:{token:csrfToken}
165
+        ,field:'img'
166
+        ,size:1000              //限制上传图片的大小,单位为KB
167
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
168
+        ,auto:false
169
+        ,bindAction:'#addcity'
170
+        ,choose: function(obj){
171
+            obj.preview(function(index, file, result){
172
+                $('#breviary_img').attr('src', result); //图片链接(base64)
173
+            });
174
+        }
175
+    });
176
+    // 图片放大浏览
177
+    $('.layui_magnify').click(function(){
178
+        var _src = $(this).attr('src');
179
+        layui.layer.open({
180
+            type: 1,
181
+            title: false,           //是否显示标题
182
+            area: ['60%', '80%'],
183
+            shade: 0.6,           //透明度
184
+            closeBtn: 1,         //按钮 1有,0无
185
+            shadeClose: true,
186
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
187
+        });
188
+    })
189
+
190
+    // 新增
191
+    var $ = layui.$, active = {
192
+        addData: function(){ //获取选中数据
193
+            var index = layui.layer.open({
194
+                type: 2,
195
+                title: '添加区域介绍',
196
+                closeBtn: 1, //不显示关闭按钮
197
+                area: ['100%','100%'],
198
+                content: '/knowledge/cityintroadd' //iframe的url,no代表不显示滚动条
199
+                ,success:function (layero, index) {
200
+                },
201
+                end:function () {
202
+                    table.reload('tablerReload');
203
+                }
204
+            });
205
+        },
206
+        reload:function(){//搜索
207
+            var form = pfgs_serialize($('form'));
208
+            var name = form.input_city;
209
+            table.reload('tablerReload', {
210
+                where: {
211
+                    city_name: name
212
+                }
213
+            })
214
+        },
215
+    };
216
+    $('.demoTable .layui-btn').on('click', function(){
217
+        var type = $(this).data('type');
218
+        active[type] ? active[type].call(this) : '';
219
+    });
220
+
221
+
222
+    $('.The_house').focus(function(){
223
+        indexOpen = parent.layui.layer.open({
224
+            type: 2,
225
+            title: '选择需要添加的区域',
226
+            area: ['','100%'],
227
+            content: '/publicuse/city',
228
+            success:function (layero, index) {
229
+            },
230
+            end:function(){
231
+            }
232
+        });
233
+        parent.layui.layer.full(indexOpen);
234
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
235
+        $(window).on("resize",function(){
236
+            parent.layui.layer.full(indexOpen);
237
+        })
238
+    })
239
+
240
+
241
+
242
+    //添加页面提交数据
243
+    // form.on('submit(add_hotcity)', function(data){
244
+    //     var trArry = $('.layui-input-block table.layui-table tbody tr');
245
+    //     var formData = new FormData($('form')[0]);
246
+    //     var dataObj = [{}];
247
+    //     var dataArry = new Array();
248
+    //     if(formData.getAll('img')[0].size == 0){
249
+    //         layer.msg('请选择图片');
250
+    //         return false;
251
+    //     }
252
+    //     $.each(trArry,function(key,val){
253
+    //         // var _title = $(this).find('input[name="matingName"]').val();
254
+    //         var _rout = $(this).find('input[name="id"]').val();
255
+    //         // dataObj[key] = {name:_title,id:_rout}        //把数据以数组对象的方式保存
256
+    //         dataArry.push(_rout)
257
+    //         // dataArry.push(dataObj[key])
258
+    //     })
259
+    //     layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
260
+    //
261
+    //     $.post("/push/hotcityaddform",{city_id:dataArry,formData:formData},function(data){
262
+    //
263
+    //                 if(data.data != null){
264
+    //                     layer.msg(ReturnInfo(data.data),{icon:5});
265
+    //                     return ;
266
+    //                 }
267
+    //         layer.msg(data.msg);
268
+    //
269
+    //     })
270
+    //     return false;
271
+    // });
272
+
273
+    form.on('submit(add_cityintro)', function(data){
274
+        var formData = new FormData($('form')[0]);
275
+        var pid =$('select[name=city] option:selected').attr('data-pid');
276
+        if(pid == 0){
277
+            if(formData.getAll('img')[0].size == 0){
278
+                layer.msg('请选择图片');
279
+                return false;
280
+            }
281
+        }
282
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
283
+        $.ajax({
284
+            cache : false,
285
+            type : "post",
286
+            url : "/knowledge/cityintroaddform",
287
+            data : formData,  // 你的formid
288
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
289
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
290
+            error : function(request) {
291
+                layer.close(index);
292
+                layer.msg("请联系管理员");
293
+            },
294
+            success : function(data) {
295
+                if(data.data != null){
296
+                    layer.msg(ReturnInfo(data.data),{icon:5});
297
+                    return ;
298
+                }
299
+                layer.msg(data.msg);
300
+            }
301
+        });
302
+        return false;
303
+    });
304
+
305
+    form.on('submit(edit_cityintro)', function(data){
306
+        var formData = new FormData($('form')[0]);
307
+        // if(formData.getAll('img')[0].size == 0){
308
+        //     layer.msg('请选择图片');
309
+        //     return false;
310
+        // }
311
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
312
+        $.ajax({
313
+            cache : false,
314
+            type : "post",
315
+            url : "/knowledge/cityintroeditform",
316
+            data : formData,  // 你的formid
317
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
318
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
319
+            error : function(request) {
320
+                layer.close(index);
321
+                layer.msg("请联系管理员");
322
+            },
323
+            success : function(data) {
324
+                if(data.data != null){
325
+                    layer.msg(ReturnInfo(data.data),{icon:5});
326
+                    return ;
327
+                }
328
+                layer.msg(data.msg);
329
+            }
330
+        });
331
+        return false;
332
+    });
333
+
334
+    form.on('submit(edit_choice)', function(data){
335
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
336
+        var formData = new FormData($('form')[0]);
337
+        $.ajax({
338
+            type : "post",
339
+            url : "/push/choiceeditform",
340
+            data : formData,
341
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
342
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
343
+            error : function(request) {
344
+                layer.close(index);
345
+                layer.msg("请联系管理员");
346
+            },
347
+            success : function(data) {
348
+                if(data.data != null){
349
+                    layer.msg(ReturnInfo(data.data),{icon:5});
350
+                    return ;
351
+                }
352
+                layer.msg(data.msg);
353
+                parent.layer.close(oindex); //再执行关闭
354
+            }
355
+        });
356
+        return false;
357
+    });
358
+    // //判断是否需要编辑,需要才加载
359
+    var verdict = $('#editor1').html();
360
+    if(typeof verdict == "string") {
361
+        var ue = UE.getEditor('editor1');  //编辑器
362
+        var ue = UE.getEditor('editor2');  //编辑器
363
+    //     var ue = UE.getEditor('editor3');  //编辑器
364
+    //     var ue = UE.getEditor('editor4');  //编辑器
365
+    //     var ue = UE.getEditor('editor5');  //编辑器
366
+    //     var ue = UE.getEditor('editor6');  //编辑器
367
+    }
368
+
369
+    form.on('select(city)',function (data) {
370
+        var pid =$('select[name=city] option:selected').attr('data-pid');
371
+        if(pid == 0 ){
372
+            $('ul li').show();
373
+            // $('ul li[lay-id=assign_2]').hide();
374
+            // $('ul li[lay-id=assign_3]').hide();
375
+            $('input[name=title]').parent().parent().css('display','none');
376
+            $('textarea[name=intro]').parent().parent().css('display','block');
377
+            $('.xm_pr').css('display','block');
378
+            $('ul li').each(function(){
379
+                if(typeof($(this).attr('data-id')) != 'undefined'){
380
+                    var v = $(this).attr('data-id');
381
+                    var ue = UE.getEditor('edi'+v);  //编辑器;
382
+                }
383
+            });
384
+        }
385
+        if(pid != 0){
386
+            $('ul li').hide();
387
+            $('ul li[lay-id=assign_1]').show();
388
+            $('input[name=title]').parent().parent().css('display','block');
389
+            $('textarea[name=intro]').parent().parent().css('display','none');
390
+            $('.xm_pr').css('display','none');
391
+            // $('ul li[lay-id=assign_2]').show();
392
+            // $('ul li[lay-id=assign_3]').show();
393
+        }
394
+    })
395
+    var pid =$('select[name=city] option:selected').attr('data-pid');
396
+    //编辑页面加载编辑器
397
+    if(typeof pid != 'undefined' ){
398
+        // var ue = UE.getEditor('editor1');  //编辑器
399
+        // var ue = UE.getEditor('editor2');  //编辑器
400
+        $('ul li').each(function(){
401
+            if(typeof($(this).attr('data-id')) != 'undefined'){
402
+                var v = $(this).attr('data-id');
403
+                var ue = UE.getEditor('edi'+v);  //编辑器;
404
+            }
405
+        });
406
+    }
407
+
408
+    if(pid != 0){
409
+        $('ul li').hide();
410
+        $('ul li[lay-id=assign_1]').show();
411
+        $('input[name=title]').parent().parent().css('display','block');
412
+        $('textarea[name=intro]').parent().parent().css('display','none');
413
+        $('.xm_pr').css('display','none');
414
+        // $('ul li[lay-id=assign_2]').show();
415
+        // $('ul li[lay-id=assign_3]').show();
416
+    }else if(pid == 0){
417
+        $('input[name=title]').parent().parent().css('display','none');
418
+        $('textarea[name=intro]').parent().parent().css('display','block');
419
+        $('.xm_pr').css('display','block');
420
+    }
421
+
422
+
423
+
424
+})

+ 139 - 0
backend/web/js/knowledge/label.js

@@ -0,0 +1,139 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,layer = layui.layer //弹层
5
+        ,table = layui.table //表格
6
+        ,element = layui.element //元素操作
7
+        ,form = layui.form;
8
+
9
+    var tableIds = 'laballist';  //表格ID
10
+    var reloadId = 'tablerReload';
11
+    //第一个实例
12
+    var tableIns = table.render({
13
+        elem: '#'+tableIds
14
+        ,url: '/knowledge/labelform' //数据接口
15
+        ,where:{token:csrfToken}
16
+        ,method:'post'
17
+        ,page: true //开启分页
18
+        ,height:600
19
+        ,text:'数据加载中'
20
+        ,id:reloadId
21
+        ,limit:20
22
+        ,cols: [[ //表头
23
+            {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left',align:'center'},
24
+            // {type:'numbers'},
25
+            {field: 'label', title: '标签类型', align:'center'}
26
+            ,{fixed: 'right',title:'操作', width: 180, align:'center', toolbar: '#operate'}
27
+
28
+        ]]
29
+    });
30
+
31
+    table.reload('tablerReload');        //重新加载
32
+
33
+    //列表操作
34
+    table.on('tool('+tableIds+')', function(obj){
35
+        var layEvent = obj.event,
36
+            data = obj.data;
37
+        if(layEvent === 'edit'){
38
+            layer.open({
39
+                type: 2,
40
+                title: '修改标签',
41
+                area: ['600px', '500px'],
42
+                content: '/dictionarya/labeledit?id='+data.id, //iframe的url,no代表不显示滚动条
43
+                end:function(){
44
+                    table.reload('tablerReload');
45
+                }
46
+            });
47
+        } else if(layEvent === 'del') {
48
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
49
+                $.post('/knowledge/labeldelshow',{'id':data.id},function (data) {
50
+                    if(data.code == 200)
51
+                    {
52
+                        layer.msg(data.msg);
53
+                        table.reload('tablerReload');
54
+                    } else if(data.code == 300 ) {
55
+                        layer.msg(data.msg);
56
+                    }
57
+                })
58
+            })
59
+        }
60
+
61
+
62
+    });
63
+
64
+    var $ = layui.$, active = {
65
+        addData: function(){ //获取选中数据
66
+
67
+            layer.open({
68
+                type: 2,
69
+                title: '添加标签',
70
+                area: ['600px', '500px'],
71
+                content: '/knowledge/labeladd', //iframe的url,no代表不显示滚动条
72
+                end:function(){
73
+                    table.reload('tablerReload');
74
+                }
75
+            });
76
+
77
+            // var checkStatus = table.checkStatus('idTest')
78
+            //     ,data = checkStatus.data;
79
+            // layer.alert(JSON.stringify(data));
80
+        }
81
+    };
82
+
83
+    $('.demoTable .layui-btn').on('click', function(){
84
+        var type = $(this).data('type');
85
+        active[type] ? active[type].call(this) : '';
86
+    });
87
+
88
+    //修改
89
+    form.on('submit(editlabel)', function(data){
90
+        $.post('/dictionarya/labeleditform',{'data':data.field,'token':csrfToken},function (data) {
91
+            if(data.code == 200)
92
+            {
93
+                layer.msg(data.msg);
94
+
95
+            } else if(data.code == 300 ) {
96
+                layer.msg(data.msg);
97
+            }
98
+        })
99
+        return false;
100
+    });
101
+
102
+    //添加
103
+    form.on('submit(addlabel)', function(data){
104
+        var formData = new FormData($('form')[0]);
105
+        // $.post('/knowledge/labeladdform',{data:formData},function (data) {
106
+        //     if(data.code == 200)
107
+        //     {
108
+        //         layer.msg(data.msg);
109
+        //         $("input[name='name']").val('');
110
+        //     } else if(data.code == 300 ) {
111
+        //         layer.msg(data.msg);
112
+        //     }
113
+        // })
114
+        // return false;
115
+
116
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
117
+        $.ajax({
118
+            cache : false,
119
+            type : "post",
120
+            url : "/knowledge/labeladdform",
121
+            data : formData,  // 你的formid
122
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
123
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
124
+            error : function(request) {
125
+                layer.close(index);
126
+                layer.msg("请联系管理员");
127
+            },
128
+            success : function(data) {
129
+                if(data.data != null){
130
+                    layer.msg(ReturnInfo(data.data),{icon:5});
131
+                    return ;
132
+                }
133
+                layer.msg(data.msg);
134
+            }
135
+        });
136
+        return false;
137
+    });
138
+
139
+});

+ 279 - 0
backend/web/js/knowledge/pone.js

@@ -0,0 +1,279 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+    var type_id = $('input[name="type"]').val();
12
+    var tableIds = 'videolist';  //表格ID
13
+
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#'+tableIds
17
+        ,url: '/knowledge/poneform' //数据接口
18
+        ,where:{token:csrfToken,type:type_id}
19
+        ,method:'post'
20
+        ,page: true //开启分页
21
+        ,height:600
22
+        ,text:'数据加载中'
23
+        ,id:'tablerReload'
24
+        ,cols: [[ //表头
25
+            {type:'numbers',title:'序号',width:50},
26
+            {field: 'subject', title: '标题', align:'center'},
27
+            {field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"}
28
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
29
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
30
+                    if(d.is_show == 2){
31
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
32
+                    } else {
33
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
34
+                    }
35
+                }}
36
+            ,{fixed: 'right',title:'操作', width: 200, align:'center', toolbar: '#operate'}
37
+
38
+        ]]
39
+    });
40
+
41
+
42
+    // 列表点击放大图片
43
+    $('.layui-table-main').on('click','.layui_magnify', function(){
44
+        var _src = $(this).attr('src');
45
+        layui.layer.open({
46
+            type: 1,
47
+            title: false,           //是否显示标题
48
+            area: ['95%', '55%'],
49
+            shade: 0.6,           //透明度
50
+            closeBtn: 1,         //按钮 1有,0无
51
+            shadeClose: true,
52
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
53
+        });
54
+    });
55
+
56
+
57
+    //监听指定开关
58
+    form.on('switch(switchTest)', function(data){
59
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
60
+            $.post('/knowledge/newsdelandshow',{id:data.value,type:'show'},function (data) {
61
+                layer.msg(data.msg);
62
+                table.reload('tablerReload');
63
+
64
+            })
65
+        },function (aa) {
66
+            table.reload('tablerReload');        //重新加载
67
+        })
68
+    });
69
+
70
+
71
+    //列表操作
72
+    table.on('tool('+tableIds+')', function(obj){
73
+        var layEvent = obj.event,
74
+            data = obj.data;
75
+
76
+        if(layEvent === 'sortData'){       //修改排序
77
+             table.on('edit('+tableIds+')', function(obj){
78
+                var data = obj.data;
79
+                // console.log(data)
80
+                $.post('/knowledge/newsdelandshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
81
+                    if(data.code == 200)
82
+                    {
83
+                        layer.msg(data.msg);
84
+                    } else if(data.code == 300 ) {
85
+                        layer.msg(data.msg);
86
+                    }
87
+                })
88
+            })
89
+            // layer.prompt({
90
+            //     formType: 2
91
+            //     ,title: '排序'
92
+            //     ,value: data.sort
93
+            // }, function(value, index){
94
+
95
+            //     $.post('/pushnews/newsdelandshow',{id:data.id,type:'sort',sort:value},function (data) {
96
+            //         layer.msg(data.msg);
97
+            //         table.reload('tablerReload');
98
+            //     })
99
+            // });
100
+        }else if(layEvent === 'del') {
101
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
102
+                $.post('/knowledge/newsdelandshow',{id:data.id,type:'del'},function (data) {
103
+                    layer.msg(data.msg);
104
+                    table.reload('tablerReload');
105
+                })
106
+            })
107
+        } else if(layEvent === 'edit'){
108
+            var index = layer.open({
109
+                type: 2,
110
+                title: '编辑',
111
+                area:['800px','500px'],
112
+                content: '/pushfresh/freshcityedit?id='+data.id+'&name='+data.city_name,
113
+                end:function () {
114
+                    table.reload('tablerReload');        //重新加载
115
+                }
116
+            });
117
+        } else if(layEvent === 'Relation'){
118
+            var index =layui.layer.open({
119
+                title :'<span style="color:red" >['+data.city_name+']</span>区域相关楼盘',
120
+                type : 2,
121
+                area:['','100%'],
122
+                maxmin: true,
123
+                content : "/pushfresh/cityhouse?id="+data.city_id,
124
+                end:function () {
125
+                    table.reload('tablerReload');
126
+                }
127
+            })
128
+            layui.layer.full(index);
129
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
130
+            $(window).on("resize",function(){
131
+                layui.layer.full(index);
132
+            })
133
+        }
134
+
135
+
136
+    });
137
+
138
+    //添加图片上传
139
+    upload.render({
140
+        elem: '#test1'
141
+        ,url: '/house/createimg'
142
+        ,data:{token:csrfToken}
143
+        ,field:'img'
144
+        ,size:1000              //限制上传图片的大小,单位为KB
145
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
146
+        ,auto:false
147
+        ,bindAction:'#addcity'
148
+        ,choose: function(obj){
149
+            obj.preview(function(index, file, result){
150
+                $('#breviary_img').attr('src', result); //图片链接(base64)
151
+            });
152
+        }
153
+    });
154
+    // 图片放大浏览
155
+    $('.layui_magnify').click(function(){
156
+        var _src = $(this).attr('src');
157
+        layui.layer.open({
158
+            type: 1,
159
+            title: false,           //是否显示标题
160
+            area: ['60%', '80%'],
161
+            shade: 0.6,           //透明度
162
+            closeBtn: 1,         //按钮 1有,0无
163
+            shadeClose: true,
164
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
165
+        });
166
+    })
167
+
168
+    // 新增
169
+    var $ = layui.$, active = {
170
+        addData: function(){ //获取选中数据
171
+            var index = layui.layer.open({
172
+                type: 2,
173
+                title: '添加',
174
+                closeBtn: 1, //不显示关闭按钮
175
+                area: ['800px','500px'],
176
+                content: '/knowledge/poneadd?type='+type_id //iframe的url,no代表不显示滚动条
177
+                ,success:function (layero, index) {
178
+                },
179
+                end:function () {
180
+                    table.reload('tablerReload');
181
+                }
182
+            });
183
+        },
184
+        reload:function(){//搜索
185
+            var form = pfgs_serialize($('form'));
186
+            var name = '';
187
+            var house_name   = '';
188
+            if(form.input_house == 'name'){
189
+                name = form.input_house_text;
190
+            } else if(form.input_house == 'house_name'){
191
+                house_name = form.input_house_text;
192
+            }
193
+            table.reload('tablerReload',{
194
+                where:{
195
+                    title:name,
196
+                    house_name:house_name,
197
+                    city:form.input_city,
198
+                    type_name:form.type_name
199
+                }
200
+            })
201
+        },
202
+    };
203
+    $('.demoTable .layui-btn').on('click', function(){
204
+        var type = $(this).data('type');
205
+        active[type] ? active[type].call(this) : '';
206
+    });
207
+
208
+
209
+    $('.The_house').focus(function(){
210
+        indexOpen = parent.layui.layer.open({
211
+            type: 2,
212
+            title: '选择需要添加的资讯',
213
+            area: ['','100%'],
214
+            content: '/publicuse/news?type=1', //1单选
215
+            success:function (layero, index) {
216
+            },
217
+            end:function(){
218
+            }
219
+        });
220
+        parent.layui.layer.full(indexOpen);
221
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
222
+        $(window).on("resize",function(){
223
+            parent.layui.layer.full(indexOpen);
224
+        })
225
+    })
226
+
227
+
228
+
229
+    //添加页面提交数据
230
+    form.on('submit(add)', function(data){
231
+        var formData = new FormData($('form')[0]);
232
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
233
+        $.ajax({
234
+            type : "post",
235
+            url : "/knowledge/poneaddform",
236
+            data : formData,
237
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
238
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
239
+            error : function(request) {
240
+                layer.close(index);
241
+                layer.msg("请联系管理员");
242
+            },
243
+            success : function(data) {
244
+                if(data.data != null){
245
+                    layer.msg(ReturnInfo(data.data),{icon:5});
246
+                    return ;
247
+                }
248
+                layer.msg(data.msg);
249
+                parent.layer.close(oindex); //再执行关闭
250
+            }
251
+        });
252
+        return false;
253
+    });
254
+
255
+    form.on('submit(edit_city)', function(data){
256
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
257
+        var formData = new FormData($('form')[0]);
258
+        $.ajax({
259
+            type : "post",
260
+            url : "/pushfresh/freshcityeditform",
261
+            data : formData,
262
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
263
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
264
+            error : function(request) {
265
+                layer.close(index);
266
+                layer.msg("请联系管理员");
267
+            },
268
+            success : function(data) {
269
+                if(data.data != null){
270
+                    layer.msg(ReturnInfo(data.data),{icon:5});
271
+                    return ;
272
+                }
273
+                layer.msg(data.msg);
274
+                parent.layer.close(oindex); //再执行关闭
275
+            }
276
+        });
277
+        return false;
278
+    });
279
+})

+ 148 - 0
backend/web/js/other/fixedinfo.js

@@ -0,0 +1,148 @@
1
+
2
+layui.use([ 'laypage', 'layer', 'table',  'element','form'], function(){
3
+
4
+    var laypage = layui.laypage //分页
5
+        ,$ = layui.jquery
6
+        ,layer = layui.layer //弹层
7
+        ,table = layui.table //表格
8
+        ,element = layui.element //元素操作
9
+        ,form = layui.form;
10
+
11
+    var port_id = $('input[name="port"]').val();
12
+    //第一个实例
13
+    table.render({
14
+        elem: '#menulist'
15
+        ,url: '/othersiteset/fixedinfoform' //数据接口
16
+        ,where:{token:csrfToken,port:port_id}
17
+        ,method:'post'
18
+        ,page: true //开启分页
19
+        ,height:600
20
+        ,text:'数据加载中'
21
+        ,id:'linkId'
22
+        ,cols: [[ //表头
23
+            {type:'numbers'}
24
+            ,{field: 'keys', title: 'keys名称', align:'center'}
25
+            ,{field: 'values', title: '简体内容', align:'center'}
26
+            ,{field: 'values_ft', title: '繁体内容', align:'center'}
27
+            ,{field: 'type', title: '位置', align:'center'}
28
+            ,{fixed: 'right',title:'操作', width: 200, align:'center', toolbar: '#operate'}
29
+        ]]
30
+    });
31
+
32
+
33
+    //列表操作
34
+    table.on('tool(menulist)', function(obj){
35
+        var layEvent = obj.event,
36
+            data = obj.data;
37
+        if(layEvent === 'edit'){
38
+            layer.open({
39
+                type: 2,
40
+                title: '修改',
41
+                closeBtn: 1, //不显示关闭按钮
42
+                shade: [0],
43
+                area: ['600px', '500px'],
44
+                anim: 2,
45
+                content:'/othersiteset/fixedinfosave?port='+port_id+'&id='+data.id, //iframe的url,no代表不显示滚动条
46
+                end:function () {
47
+                        table.reload('linkId');
48
+                }
49
+            });
50
+        } else if(layEvent === 'del') {
51
+
52
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
53
+                $.post('/othersiteset/fixedinfodelform',{'id':data.id},function (data) {
54
+                    if(data.data != null){
55
+                        layer.msg(ReturnInfo(data.data),{icon:5});
56
+                        return ;
57
+                    }
58
+                    layer.msg(data.msg);
59
+                    table.reload('linkId');
60
+                })
61
+            })
62
+
63
+        }
64
+    });
65
+
66
+
67
+
68
+
69
+    var $ = layui.$, active = {
70
+        addData: function(){ //获取选中数据
71
+            layer.open({
72
+                type: 2,
73
+                title: '添加',
74
+                closeBtn: 1, //不显示关闭按钮
75
+                shade: [0],
76
+                area: ['600px', '500px'],
77
+                anim: 2,
78
+                content: '/othersiteset/fixedinfoadd?port='+port_id, //iframe的url,no代表不显示滚动条
79
+                end: function(){ //此处用于演示
80
+                    table.reload('linkId');
81
+                }
82
+            });
83
+        },
84
+        reload:function () {
85
+            var form = pfgs_serialize($('form'));
86
+            console.log(form);
87
+            var keys = '';
88
+            var values   = '';
89
+            // console.log($('form').serializeArray());
90
+            if(form.input_house == 'name'){
91
+                keys = form.input_house_text;
92
+            } else if(form.input_house == 'id'){
93
+                values = form.input_house_text;
94
+            }
95
+
96
+            table.reload('linkId',{
97
+                where:{
98
+                    values:values,
99
+                    keys:keys,
100
+                    type:form.typearray,
101
+                    port:port_id,
102
+                },
103
+                page:{
104
+                    curr:1
105
+                }
106
+            })
107
+        }
108
+    };
109
+
110
+    // 转换拼音
111
+    $('.layui_w_name').on('keyup ',function(){
112
+        var _txt = $(this).val();
113
+        $.post('/othersiteset/cnvert',{'data':_txt},function (data) {
114
+            if(data.code == '200'){
115
+                $('input[name="values_ft"]').val(data.data.content);
116
+            }
117
+        })
118
+    })
119
+
120
+
121
+    $('.demoTable .layui-btn').on('click', function(){
122
+        var type = $(this).data('type');
123
+        active[type] ? active[type].call(this) : '';
124
+    });
125
+
126
+    form.on('submit(save_link)', function(data){
127
+        $.post('/othersiteset/fixedinfosaveform',data.field,function (data) {
128
+            if(data.data != null){
129
+                layer.msg(ReturnInfo(data.data),{icon:5});
130
+                return ;
131
+            }
132
+            layer.msg(data.msg);
133
+        })
134
+        return false;
135
+    });
136
+
137
+    form.on('submit(tijiao)', function(data){
138
+        $.post('/othersiteset/fixedinfoaddform',data.field,function (data) {
139
+            if(data.data != null){
140
+                layer.msg(ReturnInfo(data.data),{icon:5});
141
+                return ;
142
+            }
143
+            layer.msg(data.msg);
144
+        })
145
+        return false;
146
+    });
147
+
148
+});

+ 228 - 0
backend/web/js/other/telrecord.js

@@ -0,0 +1,228 @@
1
+
2
+layui.use([ 'laypage', 'layer', 'table',  'element','form','treetable'], function(){
3
+
4
+    var laypage = layui.laypage //分页
5
+        ,$ = layui.jquery
6
+        ,layer = layui.layer //弹层
7
+        ,table = layui.table //表格
8
+        ,element = layui.element //元素操作
9
+        ,form = layui.form
10
+        ,treetable = layui.treetable;
11
+
12
+
13
+
14
+
15
+    //第一个实例
16
+    table.render({
17
+        elem: '#menulist'
18
+        ,url: '/othertel/recordform' //数据接口
19
+        ,where:{token:csrfToken}
20
+        ,method:'post'
21
+        ,page: true //开启分页
22
+        ,height:600
23
+        ,id:'tablerReload'
24
+        ,limit:20
25
+        ,text:'数据加载中'
26
+        ,cols: [[ //表头
27
+            {type:'numbers',title:'序号'}
28
+            ,{field: 'user_name', title: '操作人', align:'center',width:200}
29
+            ,{field: 'name', title: '方案名称', align:'center',width:200}
30
+            ,{field: 'front', title: '操作前', align:'left'}
31
+            ,{field: 'after', title: '操作后', align:'left'}
32
+            ,{field: 'type', title: '操作类型', align:'left'}
33
+            // ,{fixed: 'right',title:'操作', width: 200, align:'center', toolbar: '#operate'}
34
+        ]]
35
+    });
36
+
37
+    table.reload('tablerReload');        //重新加载
38
+
39
+
40
+    //列表操作
41
+    table.on('tool(menulist)', function(obj){
42
+        var layEvent = obj.event,
43
+            data = obj.data;
44
+        if(layEvent === 'edit'){
45
+            layer.open({
46
+                type: 2,
47
+                title: '修改方案',
48
+                closeBtn: 1, //不显示关闭按钮
49
+                shade: [0],
50
+                area: ['600px', '500px'],
51
+                anim: 2,
52
+                content:'/othertel/edit?id='+data.id,
53
+                end:function () {
54
+                    table.reload('tablerReload');
55
+                }
56
+            });
57
+        } else if(layEvent === 'del') {
58
+
59
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
60
+                $.post('/othertel/del',{'id':data.id},function (data) {
61
+                    layer.msg(data.msg);
62
+                    table.reload('tablerReload');
63
+                })
64
+            })
65
+
66
+        }else if(layEvent === 'tel_city'){
67
+            layer.open({
68
+                type: 2,
69
+                title: '添加区域',
70
+                closeBtn: 1, //不显示关闭按钮
71
+                shade: [0],
72
+                area: ['600px', '500px'],
73
+                anim: 2,
74
+                content:'/othertel/cityascription?id='+data.id, //iframe的url,no代表不显示滚动条
75
+            });
76
+        }
77
+
78
+
79
+    });
80
+
81
+
82
+    table.on('tool(citytellist)', function(obj){
83
+        var layEvent = obj.event,
84
+            data = obj.data;
85
+       if(layEvent === 'tel_city'){
86
+            layer.open({
87
+                type: 2,
88
+                title: '加载方案',
89
+                closeBtn: 1, //不显示关闭按钮
90
+                shade: [0],
91
+                area: ['600px', '500px'],
92
+                anim: 2,
93
+                content:'/othertel/cityascription?id='+data.id,
94
+                end:function () {
95
+                    renderTable();
96
+                }
97
+            });
98
+        }
99
+    });
100
+
101
+    var $ = layui.$, active = {
102
+        addData: function(){ //获取选中数据
103
+
104
+            layer.open({
105
+                type: 2,
106
+                title: '添加电话',
107
+                closeBtn: 1, //不显示关闭按钮
108
+                shade: [0],
109
+                area: ['600px', '500px'],
110
+                anim: 2,
111
+                content: '/othertel/add', //iframe的url,no代表不显示滚动条
112
+                end: function(){ //此处用于演示
113
+                    table.reload('tablerReload');
114
+                }
115
+            });
116
+        },
117
+        reload:function () {
118
+            var form = pfgs_serialize($('form'));
119
+            var name = '';
120
+            var tel   = '';
121
+            // console.log($('form').serializeArray());
122
+            if(form.input_house == 'name'){
123
+                name = form.input_house_text;
124
+            } else if(form.input_house == 'user_name'){
125
+                tel = form.input_house_text;
126
+            }
127
+
128
+            table.reload('tablerReload',{
129
+                where:{
130
+                    name:name,
131
+                    user_name:tel,
132
+                    type:form.type
133
+                },
134
+                page:{
135
+                    curr:1
136
+                }
137
+            })
138
+        },
139
+        record:function () {
140
+            var index = layui.layer.open({
141
+                title : "操作记录",
142
+                type : 2,
143
+                area:['','100%'],
144
+                maxmin: true,
145
+                content : "/house/create.html",
146
+            })
147
+
148
+            layui.layer.full(index);
149
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
150
+            $(window).on("resize",function(){
151
+                layui.layer.full(index);
152
+            })
153
+        }
154
+
155
+    };
156
+
157
+    $('.demoTable .layui-btn').on('click', function(){
158
+        var type = $(this).data('type');
159
+        active[type] ? active[type].call(this) : '';
160
+    });
161
+
162
+    form.on('submit(edittel)', function(data){
163
+        $.post('/othertel/editform',{'data':data.field},function (data) {
164
+            if(data.code == 200)
165
+            {
166
+                layer.msg(data.msg);
167
+                parent.layui.table.reload('menulist');
168
+            } else if(data.code == 300 ) {
169
+                layer.msg(data.msg);
170
+                layer.msg(ReturnInfo(data.data),{icon:5});
171
+            }
172
+        })
173
+        return false;
174
+    });
175
+
176
+    form.on('submit(tijiao)', function(data){
177
+        $.post('/othertel/addform',{'data':data.field},function (data) {
178
+            if(data.code == 200)
179
+            {
180
+                layer.msg(data.msg);
181
+                parent.layui.table.reload('menulist');
182
+                // TableClose();
183
+            } else if(data.code == 300 ) {
184
+                layer.msg(data.msg);
185
+                layer.msg(ReturnInfo(data.data),{icon:5});
186
+            }
187
+        })
188
+        return false;
189
+    });
190
+
191
+
192
+
193
+    form.on('submit(unload_tel)', function(data){
194
+        var index = top.layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
195
+
196
+        var formData = new FormData($('#cityForm')[0]);
197
+
198
+        $.ajax({
199
+            cache : true,
200
+            type : "post",
201
+            url : "/othertel/addcityascription",
202
+            data : formData,  // 你的formid
203
+            async : false,
204
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
205
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
206
+            error : function(request) {
207
+                top.layer.close(index);         //关闭数据提交信息
208
+                layer.alert("网络超时");
209
+            },
210
+            success : function(data) {
211
+                top.layer.close(index);       //关闭数据提交信息
212
+                if (data.code == 200) {
213
+                    layer.msg(data.msg);
214
+                    parent.layui.table.reload('menulist');
215
+                    // TableClose();
216
+
217
+                } else if(data.code == 300){
218
+                    layer.msg(data.msg);
219
+                    if(data.data.length > 0){
220
+                        layer.msg(ReturnInfo(data.data),{icon:5});
221
+                    }
222
+                }
223
+            }
224
+        });
225
+        return false;
226
+    });
227
+
228
+});

+ 149 - 0
backend/web/js/publicuse/cncity.js

@@ -0,0 +1,149 @@
1
+var indexOpen;
2
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
3
+
4
+    var laypage = layui.laypage //分页
5
+        ,$ = layui.jquery
6
+        ,layer = layui.layer //弹层
7
+        ,table = layui.table //表格
8
+
9
+
10
+    var tableIds = 'videolist';  //表格ID
11
+
12
+    var $ = layui.$, active = {
13
+        house_reload:function(){
14
+            var form = pfgs_serialize($('form'));
15
+            console.log(form);
16
+            table.reload('houseReload',{
17
+                where:{
18
+                    name:form.input_house_text
19
+                }
20
+            })
21
+        }
22
+    };
23
+
24
+    $('.demoTable .layui-btn').on('click', function(){
25
+        var type = $(this).data('type');
26
+        active[type] ? active[type].call(this) : '';
27
+    });
28
+
29
+    // $('.The_house').focus(function(){
30
+    //     indexOpen = parent.layui.layer.open({
31
+    //         type: 2,
32
+    //         title: '选择需要添加的楼盘',
33
+    //         area: ['','100%'],
34
+    //         content: '/routinevideo/allhouse',
35
+    //         success:function (layero, index) {
36
+    //         },
37
+    //         end:function(){
38
+    //         }
39
+    //     });
40
+    //     parent.layui.layer.full(indexOpen);
41
+    //     //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
42
+    //     $(window).on("resize",function(){
43
+    //         parent.layui.layer.full(indexOpen);
44
+    //     })
45
+    // })
46
+
47
+    table.render({
48
+        elem: '#houselist'
49
+        ,url: '/publicuse/allcncity' //数据接口
50
+        ,where:{token:csrfToken}
51
+        ,method:'post'
52
+        ,page: true //开启分页
53
+        ,limit : 20
54
+        ,text:'数据加载中'
55
+        ,id:'houseReload'
56
+        ,cols: [[ //表头
57
+            {type: "checkbox", width:50},
58
+            // {title:'选择',event:'checkbox',width:50,align:'center',templet:"#checkBox",templet:function(d){
59
+            //         return '<div class="layui-inline" style="width: 100%"><input type="checkbox" name="sex" ></div>'
60
+            //     }},
61
+            {type:'numbers',title:'序号'},
62
+            {field: 'city_name', title: '区域名称', align:'center'},
63
+        ]]
64
+    });
65
+
66
+    //选择所属楼盘添加
67
+    var _data = [];
68
+    // table.on('tool(houselist)', function(obj){
69
+    //     var layEvent = obj.event,
70
+    //         data = obj.data;
71
+    //     if(layEvent === 'check'){
72
+    //         console.log($(this).children('input'));
73
+    //
74
+    //         if($(this).checked)
75
+    //         {
76
+    //             _data.push(data);
77
+    //             console.log(_data)
78
+    //         }
79
+    //         // _data = data;
80
+    //
81
+    //
82
+    //     }
83
+    // });
84
+
85
+
86
+    table.on('checkbox(houselist)', function(obj){
87
+
88
+        if(obj.checked == true){
89
+            _data.push(obj.data);
90
+        }
91
+        if(obj.checked == false){
92
+            var del = [];
93
+            $.each(_data,function(key,val){
94
+                console.log(val.city_name);
95
+                if(val.city_name == obj.data.city_name){
96
+                    del.push(key);
97
+                }
98
+            })
99
+
100
+            if(del.length >0){
101
+                $.each(del,function(key,val){
102
+                    console.log(key);
103
+                    _data.splice(key,1);
104
+                })
105
+            }
106
+        }
107
+    });
108
+
109
+
110
+    // 提交按钮
111
+    $('.xuanzhouse').click(function () {
112
+        var a =  parent.layer.getChildFrame('body', indexOpen);
113
+
114
+        var type = $('#types').html();
115
+        console.log(type);
116
+        if(type == 1){
117
+            var _length = a.find('input#hiddenBox[type="hidden"]');
118
+
119
+            if(_length.length > 0){
120
+                _length.remove();
121
+            }
122
+            if(_data.length > 1){
123
+                layer.msg('请勿选择多个');
124
+                return ;
125
+            }
126
+            console.log(_data[0].city_name);
127
+            a.find('#house_name').val(_data[0].city_name)
128
+            a.find('form').append('<input type="hidden" id="hiddenBox" name="city_id" value="'+_data[0].id+'" />');
129
+        } else {
130
+            a.find('tbody').html('');
131
+            if(typeof _data == 'object'){
132
+                for(var i=0;i<_data.length;i++){
133
+                    var tr ='<tr>'
134
+                        +'<td lay-event="del">'
135
+                        +'<div class="layui-table-cell del"><i class="layui-icon" style="font-size: 30px; color: #1E9FFF;cursor: pointer">&#xe640;</i></div>'
136
+                        +'</td>'
137
+                        +'<td data-field="matingName" align="center" data-content="">'
138
+                        +'<div class="layui-table-cell"><input type="text" name="matingName" value="'+_data[i].city_name+'" autocomplete="off" class="layui-input" ><input type="hidden" name="id" value="'+_data[i].id+'"></div>'
139
+                        +'</td>'
140
+                        +'</tr>'
141
+                    a.find('tbody').append(tr);
142
+                }
143
+            }
144
+        }
145
+        TableClose();
146
+    })
147
+
148
+
149
+});

+ 114 - 0
backend/web/js/publicuse/cnnews.js

@@ -0,0 +1,114 @@
1
+var indexOpen;
2
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
3
+
4
+    var laypage = layui.laypage //分页
5
+        ,$ = layui.jquery
6
+        ,layer = layui.layer //弹层
7
+        ,table = layui.table //表格
8
+
9
+
10
+    var tableIds = 'videolist';  //表格ID
11
+
12
+    var $ = layui.$, active = {
13
+        house_reload:function(){
14
+            var form = pfgs_serialize($('form'));
15
+            console.log(form);
16
+            table.reload('houseReload',{
17
+                where:{
18
+                    subject:form.input_house_text
19
+                }
20
+            })
21
+        }
22
+    };
23
+
24
+    $('.demoTable .layui-btn').on('click', function(){
25
+        var type = $(this).data('type');
26
+        active[type] ? active[type].call(this) : '';
27
+    });
28
+
29
+    var indexO = table.render({
30
+        elem: '#houselist'
31
+        ,url: '/publicuse/cnnewsform' //数据接口
32
+        ,where:{token:csrfToken}
33
+        ,method:'post'
34
+        ,page: true //开启分页
35
+        ,text:'数据加载中'
36
+        ,id:'houseReload'
37
+        ,limit : 20
38
+        ,cols: [[ //表头
39
+            {type: "checkbox", width:50},
40
+            // {title:'选择',event:'checkbox',width:50,align:'center',templet:"#checkBox",templet:function(d){
41
+            //         return '<div class="layui-inline" style="width: 100%"><input type="checkbox" name="sex" ></div>'
42
+            //     }},
43
+            {type:'numbers',title:'序号'},
44
+            {field: 'subject', title: '资讯名称', align:'center'},
45
+        ]]
46
+    });
47
+
48
+    //选择所属楼盘添加
49
+    var _data = [];
50
+
51
+    table.on('checkbox(houselist)', function(obj){
52
+
53
+        if(obj.checked == true){
54
+            _data.push(obj.data);
55
+        }
56
+        if(obj.checked == false){
57
+            var del = [];
58
+            $.each(_data,function(key,val){
59
+                console.log(val.subject);
60
+                if(val.subject == obj.data.subject){
61
+                    del.push(key);
62
+                }
63
+            })
64
+
65
+            if(del.length >0){
66
+                $.each(del,function(key,val){
67
+                    console.log(key);
68
+                    _data.splice(key,1);
69
+                })
70
+            }
71
+        }
72
+    });
73
+
74
+
75
+    // 提交按钮
76
+    $('.xuanzhouse').click(function () {
77
+        var a =  parent.layer.getChildFrame('body', indexOpen);
78
+
79
+        var type = $('#types').html();
80
+        // console.log(type);
81
+        if(type == 1){
82
+            var _length = a.find('input#hiddenBox[type="hidden"]');
83
+
84
+            if(_length.length > 0){
85
+                _length.remove();
86
+            }
87
+            if(_data.length > 1){
88
+                layer.msg('请勿选择多个');
89
+                return ;
90
+            }
91
+            console.log(_data[0].subject);
92
+            a.find('#house_name').val(_data[0].subject)
93
+            a.find('form').append('<input type="hidden" id="hiddenBox" name="nid" value="'+_data[0].id+'" />');
94
+        } else {
95
+            a.find('tbody').html('');
96
+            if(typeof _data == 'object'){
97
+                for(var i=0;i<_data.length;i++){
98
+                    var tr ='<tr>'
99
+                        +'<td lay-event="del">'
100
+                        +'<div class="layui-table-cell del"><i class="layui-icon" style="font-size: 30px; color: #1E9FFF;cursor: pointer">&#xe640;</i></div>'
101
+                        +'</td>'
102
+                        +'<td data-field="matingName" align="center" data-content="">'
103
+                        +'<div class="layui-table-cell"><input type="text" name="matingName" value="'+_data[i].city_name+'" autocomplete="off" class="layui-input" ><input type="hidden" name="id" value="'+_data[i].id+'"></div>'
104
+                        +'</td>'
105
+                        +'</tr>'
106
+                    a.find('tbody').append(tr);
107
+                }
108
+            }
109
+        }
110
+        TableClose();
111
+    })
112
+
113
+
114
+});

+ 154 - 0
backend/web/js/publicuse/housecn.js

@@ -0,0 +1,154 @@
1
+var indexOpen;
2
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () {
3
+
4
+    var laypage = layui.laypage //分页
5
+        , $ = layui.jquery
6
+        , table = layui.table //表格
7
+
8
+
9
+    var tableIds = 'videolist';  //表格ID
10
+
11
+    var $ = layui.$, active = {
12
+        house_reload: function () {
13
+            var form = pfgs_serialize($('form'));
14
+            console.log(form);
15
+            table.reload('houseReload', {
16
+                where: {
17
+                    name: form.input_house_text
18
+                }
19
+            })
20
+        }
21
+    };
22
+
23
+    $('.demoTable .layui-btn').on('click', function () {
24
+        var type = $(this).data('type');
25
+        active[type] ? active[type].call(this) : '';
26
+    });
27
+
28
+    $('.The_house').focus(function () {
29
+        indexOpen = parent.layui.layer.open({
30
+            type: 2,
31
+            title: '选择需要添加的楼盘',
32
+            area: ['', '100%'],
33
+            content: '/routinevideo/allhouse',
34
+            success: function (layero, index) {
35
+            },
36
+            end: function () {
37
+            }
38
+        });
39
+        parent.layui.layer.full(indexOpen);
40
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
41
+        $(window).on("resize", function () {
42
+            parent.layui.layer.full(indexOpen);
43
+        })
44
+    })
45
+
46
+    var indexO = table.render({
47
+        elem: '#houselist'
48
+        , url: '/publicuse/allhousecnform' //数据接口
49
+        , where: {token: csrfToken}
50
+        , method: 'post'
51
+        , page: true //开启分页
52
+        , text: '数据加载中'
53
+        , id: 'houseReload'
54
+        , cols: [[ //表头
55
+            {
56
+                title: '选择', event: 'check', width: 60, align: 'center', templet: "#checkBox", templet: function (d) {
57
+                    return '<div class="layui-inline"><input type="radio" name="sex" ></div>'
58
+                }
59
+            },
60
+            {type: 'numbers', title: '序号'},
61
+            {field: 'name', title: '楼盘名称', align: 'center'},
62
+        ]]
63
+    });
64
+
65
+    //选择所属楼盘添加
66
+    var _data;
67
+    table.on('tool(houselist)', function (obj) {
68
+        var layEvent = obj.event,
69
+            data = obj.data;
70
+        if (layEvent === 'check') {
71
+            _data = data;
72
+        }
73
+    });
74
+    // 提交按钮
75
+    $('.xuanzhouse').click(function () {
76
+        var a = parent.layer.getChildFrame('body', indexOpen);
77
+        if (a.find('#feng_houseall').length <= 0) {
78
+            // var a =  parent.layer.getChildFrame('body', indexOpen);
79
+            var _length = a.find('input#hiddenBox[type="hidden"]');
80
+            if (_length.length > 0) {
81
+                _length.remove();
82
+            }
83
+            if (typeof _data == 'object') {
84
+
85
+                a.find('#house_name').val(_data.name)
86
+                a.find('form').append('<input type="hidden" id="hiddenBox" name="hid" value="' + _data.id + '" />');
87
+                TableClose();
88
+            }
89
+        } else {
90
+            ;
91
+            // var checkStatus = table.checkStatus('houseReload');
92
+            // var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
93
+            // var a =  parent.layer.getChildFrame('body', indexOpen);
94
+            var _length = a.find('input#hiddenBox[type="hidden"]');
95
+            if (_length.length > 0) {
96
+                _length.remove();
97
+            }
98
+            if (typeof _data == 'object') {
99
+
100
+                var formdat = new FormData();
101
+
102
+                var htmlStr = '';
103
+
104
+                // $.each(checkStatus.data,function (key,val) {
105
+                htmlStr += '<tr><td>' + _data.name + ' <input type="hidden" name="hid[]" value="' + _data.id + '" ></td><td class="feng_houseallnamedel">  <a class="layui-btn layui-btn-danger layui-btn-xs" >删除</a></td></tr>';
106
+                // })
107
+                var tb = $('.layui-table').length;
108
+                var html = '';
109
+                if (a.find('.layui-table').length <= 0) {
110
+                    html += '  <table class="layui-table">\n' +
111
+                        '                <colgroup>\n' +
112
+                        '                    <col width="150">\n' +
113
+                        '                    <col width="50">\n' +
114
+                        '                    <col>\n' +
115
+                        '                </colgroup>\n' +
116
+                        '                <thead>\n' +
117
+                        '                <tr>\n' +
118
+                        '                    <th>楼盘名称</th>\n' +
119
+                        '                    <th>操作</th>\n' +
120
+                        '                </tr>\n' +
121
+                        '                </thead>\n' +
122
+                        '                <tbody>\n' +
123
+                        htmlStr +
124
+                        '                </tbody>\n' +
125
+                        '               \n' +
126
+                        '            </table>';
127
+                }
128
+                if (a.find('.layui-table').length > 0) {
129
+                    a.find('.layui-table').append(htmlStr);
130
+                } else {
131
+                    a.find('#feng_houseall').append(html);
132
+                }
133
+                TableClose();
134
+                return false;
135
+            }
136
+            layer.msg('请选择楼盘', {icon: 5});
137
+            return false;
138
+
139
+
140
+            var _length = a.find('input#hiddenBox[type="hidden"]');
141
+            if (_length.length > 0) {
142
+                _length.remove();
143
+            }
144
+            if (typeof _data == 'object') {
145
+                a.find('#house_name').val(_data.name)
146
+                a.find('form').append('<input type="hidden" id="hiddenBox" name="hid" value="' + _data.id + '" />');
147
+                TableClose();
148
+            }
149
+        }
150
+
151
+    })
152
+
153
+
154
+});

+ 282 - 0
backend/web/js/push/hotrotation.js

@@ -0,0 +1,282 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'videolist';  //表格ID
13
+    //第一个实例
14
+    table.render({
15
+        elem: '#'+tableIds
16
+        ,url: '/push/hotrotationforms' //数据接口
17
+        ,where:{token:csrfToken}
18
+        ,method:'post'
19
+        ,page: true //开启分页
20
+        ,height:600
21
+        ,text:'数据加载中'
22
+        ,id:'tablerReload'
23
+        ,cols: [[ //表头
24
+            {type:'numbers',title:'序号',width:50},
25
+            {field: 'title', title: '轮播标题', align:'center'},
26
+            {field: 'name', title: '归属楼盘名称', align:'center'},
27
+            {field: 'img', title: '图片',width:200, align:'center',templet:function(d){
28
+                return '<img class="layui_magnify" src="'+d.img+'"/>'
29
+            }}
30
+            ,
31
+            {field: 'img_ft', title: '繁体图片',width:200, align:'center',templet:function(d){
32
+                return '<img class="layui_magnify" src="'+d.img_ft+'"/>'
33
+            }}
34
+            ,    {field: 'url', title: '地址',width:200, align:'center',templet:function(d){
35
+                    return '<a href="'+d.url+'" target="_blank">'+d.url+'</a>';
36
+                }}
37
+            ,{field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"}
38
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
39
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
40
+                    if(d.is_show == 2){
41
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
42
+                    } else {
43
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
44
+                    }
45
+                }}
46
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
47
+
48
+        ]]
49
+    });
50
+
51
+    table.reload('tablerReload');        //重新加载
52
+
53
+    // 列表点击放大图片
54
+    $('.layui-table-main').on('click','.layui_magnify', function(){
55
+        var _src = $(this).attr('src');
56
+        layui.layer.open({
57
+            type: 1,
58
+            title: false,           //是否显示标题
59
+            area: ['95%', '55%'],
60
+            shade: 0.6,           //透明度
61
+            closeBtn: 1,         //按钮 1有,0无
62
+            shadeClose: true,
63
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
64
+        });
65
+    });
66
+
67
+
68
+    //监听指定开关
69
+    form.on('switch(switchTest)', function(data){
70
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
71
+            $.post('/push/hotimgdelshow',{id:data.value,type:'show'},function (data) {
72
+                layer.msg(data.msg);
73
+                table.reload('tablerReload');
74
+
75
+            })
76
+        },function (aa) {
77
+            table.reload('tablerReload');        //重新加载
78
+        })
79
+    });
80
+
81
+
82
+     //列表操作
83
+    table.on('tool('+tableIds+')', function(obj){
84
+        var layEvent = obj.event,
85
+            data = obj.data;
86
+        if(layEvent === 'edit'){
87
+           var index = layer.open({
88
+                type: 2,
89
+                title: '修改轮播图',
90
+                area:['800px','500px'],
91
+                content: '/push/hotrotationedit?id='+data.id+'&house_name='+data.name,
92
+                end:function () {
93
+                    table.reload('tablerReload');        //重新加载
94
+                }
95
+            });
96
+        } else if(layEvent === 'del') {
97
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
98
+                $.post('/push/hotimgdelshow',{id:data.id,type:'del'},function (data) {
99
+                    layer.msg(data.msg);
100
+                    table.reload('tablerReload');
101
+                })
102
+            })
103
+        }else if(layEvent === 'sortData'){       //修改排序
104
+             table.on('edit('+tableIds+')', function(obj){
105
+                var data = obj.data;
106
+                $.post('/push/hotimgdelshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
107
+                    if(data.code == 200)
108
+                    {
109
+                        layer.msg(data.msg);
110
+                    } else if(data.code == 300 ) {
111
+                        layer.msg(data.msg);
112
+                    }
113
+                })
114
+            })
115
+        }
116
+
117
+    });
118
+
119
+    //添加图片上传
120
+    upload.render({
121
+         elem: '#test1'
122
+        ,url: '/house/createimg'
123
+        ,data:{token:csrfToken}
124
+        ,field:'img'
125
+        ,size:1000              //限制上传图片的大小,单位为KB
126
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
127
+        ,auto:false
128
+        ,bindAction:'#addcity'
129
+        ,choose: function(obj){
130
+            obj.preview(function(index, file, result){
131
+                $('#breviary_img').attr('src', result); //图片链接(base64)
132
+            });
133
+        }
134
+    });
135
+        //添加图片上传
136
+    upload.render({
137
+         elem: '#test2'
138
+        ,url: '/house/createimg'
139
+        ,data:{token:csrfToken}
140
+        ,field:'img_ft'
141
+        ,size:1000              //限制上传图片的大小,单位为KB
142
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
143
+        ,auto:false
144
+        ,bindAction:'#addcity'
145
+        ,choose: function(obj){
146
+            obj.preview(function(index, file, result){
147
+                $('#breviary_imgft').attr('src', result); //图片链接(base64)
148
+            });
149
+        }
150
+    });
151
+    // 图片放大浏览
152
+    $('.layui_magnify').click(function(){
153
+        var _src = $(this).attr('src');
154
+        layui.layer.open({
155
+            type: 1,
156
+            title: false,           //是否显示标题
157
+            area: ['60%', '80%'],
158
+            shade: 0.6,           //透明度
159
+            closeBtn: 1,         //按钮 1有,0无
160
+            shadeClose: true,
161
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
162
+        });
163
+    })
164
+
165
+     // 新增
166
+     var $ = layui.$, active = {
167
+        addData: function(){ //获取选中数据
168
+            var index = layui.layer.open({
169
+                type: 2,
170
+                title: '添加轮播图',
171
+                closeBtn: 1, //不显示关闭按钮
172
+                area: ['800px','500px'],
173
+                content: '/push/hotrotationadd' //iframe的url,no代表不显示滚动条
174
+                ,success:function (layero, index) {
175
+                },
176
+                end:function () {
177
+                    table.reload('tablerReload');
178
+                }
179
+            });
180
+        },
181
+        reload:function(){//搜索
182
+            var form = pfgs_serialize($('form'));
183
+            var name = '';
184
+            var house_name   = '';
185
+            if(form.input_house == 'name'){
186
+                name = form.input_house_text;
187
+            } else if(form.input_house == 'house_name'){
188
+                house_name = form.input_house_text;
189
+            }
190
+            table.reload('tablerReload',{
191
+                where:{
192
+                    title:name,
193
+                    house_name:house_name,
194
+                    city:form.input_city,
195
+                    type_name:form.type_name
196
+                }
197
+            })
198
+        },
199
+    };
200
+    $('.demoTable .layui-btn').on('click', function(){
201
+        var type = $(this).data('type');
202
+        active[type] ? active[type].call(this) : '';
203
+    });
204
+
205
+
206
+    $('.The_house').focus(function(){
207
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
208
+        indexOpen = parent.layui.layer.open({
209
+            type: 2,
210
+            title: '选择需要添加的楼盘',
211
+            area: ['','100%'],
212
+            content: '/publicuse/housename',
213
+            success:function (layero, index) {
214
+            },
215
+            end:function(){
216
+            }
217
+        });
218
+        parent.layui.layer.full(indexOpen);
219
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
220
+        $(window).on("resize",function(){
221
+            parent.layui.layer.full(indexOpen);
222
+        })
223
+    })
224
+
225
+
226
+
227
+    //添加页面提交数据
228
+    form.on('submit(adds)', function(data){
229
+        var formData = new FormData($('form')[0]);
230
+       if(formData.getAll('img')[0].size == 0){
231
+           layer.msg('请选择图片');
232
+           return false;
233
+       }
234
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
235
+        $.ajax({
236
+            cache : false,
237
+            type : "post",
238
+            url : "/push/hotrotationform",
239
+            data : formData,  // 你的formid
240
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
241
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
242
+            error : function(request) {
243
+                layer.close(index);
244
+                layer.msg("请联系管理员");
245
+            },
246
+            success : function(data) {
247
+                if(data.data != null){
248
+                    layer.msg(ReturnInfo(data.data),{icon:5});
249
+                    return ;
250
+                }
251
+                layer.msg(data.msg);
252
+            }
253
+        });
254
+        return false;
255
+    });
256
+
257
+    form.on('submit(edit)', function(data){
258
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
259
+        // var oindex = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
260
+        var formData = new FormData($('form')[0]);
261
+        $.ajax({
262
+            type : "post",
263
+            url : "/push/hotrotationeditform",
264
+            data : formData,
265
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
266
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
267
+            error : function(request) {
268
+                layer.close(index);
269
+                layer.msg("请联系管理员");
270
+            },
271
+            success : function(data) {
272
+                if(data.data != null){
273
+                    layer.msg(ReturnInfo(data.data),{icon:5});
274
+                    return ;
275
+                }
276
+                layer.msg(data.msg);
277
+                parent.layer.close(oindex); //再执行关闭   
278
+            }
279
+        });
280
+        return false;
281
+    });
282
+})

+ 255 - 0
backend/web/js/push/newshotactivity.js

@@ -0,0 +1,255 @@
1
+layui.use(['laypage', 'layer', 'table', 'element', 'form', 'upload'], function () {
2
+
3
+    var laypage = layui.laypage //分页
4
+        , $ = layui.jquery
5
+        , layer = layui.layer //弹层
6
+        , table = layui.table //表格
7
+        , element = layui.element //元素操作
8
+        , form = layui.form
9
+        , upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'videolist';  //表格ID
13
+    var type_id = $('input[name="typeid"]').val();
14
+
15
+    //第一个实例
16
+    table.render({
17
+        elem: '#' + tableIds
18
+        , url: '/push/newshotactivityform' //数据接口
19
+        , where: {token: csrfToken, type: type_id}
20
+        , method: 'post'
21
+        , page: true //开启分页
22
+        ,height:600
23
+        , text: '数据加载中'
24
+        , id: 'tablerReload'
25
+        , cols: [[ //表头
26
+            {type: 'numbers', title: '序号', width: 50},
27
+            {field: 'title', title: '活动标题', align: 'center'}
28
+            , {
29
+                field: 'url', title: '活动链接', width: 400, align: 'center', templet: function (d) {
30
+                    return '<a href="' + d.url + '" target="_blank">' + d.url + '</a>';
31
+                }
32
+            }
33
+            , {
34
+                field: 'img', title: '图片', width: 350, align: 'center', templet: function (d) {
35
+                    return '<img class="layui_magnify" src="' + d.img + '"/>'
36
+                }
37
+            }
38
+            , {field: 'create_at', title: '添加时间', width: 150, align: 'center'}
39
+            , {
40
+                field: 'is_show', title: '审核', align: 'center', width: 100, templet: function (d) {
41
+                    if (d.is_show == 2) {
42
+                        return '<input type="checkbox"  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
43
+                    } else {
44
+                        return '<input type="checkbox" checked  value="' + d.id + '" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
45
+                    }
46
+                }
47
+            }
48
+            , {fixed: 'right', title: '操作', width: 165, align: 'center', toolbar: '#operate'}
49
+
50
+        ]]
51
+    });
52
+    //table.reload('tablerReload');        //重新加载
53
+
54
+    // 列表点击放大图片
55
+    $('.layui-table-main').on('click', '.layui_magnify', function () {
56
+        var _src = $(this).attr('src');
57
+        layui.layer.open({
58
+            type: 1,
59
+            title: false,           //是否显示标题
60
+            area: ['95%', '55%'],
61
+            shade: 0.6,           //透明度
62
+            closeBtn: 1,         //按钮 1有,0无
63
+            shadeClose: true,
64
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
65
+        });
66
+    });
67
+
68
+
69
+    //监听指定开关
70
+    form.on('switch(switchTest)', function (data) {
71
+        layer.confirm('确定要修改此操作吗?', {btn: ['确定', '取消']}, function () {
72
+            $.post('/push/newshotactivitydelshow', {id: data.value, type: 'show'}, function (data) {
73
+                layer.msg(data.msg);
74
+                table.reload('tablerReload');
75
+
76
+            })
77
+        }, function (aa) {
78
+            table.reload('tablerReload');        //重新加载
79
+        })
80
+    });
81
+
82
+
83
+    //列表操作
84
+    table.on('tool(' + tableIds + ')', function (obj) {
85
+        var layEvent = obj.event,
86
+            data = obj.data;
87
+        if (layEvent === 'edit') {
88
+            var index = layer.open({
89
+                type: 2,
90
+                title: '修改信息',
91
+                area: ['800px', '500px'],
92
+                content: '/push/newshotactivityedit?id=' + data.id + '&house_name=' + data.name,
93
+                end: function () {
94
+                    table.reload('tablerReload');        //重新加载
95
+                }
96
+            });
97
+        } else if (layEvent === 'del') {
98
+            layer.confirm('您确定要删除吗?', {btn: ['确定', '取消']}, function () {
99
+                $.post('/push/newshotactivitydelshow', {id: data.id, type: 'del'}, function (data) {
100
+                    layer.msg(data.msg);
101
+                    table.reload('tablerReload');
102
+                })
103
+            })
104
+        }
105
+
106
+
107
+    });
108
+
109
+    //添加图片上传
110
+    upload.render({
111
+        elem: '#test1'
112
+        , url: '/house/createimg'
113
+        , data: {token: csrfToken}
114
+        , field: 'img'
115
+        , size: 1000              //限制上传图片的大小,单位为KB
116
+        , exts: 'png|jpg|jpeg'     //只允许上传压缩文件
117
+        , auto: false
118
+        , bindAction: '#addcity'
119
+        , choose: function (obj) {
120
+            obj.preview(function (index, file, result) {
121
+                $('#breviary_img').attr('src', result); //图片链接(base64)
122
+            });
123
+        }
124
+    });
125
+    // 图片放大浏览
126
+    $('.layui_magnify').click(function () {
127
+        var _src = $(this).attr('src');
128
+        layui.layer.open({
129
+            type: 1,
130
+            title: false,           //是否显示标题
131
+            area: ['60%', '80%'],
132
+            shade: 0.6,           //透明度
133
+            closeBtn: 1,         //按钮 1有,0无
134
+            shadeClose: true,
135
+            content: '<img style="width:100%;height:100%" src="' + _src + '">',
136
+        });
137
+    })
138
+
139
+    // 新增
140
+    var $ = layui.$, active = {
141
+        addData: function () { //获取选中数据
142
+            var index = layui.layer.open({
143
+                type: 2,
144
+                title: '添加信息',
145
+                closeBtn: 1, //不显示关闭按钮
146
+                area: ['800px', '500px'],
147
+                content: '/push/newshotactivityadd?type=' + type_id //iframe的url,no代表不显示滚动条
148
+                , success: function (layero, index) {
149
+                },
150
+                end: function () {
151
+                    table.reload('tablerReload');
152
+                }
153
+            });
154
+        },
155
+        reload: function () {//搜索
156
+            var form = pfgs_serialize($('form'));
157
+            var name = '';
158
+            var house_name = '';
159
+            if (form.input_house == 'name') {
160
+                name = form.input_house_text;
161
+            } else if (form.input_house == 'house_name') {
162
+                house_name = form.input_house_text;
163
+            }
164
+            table.reload('tablerReload', {
165
+                where: {
166
+                    title: name,
167
+                    house_name: house_name,
168
+                    city: form.input_city,
169
+                    type_name: form.type_name
170
+                }
171
+            })
172
+        },
173
+    };
174
+    $('.demoTable .layui-btn').on('click', function () {
175
+        var type = $(this).data('type');
176
+        active[type] ? active[type].call(this) : '';
177
+    });
178
+
179
+
180
+    $('.The_house').focus(function () {
181
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
182
+        indexOpen = parent.layui.layer.open({
183
+            type: 2,
184
+            title: '选择需要添加的楼盘',
185
+            area: ['', '100%'],
186
+            content: '/publicuse/housename',
187
+            success: function (layero, index) {
188
+            },
189
+            end: function () {
190
+            }
191
+        });
192
+        parent.layui.layer.full(indexOpen);
193
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
194
+        $(window).on("resize", function () {
195
+            parent.layui.layer.full(indexOpen);
196
+        })
197
+    })
198
+
199
+
200
+    //添加页面提交数据
201
+    form.on('submit(add_hotactivity)', function (data) {
202
+        var formData = new FormData($('form')[0]);
203
+        if (formData.getAll('img')[0].size == 0) {
204
+            layer.msg('请选择图片');
205
+            return false;
206
+        }
207
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
208
+        $.ajax({
209
+            cache: false,
210
+            type: "post",
211
+            url: "/push/newshotactivityaddform",
212
+            data: formData,  // 你的formid
213
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
214
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
215
+            error: function (request) {
216
+                layer.close(index);
217
+                layer.msg("请联系管理员");
218
+            },
219
+            success: function (data) {
220
+                if (data.data != null) {
221
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
222
+                    return;
223
+                }
224
+                layer.msg(data.msg);
225
+            }
226
+        });
227
+        return false;
228
+    });
229
+
230
+    form.on('submit(edit_hotactivity)', function (data) {
231
+        var index = layer.msg('数据提交中,请稍候', {icon: 16, time: false, shade: 0.8});      //数据提交提示
232
+        var formData = new FormData($('form')[0]);
233
+        $.ajax({
234
+            type: "post",
235
+            url: "/push/newshotactivityeditform",
236
+            data: formData,
237
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
238
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
239
+            error: function (request) {
240
+                layer.close(index);
241
+                layer.msg("请联系管理员");
242
+            },
243
+            success: function (data) {
244
+                if (data.data != null) {
245
+                    layer.msg(ReturnInfo(data.data), {icon: 5});
246
+                    return;
247
+                }
248
+                layer.msg(data.msg);
249
+                parent.layer.close(oindex); //再执行关闭
250
+            }
251
+        });
252
+        return false;
253
+    });
254
+
255
+})

+ 212 - 0
backend/web/js/pushm/averageprice.js

@@ -0,0 +1,212 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,form = layui.form
8
+        // ,upload = layui.upload;
9
+
10
+
11
+    var tableIds = 'videolist';  //表格ID
12
+    //第一个实例
13
+    table.render({
14
+        elem: '#'+tableIds
15
+        ,url: '/pushm/averagepriceform' //数据接口
16
+        ,where:{token:csrfToken}
17
+        ,method:'post'
18
+        ,page: true //开启分页
19
+        ,height:600
20
+        ,text:'数据加载中'
21
+        ,id:'tablerReload'
22
+        ,cols: [[ //表头
23
+            {type:'numbers',title:'序号',width:50},
24
+            {field: 'title', title: '各地均价', align:'center'},
25
+            {field: 'price', title: '平均价格', align:'center'},
26
+            {field: 'num', title: '成交数量', align:'center'},
27
+            {field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"},
28
+            {field: 'create_at', title: '添加时间',width:150, align:'center'}
29
+            ,{field: 'status', title: '审核',align:'center',width:100, templet:function (d) {
30
+                    if(d.status == 2){
31
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
32
+                    } else {
33
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
34
+                    }
35
+                }}
36
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
37
+
38
+        ]]
39
+    });
40
+    //table.reload('tablerReload');        //重新加载
41
+
42
+
43
+
44
+    //监听指定开关
45
+    form.on('switch(switchTest)', function(data){
46
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
47
+            $.post('/pushm/averagepricedelshow',{id:data.value,type:'status'},function (data) {
48
+                layer.msg(data.msg);
49
+                table.reload('tablerReload');
50
+
51
+            })
52
+        },function (aa) {
53
+            table.reload('tablerReload');        //重新加载
54
+        })
55
+    });
56
+
57
+
58
+    //列表操作
59
+    table.on('tool('+tableIds+')', function(obj){
60
+        var layEvent = obj.event,
61
+            data = obj.data;
62
+        if(layEvent === 'edit'){
63
+            var index = layer.open({
64
+                type: 2,
65
+                title: '修改',
66
+                area:['800px','500px'],
67
+                content: '/pushm/averagepriceedit?id='+data.id+'&house_name='+data.name,
68
+                end:function () {
69
+                    table.reload('tablerReload');        //重新加载
70
+                }
71
+            });
72
+        } else if(layEvent === 'del') {
73
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
74
+                $.post('/pushm/averagepricedelshow',{id:data.id,type:'del'},function (data) {
75
+                    layer.msg(data.msg);
76
+                    table.reload('tablerReload');
77
+                })
78
+            })
79
+        } else if(layEvent === 'sortData'){       //修改排序
80
+            table.on('edit('+tableIds+')', function(obj){
81
+                var data = obj.data;
82
+                $.post('/pushm/averagepricedelshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
83
+                    if(data.code == 200)
84
+                    {
85
+                        layer.msg(data.msg);
86
+                    } else if(data.code == 300 ) {
87
+                        layer.msg(data.msg);
88
+                    }
89
+                })
90
+            })
91
+        }
92
+
93
+
94
+    });
95
+
96
+
97
+    // 新增
98
+    var $ = layui.$, active = {
99
+        addData: function(){ //获取选中数据
100
+            var index = layui.layer.open({
101
+                type: 2,
102
+                title: '添加房价一览',
103
+                closeBtn: 1, //不显示关闭按钮
104
+                area: ['650px','300px'],
105
+                content: '/pushm/averagepriceadd' //iframe的url,no代表不显示滚动条
106
+                ,success:function (layero, index) {
107
+                },
108
+                end:function () {
109
+                    table.reload('tablerReload');
110
+                }
111
+            });
112
+        },
113
+        reload:function(){//搜索
114
+            var form = pfgs_serialize($('form'));
115
+            var name = '';
116
+            var house_name   = '';
117
+            if(form.input_house == 'name'){
118
+                name = form.input_house_text;
119
+            } else if(form.input_house == 'house_name'){
120
+                house_name = form.input_house_text;
121
+            }
122
+            table.reload('tablerReload',{
123
+                where:{
124
+                    title:name,
125
+                    house_name:house_name,
126
+                    city:form.input_city,
127
+                    type_name:form.type_name
128
+                }
129
+            })
130
+        },
131
+    };
132
+    $('.demoTable .layui-btn').on('click', function(){
133
+        var type = $(this).data('type');
134
+        active[type] ? active[type].call(this) : '';
135
+    });
136
+
137
+
138
+    $('.The_house').focus(function(){
139
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
140
+        indexOpen = parent.layui.layer.open({
141
+            type: 2,
142
+            title: '选择需要添加的楼盘',
143
+            area: ['','100%'],
144
+            content: '/publicuse/housename',
145
+            success:function (layero, index) {
146
+            },
147
+            end:function(){
148
+            }
149
+        });
150
+        parent.layui.layer.full(indexOpen);
151
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
152
+        $(window).on("resize",function(){
153
+            parent.layui.layer.full(indexOpen);
154
+        })
155
+    })
156
+
157
+
158
+
159
+    //添加页面提交数据
160
+    form.on('submit(add_hotactivity)', function(data){
161
+        var formData = new FormData($('form')[0]);
162
+        // if(formData.getAll('img')[0].size == 0){
163
+        //     layer.msg('请选择图片');
164
+        //     return false;
165
+        // }
166
+         layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
167
+        $.ajax({
168
+            cache : false,
169
+            type : "post",
170
+            url : "/pushm/averagepriceaddform",
171
+            data : formData,  // 你的formid
172
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
173
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
174
+            error : function(request) {
175
+                layer.msg("请联系管理员");
176
+            },
177
+            success : function(data) {
178
+                if(data.data != null){
179
+                    layer.msg(ReturnInfo(data.data),{icon:5});
180
+                    return ;
181
+                }
182
+                layer.msg(data.msg);
183
+            }
184
+        });
185
+        return false;
186
+    });
187
+
188
+    form.on('submit(edit_hotactivity)', function(data){
189
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
190
+        var formData = new FormData($('form')[0]);
191
+        $.ajax({
192
+            type : "post",
193
+            url : "/pushm/averagepriceeditform",
194
+            data : formData,
195
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
196
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
197
+            error : function(request) {
198
+                layer.close(index);
199
+                layer.msg("请联系管理员");
200
+            },
201
+            success : function(data) {
202
+                if(data.data != null){
203
+                    layer.msg(ReturnInfo(data.data),{icon:5});
204
+                    return ;
205
+                }
206
+                layer.msg(data.msg);
207
+                parent.layer.close(oindex); //再执行关闭
208
+            }
209
+        });
210
+        return false;
211
+    });
212
+})

+ 282 - 0
backend/web/js/pushm/hotrotation.js

@@ -0,0 +1,282 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'videolist';  //表格ID
13
+    //第一个实例
14
+    table.render({
15
+        elem: '#'+tableIds
16
+        ,url: '/pushm/hotrotationforms' //数据接口
17
+        ,where:{token:csrfToken}
18
+        ,method:'post'
19
+        ,page: true //开启分页
20
+        ,height:600
21
+        ,text:'数据加载中'
22
+        ,id:'tablerReload'
23
+        ,cols: [[ //表头
24
+            {type:'numbers',title:'序号',width:50},
25
+            {field: 'title', title: '轮播标题', align:'center'},
26
+            {field: 'name', title: '归属楼盘名称', align:'center'},
27
+            {field: 'img', title: '图片',width:200, align:'center',templet:function(d){
28
+                return '<img class="layui_magnify" src="'+d.img+'"/>'
29
+            }}
30
+            ,
31
+            {field: 'img_ft', title: '繁体图片',width:200, align:'center',templet:function(d){
32
+                return '<img class="layui_magnify" src="'+d.img_ft+'"/>'
33
+            }}
34
+            ,    {field: 'url', title: '地址',width:200, align:'center',templet:function(d){
35
+                    return '<a href="'+d.url+'" target="_blank">'+d.url+'</a>';
36
+                }}
37
+            ,{field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"}
38
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
39
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
40
+                    if(d.is_show == 2){
41
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
42
+                    } else {
43
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
44
+                    }
45
+                }}
46
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
47
+
48
+        ]]
49
+    });
50
+
51
+    table.reload('tablerReload');        //重新加载
52
+
53
+    // 列表点击放大图片
54
+    $('.layui-table-main').on('click','.layui_magnify', function(){
55
+        var _src = $(this).attr('src');
56
+        layui.layer.open({
57
+            type: 1,
58
+            title: false,           //是否显示标题
59
+            area: ['95%', '55%'],
60
+            shade: 0.6,           //透明度
61
+            closeBtn: 1,         //按钮 1有,0无
62
+            shadeClose: true,
63
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
64
+        });
65
+    });
66
+
67
+
68
+    //监听指定开关
69
+    form.on('switch(switchTest)', function(data){
70
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
71
+            $.post('/pushm/hotimgdelshow',{id:data.value,type:'show'},function (data) {
72
+                layer.msg(data.msg);
73
+                table.reload('tablerReload');
74
+
75
+            })
76
+        },function (aa) {
77
+            table.reload('tablerReload');        //重新加载
78
+        })
79
+    });
80
+
81
+
82
+     //列表操作
83
+    table.on('tool('+tableIds+')', function(obj){
84
+        var layEvent = obj.event,
85
+            data = obj.data;
86
+        if(layEvent === 'edit'){
87
+           var index = layer.open({
88
+                type: 2,
89
+                title: '修改轮播图',
90
+                area:['800px','500px'],
91
+                content: '/pushm/hotrotationedit?id='+data.id+'&house_name='+data.name,
92
+                end:function () {
93
+                    table.reload('tablerReload');        //重新加载
94
+                }
95
+            });
96
+        } else if(layEvent === 'del') {
97
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
98
+                $.post('/pushm/hotimgdelshow',{id:data.id,type:'del'},function (data) {
99
+                    layer.msg(data.msg);
100
+                    table.reload('tablerReload');
101
+                })
102
+            })
103
+        }else if(layEvent === 'sortData'){       //修改排序
104
+             table.on('edit('+tableIds+')', function(obj){
105
+                var data = obj.data;
106
+                $.post('/pushm/hotimgdelshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
107
+                    if(data.code == 200)
108
+                    {
109
+                        layer.msg(data.msg);
110
+                    } else if(data.code == 300 ) {
111
+                        layer.msg(data.msg);
112
+                    }
113
+                })
114
+            })
115
+        }
116
+
117
+    });
118
+
119
+    //添加图片上传
120
+    upload.render({
121
+         elem: '#test1'
122
+        ,url: '/house/createimg'
123
+        ,data:{token:csrfToken}
124
+        ,field:'img'
125
+        ,size:1000              //限制上传图片的大小,单位为KB
126
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
127
+        ,auto:false
128
+        ,bindAction:'#addcity'
129
+        ,choose: function(obj){
130
+            obj.preview(function(index, file, result){
131
+                $('#breviary_img').attr('src', result); //图片链接(base64)
132
+            });
133
+        }
134
+    });
135
+        //添加图片上传
136
+    upload.render({
137
+         elem: '#test2'
138
+        ,url: '/house/createimg'
139
+        ,data:{token:csrfToken}
140
+        ,field:'img_ft'
141
+        ,size:1000              //限制上传图片的大小,单位为KB
142
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
143
+        ,auto:false
144
+        ,bindAction:'#addcity'
145
+        ,choose: function(obj){
146
+            obj.preview(function(index, file, result){
147
+                $('#breviary_imgft').attr('src', result); //图片链接(base64)
148
+            });
149
+        }
150
+    });
151
+    // 图片放大浏览
152
+    $('.layui_magnify').click(function(){
153
+        var _src = $(this).attr('src');
154
+        layui.layer.open({
155
+            type: 1,
156
+            title: false,           //是否显示标题
157
+            area: ['60%', '80%'],
158
+            shade: 0.6,           //透明度
159
+            closeBtn: 1,         //按钮 1有,0无
160
+            shadeClose: true,
161
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
162
+        });
163
+    })
164
+
165
+     // 新增
166
+     var $ = layui.$, active = {
167
+        addData: function(){ //获取选中数据
168
+            var index = layui.layer.open({
169
+                type: 2,
170
+                title: '添加轮播图',
171
+                closeBtn: 1, //不显示关闭按钮
172
+                area: ['800px','500px'],
173
+                content: '/pushm/hotrotationadd' //iframe的url,no代表不显示滚动条
174
+                ,success:function (layero, index) {
175
+                },
176
+                end:function () {
177
+                    table.reload('tablerReload');
178
+                }
179
+            });
180
+        },
181
+        reload:function(){//搜索
182
+            var form = pfgs_serialize($('form'));
183
+            var name = '';
184
+            var house_name   = '';
185
+            if(form.input_house == 'name'){
186
+                name = form.input_house_text;
187
+            } else if(form.input_house == 'house_name'){
188
+                house_name = form.input_house_text;
189
+            }
190
+            table.reload('tablerReload',{
191
+                where:{
192
+                    title:name,
193
+                    house_name:house_name,
194
+                    city:form.input_city,
195
+                    type_name:form.type_name
196
+                }
197
+            })
198
+        },
199
+    };
200
+    $('.demoTable .layui-btn').on('click', function(){
201
+        var type = $(this).data('type');
202
+        active[type] ? active[type].call(this) : '';
203
+    });
204
+
205
+
206
+    $('.The_house').focus(function(){
207
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
208
+        indexOpen = parent.layui.layer.open({
209
+            type: 2,
210
+            title: '选择需要添加的楼盘',
211
+            area: ['','100%'],
212
+            content: '/publicuse/housename',
213
+            success:function (layero, index) {
214
+            },
215
+            end:function(){
216
+            }
217
+        });
218
+        parent.layui.layer.full(indexOpen);
219
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
220
+        $(window).on("resize",function(){
221
+            parent.layui.layer.full(indexOpen);
222
+        })
223
+    })
224
+
225
+
226
+
227
+    //添加页面提交数据
228
+    form.on('submit(adds)', function(data){
229
+        var formData = new FormData($('form')[0]);
230
+       if(formData.getAll('img')[0].size == 0){
231
+           layer.msg('请选择图片');
232
+           return false;
233
+       }
234
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
235
+        $.ajax({
236
+            cache : false,
237
+            type : "post",
238
+            url : "/pushm/hotrotationform",
239
+            data : formData,  // 你的formid
240
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
241
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
242
+            error : function(request) {
243
+                layer.close(index);
244
+                layer.msg("请联系管理员");
245
+            },
246
+            success : function(data) {
247
+                if(data.data != null){
248
+                    layer.msg(ReturnInfo(data.data),{icon:5});
249
+                    return ;
250
+                }
251
+                layer.msg(data.msg);
252
+            }
253
+        });
254
+        return false;
255
+    });
256
+
257
+    form.on('submit(edit)', function(data){
258
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
259
+        // var oindex = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
260
+        var formData = new FormData($('form')[0]);
261
+        $.ajax({
262
+            type : "post",
263
+            url : "/pushm/hotrotationeditform",
264
+            data : formData,
265
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
266
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
267
+            error : function(request) {
268
+                layer.close(index);
269
+                layer.msg("请联系管理员");
270
+            },
271
+            success : function(data) {
272
+                if(data.data != null){
273
+                    layer.msg(ReturnInfo(data.data),{icon:5});
274
+                    return ;
275
+                }
276
+                layer.msg(data.msg);
277
+                parent.layer.close(oindex); //再执行关闭   
278
+            }
279
+        });
280
+        return false;
281
+    });
282
+})

+ 194 - 0
backend/web/js/pushm/hotsaleyahu.js

@@ -0,0 +1,194 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'videolist';  //表格ID
13
+    var type_id = $('input[name="typeid"]').val();
14
+    var id  =   $('input[name="id"]').val();
15
+    //第一个实例
16
+    table.render({
17
+        elem: '#'+tableIds
18
+        ,url: '/pushm/hotsaleform' //数据接口
19
+        ,where:{token:csrfToken,type:type_id,pcid:id}
20
+        ,method:'post'
21
+        ,page: true //开启分页
22
+        ,height:600
23
+        ,text:'数据加载中'
24
+        ,id:'tablerReload'
25
+        ,limit:15
26
+        ,cols: [[ //表头
27
+            {type:'numbers',title:'序号',width:50},
28
+            {field: 'name', title: '楼盘名称', align:'center'},
29
+            {field: 'city_name', title: '区域', width:150,align:'center'},
30
+            {field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"},
31
+            {field: 'create_at', title: '添加时间',width:150, align:'center'},
32
+            {field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
33
+                    if(d.is_show == 2){
34
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
35
+                    } else {
36
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
37
+                    }
38
+                }}
39
+            ,{fixed: 'right',title:'操作', width: 100, align:'center', toolbar: '#operate'}
40
+
41
+        ]]
42
+    });
43
+
44
+    //监听指定开关
45
+    form.on('switch(switchTest)', function(data){
46
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
47
+            $.post('/pushm/saledelshow',{id:data.value,type:'show'},function (data) {
48
+                layer.msg(data.msg);
49
+                table.reload('tablerReload');
50
+            })
51
+        },function (aa) {
52
+            table.reload('tablerReload');        //重新加载
53
+        })
54
+    });
55
+
56
+
57
+
58
+     //列表操作
59
+    table.on('tool('+tableIds+')', function(obj){
60
+        var layEvent = obj.event,
61
+            data = obj.data;
62
+        if(layEvent === 'sortData'){       //修改排序
63
+            /* 列表操作  edit  修改后执行  2018.7.24*/
64
+            table.on('edit('+tableIds+')', function(obj){
65
+                var data = obj.data;
66
+                $.post('/pushm/saledelshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
67
+                    if(data.code == 200)
68
+                    {
69
+                        layer.msg(data.msg);
70
+                    } else if(data.code == 300 ) {
71
+                        layer.msg(data.msg);
72
+                    }
73
+                })
74
+            })
75
+            // layer.prompt({
76
+            //     formType: 2
77
+            //     ,title: '排序热销楼盘:<span style="color:red">'+data.name+'</span>'
78
+            //     ,value: data.sort
79
+            // }, function(value, index){
80
+
81
+            //         $.post('/pushm/saledelshow',{id:data.id,type:'sort',sort:value},function (data) {
82
+            //             layer.msg(data.msg);
83
+            //             table.reload('tablerReload');
84
+            //         })
85
+            // });
86
+        }
87
+        if(layEvent === 'del') {
88
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
89
+                $.post('/pushm/saledelshow',{id:data.id,type:'del'},function (data) {
90
+                    layer.msg(data.msg);
91
+                    table.reload('tablerReload');
92
+                })
93
+            })
94
+        }
95
+
96
+    });
97
+
98
+     // 新增
99
+     var $ = layui.$, active = {
100
+        addData: function(){ //获取选中数据
101
+            var index = layui.layer.open({
102
+                type: 2,
103
+                title: '添加楼盘',
104
+                closeBtn: 1, //不显示关闭按钮
105
+                area: ['600px','300px'],
106
+                content: '/pushm/hotsaleaddyahu?id='+id+'&type='+type_id
107
+                ,success:function (layero, index) {
108
+                    // indexOpen = layer.getChildFrame('body', index)  ;
109
+                    // console.log(indexOpen);
110
+                },
111
+                end:function () {
112
+                    table.reload('tablerReload');
113
+                }
114
+            });
115
+        },
116
+        reload:function(){
117
+            var form = pfgs_serialize($('form'));
118
+            // var name = '';
119
+            // var house_name   = '';
120
+            // if(form.input_house == 'name'){
121
+            //     name = form.input_house_text;
122
+            // } else if(form.input_house == 'house_name'){
123
+            //     house_name = form.input_house_text;
124
+            // }
125
+            table.reload('tablerReload',{
126
+                where:{
127
+                    house_name: form.input_house_text
128
+                }
129
+            })
130
+        }
131
+    };
132
+    $('.demoTable .layui-btn').on('click', function(){
133
+        var type = $(this).data('type');
134
+        active[type] ? active[type].call(this) : '';
135
+    });
136
+
137
+
138
+    $('.The_house').focus(function(){
139
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
140
+        indexOpen = parent.layui.layer.open({
141
+            type: 2,
142
+            title: '选择需要添加的楼盘',
143
+            area: ['','100%'],
144
+            content: '/publicuse/housename',
145
+            success:function (layero, index) {
146
+            },
147
+            end:function(){
148
+            }
149
+        });
150
+        parent.layui.layer.full(indexOpen);
151
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
152
+        $(window).on("resize",function(){
153
+            parent.layui.layer.full(indexOpen);
154
+        })
155
+    })
156
+
157
+    //添加页面提交数据
158
+    form.on('submit(add)', function(data){
159
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
160
+
161
+        var formData = new FormData($('form')[0]);
162
+
163
+        $.ajax({
164
+            cache : false,
165
+            type : "post",
166
+            url : "/pushm/hotsaleaddform",
167
+            data : formData,  // 你的formid
168
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
169
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
170
+            error : function(request) {
171
+                layer.close(index);
172
+                layer.msg("请联系管理员");
173
+            },
174
+            success : function(data) {
175
+                if(data.data != null){
176
+                    layer.msg(ReturnInfo(data.data),{icon:5});
177
+                    return ;
178
+                }
179
+                layer.msg(data.msg);
180
+                parent.layer.close(oindex); //再执行关闭   
181
+            }
182
+        });
183
+        return false;
184
+    });
185
+
186
+
187
+
188
+    
189
+
190
+
191
+
192
+
193
+    
194
+})

+ 331 - 0
backend/web/js/pushm/yahucity.js

@@ -0,0 +1,331 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'videolist';  //表格ID
13
+    var type_id = $('input[name="type"]').val();
14
+
15
+    //第一个实例
16
+    table.render({
17
+        elem: '#'+tableIds
18
+        ,url: '/pushm/hotcityform' //数据接口
19
+        ,where:{token:csrfToken,type:type_id}
20
+        ,method:'post'
21
+        ,page: true //开启分页
22
+        ,height:600
23
+        ,text:'数据加载中'
24
+        ,id:'tablerReload'
25
+        ,cols: [[ //表头
26
+            {type:'numbers',title:'序号',width:50},
27
+            {field: 'title', title: '区域名称', align:'center'},
28
+            {field: 'english', title: '英文名称', align:'center'},
29
+            {field: 'img', title: '轮播图',width:200, align:'center',templet:function(d){
30
+                    return '<img class="layui_magnify" src="'+d.img+'"/>'
31
+                }},
32
+            {field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"}
33
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
34
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
35
+                    if(d.is_show == 2){
36
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
37
+                    } else {
38
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
39
+                    }
40
+                }}
41
+            ,{fixed: 'right',title:'操作', width: 180, align:'center', toolbar: '#operate'}
42
+
43
+        ]]
44
+    });
45
+
46
+    // 列表点击放大图片
47
+    $('.layui-table-main').on('click','.layui_magnify', function(){
48
+        var _src = $(this).attr('src');
49
+        layui.layer.open({
50
+            type: 1,
51
+            title: false,           //是否显示标题
52
+            area: ['95%', '55%'],
53
+            shade: 0.6,           //透明度
54
+            closeBtn: 1,         //按钮 1有,0无
55
+            shadeClose: true,
56
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
57
+        });
58
+    });
59
+
60
+
61
+    //监听指定开关
62
+    form.on('switch(switchTest)', function(data){
63
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
64
+            $.post('/pushm/citydelshow',{id:data.value,type:'show'},function (data) {
65
+                layer.msg(data.msg);
66
+                table.reload('tablerReload');
67
+
68
+            })
69
+        },function (aa) {
70
+            table.reload('tablerReload');        //重新加载
71
+        })
72
+    });
73
+
74
+
75
+    //列表操作
76
+    table.on('tool('+tableIds+')', function(obj){
77
+        var layEvent = obj.event,
78
+            data = obj.data;
79
+
80
+        if(layEvent === 'sortData'){       //修改排序
81
+             /* 列表操作  edit  修改后执行  2018.7.24*/
82
+            table.on('edit('+tableIds+')', function(obj){
83
+                var data = obj.data;
84
+                $.post('/pushm/citydelshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
85
+                    if(data.code == 200)
86
+                    {
87
+                        layer.msg(data.msg);
88
+                    } else if(data.code == 300 ) {
89
+                        layer.msg(data.msg);
90
+                    }
91
+                })
92
+            })
93
+            // layer.prompt({
94
+            //     formType: 2
95
+            //     ,title: '排序热门区域:<span style="color:red">'+data.city_name+'</span>'
96
+            //     ,value: data.sort
97
+            // }, function(value, index){
98
+            //     $.post('/pushm/citydelshow',{id:data.id,type:'sort',sort:value},function (data) {
99
+            //         layer.msg(data.msg);
100
+            //         table.reload('tablerReload');
101
+            //     })
102
+            // });
103
+        }else if(layEvent === 'del') {
104
+
105
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
106
+                $.post('/pushm/citydelshow',{id:data.id,type:'del'},function (data) {
107
+                    layer.msg(data.msg);
108
+                    table.reload('tablerReload');
109
+                })
110
+            })
111
+        }
112
+
113
+
114
+    });
115
+
116
+    //添加图片上传
117
+    upload.render({
118
+        elem: '#test1'
119
+        ,url: '/house/createimg'
120
+        ,data:{token:csrfToken}
121
+        ,field:'img'
122
+        ,size:1000              //限制上传图片的大小,单位为KB
123
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
124
+        ,auto:false
125
+        ,bindAction:'#addcity'
126
+        ,choose: function(obj){
127
+            obj.preview(function(index, file, result){
128
+                $('#breviary_img').attr('src', result); //图片链接(base64)
129
+            });
130
+        }
131
+    });
132
+    // 图片放大浏览
133
+    $('.layui_magnify').click(function(){
134
+        var _src = $(this).attr('src');
135
+        layui.layer.open({
136
+            type: 1,
137
+            title: false,           //是否显示标题
138
+            area: ['60%', '80%'],
139
+            shade: 0.6,           //透明度
140
+            closeBtn: 1,         //按钮 1有,0无
141
+            shadeClose: true,
142
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
143
+        });
144
+    })
145
+
146
+    // 新增
147
+    var $ = layui.$, active = {
148
+        addData: function(){ //获取选中数据
149
+            var index = layui.layer.open({
150
+                type: 2,
151
+                title: '添加热门区域',
152
+                closeBtn: 1, //不显示关闭按钮
153
+                area: ['800px','500px'],
154
+                content: '/pushm/hotcityaddyahu?type='+type_id //iframe的url,no代表不显示滚动条
155
+                ,success:function (layero, index) {
156
+                },
157
+                end:function () {
158
+                    table.reload('tablerReload');
159
+                }
160
+            });
161
+        },
162
+        reload:function(){//搜索
163
+            var form = pfgs_serialize($('form'));
164
+            var name = '';
165
+            var house_name   = '';
166
+            if(form.input_house == 'name'){
167
+                name = form.input_house_text;
168
+            } else if(form.input_house == 'house_name'){
169
+                house_name = form.input_house_text;
170
+            }
171
+            table.reload('tablerReload',{
172
+                where:{
173
+                    title:name,
174
+                    house_name:house_name,
175
+                    city:form.input_city,
176
+                    type_name:form.type_name
177
+                }
178
+            })
179
+        },
180
+    };
181
+    $('.demoTable .layui-btn').on('click', function(){
182
+        var type = $(this).data('type');
183
+        active[type] ? active[type].call(this) : '';
184
+    });
185
+
186
+
187
+    $('.The_house').focus(function(){
188
+        indexOpen = parent.layui.layer.open({
189
+            type: 2,
190
+            title: '选择需要添加的区域',
191
+            area: ['','100%'],
192
+            content: '/publicuse/city?type=1',
193
+            success:function (layero, index) {
194
+            },
195
+            end:function(){
196
+            }
197
+        });
198
+        parent.layui.layer.full(indexOpen);
199
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
200
+        $(window).on("resize",function(){
201
+            parent.layui.layer.full(indexOpen);
202
+        })
203
+    })
204
+
205
+
206
+
207
+    //添加页面提交数据
208
+    form.on('submit(add_hotcity)', function(data){
209
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
210
+        var formData = new FormData($('form')[0]);
211
+        // if(formData.getAll('img')[0].size == 0){
212
+        //     layer.msg('请选择图片');
213
+        //     return false;
214
+        // }
215
+        $.ajax({
216
+            type : "post",
217
+            url : "/pushm/hotcityaddyahuform",
218
+            data : formData,
219
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
220
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
221
+            error : function(request) {
222
+                layer.msg("请联系管理员");
223
+            },
224
+            success : function(data) {
225
+                if(data.data != null){
226
+                    layer.msg(ReturnInfo(data.data),{icon:5});
227
+                    return ;
228
+                }
229
+                layer.msg(data.msg);
230
+                parent.layer.close(oindex); //再执行关闭
231
+            }
232
+        });
233
+        return false;
234
+    });
235
+
236
+    //修改雅虎专题区域
237
+    form.on('submit(edit_hotcity)', function(data){
238
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
239
+        var formData = new FormData($('form')[0]);
240
+        $.ajax({
241
+            type : "post",
242
+            url : "/pushm/hotcityedityahuform",
243
+            data : formData,
244
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
245
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
246
+            error : function(request) {
247
+                layer.close(index);
248
+                layer.msg("请联系管理员");
249
+            },
250
+            success : function(data) {
251
+                if(data.data != null){
252
+                    layer.msg(ReturnInfo(data.data),{icon:5});
253
+                    return ;
254
+                }
255
+                layer.msg(data.msg);
256
+                parent.layer.close(oindex); //再执行关闭
257
+            }
258
+        });
259
+        return false;
260
+    });
261
+
262
+
263
+
264
+
265
+    //列表操作
266
+    table.on('tool('+tableIds+')', function(obj){
267
+        var layEvent = obj.event,
268
+            data = obj.data;
269
+        if(layEvent === 'sortData'){       //修改排序
270
+            /* 列表操作  edit  修改后执行  2018.7.24*/
271
+            table.on('edit('+tableIds+')', function(obj){
272
+                var data = obj.data;
273
+                $.post('/pushm/citydelshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
274
+                    if(data.code == 200)
275
+                    {
276
+                        layer.msg(data.msg);
277
+                    } else if(data.code == 300 ) {
278
+                        layer.msg(data.msg);
279
+                    }
280
+                })
281
+            })
282
+            // layer.prompt({
283
+            //     formType: 2
284
+            //     ,title: '排序热门区域:<span style="color:red">'+data.city_name+'</span>'
285
+            //     ,value: data.sort
286
+            // }, function(value, index){
287
+            //     $.post('/pushm/citydelshow',{id:data.id,type:'sort',sort:value},function (data) {
288
+            //         layer.msg(data.msg);
289
+            //         table.reload('tablerReload');
290
+            //     })
291
+            // });
292
+        }
293
+         else if(layEvent === 'Relation'){
294
+            var index =layui.layer.open({
295
+                title :'<span style="color:red" >['+data.title+']</span>相关楼盘',
296
+                type : 2,
297
+                area:['','100%'],
298
+                maxmin: true,
299
+                content : "/pushm/hotyahu?id="+data.id,
300
+                end:function () {
301
+                    table.reload('tablerReload');
302
+                }
303
+            })
304
+            layui.layer.full(index);
305
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
306
+            $(window).on("resize",function(){
307
+                layui.layer.full(index);
308
+            })
309
+        }else if(layEvent === 'del') {
310
+
311
+             layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
312
+                 $.post('/pushm/citydelshow',{id:data.id,type:'del'},function (data) {
313
+                     layer.msg(data.msg);
314
+                     table.reload('tablerReload');
315
+                 })
316
+             })
317
+         }else if(layEvent === 'edit') {
318
+            var index = layer.open({
319
+                type: 2,
320
+                title: '修改雅虎专题地区',
321
+                area: ['800px', '500px'],
322
+                content: '/pushm/hotcityedityahu?id=' + data.id + '&house_name=' + data.name,
323
+                end: function () {
324
+                    table.reload('tablerReload');        //重新加载
325
+                }
326
+            });
327
+        }
328
+
329
+
330
+    });
331
+})

+ 215 - 0
backend/web/js/pushm/zttime.js

@@ -0,0 +1,215 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+
12
+    var tableIds = 'videolist';  //表格ID
13
+    var type_id = $('input[name="typeid"]').val();
14
+    //第一个实例
15
+    table.render({
16
+        elem: '#'+tableIds
17
+        ,url: '/pushm/zttimeform' //数据接口
18
+        ,where:{token:csrfToken,type:type_id}
19
+        ,method:'post'
20
+        ,page: true //开启分页
21
+        ,height:600
22
+        ,text:'数据加载中'
23
+        ,id:'tablerReload'
24
+        ,limit:15
25
+        ,cols: [[ //表头
26
+            {type:'numbers',title:'序号',width:50},
27
+            {field: 'remark', title: '标题', align:'center'},
28
+            {field: 'title', title: '时间', width:350,align:'center'},
29
+            {field: 'address', title: '地址', width:350,align:'center'},
30
+            {field: 'create_at', title: '添加时间',width:150, align:'center'},
31
+            {field: 'is_show', title: '审核',align:'center',width:200, templet:function (d) {
32
+                    if(d.is_show == 2){
33
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
34
+                    } else {
35
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
36
+                    }
37
+                }}
38
+            ,{fixed: 'right',title:'操作', width: 300, align:'center', toolbar: '#operate'}
39
+
40
+        ]]
41
+    });
42
+
43
+    //监听指定开关
44
+    form.on('switch(switchTest)', function(data){
45
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
46
+            $.post('/pushm/zttimedelshow',{id:data.value,type:'show'},function (data) {
47
+                layer.msg(data.msg);
48
+                table.reload('tablerReload');
49
+            })
50
+        },function (aa) {
51
+            table.reload('tablerReload');        //重新加载
52
+        })
53
+    });
54
+
55
+
56
+
57
+     //列表操作
58
+    table.on('tool('+tableIds+')', function(obj){
59
+        var layEvent = obj.event,
60
+            data = obj.data;
61
+        if(layEvent === 'sortData'){       //修改排序
62
+            /* 列表操作  edit  修改后执行  2018.7.24*/
63
+            table.on('edit('+tableIds+')', function(obj){
64
+                var data = obj.data;
65
+                $.post('/pushm/',{id:data.id,type:'sort',sort:data.sort},function (data) {
66
+                    if(data.code == 200)
67
+                    {
68
+                        layer.msg(data.msg);
69
+                    } else if(data.code == 300 ) {
70
+                        layer.msg(data.msg);
71
+                    }
72
+                })
73
+            })
74
+            // layer.prompt({
75
+            //     formType: 2
76
+            //     ,title: '排序热销楼盘:<span style="color:red">'+data.name+'</span>'
77
+            //     ,value: data.sort
78
+            // }, function(value, index){
79
+
80
+            //         $.post('/pushm/saledelshow',{id:data.id,type:'sort',sort:value},function (data) {
81
+            //             layer.msg(data.msg);
82
+            //             table.reload('tablerReload');
83
+            //         })
84
+            // });
85
+        }else if(layEvent === 'edit'){
86
+            var index = layer.open({
87
+                type: 2,
88
+                title: '编辑',
89
+                area:['800px','500px'],
90
+                content: '/pushm/ztedit?id='+data.id,
91
+                end:function () {
92
+                    table.reload('tablerReload');        //重新加载
93
+                }
94
+            });
95
+        }else if(layEvent === 'del') {
96
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
97
+                $.post('/pushm/zttimedelshow',{id:data.id,type:'del'},function (data) {
98
+                    layer.msg(data.msg);
99
+                    table.reload('tablerReload');
100
+                })
101
+            })
102
+        }else if(layEvent === 'produce'){
103
+            //
104
+            var index = layer.open({
105
+                type: 2,
106
+                title: '生成['+data.remark+']控制模板代码',
107
+                closeBtn: 1, //不显示关闭按钮
108
+                shade: [0],
109
+                area: ['600px', '500px'],
110
+                anim: 2,
111
+                content: '/pushm/produce?id='+data.id+'&name='+data.name, //iframe的url,no代表不显示滚动条
112
+                end:function () {
113
+                    renderTable();
114
+                }
115
+            });
116
+        }
117
+
118
+    });
119
+
120
+     // 新增
121
+     var $ = layui.$, active = {
122
+        addData: function(){ //获取选中数据
123
+            var index = layui.layer.open({
124
+                type: 2,
125
+                title: '添加时间',
126
+                closeBtn: 1, //不显示关闭按钮
127
+                area: ['600px','300px'],
128
+                content: '/pushm/create'
129
+                ,success:function (layero, index) {
130
+                    // indexOpen = layer.getChildFrame('body', index)  ;
131
+                    // console.log(indexOpen);
132
+                },
133
+                end:function () {
134
+                    table.reload('tablerReload');
135
+                }
136
+            });
137
+        },
138
+        reload:function(){
139
+            var form = pfgs_serialize($('form'));
140
+            // var name = '';
141
+            // var house_name   = '';
142
+            // if(form.input_house == 'name'){
143
+            //     name = form.input_house_text;
144
+            // } else if(form.input_house == 'house_name'){
145
+            //     house_name = form.input_house_text;
146
+            // }
147
+            table.reload('tablerReload',{
148
+                where:{
149
+                    house_name: form.input_house_text
150
+                }
151
+            })
152
+        }
153
+    };
154
+    $('.demoTable .layui-btn').on('click', function(){
155
+        var type = $(this).data('type');
156
+        active[type] ? active[type].call(this) : '';
157
+    });
158
+
159
+
160
+    $('.The_house').focus(function(){
161
+        // $('form').append('<input type="hidden" name="aa" value="aaa">');
162
+        indexOpen = parent.layui.layer.open({
163
+            type: 2,
164
+            title: '选择需要添加的楼盘',
165
+            area: ['','100%'],
166
+            content: '/publicuse/housename',
167
+            success:function (layero, index) {
168
+            },
169
+            end:function(){
170
+            }
171
+        });
172
+        parent.layui.layer.full(indexOpen);
173
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
174
+        $(window).on("resize",function(){
175
+            parent.layui.layer.full(indexOpen);
176
+        })
177
+    })
178
+
179
+    //添加页面提交数据
180
+    form.on('submit(add)', function(data){
181
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
182
+
183
+        var formData = new FormData($('form')[0]);
184
+        $.ajax({
185
+            cache : false,
186
+            type : "post",
187
+            url : "/pushm/ztaddform",
188
+            data : formData,  // 你的formid
189
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
190
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
191
+            error : function(request) {
192
+                layer.close(index);
193
+                layer.msg("请联系管理员");
194
+            },
195
+            success : function(data) {
196
+                if(data.data != null){
197
+                    layer.msg(ReturnInfo(data.data),{icon:5});
198
+                    return ;
199
+                }
200
+                layer.msg(data.msg);
201
+                parent.layer.close(oindex); //再执行关闭   
202
+            }
203
+        });
204
+        return false;
205
+    });
206
+
207
+
208
+
209
+    
210
+
211
+
212
+
213
+
214
+    
215
+})

+ 280 - 0
backend/web/js/pushnews/floorinfo.js

@@ -0,0 +1,280 @@
1
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
2
+
3
+    var laypage = layui.laypage //分页
4
+        ,$ = layui.jquery
5
+        ,layer = layui.layer //弹层
6
+        ,table = layui.table //表格
7
+        ,element = layui.element //元素操作
8
+        ,form = layui.form
9
+        ,upload = layui.upload;
10
+
11
+    var type_id = $('input[name="type"]').val();
12
+    var tableIds = 'videolist';  //表格ID
13
+    //第一个实例
14
+    table.render({
15
+        elem: '#'+tableIds
16
+        ,url: '/pushnews/floorinfoform' //数据接口
17
+        ,where:{token:csrfToken,type:type_id}
18
+        ,method:'post'
19
+        ,page: true //开启分页
20
+        ,height:600
21
+        ,text:'数据加载中'
22
+        ,id:'tablerReload'
23
+        ,cols: [[ //表头
24
+            {type:'numbers',title:'序号',width:50},
25
+            {field: 'subject', title: '标题', align:'center'},
26
+                {field: 'img', title: '图片',width:200, align:'center',templet:function(d){
27
+                    return '<img class="layui_magnify" src="'+d.img+'"/>'
28
+                }},
29
+            {field: 'sort', title: '排序',width:100, event:'sortData',edit: 'text', align:'center',sort: true,templet:"#sortBox"}
30
+            ,{field: 'create_at', title: '添加时间',width:150, align:'center'}
31
+            ,{field: 'is_show', title: '审核',align:'center',width:100, templet:function (d) {
32
+                    if(d.is_show == 2){
33
+                        return  '<input type="checkbox"  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
34
+                    } else {
35
+                        return  '<input type="checkbox" checked  value="'+d.id+'" name="open"  lay-skin="switch" lay-filter="switchTest" lay-text="|">'
36
+                    }
37
+                }}
38
+            ,{fixed: 'right',title:'操作', width: 200, align:'center', toolbar: '#operate'}
39
+
40
+        ]]
41
+    });
42
+
43
+    // 列表点击放大图片
44
+    $('.layui-table-main').on('click','.layui_magnify', function(){
45
+        var _src = $(this).attr('src');
46
+        layui.layer.open({
47
+            type: 1,
48
+            title: false,           //是否显示标题
49
+            area: ['95%', '55%'],
50
+            shade: 0.6,           //透明度
51
+            closeBtn: 1,         //按钮 1有,0无
52
+            shadeClose: true,
53
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
54
+        });
55
+    });
56
+
57
+
58
+    //监听指定开关
59
+    form.on('switch(switchTest)', function(data){
60
+        layer.confirm('确定要修改此操作吗?',{btn: ['确定', '取消']},function () {
61
+            $.post('/pushnews/newsdelandshow',{id:data.value,type:'show'},function (data) {
62
+                layer.msg(data.msg);
63
+                table.reload('tablerReload');
64
+
65
+            })
66
+        },function (aa) {
67
+            table.reload('tablerReload');        //重新加载
68
+        })
69
+    });
70
+
71
+
72
+    //列表操作
73
+    table.on('tool('+tableIds+')', function(obj){
74
+        var layEvent = obj.event,
75
+            data = obj.data;
76
+
77
+        if(layEvent === 'sortData'){       //修改排序
78
+             table.on('edit('+tableIds+')', function(obj){
79
+                var data = obj.data;
80
+                // console.log(data)
81
+                $.post('/pushnews/newsdelandshow',{id:data.id,type:'sort',sort:data.sort},function (data) {
82
+                    if(data.code == 200)
83
+                    {
84
+                        layer.msg(data.msg);
85
+                    } else if(data.code == 300 ) {
86
+                        layer.msg(data.msg);
87
+                    }
88
+                })
89
+            })
90
+            // layer.prompt({
91
+            //     formType: 2
92
+            //     ,title: '排序'
93
+            //     ,value: data.sort
94
+            // }, function(value, index){
95
+
96
+            //     $.post('/pushnews/newsdelandshow',{id:data.id,type:'sort',sort:value},function (data) {
97
+            //         layer.msg(data.msg);
98
+            //         table.reload('tablerReload');
99
+            //     })
100
+            // });
101
+        }else if(layEvent === 'del') {
102
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
103
+                $.post('/pushnews/newsdelandshow',{id:data.id,type:'del'},function (data) {
104
+                    layer.msg(data.msg);
105
+                    table.reload('tablerReload');
106
+                })
107
+            })
108
+        } else if(layEvent === 'edit'){
109
+            var index = layer.open({
110
+                type: 2,
111
+                title: '编辑',
112
+                area:['800px','500px'],
113
+                content: '/pushfresh/freshcityedit?id='+data.id+'&name='+data.city_name,
114
+                end:function () {
115
+                    table.reload('tablerReload');        //重新加载
116
+                }
117
+            });
118
+        } else if(layEvent === 'Relation'){
119
+            var index =layui.layer.open({
120
+                title :'<span style="color:red" >['+data.city_name+']</span>区域相关楼盘',
121
+                type : 2,
122
+                area:['','100%'],
123
+                maxmin: true,
124
+                content : "/pushfresh/cityhouse?id="+data.city_id,
125
+                end:function () {
126
+                    table.reload('tablerReload');
127
+                }
128
+            })
129
+            layui.layer.full(index);
130
+            //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
131
+            $(window).on("resize",function(){
132
+                layui.layer.full(index);
133
+            })
134
+        }
135
+
136
+
137
+    });
138
+
139
+    //添加图片上传
140
+    upload.render({
141
+        elem: '#test1'
142
+        ,url: '/house/createimg'
143
+        ,data:{token:csrfToken}
144
+        ,field:'img'
145
+        ,size:1000              //限制上传图片的大小,单位为KB
146
+        ,exts: 'png|jpg|jpeg'     //只允许上传压缩文件
147
+        ,auto:false
148
+        ,bindAction:'#addcity'
149
+        ,choose: function(obj){
150
+            obj.preview(function(index, file, result){
151
+                $('#breviary_img').attr('src', result); //图片链接(base64)
152
+            });
153
+        }
154
+    });
155
+    // 图片放大浏览
156
+    $('.layui_magnify').click(function(){
157
+        var _src = $(this).attr('src');
158
+        layui.layer.open({
159
+            type: 1,
160
+            title: false,           //是否显示标题
161
+            area: ['60%', '80%'],
162
+            shade: 0.6,           //透明度
163
+            closeBtn: 1,         //按钮 1有,0无
164
+            shadeClose: true,
165
+            content: '<img style="width:100%;height:100%" src="'+_src+'">',
166
+        });
167
+    })
168
+
169
+    // 新增
170
+    var $ = layui.$, active = {
171
+        addData: function(){ //获取选中数据
172
+            var index = layui.layer.open({
173
+                type: 2,
174
+                title: '添加',
175
+                closeBtn: 1, //不显示关闭按钮
176
+                area: ['800px','500px'],
177
+                content: '/pushnews/floorinfoadd?type='+type_id //iframe的url,no代表不显示滚动条
178
+                ,success:function (layero, index) {
179
+                },
180
+                end:function () {
181
+                    table.reload('tablerReload');
182
+                }
183
+            });
184
+        },
185
+        reload:function(){//搜索
186
+            var form = pfgs_serialize($('form'));
187
+            var name = '';
188
+            var house_name   = '';
189
+            if(form.input_house == 'name'){
190
+                name = form.input_house_text;
191
+            } else if(form.input_house == 'house_name'){
192
+                house_name = form.input_house_text;
193
+            }
194
+            table.reload('tablerReload',{
195
+                where:{
196
+                    title:name,
197
+                    house_name:house_name,
198
+                    city:form.input_city,
199
+                    type_name:form.type_name
200
+                }
201
+            })
202
+        },
203
+    };
204
+    $('.demoTable .layui-btn').on('click', function(){
205
+        var type = $(this).data('type');
206
+        active[type] ? active[type].call(this) : '';
207
+    });
208
+
209
+
210
+    $('.The_house').focus(function(){
211
+        indexOpen = parent.layui.layer.open({
212
+            type: 2,
213
+            title: '选择需要添加的资讯',
214
+            area: ['','100%'],
215
+            content: '/publicuse/news?type=1', //1单选
216
+            success:function (layero, index) {
217
+            },
218
+            end:function(){
219
+            }
220
+        });
221
+        parent.layui.layer.full(indexOpen);
222
+        //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
223
+        $(window).on("resize",function(){
224
+            parent.layui.layer.full(indexOpen);
225
+        })
226
+    })
227
+
228
+
229
+
230
+    //添加页面提交数据
231
+    form.on('submit(add)', function(data){
232
+        var formData = new FormData($('form')[0]);
233
+        layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
234
+        $.ajax({
235
+            type : "post",
236
+            url : "/pushnews/floorinfoaddform",
237
+            data : formData,
238
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
239
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
240
+            error : function(request) {
241
+                layer.close(index);
242
+                layer.msg("请联系管理员");
243
+            },
244
+            success : function(data) {
245
+                if(data.data != null){
246
+                    layer.msg(ReturnInfo(data.data),{icon:5});
247
+                    return ;
248
+                }
249
+                layer.msg(data.msg);
250
+                parent.layer.close(oindex); //再执行关闭
251
+            }
252
+        });
253
+        return false;
254
+    });
255
+
256
+    form.on('submit(edit_city)', function(data){
257
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
258
+        var formData = new FormData($('form')[0]);
259
+        $.ajax({
260
+            type : "post",
261
+            url : "/pushfresh/freshcityeditform",
262
+            data : formData,
263
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
264
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
265
+            error : function(request) {
266
+                layer.close(index);
267
+                layer.msg("请联系管理员");
268
+            },
269
+            success : function(data) {
270
+                if(data.data != null){
271
+                    layer.msg(ReturnInfo(data.data),{icon:5});
272
+                    return ;
273
+                }
274
+                layer.msg(data.msg);
275
+                parent.layer.close(oindex); //再执行关闭
276
+            }
277
+        });
278
+        return false;
279
+    });
280
+})

+ 185 - 0
backend/web/js/routine/rent.js

@@ -0,0 +1,185 @@
1
+var delFiles = []; //用于删除图片
2
+var filesContainers= {};  //存储最终要上传的图片
3
+var filesContainer= {};  //存储最终要上传的图片
4
+var files ;     //存储选择图片的数量
5
+layui.use([ 'laypage', 'layer', 'table',  'element','form','upload'], function(){
6
+
7
+    var laypage = layui.laypage //分页
8
+        ,$ = layui.jquery
9
+        ,layer = layui.layer //弹层
10
+        ,table = layui.table //表格
11
+        ,form = layui.form
12
+        ,upload = layui.upload;
13
+
14
+    var tableId = 'citylist';
15
+    //第一个实例
16
+    table.render({
17
+        elem: '#'+tableId
18
+        ,url: '/routinecity/rentform' //数据接口
19
+        ,where:{token:csrfToken}
20
+        ,method:'post'
21
+        ,page: true //开启分页
22
+        ,height:600
23
+        ,text:'数据加载中'
24
+        ,id:'tablerReload'
25
+        ,limit:20
26
+        ,cols: [[ //表头
27
+            // {field: 'id', title: 'ID', width:80, sort: true,align:'center'}
28
+            {field: 'city_name', title: '区域名称',align:'center'}
29
+            ,{field: 'proportion', title: '参考收益',align:'center',sort: true}
30
+            ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
31
+
32
+        ]]
33
+    });
34
+
35
+    //table.reload('tablerReload');        //重新加载
36
+    //列表操作
37
+    table.on('tool('+tableId+')', function(obj){
38
+        var layEvent = obj.event,
39
+            data = obj.data;
40
+        if(layEvent === 'edit'){
41
+           var index = layer.open({
42
+                type: 2,
43
+                title: '修改',
44
+                area: ['500px', '60%'],
45
+                content: '/routinecity/rentedit?id='+data.id,
46
+            });
47
+
48
+        } else if(layEvent === 'del') {
49
+            layer.confirm('您确定要删除吗?',{   btn: ['确定', '取消']},function () {
50
+                $.post('/routinecity/rentdel',{'id':data.id},function (data) {
51
+                        layer.msg(data.msg);
52
+                        table.reload('tablerReload');
53
+
54
+                });
55
+            });
56
+        }
57
+    });
58
+
59
+
60
+
61
+
62
+    var $ = layui.$, active = {
63
+        addData: function(){ //获取选中数据
64
+         var index =  layui.layer.open({
65
+                type: 2,
66
+                title: '添加',
67
+                maxmin: true,
68
+                area: ['500px', '60%'],
69
+                content: '/routinecity/rentadd',
70
+            });
71
+
72
+            // layui.layer.full(index);
73
+            // //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作)
74
+            // $(window).on("resize",function(){
75
+            //     layui.layer.full(index);
76
+            // })
77
+        },
78
+        reload:function () {
79
+            var formdara = pfgs_serialize($('form'));
80
+            table.reload('tablerReload',{
81
+                where:{
82
+                    city:formdara.input_city
83
+                }
84
+            })
85
+            // console.log(formdara);
86
+        }
87
+
88
+    };
89
+
90
+    $('.demoTable .layui-btn').on('click', function(){
91
+        var type = $(this).data('type');
92
+        active[type] ? active[type].call(this) : '';
93
+    });
94
+
95
+    form.on('submit(edit)', function(data){
96
+
97
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
98
+
99
+        var formData = new FormData($('#signupForm')[0]);
100
+
101
+        $.ajax({
102
+            type : "post",
103
+            url : '/routinecity/renteditform',
104
+            data : formData,  // 你的formid
105
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
106
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
107
+            error : function(request) {
108
+                layer.close(index);         //关闭数据提交信息
109
+                layer.alert("网络超时");
110
+            },
111
+            success : function(data) {
112
+                if(data.data != null){
113
+                    layer.msg(ReturnInfo(data.data),{icon:5});
114
+                    return ;
115
+                }
116
+                layer.msg(data.msg);
117
+                parent.layui.table.reload('tablerReload');
118
+
119
+            }
120
+        });
121
+        return false;
122
+    });
123
+
124
+    //添加
125
+    form.on('submit(tijiao)', function(data){
126
+
127
+        var index = layer.msg('数据提交中,请稍候',{icon: 16,time:false,shade:0.8});      //数据提交提示
128
+
129
+        var formData = new FormData($('#signupForm')[0]);
130
+
131
+        $.ajax({
132
+            type : "post",
133
+            url : '/routinecity/rentaddform',
134
+            data : formData,  // 你的formid
135
+            contentType: false,   //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作,从而失去分界符,而使服务器不能正常解析文件
136
+            processData: false,   //当设置为true的时候,jquery ajax 提交的时候不会序列化 data,而是直接使用data
137
+            error : function(request) {
138
+                layer.close(index);         //关闭数据提交信息
139
+                layer.alert("网络超时");
140
+            },
141
+            success : function(data) {
142
+                if(data.data != null){
143
+                    layer.msg(ReturnInfo(data.data),{icon:5});
144
+                    return ;
145
+                }
146
+                layer.msg(data.msg);
147
+                parent.layui.table.reload('tablerReload');
148
+
149
+            }
150
+        });
151
+        return false;
152
+    });
153
+
154
+});
155
+
156
+//删除图片  单
157
+// $('#demo2').on("click","#delimg",function () {
158
+//     var name = $(this).next().attr("imgname");
159
+//     var delIdentification = $(this).next().attr("delIdentification");
160
+//     // if(typeof(delIdentification) != 'undefined'){
161
+//     //     delete filesContainer[delIdentification];
162
+//     //     delete files[delIdentification] ;
163
+//     // }
164
+//     if(typeof(name) != 'undefined'){
165
+//         delFiles.push(name);
166
+//     }
167
+//     $(this).parent().remove();
168
+// })
169
+
170
+//删除图片 多
171
+$('#demo1').on("click","#delimg",function () {
172
+    var name = $(this).next().attr("imgname");
173
+    var delIdentification = $(this).next().attr("delIdentification");
174
+    if(typeof(delIdentification) != 'undefined'){
175
+        delete filesContainers[delIdentification];
176
+        // delete files[delIdentification] ;
177
+    }
178
+    if(typeof(name) != 'undefined'){
179
+        delFiles.push(name);
180
+    }
181
+    $(this).parent().remove();
182
+})
183
+if($('#editor_content').length > 0){
184
+    var ue = UE.getEditor('editor_content');
185
+}

+ 0 - 0
backend/web/js/routine/terms.js


Some files were not shown because too many files changed in this diff