洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.2 KiB

10 months ago
9 months ago
10 months ago
10 months ago
9 months ago
10 months ago
  1. <template>
  2. <view class="box">
  3. <view class="phoneIcon" @click.stop="phoneClick">
  4. <slot></slot>
  5. </view>
  6. <u-action-sheet :actions="servicePhone" :show="show" @select="callPhoneClick" :closeOnClickOverlay="true" @close="show=false" cancelText="取消"></u-action-sheet>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. props: ['servicePhone'],
  12. data() {
  13. return {
  14. show: false
  15. }
  16. },
  17. methods: {
  18. phoneClick() {
  19. console.log(this.servicePhone)
  20. if(!this.servicePhone) return false
  21. if(this.servicePhone.length==1) {
  22. this.callPhoneClick(this.servicePhone[0])
  23. }else {
  24. show=true
  25. }
  26. },
  27. async callPhoneClick(item) {
  28. let phone = item.name
  29. // #ifdef APP-PLUS
  30. /* #ifdef APP-PLUS */
  31. let result = await this.$store.dispatch("requestPermissions",'CALL_PHONE',)
  32. if (result !== 1) return
  33. /* #endif */
  34. this.$u.utils.callPhone(phone)
  35. // #endif
  36. // #ifdef H5
  37. var a = document.createElement('a')
  38. a.setAttribute('href', 'tel:'+ phone)
  39. document.body.appendChild(a)
  40. a.click()
  41. console.log(phone)
  42. // #endif
  43. this.show =false
  44. },
  45. }
  46. }
  47. </script>
  48. <style>
  49. </style>