与牧同行-兽医端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
901 B

  1. import http from '../../../utils/api'
  2. const baseUrl = require('../../../utils/baseUrl')
  3. Page({
  4. data: {
  5. id: '', // 文章ID
  6. baseUrl:baseUrl,
  7. detail: {}, // 文章详情数据
  8. tags:[]
  9. },
  10. onLoad(options) {
  11. this.getexperienceDetails(options)
  12. },
  13. // 经验分享详情
  14. getexperienceDetails(options){
  15. http.experienceDetails({
  16. data:{
  17. id:options.id
  18. },
  19. success:res=>{
  20. console.log(1111,res);
  21. const tag = res.data.tags.split(',')
  22. var ch ='<img src="/dev-api'
  23. const mmg = res.data.content.replace(new RegExp(ch, 'g'), '<img src="' + baseUrl)
  24. const images = mmg.replace(/\<img/g, '<img style="width:100%;display:block; border-radius:3px;"');
  25. this.setData({
  26. detail:res.data,
  27. content:images,
  28. tags:tag
  29. })
  30. }
  31. })
  32. },
  33. })