關於我們
品牌簡介
最新職缺
下載全盈+PAY
知識專欄
全部文章
最新活動
當月活動
歷史活動
最新公告
全部公告
權益公告
活動消息
媒體報導
使用說明
註冊
支付
儲值
點數
支付工具
轉帳/收款
提領
商業收款
繳費
減碳贏家
優惠券
會員
與我聯繫
Foreigner registration
合作通路
合作通路
本月新增
減碳贏家
兌換減碳驕傲禮
執行減碳任務
去哪裡愛地球
排行榜
店家專區
收款模式介紹
行銷合作優勢
金流收費方案
下載全盈店家管理App
App使用說明
常見問題
常見問題
合作店家/薪轉商戶申請
特約商店專人聯繫
特約商店/薪轉代發線上申辦
歷史活動
歷史活動
<
pages
>
{ // 文字欄位的注入特徵檢查 ['title_name', 'source'].forEach((k) => { const v = safeText(r[k]); if (v && hasXssSignature(v)) errors.push(`第 ${i + 1} 筆 ${k} 含疑似腳本字樣`); }); }); return { ok: errors.length === 0, errors }; } fetch(root + 'csv/Promotion.csv?' + time) .then((response) => { if (!response.ok) throw new Error(`HTTP error! 狀態:${response.status}`); return response.text(); }) .then((csvData) => { if (csvData) { csvObjects = $.csv.toObjects(csvData); // 檢查 CSV 格式是否符合預期 if (!validateCSV(csvObjects)) { console.error('CSV 格式驗證失敗:缺少必要欄位'); return; } current.condition = init_codition; currentItem.condition = init_codition; var ele = document.getElementById(init_codition); if (ele) { ele.classList.add('condition__item--active'); } showItem('', init_codition); } else { alert('csv 檔案讀取失敗'); } }) .catch((error) => { console.error('Fetch error', error) }) $('.condition .condition__item a').on('click', function () { $('.article').empty(); var condition = $(this).data('condition') if (condition != current.condition) { $('.condition .condition__item').removeClass('condition__item--active') $(this).parent().addClass('condition__item--active') showItem(current.searchString, condition) } else { showItem(current.searchString, condition) } }) var PageMax = 30 var pageContainer function showItem(searchString, condition) { if (!csvObjects) { alert('csv 檔案讀取失敗') return } if (typeof searchString != 'string') { searchString = '' } current.searchString = searchString current.condition = condition || current.condition current.filtered = csvObjects.reduce(function (pre, item, index) { if (item.condition == current.condition || current.condition == 'All') { if (!current.searchString || (current.searchString && item.title_name.indexOf(current.searchString) > -1)) { pre.push(item) } } return pre }, []) knowledgeList() updatMbPageText() } function knowledgeList() { var liHTML = current.filtered.reduce(function (pre, item, index) { pre += '
\
\
\
' + item.title_name + '
\
' + '來源:' + item.source + '
\
' + item.create_time + '
\
\
'; return pre }, '') document.querySelector('.knowledge-list').innerHTML = liHTML; //pageContainer = $('.page').pagination({ // dataSource: current.filtered, // autoHidePrevious: true, // autoHideNext: true, // prevText: '<', // nextText: '>', // pageSize: PageMax, // callback: function (data, pagination) { // var liHTML = data.reduce(function (pre, item, index) { // pre += '
\ //
\ //
\ //
' + item.title_name + '
\ //
' + '來源:' + item.source + '
\ //
' + item.create_time + '
\ //
\ //
'; // return pre // }, '') // $('.knowledge-list').html($(liHTML)) // } //}) } function showSection(item_id,itemCondition) { currentItem.item_id = item_id || currentItem.item_id current.condition = itemCondition; currentItem.condition = itemCondition; currentItem.filtered = csvObjects.reduce(function (pre, item, index) { if (item.index == currentItem.item_id) { pre.push(item) } return pre }, []) Section() } function Section() { pageContainer = $('.page').pagination({ dataSource: currentItem.filtered, autoHidePrevious: true, autoHideNext: true, prevText: '<', nextText: '>', pageSize: PageMax, callback: function (data, pagination) { var HTML = data.reduce(function (p, item, index) { p += '
\
\
\
\
\
\
' + item.title_name + '
\
\
\
' + '來源:' + item.source + '
\
'+ item.create_time + '
\
\
\
\
\
'+ item.body_one + '
\
\
\
\
\
\
\
\
'+ item.body_two + '
\
\
\
\
\
\
\
\
'+ item.body_three + '
\
'; return p }, '') $('.article').html($(HTML)) } }) } function goPage(val) { if (pageContainer) { if (val > 0) { pageContainer.pagination('next') } else { pageContainer.pagination('previous') } updatMbPageText() } } function updatMbPageText() { var pageNum = pageContainer.pagination('getSelectedPageNum'), totalPage = pageContainer.pagination('getTotalPage') if (totalPage != 0) { $('.page__mb').addClass('show') $('.page__mb-text')[0].innerText = 'pages ' + pageNum + '/' + totalPage } else { $('.page__mb').removeClass('show') $('.page__mb-text')[0].innerText = 'pages' } }