imges.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // components/My_SupplyAndDemandList/imges.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. attinfos: Array,
  8. ftype: { //供需类型
  9. type: String,
  10. value: ''
  11. },
  12. isEmpty: {
  13. type: Boolean,
  14. value: true
  15. }
  16. },
  17. observers: {
  18. 'attinfos': function (newValue) {
  19. if (newValue.length == 0 && this.data.ftype) {
  20. let obj = {},
  21. url = 'https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/supplyAndDemand/'
  22. switch (this.data.ftype) {
  23. case '寻找主播':
  24. obj.fobsurl = `${url}icon-06.png`
  25. break;
  26. case '摄影摄像':
  27. obj.fobsurl = `${url}icon-01.png`
  28. break;
  29. case '寻找面料':
  30. obj.fobsurl = `${url}icon-04.png`
  31. break;
  32. case '商业培训':
  33. obj.fobsurl = `${url}icon-05.png`
  34. break;
  35. case '面料设计':
  36. obj.fobsurl = `${url}icon-07.png`
  37. break;
  38. case '平面设计':
  39. obj.fobsurl = `${url}icon-03.png`
  40. break;
  41. default:
  42. obj.fobsurl = `${url}default.jpg`
  43. break;
  44. }
  45. this.setData({
  46. emptyImage: obj
  47. })
  48. }
  49. }
  50. },
  51. /**
  52. * 组件的初始数据
  53. */
  54. data: {
  55. emptyImage: {},
  56. },
  57. /**
  58. * 组件的方法列表
  59. */
  60. methods: {
  61. /* 预览图片 */
  62. viewImage(e) {
  63. let {
  64. images,
  65. index
  66. } = e.currentTarget.dataset,
  67. urls = [];
  68. for (let i = 0; i < images.length; i++) {
  69. urls.push(images[i].fobsurl)
  70. }
  71. wx.previewImage({
  72. current: urls[index],
  73. urls
  74. })
  75. },
  76. eviewImage(e) {
  77. let arr = [e.currentTarget.dataset.url]
  78. wx.previewImage({
  79. current: arr[0],
  80. urls: arr
  81. })
  82. },
  83. }
  84. })