PageSourceSearch

https://www.pioneerplastechs.com/assets/js/unit/matching-product.js

js pioneerplastechs.com collected 2026-10-04 03:20:25 UTC 2,375 bytes, 71 lines download raw bytes

1class ScriptMatchingProduct extends Script {
2  constructor(params) {
3    super(params)
4    this.attrList = JSON.parse(params.attrList)
5    this.attrId = params.attrId
6  }
7  /** 初始化,支持异步 */
8  init() {
9    if (this.attrList.length === 0) return
10    this.initVue()
11  }
12  async initVue() {
13    const _this = this
14    await new Load('/assets/plugins/vue.min.js')
15    new Vue({
16      el: `#${this.attrId} .unit-matching-product`,
17      data: {
18        search_active_content: '',
19        is_default: true,
20        result: {
21          status: false,
22          content: ''
23        },
24        modal: null,
25        // 缓存modal,防止重复请求数据
26        modalPromise: null
27      },
28      created() {
29        this.initModal()
30      },
31      methods: {
32        /** 初始化modal,重复调用返回同一个promise,防止重复请求数据 */
33        async initModal() {
34          if (!this.modalPromise) {
35            // 缓存modal,防止重复请求数据
36            this.modalPromise = new Promise(async resolve => {
37              await new Load('/assets/plugins/quick-search.js')
38              this.modal = await new PluginQuickSearch({ attrId: this.attrId, type: 2 }).modal({
39                onSubmit: () => {
40                  this.changeSearch(this.modal.searchId)
41                  this.modal.closeModal()
42                }
43              })
44              resolve()
45            })
46          }
47          return this.modalPromise
48        },
49        showModal() {
50          // 需要等modal准备好才能调用
51          this.initModal().then(() => this.modal.showModal())
52        },
53        /** 查找匹配结果 */
54        changeSearch(id) {
55          const list = []
56          this.is_default = id === 0
57          _this.attrList.forEach(item => {
58            const data = item.filter(child => child.id === id)
59            list.push(...data)
60          })
61          if (list.length > 0) this.$set(this.result, 'content', list[0].content)
62          if (id === 0) window.app.info.productDetail.is_match_paramter = 1
63          else if (list.length === 0 && id > 0) window.app.info.productDetail.is_match_paramter = 0
64          else if (list.length > 0 && id > 0) window.app.info.productDetail.is_match_paramter = 1
65          this.$set(this.result, 'status', !!list.length)
66          window.app.info.renderDetailView()
67        }
68      }
69    })
70  }
71}

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.