123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- <template>
- <div id="list">
- <el-row>
- <el-col :span="24" class="main" :style="{ height: clientHeight + 'px' }">
- <el-col :span="24" class="one" v-if="type == '0'">
- <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="detailBtn(item)">
- <el-col :span="24" class="title">
- {{ item.title }}
- </el-col>
- <el-col :span="24" class="other">
- <el-col :span="24" class="origin">
- 信息来源:<span>{{ item.origin || '系统管理员' }}</span>
- </el-col>
- <el-col :span="24" class="date">
- <el-col :span="20" class="left">
- 更新时间:<span>{{ item.create_time || item.renew_time || '暂无时间' }}</span>
- </el-col>
- <el-col :span="4" class="right"> <i class="el-icon-view"></i>{{ item.read >= 10000 ? '1万+' : item.read }} </el-col>
- </el-col>
- </el-col>
- </el-col>
- </el-col>
- <el-col :span="24" class="two" v-else-if="type == '1'">
- <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="detailBtn(item)">
- <el-col :span="17" class="title">
- <el-col :span="24" class="text">
- {{ item.title }}
- </el-col>
- <el-col :span="24" class="other">
- <el-col :span="20" class="left">
- {{ item.origin || '系统管理员' }}
- </el-col>
- <el-col :span="4" class="right"> <i class="el-icon-view"></i>{{ item.read >= 10000 ? '1万+' : item.read }} </el-col>
- </el-col>
- </el-col>
- <el-col :span="7" class="image">
- <el-image :src="item.imgUrl[0].url">
- <div slot="error" class="image-slot">
- <img :src="noImg" alt="" />
- </div>
- </el-image>
- </el-col>
- </el-col>
- </el-col>
- <el-col :span="24" class="thr" v-else-if="type == '2'">
- <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="detailBtn(item)">
- <el-col :span="24" class="title">
- {{ item.title }}
- </el-col>
- <el-col :span="24" class="video">
- <video
- controls="controls"
- preload="meta"
- x-webkit-airplay="true"
- webkit-playsinline="true"
- playsinline="true"
- x5-video-player-type="h5"
- x5-video-player-fullscreen="true"
- controlsList="nodownload"
- :src="item.fileUrl[0].url"
- loop="loop"
- >
- <source src="movie.ogg" type="video/ogg" />
- <source src="movie.mp4" type="video/mp4" />
- </video>
- </el-col>
- <el-col :span="24" class="other">
- <el-col :span="20" class="left">{{ item.origin || '系统管理员' }}{{ item.create_time || item.renew_time || '暂无时间' }}</el-col>
- <el-col :span="4" class="right"><i class="el-icon-view"></i>{{ item.read >= 10000 ? '1万+' : item.read }}</el-col>
- </el-col>
- </el-col>
- </el-col>
- <el-col :span="24" class="thr" v-else-if="type == '3'">
- <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="detailBtn(item)">
- <el-col :span="24" class="title">
- {{ item.title }}
- </el-col>
- <el-col :span="24" class="video">
- <video
- controls="controls"
- preload="meta"
- x-webkit-airplay="true"
- webkit-playsinline="true"
- playsinline="true"
- x5-video-player-type="h5"
- x5-video-player-fullscreen="true"
- controlsList="nodownload"
- :src="item.fileUrl[0].url"
- loop="loop"
- >
- <source src="movie.ogg" type="video/ogg" />
- <source src="movie.mp4" type="video/mp4" />
- </video>
- </el-col>
- <el-col :span="24" class="other">
- <el-col :span="20" class="left">{{ item.origin || '系统管理员' }}{{ item.create_time || item.renew_time || '暂无时间' }}</el-col>
- <el-col :span="4" class="right"><i class="el-icon-view"></i>{{ item.read >= 10000 ? '1万+' : item.read }}</el-col>
- </el-col>
- </el-col>
- </el-col>
- <van-sticky container="list" :offset-top="clientHeight + 60">
- <page :total="total" :limit="limit" @search="search"></page>
- </van-sticky>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import page from '@/layout/common/page.vue';
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: service } = createNamespacedHelpers('service');
- export default {
- name: 'list',
- props: {
- type: { type: String, default: '0' },
- },
- components: { page },
- data: function() {
- return {
- noImg: require('@a/noImg.jpg'),
- clientHeight: '',
- list: [],
- total: 0,
- limit: '5',
- };
- },
- created() {
- this.search();
- },
- mounted() {
- let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 150;
- this.$set(this, `clientHeight`, clientHeight);
- },
- methods: {
- ...service(['query']),
- async search({ skip = 0 } = {}) {
- const res = await this.query({ skip, limit: this.limit, type: this.type });
- if (this.$checkRes(res)) {
- this.$set(this, `list`, res.data);
- this.$set(this, `total`, res.total);
- }
- },
- detailBtn(data) {
- this.$router.push({ path: '/adminServe/edit', query: { id: data.id } });
- },
- },
- computed: {
- ...mapState(['user', 'menuParams']),
- pageTitle() {
- return `${this.$route.meta.title}`;
- },
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- };
- </script>
- <style lang="less" scoped>
- .main {
- margin: 10px 0 0 0;
- padding: 0 5px;
- .one {
- .list {
- background-color: #fff;
- margin: 0 0 10px 0;
- padding: 8px;
- border-radius: 5px;
- .title {
- font-size: 16px;
- overflow: hidden;
- text-overflow: ellipsis;
- -webkit-line-clamp: 2;
- word-break: break-all;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- margin: 0 0 4px 0;
- }
- .other {
- .origin {
- font-size: 14px;
- color: #666;
- margin: 0 0 5px 0;
- span {
- color: #000;
- }
- }
- .date {
- font-size: 14px;
- color: #666;
- margin: 0 0 5px 0;
- span {
- color: #000;
- }
- .right {
- text-align: right;
- color: #000;
- }
- }
- }
- }
- }
- .two {
- .list {
- background-color: #fff;
- margin: 0 0 10px 0;
- padding: 8px;
- border-radius: 5px;
- position: relative;
- .title {
- padding: 0 5px 0 0;
- .text {
- font-size: 16px;
- overflow: hidden;
- text-overflow: ellipsis;
- -webkit-line-clamp: 2;
- word-break: break-all;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- margin: 0 0 4px 0;
- padding: 0 5px 0 0;
- }
- .other {
- font-size: 14px;
- color: #666;
- position: relative;
- top: 25px;
- .right {
- text-align: right;
- height: 20px;
- line-height: 25px;
- }
- }
- }
- .image {
- .el-image {
- float: right;
- width: 100%;
- height: 100%;
- border-radius: 5px;
- }
- /deep/.image-slot img {
- width: 100%;
- height: 100%;
- vertical-align: top;
- }
- }
- }
- }
- .thr {
- .list {
- background-color: #fff;
- margin: 0 0 10px 0;
- padding: 8px;
- border-radius: 5px;
- .title {
- font-size: 15px;
- margin: 0 0 5px 0;
- }
- .video {
- margin: 0 0 5px 0;
- border: 1px solid #f1f1f1;
- video {
- float: left;
- width: 100%;
- height: 100%;
- }
- }
- .other {
- font-size: 14px;
- color: #666;
- .right {
- text-align: right;
- }
- }
- }
- }
- }
- </style>
|