list.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <div id="list">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <div class="w_1200">
  6. <el-col :span="5" class="menu">
  7. <el-image :src="squareImage"></el-image>
  8. <span class="menuTitle">Menu</span>
  9. <el-col :span="24" class="menuList" v-for="(item, index) in menuList" :key="index">
  10. <p @click="changeMenu(item.name, index)" :style="`color:${menuIndex == index ? menuColor : ''}`">{{ item.name }}</p>
  11. </el-col>
  12. </el-col>
  13. <el-col :span="18" class="listInfo">
  14. <span v-if="display == 'list'">
  15. <span v-if="column_name == '专家问诊'">
  16. <exports :zhuantiList="zhuantiList" :total="zhuantiTotal" :menuName="column_name"></exports>
  17. </span>
  18. <span v-else-if="column_name == '行业研究'">
  19. <industry :industryList="industryList" :total="industryTotal" :menuName="column_name"></industry>
  20. </span>
  21. <span v-else-if="column_name == '嘉宾访谈'">
  22. <guidance :guidanceList="guidanceList" :total="guidanceTotal" :menuName="column_name"></guidance>
  23. </span>
  24. <span v-else-if="column_name == '项目路演'">
  25. <roadshow :roadshowList="roadshowList" :total="roadshowTotal" :menuName="column_name"></roadshow>
  26. </span>
  27. </span>
  28. <span v-else>
  29. <span v-if="column_name == '专家问诊'">
  30. <el-col :span="24" style="text-align:right;">
  31. <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
  32. </el-col>
  33. <el-col :span="24">
  34. <expdetail :detailinfo="expdetail"></expdetail>
  35. </el-col>
  36. </span>
  37. <span v-else-if="column_name == '行业研究'">
  38. <el-col :span="24" style="text-align:right;">
  39. <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
  40. </el-col>
  41. <el-col :span="24">
  42. <inddetail></inddetail>
  43. </el-col>
  44. </span>
  45. <span v-else-if="column_name == '嘉宾访谈'">
  46. <el-col :span="24" style="text-align:right;">
  47. <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
  48. </el-col>
  49. <el-col :span="24">
  50. <guidetail></guidetail>
  51. </el-col>
  52. </span>
  53. <span v-else-if="column_name == '项目路演'">
  54. <el-col :span="24" style="text-align:right;">
  55. <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
  56. </el-col>
  57. <el-col :span="24">
  58. <roadetail></roadetail>
  59. </el-col>
  60. </span>
  61. </span>
  62. </el-col>
  63. </div>
  64. </el-col>
  65. </el-row>
  66. </div>
  67. </template>
  68. <script>
  69. import _ from 'lodash';
  70. // 列表
  71. import exports from './list/export.vue';
  72. import industry from './list/industry.vue';
  73. import guidance from './list/guidance.vue';
  74. import roadshow from './list/roadshow.vue';
  75. // 详情
  76. import expdetail from './detail/expdetail.vue';
  77. import inddetail from './detail/inddetail.vue';
  78. import guidetail from './detail/guidetail.vue';
  79. import roadetail from './detail/roadetail.vue';
  80. import { mapState, createNamespacedHelpers } from 'vuex';
  81. const { mapActions: column } = createNamespacedHelpers('column');
  82. const { mapActions: news } = createNamespacedHelpers('news');
  83. const { mapActions: newsguidance } = createNamespacedHelpers('newsguidance');
  84. const { mapActions: newsroadshow } = createNamespacedHelpers('newsroadshow');
  85. export default {
  86. name: 'list',
  87. props: {},
  88. components: {
  89. exports,
  90. industry,
  91. guidance,
  92. roadshow,
  93. expdetail,
  94. inddetail,
  95. guidetail,
  96. roadetail,
  97. },
  98. data: function() {
  99. return {
  100. squareImage: require('@/assets/live/square_big.png'),
  101. // 菜单
  102. menuList: [{ name: '专家问诊' }, { name: '行业研究' }, { name: '嘉宾访谈' }, { name: '项目路演' }],
  103. menuIndex: '0',
  104. menuColor: 'rgb(254, 149, 14)',
  105. // 右侧显示
  106. // list:列表,detail:详情
  107. display: 'list',
  108. // 右侧头部栏目
  109. column_name: '专家问诊',
  110. // 专家问诊,行业研究栏目
  111. columnLists: [],
  112. // 专家列表
  113. zhuantiList: [],
  114. zhuantiTotal: 0,
  115. // 行业研究
  116. industryList: [],
  117. industryTotal: 0,
  118. // 嘉宾访谈
  119. guidanceList: [],
  120. guidanceTotal: 0,
  121. // 项目路演
  122. roadshowList: [],
  123. roadshowTotal: 0,
  124. // 专家详情
  125. expdetail: {},
  126. };
  127. },
  128. async created() {
  129. await this.searchcol();
  130. await this.searchColumn();
  131. },
  132. methods: {
  133. ...column({ columnList: 'query', columnInfo: 'fetch' }),
  134. ...news({ newsList: 'query', newsFetch: 'fetch' }),
  135. ...newsguidance({ danceQuery: 'query' }),
  136. ...newsroadshow({ adshowQuery: 'query' }),
  137. // 查询栏目,列表,详情
  138. async searchColumn() {
  139. if (this.type == 1) {
  140. this.changeMenu(this.columnName, 0);
  141. } else if (this.type == 2) {
  142. this.changeMenu(this.columnName, 1);
  143. } else if (this.type == 3) {
  144. this.changeMenu(this.columnName, 2);
  145. } else if (this.type == 4) {
  146. this.changeMenu(this.columnName, 3);
  147. }
  148. if (this.id) {
  149. this.display = 'detail';
  150. // 查看详情
  151. this.searchDetail(this.columnName, this.id);
  152. } else {
  153. this.display = 'list';
  154. }
  155. },
  156. // 选择菜单
  157. changeMenu(columnName, index) {
  158. this.display = 'list';
  159. this.column_name = columnName;
  160. this.menuIndex = index;
  161. this.menuColor = 'rgb(254, 149, 14)';
  162. this.searchInfo({ columnName });
  163. },
  164. // 查看列表
  165. async searchInfo({ skip = 0, columnName, name, ...info } = {}) {
  166. if (columnName == '专家问诊') {
  167. let column = this.columnLists.find(i => i.name == '专家问诊');
  168. const res = await this.newsList({ column_id: column._id });
  169. if (this.$checkRes(res)) {
  170. this.$set(this, `zhuantiList`, res.data);
  171. this.$set(this, `zhuantiTotal`, res.total);
  172. }
  173. } else if (columnName == '行业研究') {
  174. let column = this.columnLists.find(i => i.name == '行业研究');
  175. const res = await this.newsList({ column_id: column._id });
  176. if (this.$checkRes(res)) {
  177. this.$set(this, `industryList`, res.data);
  178. this.$set(this, `industryTotal`, res.total);
  179. }
  180. } else if (columnName == '嘉宾访谈') {
  181. let res = await this.danceQuery({ column_name: '嘉宾访谈' });
  182. if (this.$checkRes(res)) {
  183. this.$set(this, `guidanceList`, res.data);
  184. this.$set(this, `guidanceTotal`, res.total);
  185. }
  186. } else if (columnName == '项目路演') {
  187. let res = await this.adshowQuery({ column_name: '项目路演' });
  188. if (this.$checkRes(res)) {
  189. this.$set(this, `roadshowList`, res.data);
  190. this.$set(this, `roadshowTotal`, res.total);
  191. }
  192. }
  193. },
  194. // 查看详情
  195. async searchDetail(columnName, id) {
  196. if (columnName == '专家问诊') {
  197. let res = await this.newsFetch(id);
  198. if (this.$checkRes(res)) {
  199. this.$set(this, `expdetail`, res.data);
  200. }
  201. }
  202. },
  203. // 点击查看详情
  204. clickDetail({ column_name, id }) {
  205. this.$set(this, `column_name`, column_name);
  206. this.display = 'detail';
  207. this.searchDetail(column_name, id);
  208. },
  209. // 查询栏目
  210. async searchcol() {
  211. let res = await this.columnList();
  212. if (res) this.$set(this, `columnLists`, res.data);
  213. },
  214. },
  215. computed: {
  216. ...mapState(['user']),
  217. type() {
  218. return this.$route.query.type;
  219. },
  220. columnName() {
  221. return this.$route.query.column_name;
  222. },
  223. id() {
  224. return this.$route.query.id;
  225. },
  226. },
  227. metaInfo() {
  228. return { title: this.$route.meta.title };
  229. },
  230. };
  231. </script>
  232. <style lang="less" scoped>
  233. .w_1200 {
  234. width: 1200px;
  235. margin: 0 auto;
  236. }
  237. .main {
  238. margin: 15px 0;
  239. .menu {
  240. height: 600px;
  241. overflow: hidden;
  242. padding: 15px 10px;
  243. background: no-repeat 100% 100%;
  244. background-image: url('~@/assets/live/menu_back.jpg');
  245. box-sizing: border-box;
  246. box-shadow: 0 0 10px #bbbaba;
  247. .menuTitle {
  248. font-size: 24px;
  249. color: #92959a;
  250. font-weight: bold;
  251. position: relative;
  252. top: -10px;
  253. left: 10px;
  254. }
  255. .menuList {
  256. height: 60px;
  257. line-height: 60px;
  258. border-bottom: 1px solid #2d64b3;
  259. p {
  260. font-weight: bold;
  261. font-size: 18px;
  262. color: #044b79;
  263. }
  264. }
  265. .menuList:hover {
  266. cursor: pointer;
  267. }
  268. }
  269. .listInfo {
  270. float: right;
  271. width: 78%;
  272. min-height: 600px;
  273. overflow: hidden;
  274. box-shadow: 0 0 10px #2d64b3;
  275. padding: 10px;
  276. }
  277. }
  278. </style>