component-list.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // components/component-list.js
  2. const { cosBaseUrl } = require('../../../utils/newServices.js')
  3. const app = getApp()
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. hasProduct: {
  10. type: Boolean
  11. },
  12. hasPay: {
  13. type: Boolean
  14. },
  15. sceneId: {
  16. type: String
  17. },
  18. thumbUrl: {
  19. type: String
  20. },
  21. imageUrl: {
  22. type: String
  23. },
  24. name: {
  25. type: String
  26. },
  27. pavilionName: {
  28. type: String
  29. },
  30. statusTextDesp: {
  31. type: String
  32. },
  33. distance: {
  34. type: String
  35. },
  36. detailType: {
  37. type: [Number, String],
  38. },
  39. online: Number,
  40. scenePv: Number,
  41. link: String
  42. },
  43. options: {
  44. addGlobalClass: true,
  45. newImg: ''
  46. },
  47. lifetimes: {
  48. attached: function(){
  49. let that = this
  50. this.setData({
  51. newImg: that.getImgUrl()
  52. })
  53. }
  54. },
  55. /**
  56. * 组件的初始数据
  57. */
  58. data: {
  59. cosBaseUrl
  60. },
  61. /**
  62. * 组件的方法列表
  63. */
  64. methods: {
  65. goBigScene: function(){
  66. console.log(this.data.detailType, 666)
  67. if(this.data.detailType == 2){
  68. wx.navigateTo({
  69. url: '/pages/guicangDetails/index?id=' + this.data.sceneId
  70. });
  71. } else {
  72. if (this.data.online === 1){
  73. app.globalData.currentUrl = this.data.link
  74. wx.navigateTo({
  75. url: `../../wv_page/index?id=${this.data.sceneId}`,
  76. success: function (res) { },
  77. fail: function (res) { },
  78. complete: function (res) { },
  79. })
  80. }else{
  81. wx.navigateTo({
  82. url: `/pages/zl_detail/index?id=${this.data.sceneId}`,
  83. success: function (res) { },
  84. fail: function (res) { },
  85. complete: function (res) { },
  86. })
  87. }
  88. }
  89. },
  90. getImgUrl: function(){
  91. let url = this.data.thumbUrl || this.data.imageUrl
  92. return url.includes('http') ? url : (this.data.cosBaseUrl + url)
  93. }
  94. },
  95. ready : function(){
  96. console.log(this.data)
  97. }
  98. })