Lottery-抽獎程序

介紹

基于Ant Design組件庫、Dva開發(fā)框架實現(xiàn)的一款抽獎App。
動畫使用了react-particles-js

安裝說明

  1. cnpm i 或者 npm i (建議前者)
  2. npm run start
  3. npm run build

使用說明

  1. 點擊主頁面最左側,彈出抽屜層,導入數(shù)據(jù),或者修改路徑為:http://localhost:8000/#/data
  2. 返回主頁面,點擊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

Github地址

https://github.com/JxSx/lottery

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容