瀏覽代碼

h5 search

lyn7568 6 年之前
父節點
當前提交
55dbf7a7ce
共有 4 個文件被更改,包括 38 次插入39 次删除
  1. 0 1
      src/components/pageView/index.vue
  2. 0 19
      src/libs/common.js
  3. 18 0
      src/pages/h5/h5.js
  4. 20 19
      src/pages/h5/views/search/search.vue

+ 0 - 1
src/components/pageView/index.vue

@ -49,6 +49,5 @@
49 49
<style>
50 50
.page-view{
51 51
  display: inline-block;
52
  margin-right:15px;
53 52
}
54 53
</style>

+ 0 - 19
src/libs/common.js

@ -17,22 +17,3 @@ Vue.use(Loading);
17 17
Vue.use(BackTop);
18 18
// Vue.component('BackTop', BackTop);
19 19
Vue.use(defaultPage);
20
21
22
function hashChange () {
23
  location.reload();
24
}
25
//url变化监听器
26
if( ('onhashchange' in window) && ((typeof document.documentMode==='undefined') || document.documentMode==8)) {
27
// 浏览器支持onhashchange事件
28
    window.onhashchange = hashChange;  // TODO,对应新的hash执行的操作函数
29
} else {
30
  // 不支持则用定时器检测的办法
31
  setInterval(function() {
32
    // 检测hash值或其中某一段是否更改的函数, 在低版本的iE浏览器中通过window.location.hash取出的指和其它的浏览器不同,要注意
33
    var ischanged = isHashChanged();
34
    if (ischanged) {
35
        hashChange();  // TODO,对应新的hash执行的操作函数
36
    }
37
  }, 150);
38
}

+ 18 - 0
src/pages/h5/h5.js

@ -2,6 +2,24 @@ import '@/libs/common.js';
2 2
import App from './h5.vue';
3 3
import router from './router';
4 4
5
function hashChange () {
6
  location.reload();
7
}
8
//url变化监听器
9
if( ('onhashchange' in window) && ((typeof document.documentMode==='undefined') || document.documentMode==8)) {
10
// 浏览器支持onhashchange事件
11
    window.onhashchange = hashChange;  // TODO,对应新的hash执行的操作函数
12
} else {
13
  // 不支持则用定时器检测的办法
14
  setInterval(function() {
15
    // 检测hash值或其中某一段是否更改的函数, 在低版本的iE浏览器中通过window.location.hash取出的指和其它的浏览器不同,要注意
16
    var ischanged = isHashChanged();
17
    if (ischanged) {
18
        hashChange();  // TODO,对应新的hash执行的操作函数
19
    }
20
  }, 150);
21
}
22
5 23
new Vue({
6 24
  el: '#app',
7 25
  router: router,

+ 20 - 19
src/pages/h5/views/search/search.vue

@ -86,7 +86,7 @@ import baseResource from '@/components/subTemplate/BaseResource';
86 86
import baseResult from '@/components/subTemplate/BaseResult';
87 87
import baseContent from '@/components/subTemplate/BaseContent';
88 88
89
import loadmore from "./scrollMore.vue";
89
import loadmore from './scrollMore.vue';
90 90
export default {
91 91
  data() {
92 92
    return {
@ -184,6 +184,21 @@ export default {
184 184
      return this.orgList;
185 185
    }
186 186
  },
187
  watch: {
188
    activeTab(val) {
189
      var num = parseInt(val) - 1
190
      if (num < 3) {
191
        num = 0
192
      }
193
      this.mySwiperTab.slideTo(num, 500, false)
194
      this.clearToFun()
195
    },
196
    activeColumn(val) {
197
      this.contentList = []
198
      this.pageNo = 1
199
      this.contentListFun()
200
    }
201
  },
187 202
  created() {
188 203
    if (urlParse('n')) {
189 204
      this.activeTab = urlParse('n');
@ -208,24 +223,10 @@ export default {
208 223
  },
209 224
  methods: {
210 225
    slideChanged(val) {
211
      this.activeTab = val
212
      var num = parseInt(val) - 1
213
      if (num < 3) {
214
        num = 0
215
      }
216
      this.mySwiperTab.slideTo(num, 500, false)
217
      this.clearToFun()
226
      this.activeTab = val;
218 227
    },
219 228
    slideChangedColumn(val) {
220 229
      this.activeColumn = val
221
      var num = parseInt(val) - 1
222
      if (num < 3) {
223
        num = 0
224
      }
225
      this.swiperColumnTab.slideTo(num, 500, false)
226
      this.contentList = []
227
      this.pageNo = 1
228
      this.contentListFun()
229 230
    },
230 231
    clearToFun() {
231 232
      this.contentList = []
@ -424,6 +425,7 @@ export default {
424 425
      var that = this
425 426
      that.scrollData.loading = true
426 427
      this.$axios.get('/ajax/company/pq', {
428
        name: that.searchText,
427 429
        pageSize: that.rows,
428 430
        pageNo: that.pageNo
429 431
      }, (res) => {
@ -600,12 +602,11 @@ export default {
600 602
    }
601 603
  }
602 604
  &.columnTab{
603
    position: fixed;
604 605
    top: 80px;
605 606
    width: 100%;
606
    z-index: 3;
607
    z-index: 4;
607 608
    .swiper-slide-tab{
608
      margin:5px 4px;
609
      margin: 4px;
609 610
      line-height: 32px;
610 611
      padding:0 8px;
611 612
      &:after{