Эх сурвалжийг харах

Merge branch 'master' of http://192.168.3.207:10080/jianyu/jy-docs

zhangyuhan 4 жил өмнө
parent
commit
8daf4de04d

+ 9 - 36
README.md

@@ -40,11 +40,6 @@ PC端 /opt/nginx/nginx/html/page_docs/
 │       ├── _mixin.scss
 │       └── _variables.scss
 ├── components
-│   ├── CardItem.vue        # 卡片型文件缩略展示
-│   ├── HelloWorld.vue
-│   ├── List.vue            # 列表展示
-│   ├── ListItem.vue        # 列表型文件缩略展示
-│   └── Search.vue          # 顶部搜索框
 ├── main.js
 ├── router.js
 ├── set-public-path.js
@@ -52,8 +47,6 @@ PC端 /opt/nginx/nginx/html/page_docs/
     ├── 404.vue
     ├── Content.vue         # 内容页
     ├── Home.vue            # 首页
-    ├── Keep.vue            # 收藏
-    ├── Mine.vue            # 我的
     └── Search.vue          # 搜索结果列表页
 
 ```
@@ -75,46 +68,26 @@ PC端 /opt/nginx/nginx/html/page_docs/
 3. 访问`/swordfish/frontPage/docs/sess/index`
 
 ##### 部署
-```
-# 剑鱼文库 前端配置
-location ^~/page_docs_app {
-    if ($uri ~ \.html$) {
-		add_header         Pragma   no-cache;
-        add_header         Expires  0;
-        add_header         Cache-Control no-cache,no-store,must-revalidate;
-    }
-    root /opt/nginx/nginx/html/;
-    index index.html;
-    try_files $uri $uri/ /page_docs_app/index.html;
-}
 
-location ^~/page_docs {
-    if ($uri ~ \.html$) {
-		add_header         Pragma   no-cache;
-        add_header         Expires  0;
-        add_header         Cache-Control no-cache,no-store,must-revalidate;
-    }
-    root /opt/nginx/nginx/html/;
-    index index.html;
-    try_files $uri $uri/ /page_docs/index.html;
-}
-```
+###### 剑鱼文库 前端配置
 
-```
+```nginx
+# 如果nginx配置文件中有这段代码,则 不需要 再次配置
 # 静态资源配置
 # 1. 禁止html缓存
-location ~ ^\/(.*).html {
+location ~ ^\/page_(.*)\.html {
     add_header         Pragma   no-cache;
     add_header         Expires  0;
     add_header         Cache-Control no-cache,no-store,must-revalidate;
-    
+
     root html;
+    # root /opt/nginx/nginx/html/;
 }
-# 2. 静态资源配置(vue程序刷新404问题)
+
+# 2.静态资源配置(vue程序刷新404问题)
 location ~ ^\/page_(.*?)\/ {
     root html;
     index index.html;
     try_files $uri $uri/ /page_$1/index.html;
 }
-```
-
+```

+ 2 - 2
jydocs-back/config.json

@@ -35,11 +35,11 @@
   },
   "indexSearchTag": [
     "全部",
-    "招标",
+    "招标文件",
     "法律法规",
     "行业报告",
     "测试"
   ],
   "searchNumLimit": 200,
-  "shareUrl": "https://web-jydev-wky.jianyu360.cn/swordfish/SingleLogin"
+  "shareUrl": "https://web-wky.jydev.jianyu360.com/swordfish/SingleLogin"
 }

+ 1 - 1
jydocs-back/public/db.go

@@ -93,7 +93,7 @@ func init() {
 
 //分享打开文库赚积分
 func OpenShareJydoc(fromId, openId, docId string) {
-	fromId = encrypt.SE.DecodeString(fromId)
+	fromId = encrypt.SE.DecodeStringByCheck(fromId)
 	if fromId == "" || openId == fromId || openId == "" || docId == "" {
 		return
 	}

+ 1 - 1
jydocs-mobile/public/index.html

@@ -32,7 +32,7 @@
 <div id="app"></div>
 <!-- built files will be auto injected -->
 <% if (process.env.NODE_ENV === 'production') { %>
-  <script src="/page_partner/js/commonForVue.js?v=<%= htmlWebpackPlugin.options.version %>"></script>
+  <script src="/page_entniche/js/commonForVue.js?v=<%= htmlWebpackPlugin.options.version %>"></script>
 <% } else if (process.env.NODE_ENV === 'development') { %>
   <script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
 <% } %>

+ 1 - 1
jydocs-mobile/src/components/SharePopup.vue

@@ -52,7 +52,7 @@ export default class extends Vue {
         type: num, // options.type--1微信分享,2qq分享,3朋友圈分享
         title: this.detailData.docName,
         content: this.detailData.docSummary,
-        link: this.links.url
+        link: this.links
       })
     }
 

+ 6 - 0
jydocs-mobile/src/views/Search.vue

@@ -255,6 +255,12 @@ export default class extends Vue {
 
   async getList () {
     if (!this.listState.value) return
+    if (this.listState.pageNum === 1) {
+      this.$toast.loading({
+        forbidClick: true,
+        duration: 0
+      })
+    }
     const query = {
       keyWord: this.listState.value,
       tag: this.docsTypeConf.active === '全部' ? '' : this.docsTypeConf.active,

+ 34 - 47
jydocs-mobile/src/views/details/details.vue

@@ -4,20 +4,22 @@
           <div class="word">
             <van-icon class="word01" :name="'diy-' + fileType(detailData.docFileType)" />
           </div>
-          <div class="title">{{detailData.docName}}</div>
+          {{detailData.docName}}
         </div>
         <div class="middles">
             <h3>摘要</h3>
             <p>{{detailData.docSummary}}</p>
             <div class="continue" v-show="buyed == 0">全文共{{detailData.docPageSize}}页,<span @click="continued">继续阅读<van-icon name="arrow-down" size="18" /></span></div>
         </div>
-        <div class="head-tip" id="fixedTop" :class="{'is-fixed':fixed}" v-show="buyed == 1">
-            <h3 v-show="fixed">
-              <van-icon class="word01" :name="'diy-' + fileType(detailData.docFileType)" />
-              <span>{{detailData.docName}}</span>
-            </h3>
-            <span class="pages"><i id="page_num"></i> / <i id="page_count"></i></span>
-        </div>
+        <van-sticky offset-top="120vh" @scroll="stickyScroll" v-show="buyed == 1">
+          <div class="head-tip" :class="{'is-fixed':fixed}">
+              <h3 v-show="fixed">
+                <van-icon class="word01" :name="'diy-' + fileType(detailData.docFileType)" />
+                <span>{{detailData.docName}}</span>
+              </h3>
+              <span class="pages"><i id="page_num"></i> / <i id="page_count"></i></span>
+          </div>
+        </van-sticky>
         <div class="botts" v-show="buyed == 1">
             <div class="cont-page" id="pdfPage"></div>
         </div>
@@ -42,7 +44,7 @@
 <script lang="ts">
 import { Component, Vue } from 'vue-property-decorator'
 import { mapActions, mapMutations } from 'vuex'
-import { Icon, Toast, GoodsAction, GoodsActionIcon, GoodsActionButton } from 'vant'
+import { Icon, Toast, GoodsAction, GoodsActionIcon, GoodsActionButton, Sticky } from 'vant'
 import Recharge from '@/components/Recharge.vue'
 import sharePop from '@/components/SharePopup.vue'
 import { MixinTop } from '@/utils/mixin-top'
@@ -55,6 +57,7 @@ const pdfjsViewer = require('pdfjs-dist/web/pdf_viewer.js')
   mixins: [MixinTop],
   components: {
     [Icon.name]: Icon,
+    [Sticky.name]: Sticky,
     [GoodsAction.name]: GoodsAction,
     [GoodsActionIcon.name]: GoodsActionIcon,
     [GoodsActionButton.name]: GoodsActionButton,
@@ -83,12 +86,11 @@ export default class extends Vue {
   getDown: any
   getShow: any
   getShare: any
-  links: any = []
+  links = ''
   docIds = ''
   fixed = false
   coins: any = []
   conts: any = []
-  offsets: any = 0
   getAdd: any
   getRemove: any
   detailData: any = []
@@ -121,8 +123,6 @@ export default class extends Vue {
   created () {
     this.docIds = this.$route.params.id
     this.onList()
-    this.setTop()
-    console.log(window.screen.width)
   }
 
   mounted () {
@@ -134,21 +134,9 @@ export default class extends Vue {
     window.removeEventListener('scroll', this.initHeight)
   }
 
-  setTop () {
-    this.$nextTick(() => {
-      // 获取到达页面顶端的值
-      const heights = document.getElementById('fixedTop')
-      this.offsets = heights?.offsetTop
-      // this.offsets = heights.getBoundingClientRect().top
-      console.log(this.offsets)
-    })
-  }
-
   initHeight () {
-    // 获取页面滚动距离
-    const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
-    this.fixed = !!(scrollTop > this.offsets && this.buyed)
     const top = window.scrollY
+    console.log(top)
     let base = 0
     for (let i = 0; i < this.pData.heightList.length; i++) {
       base += this.pData.heightList[i]
@@ -176,7 +164,7 @@ export default class extends Vue {
     ;(this.$refs.shares as any).show = true
   }
 
-  updateText (data: any) {
+  updateText (data) {
     console.log(data)
     switch (data.type) {
       case 'count': {
@@ -192,8 +180,6 @@ export default class extends Vue {
 
   renders () {
     const container = document.getElementById('pdfPage')
-    // let notes = document.getElementById('pdfPage')
-    // document.getElementById('pdfPage').style.width = '100vw'
     return this.pdfDocument.getPage(this.config.PAGE_TO_VIEW).then((pdfPage: any) => {
       const pdfPageView = new pdfjsViewer.PDFPageView({
         container: container,
@@ -229,16 +215,22 @@ export default class extends Vue {
     })
   }
 
-  watchPage () {
-    const top = window.scrollY
+  stickyScroll (data: any) {
+    const tops = data.scrollTop
+    console.log(this.$parent.$el.scrollTop)
     let base = 0
     for (let i = 0; i < this.pData.heightList.length; i++) {
       base += this.pData.heightList[i]
-      if (top <= base) {
+      if (tops <= base) {
         this.updateText({ type: 'num', value: i + 1 })
         break
       }
     }
+    if (data.isFixed) {
+      this.fixed = true
+    } else {
+      this.fixed = false
+    }
   }
 
   buyShow () {
@@ -342,28 +334,25 @@ export default class extends Vue {
 @include diy-icon('guanzhu', 20, 20);
 @include diy-icon('iconJianYu', 24, 24);
 .details-p {
-    display: flex;
-    flex-direction: column;
     padding-bottom: 80px;
+    box-sizing: border-box;
     .tops {
         display: flex;
         flex-direction: initial;
         background: #fff;
         padding: 24px 16px;
+        color: #171826;
+        font-weight: 500;
+        font-size: 20px;
+        line-height: 30px;
         .word {
           display: flex;
         }
         .word01 {
-            display: flex;
-            width: 24px;
-            height: 24px;
-            margin-right: 8px;
-        }
-        .title {
-          color: #171826;
-          font-weight: 500;
-          font-size: 20px;
-          line-height: 30px;
+          display: flex;
+          width: 24px;
+          height: 24px;
+          margin-right: 8px;
         }
     }
     .middles {
@@ -401,7 +390,7 @@ export default class extends Vue {
     }
     .head-tip {
         width: auto;
-        height: 60px;
+        height: 40px;
         background: #fcfcfc;
         display: flex;
         justify-content: flex-end;
@@ -442,8 +431,6 @@ export default class extends Vue {
         }
     }
     .is-fixed {
-        position: fixed;
-        top: 0;
         justify-content: space-between;
     }
     .botts {

+ 3 - 0
jydocs-mobile/src/views/purchase/purchase.vue

@@ -405,6 +405,9 @@ export default class extends Vue {
         .van-checkbox__label{
           margin-left: 12px;
         }
+        .van-checkbox__icon--round .van-icon{
+          border-radius: 50%;
+        }
       }
     }
   }

+ 2 - 2
jydocs-mobile/src/views/purchase/purchasesuccess.vue

@@ -64,7 +64,7 @@ export default class extends Vue {
     this.query = location.href.split('/')[location.href.split('/').length - 1] // 获取num
     this.setCountDown()
     this.setSession()
-    this.clearLibState('clearLib') // 清除我的文库列表缓存数据
+    this.clearLibState() // 清除我的文库列表缓存数据
   }
 
   setSession () {
@@ -72,7 +72,7 @@ export default class extends Vue {
     console.log(paydata)
     if (paydata) {
       paydata = JSON.parse(paydata)
-      this.payinfor.payTime = dateFormatter(paydata.payTime * 1000, 'yyyy-MM-dd')
+      this.payinfor.payTime = dateFormatter(paydata.payTime * 1000, 'yyyy/MM/dd')
       this.payinfor.payWay = paydata.payWay
       this.payinfor.code = paydata.code
       this.payinfor.docId = paydata.query

+ 37 - 24
jydocs-pc/src/components/recommend.vue

@@ -3,21 +3,21 @@
     <div class="r-bott">
         <h3>相关推荐</h3>
         <div class="docs" v-for="item in recomes" :key="item.docId">
-            <div class="imgs">
+            <div class="imgs" @click="detailClick(item.docId)">
                 <img :src="item.previewImgId" alt="">
                 <i class="el-icon-jy-word"></i>
             </div>
             <div class="conts">
-                <h5>{{item.docName}}</h5>
-                <!-- <p>贡献者:{{item.price}}</p> -->
+                <h5 @click="detailClick(item.docId)">{{item.docName}}</h5>
                 <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 class="d-page">
+                      <p>共{{item.docPageSize}}页</p>
+                      <el-divider direction="vertical"></el-divider>
+                      <p>{{item.docFileSize}}</p>
+                    </div>
                 </div>
-                <div class="r-coin">500剑鱼币</div>
+                <div class="r-coin"><i class="el-icon-jy-iconJianYu"></i><span>{{item.price}}</span></div>
             </div>
         </div>
     </div>
@@ -33,21 +33,21 @@ export default {
   components: {
     [Divider.name]: Divider
   },
-  data () {
-    return {
-
-    }
-  },
   methods: {
-
+    detailClick (ids) {
+      const routeUrl = this.$router.resolve({
+        name: 'c-recommend',
+        params: { id: ids }
+      })
+      window.open(routeUrl.href, '_blank')
+    }
   }
 }
 </script>
 
 <style lang="scss" scoped>
+@include diy-icon('iconJianYu', 18, 18);
 .c-recommend {
-  // display: flex;
-  // flex-direction: initial;
   .r-bott {
       min-height: 448px;
       border-radius: 4px;
@@ -64,15 +64,16 @@ export default {
       }
       .docs {
           display: flex;
-          height: 112px;
           .imgs {
+              height: 110px;
               display: table;
               position: relative;
               border-radius: 4px;
               border: 1px solid #ECECEC;
+              cursor: pointer;
               img {
                   width: 78px;
-                  height: 112px;
+                  // height: 112px;
                   border: 0;
               }
               i {
@@ -93,6 +94,7 @@ export default {
                   overflow: hidden;
                   text-overflow: ellipsis;
                   -webkit-box-orient: vertical;
+                  cursor: pointer;
               }
               p {
                   margin: 0;
@@ -102,21 +104,32 @@ export default {
               }
               .d-tip {
                   display: flex;
-                  flex-direction: initial;
-                  align-items: center;
+                  flex-direction: column;
                   .el-divider--vertical {
                       height: 0.8em;
                       margin: 0 2px;
                   }
+                  .d-page {
+                    display: flex;
+                    flex-direction: initial;
+                    align-items: center;
+                  }
                   p {
-                      padding: 0 1px;
+                      padding: 0 2px;
                   }
               }
               .r-coin {
-                  color: #2CB7CA;
-                  font-size: 14px;
-                  line-height: 24px;
+                  display: flex;
+                  align-items: center;
                   margin-top: 2px;
+                  i {
+                    width:18px;
+                    height:18px;
+                  }
+                  span {
+                      font-size: 14px;
+                      color: #FF3A20;
+                  }
               }
           }
       }

+ 11 - 9
jydocs-pc/src/views/Content.vue

@@ -3,7 +3,9 @@
       <div class="d-left">
           <div class="tops">
               <h3>
+                <div>
                   <i :class="'el-icon-jy-' + fileType(datas.docFileType)"></i>
+                </div>
                   {{datas.docName}}
               </h3>
               <div class="tips">
@@ -151,6 +153,7 @@ export default {
       this.watchPage()
     },
     updateText ({ type, value = '' }) {
+      console.log(type, value)
       switch (type) {
         case 'count': {
           document.querySelector('#page_count').textContent = value
@@ -221,6 +224,7 @@ export default {
       getCoin({ B: true }).then(res => {
         if (res.data.error_code === 0) {
           this.coinNum = res.data.data.points.balance
+          // this.coinNum = 11
           if (this.buyed === 1) {
             this.btnName = '下载文档'
             this.lineShow = false
@@ -252,7 +256,7 @@ export default {
           this.datas.docFileSize = formatSize(this.datas.docFileSize)
           this.datas.uploadDate = dateFormatter(this.datas.uploadDate, 'yyyy-MM-dd')
           this.datas.docSummary = this.datas.docSummary.split('').length >= 500 ? this.datas.docSummary + '...' : this.datas.docSummary
-          this.datas.tags = this.datas.tags.split(',').slice(0,3)
+          this.datas.tags = this.datas.tags.split(',').slice(0, 3)
           this.buyed = res.data.data.status
           this.coined()
           this.recommend(res.data.data.detail.tags)
@@ -362,18 +366,17 @@ export default {
   .d-left {
       width: 920px;
       .tops {
-          // min-height: 224px;
           background: #fff;
           padding: 32px 40px;
           border-radius: 4px;
           h3 {
               display: flex;
               flex-direction: initial;
-            //   align-items: center;
               color: #1d1d1d;
               font-weight: 500;
               font-size: 24px;
               line-height: 36px;
+              margin: 0;
               i {
                   display: inline-flex;
                   margin-right: 8px;
@@ -389,6 +392,8 @@ export default {
                   display: flex;
                   flex-direction: initial;
                   align-items: center;
+                  margin: 0;
+                  padding: 0;
                   li {
                       display: flex;
                       list-style-type: none;
@@ -479,7 +484,6 @@ export default {
           }
       }
       .middles {
-          height: 316px;
           padding: 24px 40px;
           background: #fff;
           border-radius: 4px;
@@ -511,17 +515,14 @@ export default {
           }
       }
       .actives {
-        height: 530px;
+        height: 656px;
       }
       .actives1 {
-        height: 552px;
+        height: 680px;
       }
       .head-tip {
-            width: 920px;
             height: 42px;
             background: #fcfcfc;
-            // filter:alpha(opacity=80); //IE
-            // opacity: 0.8;   //Chrome
             display: flex;
             justify-content: flex-end;
             align-items: center;
@@ -563,6 +564,7 @@ export default {
         .is-fixed {
             position: fixed;
             top: 0;
+            width: 840px;
             justify-content: space-between;
         }
       .bottoms {

+ 1 - 1
jydocs-pc/src/views/Search.vue

@@ -19,7 +19,7 @@
           v-for="(item, index) in listState.list"
           :key="index"
           :title="item.docName"
-          :desc="item.docSummary"
+          :desc="item.docSummary + '...'"
           :docType="item.docFileType"
           :price="item.price"
           :highlightKey="highlightKey"

+ 1 - 1
jydocs-pc/src/views/purchase/purchasesuccess.vue

@@ -75,7 +75,7 @@ export default {
         paydata = JSON.parse(paydata)
         console.log(paydata)
         this.payinfor.docId = paydata.query
-        this.payinfor.payTime = dateFormatter(paydata.payTime * 1000, 'yyyy-MM-dd')
+        this.payinfor.payTime = dateFormatter(paydata.payTime * 1000, 'yyyy年MM月dd日')
         this.payinfor.payWay = paydata.payWay
         this.payinfor.code = paydata.code
         this.payinfor.balance = paydata.balance