make-phone-call.js 800 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Page({
  2. onShareAppMessage() {
  3. return {
  4. title: '打电话',
  5. path: 'packageAPI/pages/device/make-phone-call/make-phone-call'
  6. }
  7. },
  8. data: {
  9. theme: 'light',
  10. disabled: true
  11. },
  12. bindInput(e) {
  13. this.inputValue = e.detail.value
  14. if (this.inputValue.length > 0) {
  15. this.setData({
  16. disabled: false
  17. })
  18. } else {
  19. this.setData({
  20. disabled: true
  21. })
  22. }
  23. },
  24. makePhoneCall() {
  25. wx.makePhoneCall({
  26. phoneNumber: this.inputValue,
  27. success() {
  28. console.log('成功拨打电话')
  29. }
  30. })
  31. },
  32. onLoad() {
  33. this.setData({
  34. theme: wx.getSystemInfoSync().theme || 'light'
  35. })
  36. if (wx.onThemeChange) {
  37. wx.onThemeChange(({theme}) => {
  38. this.setData({theme})
  39. })
  40. }
  41. }
  42. })