Browse Source

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

zhangyuhan 4 years ago
parent
commit
b071e03b62

+ 2 - 1
jydocs-mobile/src/api/main.ts

@@ -92,7 +92,8 @@ export function getRemove (data: any) {
 export function getCoin (data: any) {
   console.log(data)
   return $request({
-    url: '/jyintegral/getList',
+    baseURL: '/jyintegral',
+    url: '/getList',
     method: 'post',
     data
   })

+ 16 - 7
jydocs-mobile/src/components/SharePopup.vue

@@ -13,11 +13,11 @@
             <span class="share_detail">了解详情</span>
         </div>
         <div class="share_channel">
-            <div class="share_c_wx share_out">
+            <div class="share_c_wx share_out" @click="wxShare('1')">
                 <img src="../assets/icon/weixin.png" class="share_out_img" alt="">
                 <span class="wx_text out_text">微信</span>
             </div>
-            <div class="share_c_pyq share_out">
+            <div class="share_c_pyq share_out" @click="wxShare('3')">
                 <img src="../assets/icon/pengyouquan.png" class="share_out_img" alt="">
                 <span class="pyq_text out_text">朋友圈</span>
             </div>
@@ -26,8 +26,9 @@
 </template>
 
 <script lang="ts">
-import { Component, Vue } from 'vue-property-decorator'
+import { Component, Prop, Vue } from 'vue-property-decorator'
 import { Icon, Popup, Sticky } from 'vant'
+import { shareToOthers } from '@/utils/globalFunctionsForApp'
 
 // @ is an alias to /src
   @Component({
@@ -36,16 +37,24 @@ import { Icon, Popup, Sticky } from 'vant'
       [Popup.name]: Popup,
       [Sticky.name]: Sticky,
       [Icon.name]: Icon
-    },
-    created () {
-      console.log('111')
     }
   })
 export default class extends Vue {
-    show = true
+    @Prop() links: any
+    @Prop() detailData: any
+    show = false
     closePopup () {
       this.show = false
     }
+
+    wxShare (num: string) {
+      shareToOthers({
+        type: num, // options.type--1微信分享,2qq分享,3朋友圈分享
+        title: this.detailData.docName,
+        content: this.detailData.docSummary,
+        link: this.links.url
+      })
+    }
 }
 </script>
 

+ 2 - 1
jydocs-mobile/src/router/modules/main.ts

@@ -28,7 +28,8 @@ export default [
     name: 'details',
     component: () => import('@/views/details/details.vue'),
     meta: {
-      title: '文库详情'
+      title: '文库详情',
+      layoutConf: true
     }
   },
   {

+ 1 - 0
jydocs-mobile/src/store/index.ts

@@ -66,6 +66,7 @@ export default new Vuex.Store({
       for (const key in conf) {
         state.layoutConf[key] = conf[key]
       }
+      console.log(state.layoutConf)
     },
     // 将数据恢复默认状态
     clearLayoutConfig (state: any) {

+ 8 - 0
jydocs-mobile/src/store/modules/main.ts

@@ -12,6 +12,7 @@ import {
   getRemove,
   getAdd,
   getCoin,
+  getShare,
   getDocPay,
   getIndexTags
 } from '@/api/main'
@@ -180,6 +181,13 @@ const modulesOption: modulesOption = {
         return res.data
       } catch (error) {}
     },
+    async getShare (state, data) {
+      try {
+        const res = await getShare(data)
+        console.log(res)
+        return res.data
+      } catch (error) {}
+    },
     // 文库购买
     async getDocPay (state, data) {
       try {

+ 1 - 1
jydocs-mobile/src/utils/globalFunctionsForApp.ts

@@ -26,7 +26,7 @@ export function shareToOthers (options: any = {}) {
     // app分享
     try {
       // options.type--1微信分享,2qq分享,3朋友圈分享
-      JyObj.share(options.type, options.title, options.link)
+      JyObj.share(options.type, options.title, options.content, options.link)
     } catch (error) {
       console.log(error)
     }

+ 1 - 1
jydocs-mobile/src/utils/mixin-top.ts

@@ -17,7 +17,7 @@ export const MixinTop = {
   },
   beforeRouteEnter (to: any, form: any, next: any) {
     next((vm: any) => {
-      console.log(vm.TopConfig.actionRightCallback)
+      console.log(vm.TopConfig)
       vm.upTopConfig()
     })
   },

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

@@ -29,8 +29,8 @@
         </van-goods-action>
         <!-- 充值 -->
         <recharge ref="charge" :detailData="detailData" :coins="coins"></recharge>
-        <!-- 购买 -->
-        <purchase ref="buys" :detailData="detailData" :coins="coins"></purchase>
+        <!-- 分享 -->
+        <share-pop ref="shares" :detailData="detailData" :links="links"></share-pop>
     </div>
 </template>
 
@@ -39,22 +39,26 @@ import { Component, Vue } from 'vue-property-decorator'
 import { mapActions } from 'vuex'
 import { Icon, Toast, GoodsAction, GoodsActionIcon, GoodsActionButton } from 'vant'
 import Recharge from '@/components/Recharge.vue'
-import Purchase from '@/components/RechargeHave.vue'
+import sharePop from '@/components/SharePopup.vue'
+import { MixinTop } from '@/utils/mixin-top'
+
 @Component({
   name: 'details-p',
+  mixins: [MixinTop],
   components: {
     [Icon.name]: Icon,
     [GoodsAction.name]: GoodsAction,
     [GoodsActionIcon.name]: GoodsActionIcon,
     [GoodsActionButton.name]: GoodsActionButton,
     Recharge,
-    Purchase
+    sharePop
   },
   methods: {
     ...mapActions({
       getDetails: 'main/getDetails',
       getShow: 'main/getShow',
       getCoin: 'main/getCoin',
+      getShare: 'main/getShare',
       getAdd: 'main/getAdd',
       getRemove: 'main/getRemove'
     })
@@ -64,6 +68,8 @@ export default class extends Vue {
   getDetails: any
   getCoin: any
   getShow: any
+  getShare: any
+  links: any = []
   docIds = ''
   coins: any = []
   conts: any = []
@@ -83,6 +89,16 @@ export default class extends Vue {
     heightList: []
   }
 
+  TopConfig: any = {
+    actionRightText: '<div style="display:flex;flex-direction: column;align-items: center;"><img src="https://app3-jytest.jydev.jianyu360.com/jyapp/images/hongbao.png?v=9629" width="24" height="24"><p style="color: #171826;font-size: 10px;line-height: 12px;margin-top:3px;">分享赚积分</p></div>',
+    actionRightCallback: this.shared,
+    actionRightStyle: {
+      color: '#5F5E64',
+      fontSize: '20px',
+      paddingLeft: '10px'
+    }
+  }
+
   created () {
     this.docIds = this.$route.params.id
     // this.docIds = '19d53d64-8890-11eb-8699-0050568f51e7'
@@ -98,6 +114,14 @@ export default class extends Vue {
     window.removeEventListener('scroll', this.watchPage)
   }
 
+  shared () {
+    ;(this.$refs.shares as any).show = true
+    this.getShare({ docId: this.docIds }).then((res: any) => {
+      console.log(res)
+      this.links = res.data
+    })
+  }
+
   // updateText (type: any, value = '') {
   //   switch (type) {
   //     case 'count': {
@@ -162,7 +186,7 @@ export default class extends Vue {
       console.log(res.data)
       this.detailData = res.data.detail
       this.buyed = res.data.status
-      this.collectd = res.data.docCang
+      this.collectd = res.data.collect
     })
     this.getCoin({ B: true }).then((res: any) => {
       console.log(res.data.data)
@@ -206,13 +230,15 @@ export default class extends Vue {
   }
 
   uploaded () {
+    Toast('点击按钮')
     if (this.buyed === 1) {
       this.$router.push('/')
     } else {
+      console.log('111')
       if (this.coins.balance < this.detailData.price) {
         ;(this.$refs.charge as any).show = true
       } else {
-        ;(this.$refs.buys as any).show = true
+        this.$router.push({ path: '/purchase', query: { id: this.detailData.docId } })
       }
     }
   }
@@ -243,6 +269,7 @@ export default class extends Vue {
 @include diy-icon('jubao', 20, 20);
 @include diy-icon('weiguanzhu', 20, 20);
 @include diy-icon('guanzhu', 20, 20);
+@include diy-icon('iconJianYu', 24, 24);
 .details-p {
     display: flex;
     flex-direction: column;
@@ -254,6 +281,7 @@ export default class extends Vue {
         h3 {
             display: flex;
             flex-direction: initial;
+            width: 100%;
             color: #171826;
             font-weight: 500;
             font-size: 20px;

+ 1 - 1
jydocs-mobile/vue.config.js

@@ -54,7 +54,7 @@ module.exports = {
         }
       },
       '^/jydocs': {
-        target: '192.168.20.180:821',
+        target: 'http://192.168.20.180:821',
         changeOrigin: true,
         logLevel: 'debug',
         pathRewrite: {

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

@@ -103,7 +103,7 @@ export default {
       conts: [],
       adsUrl: [],
       coinNum: 0,
-      btnName: '',
+      btnName: '下载文档',
       buyed: false,
       collectd: 0,
       offsetTop: 0,
@@ -126,7 +126,6 @@ export default {
   },
   created () {
     this.docIds = this.$route.params.id
-    // this.docIds = '19d53d64-8890-11eb-8699-0050568f51e7'
     this.locaHref = window.location.origin
     this.setTop()
     this.adverse()

+ 60 - 5
jydocs-pc/yarn.lock

@@ -930,6 +930,13 @@
   resolved "https://registry.npm.taobao.org/@nodelib/fs.stat/download/@nodelib/fs.stat-1.1.3.tgz?cache=0&sync_timestamp=1609076382094&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40nodelib%2Ffs.stat%2Fdownload%2F%40nodelib%2Ffs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
   integrity sha1-K1o6s/kYzKSKjHVMCBaOPwPrphs=
 
+"@rkusa/linebreak@^1.0.0":
+  version "1.0.0"
+  resolved "https://registry.npm.taobao.org/@rkusa/linebreak/download/@rkusa/linebreak-1.0.0.tgz#987b6b1f8cc8f5901afbf45f4e9f7744518d0163"
+  integrity sha1-mHtrH4zI9ZAa+/RfTp93RFGNAWM=
+  dependencies:
+    unicode-trie "^0.3.0"
+
 "@soda/friendly-errors-webpack-plugin@^1.7.1":
   version "1.8.0"
   resolved "https://registry.npm.taobao.org/@soda/friendly-errors-webpack-plugin/download/@soda/friendly-errors-webpack-plugin-1.8.0.tgz?cache=0&sync_timestamp=1607927418007&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40soda%2Ffriendly-errors-webpack-plugin%2Fdownload%2F%40soda%2Ffriendly-errors-webpack-plugin-1.8.0.tgz#84751d82a93019d5c92c0cf0e45ac59087cd2240"
@@ -6125,6 +6132,14 @@ opener@^1.5.1:
   resolved "https://registry.npm.taobao.org/opener/download/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598"
   integrity sha1-XTfh81B3udysQwE3InGv3rKhNZg=
 
+opentype.js@^1.3.3:
+  version "1.3.3"
+  resolved "https://registry.npm.taobao.org/opentype.js/download/opentype.js-1.3.3.tgz#65b8645b090a1ad444065b784d442fa19d1061f6"
+  integrity sha1-ZbhkWwkKGtREBlt4TUQvoZ0QYfY=
+  dependencies:
+    string.prototype.codepointat "^0.2.1"
+    tiny-inflate "^1.0.3"
+
 opn@^5.5.0:
   version "5.5.0"
   resolved "https://registry.npm.taobao.org/opn/download/opn-5.5.0.tgz#fc7164fab56d235904c51c3b27da6758ca3b9bfc"
@@ -6247,7 +6262,12 @@ p-try@^2.0.0:
   resolved "https://registry.npm.taobao.org/p-try/download/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
   integrity sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=
 
-pako@~1.0.5:
+pako@^0.2.5:
+  version "0.2.9"
+  resolved "https://registry.npm.taobao.org/pako/download/pako-0.2.9.tgz?cache=0&sync_timestamp=1610208924218&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpako%2Fdownload%2Fpako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75"
+  integrity sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=
+
+pako@^1.0.11, pako@~1.0.5:
   version "1.0.11"
   resolved "https://registry.npm.taobao.org/pako/download/pako-1.0.11.tgz?cache=0&sync_timestamp=1610208924218&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpako%2Fdownload%2Fpako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
   integrity sha1-bJWZ00DVTf05RjgCUqNXBaa5kr8=
@@ -6420,10 +6440,17 @@ 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@^2.4.2:
+  version "2.4.2"
+  resolved "https://registry.npm.taobao.org/pdfjs/download/pdfjs-2.4.2.tgz#0a7db302a971e463c134c9f36d57ad56cb8bbe4b"
+  integrity sha1-Cn2zAqlx5GPBNMnzbVetVsuLvks=
+  dependencies:
+    "@rkusa/linebreak" "^1.0.0"
+    opentype.js "^1.3.3"
+    pako "^1.0.11"
+    readable-stream "^3.6.0"
+    unorm "^1.6.0"
+    uuid "^8.3.1"
 
 pdfjs-dist@^2.6.347:
   version "2.6.347"
@@ -7906,6 +7933,11 @@ string-width@^4.1.0, string-width@^4.2.0:
     is-fullwidth-code-point "^3.0.0"
     strip-ansi "^6.0.0"
 
+string.prototype.codepointat@^0.2.1:
+  version "0.2.1"
+  resolved "https://registry.npm.taobao.org/string.prototype.codepointat/download/string.prototype.codepointat-0.2.1.tgz#004ad44c8afc727527b108cd462b4d971cd469bc"
+  integrity sha1-AErUTIr8cnUnsQjNRitNlxzUabw=
+
 string.prototype.trimend@^1.0.4:
   version "1.0.4"
   resolved "https://registry.npm.taobao.org/string.prototype.trimend/download/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80"
@@ -8170,6 +8202,11 @@ timsort@^0.3.0:
   resolved "https://registry.npm.taobao.org/timsort/download/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4"
   integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=
 
+tiny-inflate@^1.0.0, tiny-inflate@^1.0.3:
+  version "1.0.3"
+  resolved "https://registry.npm.taobao.org/tiny-inflate/download/tiny-inflate-1.0.3.tgz#122715494913a1805166aaf7c93467933eea26c4"
+  integrity sha1-EicVSUkToYBRZqr3yTRnkz7qJsQ=
+
 tmp@^0.0.33:
   version "0.0.33"
   resolved "https://registry.npm.taobao.org/tmp/download/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
@@ -8355,6 +8392,14 @@ unicode-property-aliases-ecmascript@^1.0.4:
   resolved "https://registry.npm.taobao.org/unicode-property-aliases-ecmascript/download/unicode-property-aliases-ecmascript-1.1.0.tgz#dd57a99f6207bedff4628abefb94c50db941c8f4"
   integrity sha1-3Vepn2IHvt/0Yoq++5TFDblByPQ=
 
+unicode-trie@^0.3.0:
+  version "0.3.1"
+  resolved "https://registry.npm.taobao.org/unicode-trie/download/unicode-trie-0.3.1.tgz#d671dddd89101a08bac37b6a5161010602052085"
+  integrity sha1-1nHd3YkQGgi6w3tqUWEBBgIFIIU=
+  dependencies:
+    pako "^0.2.5"
+    tiny-inflate "^1.0.0"
+
 union-value@^1.0.0:
   version "1.0.1"
   resolved "https://registry.npm.taobao.org/union-value/download/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847"
@@ -8394,6 +8439,11 @@ universalify@^0.1.0:
   resolved "https://registry.npm.taobao.org/universalify/download/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
   integrity sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY=
 
+unorm@^1.6.0:
+  version "1.6.0"
+  resolved "https://registry.npm.taobao.org/unorm/download/unorm-1.6.0.tgz#029b289661fba714f1a9af439eb51d9b16c205af"
+  integrity sha1-ApsolmH7pxTxqa9DnrUdmxbCBa8=
+
 unpipe@1.0.0, unpipe@~1.0.0:
   version "1.0.0"
   resolved "https://registry.npm.taobao.org/unpipe/download/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
@@ -8516,6 +8566,11 @@ uuid@^3.3.2, uuid@^3.4.0:
   resolved "https://registry.npm.taobao.org/uuid/download/uuid-3.4.0.tgz?cache=0&sync_timestamp=1607460077975&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuuid%2Fdownload%2Fuuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
   integrity sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4=
 
+uuid@^8.3.1:
+  version "8.3.2"
+  resolved "https://registry.npm.taobao.org/uuid/download/uuid-8.3.2.tgz?cache=0&sync_timestamp=1607460077975&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuuid%2Fdownload%2Fuuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
+  integrity sha1-gNW1ztJxu5r2xEXyGhoExgbO++I=
+
 v8-compile-cache@^2.0.3:
   version "2.3.0"
   resolved "https://registry.npm.taobao.org/v8-compile-cache/download/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"