index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <div class="bg-F5">
  3. <div class="container">
  4. <div class="infoTabDiv">
  5. <el-tabs v-model="activeName" @tab-click="tabChange">
  6. <el-tab-pane label="通知公告" name="first">
  7. <div class="listDiv">
  8. <ul class="listUl">
  9. <li v-for="item in tzggArr" :key="item.noticeId">
  10. <div class="dateDiv">
  11. <div class="day">{{ item.createDay }}</div>
  12. <div>{{ item.createMonth }}</div>
  13. </div>
  14. <router-link class="conDiv" :to="`/home`">
  15. <div class="tit">{{ item.noticeTitle }}</div>
  16. <div class="detail">
  17. <div v-html="item.noticeContent"></div>
  18. <span class="xq"
  19. >详情<i class="el-icon-d-arrow-right"></i
  20. ></span>
  21. </div>
  22. </router-link>
  23. </li>
  24. </ul>
  25. </div>
  26. </el-tab-pane>
  27. <el-tab-pane label="行业资讯" name="second">
  28. <div class="listDiv">
  29. <ul class="listUl">
  30. <li v-for="item in hyzxArr" :key="item.noticeId">
  31. <div class="dateDiv">
  32. <div class="day">{{ item.createDay }}</div>
  33. <div>{{ item.createMonth }}</div>
  34. </div>
  35. <router-link class="conDiv" :to="`/home`">
  36. <div class="tit">{{ item.noticeTitle }}</div>
  37. <div class="detail">
  38. <div v-html="item.noticeContent"></div>
  39. <span class="xq"
  40. >详情<i class="el-icon-d-arrow-right"></i
  41. ></span>
  42. </div>
  43. </router-link>
  44. </li>
  45. </ul>
  46. </div>
  47. </el-tab-pane>
  48. <el-tab-pane label="家具保养" name="third">
  49. <div class="listDiv">
  50. <ul class="listUl">
  51. <li v-for="item in jjbyArr" :key="item.noticeId">
  52. <div class="dateDiv">
  53. <div class="day">{{ item.createDay }}</div>
  54. <div>{{ item.createMonth }}</div>
  55. </div>
  56. <router-link
  57. class="conDiv"
  58. :to="`/news/newsDetail?noticeId=${item.noticeId}`"
  59. >
  60. <div class="tit">{{ item.noticeTitle }}</div>
  61. <div class="detail">
  62. <div v-html="item.noticeContent"></div>
  63. <span class="xq"
  64. >详情<i class="el-icon-d-arrow-right"></i
  65. ></span>
  66. </div>
  67. </router-link>
  68. </li>
  69. </ul>
  70. </div>
  71. </el-tab-pane>
  72. </el-tabs>
  73. </div>
  74. <el-pagination
  75. class="pageDiv"
  76. background
  77. @current-change="handleCurrentChange"
  78. :page-size="pageSize"
  79. :current-page="currentPage"
  80. layout="prev, pager, next,total, jumper"
  81. :total="total"
  82. ></el-pagination>
  83. </div>
  84. </div>
  85. </template>
  86. <script lang="ts">
  87. import { Component, Vue, Watch } from "vue-property-decorator";
  88. export default {
  89. name: "app",
  90. components: {},
  91. data() {
  92. return {
  93. activeName: "first",
  94. tzggArr: [],
  95. hyzxArr: [],
  96. jjbyArr: [],
  97. currentPage: 1,
  98. pageSize: 10,
  99. total: 0
  100. };
  101. },
  102. methods: {
  103. tabChange() {
  104. var that = this;
  105. that.currentPage = 1;
  106. if (that.activeName == "first") {
  107. that.listAll(1);
  108. } else if (that.activeName == "second") {
  109. that.listAll(2);
  110. } else if (that.activeName == "third") {
  111. that.listAll(3);
  112. }
  113. },
  114. handleCurrentChange(val) {
  115. this.currentPage = val;
  116. if (that.activeName == "first") {
  117. that.listAll(1);
  118. } else if (that.activeName == "second") {
  119. that.listAll(2);
  120. } else {
  121. that.listAll(3);
  122. }
  123. },
  124. listAll(noticeType) {
  125. var that = this;
  126. that
  127. .$post("interface/notice/getNoticeListAll", {
  128. pageNum: that.currentPage1,
  129. pageSize: that.pageSize1,
  130. noticeType: noticeType
  131. })
  132. .then(function(res) {
  133. console.log(res);
  134. if (!res[0]) {
  135. res[1].rows.forEach(function(item, index) {
  136. let date = [];
  137. let dateTime = [];
  138. if (item.createTime) {
  139. dateTime = item.createTime.split(" ");
  140. date = dateTime[0].split("-");
  141. item.createDay = date[2];
  142. item.createMonth = date[0] + "-" + date[1];
  143. }
  144. });
  145. that.total = res[1].total;
  146. if (noticeType == 1) {
  147. that.tzggArr = res[1].rows;
  148. } else if (noticeType == 2) {
  149. that.hyzxArr = res[1].rows;
  150. } else {
  151. that.jjbyArr = res[1].rows;
  152. }
  153. }
  154. });
  155. }
  156. },
  157. activated() {
  158. if (this.$route.query.active) {
  159. this.activeName = this.$route.query.active;
  160. this.tabChange();
  161. }
  162. },
  163. mounted() {
  164. this.listAll(1);
  165. this.listAll(2);
  166. this.listAll(3);
  167. }
  168. };
  169. </script>
  170. <style scoped lang="scss">
  171. .listDiv {
  172. width: 100%;
  173. padding-left: 4rem;
  174. box-sizing: border-box;
  175. }
  176. .listUl {
  177. list-style: none;
  178. width: 100%;
  179. border-left: 0.1rem solid #e5e5e5;
  180. }
  181. .listUl li {
  182. width: 100%;
  183. min-height: 7rem;
  184. position: relative;
  185. padding-left: 7rem;
  186. margin-top: 2rem;
  187. box-sizing: border-box;
  188. .dateDiv {
  189. height: 8rem;
  190. width: 8rem;
  191. color: #fff;
  192. text-align: center;
  193. background: #fd5522;
  194. border-radius: 0.5rem;
  195. position: absolute;
  196. left: -3.5rem;
  197. top: 0;
  198. > div {
  199. font-size: 1.6rem;
  200. height: 2.8rem;
  201. line-height: 2.8rem;
  202. }
  203. .day {
  204. height: 5rem;
  205. line-height: 5rem;
  206. font-size: 2.5em;
  207. font-weight: bolder;
  208. border-bottom: 0.1rem solid #fff;
  209. }
  210. }
  211. .conDiv {
  212. width: 100%;
  213. display: block;
  214. height: 100%;
  215. padding: 0 1rem;
  216. background: #fff;
  217. box-shadow: 2px 2px 12px #ddd;
  218. box-sizing: border-box;
  219. border-radius: 0.3rem;
  220. .tit {
  221. height: 3rem;
  222. line-height: 3rem;
  223. font-size: 1.6rem;
  224. font-weight: bolder;
  225. }
  226. .detail {
  227. height: 5rem;
  228. line-height: 1.6rem;
  229. div {
  230. height: 3.2rem;
  231. line-height: 1.6rem;
  232. font-size: 1.2rem;
  233. color: #666;
  234. word-break: break-all;
  235. overflow: hidden;
  236. text-overflow: ellipsis;
  237. white-space: normal;
  238. display: -webkit-box;
  239. -webkit-line-clamp: 2;
  240. -webkit-box-orient: vertical;
  241. }
  242. .xq {
  243. color: #fd5522;
  244. margin-left: 1rem;
  245. }
  246. }
  247. }
  248. }
  249. .pageDiv {
  250. text-align: right;
  251. margin-top: 0.5rem;
  252. padding: 3rem 0;
  253. }
  254. </style>
  255. <style lang="scss">
  256. .infoTabDiv {
  257. .el-tabs__nav-scroll {
  258. padding: 0 1.6rem;
  259. box-sizing: border-box;
  260. }
  261. .el-tabs__item {
  262. height: 5rem;
  263. line-height: 5rem;
  264. }
  265. .el-tabs__item:hover {
  266. color: #fd5522;
  267. }
  268. .el-tabs__item.is-active {
  269. color: #fd5522;
  270. }
  271. .el-tabs__active-bar {
  272. background-color: #fd5522;
  273. }
  274. }
  275. </style>