list.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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 hangyeList" :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 zhuantiList" :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. methods: {
  101. ...news(['query']),
  102. async searchList({ skip = 0, limit = 10, ...info } = {}) {
  103. if (this.$route.query.column_name == '专题研讨') {
  104. this.changeMenu(this.$route.query.column_name, 0);
  105. } else if (this.$route.query.column_name == '技术问答') {
  106. this.changeMenu(this.$route.query.column_name, 1);
  107. } else if (this.$route.query.column_name == '行业研究') {
  108. this.changeMenu(this.$route.query.column_name, 2);
  109. } else if (this.$route.query.column_name == '教育培训') {
  110. this.changeMenu(this.$route.query.column_name, 3);
  111. }
  112. },
  113. async changeMenu(name, index) {
  114. this.menuIndex = index;
  115. this.menuColor = 'rgb(254, 149, 14)';
  116. this.menuName = name;
  117. console.log(name);
  118. this.initList({ name });
  119. },
  120. async initList({ name, skip = 0, limit = 10, ...info } = {}) {
  121. let res = [];
  122. console.log(name);
  123. if (name == '专题研讨') {
  124. this.pageSize = 5;
  125. res = await this.query({ skip, limit, column_name: '专题研讨', ...info });
  126. this.$set(this, `zhuantiList`, res.data);
  127. } else if (name == '技术问答') {
  128. res = await this.query({ skip, limit, column_name: '技术问答', ...info });
  129. this.$set(this, `jishuList`, res.data);
  130. } else if (name == '行业研究') {
  131. res = await this.query({ skip, limit, column_name: '行业研究', ...info });
  132. this.$set(this, `hangyeList`, res.data);
  133. } else if (name == '教育培训') {
  134. this.pageSize = 5;
  135. res = await this.query({ skip, limit, column_name: '教育培训', ...info });
  136. this.$set(this, `jiaoyuList`, res.data);
  137. }
  138. console.log(res);
  139. this.$set(this, `pageTotal`, res.total);
  140. },
  141. handleCurrentChange(val) {
  142. console.log(`当前页: ${val}`);
  143. console.log(this.menuName);
  144. const name = this.menuName;
  145. if (name == '专题研讨' || name == '教育培训') {
  146. this.limit = 5;
  147. }
  148. this.initList({ name: name, skip: (val - 1) * this.limit, limit: this.limit });
  149. },
  150. clickzhuanti(id) {
  151. this.$router.push({ path: '/live/detail', query: { id: id } });
  152. console.log(id);
  153. },
  154. clickjishu(id) {
  155. this.$router.push({ path: '/live/detail', query: { id: id } });
  156. console.log(id);
  157. },
  158. clickhangye(id) {
  159. this.$router.push({ path: '/live/detail', query: { id: id } });
  160. console.log(id);
  161. },
  162. clickjiaoyu(id) {
  163. this.$router.push({ path: '/live/detail', query: { id: id } });
  164. console.log(id);
  165. },
  166. },
  167. };
  168. </script>
  169. <style lang="less" scoped>
  170. .main {
  171. width: 80%;
  172. margin: 0 auto;
  173. float: none;
  174. }
  175. .menu {
  176. float: left;
  177. height: 450px;
  178. width: 20%;
  179. background: no-repeat bottom right;
  180. background-image: url(../../assets/live/menu_back.jpg);
  181. margin: 30px 0;
  182. padding: 10px 0 0 10px;
  183. box-sizing: border-box;
  184. box-shadow: 0 0 10px #bbbaba;
  185. }
  186. .menu .el-image {
  187. width: 30px;
  188. display: inline-table;
  189. margin: 10px 5px;
  190. }
  191. .menu span {
  192. font-size: 24px;
  193. color: #92959a;
  194. font-weight: 600;
  195. margin-left: 3px;
  196. position: relative;
  197. top: 10px;
  198. }
  199. .menuList p {
  200. line-height: 60px;
  201. font-size: 18px;
  202. cursor: pointer;
  203. border-bottom: 1px solid #2d64b3;
  204. color: #044b79;
  205. font-weight: 600;
  206. }
  207. .info {
  208. width: 77%;
  209. float: right;
  210. margin: 30px 0 30px 2px;
  211. height: 585px;
  212. box-shadow: 0 0 10px #2d64b3;
  213. overflow: hidden;
  214. right: 0px;
  215. background: #ffffff;
  216. }
  217. .leftInfo {
  218. height: 500px;
  219. overflow: hidden;
  220. }
  221. .leftTop {
  222. font-size: 18px;
  223. width: 96%;
  224. height: 41px;
  225. line-height: 35px;
  226. border-bottom: 1px solid #e5e5e5;
  227. position: relative;
  228. bottom: 1px;
  229. margin: 10px;
  230. font-weight: 600;
  231. color: #22529a;
  232. }
  233. .infoLeftList {
  234. float: left;
  235. width: 95%;
  236. border-bottom: 1px dashed #ccc;
  237. padding: 10px 0 10px 10px;
  238. height: 87px;
  239. margin: 0 0 0 5px;
  240. }
  241. .infoLeftList:hover p:last-child span:first-child {
  242. -webkit-transform: translateY(-3px);
  243. -ms-transform: translateY(-3px);
  244. transform: translateY(-3px);
  245. -webkit-box-shadow: 0 0 6px #999;
  246. box-shadow: 0 0 6px #999;
  247. -webkit-transition: all 0.5s ease-out;
  248. transition: all 0.5s ease-out;
  249. color: #005293;
  250. cursor: pointer;
  251. }
  252. .infoLeftList p:first-child {
  253. float: left;
  254. width: 20%;
  255. font-size: 15px;
  256. background: #044b79;
  257. text-align: center;
  258. color: #fff;
  259. font-weight: bold;
  260. padding: 4px 0px;
  261. margin: 0 0 0 5px;
  262. }
  263. .infoLeftList p:last-child {
  264. float: right;
  265. width: 70%;
  266. padding: 0 0 0 10px;
  267. }
  268. .infoLeftList p:last-child span:first-child {
  269. float: left;
  270. width: 90%;
  271. font-size: 18px;
  272. }
  273. .infoLeftList p:last-child span:last-child {
  274. float: left;
  275. width: 90%;
  276. font-size: 16px;
  277. overflow: hidden;
  278. text-overflow: ellipsis;
  279. -webkit-line-clamp: 2;
  280. word-break: break-all;
  281. display: -webkit-box;
  282. -webkit-box-orient: vertical;
  283. margin: 5px 0 0 0;
  284. color: #666;
  285. }
  286. .page {
  287. text-align: center;
  288. margin: 10px 0;
  289. }
  290. .infoRightList {
  291. float: left;
  292. width: 95%;
  293. padding: 7px 0;
  294. margin: 0 0 0 5px;
  295. }
  296. .infoRightList:nth-child(6) {
  297. border-bottom: 1px solid #ccc;
  298. padding: 0 0 17px 0;
  299. }
  300. .infoRightList:nth-child(7) {
  301. padding: 15px 0 0 0;
  302. }
  303. .infoRightList:nth-child(11) {
  304. border-bottom: 1px solid #ccc;
  305. padding: 0 0 15px 0;
  306. }
  307. .infoRightList:hover p span:first-child {
  308. -webkit-transform: translateY(-3px);
  309. -ms-transform: translateY(-3px);
  310. transform: translateY(-3px);
  311. -webkit-box-shadow: 0 0 6px #999;
  312. box-shadow: 0 0 6px #999;
  313. -webkit-transition: all 0.5s ease-out;
  314. transition: all 0.5s ease-out;
  315. color: #005293;
  316. cursor: pointer;
  317. }
  318. .infoRightList p {
  319. font-size: 18px;
  320. }
  321. .infoRightList p span:first-child {
  322. display: inline-block;
  323. width: 70%;
  324. margin: 0 20px 0 10px;
  325. }
  326. .infoRightList p span:last-child {
  327. display: inline-block;
  328. width: 21%;
  329. text-align: center;
  330. font-size: 16px;
  331. }
  332. </style>