修改注释 封装方法

This commit is contained in:
wangsongsole 2022-05-19 09:58:16 +08:00
parent 13a6a94859
commit ad0cc4829b
1 changed files with 71 additions and 69 deletions

View File

@ -182,6 +182,27 @@ export default class addKnockGold extends Component {
return true return true
} }
} else { } else {
/* 校验表单 */
if (!this.limitFunction()) {
return false
}
//
let temp = []
if (sessionStorage.getItem('knockGoldData')) {
temp = JSON.parse(sessionStorage.getItem('knockGoldData'))
}
let data = temp ? temp : []
const models = this.state.model
models.uuid = uuid(6, 16)
data.push(models)
sessionStorage.setItem('knockGoldData', JSON.stringify(data))
return true
}
}
}
/* 校验表单function */
limitFunction() {
if (!this.state.model.card_type) { if (!this.state.model.card_type) {
Notify.error('请选择卡种') Notify.error('请选择卡种')
return false return false
@ -199,10 +220,7 @@ export default class addKnockGold extends Component {
/* 可用时间段 */ /* 可用时间段 */
if (this.state.model.usable_time === '1') { if (this.state.model.usable_time === '1') {
if ( if (!this.state.model.effect_date_type || !this.state.model.effect_date) {
!this.state.model.effect_date_type ||
!this.state.model.effect_date
) {
Notify.error('请完整的填写或选择可用时间段') Notify.error('请完整的填写或选择可用时间段')
return false return false
} }
@ -229,10 +247,7 @@ export default class addKnockGold extends Component {
return false return false
} }
if ( if (this.state.model.denomination - 0 > this.state.model.all_budget - 0) {
this.state.model.denomination - 0 >
this.state.model.all_budget - 0
) {
Notify.error('面额必须小于总预算') Notify.error('面额必须小于总预算')
return false return false
} }
@ -251,20 +266,6 @@ export default class addKnockGold extends Component {
Notify.error('请选择结束时间或开始时间') Notify.error('请选择结束时间或开始时间')
return false return false
} }
//
let temp = []
if (sessionStorage.getItem('knockGoldData')) {
temp = JSON.parse(sessionStorage.getItem('knockGoldData'))
}
let data = temp ? temp : []
const models = this.state.model
models.uuid = uuid(6, 16)
data.push(models)
sessionStorage.setItem('knockGoldData', JSON.stringify(data))
return true
}
}
} }
// //
@ -278,6 +279,7 @@ export default class addKnockGold extends Component {
debugger debugger
return blr return blr
} }
// onProductChange(e) { // onProductChange(e) {
// console.log('e ===>', e) // console.log('e ===>', e)
// this.setState({ cur_product: e }) // this.setState({ cur_product: e })
@ -308,7 +310,7 @@ export default class addKnockGold extends Component {
// }) // })
// } // }
//change /* 输入事件和选择事件统一处理 */
onHandleChange(value, key) { onHandleChange(value, key) {
let model2 = this.state.model let model2 = this.state.model
model2[key] = value model2[key] = value