1class ScriptDownloadList extends Script { 2 constructor(params) { 3 super(params) 4 this.$dom = document.querySelector(`#${this.attrId}`) 5 this.$item = this.$dom.querySelector('.unit-download-list__item') 6 this.$fileInquiry = this.$dom.querySelectorAll("[file-inquiry]") 7 this.$submit = null 8 this.is_inquiry_captcha = 0 9 // 询çè¾å ¥ç¶æ 10 this.is_record_input = false 11 this.pageInfo = JSON.parse(this.utilts.htmlDecode(params.pageInfo)) 12 this.$nodataDom = this.$dom.querySelector('.page_no_data.d-none') 13 this.label_style = params.label_style 14 // this.listData = JSON.parse(params.listData) 15 this.config = JSON.parse(this.utilts.htmlDecode(params.config)) 16 this.$carouselEl = this.$dom.querySelector('.unit-download-list') 17 this.attrId = params.attrId 18 this.show_download_more = params.show_download_more || 0 19 this.downloadUrl = '' 20 } 21 /** åå§åï¼æ¯æå¼æ¥ */ 22 async init() { 23 await new Load('/assets/plugins/selector.js') 24 // if (!this.utilts.checkDesign()) { 25 this.initNodeEvent() 26 // this.initDownloadFileList() 27 if (this.config.swiper.is_swiper) { 28 this.listenSwiperInit([ 29 () => this.initDownloadFileList() 30 ]) 31 } else { 32 this.initDownloadFileList() 33 } 34 35 // } 36 } 37 /** 38 * çå¬Swiperåå§å 39 * 设置Swiperåå§ååéè¦æ§è¡çäºä»¶ 40 * @param {function[]} eventsInitSwiper 彿°æ°ç» 41 */ 42 listenSwiperInit(eventsInitSwiper) { 43 this.$carouselEl._eventsInitSwiper = eventsInitSwiper 44 } 45 46 /** 47 * ä¸è½½å表åå§å 48 */ 49 initDownloadFileList() { 50 let fileList = document.querySelectorAll(`#${this.attrId} .file-list`) 51 // let fileList = document.querySelectorAll(`#${this.attrId} .dl-select`) 52 let downloadFn = (href) => { 53 window.app.utilts.jupmLinkSave({href, target: '_blank'}) 54 } 55 // console.log(this.listData); 56 fileList.forEach((el,i)=>{ 57 let target = el.querySelector('.dl-select') 58 // let hrefs = el.querySelectorAll('a[content-id]') 59 // let fileData = this.listData[i] 60 let fileData = JSON.parse(decodeURIComponent(el.getAttribute("file-data")) || '[]') // 循ç¯è½®æä¼å¤å¶domï¼ 61 62 let option = fileData.file_list 63 option.forEach(op=>{ 64 op.name = op.content 65 op.value=op.url 66 }) 67 // let that = this 68 let pluginsSelector = new PluginSelector({ 69 target, 70 customClass: `${this.attrId} dl-more-list`, 71 readonly: true, 72 option: [{name:window.app.utilts.$t('More'),value:''},...option], 73 // placeholder: 'More', 74 onChange: res => { 75 // 妿éè¦å¨æåæ¢ hrefï¼å¯ä»¥å¨è¿éæ´æ° hrefs 76 // hrefs.forEach(a => { 77 // a.setAttribute('href', res.value) 78 // }) 79 if (fileData.is_limit) { 80 this.downLoadLimit(fileData.content_id, res.url) 81 } else { 82 downloadFn(res.value) 83 } 84 resetSelect('') 85 } 86 }) 87 let resetSelect = () => { 88 pluginsSelector.setValue('') 89 } 90 if (target) { 91 pluginsSelector.init() 92 pluginsSelector.setValue(''); 93 } 94 95 }) 96 } 97 downLoadLimit(contentId, downloadUrl = '') { 98 // 第ä¸ä¸ªåæ°downloadUrlæ¯ä¸ºäºå ¼å®¹å¤æä»¶ä¸è½½ï¼ç´æ¥ä¼ å ¥ä¸è½½å°å 99 this.utilts.request({ 100 prefix: 'jmc', 101 stringify: false, 102 url: '/download/get-url', 103 method: 'GET', 104 params: { 105 site_id: window.app.info.site.site_id, 106 id: contentId 107 } 108 }).then((res) => { 109 console.log('/download/get-url',res) 110 if (res && res.data && res.data.hasOwnProperty('download_status')) { 111 // 0:ä¸é;1:æäº¤è¯¢çæä¸è½½;2:ç»å½åæè½ä¸è½½ 112 const url = res.data.url 113 const download_status = res.data.download_status 114 const DOWNLOAD_STATUS = { 115 UN_LIMIT: 0, 116 LIMIT_INQUIRY: 1, 117 LIMIT_LOGIN: 2 118 } 119 if (url) { 120 window.open('/uncache/download.html?file=' + (downloadUrl || url), '_blank') 121 } else if (download_status === DOWNLOAD_STATUS.LIMIT_INQUIRY) { 122 // let key = [contentId, file_id || ''].filter(el=>el).join('-') 123 const files = this.utilts.getInquiredFiles() 124 if (files[contentId]) { 125 window.open('/uncache/download.html?file=' + (downloadUrl || files[contentId]), '_blank') 126 } else { 127 // this.initInquiry($el.getAttribute("content-id")) 128 this.initInquiry(contentId,downloadUrl) 129 } 130 } else if (download_status === DOWNLOAD_STATUS.LIMIT_LOGIN) { 131 sessionStorage.setItem('prev_url', location.pathname) 132 const msgBox = new Message() 133 msgBox.info(window.app.utilts.$t("Please login in first")) 134 setTimeout(function () { 135 msgBox.close() 136 location.href = '/login.html' 137 }, 2000) 138 } 139 } 140 }) 141 } 142 /** ç»å®äºä»¶ */ 143 initNodeEvent() { 144 const that = this 145 for (let $el of this.$fileInquiry) { 146 $el.addEventListener("click", (e) => { 147 e.preventDefault() 148 if ($el.hasAttribute('download-switch')) { 149 that.hasLinkFn($el) 150 return false 151 } 152 const contentId = $el.getAttribute("content-id") || 0 153 that.downLoadLimit(contentId) 154 // that.utilts.request({ 155 // prefix: 'jmc', 156 // stringify: false, 157 // url: '/download/get-url', 158 // method: 'GET', 159 // params: { 160 // site_id: window.app.info.site.site_id, 161 // id: contentId 162 // } 163 // }).then(function (res) { 164 // // console.log('/download/get-url',res) 165 // if (res && res.data && res.data.hasOwnProperty('download_status')) { 166 // // 0:ä¸é;1:æäº¤è¯¢çæä¸è½½;2:ç»å½åæè½ä¸è½½ 167 // const url = res.data.url 168 // const download_status = res.data.download_status 169 // const DOWNLOAD_STATUS = { 170 // UN_LIMIT: 0, 171 // LIMIT_INQUIRY: 1, 172 // LIMIT_LOGIN: 2 173 // } 174 // if (url) { 175 // window.open('/uncache/download.html?file=' + url, '_blank') 176 // } else if (download_status === DOWNLOAD_STATUS.LIMIT_INQUIRY) { 177 // const files = that.utilts.getInquiredFiles() 178 // if (files[contentId]) { 179 // window.open('/uncache/download.html?file=' + files[contentId], '_blank') 180 // } else { 181 // that.initInquiry($el.getAttribute("content-id")) 182 // } 183 // } else if (download_status === DOWNLOAD_STATUS.LIMIT_LOGIN) { 184 // sessionStorage.setItem('prev_url', location.pathname) 185 // const msgBox = new Message() 186 // msgBox.info(window.app.utilts.$t("Please login in first")) 187 // setTimeout(function () { 188 // msgBox.close() 189 // location.href = '/login.html' 190 // }, 2000) 191 // } 192 // } 193 // }) 194 return false 195 }) 196 } 197 } 198 hasLinkFn($el) { 199 const download_switch = $el.getAttribute("download-switch") || 0 200 const contentId = $el.getAttribute("content-id") || 0 201 if (Number(download_switch) === 1) { 202 const files = this.utilts.getInquiredFiles() 203 if (files[contentId]) { 204 window.open('/uncache/download.html?file=' + files[contentId], '_blank') 205 } else { 206 this.initInquiry($el.getAttribute("content-id")) 207 } 208 } else if (Number(download_switch) === 2) { 209 sessionStorage.setItem('prev_url', location.pathname) 210 const msgBox = new Message() 211 msgBox.info(window.app.utilts.$t("Please login in first")) 212 setTimeout(function () { 213 msgBox.close() 214 location.href = '/login.html' 215 }, 2000) 216 } 217 } 218 /** å建询ç */ 219 initInquiry(id,downloadUrl='') { 220 const that = this 221 this.downloadUrl = downloadUrl 222 const inquiryPopupContent = ` 223 <form method="post" id="inquiry-unit-${this.attrId}" class="needs-validation" inquiry="" novalidate=""> 224 <input type="hidden" name="content_id" value=""> 225 <div class="form-row"> 226 <div class="unit-form__title">${window.app.utilts.$t('Send your inquiry')}</div> 227 <div class="unit-form__item form-group contacts col col-12 col-md-12 col-xl-12"> 228 <label class="unit-form__item-inner"> 229 <input class="unit-form__control form-control" type="text" name="contacts" autocomplete="off" placeholder="name" maxlength="200" required=""> 230 <div class="invalid-feedback">${window.app.utilts.$t('Please enter your name')}!</div>
231 <span class="unit-form__label col-form-label">${window.app.utilts.$t('name')}</span> 232 </label> 233 </div> 234 <div class="unit-form__item form-group email col col-12 col-md-12 col-xl-12"> 235 <label class="unit-form__item-inner"> 236 <input class="unit-form__control form-control" type="email" name="email" autocomplete="off" placeholder="email" maxlength="200" required="" pattern="[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)*@[a-zA-Z0-9_]+(-?[a-zA-Z0-9\\.]+)*(\\.[a-zA-Z]{2,})$"> 237 <div class="invalid-feedback">${window.app.utilts.$t('Please enter a valid email address')}!</div> 238 <span class="unit-form__label col-form-label">${window.app.utilts.$t('email')}</span> 239 </label> 240 </div> 241 <div class="unit-form__item form-group phone col col-12 col-md-12 col-xl-12"> 242 <label class="unit-form__item-inner"> 243 <input class="unit-form__control form-control" type="text" name="phone" autocomplete="off" placeholder="phone" maxlength="200" required=""> 244 <div class="invalid-feedback">${window.app.utilts.$t('Please enter a valid phone')}!</div> 245 <span class="unit-form__label col-form-label">${window.app.utilts.$t('phone')}</span> 246 </label> 247 </div> 248 <div class="unit-form__item form-group company_name col col-12 col-md-12 col-xl-12"> 249 <label class="unit-form__item-inner"> 250 <input class="unit-form__control form-control" type="text" name="company_name" autocomplete="off" placeholder="company name" maxlength="200"> 251 <div class="invalid-feedback">${window.app.utilts.$t('input must not exceed 200 in length')}!</div> 252 <span class="unit-form__label col-form-label">${window.app.utilts.$t('Company Name')}</span> 253 </label> 254 </div> 255 <div class="unit-form__item form-group col-12"> 256 <label class="unit-form__item-inner"> 257 <textarea class="unit-form__control form-control" rows="5" name="content" maxlength="65530" placeholder="content" required="" minlength=""></textarea> 258 <div class="invalid-feedback">${window.app.utilts.$t('the content cannot be empty and cannot exceed 65530')}!</div> 259 <span class="unit-form__label col-form-label">${window.app.utilts.$t('content')}</span> 260 </label> 261 </div> 262 263 <div class="unit-form__item unit-form__item-submit form-group col"> 264 <div class="unit-form__submit-wrap" button-style="2"> 265 <div class="base-button"> 266 <button class="base-button__inner btn" type="submit"> 267 <div class="d-inline-block">${window.app.utilts.$t('send inquiry now')}</div> 268 </button> 269 </div> 270 </div> 271 </div> 272 </div> 273 </form>` 274 275 let inquiryPopupNode = document.getElementById('inquiry-popup') 276 if (!inquiryPopupNode) { 277 inquiryPopupNode = document.createElement('div') 278 inquiryPopupNode.innerHTML = ` 279 <div class="unit-inquiry-popup__window"> 280 <div class="unit-inquiry-popup__close">Ã</div> 281 <div class="unit-inquiry-popup__content" label-style="${that.label_style}">${inquiryPopupContent}</div> 282 </div>` 283 284 inquiryPopupNode.setAttribute('id', 'inquiry-popup') 285 inquiryPopupNode.className= "unit-inquiry-popup__window-wrap" 286 inquiryPopupNode.getElementsByClassName("unit-inquiry-popup__close")[0].addEventListener('click', function() { 287 inquiryPopupNode.classList.remove("show") 288 }) 289 290 this.$submit = inquiryPopupNode.querySelector('[type="submit"]') 291 292 inquiryPopupNode.querySelector('form').addEventListener('submit', async (event) => { 293 event.preventDefault() 294 // éªè¯è¡¨åä¿¡æ¯æ¯å¦åæ³ï¼ä¸åæ³ä¸æäº¤ 295 if (!this._inquirySet(event, inquiryPopupNode.querySelector('form'))) return 296 this.utilts.setBtnLoadingStatus(this.$submit, true) 297 // 设置ï¼è·åè¦ä¿åç表åä¿¡æ¯ 298 const { preset_config } = this._inquiryConfig(inquiryPopupNode.querySelector('form')) 299 // è®°å½æäº¤è®°å½ 300 await this.utilts.setInquiryRecord('inquiry_submit', this._getConfigParams(preset_config)) 301 this._inquiryRequest({...preset_config,downloadUrl: this.downloadUrl}) 302 }) 303 304 inquiryPopupNode.querySelectorAll('input').forEach($el => { 305 $el.addEventListener('focus', () => { 306 if (!that.is_record_input) { 307 that.is_record_input = true 308 that.utilts.setInquiryRecord('inquiry_start').then(function(){}) 309 } 310 }) 311 }) 312 313 inquiryPopupNode.addEventListener('wheel', function (e) { 314 e.stopPropagation() 315 if (!e.target.closest('.unit-inquiry-popup__window')) { 316 e.preventDefault() 317 } 318 }) 319 320 inquiryPopupNode.addEventListener('touchmove', function (e) { 321 e.stopPropagation() 322 if (!e.target.closest('.unit-inquiry-popup__window')) { 323 e.preventDefault() 324 } 325 }) 326 327 inquiryPopupNode.querySelectorAll('[type="email"]').forEach(formItem => { 328 formItem.addEventListener('blur', function () { 329 formItem.value = formItem.value.toLowerCase() 330 }) 331 }) 332 333 document.body.appendChild(inquiryPopupNode) 334 } 335 336 inquiryPopupNode.querySelector('[name="content_id"]').setAttribute('value', id
336) 337 inquiryPopupNode.classList.add('show') 338 } 339 340 _inquirySet(event, $form) { 341 event.preventDefault() 342 event.stopPropagation() 343 // è£ ä¿®æ¨¡å¼ä¸ä¸è½ä¿å表å 344 if (window.app.info.utilts.checkDesign()) return false 345 $form.classList.add('was-validated') 346 let success = true 347 // éªè¯è¡¨å项 348 for (const $formItem of $form) { 349 if (!$formItem.checkValidity()) { 350 success = false 351 break 352 } 353 } 354 return success 355 } 356 357 // è·åconfig 358 _inquiryConfig($form) { 359 // è·åè¦ä¿åçä¿¡æ¯ 360 var preset_config = {} //é»è®¤ç表å项 361 const formData = new FormData($form) 362 const serializeArray = [] 363 for (const item of formData) { 364 serializeArray.push({ name: item[0], value: item[1] }) 365 } 366 // åºåèªå®ä¹è¡¨åå ç´ åç³»ç»è¡¨åå ç´ 367 serializeArray.forEach(function (item, index) { 368 preset_config[item.name] = item.value 369 }) 370 return { preset_config } 371 } 372 373 // 询ç表åæäº¤ 374 async _inquiryRequest(preset_config) { 375 const params = this._getConfigParams(preset_config) 376 params['need'] = 'download_url' 377 const utilts = window.app.utilts 378 const that = this 379 const _handleInquiry = async function (captcha, flagRetry) { 380 if (captcha) { 381 // è ¾è®¯éªè¯ 382 const captcha_token = await that.utilts.checkTCaptcha('inquiry') 383 if (captcha_token) params.token = captcha_token 384 else { 385 utilts.setBtnLoadingStatus(that.$submit, false) 386 return 387 } 388 } 389 const stringify = 1 390 const url = '/inquiry/insert' 391 const method = 'POST' 392 if(sessionStorage.getItem('ip')){ 393 params.ip = sessionStorage.getItem('ip') 394 } 395 return utilts.request({stringify, url, method, params}) 396 .then(res => { 397 utilts.recordClientInquiredTimes() 398 that.handleInquireSuccess(res, params) 399 }) 400 .catch((res) => { 401 if (res && res.code && parseInt(res.code) === 103) { 402 // 103 éªè¯ç 403 if (flagRetry) { 404 // 鲿¢æ éå¼¹éªè¯ç 405 throw new Error('retry captcha') 406 } 407 return _handleInquiry(true, true) 408 } else if (res && res.msg) { 409 new Modal().warning(res.msg, 'Prompt').open() 410 } else { 411 console.error(res) 412 new Modal().warning('Unknown error', 'Prompt').open() 413 } 414 utilts.setBtnLoadingStatus(that.$submit, false) 415 }) 416 } 417 let needleCaptcha = false
418 const cfgRes = await this.getSiteData() 419 if (cfgRes && cfgRes.data && cfgRes.data.tencent_verify_id) { 420 // è®¾ç½®ææ°çéªè¯ç 客æ·ç«¯id 421 window.app.info.site.tencent_verify_id = cfgRes.data.tencent_verify_id 422 } 423 if (cfgRes.data && cfgRes.data.site_config) { 424 const site_config = cfgRes.data.site_config 425 const page_type = window.app.info.page.page_type || '' 426 const is_landing_page = page_type === 'landing_page' 427 const captcha_switch = is_landing_page ? site_config.ads_inquiry_captcha_switch : site_config.inquiry_captcha_switch 428 const first_no_check = is_landing_page ? site_config.ads_inquiry_captcha_first_no_check_switch : site_config.inquiry_captcha_first_no_check_switch 429 const count = utilts.getClientInquiredTimes() 430 needleCaptcha = captcha_switch ? ( first_no_check ? count > 0 : true ) : false 431 if (site_config.inquiry_success_redirect_time && !isNaN(site_config.inquiry_success_redirect_time)) { 432 sessionStorage.setItem('success_redirect_time', Number(site_config.inquiry_success_redirect_time)) 433 } 434 } 435 return _handleInquiry(needleCaptcha, false) 436 } 437 438 /** 439 * 询çæå 440 * @param res 441 * @param {{email?:string}} params 442 */ 443 handleInquireSuccess(res, params) { 444 try { 445 const download_url = (res && res.data && res.data.download_url) || '' 446 this.utilts.setBtnLoadingStatus(this.$submit, false) 447 this.utilts.setGtag('begin_inquiy') 448 const contentId = params.content_id || 0 449 this.utilts.recordInquiredFile(contentId, download_url) 450 window.app.info.user.guest_id = res.data.member_id 451 sessionStorage.setItem('prev_url', location.pathname) 452 window.open('/uncache/download.html?file=' + (params.downloadUrl || res.data.download_url), '_blank') 453 sessionStorage.setItem('prev_inquire_email', (params && params.email) || '') 454 window.location.href = globalThis.Server.getRinseHref('/inquire_success.html', window.app.info.site) 455 } catch (err) { 456 console.error("err.message", err.message) 457 } 458 } 459 460 /** 461 * è·åæ¯å¦å¼å¯å¹¿å页询çéªè¯ 462 * è¿ç§»å° Utilts.getSiteData 463 * @deprecated 464 * @returns {Promise<unknown>} 465 */ 466 async getSiteData() { 467 const params = { 468 site_id: window.app.info.site.site_id 469 } 470 return await this.utilts.request({ 471 url: '/site/info', 472 method: 'get', 473 params 474 }).then(res => { 475 if (res.code == 0) { 476 this.is_inquiry_captcha = res.data.inquiry_captcha 477 } 478 return res 479 }) 480 } 481 482 /** è·å表åè¦æäº¤çåæ° */ 483 _getConfigParams(preset_config) { 484 let params = Object.assign({}, preset_config, { 485 site_id: window.app.info.site.site_id, 486 visitor_code: window.app.info.user.visitor_code, 487 visitor_id: window.app.info.user.visitor_id, 488 ip: window.app.info.user.visitor_ip, 489 inquiry_record: this.utilts.getDevice(), 490 // member_id: window.app.info.user.user_id, 491 content_type: window.app.info.source.source_content_type, 492 page_url: window.app.info.tempValidPage.href, 493 page_type: window.app.info.page.page_type, 494 source: window.app.info.source.source_result, 495 language_code: window.app.info.site.language_code 496 }) 497 return params 498 } 499 async renderList({keyword='',page_number=1}) { 500 const num = page_number || this.pageInfo.page_number 501 const size = this.pageInfo.page_size 502 this.$nodataDom.classList.remove('on') 503 let page_category_id = this.pageInfo.page_category_id || 0 504 window.app.info.page.cur_page_category_id = page_category_id 505 const data = await window.app.getDownloadListPageBySearch(num, size,keyword,page_category_id) 506 // if (tabType === 'youMightLike') tabType = 'you might like' 507 // else if (tabType === 'products-similar') tabType = 'similar' 508 const $nodeList = this.$dom.querySelector('.unit-download-list__items') 509 this.getTabList($nodeList || this.$unitList, data.list) 510 if (!data.total) { 511 this.$nodataDom.classList.add('on') 512 } 513 } 514 getTabList($tabNode, list) { 515 // const self = this 516 $tabNode.innerHTML = '' 517 // if (list.length === 0 && this.$noData) { 518 // this.$noData.classList.remove('d-none') 519 // return 520 // }
521 // this.$noData.classList.add('d-none') 522 // const params = { 523 // open_hover: this.open_hover, 524 // attrId: this.attrId, pageInfo: this.pageInfo, colInfo: this.colInfo, config: this.config 525 // } 526 // this.element = new ScriptListElement(params) 527 // for (let index = 0; index < list.length; index++) { 528 // const item = list[index]; 529 // const $itemNode = this.element.getItem(item) 530 // this.element.$items.append($itemNode) 531 // } 532 list.forEach((el,index)=>{ 533 let item = this.$item.cloneNode(true) 534 let downloadFn = () => { 535 window.app.utilts.jupmLinkSave({href:el.url, target: '_blank'}) 536 } 537 // å°é¢ 538 let imgDom = item.querySelector('.base-image__img') 539 if (imgDom) imgDom.src = el.thumb 540 // å°é¢çaæ ç¾ 541 let tagADom = item.querySelector('.unit-download-list__image.unit-download-list__a') 542 if (tagADom) { 543 // tagADom.setAttribute('content-id', el.id) 544 // tagADom.setAttribute('href', el.url) 545 // tagADom.setAttribute('target', '_blank') 546 if (el.download_switch === 2 || (!el.is_limit)) { 547 tagADom.removeAttribute('file-inquiry') 548 tagADom.addEventListener('click',downloadFn) 549 }else { 550 tagADom.setAttribute('file-inquiry', '1') 551 } 552 tagADom.setAttribute('content-id', el.id) 553 tagADom.removeAttribute('href') 554 // Object.assign(tagADom,{ 555 // 'content-id': el.id, 556 // 'href': el.url, 557 // 'target': '_blank' 558 // }) 559 } 560 // æ é¢ 561 let titleDom = item.querySelector('.unit-download-list__title a') 562 if (titleDom) { 563 titleDom.innerHTML = el.title 564 titleDom.title = el.title 565 // titleDom.setAttribute('content-id', el.id) 566 // titleDom.setAttribute('href', el.url) 567 // titleDom.setAttribute('target', '_blank') 568 if (el.download_switch === 2 || (!el.is_limit)) { 569 titleDom.removeAttribute('file-inquiry') 570 titleDom.addEventListener('click',downloadFn) 571 }else { 572 titleDom.setAttribute('file-inquiry', '1') 573 } 574 titleDom.setAttribute('content-id', el.id) 575 titleDom.removeAttribute('href') 576 // Object.assign(titleDom,{ 577 // 'content-id': el.id, 578 // 'href': el.url, 579 // 'target': '_blank' 580 // }) 581 } 582 // 坿 é¢ 583 let subtitleDom = item.querySelector('.unit-download-list__subtitle>div') 584 if (subtitleDom) { 585 subtitleDom.innerHTML = el.subtitle 586 } 587 // ç®ä» 588 let summaryDom = item.querySelector('.unit-download-list__description>div') 589 if (summaryDom) { 590 summaryDom.innerHTML = el.summary 591 } 592 // ä¸è½½id 593 let downloadBtn = item.querySelector('.read_more [content-id]') 594 if (downloadBtn) { 595 // downloadBtn.setAttribute('content-id', el.id) 596 // downloadBtn.setAttribute('href', el.url) 597 // downloadBtn.setAttribute('target', '_blank') 598 if (el.download_switch === 2 || (!el.is_limit)) { 599 downloadBtn.removeAttribute('file-inquiry') 600 downloadBtn.addEventListener('click',downloadFn) 601 }else { 602 downloadBtn.setAttribute('file-inquiry', '1') 603 } 604 downloadBtn.setAttribute('content-id', el.id) 605 downloadBtn.removeAttribute('href') 606 // Object.assign(downloadBtn,{ 607 // 'content-id': el.id, 608 // 'href': el.url, 609 // 'target': '_blank' 610 // }) 611 612 // if (el.is_limit) { 613 // downloadBtn.setAttribute('file-inquiry', '1') 614 // }else{ 615 // downloadBtn.removeAttribute('file-inquiry') 616 // } 617 let picDom = item.querySelector('.base-image--scale') 618 if (picDom) { 619 picDom.classList.remove('base-image--scale') 620 } 621 } 622 // ä¸è½½éæ© 623 let oldSelect = item.querySelector('.dl-select') 624 if (oldSelect) { 625 oldSelect.remove() // å 餿§ç 626 } 627 let selectElBox = item.querySelector('.select-flex') 628 let selectEl = document.createElement('div'); 629 let fileData = list[index] || {} 630 let file_list = fileData.file_list || [] 631 let option = file_list 632 option.forEach(op=>{ 633 op.name = op.content 634 op.value=op.url 635 }) 636 if (file_list.length > 1 && this.show_download_more>0) { 637 // console.log(2222333,fileData); 638 639 selectEl.className = 'dl-select' 640 let pluginsSelector = new PluginSelector({ 641 target:selectEl, 642 customClass: `${this.attrId} dl-more-list`, 643 readonly: true, 644 option: [{name:window.app.utilts.$t('More'),value:''},...option], 645 onChange: res => { 646 // const hrefs = item.querySelectorAll('a[content-id]')
647 // hrefs.forEach(a => { 648 // a.setAttribute('data-href', res.value) // ä¿åæ°çä¸è½½å°å 649 // const newA = a.cloneNode(true) 650 // a.replaceWith(newA) 651 // newA.addEventListener('click', e => { 652 // e.preventDefault() 653 // e.stopPropagation() 654 // const url = newA.getAttribute('data-href') 655 // const target = newA.getAttribute('target') || '_blank' 656 // const name = newA.innerText || newA.getAttribute('tname') || 'å¹³å°å¯¼æµ' 657 // window.app.utilts.jupmLinkSave({ href: url, target, name }) 658 // }) 659 // }) 660 if (fileData.is_limit) { 661 this.downLoadLimit(fileData.id, res.url) 662 } else { 663 window.app.utilts.jupmLinkSave({href:res.value, target: '_blank'}) 664 } 665 resetSelect('') 666 } 667 }) 668 pluginsSelector.init() 669 let resetSelect = () => { 670 pluginsSelector.setValue(''); 671 } 672 pluginsSelector.setValue(''); 673 selectElBox.appendChild(selectEl) 674 } 675 676 $tabNode.append(item) 677 }) 678 this.$fileInquiry = this.$dom.querySelectorAll("[file-inquiry]") 679 this.initNodeEvent() 680 // $tabNode.append(this.element.$container) 681 // if (this.config.swiper.is_swiper) { 682 // $tabNode.setAttribute('data-carousel', 0) 683 // } 684 // window.addEventListener('hookInitContentRender', function () { 685 // self.initHoverImg() 686 // }, { 687 // once: false 688 // }) 689 // window.app.initPlug(this.attrId 690 // this.initQuoteList() 691 } 692}
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.