methods.js 655 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import Apis from '@/common/apis/index'
  2. export default {
  3. inputMobile(event) {
  4. this.form.name = event.detail.value
  5. },
  6. inputIdCard(event) {
  7. this.form.id_card = event.detail.value
  8. },
  9. async onSubmit() {
  10. for (let key in this.form) {
  11. if (!this.form[key]) {
  12. let keyname = {
  13. name: '姓名',
  14. id_card: '身份证号'
  15. } [key]
  16. uni.showToast({
  17. title: `请输入${keyname}`,
  18. duration: 2000,
  19. icon: 'error'
  20. });
  21. return
  22. }
  23. }
  24. try {
  25. let query = {
  26. ...this.form
  27. }
  28. await Apis.PostAssociation(this.form)
  29. uni.navigateBack({
  30. delta: 1
  31. })
  32. } catch (e) {
  33. //TODO handle the exception
  34. }
  35. }
  36. }