123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <template>
- <div id="">
- <van-tabs
- @click="onClickTab"
- color="#333"
- title-active-color="#fff"
- animated
- >
- <van-tab
- v-for="(item, index) in tab"
- :key="index"
- :title="item.label"
- :name="item.name"
- >
- <van-empty
- description="暂无数据"
- v-if="notList[item.name].length == 0"
- />
- <el-main v-else v-loading="loading" class="notList_box">
- <div
- class="notList_style"
- v-for="(items, indexs) in notList[item.name]"
- :key="indexs"
- @click="jumpInfo(items)"
- >
- <i></i>
- <div class="title">{{ items.Title }}</div>
- <span class="time">{{
- $methods.onlyFormaHao(items.NewsCreateTime, false)
- }}</span>
- </div>
- <div style="text-align: center" v-if="notList[item.name].length > 0">
- <el-pagination
- :pager-count="3"
- class="paginations"
- @current-change="handleCurrentChange($event, item.name)"
- :current-page.sync="formData1.pageindex"
- :page-size="formData1.pagesize"
- layout="total, prev, pager, next"
- :total="total"
- >
- </el-pagination>
- </div>
- </el-main>
- </van-tab>
- </van-tabs>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- loading: false,
- activeTab: "",
- tab: [
- { label: "最新动态", name: "d0" },
- { label: "政策要闻", name: "d1" },
- { label: "通知公告", name: "d2" },
- { label: "协会动态", name: "d3" },
- // { label: "行业报告", name: "d4" },
- ],
- notList: {
- d0: [],
- d1: [],
- d2: [],
- d3: [],
- d4: [],
- },
- total: 0,
- formData1: {
- pagesize: 10, //每页内容条数
- pageindex: 1, //当前第几页
- },
- };
- },
- created() {
- this.onClickTab("d0");
- },
- methods: {
- //通知列表
- getList(name) {
- return new Promise((resolve, reject) => {
- var data = {
- ...this.formData1,
- };
- if (name == "d0") {
- this.$api
- .XfWebApiGetNewsReList(data)
- .then((res) => {
- this.notList[name] = res.Data.List || [];
- this.total = res.Data.TotalCount;
- })
- .finally(() => {
- this.loading = false;
- resolve();
- });
- } else {
- switch (name) {
- case "d1":
- data.seat = 1;
- break;
- case "d2":
- data.seat = 2;
- break;
- case "d3":
- data.seat = 3;
- break;
- case "d4":
- data.seat = 4;
- break;
- default:
- break;
- }
- this.loading = true;
- this.$api
- .XfWebApiGetNewPositionList(data)
- .then((res) => {
- this.notList[name] = res.Data.List || [];
- this.total = res.Data.TotalCount;
- })
- .finally(() => {
- this.loading = false;
- resolve();
- });
- }
- });
- },
- //Tab切换
- async onClickTab(name, title) {
- if (name == this.activeTab) return;
- this.formData1 = {
- pagesize: 10, //每页内容条数
- pageindex: 1, //当前第几页
- };
- await this.getList(name);
- this.activeTab = name;
- },
- handleCurrentChange(e, name) {
- this.formData1.pageindex = e;
- this.getList(name);
- },
- //跳转详情页
- jumpInfo(e) {
- this.$router.push({
- path: "info",
- query: {
- MenuId: e.MenuId,
- NewsId: e.NewsId,
- },
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .van-tabs__nav--line {
- border-bottom: 2px solid #1890ff !important;
- padding-bottom: 0px;
- box-sizing: border-box;
- }
- ::v-deep .van-tab--active {
- background-color: #1890ff;
- }
- ::v-deep .van-tabs__line {
- display: none;
- }
- .notList_box {
- padding: 48px 30px;
- .notList_style {
- display: flex;
- align-items: center;
- margin-bottom: 50px;
- &:first-child{
- margin-top: 10px;
- }
- & > i {
- width: 10px;
- height: 10px;
- background-color: rgb(158, 156, 156);
- border-radius: 50%;
- margin-right: 14px;
- flex-shrink: 0;
- }
- & > .title {
- flex: 1;
- word-break: break-all;
- text-overflow: ellipsis;
- overflow: hidden;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- color: #222;
- font-weight: 500;
- font-size: 28px;
- margin-right: 20px;
- }
- & > .time {
- color: #636b75;
- font-size: 24px;
- flex-shrink: 0;
- }
- }
- }
- </style>
|