xgwangman 4 年之前
父節點
當前提交
fc4ae05d40

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

@@ -103,7 +103,9 @@ func OpenShareJydoc(fromId, openId, docId string) {
 	}) == 0 {
 		return
 	}
-	if redis.Get("other", fmt.Sprintf("integral_article_%s_%s", fromId, docId)) == nil {
+	key := fmt.Sprintf("integral_article_%s_%s_%s", docId, fromId, openId)
+	if redis.Incr("other", key) == 1 {
+		_ = redis.SetExpire("other", key, 24*60*60)
 		pushErr := func() error {
 			b, _ := json.Marshal(&model.Message{
 				E_code:   "jydocs_doc_open",

+ 1 - 1
jydocs-back/servers/share.go

@@ -47,7 +47,7 @@ func (share *Share) ShareImg() {
 }
 
 func getDocShareUrl(userId, docId string) string {
-	enUserId := encrypt.SE.EncodeString(userId)
+	enUserId := encrypt.SE.EncodeStringByCheck(userId)
 	toHref := url.QueryEscape(fmt.Sprintf("/page_docs_app/details/%s?from=%s", docId, enUserId)) //关注跳转页面
 	unHref := url.QueryEscape(fmt.Sprintf("/swordfish/about?from=%s", enUserId))                 //为关注跳转页面
 	log.Println(fmt.Sprintf(config.JyDocsAppConfig.ShareUrl+"?toHref=%s&unHref=%s", toHref, unHref))

+ 10 - 2
jydocs-back/servers/stdDoc.go

@@ -4,6 +4,7 @@ import (
 	. "app.yhyue.com/moapp/jybase/api"
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jybase/redis"
 	"fmt"
 	"jy-docs/config"
 	"jy-docs/public"
@@ -143,7 +144,6 @@ func (stdDoc *StdDoc) GetDoc(sign string) {
 		fileId := detail.OssPdfId
 		if sign == "Down" {
 			fileId = detail.OssDocId
-			go rpc.DocStatistics(userId, docId, rpc.Down) //统计下载次数
 		}
 		url, err := rpc.GetFileContext(userId, fileId)
 		if err != nil {
@@ -176,11 +176,19 @@ func (stdDoc *StdDoc) TopList() {
 		} else {
 			return nil, fmt.Errorf("未知请求")
 		}
-		//存入redis缓存
+		topKey := fmt.Sprintf("jydoc_indexCache_%s_%d", reqSort, num)
+		listCache := redis.Get("other", topKey)
+		if listCache != nil {
+			return listCache, nil
+		}
+		log.Println("flush", topKey)
 		list, _, err := rpc.GetDocQuery(userId, "", "", 1, num, reqSort)
 		if err != nil {
 			return nil, err
 		}
+		if len(list) > 0 { //存入redis缓存
+			redis.Put("other", topKey, list, 60*5)
+		}
 		return list, nil
 	}()
 	if errMsg != nil {

+ 1 - 1
jydocs-mobile/.env.development

@@ -3,4 +3,4 @@ VUE_APP_MOCK=false
 VUE_APP_BASE_API = '/jydocs'
 BASE_URL = '/dev/docs/'
 VUE_APP_BASE_URL = '/dev/docs/'
-VUE_APP_LOG_URL='https://web2-jytest.jianyu360.cn/jyintegral/actionInfo?logAction='
+VUE_APP_LOG_URL='https://web2-jytest.jydev.jianyu360.com/jyLogs/actionInfo?logAction='

+ 1 - 1
jydocs-mobile/.env.production

@@ -2,4 +2,4 @@ NODE_ENV=production
 VUE_APP_BASE_API='/jydocs'
 BASE_URL = '/page_docs_app/'
 VUE_APP_BASE_URL = '/page_docs_app/'
-VUE_APP_LOG_URL='https://web2-jytest.jydev.jianyu360.com/jyLogs/actionInfo?logAction='
+VUE_APP_LOG_URL='https://www.jianyu360.com/jyLogs/actionInfo?logAction='

+ 1 - 1
jydocs-mobile/.env.test

@@ -2,4 +2,4 @@ NODE_ENV=production
 VUE_APP_BASE_API='/jydocs/'
 BASE_URL = '/page_docs_app/'
 VUE_APP_BASE_URL = '/page_docs_app/'
-VUE_APP_LOG_URL='https://web2-jytest.jydev.jianyu360.com/jyLogs/pointsLogs?logAction='
+VUE_APP_LOG_URL='https://web2-jytest.jydev.jianyu360.com/jyLogs/actionInfo?logAction='

+ 1 - 1
jydocs-mobile/package.json

@@ -14,7 +14,7 @@
     "html2canvas": "^1.0.0-rc.6",
     "js-cookie": "^2.2.1",
     "moment": "^2.24.0",
-    "pdfjs-dist": "^2.6.347",
+    "pdfjs-dist": "^2.1.266",
     "vant": "^2.8.2",
     "vue": "^2.6.11",
     "vue-class-component": "^7.2.3",

+ 1 - 4
jydocs-mobile/src/components/Recharge.vue

@@ -45,9 +45,6 @@ import { Icon, Popup, Sticky } from 'vant'
       [Popup.name]: Popup,
       [Sticky.name]: Sticky,
       [Icon.name]: Icon
-    },
-    created () {
-      console.log('111')
     }
   })
 export default class extends Vue {
@@ -59,7 +56,7 @@ export default class extends Vue {
     }
 
     buyMoney () {
-      window.location.href = '/page_points_app/pay'
+      window.location.href = `/page_points_app/pay?id=${this.detailData.docId}`
     }
 }
 </script>

+ 17 - 7
jydocs-mobile/src/store/modules/main.ts

@@ -28,7 +28,7 @@ function recoveryPageData (key: string, defaultValues = {}) {
   return sessionStorage.getItem(key) ? JSON.parse(sessionStorage.getItem(key) || '') : defaultValues
 }
 function checkType (type: string | number) {
-  let typeStr = ''
+  let typeStr = type
   switch (type) {
     case 1: {
       typeStr = 'word'
@@ -87,7 +87,7 @@ const modulesOption: modulesOption = {
       }
       sessionStorage.setItem('jy-docs-home-page', JSON.stringify(state.homePageData))
     },
-    // 我的文库页面数据
+    // 搜索页面数据
     saveSearchPageState (state, data) {
       console.log(data)
       for (const key in data) {
@@ -95,7 +95,7 @@ const modulesOption: modulesOption = {
       }
       sessionStorage.setItem('jy-docs-search-page', JSON.stringify(data))
     },
-    // 清除提现成功数据
+    // 清除搜索页面数据
     clearSearchPageState (state) {
       state.searchPageData = {}
       sessionStorage.setItem('jy-docs-search-page', JSON.stringify({}))
@@ -107,10 +107,20 @@ const modulesOption: modulesOption = {
       }
       sessionStorage.setItem('jy-docs-user-lib', JSON.stringify(data))
     },
-    // 清除提现成功数据
-    clearMyLibState (state) {
-      state.userLib = {}
-      sessionStorage.setItem('jy-docs-user-lib', JSON.stringify({}))
+    // 清除我的文库页面数据
+    clearMyLibState (state, data = '') { // clearLib,clearCollections
+      if (data === 'clearLib') {
+        if (state.userLib && Object.keys(state.userLib).length !== 0) {
+          delete state.userLib.myLibListState
+        }
+      } else if (data === 'clearCollections') {
+        if (state.userLib && Object.keys(state.userLib).length !== 0) {
+          delete state.userLib.myCollectionListState
+        }
+      } else {
+        state.userLib = {}
+      }
+      sessionStorage.setItem('jy-docs-user-lib', JSON.stringify(state.userLib))
     }
   },
   actions: {

+ 0 - 30
jydocs-mobile/src/utils/index.ts

@@ -1,17 +1,7 @@
 import Vue from 'vue'
 import './globalDirectives'
 import './globalFilters'
-import WeiXinSDK from '@/utils/wx-js-sdk-register.ts'
 import { isWeiXinBrowser, androidOrIOS } from '@/utils/globalFunctions'
-import { getWxSdkSign } from '@/api/index.ts'
-
-declare module 'vue/types/vue' {
-  interface Vue {
-    $env: any;
-    $registerWxSdk: any;
-    $wxSdk: any;
-  }
-}
 
 const inWeiXinBrowser = isWeiXinBrowser()
 const isAndroidOrIos = androidOrIOS()
@@ -23,26 +13,6 @@ Vue.prototype.$env = {
   isIOS: isAndroidOrIos === 'ios'
 }
 
-// 如果是微信浏览器, 注册一个微信SDK初始化函数
-if (!inWeiXinBrowser) {
-  Vue.prototype.$registerWxSdk = async () => {
-    const sdkInfo = await getWxSdkSign({ url: location.href.split('#')[0] })
-    if (!sdkInfo) return
-    const info = sdkInfo.data
-    if (info && info.wxsdk && Array.isArray(info.wxsdk)) {
-      const sdk = info.wxsdk
-      Vue.prototype.$wxSdk = new WeiXinSDK({
-        appId: sdk[0],
-        timestamp: sdk[1],
-        nonceStr: sdk[2],
-        signature: sdk[3]
-      })
-    }
-    return info
-  }
-  Vue.prototype.$registerWxSdk()
-}
-
 // 正式环境下屏蔽console.log
 if (process.env.NODE_ENV === 'production') {
   const print = window.console.log

+ 10 - 3
jydocs-mobile/src/views/Search.vue

@@ -139,6 +139,8 @@ export default class extends Vue {
     list: []
   }
 
+  restored = false // 当前数据是否走过缓存
+
   get activeSortType () {
     return this.sortTypeList.find(item => {
       return item.active
@@ -150,17 +152,20 @@ export default class extends Vue {
   }
 
   created () {
-    const y = this.reStoreState()
-    if (!y) {
+    this.restored = this.reStoreState()
+    if (!this.restored) {
       this.getTags()
     }
   }
 
   mounted () {
-    this.onFocus()
+    if (!this.restored) {
+      this.onFocus()
+    }
   }
 
   onFocus () {
+    console.log('fffff')
     const dom = document.querySelector('#mySearch input') as HTMLInputElement
     if (dom) {
       this.$nextTick(() => {
@@ -214,6 +219,7 @@ export default class extends Vue {
   }
 
   doSearch () {
+    if (!this.listState.value) return
     this.resetListState()
     this.setScrollTop()
     this.listState.finished = false
@@ -261,6 +267,7 @@ export default class extends Vue {
     const { data } = await this.doSearchRquesst(query)
     this.listState.loading = false
     this.listState.loaded = true
+    this.$toast.clear()
     if (data && Array.isArray(data.list)) {
       this.listState.pageNum += 1
       this.listState.total = data.total

+ 16 - 12
jydocs-mobile/src/views/details/details.vue

@@ -43,7 +43,7 @@
 
 <script lang="ts">
 import { Component, Vue } from 'vue-property-decorator'
-import { mapActions } from 'vuex'
+import { mapActions, mapMutations } from 'vuex'
 import { Icon, Toast, GoodsAction, GoodsActionIcon, GoodsActionButton, Sticky } from 'vant'
 import Recharge from '@/components/Recharge.vue'
 import sharePop from '@/components/SharePopup.vue'
@@ -73,10 +73,14 @@ const pdfjsViewer = require('pdfjs-dist/web/pdf_viewer.js')
       getShare: 'main/getShare',
       getAdd: 'main/getAdd',
       getRemove: 'main/getRemove'
+    }),
+    ...mapMutations({
+      clearLibState: 'main/clearMyLibState'
     })
   }
 })
 export default class extends Vue {
+  clearLibState: any
   getDetails: any
   getCoin: any
   getDown: any
@@ -96,10 +100,10 @@ export default class extends Vue {
   pdfDocument: any
   config: any = {
     PAGE_TO_VIEW: 0,
-    SCALE: 1,
-    CMAP_URL: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.6.347/cmaps/',
+    SCALE: 0,
+    CMAP_URL: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/cmaps/',
     CMAP_PACKED: true,
-    workerSrc: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.6.347/es5/build/pdf.worker.min.js'
+    workerSrc: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/build/pdf.worker.min.js'
   }
 
   pData: any = {
@@ -151,7 +155,7 @@ export default class extends Vue {
       config: {
         title: this.detailData.docName,
         desc: this.detailData.docSummary,
-        url: this.links
+        link: this.links
       }
     })
   }
@@ -160,15 +164,15 @@ export default class extends Vue {
     ;(this.$refs.shares as any).show = true
   }
 
-  updateText ({ type = '', value = '' }) {
-    console.log(type, value)
-    switch (type) {
+  updateText (data) {
+    console.log(data)
+    switch (data.type) {
       case 'count': {
-        document.getElementById('page_count').textContent = value
+        ;(document.getElementById('page_count') as HTMLDivElement).textContent = data.value
         break
       }
       case 'num': {
-        document.getElementById('page_num').textContent = value
+        ;(document.getElementById('page_count') as HTMLDivElement).textContent = data.value
         break
       }
     }
@@ -265,16 +269,16 @@ export default class extends Vue {
   canged () {
     if (this.collectd === 0) {
       this.getAdd({ docId: this.docIds }).then((res: any) => {
-        console.log(res)
         if (res.error_code === 0) {
+          this.clearLibState('clearCollections') // 清除我的收藏列表缓存数据
           this.collectd = 1
           Toast('收藏成功')
         }
       })
     } else {
       this.getRemove({ docId: this.docIds }).then((res: any) => {
-        console.log(res)
         if (res.error_code === 0) {
+          this.clearLibState('clearCollections') // 清除我的收藏列表缓存数据
           this.collectd = 0
           Toast('取消收藏')
         }

File diff suppressed because it is too large
+ 22 - 7
jydocs-mobile/src/views/purchase/purchase.vue


+ 12 - 7
jydocs-mobile/src/views/purchase/purchasesuccess.vue

@@ -38,19 +38,22 @@
 <script lang="ts">
 import { Component, Vue } from 'vue-property-decorator'
 import { dateFormatter } from '../../utils/globalFunctions'
-// import { mapState } from 'vuex'
+import { mapMutations } from 'vuex'
 
 @Component({
   name: 'test',
-  components: {
-  }
+  ...mapMutations({
+    clearLibState: 'main/clearMyLibState'
+  })
 })
 export default class extends Vue {
+  clearLibState: any
   count = 3
   timer: any
   $router: any
   query: any
   payinfor = {
+    docId: '', // id
     payTime: '',
     payWay: '',
     code: '',
@@ -58,9 +61,10 @@ export default class extends Vue {
   }
 
   created () {
-    this.query = location.href.split('/')[location.href.split('/').length - 1] // 获取id
+    this.query = location.href.split('/')[location.href.split('/').length - 1] // 获取num
     this.setCountDown()
     this.setSession()
+    this.clearLibState('clearLib') // 清除我的文库列表缓存数据
   }
 
   setSession () {
@@ -68,9 +72,10 @@ 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
     }
   }
 
@@ -86,7 +91,7 @@ export default class extends Vue {
           this.$router.replace({
             name: 'details',
             params: {
-              id: this.payinfor.code
+              id: this.payinfor.docId
             }
           })
         }
@@ -99,7 +104,7 @@ export default class extends Vue {
     this.$router.replace({
       name: 'details',
       params: {
-        id: this.payinfor.code
+        id: this.payinfor.docId
       }
     })
   }

+ 18 - 4
jydocs-mobile/src/views/user/Library.vue

@@ -29,7 +29,7 @@
             />
           </div>
         </van-list>
-        <Empty v-if="myLibListState.list.length === 0 && myLibListState.loaded">暂无数据</Empty>
+        <Empty v-if="myLibListState.list.length === 0 && myLibListState.loaded">暂无我的文库</Empty>
       </van-tab>
 
       <van-tab title="文库收藏" name="1">
@@ -54,7 +54,7 @@
             />
           </div>
         </van-list>
-        <Empty v-if="myCollectionListState.list.length === 0 && myCollectionListState.loaded">暂无数据</Empty>
+        <Empty v-if="myCollectionListState.list.length === 0 && myCollectionListState.loaded">暂无文库收藏</Empty>
       </van-tab>
     </van-tabs>
   </div>
@@ -165,12 +165,26 @@ export default class UserLibrary extends Vue {
 
   calcSubInfoForLib (item: any) {
     const { UpdateAt, DocFileSize } = item
-    return [`${dateFormatter(UpdateAt * 1000, 'yyyy/MM/dd')}下载`, formatSize(DocFileSize)]
+    const subInfoArr = []
+    if (UpdateAt !== undefined) { // 下载时间
+      subInfoArr.push(`${dateFormatter(UpdateAt * 1000, 'yyyy/MM/dd')}下载`)
+    }
+    if (DocFileSize !== undefined) {
+      subInfoArr.push(formatSize(DocFileSize))
+    }
+    return subInfoArr
   }
 
   calcSubInfoForColl (item: any) {
     const { DocPageSize, DocFileSize } = item
-    return [`共${DocPageSize}页`, formatSize(DocFileSize)]
+    const subInfoArr = []
+    if (DocPageSize !== undefined) {
+      subInfoArr.push(`共${DocPageSize}页`)
+    }
+    if (DocFileSize !== undefined) {
+      subInfoArr.push(formatSize(DocFileSize))
+    }
+    return subInfoArr
   }
 
   async onLoad () {

+ 1 - 6
jydocs-mobile/yarn.lock

@@ -6947,7 +6947,7 @@ pbkdf2@^3.0.3:
     safe-buffer "^5.0.1"
     sha.js "^2.4.8"
 
-pdfjs-dist@^2.6.347:
+pdfjs-dist@^2.1.266:
   version "2.6.347"
   resolved "https://registry.npm.taobao.org/pdfjs-dist/download/pdfjs-dist-2.6.347.tgz#f257ed66e83be900cd0fd28524a2187fb9e25cd5"
   integrity sha1-8lftZug76QDND9KFJKIYf7niXNU=
@@ -9577,11 +9577,6 @@ websocket-extensions@>=0.1.1:
   resolved "https://registry.npm.taobao.org/websocket-extensions/download/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42"
   integrity sha1-f4RzvIOd/YdgituV1+sHUhFXikI=
 
-weixin-js-sdk@^1.6.0:
-  version "1.6.0"
-  resolved "https://registry.npm.taobao.org/weixin-js-sdk/download/weixin-js-sdk-1.6.0.tgz#ff50484d8118ce1208f11248cf4a1c0831577514"
-  integrity sha1-/1BITYEYzhII8RJIz0ocCDFXdRQ=
-
 which-module@^2.0.0:
   version "2.0.0"
   resolved "https://registry.npm.taobao.org/which-module/download/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"

+ 1 - 1
jydocs-pc/.env.development

@@ -1,6 +1,6 @@
 NODE_ENV=development
 VUE_APP_BASE_API='/jydocs/'
-VUE_APP_BASE_URL='/swordfish/frontPage/docs/sess/index/'
+VUE_APP_BASE_URL='/swordfish/frontPage/docs/free/index/'
 VUE_APP_MOCK=false
 VUE_APP_BASE_PUBLIC='http://localhost:8080/'
 VUE_APP_LOG_URL='https://web2-jytest.jydev.jianyu360.com/jyLogs/actionInfo?logAction='

+ 1 - 1
jydocs-pc/.env.test

@@ -2,4 +2,4 @@ NODE_ENV=production
 VUE_APP_BASE_API='/jydocs/'
 VUE_APP_BASE_URL='/swordfish/docs/index'
 VUE_APP_BASE_PUBLIC='/page_docs/'
-VUE_APP_LOG_URL='https://web2-jytest.jydev.jianyu360.com/jyLogs/pointsLogs?logAction='
+VUE_APP_LOG_URL='https://web2-jytest.jydev.jianyu360.com/jyLogs/actionInfo?logAction='

+ 3 - 1
jydocs-pc/.eslintrc.js

@@ -9,7 +9,9 @@ module.exports = {
   ],
   globals: {
     loginflag: true,
-    $: true
+    $: true,
+    pdfjsLib: true,
+    pdfjsViewer: true
   },
   parserOptions: {
     parser: 'babel-eslint'

+ 0 - 1
jydocs-pc/package.json

@@ -13,7 +13,6 @@
     "axios": "^0.21.1",
     "core-js": "^3.4.3",
     "element-ui": "^2.15.1",
-    "pdfjs-dist": "^2.6.347",
     "single-spa-vue": "^1.5.4",
     "systemjs-webpack-interop": "^1.1.2",
     "vue": "^2.6.10",

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

@@ -5,26 +5,26 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
-    <title>app1</title>
+    <title>剑鱼标讯</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/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">
-      <link href="https://web2-jytest.jianyu360.cn/css/common.css?v=6302" rel="stylesheet">
-      <link href="https://web2-jytest.jianyu360.cn/css/animate.css" rel="stylesheet">
-      <link href="https://web2-jytest.jianyu360.cn/css/unicorn.main.css" rel="stylesheet" />
-      <link href="https://web2-jytest.jianyu360.cn/css/unicorn.grey.css" rel="stylesheet" />
-      <script src="https://web2-jytest.jianyu360.cn/js/jquery-3.2.1.min.js?v=6302"></script>
-      <script src="https://web2-jytest.jianyu360.cn/js/jquery.cookie.js"></script>
-      <script src="https://web2-jytest.jianyu360.cn/js/bootstrap.min.js"></script>
-      <script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.6.347/build/pdf.min.js"></script>
-      <script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.6.347/web/pdf_viewer.js"></script>
+      <link href="https://web2-jytest.jydev.jianyu360.com/css/bootstrap.min.css" rel="stylesheet">
+      <link href="https://web2-jytest.jydev.jianyu360.com/css/bootswatch.min.css" rel="stylesheet">
+      <link href="https://web2-jytest.jydev.jianyu360.com/css/font.css?v=6302" rel="stylesheet">
+      <link href="https://web2-jytest.jydev.jianyu360.com/css/jy.css?v=6302" rel="stylesheet">
+      <link href="https://web2-jytest.jydev.jianyu360.com/css/common.css?v=6302" rel="stylesheet">
+      <link href="https://web2-jytest.jydev.jianyu360.com/css/animate.css" rel="stylesheet">
+      <link href="https://web2-jytest.jydev.jianyu360.com/css/unicorn.main.css" rel="stylesheet" />
+      <link href="https://web2-jytest.jydev.jianyu360.com/css/unicorn.grey.css" rel="stylesheet" />
+      <script src="https://web2-jytest.jydev.jianyu360.com/js/jquery-3.2.1.min.js?v=6302"></script>
+      <script src="https://web2-jytest.jydev.jianyu360.com/js/jquery.cookie.js"></script>
+      <script src="https://web2-jytest.jydev.jianyu360.com/js/bootstrap.min.js"></script>
+      <script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/build/pdf.min.js"></script>
+      <script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/web/pdf_viewer.js"></script>
 
-      <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.jydev.jianyu360.com/css/reset.css?v=6302' rel="stylesheet" type="text/css"/>
+      <link href='https://web2-jytest.jydev.jianyu360.com/pccss/reset_pc.css' rel="stylesheet" type="text/css"/>
+      <link href='https://web2-jytest.jydev.jianyu360.com/css/pc.css?v=6302' rel="stylesheet"/>
+      <link href='https://web2-jytest.jydev.jianyu360.com/pccss/public-nav-1200.css?v=6302' rel="stylesheet" type="text/css"/>
     <% } %>
   </head>
   <body>

+ 26 - 0
jydocs-pc/src/assets/style/_variables.scss

@@ -37,6 +37,32 @@ body {
   color: $color-text--highlight;
 }
 
+.ellipsis {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  text-align: justify
+}
+
+/* 超过2行省略号显示 */
+.ellipsis-2 {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-line-clamp: 2;
+  -webkit-box-orient: vertical;
+  text-align: justify
+}
+
+/* 超过3行省略号显示 */
+.ellipsis-3 {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-line-clamp: 3;
+  -webkit-box-orient: vertical;
+}
+
 .flex {
   width: 100%;
   flex: 1;

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

@@ -7,7 +7,7 @@
                 clearable>
             <el-button @click="submitSearch" slot="append" icon="el-icon-jy-search"></el-button>
         </el-input>
-        <el-tabs v-model="type" v-show="tabs.length">
+        <el-tabs v-model="type" v-show="tabs.length" @tab-click="submitSearch">
           <el-tab-pane v-for="item in tabs" :key="item.type" :label="item.label" :name="item.type"></el-tab-pane>
         </el-tabs>
     </div>

+ 2 - 2
jydocs-pc/src/components/doc-item-card/Card.vue

@@ -23,7 +23,7 @@
         <span class="doc-type-icon" :class="docTypeIcon"></span>
       </div>
       <div class="image-info-container flex-c-c flex">
-        <div class="card-title">{{ title }}</div>
+        <div class="card-title ellipsis-2">{{ title }}</div>
         <div class="card-info">
           <div class="card-info-item uploader" v-if="uploader">贡献者:{{ uploader }}</div>
           <div class="card-info-item subinfo-container">
@@ -46,7 +46,7 @@
         <span class="card-title flex" v-html="hightLightTitle"></span>
       </div>
       <div class="docs-card-content">
-        <span class="card-desc" v-html="hightLightDesc"></span>
+        <span class="card-desc ellipsis-2" v-html="hightLightDesc"></span>
       </div>
       <div class="docs-card-footer flex-r-c">
         <div class="c-f-left subinfo-container">

+ 2 - 4
jydocs-pc/src/views/Content.vue

@@ -91,8 +91,6 @@ import { Button, Tooltip, Divider, Message } from 'element-ui'
 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 {
   components: {
     [Button.name]: Button,
@@ -124,9 +122,9 @@ export default {
       config: {
         PAGE_TO_VIEW: 0,
         SCALE: 1.0,
-        CMAP_URL: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.6.347/cmaps/',
+        CMAP_URL: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/cmaps/',
         CMAP_PACKED: true,
-        workerSrc: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.6.347/es5/build/pdf.worker.min.js'
+        workerSrc: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/build/pdf.worker.min.js'
       },
       pData: {
         heightList: []

+ 9 - 3
jydocs-pc/src/views/Home.vue

@@ -127,7 +127,7 @@ import { getHomeActivity, getHomeHot } from '../api/modules/home'
 import { recoveryPageData } from '../utils'
 
 function checkType (type) {
-  let typeStr = ''
+  let typeStr = type
   switch (type) {
     case 1: {
       typeStr = 'word'
@@ -210,12 +210,13 @@ export default {
   },
   methods: {
     goContent (item) {
-      this.$router.push({
+      const routeData = this.$router.resolve({
         name: 'content',
         params: {
           id: item.id
         }
       })
+      window.open(routeData.href, '_blank')
     },
     async getHome () {
       getHomeHot({ sign: 'new', num: 10 }).then(res => {
@@ -374,17 +375,20 @@ export default {
       white-space: nowrap;
       text-overflow: ellipsis;
     }
+
     .van-multi-ellipsis--l2 {
       display: -webkit-box;
       overflow: hidden;
       text-overflow: ellipsis;
       -webkit-line-clamp: 2;
       -webkit-box-orient: vertical;
+
     }
 
     .hot-keep-group {
       .card-item {
         width: 33.33%;
+        overflow: hidden;
       }
     }
 
@@ -412,7 +416,9 @@ export default {
 
     .hot-down-group {
         border-radius: 12px;
-        background: url("~@/assets/images/dateGetBg.png") no-repeat;
+        background: radial-gradient(circle at 50% 50%, #FAEACD 0%, #FFF8EA 100%);
+        background-image: url("~@/assets/images/dateGetBg.png");
+        background-repeat: no-repeat;
 
         background-size: 100% 100%;
         width: 100%;

+ 16 - 2
jydocs-pc/src/views/Search.vue

@@ -50,7 +50,7 @@ import SearchInput from '@/components/Search'
 import DocCard from '@/components/doc-item-card/Card'
 import NoData from '@/components/NoData'
 import { getSearch } from '../api/modules/search'
-import { formatSize } from '@/utils/'
+import { formatSize, dateFormatter } from '@/utils/'
 import { mixinBackground } from '@/utils/mixins'
 
 export default {
@@ -182,7 +182,21 @@ export default {
     },
     calcSubInfo (item) {
       const { docFileSize: size, downTimes, uploadDate, docPageSize } = item
-      return [uploadDate, `${downTimes}次下载`, `共${docPageSize}页`, formatSize(size)]
+      const subInfoArr = []
+      if (uploadDate !== undefined) {
+        const data = uploadDate.replace(/-/g, '/')
+        subInfoArr.push(dateFormatter(data, 'yyyy/MM/dd'))
+      }
+      if (downTimes !== undefined) {
+        subInfoArr.push(`${downTimes}次下载`)
+      }
+      if (docPageSize !== undefined) {
+        subInfoArr.push(`共${docPageSize}页`)
+      }
+      if (size !== undefined) {
+        subInfoArr.push(formatSize(size))
+      }
+      return subInfoArr
     }
   }
 }

+ 12 - 6
jydocs-pc/src/views/UserCollections.vue

@@ -10,7 +10,7 @@
           :key="index"
           :title="item.DocName"
           :desc="item.DocSummary"
-          :docType="item.docFileType"
+          :docType="item.DocFileType"
           :subInfo="calcSubInfo(item)"
           @onClick="toDocDetail(item)"
         >
@@ -43,7 +43,7 @@ import DocCard from '@/components/doc-item-card/Card'
 import Price from '@/components/doc-item-card/Price'
 import NoData from '@/components/NoData'
 import { getUserDocs } from '../api/modules/user'
-import { dateFormatter, formatSize } from '@/utils/'
+import { formatSize } from '@/utils/'
 import { mixinBackground } from '@/utils/mixins'
 
 export default {
@@ -57,7 +57,7 @@ export default {
   },
   data () {
     return {
-      title: '我的收藏',
+      title: '文库收藏',
       listState: {
         loaded: false, // 是否已经搜索过
         loading: false,
@@ -102,9 +102,15 @@ export default {
       this.getList()
     },
     calcSubInfo (item) {
-      // eslint-disable-next-line
-      const { DocFileSize, CreateAt, UpdateAt, DeletedAt } = item
-      return [dateFormatter(CreateAt * 1000, 'yyyy-MM-dd'), formatSize(DocFileSize)]
+      const { DocPageSize, DocFileSize } = item
+      const subInfoArr = []
+      if (DocPageSize !== undefined) {
+        subInfoArr.push(`共${DocPageSize}页`)
+      }
+      if (DocFileSize !== undefined) {
+        subInfoArr.push(formatSize(DocFileSize))
+      }
+      return subInfoArr
     }
   }
 }

+ 11 - 5
jydocs-pc/src/views/UserDocs.vue

@@ -17,7 +17,7 @@
           cardType="oneline"
           :key="index"
           :title="item.DocName"
-          :docType="item.docFileType"
+          :docType="item.DocFileType + ''"
           :subInfo="calcSubInfo(item)"
           @onClick="toDocDetail(item)"
         />
@@ -44,7 +44,7 @@ import { Pagination } from 'element-ui'
 import DocCard from '@/components/doc-item-card/Card'
 import NoData from '@/components/NoData'
 import { getUserDocs } from '../api/modules/user'
-import { dateFormatter, formatSize } from '@/utils/'
+import { dateFormatter, formatSize } from '@/utils/index'
 import { mixinBackground } from '@/utils/mixins'
 
 export default {
@@ -102,9 +102,15 @@ export default {
       this.getList()
     },
     calcSubInfo (item) {
-      // eslint-disable-next-line
-      const { DocFileSize, CreateAt, UpdateAt, DeletedAt } = item
-      return [dateFormatter(CreateAt * 1000, 'yyyy-MM-dd'), formatSize(DocFileSize)]
+      const { UpdateAt, DocFileSize } = item
+      const subInfoArr = []
+      if (UpdateAt !== undefined) {
+        subInfoArr.push(dateFormatter(UpdateAt * 1000, 'yyyy-MM-dd'))
+      }
+      if (DocFileSize !== undefined) {
+        subInfoArr.push(formatSize(DocFileSize))
+      }
+      return subInfoArr
     }
   }
 }

+ 4 - 5
jydocs-pc/src/views/purchase/purchase.vue

@@ -145,16 +145,15 @@ export default {
       getDocPays({ docId: this.sessioninfor.query, phone: this.tel }).then((res) => {
         console.log(res)
         if (res.data.error_code === 0) {
-          this.sessioninfor.balance = res.data.balance
-          this.sessioninfor.code = res.data.code
-          this.sessioninfor.payTime = res.data.payTime
-          this.sessioninfor.payWay = res.data.payWay
+          this.sessioninfor.balance = res.data.data.balance
+          this.sessioninfor.code = res.data.data.code
+          this.sessioninfor.payTime = res.data.data.payTime
+          this.sessioninfor.payWay = res.data.data.payWay
           sessionStorage.setItem('paydata', JSON.stringify(this.sessioninfor))
           this.$router.push('/purchasesuccess/' + this.response.price)
         }
       })
     },
-
     getBool (bool) {
       if (this.checked === true && bool === true) {
         this.btnChecked = true

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

@@ -75,14 +75,14 @@ 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
       }
     },
     runDownLoad () {
-      getDown({ docId: this.payinfor.docIds }).then(res => {
+      getDown({ docId: this.payinfor.docId }).then(res => {
         if (res.data.error_code === 0) {
           window.location.href = res.data.data
         }
@@ -156,7 +156,7 @@ export default {
             display: flex;
             flex-direction: column;
             justify-content: space-between;
-            width: 215px;
+            width: 247px;
             height: 96px;
             .bill_list{
               display: flex;

+ 0 - 10
jydocs-pc/yarn.lock

@@ -6420,16 +6420,6 @@ pbkdf2@^3.0.3:
     safe-buffer "^5.0.1"
     sha.js "^2.4.8"
 
-pdfh5@^1.3.20:
-  version "1.3.20"
-  resolved "https://registry.npm.taobao.org/pdfh5/download/pdfh5-1.3.20.tgz#4fd41f7e306b51d722d8a5a01123cf3d7eaea499"
-  integrity sha1-T9QffjBrUdci2KWgESPPPX6upJk=
-
-pdfjs-dist@^2.6.347:
-  version "2.6.347"
-  resolved "https://registry.npm.taobao.org/pdfjs-dist/download/pdfjs-dist-2.6.347.tgz#f257ed66e83be900cd0fd28524a2187fb9e25cd5"
-  integrity sha1-8lftZug76QDND9KFJKIYf7niXNU=
-
 performance-now@^2.1.0:
   version "2.1.0"
   resolved "https://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"

Some files were not shown because too many files changed in this diff