介紹
基于Ant Design組件庫、Dva開發(fā)框架實現(xiàn)的一款抽獎App。
動畫使用了react-particles-js
安裝說明
- cnpm i 或者 npm i (建議前者)
- npm run start
- npm run build
使用說明
- 點擊主頁面最左側,彈出抽屜層,導入數(shù)據(jù),或者修改路徑為:http://localhost:8000/#/data
- 返回主頁面,點擊Enter開始執(zhí)行滾動,再次點擊結束。
隨機洗牌算法
/**
* 隨機洗牌算法
* https://ashan.org/archives/925
*
* @param {Array} arr
*/
export function shuffle(arr) {
let randomIndex = 0;
for (var i = 0; i < arr.length; i++) {
randomIndex = Math.floor(Math.random() * (arr.length - i));
let temp = arr[i];
arr[i] = arr[randomIndex];
arr[randomIndex] = temp;
}
}
圖例
主頁:
image
抽屜:
image
導入數(shù)據(jù):
image
Excel表格模板:
image