Browse Source

feat: 移动端详情页高亮页面点击

cuiyalong 1 year ago
parent
commit
8d05a14494

+ 17 - 2
apps/mobile/src/composables/quick-monitor/component/QuickMonitor.vue

@@ -42,6 +42,7 @@ import { reactive, toRefs, toRef } from 'vue'
 import { mapGetters } from 'vuex'
 import { LINKS } from '@/data'
 import { openAppOrWxPage } from '@/utils/'
+import { cloneDeep } from 'lodash'
 
 const confMap = {
   project: {
@@ -138,8 +139,12 @@ export default {
     const { doFetch, doChange } = useMonitor
 
     if (props.auto) {
-      doFetch().then((res) => {
-        emit('afterFetch', res)
+      doFetch().finally(() => {
+        emit('initd', {
+          model: cloneDeep(model.value),
+          id: props.id,
+          fid: fid?.value
+        })
       })
     }
 
@@ -345,13 +350,23 @@ export default {
         this.syncValue(true)
       } catch (error) {
         loading.clear()
+      } finally {
+        this.emitChange()
       }
     },
+    emitChange() {
+      this.$emit('change', {
+        model: cloneDeep(this.model),
+        id: this.id,
+        fid: this.fid
+      })
+    },
     // 取消监控
     async doCancelMonitor() {
       const loading = this.$toast.loading()
       const { success, msg } = await this.doChange()
       if (success) {
+        this.emitChange()
         console.log('取消监控成功')
       } else {
         console.log('取消监控失败', msg)

+ 7 - 0
apps/mobile/src/data/links.js

@@ -49,6 +49,11 @@ export const LINKS = {
     h5: '/jyapp/article/content/',
     wx: '/article/content/'
   },
+  旧版企业信息前缀: {
+    app: '/jyapp/followent/newInfo/',
+    h5: '/jyapp/followent/newInfo/',
+    wx: '/jylab/followent/newInfo/'
+  },
   订阅管理页面: {
     app: '/jyapp/vipsubscribe/toSubVipSetPage',
     h5: '/jyapp/vipsubscribe/toSubVipSetPage',
@@ -158,11 +163,13 @@ export const LINKS = {
     h5: '/jyapp/big/page/pro_follow_list',
     wx: '/big/wx/page/pro_follow_list'
   },
+  // 商机管理项目详情
   项目信息: {
     app: '/jyapp/big/page/client_follow_detail',
     h5: '/jyapp/big/page/client_follow_detail',
     wx: '/big/wx/page/pro_follow_detail'
   },
+  // 大会员以及其他用户项目详情
   项目详情页: {
     app: '/jyapp/big/page/pro_follow_detail',
     h5: '/jyapp/big/page/pro_follow_detail',

+ 6 - 4
apps/mobile/src/store/modules/article.js

@@ -28,7 +28,9 @@ const defaultValueMap = {
   otherModel: {
     hasProject: false, // 当前标讯是否关联有项目,如果有,则可以点击查看项目信息
     forecastShow: false, // 是否显示中标企业预测
-    // 项目关注标签
+    // 项目关注状态同步
+    projectFollowState: {},
+    // 项目收藏标签
     collectionTags: [],
     // 参标人列表
     inBiddingPersonList: []
@@ -171,7 +173,7 @@ export default {
           console.log(msg)
         }
       } catch (error) {
-        console.log(error)
+        console.error(error)
       }
     },
     async getBaseInfo({ commit, state }) {
@@ -190,7 +192,7 @@ export default {
           console.log(msg)
         }
       } catch (error) {
-        console.log(error)
+        console.error(error)
       }
     },
     async getAdvancedInfo({ commit, state }) {
@@ -210,7 +212,7 @@ export default {
           console.log(msg)
         }
       } catch (error) {
-        console.log(error)
+        console.error(error)
       }
     }
   },

+ 8 - 2
apps/mobile/src/views/article/components/TabActions.vue

@@ -8,7 +8,8 @@
       :cache="true"
       :auto="true"
       popover
-      @afterFetch="afterMonitorFetch"
+      @initd="afterMonitorFetch"
+      @change="afterMonitorFetch"
     />
     <ActionShareToWorkmate class="tab-action" :id="id" />
     <ActionInBidding v-if="false" class="tab-action" :id="id" />
@@ -79,7 +80,12 @@ export default {
     },
     showForecast() {},
     afterMonitorFetch(payload) {
-      if (payload.canFollow) {
+      // console.log(payload)
+      this.setOtherModelChild({
+        key: 'projectFollowState',
+        data: payload
+      })
+      if (payload.model && payload.model.canFollow) {
         this.showForecast()
         this.removeHideUnderline()
       }

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

@@ -4,6 +4,7 @@
       <div
         class="j-main article-content-main"
         :class="{ 'show-underline': otherModel.hasProject }"
+        @click="onScrollWrapperClick"
         ref="scrollWrapper"
         @scroll.passive="onScroll"
       >
@@ -115,8 +116,9 @@ import FreeUserBiddingMask from '@/views/article/components/FreeUserBiddingMask.
 import FreeUserAdvancedMask from '@/views/article/components/FreeUserAdvancedMask.vue'
 import { throttle } from 'lodash'
 import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
-
 import { getArticleShareInfo } from '@/api/modules/article'
+import { LINKS } from '@/data'
+import { openAppOrWxPage } from '@/utils/'
 
 export default {
   name: 'ArticleContent',
@@ -207,7 +209,13 @@ export default {
       expandModel: (state) => state.article.expandModel,
       otherModel: (state) => state.article.otherModel
     }),
-    ...mapGetters('user', ['isLogin', 'isSuper', 'isMember', 'isNewBusiness']),
+    ...mapGetters('user', [
+      'isLogin',
+      'isSuper',
+      'isMember',
+      'isNewBusiness',
+      'bigMemberPower'
+    ]),
     canRead() {
       return this.content.isCanRead
     },
@@ -235,7 +243,6 @@ export default {
       this.getParams()
       await this.getPreAgentInfo()
       await this.getBaseInfo()
-      this.checkProject()
       if (this.canRead) {
         this.getAdvancedInfo()
       }
@@ -267,6 +274,72 @@ export default {
         }
       }
     },
+    onScrollWrapperClick(e) {
+      // project-name事件委托
+      if (e.target.classList.contains('keyword-underline')) {
+        this.clickKeywordUnderline(e)
+      }
+    },
+    // 页面下划线高内容亮事件委托
+    clickKeywordUnderline(e) {
+      const target = e.target
+      if (target.classList.contains('project-name')) {
+        this.goMemberFollowPage()
+      } else if (target.classList.contains('winner-name')) {
+        this.goToEntPortraitPage(target)
+      }
+    },
+    goMemberFollowPage() {
+      const { _ob } = this.content || {}
+      const { fid, id } = this.otherModel.projectFollowState || {}
+      const params = {
+        fid,
+        sid: id
+      }
+      sessionStorage.setItem('bigvip-fid', JSON.stringify(params))
+      if (this.isNewBusiness) {
+        openAppOrWxPage(LINKS.项目信息, {
+          query: {
+            from: 'client',
+            industry: _ob ? _ob.buyerClass : undefined
+          }
+        })
+      } else {
+        openAppOrWxPage(LINKS.项目详情页)
+      }
+    },
+    goToEntPortraitPage(target) {
+      const id = target.dataset.eid
+      const eName = target.dataset.ename
+        ?.replace(/#/g, '%23')
+        ?.replace(/\?/g, '%3F')
+      if (!id) {
+        return this.$toast('暂无数据')
+      } else {
+        const noPower =
+          this.bigMemberPower.indexOf(4) === -1 &&
+          this.bigMemberPower.indexOf(12) === -1 &&
+          this.bigMemberPower.indexOf(13) === -1
+        if (this.isMember && noPower) {
+          if (eName) {
+            openAppOrWxPage({
+              wx: LINKS.旧版企业信息前缀.wx + eName,
+              app: LINKS.旧版企业信息前缀.app + eName,
+              h5: LINKS.旧版企业信息前缀.h5 + eName
+            })
+          } else {
+            return this.$toast('暂无数据')
+          }
+        } else {
+          sessionStorage.removeItem('$data-ent_portrait')
+          openAppOrWxPage(LINKS.企业画像页面, {
+            query: {
+              eId: id
+            }
+          })
+        }
+      }
+    },
     beforeLeaveVue() {
       this.saveToStorage()
     },
@@ -298,8 +371,6 @@ export default {
       this.shareConf.title = this.getRandomShareText()
       this.shareConf.content = '全国招标信息免费看,不遮挡'
       this.shareConf.pathname = '/swordfish/about'
-
-      console.log(this.shareConf.title)
     },
     calcAppShareInfo(t) {
       const shareType = t.id
@@ -366,7 +437,6 @@ export default {
         targetVm.getIsView()
       }
     },
-    checkProject() {},
     async dialog1() {
       return await this.$dialog.alert({
         title: '申请监控更多项目',