person-add.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <view>
  3. <u-field icon="man-add" v-model="name" label-width="0" placeholder="紧急联系人姓名"></u-field>
  4. <u-field icon="phone" type="number" v-model="tel" label-width="0" placeholder="紧急联系人手机号码"></u-field>
  5. <view class="plr-36 mt-80">
  6. <u-button type="primary" :disabled="!tel || !name" @click="submit">保存</u-button>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. data() {
  13. return {
  14. name:'',
  15. tel:''
  16. }
  17. },
  18. methods: {
  19. submit(){
  20. this.$http('/addons/ddrive/user/add_contact',{
  21. emergency_contact: this.name,
  22. contact_tel: this.tel
  23. },"POST").then(data=>{
  24. console.log(data);
  25. this.$store.dispatch('updateUserInfo')
  26. uni.showToast({
  27. title: '添加成功'
  28. })
  29. setTimeout(() => {
  30. uni.navigateBack({})
  31. }, 500)
  32. })
  33. }
  34. }
  35. }
  36. </script>
  37. <style lang="scss" scoped>
  38. /deep/.u-btn {
  39. height: 96rpx !important;
  40. }
  41. /deep/.u-primary-hover {
  42. background: linear-gradient(to right,#00b6b4,#00d496) !important;
  43. }
  44. /deep/.u-btn--primary--disabled {
  45. background-color: $bg-1 !important;
  46. }
  47. </style>