Browse Source

feat: 接口参数调整、优化业务逻辑判断

zhangyuhan 1 year ago
parent
commit
6e8b38c10e

+ 11 - 0
apps/bigmember_pc/src/assets/style/common.scss

@@ -149,9 +149,20 @@ input[type='number'] {
 .keyword-underline {
   border-bottom: 1px solid $color-main;
   padding-bottom: 1px;
+  &.project-name,
+  &.winner-name {
+    cursor: pointer;
+  }
 }
 .keyword.hide-underline {
   border-width: 0;
 }
 
+.iconfont {
+  &.icon-yijiankong {
+    color: #ff9f40;
+  }
+}
+
+
 

+ 1 - 1
apps/bigmember_pc/src/components/forecast/ForeCast.vue

@@ -853,7 +853,7 @@ export default {
       if (num === '') {
         setFollowEnt({ entId: id }).then((res) => {
           if (res.error_code === 0) {
-            if (res.data === 'success') {
+            if (res.data?.status) {
               this.entSearch.forEach(function (item, i) {
                 if (id === item.entId) {
                   item.isFollow = '1'

+ 1 - 1
apps/bigmember_pc/src/components/medical/FollowList.vue

@@ -245,7 +245,7 @@ export default {
       if (num === '') {
         setFollowEnt({ entId: id }).then((res) => {
           if (res.error_code === 0) {
-            if (res.data === 'success') {
+            if (res.data?.status) {
               this.entSearch.forEach(function (item, i) {
                 if (id === item.entId) {
                   item.isFollow = '1'

+ 10 - 1
apps/bigmember_pc/src/components/time-line/PoverTimeLine.vue

@@ -18,7 +18,12 @@
       <el-card class="project-content" v-show="stepList.length !== 0">
         <div slot="header" class="p-h-title">{{ title }}</div>
         <div class="p-c-main">
-          <TimeLine poverType="card" :stepList="stepList" />
+          <TimeLine
+            poverType="card"
+            :custom-event="customEvent"
+            :stepList="stepList"
+            @open="$emit('open', $event)"
+          />
         </div>
       </el-card>
     </el-popover>
@@ -56,6 +61,10 @@ export default {
       default() {
         return '720'
       }
+    },
+    customEvent: {
+      type: Boolean,
+      default: false
     }
   },
   data() {

+ 23 - 7
apps/bigmember_pc/src/composables/quick-monitor/use/base.js

@@ -7,18 +7,31 @@ import useQuickMonitor from '@jy/data-models/modules/quick-monitor/model'
  */
 export function useMonitorTipDialog(dialogDataMap) {
   const dialogShow = ref(false)
-  const dialogShowType = ref('monitor-success')
-  const dialogParams = ref({})
-  const dialogConfig = computed(() =>
-    Object.assign(
+  const dialogShowType = ref('success-monitor')
+  const dialogParams = ref({
+    count: 0
+  })
+  const dialogConfig = computed(() => {
+    const dialogOptions = dialogDataMap[dialogShowType.value]
+    const overOptions = {
+      content: dialogOptions.content
+    }
+    if (dialogShowType.value === 'max-monitor') {
+      overOptions.content = overOptions.content.replace(
+        '$1',
+        dialogParams.value.count
+      )
+    }
+    return Object.assign(
       {
         type: dialogShowType.value,
         params: dialogParams.value,
         show: dialogShow.value
       },
-      dialogDataMap[dialogShowType.value]
+      dialogOptions,
+      overOptions
     )
-  )
+  })
 
   function doOpenDialog(type, params = {}) {
     dialogShowType.value = type
@@ -49,7 +62,10 @@ export function useMonitorModel({ type, id }) {
     }
   })
   const { doFetch, doChange } = useMonitor
+  function getId() {
+    return useMonitor.id
+  }
   const { model } = toRefs(reactive(useMonitor))
 
-  return { model, doChange, doFetch }
+  return { model, doChange, doFetch, getId }
 }

+ 15 - 10
apps/bigmember_pc/src/composables/quick-monitor/use/client.js

@@ -1,6 +1,11 @@
 import { computed, ref, getCurrentInstance } from 'vue'
 import { useStore } from '@/store'
 import { useMonitorModel, useMonitorTipDialog } from './base'
+import {
+  doOpenBuyerListPage,
+  doOpenBuyerPage,
+  doOpenPushSettingPage
+} from '@/views/article-content/composables/useArticleUtil'
 
 /**
  * 文案项目配置
@@ -77,14 +82,6 @@ const DialogDataMap = {
   'success-toast': '监控成功,您可前往“工作台-商机-业主监控”查看'
 }
 
-/**
- * 弹窗相关事件 Emit
- */
-// 打开推送提醒设置
-function doOpenPushSetting() {
-  window.open('/swordfish/page_big_pc/push_setting')
-}
-
 function useClientQuickMonitorModel({ type, id }) {
   const that = getCurrentInstance().proxy
   const collectElement = ref(null)
@@ -95,7 +92,7 @@ function useClientQuickMonitorModel({ type, id }) {
     return store.getters['user/entniche'] || store.getters['user/bigmember']
   })
   const loading = ref(false)
-  const { model, doChange, doFetch } = useMonitorModel({ type, id })
+  const { model, doChange, doFetch, getId } = useMonitorModel({ type, id })
   const monitorPopoverConfig = computed(() => {
     return {
       showTip: !model.value.follow,
@@ -140,6 +137,12 @@ function useClientQuickMonitorModel({ type, id }) {
     loading.value = true
     // 业务流程
     if (!model.value.follow) {
+      // 无权限用户弹窗留资
+      if (!HasPowerBigmemberOrEnt.value) {
+        loading.value = false
+        return doOpenCollectDialog('pc_buyer_monitor_freeuser')
+      }
+
       await doChange().then((res) => {
         if (res.success) {
           // 判断是否开启推送提醒
@@ -189,7 +192,7 @@ function useClientQuickMonitorModel({ type, id }) {
         break
       case 'doOpenPushSetting':
         doCloseDialog()
-        doOpenPushSetting()
+        doOpenPushSettingPage()
         break
       case 'doRemoveFollow':
         doCloseDialog()
@@ -210,8 +213,10 @@ function useClientQuickMonitorModel({ type, id }) {
         }
         break
       case 'more':
+        doOpenBuyerPage({ name: getId() })
         break
       case 'list':
+        doOpenBuyerListPage()
         break
       default:
         break

+ 9 - 10
apps/bigmember_pc/src/composables/quick-monitor/use/ent.js

@@ -1,6 +1,11 @@
 import { computed, ref, getCurrentInstance } from 'vue'
 import { useStore } from '@/store'
 import { useMonitorModel, useMonitorTipDialog } from './base'
+import {
+  doOpenPushSettingPage,
+  doOpenWinnerListPage,
+  doOpenWinnerPage
+} from '@/views/article-content/composables/useArticleUtil'
 
 /**
  * 文案项目配置
@@ -77,14 +82,6 @@ const DialogDataMap = {
   'success-toast': '监控成功,您可前往“工作台-商机-企业情报监控”查看'
 }
 
-/**
- * 弹窗相关事件 Emit
- */
-// 打开推送提醒设置
-function doOpenPushSetting() {
-  window.open('/swordfish/page_big_pc/push_setting')
-}
-
 function useEntQuickMonitorModel({ type, id }) {
   const that = getCurrentInstance().proxy
   const collectElement = ref(null)
@@ -95,7 +92,7 @@ function useEntQuickMonitorModel({ type, id }) {
     return store.getters['user/entniche'] || store.getters['user/bigmember']
   })
   const loading = ref(false)
-  const { model, doChange, doFetch } = useMonitorModel({ type, id })
+  const { model, doChange, doFetch, getId } = useMonitorModel({ type, id })
   const monitorPopoverConfig = computed(() => {
     return {
       showTip: !model.value.follow,
@@ -189,7 +186,7 @@ function useEntQuickMonitorModel({ type, id }) {
         break
       case 'doOpenPushSetting':
         doCloseDialog()
-        doOpenPushSetting()
+        doOpenPushSettingPage()
         break
       case 'doRemoveFollow':
         doCloseDialog()
@@ -210,8 +207,10 @@ function useEntQuickMonitorModel({ type, id }) {
         }
         break
       case 'more':
+        doOpenWinnerPage({ id: getId() })
         break
       case 'list':
+        doOpenWinnerListPage()
         break
       default:
         break

+ 9 - 11
apps/bigmember_pc/src/composables/quick-monitor/use/porject.js

@@ -1,6 +1,11 @@
 import { computed, ref, getCurrentInstance } from 'vue'
 import { useStore } from '@/store'
 import { useMonitorModel, useMonitorTipDialog } from './base'
+import {
+  doOpenProjectDetailPage,
+  doOpenProjectProgressListPage,
+  doOpenPushSettingPage
+} from '@/views/article-content/composables/useArticleUtil'
 
 /**
  * 文案项目配置
@@ -77,14 +82,6 @@ const DialogDataMap = {
   'success-toast': '监控成功,您可前往“工作台-商机-项目进度监控”查看'
 }
 
-/**
- * 弹窗相关事件 Emit
- */
-// 打开推送提醒设置
-function doOpenPushSetting() {
-  window.open('/swordfish/page_big_pc/push_setting')
-}
-
 function useProjectQuickMonitorModel({ type, id }) {
   const that = getCurrentInstance().proxy
   const collectElement = ref(null)
@@ -95,7 +92,7 @@ function useProjectQuickMonitorModel({ type, id }) {
     return store.getters['user/entniche'] || store.getters['user/bigmember']
   })
   const loading = ref(false)
-  const { model, doChange, doFetch } = useMonitorModel({ type, id })
+  const { model, doChange, doFetch, getId } = useMonitorModel({ type, id })
   const monitorPopoverConfig = computed(() => {
     return {
       showTip: !model.value.follow,
@@ -189,7 +186,7 @@ function useProjectQuickMonitorModel({ type, id }) {
         break
       case 'doOpenPushSetting':
         doCloseDialog()
-        doOpenPushSetting()
+        doOpenPushSettingPage()
         break
       case 'doRemoveFollow':
         doCloseDialog()
@@ -210,9 +207,10 @@ function useProjectQuickMonitorModel({ type, id }) {
         }
         break
       case 'more':
+        doOpenProjectDetailPage({ id: getId() })
         break
       case 'list':
-        break
+        doOpenProjectProgressListPage()
       default:
         break
     }

+ 1 - 1
apps/bigmember_pc/src/views/PotentialList.vue

@@ -258,7 +258,7 @@ export default {
       } else {
         // 潜在竞争对手 / 合作伙伴挖掘 -- 关注
         setFollowEnt({ entId: item.entId, group: item.group }).then((res) => {
-          if (!(res && res.error_code === 0 && res.data === 'success')) {
+          if (!(res && res.error_code === 0 && res.data?.status)) {
             this.$toast(res.error_msg)
           } else {
             this.$toast('关注成功,已添加至企业情报监控内')

+ 33 - 1
apps/bigmember_pc/src/views/article-content/composables/useArticleUtil.js

@@ -1,5 +1,6 @@
 import router from '@/router'
 
+// 打开标讯详情页
 export function doOpenArticlePage({ id }) {
   const link = router.resolve({
     name: 'article_detail',
@@ -8,9 +9,13 @@ export function doOpenArticlePage({ id }) {
       content: 'content'
     }
   })
-  window.open(link.href, '_blank')
+  window.open(
+    link.href.replace('/swordfish/page_big_pc', '') + '.html',
+    '_blank'
+  )
 }
 
+// 打开采购单位详情页
 export function doOpenBuyerPage({ name }) {
   const link = router.resolve({
     path: '/unit_portrayal/' + name
@@ -18,6 +23,12 @@ export function doOpenBuyerPage({ name }) {
   window.open(link.href, '_blank')
 }
 
+// 打开采购单位监控列表页
+export function doOpenBuyerListPage() {
+  window.open('/swordfish/page_big_pc/my_client', '_blank')
+}
+
+// 打开中标企业详情页
 export function doOpenWinnerPage({ id }) {
   const link = router.resolve({
     path: '/ent_portrait/' + id
@@ -25,9 +36,30 @@ export function doOpenWinnerPage({ id }) {
   window.open(link.href, '_blank')
 }
 
+// 打开企业监控列表页
+export function doOpenWinnerListPage() {
+  window.open('/swordfish/page_big_pc/free/ent_follow', '_blank')
+}
+
+// 打开更多客户监控列表
 export function doOpenCorListPage() {
   const link = router.resolve({
     path: '/potential_cor_list/c'
   })
   window.open(link.href, '_blank')
 }
+
+// 打开项目监控详情页
+export function doOpenProjectDetailPage({ id }) {
+  window.open(`/swordfish/page_big_pc/pro_follow_detail?sid=${id}`, '_blank')
+}
+
+// 打开项目监控列表页
+export function doOpenProjectProgressListPage() {
+  window.open('/swordfish/page_big_pc/free/project_progress', '_blank')
+}
+
+// 打开推送提醒设置
+export function doOpenPushSettingPage() {
+  window.open('/swordfish/page_big_pc/push_setting')
+}

+ 27 - 7
apps/bigmember_pc/src/views/article-content/composables/useHoverElementClientRect.js

@@ -39,17 +39,22 @@ function checkAncestorClass(event, hasClass, maxDepth = 3) {
 export function useHoverHighlightTextPopover({
   parentSelector,
   hasClass,
-  onChangeHover
+  onChangeHover = () => {},
+  onClick = () => {}
 }) {
   // 创建响应式引用
   const rect = ref(null)
   const isHover = ref(false)
-  const elementClassName = ref('')
-  const elementText = ref('')
+  const elementInfo = ref({
+    className: '',
+    text: '',
+    winnerId: ''
+  })
   const elementState = computed(() => {
     return {
-      text: elementText.value,
-      className: elementClassName.value,
+      text: elementInfo.value.text,
+      className: elementInfo.value.className,
+      winnerId: elementInfo.value.winnerId,
       isHover: isHover.value,
       rect: rect.value,
       style: rect.value
@@ -66,14 +71,27 @@ export function useHoverHighlightTextPopover({
     }
   })
 
+  const handleClick = (event) => {
+    const { status, target } = checkAncestorClass(event, hasClass, 3)
+    if (status) {
+      tranElementInfo(target)
+      onClick(target)
+    }
+  }
+
+  function tranElementInfo(activeElement) {
+    elementInfo.value.className = activeElement.className
+    elementInfo.value.text = activeElement.innerText
+    elementInfo.value.winnerId = activeElement.getAttribute('data-eid')
+  }
+
   const handleMouseOver = (event) => {
     const { status, target } = checkAncestorClass(event, hasClass, 3)
     if (status) {
       // 检测到指定的类名
       const activeElement = target
       const activeElementRect = activeElement?.getBoundingClientRect()
-      elementClassName.value = activeElement.className
-      elementText.value = activeElement.innerText
+      tranElementInfo(activeElement)
       if (activeElementRect) {
         rect.value = activeElementRect
         isHover.value = true
@@ -92,12 +110,14 @@ export function useHoverHighlightTextPopover({
     // 使用事件委托,将事件监听绑定到 parentElement 上
     const parentElement = document.querySelector(parentSelector)
     parentElement.addEventListener('mouseover', handleMouseOver)
+    parentElement.addEventListener('click', handleClick)
   })
 
   onUnmounted(() => {
     // 移除事件监听
     const parentElement = document.querySelector(parentSelector)
     parentElement.removeEventListener('mouseover', handleMouseOver)
+    parentElement.removeEventListener('click', handleClick)
   })
 
   return {

+ 30 - 4
apps/bigmember_pc/src/views/article-content/pages/Article.vue

@@ -34,7 +34,9 @@ import {
 import DownProjectReport from '@/composables/down-project-report/component/DownProjectReport.vue'
 import {
   doOpenArticlePage,
-  doOpenCorListPage
+  doOpenCorListPage,
+  doOpenProjectDetailPage,
+  doOpenWinnerPage
 } from '@/views/article-content/composables/useArticleUtil'
 import RecommendOpportunities from '@/views/article-content/components/RecommendOpportunities.vue'
 import FooterAd from '@/views/article-content/components/FooterAd.vue'
@@ -146,6 +148,7 @@ const timeLineList = computed(() => {
         ContentExpandsModel.value.projectProgress.name,
         ['<span class="highlight-text">', '</span>']
       ),
+      id: v.id,
       s_id: v.id,
       tags: [v.tag],
       time: v.time,
@@ -261,6 +264,7 @@ const winnerTimeLineList = computed(() => {
         ContentExpandsModel.value.recommendWinners.name,
         ['<span class="highlight-text">', '</span>']
       ),
+      id: v.id,
       s_id: v.id,
       tags: tag ? [tag] : [],
       time: v?.time ? dateFromNow(v?.time) : '',
@@ -269,9 +273,19 @@ const winnerTimeLineList = computed(() => {
   })
 })
 
+const popoverElementType = computed(() => {
+  if (elementState.value.className.indexOf('project-name') !== -1) {
+    return 'project-name'
+  }
+  if (elementState.value.className.indexOf('winner-name') !== -1) {
+    return 'winner-name'
+  }
+  return ''
+})
+
 // 项目名称、企业名称悬浮窗口
 const popoverTimeLine = computed(() => {
-  if (elementState.value.className.indexOf('project-name') !== -1) {
+  if (popoverElementType.value === 'project-name') {
     return {
       title: '项目公告',
       list: timeLineList.value
@@ -280,7 +294,7 @@ const popoverTimeLine = computed(() => {
   if (
     elementState.value.text ===
       ContentExpandsModel.value.recommendWinners.name &&
-    elementState.value.className.indexOf('winner-name') !== -1
+    popoverElementType.value === 'winner-name'
   ) {
     return {
       title: '企业最新信息',
@@ -298,7 +312,17 @@ const { elementState } = useHoverHighlightTextPopover({
   hasClass: 'keyword-underline',
   onChangeHover: debounce((isHover) => {
     popoverElement.value.doChangePopover(isHover)
-  }, 150)
+  }, 150),
+  onClick: () => {
+    if (popoverElementType.value === 'project-name') {
+      doOpenProjectDetailPage({ id: contentId })
+    }
+    if (popoverElementType.value === 'winner-name') {
+      if (elementState.value.winnerId) {
+        doOpenWinnerPage({ id: elementState.value.winnerId })
+      }
+    }
+  }
 })
 </script>
 <template>
@@ -496,6 +520,8 @@ const { elementState } = useHoverHighlightTextPopover({
     <pover-time-line
       trigger="manual"
       :title="popoverTimeLine.title"
+      :custom-event="true"
+      @open="doOpenArticlePage"
       :stepList="popoverTimeLine.list"
       ref="popoverElement"
     >

+ 22 - 35
apps/bigmember_pc/src/views/portrayal/components/EntFollowStar.vue

@@ -1,10 +1,10 @@
 <template>
   <div class="ent-follow-container" v-show="followCheck.isShow">
     <div class="ent-follow" @click="setFollow()">
-      <span :class="follow.classActive"></span>
+      <span class="iconfont" :class="follow.classActive"></span>
       <span class="follow_text">{{ follow.text }}</span>
     </div>
-    <!-- 关注分组选择dialog -->
+    <!-- 监控分组选择dialog -->
     <el-dialog
       custom-class="sub-dialog"
       :visible.sync="follow.dialog"
@@ -52,8 +52,8 @@ export default {
         isShow: true
       },
       follow: {
-        classActive: 'icon_heart_gray',
-        text: '关注',
+        classActive: 'icon-jiankong',
+        text: '监控',
         groupInitData: ['A'],
         dialog: false,
         loading: false
@@ -64,7 +64,7 @@ export default {
     this.getFollow()
   },
   methods: {
-    // 查询项目是否关注
+    // 查询项目是否监控
     getFollow() {
       getfollowCheck({ entId: this.id }).then((res) => {
         if (res.error_code === 0) {
@@ -72,18 +72,18 @@ export default {
             Object.assign(this.followCheck, res.data)
           }
           if (res.data.followed) {
-            this.follow.classActive = 'icon_heart_red'
-            this.follow.text = '已关注'
+            this.follow.classActive = 'icon-yijiankong'
+            this.follow.text = '已监控'
           } else {
-            this.follow.classActive = 'icon_heart_gray'
-            this.follow.text = '关注'
+            this.follow.classActive = 'icon-jiankong'
+            this.follow.text = '监控'
           }
         }
       })
     },
-    // 关注
+    // 监控
     async setFollow() {
-      if (this.follow.text === '关注') {
+      if (this.follow.text === '监控') {
         if (this.beforeFollowFn) {
           const pass = await this.beforeFollowFn()
           if (!pass) {
@@ -95,11 +95,11 @@ export default {
         setCancelEnt({ entId: this.id }).then((res) => {
           if (res.error_code === 0) {
             if (res.data === 'success') {
-              this.follow.classActive = 'icon_heart_gray'
-              this.follow.text = '关注'
-              this.$toast('取消关注成功')
+              this.follow.classActive = 'icon-jiankong'
+              this.follow.text = '监控'
+              this.$toast('取消监控成功')
             } else {
-              this.$toast(res.error_msg || '取消关注失败')
+              this.$toast(res.error_msg || '取消监控失败')
             }
           }
         })
@@ -116,14 +116,14 @@ export default {
           if (res.error_code === 0) {
             // 关闭弹窗
             this.setFollowCancel()
-            this.$toast(res.error_msg || '关注成功,已添加至企业情报监控内')
-            if (res.data === 'success') {
-              this.follow.classActive = 'icon_heart_red'
-              this.follow.text = '已关注'
+            this.$toast(res.error_msg || '监控成功,已添加至企业情报监控内')
+            if (res.data?.status) {
+              this.follow.classActive = 'icon-yijiankong'
+              this.follow.text = '已监控'
             }
             this.$emit('followSuccess')
           } else {
-            this.$toast(res.error_msg || '关注失败')
+            this.$toast(res.error_msg || '监控失败')
           }
         })
         .finally(() => {
@@ -152,22 +152,9 @@ export default {
   align-items: center;
   cursor: pointer;
 
-  .icon_heart_gray {
-    margin-right: 4px;
-    display: flex;
-    width: 18px;
-    height: 18px;
-    background: url('~@/assets/images/icon/icon-heart.png') no-repeat;
-    background-size: contain;
-  }
-
-  .icon_heart_red {
+  .iconfont {
     margin-right: 4px;
-    display: flex;
-    width: 18px;
-    height: 18px;
-    background: url('~@/assets/images/icon/icon-favorite.png') no-repeat;
-    background-size: contain;
+    font-size: 18px;
   }
 
   .follow_text {

+ 1 - 1
apps/bigmember_pc/src/views/work-desktop/WorkDesktop.vue

@@ -616,7 +616,7 @@ export default {
       } else {
         // 潜在竞争对手 / 合作伙伴挖掘 -- 关注
         setFollowEnt({ entId: item.entId, group: item.group }).then((res) => {
-          if (!(res && res.error_code === 0 && res.data === 'success')) {
+          if (!(res && res.error_code === 0 && res.data?.status)) {
             this.$toast(res.error_msg)
           } else {
             this.$toast('关注成功,已添加至企业情报监控内')