${(function(){ const get_random_six_digits = () => { return Math.random().toString().slice(-6) }; const wholesale_enabled = false; const setting_product_image_display = "133.33%"; const product_image = data.image; const secondary_image = data.secondImage; const image_width = product_image.width; let image_height = product_image.height; if(setting_product_image_display == '100%'){ image_height = image_width }else if(setting_product_image_display == '133.33%'){ image_height = image_width * 1.3333; }; const product_image_hover_on = true && !!secondary_image.src; const has_save_label = true && ((+data.compare_at_price) > (+data.price)); const is_single_variant = data.variants.length == 1; const min_price_variant_href = (data.min_price_variant && data.min_price_variant.available) ? data.min_price_variant.withinUrl : data.withinUrl; const retail_price_max = data.retail_price_max || data.compare_at_price_max; const THUMBNAILS_MAX_SIZE = 3; const thumbnails = data.thumbVariants.slice(0, THUMBNAILS_MAX_SIZE); const image_wrap_id = 'image_wrap_' + get_random_six_digits(); const image_carousel_id = 'image_carousel_' + get_random_six_digits(); const thumbnails_selector_id = 'thumbnails_selector_' + get_random_six_digits(); const form_id = 'form_' + get_random_six_digits(); const mixed_wholesale = data.mixed_wholesale; return `
${ data.available ? `${ (+data.compare_at_price > +data.price) ? `Save
` : '' }` : "Sold out" }
Mixed Lot
${data.title}
${ data.price_min != data.price_max ? `from
` : `
` }
+${data.remainInvisibleThumbCount}
` })()}
30-Day Return,Buy Now to Add 2-Year Warranty
30-Day Return,Buy Now to Add 2-Year Warranty
Search
Log in
Create an account
${data.data && data.data.count}
HOME
PRODUCTS
Top Seller
Smart Recessed Lights
Gimbal-smart Recessed Light
Smart High Bay Lights
Landscape Spot Lights
Smart Outdoor Lights
Lumary Water Timer
Smart Disk Light
Smart Plug | Smart Wall Outlet
Smart Rgbai Ceiling Fan Light
Zigbee Smart Recessed Lighting Hdmi Sync Box Kit
Smart Indoor Lights
Lumary Permanent Outdoor Lights Max
from
$299.99
NEW ARRIVAL
NEWS
Influencers
Blog
SUPPORT
APP FAQ
Smart Outlet FAQ
Smart Recessed Lighting FAQ
Contact Us
PARTNER
Affiliate Program
Cooperation Program
BUY ON LUMARY ONLINE STORE
More links
${(function(){ var linkList =[false,true,false,true,true,true,false].slice(offset); var hasChild = linkList.some(v => v); if(!hasChild){ return `
HOME
PRODUCTS
NEW ARRIVAL
NEWS
SUPPORT
PARTNER
BUY ON LUMARY ONLINE STORE
` } return `
HOME
PRODUCTS
NEW ARRIVAL
NEWS
SUPPORT
PARTNER
BUY ON LUMARY ONLINE STORE
Top Seller
Smart Recessed Lights
Gimbal-smart Recessed Light
Smart High Bay Lights
Landscape Spot Lights
Smart Outdoor Lights
Lumary Water Timer
Smart Disk Light
Smart Plug | Smart Wall Outlet
Smart Rgbai Ceiling Fan Light
Zigbee Smart Recessed Lighting Hdmi Sync Box Kit
Smart Indoor Lights
Influencers
Blog
APP FAQ
Smart Outlet FAQ
Smart Recessed Lighting FAQ
Contact Us
Affiliate Program
Cooperation Program
` })()}
HOME
PRODUCTS
Top Seller
Smart Recessed Lights
Gimbal-smart Recessed Light
Smart High Bay Lights
Landscape Spot Lights
Smart Outdoor Lights
Lumary Water Timer
Smart Disk Light
Smart Plug | Smart Wall Outlet
Smart Rgbai Ceiling Fan Light
Zigbee Smart Recessed Lighting Hdmi Sync Box Kit
Smart Indoor Lights
Lumary Permanent Outdoor Lights Max
from
$299.99
NEW ARRIVAL
NEWS
Influencers
Blog
SUPPORT
APP FAQ
Smart Outlet FAQ
Smart Recessed Lighting FAQ
Contact Us
PARTNER
Affiliate Program
Cooperation Program
BUY ON LUMARY ONLINE STORE
More links
${(function(){ var linkList =[false,true,false,true,true,true,false].slice(offset); var hasChild = linkList.some(v => v); if(!hasChild){ return `
HOME
PRODUCTS
NEW ARRIVAL
NEWS
SUPPORT
PARTNER
BUY ON LUMARY ONLINE STORE
` } return `
HOME
PRODUCTS
NEW ARRIVAL
NEWS
SUPPORT
PARTNER
BUY ON LUMARY ONLINE STORE
Top Seller
Smart Recessed Lights
Gimbal-smart Recessed Light
Smart High Bay Lights
Landscape Spot Lights
Smart Outdoor Lights
Lumary Water Timer
Smart Disk Light
Smart Plug | Smart Wall Outlet
Smart Rgbai Ceiling Fan Light
Zigbee Smart Recessed Lighting Hdmi Sync Box Kit
Smart Indoor Lights
Influencers
Blog
APP FAQ
Smart Outlet FAQ
Smart Recessed Lighting FAQ
Contact Us
Affiliate Program
Cooperation Program
` })()}
Log in
Create an account
${data.data && data.data.count}
Search
${(function(){ if (data === undefined || typeof data !== 'string' || data == '') return '
'; const keyword = encodeURIComponent(data); return `
View more
Your search for '${data}' did not yield any results.
` })()}
${(function(){ if (data === undefined || typeof data !== 'string' || data == '') return '
'; const keyword = encodeURIComponent(data); return `
View more
Your search for '${data}' did not yield any results.
` })()}
HOME
PRODUCTS
PRODUCTS
Top Seller
Smart Recessed Lights
Gimbal-smart Recessed Light
Smart High Bay Lights
Landscape Spot Lights
Smart Outdoor Lights
Lumary Water Timer
Smart Disk Light
Smart Plug | Smart Wall Outlet
Smart Rgbai Ceiling Fan Light
Zigbee Smart Recessed Lighting Hdmi Sync Box Kit
Smart Indoor Lights
NEW ARRIVAL
NEWS
NEWS
Influencers
Blog
SUPPORT
SUPPORT
APP FAQ
Smart Outlet FAQ
Smart Recessed Lighting FAQ
Contact Us
PARTNER
PARTNER
Affiliate Program
Cooperation Program
BUY ON LUMARY ONLINE STORE
Log in
Create an account
(function(){ let w = window.innerWidth; function setHeaderCssVar() { const headerEle = document.getElementById('shoplaza-section-header'); if(!headerEle){ return }; document.body.style.setProperty('--window-height', `${window.innerHeight}px`); document.body.style.setProperty('--header-height', `${headerEle.clientHeight}px`); const mdScorllHideEle = headerEle.querySelector('.header__mobile .header__scroll_hide'); if (mdScorllHideEle) { document.body.style.setProperty('--header-scroll-hide-height-md', `${mdScorllHideEle.clientHeight}px`); } const pcScorllHideEle = headerEle.querySelector('.header__desktop .header__scroll_hide'); if (pcScorllHideEle) { document.body.style.setProperty('--header-scroll-hide-height-pc', `${pcScorllHideEle.clientHeight}px`); } } function handlResize() { if(w == window.innerWidth){return}; w = window.innerWidth; setHeaderCssVar(); }; function init(){ setHeaderCssVar(); window.removeEventListener('resize', window._theme_header_listener) window._theme_header_listener = handlResize; window.addEventListener('resize', window._theme_header_listener); } init(); })();
Lumary Smart Home Blog
Search
Modern Wall Sconce Trends Shaping Interiors in 2025
by Lumary
How to Replace Traditional Recessed Lights with Energy-Efficient LEDs
by Lumary
Easy Steps to Install Disc Lights in 2025
by Lumary
LED Disc Lights Explained: Features and Advantages
by Lumary
Top Tips for Installing Outdoor LED Rope Lights
by Lumary
How to Choose the Best Smart Outdoor Lighting
by Lumary
How to Choose the Best Outdoor LED Bulbs for Your Home
by Lumary
Why LED Outdoor Spotlights Are Better for the Environment
by Lumary
Top Tips for Choosing LED Landscape Lighting in 2025
by Lumary
${data.title}
by ${data.author}
Your search for '${ data.query.keyword }' did not yield any results.
Cart
Your shopping bag is empty
Continue shopping
${item.product_title}
${item.options.map(option => option.value).join('/')}
${propertie.name}/${propertie.isImage ? `
View image
` : propertie.value}
Free gift
Mixed Lot
*${item.quantity}
${item.item_text}
${discount_item.title}
(-
)
Total:
${function() { const textArray = ("Save {{save_amount}}").split(/\{\{\s*save_amount\}\}/); if (textArray.length > 0 && textArray.length < 2) { textArray.push(''); } return textArray.map((text, index) => { if (index == 0) { return `
${text}
`; } return `
${text}
`; }).join(''); }()}
${function() { const textArray = ("Save {{save_amount}}").split(/\{\{\s*save_amount\}\}/); if (textArray.length > 0 && textArray.length < 2) { textArray.push(''); } return textArray.map((text, index) => { if (index == 0) { return `
${text}
`; } return `
${text}
`; }).join(''); }()}
${discount_application.title}:
-
${data.invalid_msg}
Check out
Taxes and shipping calculated at checkout
${data.invalid_msg}
Total:
${function() { const textArray = ("Save {{save_amount}}").split(/\{\{\s*save_amount\}\}/); if (textArray.length > 0 && textArray.length < 2) { textArray.push(''); } return textArray.map((text, index) => { if (index == 0) { return `
${text}
`; } return `
${text}
`; }).join(''); }()}
${function() { const textArray = ("Save {{save_amount}}").split(/\{\{\s*save_amount\}\}/); if (textArray.length > 0 && textArray.length < 2) { textArray.push(''); } return textArray.map((text, index) => { if (index == 0) { return `
${text}
`; } return `
${text}
`; }).join(''); }()}
${function() { const textArray = ("Save {{save_amount}}").split(/\{\{\s*save_amount\}\}/); if (textArray.length > 0 && textArray.length < 2) { textArray.push(''); } return textArray.map((text, index) => { if (index == 0) { return `
${text}
`; } return `
${text}
`; }).join(''); }()}
${discount_application.title}:
-
Check out
${data.invalid_msg}
Check out
Taxes and shipping calculated at checkout
Subtotal:
${discount_application.title}:
-
Total:
Check out
Taxes and shipping calculated at checkout
const summaryStickyRender = document.querySelector('#cart-drawer-summary-sticky-render'); if (summaryStickyRender) { document.body.style.setProperty('--cart-drawer-summary-sticky-height', summaryStickyRender.clientHeight + 'px'); }
View Cart
${function(){ const productData = data.product; let product_change_event = '', mouse_over_event = ' '; mouse_out_event = ''; const product_options = productData.options.filter(Boolean) || []; for (let opt of product_options) { const nameEscape = opt.name.replace(/\/|\\|\s|\'|\"|`|\<|\>/g, '') product_change_event = product_change_event + `quick-shop-selected-variant-${opt.id}.rerender(data=event.selectedValues.${opt.name});`; mouse_out_event = mouse_out_event + `@${nameEscape}Mouseout="quick-shop-selected-variant-${opt.id}.rerender(data=event.selectData.${opt.name}, redo=true);"`; mouse_over_event = mouse_over_event + `@${nameEscape}Mouseover="quick-shop-selected-variant-${opt.id}.rerender(data=event, redo=true);"`; } const selectedVariant = productData.variants.find(v => v.available) || productData.variants[0]; const statusLan = ((selectedVariant && !selectedVariant.available) || (!selectedVariant && !productData.available)) ? "Sold out" : "Add to cart"; return `
${statusLan}
` }()}
${function(){ const currentSelectVariant = data.variant; const defaultVariant = (data.product && data.product.variants && data.product.variants[0]); const variantData = currentSelectVariant || defaultVariant || data; const retail_price = variantData.retail_price || 0; return `
Retail
` }()}
${function(){ const wholesale_enabled = false; const qty = data.quantity || 1; const currentSelectVariant = data.variant; const defaultVariant = (data.product && data.product.variants && data.product.variants[0]); const productVariant = null; const variantData = currentSelectVariant || defaultVariant || productVariant; const wholesale_price = variantData.wholesale_price || []; if(wholesale_enabled && wholesale_price.length > 0) { let wholesaleIndex = wholesale_price.findIndex(item => { return item.min_quantity > qty; }); if(wholesaleIndex < 0){ wholesaleIndex = wholesale_price.length - 1; }else if(wholesaleIndex > 0){ wholesaleIndex = wholesaleIndex - 1; } const wholesalePrice = wholesale_price[wholesaleIndex] || ''; return `
` }else { const price = variantData && variantData.price; return price != undefined ? `
` : '
'; } }()}
${function() { let variantImageShowed = false; const currentProduct = data.product; return (currentProduct.options || []).map((option, index) => { const optionName = option.name || ''; const optionId = option.id || ''; const position = `option${index + 1}`; let isThumbImage = false; if (currentProduct.need_variant_image && !variantImageShowed) { const variantNames = ["color"] || []; for (let i = 0, len = variantNames.length; i < len; i++) { const name = variantNames[i].toLowerCase(); if (name === optionName.toLowerCase()) { isThumbImage = true; variantImageShowed = true; } } } const variantType = "button"; const thumbStyle = "image_with_text"; return `
${optionName}:
${option.values.map((value, idx) => { const selected = data.selectedValues[optionName] == value ? 'checked' : ''; let thumbImage = null; if (isThumbImage) { const variants = currentProduct.variants; for (let i = 0, len = variants.length; i < len; i++) { const variant = variants[i]; if (variant[position] == value && thumbImage == null) { thumbImage = variant.image; break; } } } return `
${value}
` }).join('')}
${optionName}
${option.values.map(value => { const selected = data.selectedValues[optionName] == value ? 'selected' : ''; return `
${value}
` }).join('')}
` }).join(''); }()}
${data.originData && data.originData.value || data.value}
const TAG = "spz-custom-announcement"; const DISPLAY_TYPE = { ANNOUNCEMENT: "PTT_BANNER" // 公告栏 }; const API = { LIST: `/api/storefront/promotion/placement/list`, // 获取公告栏列表 REPORT: `/api/storefront/promotion/placement/data/report` // 上报数据 }; const DISPLAY_DEVICE = { PC_AND_MOBILE: "PD_PC_MOBILE", // PC和移动端 PC: "PD_PC", // PC MOBILE: "PD_MOBILE" // 移动端 }; const REPORT_EVENT = { CLICK: "PE_CLICK", // 点击事件 IMPRESSION: "PE_IMPRESSION" // 曝光事件 }; const POSITION = { TOP: "PP_TOP", // 顶部 BOTTOM: "PP_BOTTOM" // 底部 } const MODE = { FIXED: "PM_FIXED", // 固定 NORMAL: "PM_SCROLLING" // 滚动 } const THEME_NAME = window.SHOPLAZZA.theme.merchant_theme_name; class SpzCustomAnnouncement extends SPZ.BaseElement { constructor(element) { super(element); this.announcementList_ = []; // 公告栏数据 } static deferredMount() { return false; } buildCallback() { this.action_ = SPZServices.actionServiceForDoc(this.element); this.templates_ = SPZServices.templatesForDoc(this.element); this.xhr_ = SPZServices.xhrFor(this.win); this.setupAction_(); this.viewport_ = this.getViewport(); } mountCallback() { this.fetchData_(); this.createAnnouncementDom_(); this.listenCartChange_(); } fetchData_(type = '') { const id = window.SHOPLAZZA.meta.page.template_type === 51 ? window.SHOPLAZZA.meta.page.resource_id : 0; return this.xhr_.fetchJson(API.LIST, { method: 'POST', body: { page_id: window.SHOPLAZZA.meta.page.template_type, placement_type: DISPLAY_TYPE.ANNOUNCEMENT, discount_id: id } }).then((res) => { this.announcementList_ = res.list || []; if (this.announcementList_.length > 0) { this.announcementList_.forEach((item) => { item.config = JSON.parse(item.config); }); } if(type === 'cartChange') { this.announcementList_.forEach((item) => { this.updateText_(item); }); } else { this.doRender_(this.announcementList_); } }).catch((error) => { console.error(error); }) } doRender_(data) { return this.templates_ .findAndRenderTemplate(this.element, { list: this.announcementList_ }) .then((el) => { const children = this.element.querySelector('*:not(template)'); children && SPZCore.Dom.removeElement(children); this.element.appendChild(el); }) .then(() => { this.announcementList_.forEach((item) => { this.showAnnouncement_(item); }); }).then(() => { this.handleThemeCompatibility_(); }); } // 更新文案 updateText_(item) { const announcement = document.querySelector(`#announcement-${item.id}`); const announcementText = announcement.querySelectorAll('.announcement_text'); const textArr = item.config.text_discount.replace_texts; const textDom = textArr.map((text) => { return `
${text}
`; }).join(','); announcementText.forEach((text) => { text.innerHTML = textDom; }); } // 创建公告栏dom createAnnouncementDom_() { const isHero = /Hero/.test(THEME_NAME); const headerElement = document.querySelector('[data-section-type="header"]'); const headerSticky = window.getComputedStyle(headerElement).position === 'sticky'; // 创建滚动的底部公告栏 const announcementBottomContainer = document.createElement('div'); announcementBottomContainer.className = 'announcement__container_bottom bootstrap'; document.body.appendChild(announcementBottomContainer); // 创建固定的底部公告栏 const announcementBottomSticky = document.createElement('ljs-sticky'); announcementBottomSticky.className = 'announcement__container_bottom-sticky'; announcementBottomSticky.setAttribute('layout', 'container'); announcementBottomSticky.setAttribute('position', 'bottom'); announcementBottomSticky.style.position = 'fixed'; announcementBottomSticky.style.bottom = '0'; announcementBottomSticky.style.left = '0'; announcementBottomSticky.style.right = '0'; announcementBottomSticky.style.zIndex = '1030'; document.body.appendChild(announcementBottomSticky); const announcementTopContainer = document.createElement('div'); announcementTopContainer.classList.add('announcement__container_top'); if (isHero) { announcementTopContainer.classList.add('announcement__container_top_zIndex_1030'); } announcementTopContainer.classList.add('bootstrap'); document.body.insertBefore(announcementTopContainer, document.body.children[0]); const announcementTopFixedContainer = document.createElement('div'); announcementTopFixedContainer.classList.add('announcement__container_top-fixed'); if (isHero) { announcementTopFixedContainer.classList.add('announcement__container_top_zIndex_1030'); } announcementTopFixedContainer.classList.add('bootstrap'); const insertBeforeElement = headerSticky ? document.querySelector('[data-section-type="header"]') : document.body; insertBeforeElement.insertBefore(announcementTopFixedContainer, insertBeforeElement.children[0]); const isEvaMaskHeader = /Eva/.test(THEME_NAME) && $('header.header').css('position') === 'absolute'; let fixedBannerTopContainer = document.querySelector('.announcement__container_top-fixed'); // 处理eva主题header蒙层设置时的样式 if (isEvaMaskHeader) { if (fixedBannerTopContainer) { fixedBannerTopContainer.remove(); } const newBanner = document.createElement('div'); newBanner.className = 'announcement__container_top-fixed bootstrap'; document.body.insertBefore(newBanner, document.body.firstChild); fixedBannerTopContainer = newBanner; } if (headerSticky && !isEvaMaskHeader && fixedBannerTopContainer) { fixedBannerTopContainer.style.position = 'relative'; fixedBannerTopContainer.style.zIndex = '29'; } } // 展示公告栏 showAnnouncement_(item) { const announcement = document.querySelector(`#announcement-${item.id}`); const announcementBottomContainer = document.querySelector('.announcement__container_bottom'); const announcementBottomSticky = document.querySelector('.announcement__container_bottom-sticky'); const announcementTopContainer = document.querySelector('.announcement__container_top'); const announcementTopFixedContainer = document.querySelector('.announcement__container_top-fixed'); const isPC = this.viewport_.getWidth() >= 960; const isMobile = this.viewport_.getWidth() < 960; const isMatchPCDevice = item.device === DISPLAY_DEVICE.PC_AND_MOBILE || item.device === DISPLAY_DEVICE.PC; const isMatchMobileDevice = item.device == DISPLAY_DEVICE.PC_AND_MOBILE || item.device === DISPLAY_DEVICE.MOBILE; if((isPC && isMatchPCDevice) || (isMobile && isMatchMobileDevice)) { if (item.position === POSITION.BOTTOM) { if(item.mode === MODE.FIXED) { announcementBottomSticky && announcementBottomSticky.appendChild(announcement); } else { announcementBottomContainer && announcementBottomContainer.appendChild(announcement); } } else { if (item.mode === MODE.FIXED) { announcementTopFixedContainer && announcementTopFixedContainer.appendChild(announcement); } else { announcementTopContainer && announcementTopContainer.appendChild(announcement); } } this.reportData({ placement_id: item.id, event: REPORT_EVENT.IMPRESSION }); } } // 处理主题兼容 handleThemeCompatibility_() { try { const throttle = (func, limit) => { let lastFunc; let lastRan; return function() { const context = this; const args = arguments; if (!lastRan) { func.apply(context, args); lastRan = Date.now(); } else { clearTimeout(lastFunc); lastFunc = setTimeout(function() { if ((Date.now() - lastRan) >= limit) { func.apply(context, args); lastRan = Date.now(); } }, limit - (Date.now() - lastRan)); } }; }; const isBoost = /Boost/.test(THEME_NAME); const isHyde = /Hyde/.test(THEME_NAME); const header = document.querySelector('.header__fixed') || document.querySelector('.header__wrapper'); const isEvaMaskHeader = /Eva/.test(THEME_NAME) && $('header.header').css('position') === 'absolute'; const boostHeader = document.querySelector('.boost-header'); const fixedBannerTopContainer = document.querySelector('.announcement__container_top-fixed'); const notFixedBannerTopContainer = document.querySelector('.announcement__container_top'); const headerElement = document.querySelector('[data-section-type="header"]'); const headerSticky = headerElement && window.getComputedStyle(headerElement).position === 'sticky'; const headerFixed = header && window.getComputedStyle(header).position === 'fixed'; const onScroll = throttle(() => { if (isHyde) { if (header && headerSticky) { header.style.marginTop = `${fixedBannerTopContainer.offsetHeight}px`; } else { notFixedBannerTopContainer.style.marginTop = `${fixedBannerTopContainer.offsetHeight}px`; } } if (isEvaMaskHeader) { const evaHeader = document.querySelector('header.header'); if (evaHeader.classList.contains('header__fixed')) { evaHeader.style.marginTop = `${fixedBannerTopContainer.offsetHeight}px`; } else { notFixedBannerTopContainer.style.marginTop = `${fixedBannerTopContainer.offsetHeight}px`; } if(document.documentElement.scrollTop === 0) { evaHeader.style.marginTop = '0'; } } if (headerSticky) return; if (headerFixed) { header.style.marginTop = `${fixedBannerTopContainer.offsetHeight}px`; } else { const observer = new MutationObserver((mutationsList, observer) => { for (const mutation of mutationsList) { if (mutation.type === 'childList' && fixedBannerTopContainer.childElementCount > 0) { notFixedBannerTopContainer.style.marginTop = `${fixedBannerTopContainer.offsetHeight}px`; observer.disconnect(); // 停止观察 break; } } }); // 开始观察 fixedBannerTopContainer 的子节点变化 observer.observe(fixedBannerTopContainer, { childList: true, subtree: true }); // 初始检查 if (fixedBannerTopContainer.childElementCount > 0) { notFixedBannerTopContainer.style.marginTop = `${fixedBannerTopContainer.offsetHeight}px`; } if(header) { header.style.marginTop = '0'; } } if (isBoost) { fixedBannerTopContainer.style.zIndex = '1031'; if (boostHeader && boostHeader.classList.contains('header__fixed')) { boostHeader.style.marginTop = `${fixedBannerTopContainer.offsetHeight}px`; } else { notFixedBannerTopContainer.style.marginTop = `${fixedBannerTopContainer.offsetHeight}px`; } } }, 16); window.addEventListener('scroll', onScroll); window.dispatchEvent(new Event('scroll')); } catch (error) { console.error('error', error); } } // 上报数据 async reportData(data) { // 如果是主题编辑器则不用处理 if(window.top !== window.self) { return; } this.xhr_.fetchJson(API.REPORT, { method: "POST", body: { placement_id: data.placement_id, event: data.event } }); } // 监听购物车变化事件dj.cartChange listenCartChange_() { SPZUtils.Event.listen(document, 'dj.cartChange', (event) => { this.fetchData_('cartChange'); }); } setupAction_() { this.registerAction('handleClose', (invocation) => { const data = invocation.args; const id = data.id; const announcement = document.querySelector(`#announcement-${id}`); announcement && SPZCore.Dom.removeElement(announcement); }); this.registerAction('handleJumpLink', (invocation) => { const data = invocation.args; if(!data.show_url) return; data.url && window.open(data.url, data.open_new_window ? '_blank' : '_self'); this.reportData({ placement_id: data.id, event: REPORT_EVENT.CLICK }); }); } triggerEvent_(name, data) { const event = SPZUtils.Event.create(this.win, `${ TAG }.${ name }`, data || {}); this.action_.trigger(this.element, name, event); } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } } SPZ.defineElement(TAG, SpzCustomAnnouncement);
${function() { return data.originData.list.map((item) => { const background = item.config.background; const interactive = item.config.interactive; const textArr = item.config.text_discount.replace_texts; const textColor = item.config.text_discount.color; const backgroundSize = background.presentation_rule === 'fill' ? 'cover' : 'contain'; const pcImage = (background.url && background.upload) ? background.url : ''; const mobileImage = (background.mobile_url && background.upload) ? background.mobile_url : ''; const color1 = background.color; const color2 = background.color2 || background.color; const backgroundStyle = `background: url(//img.staticdj.com/${pcImage}) center / ${backgroundSize} no-repeat, linear-gradient(to right, ${color1}, ${color2});`; const backgroundMobileStyle = `background: url(//img.staticdj.com/${mobileImage}) center / ${backgroundSize} no-repeat, linear-gradient(to right, ${color1}, ${color2});`; return `
${textArr.map((text) => { return `
${text}
` }).join(',')}
${textArr.map((text) => { return `
${text}
` }).join(',')}
` }) }()}