# Lottery program


Annual lucky draw program, 3D sphere lucky draw, support the configuration of prize information, participating in the lucky draw personnel information ‘Excel’ import, lucky draw results’ Excel ‘export


> making address: [https://github.com/moshang-xc/lottery] (https://github.com/moshang-xc/lottery)


# # technology


Technology: Node + Express + three.js


The backend is implemented through ‘Express’


The front-end lottery interface realizes the 3D lottery ball through ‘three. js’, citing the official 3D example of’ three. js’


##


1. Save the lottery results and download them to Excel in real time
2. Those who have already been selected can be selected again if they are not present
3. Refresh or turn off the server, the data currently extracted will be saved, and data will not be reset. Only click the reset button on the interface can reset the lottery data
4. The number of prizes drawn each time can be configured
5. After all the prizes are drawn, you can continue to draw special prizes (for example, draw red envelopes now, additional prizes, etc.). By default, you can draw one prize at a time


# # preview










# # to install


` ` `
git clone https://github.com/moshang-xc/lottery.git


cd lottery


Install the server plug-in
cd server
npm install


Install front-end plug-in
cd .. /product
npm install


# packaged
npm run build


# run
npm run serve


# Development debugging
npm run dev


` ` `


## directory structure


` ` `
Lottery
├ ─ ─ the product
│ ├ ─ ─ the SRC
│ │ ├ ─ ─ the lottery
│ ├ ─ ├ ─ sci.js
│ │ ├ ─ ─ lib
│ │ ├ ─ ─ img
│ │ ├ ─ ─ the CSS
│ │ └ ─ ─ the data
│ ├ ─ ─ package. Json
│ └ ─ ─ webpack. Config. Js
├ ─ ─ server
│ ├ ─ ─ config. Js
│ ├ ─ ─ server. Js
│ └ ─ ─ package. Js
` ` `


> 1. Product is the front-end page directory
> 2. package.josn Web project configuration file
> 3. webpack.config.js package configuration files
> 4. Server indicates the server directory
> 5. Config indicates the configuration file of the prize information


# configure information


1. Fill in the lottery user information in the ‘server/data/user. XLSX’ file in the specified format without modifying the file name


2. The configuration information of the prize is in the ‘server/config.js’ file, and the file name cannot be changed


“`js
// Prize information. The first item is reserved and cannot be modified. Other items can be modified as required
let prizes = [{
type: 0,
count: 1000,
Title: ‘Special Award ‘,
img: ”
}, {
type: 1,
count: 1,
Huawei Mate 20X’,
img: ‘.. /img/huawei.png’
}
.
];


/ * *
* Number of prizes drawn at one time
* The order is: [Special Prize, first Prize, second prize, third prize, fourth prize, fifth prize]
* /
const EACH_COUNT = [1, 1, 1, 1, 1, 5];
// The name of the company to be displayed in the title section of the lottery list
const COMPANY = ‘MoShang’;
` ` `