home.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. new Vue({
  2. el: '#main',
  3. data: {
  4. roles: [],
  5. selectedRole: "",
  6. isopen: true,
  7. signAnalysis: [{
  8. photo: '../../images/qianyujingzhan_icon.png',
  9. label: '签约进展',
  10. url: 'sign-progress.html'
  11. }, {
  12. photo: '../../images/xuqianjingzhan_icon.png',
  13. label: '续签进展',
  14. url: 'renew-progress.html'
  15. }, {
  16. photo: '../../images/jumingfenxi_icon.png',
  17. label: '居民分析',
  18. url: 'resident-analysis.html'
  19. }, {
  20. photo: '../../images/tuigaiqian_icon.png',
  21. label: '退改签',
  22. url: 'change-back.html'
  23. }, {
  24. photo: '../../images/lianglvfenxi_icon.png',
  25. label: '两率分析',
  26. url: 'two-rate-analysis.html'
  27. }],
  28. serviceAnalysis: [{
  29. photo: '../../images/zongtifenxi_icon.png',
  30. label: '总体分析',
  31. url: 'comprehensive-analysis.html'
  32. }, {
  33. photo: '../../images/zixunfenxi_icon.png',
  34. label: '咨询分析',
  35. url: 'consulting-analysis.html'
  36. }, {
  37. photo: '../../images/pijianfenxi_icon.png',
  38. label: '评价分析',
  39. url: 'estimate-analysis.html'
  40. }, {
  41. photo: '../../images/changcufangfenxi_icon.png',
  42. label: '长处方分析',
  43. url: 'prescription-analysis.html'
  44. }]
  45. },
  46. methods: {
  47. open: function() {
  48. EventBus.$emit('open-click', {});
  49. },
  50. showDetail: function(url) {
  51. window.location.href = url;
  52. }
  53. },
  54. mounted: function() {
  55. //获取缓存里面的userRole
  56. var roles = window.localStorage.getItem("userRole");
  57. this.roles = JSON.parse(roles);
  58. var selected = window.localStorage.getItem("selectedRole");
  59. if(selected && selected!= "undefined") {
  60. this.selectedRole = JSON.parse(selected).code;
  61. } else {
  62. this.selectedRole = this.roles[0].code;
  63. var selected = this.roles[0];
  64. window.localStorage.setItem("selectedRole", JSON.stringify(selected));
  65. }
  66. },
  67. watch: {
  68. selectedRole: function(val) {
  69. var selected = _.findWhere(this.roles, {
  70. code: val
  71. });
  72. window.localStorage.setItem("selectedRole", JSON.stringify(selected));
  73. }
  74. }
  75. })