education-detail.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. new Vue({
  2. el: '#app',
  3. data:{
  4. educationData:""
  5. },
  6. methods:{
  7. },
  8. mounted(){
  9. var vm = this
  10. var Request = GetRequest();
  11. var id = Request["articleId"];
  12. var promise1 = recordAPI.educationDetail({articleId:id,userType:1}).then(function(res){
  13. if(res.status == 200){return res.data}
  14. })
  15. var promise2 = recordAPI.educationDictionary({typeName:"prio"}).then(function(res){
  16. if(res.status == 200){return res.data}
  17. })
  18. Promise.all([promise1, promise2]).then(function(datas){
  19. var detail = datas[0]
  20. var content = detail.articleContent
  21. detail.articleContent = content.split('group1/M00').join(httpRequest.imgServer+'group1/M00')
  22. //优先级
  23. var articleleveObj = _.find(datas[1],function(item){return item.code == detail.articlelevel;});
  24. if(articleleveObj){
  25. detail.articleleveName = articleleveObj.codeName
  26. }else{
  27. detail.articleleveName = ""
  28. }
  29. //使用范围
  30. var userscopeName = ""
  31. var userscopeArr = [{code:"1",name:'全市使用'},{code:"2",name:'全区使用'},{code:"3",name:'社区使用'},{code:"4",name:'自己使用'}];
  32. detail.userscopeName = _.find(userscopeArr,function(item){return item.code == detail.userScope;}).name;
  33. vm.educationData = detail
  34. }).catch(function(){
  35. toastr.error("请求出错")
  36. })
  37. var divH = $(".layui-layer-content",parent.document).height();
  38. $(".pc-container").slimScroll({ height: divH,color: '#666'});
  39. $(".mobile-text").slimScroll({ height: '421px',color: '#666'});
  40. },
  41. })