这里准备记录一些急中生智的代码,方便日后总结回顾。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| async function addContactSubmit() { const value = contactForm.value; const verify = await checkContactPhone(value.f_tel_a, value.f_tel_b); if (!verify) return; }
function checkContactPhone(f_tel_a, f_tel_b) { if (this.foreign_key !== 'f_order_id') return true; const params = { f_tel_a, f_tel_b }; return new Promise((resolve) => { this.apiService.post('/order/verifyOnlyContact', params).subscribe((res) => { const status = this.statusReport.getStatus(res); resolve(status); }); }); }
|