chat.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. const util = require("../../utils/util.js");
  2. Component({
  3. properties: {
  4. type:{
  5. type: Number,
  6. observer:function(val){
  7. this.setData({type:val});
  8. }
  9. },
  10. aid:{
  11. type: String,
  12. observer:function(val){
  13. this.setData({aid:val});
  14. }
  15. },
  16. ishome:{
  17. type: Boolean,
  18. observer:function(val){
  19. this.setData({ishome:val});
  20. }
  21. },
  22. show:{
  23. type: Boolean,
  24. observer:function(newVal){
  25. this.setData({show: newVal });
  26. if (newVal && (this.data.aid || this.data.ishome)) {
  27. this.getInfo();
  28. }
  29. }
  30. }
  31. },
  32. data: {
  33. show:false,
  34. aid:'',
  35. phone:'',
  36. imgUrl:'',
  37. ishome:false,
  38. type:0
  39. },
  40. methods: {
  41. getInfo() {
  42. var that = this;
  43. util.ajax({
  44. func: "article/wx_info",
  45. data: { "aid": that.data.aid },
  46. load: false
  47. }, function (res) {
  48. if (res.code == 0) {
  49. that.setData({
  50. phone: res.data.weixin,
  51. imgUrl: res.data.wxlogo
  52. })
  53. } else {
  54. util.showTips(res.reason);
  55. }
  56. })
  57. },
  58. makePhoneCall() {
  59. wx.makePhoneCall({
  60. phoneNumber: this.data.phone
  61. });
  62. },
  63. close(e){
  64. this.setData({show:e.detail})
  65. this.triggerEvent('close',e.detail)
  66. },
  67. lookImg() {
  68. let urls = [];
  69. urls.push(this.data.imgUrl)
  70. wx.previewImage({
  71. current: this.data.imgUrl, // 当前显示图片的http链接
  72. urls: urls // 需要预览的图片http链接列表
  73. });
  74. }
  75. }
  76. })