Commit 949c824b authored by fushaowu's avatar fushaowu

日志

parent 4d5dae00
let vue = new Vue({ let vue = new Vue({
el: '#v1', el: '#v1',
data: () => { data: () => {
...@@ -94,6 +95,7 @@ let vue = new Vue({ ...@@ -94,6 +95,7 @@ let vue = new Vue({
winPerson[this.awardTitle] = activePersonList; winPerson[this.awardTitle] = activePersonList;
localStorage['yit'] = JSON.stringify(winPerson); localStorage['yit'] = JSON.stringify(winPerson);
this.activePersonList = activePersonList; this.activePersonList = activePersonList;
uploadLog(this.awardTitle, activePersonList)
}, },
}, },
}); });
...@@ -136,3 +138,36 @@ function getRandomPerson(num, candidateMap) { ...@@ -136,3 +138,36 @@ function getRandomPerson(num, candidateMap) {
} }
return [...currentWinPersonMap.values()]; return [...currentWinPersonMap.values()];
} }
/**
*
* @param {*} title 日志 中奖标题
* @param {*} list 日志中奖上传列表
*/
function uploadLog(title, list) {
let arr = chuck(list, 30)
arr.forEach(val => {
let winPerson = JSON.stringify({
[title]: val
})
let img = document.createElement('img')
let imgPath = 'https://l.yit.com/yd.gif'
let params = `err_ctype=lottery&err_stack=${winPerson}`
img.src = `${imgPath}?${params}`
img.style.display = 'none'
document.querySelector('body').appendChild(img)
})
}
// 拆分数组
function chuck(arr, size) {
let result = []
let start = 0
let end = 0
for (let index = 0; index < Math.ceil(arr.length / size); index++) {
start = index * size
end = start + size
result.push(arr.slice(start, end))
}
return result
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment