xgwangman 4 năm trước cách đây
mục cha
commit
54a80d4ff3

+ 2 - 2
jydocs-pc/public/index.html

@@ -7,7 +7,7 @@
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <title>app1</title>
     <% if (process.env.NODE_ENV === 'development') { %>
-      <link href="https://web2-jytest.jianyu360.cn/css/bootstrap.min.css" rel="stylesheet">
+      <!-- <link href="https://web2-jytest.jianyu360.cn/css/bootstrap.min.css" rel="stylesheet">
       <link href="https://web2-jytest.jianyu360.cn/css/bootswatch.min.css" rel="stylesheet">
       <link href="https://web2-jytest.jianyu360.cn/css/font.css?v=6302" rel="stylesheet">
       <link href="https://web2-jytest.jianyu360.cn/css/jy.css?v=6302" rel="stylesheet">
@@ -24,7 +24,7 @@
       <link href='https://web2-jytest.jianyu360.cn/css/reset.css?v=6302' rel="stylesheet" type="text/css"/>
       <link href='https://web2-jytest.jianyu360.cn/pccss/reset_pc.css' rel="stylesheet" type="text/css"/>
       <link href='https://web2-jytest.jianyu360.cn/css/pc.css?v=6302' rel="stylesheet"/>
-      <link href='https://web2-jytest.jianyu360.cn/pccss/public-nav-1200.css?v=6302' rel="stylesheet" type="text/css"/>
+      <link href='https://web2-jytest.jianyu360.cn/pccss/public-nav-1200.css?v=6302' rel="stylesheet" type="text/css"/> -->
     <% } %>
   </head>
   <body>

+ 9 - 0
jydocs-pc/src/api/modules/detail.js

@@ -75,3 +75,12 @@ export function getShare (data) {
     data
   })
 }
+
+export function getRecommend (data) {
+  console.log(data)
+  return request({
+    url: '/detail/recommend',
+    method: 'post',
+    data
+  })
+}

+ 128 - 0
jydocs-pc/src/components/recommend.vue

@@ -0,0 +1,128 @@
+<template>
+  <div class="c-recommend">
+    <div class="r-bott">
+        <h3>相关推荐</h3>
+        <div class="docs" v-for="item in recomes" :key="item.docId">
+            <div class="imgs">
+                <img :src="item.previewImgId" alt="">
+                <i class="el-icon-jy-word"></i>
+            </div>
+            <div class="conts">
+                <h5>{{item.docName}}</h5>
+                <p>贡献者:{{item.price}}</p>
+                <div class="d-tip">
+                    <p>{{item.downTimes}}次下载</p>
+                    <el-divider direction="vertical"></el-divider>
+                    <p>共{{item.docPageSize}}页</p>
+                    <el-divider direction="vertical"></el-divider>
+                    <p>{{item.docFileSize}}</p>
+                </div>
+                <div class="r-coin">500剑鱼币</div>
+            </div>
+        </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { Divider } from 'element-ui'
+export default {
+  props: {
+    recomes: {}
+  },
+  components: {
+    [Divider.name]: Divider
+  },
+  data () {
+    return {
+      
+    }
+  },
+  methods: {
+    
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.c-recommend {
+  // display: flex;
+  // flex-direction: initial;
+  .r-bott {
+      min-height: 448px;
+      border-radius: 4px;
+      background: #fff;
+      margin-top: 16px;
+      padding: 15px 12px;
+      h3 {
+          color: #686868;
+          font-size: 16px;
+          line-height: 24px;
+          font-weight: 500;
+          margin-top: 0;
+          margin-bottom: 13px;
+      }
+      .docs {
+          display: flex;
+          height: 112px;
+          .imgs {
+              display: table;
+              position: relative;
+              border-radius: 4px;
+              border: 1px solid #ECECEC;
+              img {
+                  width: 78px;
+                  height: 112px;
+                  border: 0;
+              }
+              i {
+                  position: absolute;
+                  right: 0;
+                  bottom: 0;
+              }
+          }
+          .conts {
+              margin-left: 8px;
+              h5 {
+                  margin: 0;
+                  font-size: 14px;
+                  line-height: 24px;
+                  font-weight: 500;
+                  display: -webkit-box;
+                  -webkit-line-clamp:2;
+                  overflow: hidden;
+                  text-overflow: ellipsis;
+                  -webkit-box-orient: vertical;
+              }
+              p {
+                  margin: 0;
+                  color: #999999;
+                  font-size: 12px;
+                  line-height: 20px;
+              }
+              .d-tip {
+                  display: flex;
+                  flex-direction: initial;
+                  align-items: center;
+                  .el-divider--vertical {
+                      height: 0.8em;
+                      margin: 0 2px;
+                  }
+                  p {
+                      padding: 0 1px;
+                  }
+              }
+              .r-coin {
+                  color: #2CB7CA;
+                  font-size: 14px;
+                  line-height: 24px;
+                  margin-top: 2px;
+              }
+          }
+      }
+      .docs:not(:last-child) {
+        margin-bottom: 16px;
+      }
+  }
+}
+</style>

+ 23 - 3
jydocs-pc/src/views/Content.vue

@@ -37,7 +37,7 @@
                   </div>
               </div>
           </div>
-          <div class="middles">
+          <div class="middles" :class="{'actives':buyed == 0, 'actives1':lineShow == 1}">
               <h3>摘要</h3>
               <p>{{datas.docSummary}}</p>
               <div class="continue" v-show="buyed == 0">全文共{{datas.docPageSize}}页,<span @click="continued">继续阅读<i class="el-icon-arrow-down"></i></span></div>
@@ -79,14 +79,16 @@
                 <img :src="item.s_pic">
               </a>
           </div>
+          <v-recommend :recomes="recomes"></v-recommend>
       </div>
   </div>
 </template>
 
 <script>
 import { Button, Tooltip, Divider, Message } from 'element-ui'
-import { getDetails, getShow, getDown, getAdverse, getCoin, getAdd, getRemove } from '../api/modules/detail'
+import { getDetails, getShow, getRecommend, getDown, getAdverse, getCoin, getAdd, getRemove } from '../api/modules/detail'
 import { formatSize, dateFormatter } from '@/utils/'
+import vRecommend from '@/components/recommend'
 const pdfjsLib = require('pdfjs-dist/build/pdf.js')
 const pdfjsViewer = require('pdfjs-dist/web/pdf_viewer.js')
 export default {
@@ -94,7 +96,8 @@ export default {
     [Button.name]: Button,
     [Tooltip.name]: Tooltip,
     [Divider.name]: Divider,
-    [Message.name]: Message
+    [Message.name]: Message,
+    vRecommend
   },
   data () {
     return {
@@ -103,6 +106,7 @@ export default {
       datas: [],
       conts: [],
       adsUrl: [],
+      recomes: [],
       coinNum: 0,
       btnName: '',
       buyed: 0,
@@ -235,6 +239,14 @@ export default {
         }
       })
     },
+    recommend (str) {
+      getRecommend({ docTag: str, docId: this.docIds, num: 3 }).then(res => {
+        res.data.data.forEach(v => {
+          v.docFileSize = formatSize(v.docFileSize)
+          this.recomes.push(v)
+        });
+      })
+    },
     details () {
       getDetails({ docId: this.docIds, from: this.$route.query.from }).then(res => {
         if (res.data.error_code === 0) {
@@ -245,6 +257,7 @@ export default {
           this.datas.tags = this.datas.tags.split(',')
           this.buyed = res.data.data.status
           this.coined()
+          this.recommend(res.data.data.detail.tags)
           if (res.data.data.status === 1) {
             this.buyShow()
           }
@@ -468,6 +481,7 @@ export default {
           }
       }
       .middles {
+          height: 316px;
           padding: 24px 40px;
           background: #fff;
           border-radius: 4px;
@@ -498,6 +512,12 @@ export default {
               }
           }
       }
+      .actives {
+        height: 530px;
+      }
+      .actives1 {
+        height: 552px;
+      }
       .head-tip {
             width: 920px;
             height: 42px;

+ 2 - 2
jydocs-pc/vue.config.js

@@ -9,8 +9,8 @@ module.exports = {
     disableHostCheck: true,
     proxy: {
       '^/jydocs': {
-        target: 'http://web2-jytest.jydev.jianyu360.com',
-        // target: 'http://192.168.20.180:821',
+        // target: 'http://web2-jytest.jydev.jianyu360.com',
+        target: 'http://192.168.20.180:821',
         changeOrigin: true,
         logLevel: 'debug',
         pathRewrite: {