Commit 4894f7b8 by zhangyongfeng

Increase the total number of configurable draws

parent d1c9d488
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
## 使用说明 ## 使用说明
### 配置建议
- 本程序理论支持配置百万级别人数,超过 10 万以上时初始化会比较耗时,初始化后可以正常抽奖。
- 如果人数较多,不建议导入名单或照片,按号码抽奖即可。
### 抽奖配置 ### 抽奖配置
- 设置抽奖总人数、奖项及每个奖项的人数,默认包含两个奖项,如果不想抽取默认的奖项,可以设置该奖项数量为 0 - 设置抽奖总人数、奖项及每个奖项的人数,默认包含两个奖项,如果不想抽取默认的奖项,可以设置该奖项数量为 0
......
...@@ -16,8 +16,7 @@ ...@@ -16,8 +16,7 @@
<a <a
href="javascript:void(0);" href="javascript:void(0);"
:style="{ :style="{
color: color: '#fff'
!running && allresult.includes(item.key) ? '#ff2200' : '#fff'
}" }"
> >
{{ item.name ? item.name : item.key }} {{ item.name ? item.name : item.key }}
...@@ -173,17 +172,20 @@ export default { ...@@ -173,17 +172,20 @@ export default {
return allresult; return allresult;
}, },
datas() { datas() {
const datas = []; const { number } = this.config;
for (let index = 1; index <= this.config.number; index++) { const nums = number >= 1500 ? 500 : this.config.number;
const listData = this.list.find(d => d.key === index); const configNum = number > 1500 ? Math.floor(number / 3) : number;
const photo = this.photos.find(d => d.id === index); const randomShowNums = luckydrawHandler(configNum, [], nums);
datas.push({ const randomShowDatas = randomShowNums.map(item => {
key: index, const listData = this.list.find(d => d.key === item);
const photo = this.photos.find(d => d.id === item);
return {
key: item * (number > 1500 ? 3 : 1),
name: listData ? listData.name : '', name: listData ? listData.name : '',
photo: photo ? photo.value : '' photo: photo ? photo.value : ''
}); };
} });
return datas; return randomShowDatas;
}, },
categoryName() { categoryName() {
return conversionCategoryName(this.category); return conversionCategoryName(this.category);
......
...@@ -92,7 +92,8 @@ export default { ...@@ -92,7 +92,8 @@ export default {
return this.$store.state.config; return this.$store.state.config;
}, },
set(val) { set(val) {
this.$store.commit('setConfig', val); // this.$store.commit('setConfig', val);
return val;
} }
}, },
storeNewLottery() { storeNewLottery() {
...@@ -108,6 +109,7 @@ export default { ...@@ -108,6 +109,7 @@ export default {
methods: { methods: {
onSubmit() { onSubmit() {
setData(configField, this.form); setData(configField, this.form);
this.$store.commit('setConfig', this.form);
this.$emit('update:visible', false); this.$emit('update:visible', false);
this.$message({ this.$message({
......
...@@ -61,6 +61,10 @@ export default { ...@@ -61,6 +61,10 @@ export default {
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
.el-carousel {
width: 80vw;
margin: 0 auto;
}
.item { .item {
text-align: center; text-align: center;
color: #fff; color: #fff;
......
...@@ -111,10 +111,10 @@ export default { ...@@ -111,10 +111,10 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.c-Result { .c-Result {
.el-dialog__body{ .el-dialog__body {
max-height: 500px; max-height: 500px;
overflow-y: auto; overflow-y: auto;
} }
.listrow { .listrow {
display: flex; display: flex;
line-height: 30px; line-height: 30px;
...@@ -127,9 +127,9 @@ export default { ...@@ -127,9 +127,9 @@ export default {
} }
.card { .card {
display: inline-block; display: inline-block;
width: 40px; // width: 40px;
height: 40px; padding: 0 5px;
line-height: 40px; line-height: 30px;
text-align: center; text-align: center;
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment