details.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. Page({
  2. data: {
  3. contacts: [],
  4. form1: [],
  5. form2: [],
  6. show: false,
  7. actions: [{
  8. name: "呼叫"
  9. }, {
  10. name: "复制"
  11. }]
  12. },
  13. onLoad(options) {
  14. this.handleData(JSON.parse(options.item))
  15. },
  16. handleData(item) {
  17. const form1 = [{
  18. label: "性别",
  19. content: item.sex
  20. }, {
  21. label: "生日",
  22. content: item.birthday
  23. }, {
  24. label: "家庭住址",
  25. content: item.homeaddress
  26. }, {
  27. label: "邮箱",
  28. content: item.email
  29. }],
  30. form2 = [{
  31. label: "单位",
  32. content: item.company
  33. }, {
  34. label: "部门",
  35. content: item.depname
  36. }, {
  37. label: "职位",
  38. content: item.position
  39. }]
  40. this.setData({
  41. contacts: item,
  42. form1,
  43. form2
  44. })
  45. },
  46. changeShow() {
  47. this.setData({
  48. show: !this.data.show
  49. })
  50. },
  51. /* 处理选择 */
  52. handleSelect(e) {
  53. let phone = this.data.contacts.phonenumber;
  54. if (e.detail.name == '复制') {
  55. wx.setClipboardData({
  56. data: phone
  57. });
  58. } else {
  59. wx.makePhoneCall({
  60. phoneNumber: phone,
  61. })
  62. };
  63. this.changeShow()
  64. },
  65. /* 拷贝内容 */
  66. copyContents(e) {
  67. const {
  68. data
  69. } = e.currentTarget.dataset;
  70. if (data) wx.setClipboardData({
  71. data,
  72. });
  73. },
  74. /* 去编辑 */
  75. toEdit() {
  76. let data = JSON.stringify(this.data.contacts);
  77. wx.navigateTo({
  78. url: '../contacts/edit?data=' + data,
  79. })
  80. },
  81. onShareAppMessage() {}
  82. })