PageSourceSearch

https://apsgo.com/assets/views/home/search.js?v=2

js apsgo.com collected 2026-10-04 21:00:19 UTC 3,392 bytes, 118 lines download raw bytes

1new Vue({
2  el: "#app",
3  data: {
4    activeKey: ['1', '2'],
5    page: 1,
6    products: {
7      total: 0
8    },
9    cate: 0,
10    cate2: 0,
11    sort: {
12      date: 'desc'
13    },
14    tag: '',
15    spinning: false,
16    loading: false,
17    isTicketsId: 0,
18  },
19  mounted() {
20    this.page = parseInt(app.getQuery('page')) || 1;
21    this.cate = app.getQuery('cate') || 0;
22    this.cate2 = app.getQuery('cate2') || 0;
23    this.tag = app.getQuery('tag') || '';
24    this.seckill = app.getQuery('seckill') || '';
25    this.type = app.getQuery('type') || '';
26    this.isplus = app.getQuery('isplus') || '';
27    let sort = app.getQuery('sort') || 'date-desc';
28    this.sort.date = sort == 'date-desc' ? 'desc' : 'asc';
29    app.keyword = decodeURI(app.getQuery('keyword')) || '';
30    app.keyword_input_start = !!app.keyword
31    this.categoryScrollable();
32    this.$nextTick(() => {
33      this.keywordsHighlight()
34    })
35  },
36  methods: {
37    getProducts() {
38      if (!app.isLogin) {
39        app.showLoginModal();
40        return;
41      }
42
43      let url = "/search?seckill=" + this.seckill + "&keyword=" + app.keyword + '&cate=' + this
44        .cate + '&cate2=' + this.cate2 + "&page=" + this.page + '&isplus=' + this.isplus +
45        '&sort=date-' + this.sort.date + '&tag=' + this.tag;
46      window.location.href = url;
47    },
48    selectCate(id) {
49      this.cate = id;
50      this.cate2 = 0;
51      this.page = 1;
52      this.getProducts();
53    },
54    selectCate2(id) {
55      this.cate2 = id;
56      this.page = 1;
57      this.getProducts();
58    },
59    setSort(field) {
60
61      this.sort[field] = this.sort[field] == 'desc' ? 'asc' : 'desc';
62      this.page = 1;
63
64      this.getProducts();
65    },
66    setTag(tag) {
67      this.tag = tag;
68      this.page = 1;
69      this.getProducts();
70    },
71    categoryScrollable() {
72      let scrollContainer = document.querySelector('.filter-box.class-list .class-item')
73      if (scrollContainer) {
74        scrollContainer.addEventListener('wheel', function (event) {
75          event.preventDefault(); // 阻止默认的滚动行为
76          scrollContainer.scrollLeft = scrollContainer.scrollLeft - event.wheelDelta; // 设置新的滚动位置
77        }, { passive: false }); // passive选项设置为false以允许默认行为,但在这里我们阻止了它
78
79        setTimeout(() => {
80          let left = 0,
81            itemList = document.querySelectorAll('.filter-box.class-list .class-item>.item')
82
83          for (let item of itemList) {
84            if (item.classList.contains('active')) {
85              break
86            }
87            left += item.offsetWidth
88          }
89          if (left > scrollContainer.offsetWidth / 2) {
90            scrollContainer.scrollLeft = left - scrollContainer.offsetWidth / 2
91          }
92        }, 500)
93
94      }
95
96    },
97    searchCreateWorkOrder(el) {
98      if (this.loading) {
99        return;
100      }
101      if (this.isTicketsId) {
102        openTickets(`openid=` + this.isTicketsId, 2);
103      } else {
104        this.loading = true;
105        newTickets(`搜索时未找到“${app.keyword}”相关商品`, '来源搜索').then(res => {
106          this.loading = false;
107          this.isTicketsId = res.tickets_id;
108        })
109      }
110
111    },
112    keywordsHighlight() {
113      document.querySelectorAll('.goods-item .goods-name').forEach(el => {
114        el.innerHTML = app.highlightText(el.innerHTML, app.keyword)
115      })
116    }
117  }
118})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.