Fix possible duplicated signings (fix #68)
This commit is contained in:
parent
0a1f9ea3d6
commit
7cb3e246a8
|
|
@ -73,6 +73,7 @@
|
||||||
class="btn btn-primary pull-left"
|
class="btn btn-primary pull-left"
|
||||||
type="primary"
|
type="primary"
|
||||||
round
|
round
|
||||||
|
:disabled="signing"
|
||||||
@click="sign"
|
@click="sign"
|
||||||
>
|
>
|
||||||
<i class="far fa-calendar-check" aria-hidden="true" /> {{ $t('user.sign') }}
|
<i class="far fa-calendar-check" aria-hidden="true" /> {{ $t('user.sign') }}
|
||||||
|
|
@ -114,6 +115,7 @@ export default {
|
||||||
lastSignAt: new Date(),
|
lastSignAt: new Date(),
|
||||||
signAfterZero: false,
|
signAfterZero: false,
|
||||||
signGap: 0,
|
signGap: 0,
|
||||||
|
signing: false,
|
||||||
playersUsed: 0,
|
playersUsed: 0,
|
||||||
playersTotal: 1,
|
playersTotal: 1,
|
||||||
storageUsed: 0,
|
storageUsed: 0,
|
||||||
|
|
@ -186,6 +188,7 @@ export default {
|
||||||
this.score = data.user.score
|
this.score = data.user.score
|
||||||
},
|
},
|
||||||
async sign() {
|
async sign() {
|
||||||
|
this.signing = true
|
||||||
const {
|
const {
|
||||||
code, message, data,
|
code, message, data,
|
||||||
} = await this.$http.post('/user/sign')
|
} = await this.$http.post('/user/sign')
|
||||||
|
|
@ -199,6 +202,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning(message)
|
this.$message.warning(message)
|
||||||
}
|
}
|
||||||
|
this.signing = false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -166,3 +166,12 @@ test('sign', async () => {
|
||||||
expect(button.attributes('disabled')).toBe('disabled')
|
expect(button.attributes('disabled')).toBe('disabled')
|
||||||
expect(wrapper.text()).toContain('3 / 4 KB')
|
expect(wrapper.text()).toContain('3 / 4 KB')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('disable button when signing', () => {
|
||||||
|
Vue.prototype.$http.get.mockResolvedValue(scoreInfo())
|
||||||
|
const wrapper = mount(Dashboard)
|
||||||
|
const button = wrapper.find(Button)
|
||||||
|
expect(button.attributes('disabled')).toBeFalsy()
|
||||||
|
wrapper.setData({ signing: true })
|
||||||
|
expect(button.attributes('disabled')).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,7 @@
|
||||||
|
|
||||||
- Tweaked style of chart at administration panel.
|
- Tweaked style of chart at administration panel.
|
||||||
- Optimized panel of changing theme color.
|
- Optimized panel of changing theme color.
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- Fixed that possible duplicated signings.
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,7 @@
|
||||||
|
|
||||||
- 调整管理面板中的图表样式
|
- 调整管理面板中的图表样式
|
||||||
- 优化「更改配色」的面板
|
- 优化「更改配色」的面板
|
||||||
|
|
||||||
|
## 修复
|
||||||
|
|
||||||
|
- 修复可能存在的重复签到问题
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user