Browse Source

feat: 企业搜索默认状态

cuiyalong 4 years ago
parent
commit
f3f147450f

+ 3 - 3
src/jfw/modules/app/src/web/staticres/jyapp/css/wxinfocontent.css

@@ -303,9 +303,9 @@ body .loading_ p span {
 }
 
 .forecast {
-    position: fixed;
-    top: 160px;
-    right: 0;
+    position: absolute;
+    top: 20px;
+    right: -16px;
     display: flex;
     justify-content: center;
     align-items: center;

+ 2 - 2
src/jfw/modules/app/src/web/templates/me/mine.html

@@ -138,7 +138,7 @@
                             <span class="j-icon base-icon icon-arrow-right"></span>
                         </div>
                     </div>
-                    <!-- <div class="menu_list ent-search" style="display: none;" data-href='/jyapp/vipsubscribe/introducePage'>
+                    <div class="menu_list ent-search" style="display: none;" data-href='/jyapp/vipsubscribe/introducePage'>
                         <div class="menu_list_left">
                             <span class="j-icon base-icon icon-qiyechaxun"></span>
                             <span class="label">企业查询</span>
@@ -147,7 +147,7 @@
                             <i class="dot-red"></i>
                             <span class="j-icon base-icon icon-arrow-right"></span>
                         </div>
-                    </div> -->
+                    </div>
                     <div class="menu_list bx-collection" data-href='/jyapp/frontPage/collection/sess/index'>
                         <div class="menu_list_left">
                             <span class="j-icon base-icon icon-shoucang"></span>

+ 36 - 65
src/web/staticres/js/ent-search-index-pc.js

@@ -226,9 +226,7 @@ var vm = new Vue({
                     if (res.error_code === 0 && res.data) {
                         Object.assign(this.powerInfo, res.data)
                         this.checkPower()
-                        if (this.searchContent.trim()) {
-                            this.doSearch()
-                        }
+                        this.doSearch()
                     } else {
                         this.checkLogin()
                     }
@@ -357,36 +355,6 @@ var vm = new Vue({
                 }.bind(this)
             })
         }, 200),
-        getDefaultList: function () {
-            $.ajax({
-                url: '/publicapply/enterpriseSearch/index',
-                type: 'POST',
-                success: function (res) {
-                    if (res.error_code === 0 && res.data) {
-                        if (res.data.list) {
-                            if (this.power) {
-                                this.listState.list = res.data.list || []
-                            } else {
-                                if (res.data.list.length > 4) {
-                                    res.data.list.length = 4
-                                    res.data.list.push({
-                                        company_address: 'xxx',
-                                        company_name: 'xxx',
-                                        company_status: 'xxx',
-                                        legal_person: 'xxx',
-                                        id: 'xxx',
-                                        showMask: true
-                                    })
-                                }
-                                this.listState.list = res.data.list || []
-                            }
-                        }
-                    } else {
-                        this.checkLogin()
-                    }
-                }.bind(this)
-            })
-        },
         getList: function () {
             var data = {
                 match: this.searchContent,
@@ -403,8 +371,6 @@ var vm = new Vue({
                 pageNum: this.listState.pageNum - 1, // 当前页, 从0开始
             }
 
-            if (!data.match.replace(/\s+/g, '')) return
-
             this.listState.loading = true
             this.listState.loaded = false
 
@@ -414,36 +380,7 @@ var vm = new Vue({
                 data: data,
                 success: function (res) {
                     if (res.error_code === 0) {
-                        if (res.data) {
-                            if (res.data.total) {
-                                if (this.power) {
-                                    this.listState.total = res.data.total
-                                } else {
-                                    this.listState.total = 9
-                                }
-                            }
-                            if (res.data.list) {
-                                if (this.power) {
-                                    this.listState.list = res.data.list || []
-                                } else {
-                                    if (res.data.list.length > 4) {
-                                        res.data.list.length = 4
-                                        res.data.list.push({
-                                            company_address: 'xxx',
-                                            company_name: 'xxx',
-                                            company_status: 'xxx',
-                                            legal_person: 'xxx',
-                                            id: 'xxx',
-                                            showMask: true
-                                        })
-                                    }
-                                    this.listState.list = res.data.list || []
-                                }
-                            }
-                        } else {
-                            this.listState.total = 0
-                            this.listState.list = []
-                        }
+                        this.setListStateAndCheckPower(res)
                     } else {
                         this.checkLogin()
                     }
@@ -454,6 +391,40 @@ var vm = new Vue({
                 }.bind(this)
             })
         },
+        setListStateAndCheckPower: function (res) {
+            if (res.data) {
+                if (res.data.total) {
+                    if (this.power) {
+                        this.listState.total = res.data.total
+                    } else {
+                        this.listState.total = 4
+                    }
+                }
+
+                if (res.data.list) {
+                    if (this.power) {
+                        this.listState.list = res.data.list || []
+                    } else {
+                        if (res.data.list.length >= 4) {
+                            res.data.list.length = 4
+                            res.data.list.push({
+                                company_shortname: 'xxx',
+                                company_address: 'xxx',
+                                company_name: 'xxx',
+                                company_status: 'xxx',
+                                legal_person: 'xxx',
+                                id: 'xxx',
+                                showMask: true
+                            })
+                        }
+                        this.listState.list = res.data.list || []
+                    }
+                }
+            } else {
+                this.listState.total = 0
+                this.listState.list = []
+            }
+        },
         onPageChange: function (p) {
             this.listState.pageNum = p
             this.getList()