Skip to content

Commit

Permalink
修复多次抽奖不减去奖池人数的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vitozyf committed Dec 27, 2019
1 parent 75e4d4d commit 9ea6529
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
v-for="item in resArr"
:key="item"
class="itemres"
:style="resCardStyle"
@click="showRes = false"
>
{{ item }}
</span>
</div>

<LotteryConfig :visible.sync="showConfig" @resetconfig="reloadTagCanvas" />
<Tool @toggle="toggle" :running="running" />
<Tool @toggle="toggle" @resetConfig="reloadTagCanvas" :running="running" />
<Result :visible.sync="showResult"></Result>

<span class="copy-right">
Expand All @@ -59,6 +60,18 @@ export default {
components: { LotteryConfig, Publicity, Tool, Result },
computed: {
resCardStyle() {
const style = {};
const { number } = this.config;
if (number < 100) {
style.fontSize = '100px';
} else if (number < 1000) {
style.fontSize = '80px';
} else if (number < 10000) {
style.fontSize = '60px';
}
return style;
},
config: {
get() {
return this.$store.state.config;
Expand Down Expand Up @@ -192,16 +205,13 @@ export default {
this.resArr = resArr;
this.category = category;
if (this.result[category]) {
if (!this.result[category]) {
this.$set(this.result, category, []);
}
const oldRes = this.result[category] || [];
const data = Object.assign({}, this.result, {
[category]: oldRes.concat(resArr)
});
this.result = data;
window.TagCanvas.SetSpeed('rootcanvas', [5, 1]);
}
Expand Down Expand Up @@ -272,7 +282,7 @@ export default {
border-radius: 4px;
border: 1px solid #ccc;
line-height: 160px;
font-size: 100px;
font-size: 80px;
font-weight: bold;
margin-right: 20px;
margin-top: 20px;
Expand Down
1 change: 1 addition & 0 deletions src/components/Tool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export default {
.then(() => {
clearData();
this.$store.commit('setClearStore');
this.$emit('resetConfig');
this.$message({
type: 'success',
message: '重置成功!'
Expand Down

0 comments on commit 9ea6529

Please sign in to comment.