Quellcode durchsuchen

Merge branch 'main' into feature/v1.0.34

lianbingjie vor 1 Jahr
Ursprung
Commit
e353bdb8e1

+ 15 - 6
apps/bigmember_pc/src/views/article-content/components/ContentHeader.vue

@@ -89,12 +89,20 @@ const isUseBIActions =
       <span v-html="ContentModel.titleHighlighted"></span>
     </h1>
     <div class="tags">
-      <a
-        :href="item.link"
-        v-for="(item, index) in ContentModel.tags"
-        :key="index"
-        >{{ item.label }}</a
-      >
+      <template v-for="(item, index) in ContentModel.tags">
+        <a
+          v-if="item.hasLink"
+          target="_blank"
+          class="pointer"
+          :href="item.link"
+          :key="index"
+        >
+          {{ item.label }}
+        </a>
+        <a v-else :key="index + 'no-link'">
+          {{ item.label }}
+        </a>
+      </template>
     </div>
     <div class="actions-info">
       <div class="time-label">{{ ContentModel.time }}</div>
@@ -293,6 +301,7 @@ const isUseBIActions =
     font-weight: 400;
     line-height: 18px;
     text-decoration: none;
+    &:not([href]),
     &[href*='javascript'] {
       cursor: unset;
     }

+ 10 - 0
apps/mobile/src/api/modules/article.js

@@ -49,3 +49,13 @@ export function getArticleOriginalText(data) {
     data
   })
 }
+
+
+// 三级页分享相关接口
+export function getContentShareEncrypt(data) {
+  return request({
+    url: '/share/encrypt',
+    method: 'post',
+    data: qs.stringify(data)
+  })
+}

+ 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,

+ 90 - 13
apps/mobile/src/views/article/content.vue

@@ -166,7 +166,7 @@ import FreeUserAdvancedMask from '@/views/article/components/FreeUserAdvancedMas
 import ThirdPartyVerifyPopup from '@/views/article/components/ThirdPartyVerifyPopup.vue'
 import { throttle } from 'lodash'
 import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
-import { getArticleShareInfo } from '@/api/modules/article'
+import { getArticleShareInfo, getContentShareEncrypt } from '@/api/modules/article'
 import { LINKS } from '@/data'
 import { openAppOrWxPage } from '@/utils/'
 import setPageTdk from '@/utils/mixins/modules/set-tdk'
@@ -256,6 +256,10 @@ export default {
       popup: {
         thirdPartyVerify: false
       },
+      wxShareCache: {
+        encryptid: '',
+        subhref: ''
+      },
       pageState: {
         id: '',
         tabActive: ''
@@ -271,6 +275,9 @@ export default {
       expandModel: (state) => state.article.expandModel,
       otherModel: (state) => state.article.otherModel
     }),
+    openid() {
+      return this.preAgentInfo.openid
+    },
     ...mapGetters('user', [
       'isLogin',
       'isSuper',
@@ -304,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() {
@@ -496,9 +503,14 @@ export default {
     doShare() {
       this.shareShow = true
     },
-    initAppWxShare() {
+    async initAppWxShare() {
       if (this.$envs.inWX) {
-        this.calcWxShareInfo()
+        try {
+          await this.getShareInfoReq()
+        } catch (error) {
+          console.log(error)
+        }
+        await this.calcWxShareInfo()
         this.initShareMixin()
       } else {
         this.getShareInfoReq()
@@ -514,21 +526,86 @@ export default {
         this.shareInfoRes = data
       }
     },
-    calcWxShareInfo() {
-      this.shareConf.title = this.getRandomShareText()
-      this.shareConf.content = '全国招标信息免费看,不遮挡'
-      this.shareConf.pathname = '/swordfish/about'
+    async calcWxShareInfo() {
+      const host = location.host
+      const id = this.content.id
+      const openid = this.openid ? encodeURIComponent(this.openid) : '-1'
+
+      // 计算title
+      const title = this.content.title
+        .replace(/<\/?.+?>/g, '')
+        .replace(/ /g, '')
+
+      // 计算content
+      const contentList = ['您的好友']
+      // 分享到微信或者朋友圈带上昵称
+      if (this.shareInfoRes.nickname) {
+        contentList.push(this.shareInfoRes.nickname)
+      }
+      contentList.push('向您推荐了剑鱼标讯')
+      const content = contentList.join('')
+
+      let link = `${host}/swordfish/about?param=${openid}__jy_extend&qrcodeType=wx_infocontent_timeline_z`
+      if (window.location.href.indexOf('open_infocontent') > -1) {
+        const query = window.location.search.slice(1)
+        link += `${query}`
+      } else {
+        link += '&source=wx_infocontentshare'
+      }
+
+      let subhref = location.href
+      let encryptid = ''
+      if (id) {
+        try {
+          const data = await getContentShareEncrypt({ id })
+          if(data.flag === 'T'){
+            encryptid = data.sid_openid
+            this.wxShareCache.encryptid = encryptid
+            var add1 = subhref.substring(0,subhref.indexOf('/content/'))
+            var add2 = subhref.substring(subhref.indexOf('.html'))
+            subhref = add1 + '/content/' + encryptid + add2
+            this.wxShareCache.subhref = subhref
+          }
+        } catch (error) {
+          console.warn(error)
+        }
+      }
+
+      if (encryptid) {
+        link = subhref
+      } else {
+        link = window.location.href
+      }
+      if (link.indexOf('?') === -1){
+        link += '?'
+      } else {
+        link += '&'
+      }
+      if(!encryptid){
+        link += `openid=${openid}&`
+      }
+      link += 'source=wx_infocontentshare'
+      
+      
+      this.shareConf.title = title
+      this.shareConf.content = content
+      this.shareConf.link = link
+
+      // const url = new URL(link)
+      // this.shareConf.pathname = url.pathname
+      // this.refreshShareLink()
+      console.log(JSON.stringify(this.shareConf))
     },
     calcAppShareInfo(t) {
       const shareType = t.id
 
-      const titleList = ['您的好友']
+      const contentList = ['您的好友']
       // 分享到微信或者朋友圈带上昵称
       if (this.shareInfoRes.nickname && shareType !== 2) {
-        titleList.push(this.shareInfoRes.nickname)
+        contentList.push(this.shareInfoRes.nickname)
       }
-      titleList.push('向您推荐了剑鱼标讯')
-      const content = titleList.join('')
+      contentList.push('向您推荐了剑鱼标讯')
+      const content = contentList.join('')
 
       let link = `/swordfish/about?source=app_infocontentshare&from=${
         this.shareInfoRes.userId || ''

+ 1 - 1
apps/mobile/src/views/article/index.vue

@@ -224,7 +224,7 @@ export default {
   data() {
     return {
       conf: {
-        type: ''
+        type: 'issued'
       },
       matchKeys: [],
       contentId: '',

+ 7 - 1
data/data-models/modules/article/transform/content.js

@@ -128,7 +128,13 @@ class CommonContentModel extends BaseModel {
       amountItem
     ].filter((v) => v.label)
 
-    return tags
+    return tags.map((t) => {
+      return {
+        ...t,
+        // 是否有正确格式的链接
+        hasLink: t.link !== defaultURL
+      }
+    })
   }
 
   // 获取url高亮字符, 并截取