Переглянути джерело

Merge branch 'main' into feature/v1.0.23

lianbingjie 1 рік тому
батько
коміт
9943963c8a

+ 2 - 1
apps/work-bench/public/index.html

@@ -27,7 +27,8 @@
     <script src="/common-module/public/fotter.js?v=<%= htmlWebpackPlugin.options.assets.version %>"></script>
     <script src="/js/jyWebScoket.js?v=<%= htmlWebpackPlugin.options.assets.version %>"></script>
     <script src="/common-module/ad/js/msgbuoy.js?v=<%= htmlWebpackPlugin.options.assets.version %>"></script>
-    <script src="/common-module/chat/jy-chat.umd.js?auto=true&v=<%= htmlWebpackPlugin.options.assets.version %>"></script>
+<!--    智能助手-->
+<!--    <script src="/common-module/chat/jy-chat.umd.js?auto=true&v=<%= htmlWebpackPlugin.options.assets.version %>"></script>-->
     <% } %>
 
     <% if (process.env.NODE_ENV === 'development') { %>

+ 24 - 2
apps/work-bench/src/store/modules/customer.js

@@ -2,19 +2,41 @@ import { ajaxObtainShunt } from '../../api/modules'
 
 export default {
   namespaced: true,
+  state: () => ({
+    showCustomer: false,
+    customerUrl: ''
+  }),
+  mutations: {
+    setCustomerUrl (state, data) {
+      state.customerUrl = data
+    },
+    setCustomerStatus (state, data) {
+      state.showCustomer = data
+    }
+  },
   actions: {
     async open ({ dispatch }) {
       dispatch('checkObtainShunt', { isFind: true })
     },
-    async checkObtainShunt ({ state, dispatch, rootGetters }, payload = {}) {
+    async checkObtainShunt ({ state, commit, dispatch, rootGetters }, payload = {}) {
       ajaxObtainShunt({
         type: 'PC',
         isFind: payload.isFind
       }).then(res => {
         if (res && res.data && res.data.url) {
-          window.open(process.env.VUE_APP_BASE_SITE + res.data.url)
+          // window.open(process.env.VUE_APP_BASE_SITE + res.data.url)
+          commit('setCustomerUrl', process.env.VUE_APP_BASE_SITE + res.data.url + '&from=aside')
+          commit('setCustomerStatus', true)
         }
       })
     }
+  },
+  getters: {
+    getCustomerStatus (state) {
+      return state.showCustomer
+    },
+    getCustomerUrl (state) {
+      return state.customerUrl
+    }
   }
 }

+ 8 - 4
packages/work-bench-frame/packages/components/Menu/index.vue

@@ -397,15 +397,19 @@ $aside-menu--apex-bg: $aside-menu--color-black;
         }
 
         .el-submenu__title .el-submenu__icon-arrow {
-          margin-top: -8px;
+          margin-top: -6px;
           right: 8px;
-          font-family: "iconfont" !important;
-          font-size: 16px;
+          //font-family: "iconfont" !important;
+          //font-size: 12px;
           color: #8F9399;
 
           &::before {
-            content: "\e656";
+            //color: #8F9399;
+            //content: "\e656";
+            font-weight:bold;
+            font-size:14px;
           }
+
         }
 
         .el-menu-item-group__title {

+ 46 - 2
packages/work-bench-frame/packages/components/Navbar/index.vue

@@ -70,14 +70,16 @@
         </el-popover>
       </div>
     </div>
-
+    <div v-if="showCustomer" class="customer-container">
+      <iframe :src="customerUrl" name="_blank" frameborder="0" width="100%" height="100%"></iframe>
+    </div>
   </div>
 </template>
 
 <script>
 import NavbarItem from './components/item'
 import NavbarSearch from './components/search'
-import { mapActions, mapGetters, mapState } from 'vuex'
+import { mapActions, mapGetters, mapState, mapMutations } from 'vuex'
 import EmptyTip from '../Empty'
 import {debounce} from 'lodash'
 
@@ -127,6 +129,10 @@ export default {
     // 获取是否启用自定义顶部导航用户信息自定义
     ...mapGetters('work-bench', [
       'useCustomStatus'
+    ]),
+    ...mapState('customer', [
+      'showCustomer',
+      'customerUrl'
     ])
   },
   created () {
@@ -153,6 +159,22 @@ export default {
     })
     this.getMessageInfo()
   },
+  mounted () {
+    window.addEventListener('message', (event) => {
+      // 子页面发送来得消息是关闭或是全屏操作时 关闭当前侧边栏会话窗口
+      if (event.data && event.data.action) {
+        if (event.data.action === 'close') {
+          this.setCustomerStatus(false)
+        } else if (event.data.action ==='fullScreen') {
+          this.setCustomerStatus(false)
+          window.open(this.customerUrl.replace('&from=aside', '&mini=1'))
+        }
+      }
+    }, false)
+  },
+  beforeDestroy () {
+    window.removeEventListener('message', () => {})
+  },
   methods: {
     ...mapActions('work-bench', [
       'getPower',
@@ -163,6 +185,9 @@ export default {
       'setReadMessage',
       'navbarConvergeSearch'
     ]),
+    ...mapMutations('customer', [
+      'setCustomerStatus'
+    ]),
     /**
      * 获取消息数据
      */
@@ -557,5 +582,24 @@ export default {
       margin-left: 48px;
     }
   }
+  .customer-container{
+    // display: none;
+    position: fixed;
+     right: 84px;
+    bottom: 80px;
+    max-height: 674px;
+    min-height: 400px;
+    width: 460px;
+    height: calc(100% - 40px);
+    box-shadow: 0 0 20px 0 rgba(8, 31, 38, 0.12);
+    border-radius: 8px;
+    overflow: hidden;
+    z-index: 9999;
+  }
+  @media screen and (max-height: 800px) {
+    .customer-container{
+      bottom: 20px;
+    }
+  }
 }
 </style>