Prechádzať zdrojové kódy

feat: 完善微信端标讯详情页分享

cuiyalong 1 rok pred
rodič
commit
3e791c2d39

+ 2 - 1
apps/mobile/src/utils/mixins/modules/app-wx-share.js

@@ -64,6 +64,7 @@ export const appWxShareMixin = {
       }
     },
     refreshShareLink() {
+      if (!this.shareConf.pathname) return
       this.shareConf.link = this.shareConf.origin + this.shareConf.pathname
     },
     async getShareDomain() {
@@ -95,7 +96,7 @@ export const appWxShareMixin = {
           imgUrl: this.shareConf.imgUrl
         }
       })
-      console.log({
+      console.table({
         title: this.shareConf.title,
         desc: this.shareConf.content,
         link: this.shareConf.link,

+ 9 - 6
apps/mobile/src/views/article/content.vue

@@ -311,9 +311,9 @@ export default {
       return (this.$envs.inWX ? 'jy' : 'jyapp') + '-wxcontent-bottom'
     }
   },
-  created() {
+  async created() {
     this.appHeaderActions()
-    this.getPageState()
+    await this.getPageState()
     this.initAppWxShare()
   },
   mounted() {
@@ -504,7 +504,7 @@ export default {
       this.shareShow = true
     },
     async initAppWxShare() {
-      if (!this.$envs.inWX) {
+      if (this.$envs.inWX) {
         try {
           await this.getShareInfoReq()
         } catch (error) {
@@ -585,13 +585,16 @@ export default {
         link += `openid=${openid}&`
       }
       link += 'source=wx_infocontentshare'
-
+      
+      
       this.shareConf.title = title
       this.shareConf.content = content
-      // this.shareConf.pathname = link
       this.shareConf.link = link
+
+      // const url = new URL(link)
+      // this.shareConf.pathname = url.pathname
       // this.refreshShareLink()
-      // console.log(JSON.stringify(this.shareConf))
+      console.log(JSON.stringify(this.shareConf))
     },
     calcAppShareInfo(t) {
       const shareType = t.id