lrf402788946 4 年之前
父节点
当前提交
cd7b734da0

+ 3 - 6
src/plugins/check-res.js

@@ -4,9 +4,7 @@
 /* eslint-disable no-shadow */
 import Vue from 'vue';
 import _ from 'lodash';
-import { Message } from 'element-ui';
-import { Notify } from 'vant';
-
+import { Toast } from 'vant';
 const vm = new Vue({});
 const Plugin = {
   install(Vue, options) {
@@ -23,15 +21,14 @@ const Plugin = {
           return _okText();
         }
         if (_okText) {
-          Notify({ type: 'success', message: _okText });
+          Toast({ type: 'success', message: _okText });
         }
         return true;
       }
       if (_.isFunction(_errText)) {
         return _errText();
       }
-      Notify({ type: 'danger', message: errText });
-      // Message({ message: _errText || errmsg, duration: 60000 });
+      Toast({ type: 'danger', message: errText });
       return false;
     };
   },

+ 2 - 2
src/views/adminCenter/adminCommunity.vue

@@ -9,12 +9,12 @@
             </template>
           </van-nav-bar>
         </el-col>
-        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }" ref="list">
+        <el-col :span="24" class="info">
           <template v-for="(i, index) in list">
             <item :key="`list${index}`" :data="i"></item>
           </template>
           <van-sticky container="list" :offset-top="clientHeight">
-            <page :total="total" :limit="limit"></page>
+            <page :total="total" :limit="limit" @search="search"></page>
           </van-sticky>
         </el-col>
         <el-col :span="24" class="foot">

+ 1 - 1
src/views/adminCenter/adminRefute.vue

@@ -14,7 +14,7 @@
             <item :key="`list${index}`" :data="i"></item>
           </template>
           <van-sticky container="list" :offset-top="clientHeight">
-            <page :total="total" :limit="limit"></page>
+            <page :total="total" :limit="limit" @search="search"></page>
           </van-sticky>
         </el-col>
         <el-col :span="24" class="foot">

+ 18 - 23
src/views/adminCenter/adminServe.vue

@@ -10,12 +10,20 @@
           </van-nav-bar>
         </el-col>
         <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }" ref="list">
-          <!-- <template v-for="(i, index) in list">
-            <item :key="`list${index}`" :data="i"></item>
-          </template> -->
-          <van-sticky container="list" :offset-top="clientHeight">
-            <page :total="total" :limit="limit"></page>
-          </van-sticky>
+          <van-tabs v-model="active">
+            <van-tab title="文字">
+              <list type="0"></list>
+            </van-tab>
+            <van-tab title="图片">
+              <list type="1"></list>
+            </van-tab>
+            <van-tab title="科普视频">
+              <list type="2"></list>
+            </van-tab>
+            <van-tab title="培训视频">
+              <list type="3"></list>
+            </van-tab>
+          </van-tabs>
         </el-col>
         <el-col :span="24" class="foot">
           <foot></foot>
@@ -26,41 +34,28 @@
 </template>
 
 <script>
+import list from './serve/list.vue';
 import foot from '@/layout/common/foot.vue';
-import page from '@/layout/common/page.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions: service } = createNamespacedHelpers('service');
 export default {
   name: 'adminServe',
   props: {},
   components: {
-    page,
     foot,
+    list,
   },
   data: function() {
     return {
       clientHeight: '',
-      list: [],
-      total: 0,
-      limit: '5',
+      active: 0,
     };
   },
-  created() {
-    this.search();
-  },
+  created() {},
   mounted() {
     let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 90;
     this.$set(this, `clientHeight`, clientHeight);
   },
   methods: {
-    ...service(['query']),
-    async search({ skip = 0 } = {}) {
-      const res = await this.query({ skip, limit: this.limit });
-      if (this.$checkRes(res)) {
-        this.$set(this, `list`, res.data);
-        this.$set(this, `total`, res.total);
-      }
-    },
     toAdd() {
       this.$router.push('/adminServe/edit');
     },

+ 280 - 0
src/views/adminCenter/serve/list.vue

@@ -0,0 +1,280 @@
+<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 + 50">
+          <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>