wuhongyu 5 роки тому
батько
коміт
5489b2d88e

+ 3 - 5
src/views/communication/list.vue

@@ -52,13 +52,13 @@
                   <topicDetail :newsid="newsid" :details="details"></topicDetail>
                 </span>
                 <span v-else-if="columnName == '技术问答'">
-                  <technologyDetail :details="details"></technologyDetail>
+                  <technologyDetail :details="details" :newsid="newsid"></technologyDetail>
                 </span>
                 <span v-else-if="columnName == '行业研究'">
-                  <industryDetail :details="details"></industryDetail>
+                  <technologyDetail :details="details" :newsid="newsid"></technologyDetail>
                 </span>
                 <span v-else-if="columnName == '科技培训'">
-                  <scienceDetail :details="details"></scienceDetail>
+                  <scienceDetail :details="details" :newsid="newsid"></scienceDetail>
                 </span>
               </span>
             </el-col>
@@ -81,7 +81,6 @@ import foot from '@/layout/common/foot.vue';
 import technologyList from './parts/technologyList.vue';
 import technologyDetail from './parts/technologyDetail.vue';
 import industryList from './parts/industryList.vue';
-import industryDetail from './parts/industryDetail.vue';
 import topicList from './parts/topicList.vue';
 import topicDetail from './parts/topicDetail.vue';
 import scienceList from './parts/scienceList.vue';
@@ -100,7 +99,6 @@ export default {
     technologyDetail,
     technologyList,
     industryList,
-    industryDetail,
     scienceList,
     scienceDetail,
   },

+ 3 - 3
src/views/communication/parts/right.vue

@@ -100,14 +100,14 @@ export default {
       if (item.url) {
         window.open(item.url);
       } else {
-        this.$router.push({ path: '/communication/list', query: { col_name: '技术问答', id: item.id, display: '1' } });
+        this.$router.push({ path: '/communication/list', query: { col_name: '技术问答', newsid: item.id, display: '1' } });
       }
     },
     hangye(item) {
       if (item.url) {
         window.open(item.url);
       } else {
-        this.$router.push({ path: '/communication/list', query: { col_name: '行业研究', id: item.id, display: '1' } });
+        this.$router.push({ path: '/communication/list', query: { col_name: '行业研究', newsid: item.id, display: '1' } });
       }
     },
 
@@ -115,7 +115,7 @@ export default {
       if (item.url) {
         window.open(item.url);
       } else {
-        this.$router.push({ path: '/communication/list', query: { col_name: '科技培训', id: item.id, display: '1' } });
+        this.$router.push({ path: '/communication/list', query: { col_name: '科技培训', newsid: item.id, display: '1' } });
       }
     },
   },

+ 20 - 16
src/views/communication/parts/scienceDetail.vue

@@ -7,14 +7,14 @@
             <span>{{ detailinfo.title }}</span>
           </div>
           <div class="detailtopleft">
-            <span>时间:{{ detailinfo.publish_time }}&nbsp;&nbsp;&nbsp;&nbsp;来源:{{ detailinfo.orgin }}</span>
+            <span>时间:{{ detailinfo.publish_time }}&nbsp;&nbsp;&nbsp;&nbsp;来源:{{ detailinfo.publish_time }}</span>
           </div>
-          <div class="detailimage" v-if="detailinfo.picture">
-            <img :src="detailinfo.picture" class="detailimg" />
+          <div class="detailimage" v-if="detailinfo.img_url">
+            <img :src="detailinfo.img_url" class="detailimg" />
           </div>
-          <div class="detailVideo">
-            <video :src="detailinfo.filepath" controls="controls">
-              您的浏览器不支持 video 标签。
+          <div class="detailVideo" v-if="detailinfo.file_url">
+            <video :src="detailinfo.file_url" controls="controls">
+              <!-- 您的浏览器不支持 video 标签。 -->
             </video>
           </div>
           <div class="detailcontext">
@@ -28,11 +28,11 @@
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
-// const { mapActions: news } = createNamespacedHelpers('news');
+const { mapActions: news } = createNamespacedHelpers('news');
 export default {
   name: 'eduDetail',
   props: {
-    // newsid: null,
+    newsid: null,
   },
   components: {},
   data: () => {
@@ -47,19 +47,23 @@ export default {
     };
   },
   created() {
-    // this.search();
+    this.search();
   },
   methods: {
-    // ...news(['fetch']),
-    // async search() {
-    //   console.log(this.newsid);
-    //   const res = await this.fetch(this.newsid);
-    //   this.$set(this, `detailinfo`, res.data);
-    // },
+    ...news(['fetch']),
+    async search() {
+      if (this.id) {
+        const res = await this.fetch(this.id);
+        this.$set(this, `detailinfo`, res.data);
+      } else {
+        const res = await this.fetch(this.newsid);
+        this.$set(this, `detailinfo`, res.data);
+      }
+    },
   },
   computed: {
     id() {
-      return this.$route.query.id;
+      return this.$route.query.newsid;
     },
     ...mapState(['user']),
     pageTitle() {

+ 22 - 14
src/views/communication/parts/technologyDetail.vue

@@ -7,16 +7,16 @@
             <span>{{ detailinfo.title }}</span>
           </div>
           <div class="detailtopleft">
-            <span>时间:{{ detailinfo.publish_time }}&nbsp;&nbsp;&nbsp;&nbsp;来源:{{ detailinfo.orgin }}</span>
+            <span>时间:{{ detailinfo.publish_time }}&nbsp;&nbsp;&nbsp;&nbsp;来源:{{ detailinfo.publish_unit }}</span>
           </div>
 
-          <div class="detailimage" v-if="detailinfo.picture">
-            <img :src="detailinfo.picture" class="detailimg" />
+          <div class="detailimage" v-if="detailinfo.img_url">
+            <img :src="detailinfo.img_url" class="detailimg" />
           </div>
           <div class="detailcontext">
             <p v-html="detailinfo.content"></p>
           </div>
-          <div class="development" v-if="detailinfo.column_name == '专家问诊'">
+          <div class="development" v-if="detailinfo.col_name == '技术问答'">
             <p>功能开发中</p>
             <p>功能实现流程:<span>问诊记录展示</span>-<span>在线咨询</span>-<span>专家在线问诊</span></p>
           </div>
@@ -28,10 +28,12 @@
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
-// const { mapActions: news } = createNamespacedHelpers('news');
+const { mapActions: news } = createNamespacedHelpers('news');
 export default {
   name: 'detail',
-  props: {},
+  props: {
+    newsid: null,
+  },
   components: {},
   data: () => {
     return {
@@ -51,19 +53,25 @@ export default {
     };
   },
   created() {
-    // this.search();
+    this.search();
   },
   methods: {
-    // ...news(['fetch']),
-    // async search() {
-    //   const res = await this.fetch(this.newsid);
-    //   this.$set(this, `detailinfo`, res.data);
-    //   console.log(res.data);
-    // },
+    ...news(['fetch']),
+    async search() {
+      if (this.id) {
+        const res = await this.fetch(this.id);
+        this.$set(this, `detailinfo`, res.data);
+        console.log(res.data);
+      } else {
+        const res = await this.fetch(this.newsid);
+        this.$set(this, `detailinfo`, res.data);
+        console.log(res.data);
+      }
+    },
   },
   computed: {
     id() {
-      return this.$route.query.id;
+      return this.$route.query.newsid;
     },
     ...mapState(['user']),
     pageTitle() {

+ 19 - 9
src/views/communication/parts/topicDetail.vue

@@ -52,7 +52,7 @@
                 <el-col :span="21" class="right">
                   <el-col :span="24" class="date">
                     <i class="el-icon-user icon"></i>
-                    <span>评论发布于{{ publish_time }}</span>
+                    <span>评论发布于{{ item.meta | getDate }}</span>
                     <span>{{ index + 2 }}楼</span>
                   </el-col>
                   <el-col :span="24" class="info">
@@ -138,7 +138,7 @@ export default {
       }
     },
     async search({ skip = 0, limit = this.limit, newsid = this.newsid } = { skip: 0, limit: this.limit }) {
-      let res = await this.commentquery({ skip, limit, newsid });
+      let res = await this.commentquery({ skip, limit, newsid, status: 1 });
       console.log(res);
       this.$set(this, `list`, res.data);
       this.$set(this, `total`, res.total);
@@ -148,13 +148,23 @@ export default {
         this.$message.error('游客身份无法评论,请先登录');
         return;
       } else {
-        this.form.newsid = this.newsid;
-        this.form.uid = this.user.uid;
-        let data = this.form;
-        let res = await this.commentCreate(data);
-        console.log(res);
-        this.$checkRes(res, '评论成功', '评论失败');
-        this.search();
+        if (this.id) {
+          this.form.newsid = this.id;
+          this.form.uid = this.user.uid;
+          let data = this.form;
+          let res = await this.commentCreate(data);
+          console.log(res);
+          this.$checkRes(res, '评论成功', '评论失败');
+          this.search();
+        } else {
+          this.form.newsid = this.newsid;
+          this.form.uid = this.user.uid;
+          let data = this.form;
+          let res = await this.commentCreate(data);
+          console.log(res);
+          this.$checkRes(res, '评论成功', '评论失败');
+          this.search();
+        }
       }
     },
   },