123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- <template>
- <div id="list">
- <el-col :span="24" class="main">
- <el-col :span="5" class="menu">
- <el-image :src="squareImage"></el-image>
- <span>Menu</span>
- <el-col class="menuList" :span="24" v-for="(item, index) in menuList" :key="index">
- <p @click="changeMenu(item.name, index)" :style="`color:${menuIndex == index ? menuColor : ''}`">{{ item.name }}</p>
- </el-col>
- </el-col>
- <el-col :span="19" class="info">
- <el-col v-if="menuIndex == '0'" class="leftInfo">
- <el-col :span="24" class="leftTop">
- <span>|</span> <span>{{ menuName }}</span>
- </el-col>
- <el-col class="infoLeftList" :span="24" v-for="(item, index) in zhuantiList" :key="index">
- <p>{{ item.publish_time }}</p>
- <p>
- <span class="textOver" @click="clickzhuanti(item.id)">{{ item.title }}</span>
- <span>{{ item.content }}</span>
- </p>
- </el-col>
- </el-col>
- <el-col v-if="menuIndex == '1'" class="leftInfo">
- <el-col :span="24" class="leftTop">
- <span>|</span> <span>{{ menuName }}</span>
- </el-col>
- <el-col class="infoRightList" :span="24" v-for="(item, index) in hangyeList" :key="index">
- <p>
- <span class="textOver" @click="clickjishu(item.id)">{{ item.title }}</span
- ><span class="textOver">{{ item.publish_time }}</span>
- </p>
- </el-col>
- </el-col>
- <el-col v-if="menuIndex == '2'" class="leftInfo">
- <el-col :span="24" class="leftTop">
- <span>|</span> <span>{{ menuName }}</span>
- </el-col>
- <el-col class="infoRightList" :span="24" v-for="(item, index) in hangyeList" :key="index">
- <p>
- <span class="textOver" @click="clickhangye(item.id)">{{ item.title }}</span
- ><span class="textOver">{{ item.publish_time }}</span>
- </p>
- </el-col>
- </el-col>
- <el-col v-if="menuIndex == '3'" class="leftInfo">
- <el-col :span="24" class="leftTop">
- <span>|</span> <span>{{ menuName }}</span>
- </el-col>
- <el-col class="infoLeftList" :span="24" v-for="(item, index) in zhuantiList" :key="index">
- <p>{{ item.publish_time }}</p>
- <p>
- <span class="textOver" @click="clickjiaoyu(item.id)">{{ item.title }}</span>
- <span>{{ item.content }}</span>
- </p>
- </el-col>
- </el-col>
- <el-col class="page">
- <el-pagination
- background
- @current-change="handleCurrentChange"
- :current-page.sync="currentPage"
- :page-size="pageSize"
- layout="total,prev, pager, next, jumper"
- :total="pageTotal"
- >
- </el-pagination>
- </el-col>
- </el-col>
- </el-col>
- </div>
- </template>
- <script>
- import _ from 'lodash';
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: news } = createNamespacedHelpers('news');
- export default {
- name: 'list',
- props: {},
- components: {},
- data: () => ({
- squareImage: require('@/assets/live/square_big.png'),
- menuList: [{ name: '专题研讨' }, { name: '技术问答' }, { name: '行业研究' }, { name: '教育培训' }],
- menuIndex: '0',
- menuName: '专题研讨',
- menuColor: 'rgb(254, 149, 14)',
- currentPage: 1,
- pageTotal: 0,
- pageSize: 10,
- limit: 10,
- zhuantiList: [],
- jishuList: [],
- hangyeList: [],
- jiaoyuList: [],
- }),
- created() {
- this.searchList();
- },
- computed: {},
- methods: {
- ...news(['query']),
- async searchList({ skip = 0, limit = 10, ...info } = {}) {
- if (this.$route.query.column_name == '专题研讨') {
- this.changeMenu(this.$route.query.column_name, 0);
- } else if (this.$route.query.column_name == '技术问答') {
- this.changeMenu(this.$route.query.column_name, 1);
- } else if (this.$route.query.column_name == '行业研究') {
- this.changeMenu(this.$route.query.column_name, 2);
- } else if (this.$route.query.column_name == '教育培训') {
- this.changeMenu(this.$route.query.column_name, 3);
- }
- },
- async changeMenu(name, index) {
- this.menuIndex = index;
- this.menuColor = 'rgb(254, 149, 14)';
- this.menuName = name;
- console.log(name);
- this.initList({ name });
- },
- async initList({ name, skip = 0, limit = 10, ...info } = {}) {
- let res = [];
- console.log(name);
- if (name == '专题研讨') {
- this.pageSize = 5;
- res = await this.query({ skip, limit, column_name: '专题研讨', ...info });
- this.$set(this, `zhuantiList`, res.data);
- } else if (name == '技术问答') {
- res = await this.query({ skip, limit, column_name: '技术问答', ...info });
- this.$set(this, `jishuList`, res.data);
- } else if (name == '行业研究') {
- res = await this.query({ skip, limit, column_name: '行业研究', ...info });
- this.$set(this, `hangyeList`, res.data);
- } else if (name == '教育培训') {
- this.pageSize = 5;
- res = await this.query({ skip, limit, column_name: '教育培训', ...info });
- this.$set(this, `jiaoyuList`, res.data);
- }
- console.log(res);
- this.$set(this, `pageTotal`, res.total);
- },
- handleCurrentChange(val) {
- console.log(`当前页: ${val}`);
- console.log(this.menuName);
- const name = this.menuName;
- if (name == '专题研讨' || name == '教育培训') {
- this.limit = 5;
- }
- this.initList({ name: name, skip: (val - 1) * this.limit, limit: this.limit });
- },
- clickzhuanti(id) {
- this.$router.push({ path: '/live/detail', query: { id: id } });
- console.log(id);
- },
- clickjishu(id) {
- this.$router.push({ path: '/live/detail', query: { id: id } });
- console.log(id);
- },
- clickhangye(id) {
- this.$router.push({ path: '/live/detail', query: { id: id } });
- console.log(id);
- },
- clickjiaoyu(id) {
- this.$router.push({ path: '/live/detail', query: { id: id } });
- console.log(id);
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .main {
- width: 80%;
- margin: 0 auto;
- float: none;
- }
- .menu {
- float: left;
- height: 450px;
- width: 20%;
- background: no-repeat bottom right;
- background-image: url(../../assets/live/menu_back.jpg);
- margin: 30px 0;
- padding: 10px 0 0 10px;
- box-sizing: border-box;
- box-shadow: 0 0 10px #bbbaba;
- }
- .menu .el-image {
- width: 30px;
- display: inline-table;
- margin: 10px 5px;
- }
- .menu span {
- font-size: 24px;
- color: #92959a;
- font-weight: 600;
- margin-left: 3px;
- position: relative;
- top: 10px;
- }
- .menuList p {
- line-height: 60px;
- font-size: 18px;
- cursor: pointer;
- border-bottom: 1px solid #2d64b3;
- color: #044b79;
- font-weight: 600;
- }
- .info {
- width: 77%;
- float: right;
- margin: 30px 0 30px 2px;
- height: 585px;
- box-shadow: 0 0 10px #2d64b3;
- overflow: hidden;
- right: 0px;
- background: #ffffff;
- }
- .leftInfo {
- height: 500px;
- overflow: hidden;
- }
- .leftTop {
- font-size: 18px;
- width: 96%;
- height: 41px;
- line-height: 35px;
- border-bottom: 1px solid #e5e5e5;
- position: relative;
- bottom: 1px;
- margin: 10px;
- font-weight: 600;
- color: #22529a;
- }
- .infoLeftList {
- float: left;
- width: 95%;
- border-bottom: 1px dashed #ccc;
- padding: 10px 0 10px 10px;
- height: 87px;
- margin: 0 0 0 5px;
- }
- .infoLeftList:hover p:last-child span:first-child {
- -webkit-transform: translateY(-3px);
- -ms-transform: translateY(-3px);
- transform: translateY(-3px);
- -webkit-box-shadow: 0 0 6px #999;
- box-shadow: 0 0 6px #999;
- -webkit-transition: all 0.5s ease-out;
- transition: all 0.5s ease-out;
- color: #005293;
- cursor: pointer;
- }
- .infoLeftList p:first-child {
- float: left;
- width: 20%;
- font-size: 15px;
- background: #044b79;
- text-align: center;
- color: #fff;
- font-weight: bold;
- padding: 4px 0px;
- margin: 0 0 0 5px;
- }
- .infoLeftList p:last-child {
- float: right;
- width: 70%;
- padding: 0 0 0 10px;
- }
- .infoLeftList p:last-child span:first-child {
- float: left;
- width: 90%;
- font-size: 18px;
- }
- .infoLeftList p:last-child span:last-child {
- float: left;
- width: 90%;
- font-size: 16px;
- overflow: hidden;
- text-overflow: ellipsis;
- -webkit-line-clamp: 2;
- word-break: break-all;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- margin: 5px 0 0 0;
- color: #666;
- }
- .page {
- text-align: center;
- margin: 10px 0;
- }
- .infoRightList {
- float: left;
- width: 95%;
- padding: 7px 0;
- margin: 0 0 0 5px;
- }
- .infoRightList:nth-child(6) {
- border-bottom: 1px solid #ccc;
- padding: 0 0 17px 0;
- }
- .infoRightList:nth-child(7) {
- padding: 15px 0 0 0;
- }
- .infoRightList:nth-child(11) {
- border-bottom: 1px solid #ccc;
- padding: 0 0 15px 0;
- }
- .infoRightList:hover p span:first-child {
- -webkit-transform: translateY(-3px);
- -ms-transform: translateY(-3px);
- transform: translateY(-3px);
- -webkit-box-shadow: 0 0 6px #999;
- box-shadow: 0 0 6px #999;
- -webkit-transition: all 0.5s ease-out;
- transition: all 0.5s ease-out;
- color: #005293;
- cursor: pointer;
- }
- .infoRightList p {
- font-size: 18px;
- }
- .infoRightList p span:first-child {
- display: inline-block;
- width: 70%;
- margin: 0 20px 0 10px;
- }
- .infoRightList p span:last-child {
- display: inline-block;
- width: 21%;
- text-align: center;
- font-size: 16px;
- }
- </style>
|