// 添加广告位 $(document).on('click', '#addAdvertGroupBtn', function () { $('.foxui-collapse').append(advertGroupHtml({})); }); // 添加字段 $(document).on('click', '.add-btn', function () { let columnId = $('input[name="columnId"]').val(); let id = $(this).attr('id'); window.location.href = `addField?columnId=${columnId}&type=1&id=${id}`; }); // 添加广告 $(document).on('click', '.add-advert-btn', function () { let $handle = $(this).siblings('.handle-box').find('.foxui-collapse-handle'), isActive = $handle.is('.is-active'); if (!isActive) $handle.click(); $(this).closest('.foxui-collapse-item').find('.adverts-list-container').append(advertHtml({})); }); // 标签调用 $(document).on('click', '.call-btn', function () { let id = $(this).attr('id'); let jscript = $(this).attr('j-script'); // 异步获取数据(生成html); let flag = `{fox:adv pid='${id}'} [$ad.title] {/fox:adv}`; let jscriptStr = ''; let dataObj = { flag: flag, jscript: jscriptStr, }; foxui.dialog({ title: '标签调用', content: _callHtml(dataObj), confirmText: '确认', buttonSize: 'small', buttonAlign: 'center', width: '710px', longButton: true, border: true, confirm: function (callback) { callback(); }, }); }); // 广告位 HTML function advertGroupHtml({ gId, gName, isShow, title, linkUrl, imgUrl, imgId }) { return [ '
  • ', '
    ', `
    ${gId || ''}
    `, '
    ', '
    ', '', '
    ', '
    ', '
    ', ``, '0/30', '
    ', '
    ', '', '
    ', '
    ', `
    `, ``, '', '
    ', '
    ', '
    ', '', '', '', '
    ', '
    ', '
    ', '
    ', `${advertHtml({ title, linkUrl, imgUrl, imgId })}`, '
    ', '
    ', '
  • ', ].join(''); } // 广告 HTML function advertHtml({ title, linkUrl, imgUrl, imgId }) { return [ '
    ', '
    ', `${imagesHtml(imgUrl, imgId)}`, '
    ', '
    ', '', '
    ', ``, '0/30', '
    ', '
    ', '
    ', '', '
    ', ``, '
    ', '
    ', '
    ', '', '', '
    ', '
    ', '
    ', '
    ', ].join(''); } // 图片 THML function imagesHtml(imgUrl, imgId) { let htmlArr = []; if (imgUrl) { htmlArr = [ '
    ', '
    ', '', '
    ', '
    ', ]; } else { htmlArr = [ '
    ', '
    ', '', '
    ', '
    ', ]; } return htmlArr.join(''); } // 标签调用 html function _callHtml(dataObj) { return [ '
    ', '
    ', '', `
    `, ` `, `
    `, '
    ', '
    ', '', ``, '
    ', '
    ', '

    请将相应标签复制并粘贴到对应模板文件中!

    ', '
    ', '
    ', ].join(''); }