浏览代码

Merge branch 'main' into feature/v1.0.98

yuelujie 5 月之前
父节点
当前提交
2b654ed342

+ 79 - 46
apps/mobile/src/views/article/content.vue

@@ -14,7 +14,7 @@ small-tab
           class="j-main article-content-main"
           :class="{
             'show-underline': otherModel.hasProject,
-            'no-scroll': showBindPhone
+            'no-scroll': showBindPhone,
           }"
           @click="onScrollWrapperClick"
           @scroll.passive="onScroll"
@@ -325,13 +325,13 @@ export default {
   },
   computed: {
     ...mapState({
-      preAgentInfo: (state) => state.article.preAgentInfo,
-      content: (state) => state.article.mainModel.content,
-      summary: (state) => state.article.mainModel.summary,
-      mainModel: (state) => state.article.mainModel,
-      expandModel: (state) => state.article.expandModel,
-      otherModel: (state) => state.article.otherModel,
-      bindPhone: (state) => state.article.bindPhone
+      preAgentInfo: state => state.article.preAgentInfo,
+      content: state => state.article.mainModel.content,
+      summary: state => state.article.mainModel.summary,
+      mainModel: state => state.article.mainModel,
+      expandModel: state => state.article.expandModel,
+      otherModel: state => state.article.otherModel,
+      bindPhone: state => state.article.bindPhone
     }),
     IsCustomTopNet() {
       return this.content.IsCustomTopNet || false
@@ -373,7 +373,8 @@ export default {
           show: this.content.isCanRead, // 是否展示全部内容
           showContentModule: this.hasPowerToReadSunPublishContent
         }
-      } else {
+      }
+      else {
         return {
           show: this.content.isCanRead,
           showContentModule: true
@@ -399,10 +400,10 @@ export default {
       return this.mainModel.moduleShow
     },
     advancedModuleShow() {
-      const { tbService, customerRecommend, timeline, zbRecommend } =
-        this.expandModel.moduleShow
-      const toBCustom =
-        this.IsCustomTopNet || this.IsSunPublishContent || this.yyszbContent
+      const { tbService, customerRecommend, timeline, zbRecommend }
+        = this.expandModel.moduleShow
+      const toBCustom
+        = this.IsCustomTopNet || this.IsSunPublishContent || this.yyszbContent
       return Object.assign({}, this.expandModel.moduleShow, {
         tbService: toBCustom ? false : tbService,
         customerRecommend: toBCustom ? false : customerRecommend,
@@ -421,7 +422,8 @@ export default {
       // 如果是有权限用户(权限7),则有数据展示,无数据不展示。无权限7用户则一直展示,展示广告引导
       if (this.hasCustomerModulePower) {
         return this.advancedModuleShow.customerRecommend
-      } else {
+      }
+      else {
         return true
       }
     },
@@ -489,26 +491,31 @@ export default {
           }
           this.checkNpsView()
         })
-      } else {
+      }
+      else {
         try {
           await this.getPreAgentInfo()
           const { data, msg } = await this.getBaseInfo()
           if (data) {
             this.finishLoading()
-          } else {
+          }
+          else {
             this.finishLoading()
             this.isError = true
             // 无效参数 = d解析错误
             // 未查到当前招标信息 = 文章不存在
             if (msg.includes('未查到当前招标信息')) {
               this.errorText = '由于相关部门要求,该信息已下架,敬请原谅'
-            } else {
+            }
+            else {
               this.errorText = '该页面信息不存在'
             }
           }
-        } catch (error) {
+        }
+        catch (error) {
           console.error(error)
-        } finally {
+        }
+        finally {
           // console.log('基础接口请求完成')
         }
         if (this.canReadConf.show) {
@@ -519,19 +526,21 @@ export default {
     },
     changeTdk() {
       const { title, keywords, description } = this.content.tdk || {}
+      const { listShareTitle } = this.content
       this.setPageTdkCall({
         title,
         keywords,
         description
       })
-      this.setAMiniProgramShareTitle(title)
+      this.setAMiniProgramShareTitle(title, listShareTitle)
     },
-    setAMiniProgramShareTitle(title) {
+    setAMiniProgramShareTitle(title, otherTitle) {
       // if (!this.$envs.inWxMini) return
       let subType = ''
       try {
         subType = this.content?._ob?.subType
-      } catch (error) {
+      }
+      catch (error) {
         console.log(error)
       }
       let prefix = ''
@@ -539,7 +548,12 @@ export default {
         prefix = `【${subType}】`
       }
       const newTitle = prefix + title
-      this.postMessageToMiniProgram(newTitle)
+      if (otherTitle) {
+        this.postMessageToMiniProgram(otherTitle)
+      }
+      else {
+        this.postMessageToMiniProgram(newTitle)
+      }
     },
     postMessageToMiniProgram(title) {
       try {
@@ -551,7 +565,8 @@ export default {
             title
           }
         })
-      } catch (e) {
+      }
+      catch (e) {
         console.log(e)
       }
     },
@@ -563,7 +578,8 @@ export default {
     },
     appHeaderActions() {
       const { $envs } = this
-      if (!$envs.inApp) return
+      if (!$envs.inApp)
+        return
       if (this.yyszbContent) {
         return
       }
@@ -591,9 +607,11 @@ export default {
       // project-name事件委托
       if (checkUnderline.status) {
         this.clickKeywordUnderline(e)
-      } else if (e.target.classList.contains('free-view')) {
+      }
+      else if (e.target.classList.contains('free-view')) {
         this.clickFreeView(e)
-      } else if (e.target.className.includes('third-party-popover')) {
+      }
+      else if (e.target.className.includes('third-party-popover')) {
         this.popup.thirdPartyVerify = true
       }
     },
@@ -603,7 +621,8 @@ export default {
       const checkWinnerName = checkAncestorClass(e, 'winner-name', 3)
       if (checkProjectName.status) {
         this.goMemberFollowPage()
-      } else if (checkWinnerName.status) {
+      }
+      else if (checkWinnerName.status) {
         this.goToEntPortraitPage(checkWinnerName.target)
       }
     },
@@ -623,7 +642,8 @@ export default {
             industry: _ob ? _ob.buyerClass : undefined
           }
         })
-      } else {
+      }
+      else {
         openAppOrWxPage(LINKS.项目详情页)
       }
     },
@@ -634,11 +654,12 @@ export default {
         ?.replace(/\?/g, '%3F')
       if (!id) {
         return this.$toast('暂无数据')
-      } else {
-        const noPower =
-          !this.bigMemberPower.includes(4) &&
-          !this.bigMemberPower.includes(12) &&
-          !this.bigMemberPower.includes(13)
+      }
+      else {
+        const noPower
+          = !this.bigMemberPower.includes(4)
+            && !this.bigMemberPower.includes(12)
+            && !this.bigMemberPower.includes(13)
         if (this.isMember && noPower) {
           if (eName) {
             this.beforeLeavePage()
@@ -647,10 +668,12 @@ export default {
               app: LINKS.旧版企业信息前缀.app + eName,
               h5: LINKS.旧版企业信息前缀.h5 + eName
             })
-          } else {
+          }
+          else {
             return this.$toast('暂无数据')
           }
-        } else {
+        }
+        else {
           this.beforeLeavePage()
           sessionStorage.removeItem('$data-ent_portrait')
           openAppOrWxPage(LINKS.企业画像页面, {
@@ -689,12 +712,14 @@ export default {
       if (this.$envs.inWX) {
         try {
           await this.getShareInfoReq()
-        } catch (error) {
+        }
+        catch (error) {
           console.log(error)
         }
         await this.calcWxShareInfo()
         this.initShareMixin()
-      } else {
+      }
+      else {
         this.getShareInfoReq()
       }
     },
@@ -731,7 +756,8 @@ export default {
       if (window.location.href.includes('open_infocontent')) {
         const query = window.location.search.slice(1)
         link += `${query}`
-      } else {
+      }
+      else {
         link += '&source=wx_infocontentshare'
       }
 
@@ -748,19 +774,22 @@ export default {
             subhref = `${add1}/content/${encryptid}${add2}`
             this.wxShareCache.subhref = subhref
           }
-        } catch (error) {
+        }
+        catch (error) {
           console.warn(error)
         }
       }
 
       if (encryptid) {
         link = subhref
-      } else {
+      }
+      else {
         link = window.location.href
       }
       if (!link.includes('?')) {
         link += '?'
-      } else {
+      }
+      else {
         link += '&'
       }
       if (!encryptid) {
@@ -805,12 +834,14 @@ export default {
           link += `${location.search}&source=app_infocontentshare&from=${
             this.shareInfoRes.userId || ''
           }`
-        } else {
+        }
+        else {
           link += `?source=app_infocontentshare&from=${
             this.shareInfoRes.userId || ''
           }`
         }
-      } else if (shareType === 3) {
+      }
+      else if (shareType === 3) {
         // 分享到朋友圈
         link += '&qrcodeType=app_infocontent_timeline_z'
         shareTitle = this.getRandomShareText()
@@ -822,7 +853,8 @@ export default {
       // this.shareConf.link = link
       if (this.$envs.inApp && shareToWx) {
         this.refreshShareLink(this.domainConf.wx)
-      } else {
+      }
+      else {
         this.refreshShareLink()
       }
     },
@@ -845,7 +877,8 @@ export default {
     },
     checkNpsView() {
       const targetVm = this.$refs.npsCard
-      if (!targetVm) return
+      if (!targetVm)
+        return
       const target = targetVm.$el
       const scrollWrapper = this.$refs.scrollWrapper
       const visible = isElementInScrollArea(target, scrollWrapper)

+ 20 - 2
apps/mobile/src/views/search/result/sun/index.vue

@@ -1540,6 +1540,22 @@ export default {
         console.log(error)
       }
       if (!this.isLogin) {
+        if (this.$envs.inWxMini) {
+          const targetMiniAppMap = {
+            wx: `/nologin/content/${id}.html?${qs.stringify(query)}`,
+            app: `/nologin/content/${id}.html?${qs.stringify(query)}`
+          }
+          openAppOrWxPage(targetMiniAppMap)
+          // try {
+          //   wx.miniProgram.navigateTo({
+          //     url: `/pages/search/content/bidding/index?q=${qs.stringify(query)}&time=${Date.now()}&id=${id}`
+          //   })
+          // } catch (e) {
+          //   console.log(e)
+          // }
+          return false
+        }
+
         return openLinkOfOther(LINKS.APP登录页.app, {
           query: {
             url: this.$envs.inWX ? targetMap.wx : targetMap.app
@@ -2394,7 +2410,8 @@ export default {
   border-radius: 8px;
   border: 1px solid transparent;
   background-clip: padding-box, border-box;
-  background-image: linear-gradient(#e8ffff 40%, #ffffff 100%),
+  background-image:
+    linear-gradient(#e8ffff 40%, #ffffff 100%),
     linear-gradient(to right, #2abed1, #4de4f84c, #2abed1);
   background-origin: padding-box, border-box;
   .tab-right {
@@ -2590,7 +2607,8 @@ export default {
   color: #171826;
   border: 0.5px solid transparent;
   background-clip: padding-box, border-box;
-  background-image: linear-gradient(#e8ffff 40%, #ffffff 100%),
+  background-image:
+    linear-gradient(#e8ffff 40%, #ffffff 100%),
     linear-gradient(to right, #2abed1 10%, #4de4f84c 30%, #2abed1);
   background-origin: padding-box, border-box;
   border-radius: 8px;

+ 30 - 16
data/data-models/modules/article/transform/content.js

@@ -44,6 +44,7 @@ class CommonContentModel extends BaseModel {
   formatModel(data) {
     const result = this.createModel()
     const { baseInfo, detailInfo, abstract } = data
+    const fromSunList = getQueryParam('fromlist') === 'sun'
     result.id = baseInfo.id ? decodeURIComponent(baseInfo.id) : ''
     result.title = baseInfo.title
     result.projectName = baseInfo?.projectName
@@ -77,10 +78,17 @@ class CommonContentModel extends BaseModel {
     result.yyszbContent = location.pathname.includes('/yyszb')
     result.bId = baseInfo.bId || ''
 
+    // 阳光直采过来的小程序分享标题处理
+    if (fromSunList) {
+      result.listShareTitle = this.getSunListTitle([baseInfo.id, result.id])
+    }
     if (result.IsSunPublishContent) {
       // 处理拆条信息
-      const changedTitle = this.changeChaiTitle(baseInfo, abstract, result)
-      result.changedTitle = changedTitle
+      const changedTitle = this.changeChaiTitle(abstract, result.listShareTitle)
+      if (changedTitle) {
+        result.title = changedTitle
+        result.changedTitle = changedTitle
+      }
     }
 
     // TDK
@@ -224,25 +232,31 @@ class CommonContentModel extends BaseModel {
   }
 
   // 处理拆条信息:详情页中需要判断purchasingList长度>1,就使用列表页标题+‘等’。
-  changeChaiTitle(baseInfo, abstract, result) {
-    const key = 'sun_list_info_clicked'
+  changeChaiTitle(abstract, title) {
     const purchasingList = abstract?.default?.purchasingList
     if (Array.isArray(purchasingList) && purchasingList.length > 0) {
-      const saved = sessionStorage.getItem(key)
-      if (saved) {
-        const list = JSON.parse(saved)
-        if (Array.isArray(list)) {
-          const r = list.find(
-            item => item.id === baseInfo.id || item.id === result.id
-          )
-          // console.log(r)
-          if (r && r.title) {
-            result.title = r.title
-            return true
-          }
+      if (title) {
+        return title
+      }
+    }
+    return ''
+  }
+
+  getSunListTitle(idArr = []) {
+    const key = 'sun_list_info_clicked'
+    const saved = sessionStorage.getItem(key)
+    if (saved) {
+      const list = JSON.parse(saved)
+      if (Array.isArray(list)) {
+        const r = list.find(
+          item => idArr.includes(item.id)
+        )
+        if (r && r.title) {
+          return r.title
         }
       }
     }
+    return ''
   }
 }