companyDynamics.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="t-container">
  3. <!-- 停水公告 -->
  4. <div class="content">
  5. <div class="mian" v-if="ishowDetails">
  6. <Notice
  7. :records="result.records"
  8. title="停水公告"
  9. @toDetail="toDetail"
  10. ></Notice>
  11. <Pagination />
  12. </div>
  13. <div class="datails" v-else>
  14. <Details :detailObj="detailObj" @backFn="backFn"></Details>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import Pagination from "@/components/Pagination/index.vue";
  21. import Notice from "@/components/notice/index.vue";
  22. import Details from "./detail.vue";
  23. import { getCurrentPage } from "@/api/currentpage";
  24. export default {
  25. components: {
  26. Pagination,
  27. Notice,
  28. Details,
  29. },
  30. data() {
  31. return {
  32. // 是否展示详情页
  33. ishowDetails: true,
  34. // 返回的公告总数据
  35. result: {},
  36. // 详情页数据
  37. detailObj: {},
  38. /*
  39. moduleType 0公司动态 1信息公开
  40. moduleFunction 0公司动态 1办事公开 2停水通知 3政策法规
  41. */
  42. moduleType: 0,
  43. moduleFunction: 0,
  44. };
  45. },
  46. mounted() {
  47. // 请求停水列表数据与详情
  48. this.getCurrentPage();
  49. },
  50. methods: {
  51. // 获取数据
  52. getCurrentPage() {
  53. let data = { moduleType: this.moduleType, moduleFunction: this.moduleFunction };
  54. getCurrentPage(data).then((res) => {
  55. console.log("lz", res);
  56. if (res.code === 1) {
  57. this.result = res.result;
  58. }
  59. });
  60. },
  61. // 点击标题
  62. toDetail(proId) {
  63. this.ishowDetails = false;
  64. this.result.records.forEach((item) => {
  65. if (item.id === proId) {
  66. this.detailObj = item;
  67. }
  68. });
  69. // console.log(this.detailObj.content);
  70. },
  71. backFn() {
  72. this.ishowDetails = true;
  73. },
  74. },
  75. };
  76. </script>
  77. <style lang="scss" scoped>
  78. .t-container {
  79. width: 100%;
  80. }
  81. ul {
  82. min-height: 50vh;
  83. li {
  84. display: flex;
  85. justify-content: space-between;
  86. align-items: center;
  87. font-size: 20px;
  88. position: relative;
  89. margin: 20px 0 20px 10px;
  90. .l::before {
  91. content: "";
  92. position: absolute;
  93. left: -8px;
  94. top: 8px;
  95. width: 4px;
  96. height: 4px;
  97. background: #000;
  98. border-radius: 50%;
  99. }
  100. }
  101. }
  102. </style>