与牧同行-小程序用户端
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.

33 lines
819 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. },
  9. onLoad(options) {
  10. this.getexperienceDetails(options)
  11. },
  12. // 经验分享详情
  13. getexperienceDetails(options){
  14. http.experienceDetails({
  15. data:{
  16. id:options.id
  17. },
  18. success:res=>{
  19. console.log(1111,res);
  20. var ch ='<img src="/dev-api'
  21. const mmg = res.data.content.replace(new RegExp(ch, 'g'), '<img src="' + baseUrl)
  22. const images = mmg.replace(/\<img/g, '<img style="width:100%;display:block; border-radius:3px;"');
  23. this.setData({
  24. detail:res.data,
  25. content:images
  26. })
  27. }
  28. })
  29. },
  30. })