list.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <div id="list">
  3. <el-col :span="24" class="main">
  4. <el-col :span="5" class="menu">
  5. <el-image :src="squareImage"></el-image>
  6. <span>Menu</span>
  7. <el-col class="menuList" :span="24" v-for="(item, index) in menuList" :key="index">
  8. <p @click="changeMenu(item.name, index)" :style="`color:${menuIndex == index ? menuColor : ''}`">{{ item.name }}</p>
  9. </el-col>
  10. </el-col>
  11. <el-col :span="19" class="info">
  12. <el-col v-if="menuIndex == '0'" class="leftInfo">
  13. <el-col :span="24" class="leftTop">
  14. <span>|</span> <span>{{ menuName }}</span>
  15. </el-col>
  16. <el-col class="infoLeftList" :span="24" v-for="(item, index) in zhuantiList" :key="index">
  17. <p>{{ item.publish_time }}</p>
  18. <p>
  19. <span class="textOver" @click="clickzhuanti(item.id)">{{ item.title }}</span>
  20. <span>{{ item.content }}</span>
  21. </p>
  22. </el-col>
  23. </el-col>
  24. <el-col v-if="menuIndex == '1'" class="leftInfo">
  25. <el-col :span="24" class="leftTop">
  26. <span>|</span> <span>{{ menuName }}</span>
  27. </el-col>
  28. <el-col class="infoRightList" :span="24" v-for="(item, index) in jishuList" :key="index">
  29. <p>
  30. <span class="textOver" @click="clickjishu(item.id)">{{ item.title }}</span
  31. ><span class="textOver">{{ item.publish_time }}</span>
  32. </p>
  33. </el-col>
  34. </el-col>
  35. <el-col v-if="menuIndex == '2'" class="leftInfo">
  36. <el-col :span="24" class="leftTop">
  37. <span>|</span> <span>{{ menuName }}</span>
  38. </el-col>
  39. <el-col class="infoRightList" :span="24" v-for="(item, index) in hangyeList" :key="index">
  40. <p>
  41. <span class="textOver" @click="clickhangye(item.id)">{{ item.title }}</span
  42. ><span class="textOver">{{ item.publish_time }}</span>
  43. </p>
  44. </el-col>
  45. </el-col>
  46. <el-col v-if="menuIndex == '3'" class="leftInfo">
  47. <el-col :span="24" class="leftTop">
  48. <span>|</span> <span>{{ menuName }}</span>
  49. </el-col>
  50. <el-col class="infoLeftList" :span="24" v-for="(item, index) in jiaoyuList" :key="index">
  51. <p>{{ item.publish_time }}</p>
  52. <p>
  53. <span class="textOver" @click="clickjiaoyu(item.id)">{{ item.title }}</span>
  54. <span>{{ item.content }}</span>
  55. </p>
  56. </el-col>
  57. </el-col>
  58. <el-col class="page">
  59. <el-pagination
  60. background
  61. @current-change="handleCurrentChange"
  62. :current-page.sync="currentPage"
  63. :page-size="pageSize"
  64. layout="total,prev, pager, next, jumper"
  65. :total="pageTotal"
  66. >
  67. </el-pagination>
  68. </el-col>
  69. </el-col>
  70. </el-col>
  71. </div>
  72. </template>
  73. <script>
  74. import _ from 'lodash';
  75. import { mapState, createNamespacedHelpers } from 'vuex';
  76. const { mapActions: news } = createNamespacedHelpers('news');
  77. export default {
  78. name: 'list',
  79. props: {},
  80. components: {},
  81. data: () => ({
  82. squareImage: require('@/assets/live/square_big.png'),
  83. menuList: [{ name: '专题研讨' }, { name: '专家问诊' }, { name: '行业研究' }, { name: '教育培训' }],
  84. menuIndex: '0',
  85. menuName: '专题研讨',
  86. menuColor: 'rgb(254, 149, 14)',
  87. currentPage: 1,
  88. pageTotal: 0,
  89. pageSize: 10,
  90. limit: 10,
  91. zhuantiList: [],
  92. jishuList: [],
  93. hangyeList: [],
  94. jiaoyuList: [],
  95. }),
  96. created() {
  97. this.searchList();
  98. },
  99. computed: {
  100. pageTitle() {
  101. return `${this.$route.meta.title}`;
  102. },
  103. },
  104. metaInfo() {
  105. return { title: this.$route.meta.title };
  106. },
  107. methods: {
  108. ...news(['query']),
  109. async searchList({ skip = 0, limit = 10, ...info } = {}) {
  110. if (this.$route.query.column_name == '专题研讨') {
  111. this.changeMenu(this.$route.query.column_name, 0);
  112. } else if (this.$route.query.column_name == '专家问诊') {
  113. this.changeMenu(this.$route.query.column_name, 1);
  114. } else if (this.$route.query.column_name == '行业研究') {
  115. this.changeMenu(this.$route.query.column_name, 2);
  116. } else if (this.$route.query.column_name == '教育培训') {
  117. this.changeMenu(this.$route.query.column_name, 3);
  118. }
  119. },
  120. async changeMenu(name, index) {
  121. this.menuIndex = index;
  122. this.menuColor = 'rgb(254, 149, 14)';
  123. this.menuName = name;
  124. this.initList({ name });
  125. },
  126. async initList({ name, skip = 0, limit = 10, ...info } = {}) {
  127. let res = [];
  128. if (name == '专题研讨') {
  129. this.pageSize = 5;
  130. res = await this.query({ skip, limit, column_name: '专题研讨', ...info });
  131. this.$set(this, `zhuantiList`, res.data);
  132. } else if (name == '专家问诊') {
  133. res = await this.query({ skip, limit, column_name: '技术问答', ...info });
  134. console.log(res);
  135. this.$set(this, `jishuList`, res.data);
  136. } else if (name == '行业研究') {
  137. res = await this.query({ skip, limit, column_name: '行业研究', ...info });
  138. this.$set(this, `hangyeList`, res.data);
  139. } else if (name == '教育培训') {
  140. this.pageSize = 5;
  141. res = await this.query({ skip, limit, column_name: '教育培训', ...info });
  142. this.$set(this, `jiaoyuList`, res.data);
  143. }
  144. this.$set(this, `pageTotal`, res.total);
  145. },
  146. handleCurrentChange(val) {
  147. const name = this.menuName;
  148. if (name == '专题研讨' || name == '教育培训') {
  149. this.limit = 5;
  150. }
  151. this.initList({ name: name, skip: (val - 1) * this.limit, limit: this.limit });
  152. },
  153. clickzhuanti(id) {
  154. this.$router.push({ path: '/live/detail', query: { id: id } });
  155. console.log(id);
  156. },
  157. clickjishu(id) {
  158. this.$router.push({ path: '/live/detail', query: { id: id } });
  159. console.log(id);
  160. },
  161. clickhangye(id) {
  162. this.$router.push({ path: '/live/detail', query: { id: id } });
  163. console.log(id);
  164. },
  165. clickjiaoyu(id) {
  166. this.$router.push({ path: '/live/detail', query: { id: id } });
  167. console.log(id);
  168. },
  169. },
  170. };
  171. </script>
  172. <style lang="less" scoped>
  173. .main {
  174. width: 80%;
  175. margin: 0 auto;
  176. float: none;
  177. }
  178. .menu {
  179. float: left;
  180. height: 450px;
  181. width: 20%;
  182. background: no-repeat bottom right;
  183. background-image: url(../../assets/live/menu_back.jpg);
  184. margin: 30px 0;
  185. padding: 10px 0 0 10px;
  186. box-sizing: border-box;
  187. box-shadow: 0 0 10px #bbbaba;
  188. }
  189. .menu .el-image {
  190. width: 30px;
  191. display: inline-table;
  192. margin: 10px 5px;
  193. }
  194. .menu span {
  195. font-size: 24px;
  196. color: #92959a;
  197. font-weight: 600;
  198. margin-left: 3px;
  199. position: relative;
  200. top: 10px;
  201. }
  202. .menuList p {
  203. line-height: 60px;
  204. font-size: 18px;
  205. cursor: pointer;
  206. border-bottom: 1px solid #2d64b3;
  207. color: #044b79;
  208. font-weight: 600;
  209. }
  210. .info {
  211. width: 77%;
  212. float: right;
  213. margin: 30px 0 30px 2px;
  214. height: 585px;
  215. box-shadow: 0 0 10px #2d64b3;
  216. overflow: hidden;
  217. right: 0px;
  218. background: #ffffff;
  219. }
  220. .leftInfo {
  221. height: 500px;
  222. overflow: hidden;
  223. }
  224. .leftTop {
  225. font-size: 18px;
  226. width: 96%;
  227. height: 41px;
  228. line-height: 35px;
  229. border-bottom: 1px solid #e5e5e5;
  230. position: relative;
  231. bottom: 1px;
  232. margin: 10px;
  233. font-weight: 600;
  234. color: #22529a;
  235. }
  236. .infoLeftList {
  237. float: left;
  238. width: 95%;
  239. border-bottom: 1px dashed #ccc;
  240. padding: 10px 0 10px 10px;
  241. height: 87px;
  242. margin: 0 0 0 5px;
  243. }
  244. .infoLeftList:hover p:last-child span:first-child {
  245. -webkit-transform: translateY(-3px);
  246. -ms-transform: translateY(-3px);
  247. transform: translateY(-3px);
  248. -webkit-box-shadow: 0 0 6px #999;
  249. box-shadow: 0 0 6px #999;
  250. -webkit-transition: all 0.5s ease-out;
  251. transition: all 0.5s ease-out;
  252. color: #005293;
  253. cursor: pointer;
  254. }
  255. .infoLeftList p:first-child {
  256. float: left;
  257. width: 20%;
  258. font-size: 15px;
  259. background: #044b79;
  260. text-align: center;
  261. color: #fff;
  262. font-weight: bold;
  263. padding: 4px 0px;
  264. margin: 0 0 0 5px;
  265. }
  266. .infoLeftList p:last-child {
  267. float: right;
  268. width: 70%;
  269. padding: 0 0 0 10px;
  270. }
  271. .infoLeftList p:last-child span:first-child {
  272. float: left;
  273. width: 90%;
  274. font-size: 18px;
  275. }
  276. .infoLeftList p:last-child span:last-child {
  277. float: left;
  278. width: 90%;
  279. font-size: 16px;
  280. overflow: hidden;
  281. text-overflow: ellipsis;
  282. -webkit-line-clamp: 2;
  283. word-break: break-all;
  284. display: -webkit-box;
  285. -webkit-box-orient: vertical;
  286. margin: 5px 0 0 0;
  287. color: #666;
  288. }
  289. .page {
  290. text-align: center;
  291. margin: 10px 0;
  292. }
  293. .infoRightList {
  294. float: left;
  295. width: 95%;
  296. padding: 7px 0;
  297. margin: 0 0 0 5px;
  298. }
  299. .infoRightList:nth-child(6) {
  300. border-bottom: 1px solid #ccc;
  301. padding: 0 0 17px 0;
  302. }
  303. .infoRightList:nth-child(7) {
  304. padding: 15px 0 0 0;
  305. }
  306. .infoRightList:nth-child(11) {
  307. border-bottom: 1px solid #ccc;
  308. padding: 0 0 15px 0;
  309. }
  310. .infoRightList:hover p span:first-child {
  311. -webkit-transform: translateY(-3px);
  312. -ms-transform: translateY(-3px);
  313. transform: translateY(-3px);
  314. -webkit-box-shadow: 0 0 6px #999;
  315. box-shadow: 0 0 6px #999;
  316. -webkit-transition: all 0.5s ease-out;
  317. transition: all 0.5s ease-out;
  318. color: #005293;
  319. cursor: pointer;
  320. }
  321. .infoRightList p {
  322. font-size: 18px;
  323. }
  324. .infoRightList p span:first-child {
  325. display: inline-block;
  326. width: 70%;
  327. margin: 0 20px 0 10px;
  328. }
  329. .infoRightList p span:last-child {
  330. display: inline-block;
  331. width: 21%;
  332. text-align: center;
  333. font-size: 16px;
  334. }
  335. </style>