listDetail.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div id="listDetail">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <top></top>
  7. </el-col>
  8. <el-col :span="24" class="menu">
  9. <div class="w_1200">
  10. <menus></menus>
  11. </div>
  12. </el-col>
  13. <el-col :span="24" class="main">
  14. <div class="w_1200">
  15. <el-col :span="5" class="left">
  16. <el-col :span="24" class="top">
  17. <i class="el-icon-s-unfold"></i>
  18. <span>党建学苑</span>
  19. </el-col>
  20. <el-col :span="24" class="menu">
  21. <el-col class="menuList" :span="24" v-for="(item, index) in menuList" :key="index">
  22. <p @click="changeMenu(item.name, index)" :style="`color:${menuIndex == index ? menuColor : ''}`">
  23. {{ item.name }}
  24. </p>
  25. </el-col>
  26. </el-col>
  27. </el-col>
  28. <el-col :span="18" class="right">
  29. <span v-if="displays == '0'">
  30. <el-col :span="24" class="one">
  31. <span></span>
  32. <span>{{ columnName }}</span>
  33. </el-col>
  34. <el-col :span="24" class="list">
  35. <newsList :list="list" :total="total" @detailBtn="detailBtn"></newsList>
  36. </el-col>
  37. </span>
  38. <span v-else>
  39. <newsDetail :details="details"></newsDetail>
  40. </span>
  41. </el-col>
  42. </div>
  43. </el-col>
  44. <el-col :span="24" class="foot">
  45. <div class="w_1200">
  46. <foot></foot>
  47. </div>
  48. </el-col>
  49. </el-col>
  50. </el-row>
  51. </div>
  52. </template>
  53. <script>
  54. import top from '@/layout/common/top.vue';
  55. import menus from '@/layout/common/menus.vue';
  56. import foot from '@/layout/common/foot.vue';
  57. import newsList from './parts/newsList.vue';
  58. import newsDetail from './parts/newsDetail.vue';
  59. import { mapState, createNamespacedHelpers } from 'vuex';
  60. export default {
  61. name: 'listDetail',
  62. props: {},
  63. components: {
  64. top,
  65. menus,
  66. foot,
  67. newsList,
  68. newsDetail,
  69. },
  70. data: function() {
  71. return {
  72. menuList: [{ name: '图片新闻' }, { name: '党建工作' }, { name: '学习园地' }, { name: '党风廉政' }],
  73. menuColor: 'rgb(5,73,130)',
  74. menuIndex: '0',
  75. columnName: '',
  76. displays: '0',
  77. // 列表
  78. list: [
  79. {
  80. title: '标题',
  81. date: '2020-02-02',
  82. },
  83. {
  84. title: '十四数据',
  85. date: '2020-02-02',
  86. },
  87. ],
  88. // 总数
  89. total: 10,
  90. // 详情
  91. details: {
  92. title: '信息标题',
  93. source: '信息部',
  94. date: '2020-02-02',
  95. content: '信息内容',
  96. },
  97. };
  98. },
  99. created() {
  100. this.changeColumn();
  101. },
  102. methods: {
  103. // 选择栏目
  104. changeColumn() {
  105. if (this.col_name == '图片新闻') {
  106. this.menuIndex = 0;
  107. this.columnName = this.col_name;
  108. this.menuColor = 'rgb(5,73,130)';
  109. this.$set(this, `displays`, this.display);
  110. } else if (this.col_name == '党建工作') {
  111. this.menuIndex = 1;
  112. this.columnName = this.col_name;
  113. this.menuColor = 'rgb(5,73,130)';
  114. this.$set(this, `displays`, this.display);
  115. } else if (this.col_name == '学习园地') {
  116. this.menuIndex = 2;
  117. this.columnName = this.col_name;
  118. this.menuColor = 'rgb(5,73,130)';
  119. this.$set(this, `displays`, this.display);
  120. } else if (this.col_name == '党风廉政') {
  121. this.menuIndex = 3;
  122. this.columnName = this.col_name;
  123. this.menuColor = 'rgb(5,73,130)';
  124. this.$set(this, `displays`, this.display);
  125. }
  126. },
  127. // 点击选择菜单
  128. changeMenu(name, index) {
  129. this.menuIndex = index;
  130. this.columnName = name;
  131. this.menuColor = 'rgb(5,73,130)';
  132. this.$set(this, `displays`, 0);
  133. },
  134. // 点击详情
  135. detailBtn(id) {
  136. this.$set(this, `displays`, 1);
  137. },
  138. },
  139. computed: {
  140. ...mapState(['user']),
  141. display() {
  142. return this.$route.query.display;
  143. },
  144. col_name() {
  145. return this.$route.query.col_name;
  146. },
  147. id() {
  148. return this.$route.query.id;
  149. },
  150. },
  151. metaInfo() {
  152. return { title: this.$route.meta.title };
  153. },
  154. };
  155. </script>
  156. <style lang="less" scoped>
  157. .w_1200 {
  158. width: 1200px;
  159. margin: 0 auto;
  160. }
  161. .style {
  162. .menu {
  163. height: 70px;
  164. margin: 0 0 10px 0;
  165. }
  166. .main {
  167. min-height: 600px;
  168. margin: 0 0 10px 0;
  169. .left {
  170. min-height: 600px;
  171. background: #fff;
  172. margin: 0 10px 0 0;
  173. .top {
  174. height: 60px;
  175. line-height: 60px;
  176. background-color: #054982;
  177. color: #fff;
  178. font-size: 25px;
  179. font-weight: 600;
  180. letter-spacing: 2px;
  181. text-align: center;
  182. }
  183. .menuList {
  184. height: 50px;
  185. line-height: 50px;
  186. text-align: center;
  187. border-bottom: 1px solid #ccc;
  188. p {
  189. font-size: 20px;
  190. font-weight: bold;
  191. }
  192. }
  193. }
  194. .right {
  195. width: 78%;
  196. min-height: 600px;
  197. background: #fff;
  198. padding: 0 20px;
  199. .one {
  200. height: 35px;
  201. margin: 20px 0;
  202. border-bottom: 1px dashed #ccc;
  203. span:first-child {
  204. display: inline-block;
  205. width: 4px;
  206. height: 20px;
  207. background: #005293;
  208. margin: 0 10px -3px 0;
  209. }
  210. span:nth-child(2) {
  211. font-size: 20px;
  212. color: #005293;
  213. font-weight: bold;
  214. }
  215. }
  216. }
  217. }
  218. .foot {
  219. height: 135px;
  220. }
  221. }
  222. </style>