Lottery program for annual meeting, 3D ball lottery, supports prize information configuration, participants information Excel
import, lottery results Excel
export
Experience now: https://janparkio.github.io/lottery/
Technology: Node + Express + Three.js
Implemented in the backend with Express
The frontend lottery interface is implemented with Three.js
for 3D lottery ball, using the official 3D example of Three.js
- The lottery result can be saved and downloaded to excel in real time ๐
- People who have already been drawn are not allowed to participate in the draw again. If the drawn person is not present, they can draw again ๐
- If the server is refreshed or closed, the currently drawn data will be saved, and the data will not be reset. Only by clicking the reset button on the interface can the lottery data be reset ๐งง
- The number of prizes drawn each time can be configured ๐
- After all the prizes have been drawn, you can continue to draw special prizes (for example: red envelopes, additional prizes, etc.). At this time, only one prize is drawn by default ๐งจ
git clone https://github.com/janparkio/lottery.git
cd lottery
# Server-side plug-in installation
cd server
npm install
# Front-end plug-in installation
cd ../product
npm install
# Packaging
npm run build
# Running
npm run serve
# Development debugging
npm run dev
Lottery
โโโ product
โ โโโ src
โ โ โโโ lottery
โ โ โ โโโ index.js
โ โ โโโ lib
โ โ โโโ img
โ โ โโโ css
โ โ โโโ data
โ โโโ package.json
โ โโโ webpack.config.js
โโโ server
โ โโโ config.js
โ โโโ server.js
โ โโโ package.js
- product is the frontend page directory
- package.josn web project configuration file
- webpack.config.js packaging configuration file
- server is the server directory
- config is the configuration file for prize information
The lottery user information is in the server/data/user.xlsx
file, which should be filled in according to the file format, and the file name and column header cannot be modified.
The configuration information of the prize is filled in the server/config.js file, and the file name cannot be modified.
The configuration description of the prize "prizes" is as follows:
Parameter | Value type | Description |
---|---|---|
type | Number | Prize type, unique identifier, 0 is the placeholder for the default special prize, other prizes cannot be used |
count | Number | Number of prizes |
text | String | Prize name |
title | String | Prize description |
img | String | Prize image address, image in the img directory |
// Prize information, the first item is reserved and cannot be modified, other items can be modified as needed
let prizes = [{
type: 0,
count: 1000,
title: "",
text: "Special prize"
},
{
type: 1,
count: 2,
text: "Grand prize",
title: "Mystery gift",
img: "../img/secrit.jpg"
},
{
type: 2,
count: 5,
text: "First prize",
title: "Mac Pro",
img: "../img/mbp.jpg"
}
...
];
EACH_COUNT is used to configure the number of prizes drawn each time, corresponding to the prizes one by one. For example, the prize configuration above corresponds to the following prize draw configuration:
const EACH_COUNT = [1, 1, 5];
As configured above, the order of the number of prizes drawn each time is: the special prize is drawn once, the grand prize is drawn once, and five first prizes are drawn each time.
This identity is used to display on the lottery card.
const COMPANY = "Eleve";
MIT