Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
goodluck
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fukai
goodluck
Commits
59660f44
Commit
59660f44
authored
Jan 06, 2020
by
zhangyongfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除默认配置
parent
cd7de73b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
101 deletions
+13
-101
LotteryConfig.vue
src/components/LotteryConfig.vue
+2
-43
algorithm.js
src/helper/algorithm.js
+5
-6
index.js
src/helper/index.js
+0
-16
index.js
src/store/index.js
+6
-36
No files found.
src/components/LotteryConfig.vue
View file @
59660f44
...
...
@@ -2,7 +2,7 @@
<el-dialog
:visible=
"visible"
:append-to-body=
"true"
width=
"
40
0px"
width=
"
39
0px"
@
close=
"$emit('update:visible', false)"
class=
"c-LotteryConfig"
>
...
...
@@ -19,7 +19,7 @@
>
</div>
<div
class=
"container"
>
<el-form
ref=
"form"
:model=
"form"
label-width=
"90px"
size=
"mini"
>
<el-form
ref=
"form"
:model=
"form"
size=
"mini"
>
<el-form-item
label=
"抽奖标题"
>
<el-input
v-model=
"form.name"
></el-input>
</el-form-item>
...
...
@@ -31,14 +31,6 @@
:step=
"1"
></el-input>
</el-form-item>
<el-form-item
label=
"特等奖"
>
<el-input
type=
"number"
v-model=
"form.specialAward"
:min=
"0"
:step=
"1"
></el-input>
</el-form-item>
<el-form-item
label=
"一等奖"
>
<el-input
type=
"number"
...
...
@@ -47,39 +39,6 @@
:step=
"1"
></el-input>
</el-form-item>
<el-form-item
label=
"二等奖"
>
<el-input
type=
"number"
v-model=
"form.secondPrize"
:min=
"0"
:step=
"1"
></el-input>
</el-form-item>
<el-form-item
label=
"三等奖"
>
<el-input
type=
"number"
v-model=
"form.thirdPrize"
:min=
"0"
:step=
"1"
></el-input>
</el-form-item>
<el-form-item
label=
"四等奖"
>
<el-input
type=
"number"
v-model=
"form.fourthPrize"
:min=
"0"
:step=
"1"
></el-input>
</el-form-item>
<el-form-item
label=
"五等奖"
>
<el-input
type=
"number"
v-model=
"form.fifthPrize"
:min=
"0"
:step=
"1"
></el-input>
</el-form-item>
<el-form-item
:label=
"newitem.name"
v-for=
"newitem in storeNewLottery"
...
...
src/helper/algorithm.js
View file @
59660f44
...
...
@@ -15,6 +15,10 @@
}
*/
export
function
generateArray
(
start
,
end
)
{
return
Array
.
from
(
new
Array
(
end
+
1
).
keys
()).
slice
(
start
);
}
/**
* 取范围内随机整数
* @param {number} minNum
...
...
@@ -30,13 +34,8 @@ export function randomNum(minNum = 1, maxNum) {
* @param {number} num 本次抽取人数
*/
export
function
luckydrawHandler
(
total
,
won
=
[],
num
)
{
const
peolist
=
[];
for
(
let
i
=
1
;
i
<=
total
;
i
++
)
{
peolist
.
push
(
i
);
}
const
peolist
=
generateArray
(
1
,
Number
(
total
));
const
wons
=
won
;
const
res
=
[];
for
(
let
j
=
0
;
j
<
num
;
j
++
)
{
const
nodraws
=
peolist
.
filter
(
item
=>
!
wons
.
includes
(
item
));
...
...
src/helper/index.js
View file @
59660f44
...
...
@@ -40,25 +40,9 @@ export const listField = 'list'; // 名单
export
function
conversionCategoryName
(
key
)
{
let
name
=
''
;
switch
(
key
)
{
case
'specialAward'
:
name
=
'特等奖'
;
break
;
case
'firstPrize'
:
name
=
'一等奖'
;
break
;
case
'secondPrize'
:
name
=
'二等奖'
;
break
;
case
'thirdPrize'
:
name
=
'三等奖'
;
break
;
case
'fourthPrize'
:
name
=
'四等奖'
;
break
;
case
'fifthPrize'
:
name
=
'五等奖'
;
break
;
default
:
break
;
}
...
...
src/store/index.js
View file @
59660f44
...
...
@@ -14,20 +14,10 @@ export default new Vuex.Store({
config
:
{
name
:
'年会抽奖'
,
number
:
70
,
specialAward
:
0
,
firstPrize
:
1
,
secondPrize
:
5
,
thirdPrize
:
8
,
fourthPrize
:
10
,
fifthPrize
:
20
firstPrize
:
1
},
result
:
{
specialAward
:
[],
firstPrize
:
[],
secondPrize
:
[],
thirdPrize
:
[],
fourthPrize
:
[],
fifthPrize
:
[]
firstPrize
:
[]
},
newLottery
:
[],
list
:
[],
...
...
@@ -38,12 +28,7 @@ export default new Vuex.Store({
state
.
config
=
{
name
:
'年会抽奖'
,
number
:
70
,
specialAward
:
0
,
firstPrize
:
1
,
secondPrize
:
5
,
thirdPrize
:
8
,
fourthPrize
:
10
,
fifthPrize
:
20
firstPrize
:
1
};
state
.
newLottery
=
[];
},
...
...
@@ -55,32 +40,17 @@ export default new Vuex.Store({
},
setClearResult
(
state
)
{
state
.
result
=
{
specialAward
:
[],
firstPrize
:
[],
secondPrize
:
[],
thirdPrize
:
[],
fourthPrize
:
[],
fifthPrize
:
[]
firstPrize
:
[]
};
},
setClearStore
(
state
)
{
state
.
config
=
{
name
:
'年会抽奖'
,
number
:
70
,
specialAward
:
0
,
firstPrize
:
1
,
secondPrize
:
5
,
thirdPrize
:
8
,
fourthPrize
:
10
,
fifthPrize
:
20
firstPrize
:
1
};
state
.
result
=
{
specialAward
:
[],
firstPrize
:
[],
secondPrize
:
[],
thirdPrize
:
[],
fourthPrize
:
[],
fifthPrize
:
[]
firstPrize
:
[]
};
state
.
newLottery
=
[];
state
.
list
=
[];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment