index.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const util = require("../../utils/util");
  2. Component({
  3. properties: {
  4. showType:{
  5. type:Boolean,
  6. value:false,
  7. observer:function(newVal){
  8. this.setData({showType:newVal})
  9. }
  10. },
  11. aid:{
  12. type:String,
  13. observer:function(newVal){
  14. this.setData({aid:newVal})
  15. this.getGoodstext();
  16. this.getGoodsList();
  17. }
  18. },
  19. },
  20. data: {
  21. dataList:{},
  22. content:{},
  23. aid:'',
  24. showType:false,
  25. },
  26. methods: {
  27. getGoodstext(){
  28. let that=this;
  29. util.getGoodstext(this.data.aid).then(res=>{
  30. let data=res;
  31. data.provide = data.provide.replace(/section/g, "div");
  32. data.provide = data.provide.replace(/<img/g, "<img style='max-width:100%'");
  33. data.userProvided = data.userProvided.replace(/section/g, "div");
  34. data.userProvided = data.userProvided.replace(/<img/g, "<img style='max-width:100%'");
  35. that.setData({content:data})
  36. })
  37. },
  38. getGoodsList(){
  39. let that=this;
  40. util.getGoodsList(this.data.aid).then(res=>{
  41. res.forEach(el => {
  42. el.logo=el.logo.replace('@!logo','')
  43. });
  44. that.setData({dataList:res})
  45. })
  46. }
  47. }
  48. })