guhongwei 4 лет назад
Родитель
Сommit
dc435a4e42

+ 3 - 0
src/components/uploaddock.vue

@@ -95,6 +95,7 @@ export default {
     },
     defalutProcess(val) {
       if (_.isArray(val)) {
+        console.log('1');
         let newArr = val.map(item => {
           let object = {};
           object.name = item.name;
@@ -103,6 +104,7 @@ export default {
         });
         this.$set(this, `fileList`, newArr);
       } else if (_.isObject(val)) {
+        console.log('2');
         let object = {};
         if (_.get(val, `url`)) {
           object.name = val.name;
@@ -110,6 +112,7 @@ export default {
           this.$set(this, `fileList`, [object]);
         }
       } else if (typeof val === 'string') {
+        console.log('3');
         this.$set(this, `fileList`, [{ name: '附件', url: val }]);
       }
     },

+ 98 - 0
src/views/service/news/detail.vue

@@ -0,0 +1,98 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="detail">
+        <el-col :span="24" class="one">
+          <p>{{ info.title }}</p>
+          <p>
+            <span>信息来源:{{ info.orgin || '暂无' }}</span>
+            <span>发布时间:{{ info.publish_time || '暂无' }}</span>
+          </p>
+        </el-col>
+        <el-col :span="24" class="two" v-if="info.picture != null || undefined">
+          <el-image :src="info.picture"></el-image>
+        </el-col>
+        <el-col :span="24" class="three">
+          <p v-html="info.content"></p>
+        </el-col>
+        <el-col :span="24" class="four" v-if="info.filepath">
+          <h4>附件:</h4>
+          <el-link :href="info.filepath" :underline="false">{{ info.filepathname || '附件下载' }}</el-link>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'detail',
+  props: {
+    info: { type: Object },
+  },
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped>
+.detail {
+  .one {
+    border-bottom: 1px dashed #ccc;
+    margin: 0 0 15px 0;
+    p:nth-child(1) {
+      font-size: 20px;
+      font-weight: bold;
+      color: #044b79;
+      padding: 25px 0;
+      text-align: center;
+    }
+    p:nth-child(2) {
+      padding: 0 0 20px 0;
+      span {
+        display: inline-block;
+        width: 46%;
+        font-size: 16px;
+        color: #666;
+        padding: 0 15px;
+      }
+      span:nth-child(1) {
+        text-align: right;
+      }
+    }
+  }
+  .two {
+    text-align: center;
+    margin: 0 0 15px 0;
+    .el-image {
+      width: 60%;
+    }
+  }
+  .three {
+    margin: 0 0 15px 0;
+    // /deep/p {
+    //   img {
+    //     padding: 10px 140px !important;
+    //   }
+    // }
+  }
+  .four {
+    h4 {
+      color: #400eff;
+      font-weight: bold;
+    }
+    .el-link {
+      padding: 10px 0 0 10px;
+    }
+  }
+}
+</style>

+ 3 - 3
src/views/service/list/index.vue

@@ -13,7 +13,7 @@
           </el-col>
         </el-col>
         <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
-          <el-col :span="20" class="name textOver" @click.native="clickDetail(item.id)">
+          <el-col :span="20" class="name textOver" @click.native="clickDetail(item)">
             {{ item.title }}
           </el-col>
           <el-col :span="4" class="date">
@@ -63,8 +63,8 @@ export default {
       this.searchPage(currentPage);
     },
     // 详情
-    clickDetail(id) {
-      this.$emit('clickDetail', { column_name: '科技需求', id: id });
+    clickDetail(data) {
+      this.$emit('clickDetail', { column_id: data.column_id, id: data.id });
     },
     // 查询
     searchData() {

+ 47 - 14
src/views/service/newslist.vue

@@ -14,30 +14,50 @@
             <el-col :span="18" class="listInfo">
               <span v-if="display == 'list'">
                 <span v-if="menuIndex == 'kjzx'">
-                  <listindex :newsList="kjzxList" :total="kjzxtotal" :column_name="column_name"></listindex>
+                  <listindex :newsList="kjzxList" :total="kjzxtotal" :column_name="column_name" @clickDetail="clickDetail"></listindex>
                 </span>
                 <span v-else-if="menuIndex == 'gzdt'">
-                  <listindex :newsList="gzdtList" :total="gzdttotal" :column_name="column_name"></listindex>
+                  <listindex :newsList="gzdtList" :total="gzdttotal" :column_name="column_name" @clickDetail="clickDetail"></listindex>
                 </span>
                 <span v-else-if="menuIndex == 'tztg'">
-                  <listindex :newsList="tztgList" :total="tztgtotal" :column_name="column_name"></listindex>
+                  <listindex :newsList="tztgList" :total="tztgtotal" :column_name="column_name" @clickDetail="clickDetail"></listindex>
                 </span>
                 <span v-else-if="menuIndex == 'jsqy'">
-                  <listindex :newsList="jsqyList" :total="jsqytotal" :column_name="column_name"></listindex>
+                  <listindex :newsList="jsqyList" :total="jsqytotal" :column_name="column_name" @clickDetail="clickDetail"></listindex>
                 </span>
               </span>
               <span v-else>
                 <span v-if="menuIndex == 'kjzx'">
-                  科技咨讯详情
+                  <el-col :span="24" style="text-align:right;">
+                    <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
+                  </el-col>
+                  <el-col :span="24">
+                    <detailinfo :info="info"></detailinfo>
+                  </el-col>
                 </span>
                 <span v-else-if="menuIndex == 'gzdt'">
-                  工作动态详情
+                  <el-col :span="24" style="text-align:right;">
+                    <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
+                  </el-col>
+                  <el-col :span="24">
+                    <detailinfo :info="info"></detailinfo>
+                  </el-col>
                 </span>
                 <span v-else-if="menuIndex == 'tztg'">
-                  通知通告详情
+                  <el-col :span="24" style="text-align:right;">
+                    <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
+                  </el-col>
+                  <el-col :span="24">
+                    <detailinfo :info="info"></detailinfo>
+                  </el-col>
                 </span>
                 <span v-else-if="menuIndex == 'jsqy'">
-                  技术前沿详情
+                  <el-col :span="24" style="text-align:right;">
+                    <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
+                  </el-col>
+                  <el-col :span="24">
+                    <detailinfo :info="info"></detailinfo>
+                  </el-col>
                 </span>
               </span>
             </el-col>
@@ -49,7 +69,8 @@
 </template>
 
 <script>
-import listindex from './list/index.vue';
+import listindex from './news/index.vue';
+import detailinfo from './news/detail.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: journcolumn } = createNamespacedHelpers('journcolumn');
 const { mapActions: journnews } = createNamespacedHelpers('journnews');
@@ -61,6 +82,7 @@ export default {
   props: {},
   components: {
     listindex,
+    detailinfo,
   },
   data: function() {
     return {
@@ -79,7 +101,10 @@ export default {
       tztgtotal: 0,
       jsqyList: [],
       jsqytotal: 0,
+      // 栏目名称
       column_name: '',
+      // 详情
+      info: {},
     };
   },
   async created() {
@@ -87,7 +112,7 @@ export default {
   },
   methods: {
     ...journcolumn({ journcolumnQuery: 'query' }),
-    ...journnews(['query', 'create', 'update', 'delete']),
+    ...journnews(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询栏目
     async searchcol() {
       let res = await this.journcolumnQuery();
@@ -100,7 +125,7 @@ export default {
           if (this.id) {
             // 查询详情
             this.display = 'detail';
-            this.searchDetail(column.title, this.id);
+            this.searchDetail(this.id);
           } else {
             // 查询列表
             this.display = 'list';
@@ -129,8 +154,16 @@ export default {
       }
     },
     // 查询详情
-    searchDetail() {
-      console.log('查询详情');
+    async searchDetail(id) {
+      let res = await this.fetch(id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `info`, res.data);
+      }
+    },
+    // 点击查看详情
+    clickDetail({ id }) {
+      this.display = 'detail';
+      this.searchDetail(id);
     },
   },
   computed: {
@@ -186,7 +219,7 @@ export default {
   .listInfo {
     float: right;
     width: 78%;
-    height: 685px;
+    min-height: 685px;
     overflow: hidden;
     box-shadow: 0 0 10px #2d64b3;
     padding: 10px;

+ 4 - 0
src/views/superAdminCenter/Journ/parts/news.vue

@@ -200,7 +200,11 @@ export default {
     },
     // 图片
     uploadSuccess({ type, data }) {
+      console.log(type, data.name);
       this.$set(this.form, `${type}`, data.uri);
+      if (type == 'filepath') {
+        this.$set(this.form, `filepathname`, data.name);
+      }
     },
     // 删除图片
     uploadDelete(index) {