Kaynağa Gözat

Merge branch 'dev/v1.5.53_yf' of jianyu/page_bigmember_pc into feature/v1.5.53

yangfeng 2 yıl önce
ebeveyn
işleme
4372fe063e

+ 2 - 1
src/store/workspace/common-use.js

@@ -78,7 +78,8 @@ export default {
         const obj = { ...item, children: flatTabsMenu(item.child).filter(v => v.level === 3 && v.usable) }
         filterMainList.push(obj)
       })
-      this.commit('workspace/commonUse/setMainFunList', filterMainList)
+      const newFilterMainList = filterMainList.filter(n => n.children && n.children.length > 0)
+      this.commit('workspace/commonUse/setMainFunList', newFilterMainList)
     },
     setAllFunctionsContainsUsable: function (state, list = []) {
       if (Array.isArray(list)) {

+ 30 - 16
src/views/workspace/components/CommonUse.vue

@@ -136,13 +136,13 @@ export default {
     commonList (val) {
       if (val) {
         this.addedList = JSON.parse(JSON.stringify(val))
-        this.formatMainFunList(this.mainFunList, this.addedList)
+        this.formatMainFunList(this.addedList)
       }
     },
     mainFunctions (val) {
       if (val) {
         this.mainFunList = JSON.parse(JSON.stringify(val))
-        this.formatMainFunList(this.mainFunList, this.addedList)
+        this.formatMainFunList(this.addedList)
       }
     }
   },
@@ -266,9 +266,10 @@ export default {
       element.classList.remove('drag-move-item')
       this.$forceUpdate()
     },
-    formatMainFunList (allList = [], addedList = []) {
-      allList.forEach(v => {
+    formatMainFunList (addedList = []) {
+      this.mainFunList.forEach(v => {
         v.children.forEach(t => {
+          t.status = false
           addedList.forEach(s => {
             if (s.id === t.id || s.name === t.name) {
               t.status = true
@@ -280,7 +281,7 @@ export default {
     onCloseDrawer () {
       this.tabFixed = false
       this.tabActive = 0
-      this.formatMainFunList(this.mainFunList, this.commonList)
+      this.formatMainFunList(this.commonList)
       this.changeDrawerState(false)
     },
     onSaveDrawer () {
@@ -289,7 +290,7 @@ export default {
     setCommonFun () {
       this.changeDrawerState(true)
       this.addedList = JSON.parse(JSON.stringify(this.commonList))
-      this.formatMainFunList(this.mainFunList, this.addedList)
+      this.formatMainFunList(this.addedList)
     },
     onRemoveFun (item) {
       item.status = false
@@ -325,7 +326,6 @@ export default {
       // qiankun 子应用选择器获取不到document  改为this.$root.$el
       const scrollDom = this.$root.$el.querySelector('.function-drawer-content')
       // const addTop = this.$root.$el.querySelector('.added-function').offsetHeight
-      console.log(offsetTop)
       const scrollTop = offsetTop - 70 - 48
       scrollDom.scrollTo({
         /**
@@ -334,7 +334,6 @@ export default {
         top: scrollTop,
         behavior: 'smooth'
       })
-      console.log(index, 'index')
       this.tabActive = index
       setTimeout(() => {
         this.isScrollAnchor = true
@@ -346,11 +345,11 @@ export default {
       if (!this.isScrollAnchor) return
       const scrollItems = this.$root.$el.querySelectorAll('.outer-item')
       for (let i = scrollItems.length - 1; i >= 0; i--) {
-        // console.log(this.getOffsetTop(scrollItems[i]), this.getOffsetTop(scrollItems[0]), 'judge')
-        const scrollItemTop = this.getOffsetTop(scrollItems[i]) - this.getOffsetTop(scrollItems[0])
+        // console.log(e.target.scrollTop, this.getOffsetTop(scrollItems[i]), this.getOffsetTop(scrollItems[0]), 'judge')
+        const scrollItemTop = this.getOffsetTop(scrollItems[i])
         // 判断滚动条滚动距离是否大于当前滚动项可滚动距离
         const judge =
-          e.target.scrollTop >= scrollItemTop + 80
+          e.target.scrollTop >= scrollItemTop
         if (judge) {
           this.tabActive = i
           break
@@ -377,7 +376,7 @@ export default {
           })
         }
       })
-      this.formatMainFunList(this.mainFunList, this.addedList)
+      this.formatMainFunList(this.addedList)
       const ids = this.addedList.map(v => {
         return v.id
       })
@@ -506,23 +505,38 @@ $main: #2cb7ca;
     .classify-function{
       margin-top: 12px;
       .classify-tab{
+        width: 100%;
         padding: 0 12px;
-        height: 48px;
-        line-height: 48px;
         background: #fff;
+        white-space: nowrap;
+        overflow-x: auto;
         border-bottom: 1px solid rgba(0, 0, 0, 0.05);
+        &::-webkit-scrollbar{
+          height: 4px;
+        }
+        &::-webkit-scrollbar-track {
+          background-color: #f5f5f5;
+        }
+        &::-webkit-scrollbar-thumb {
+          border-radius: 2px;
+          background-color: #ECECEC;
+          opacity: 0.15;
+        }
       }
       .tab-fixed{
         position: fixed;
         top: 70px;
         width: 100%;
-        height: 48px;
         background: #fff;
         z-index: 10;
+        white-space: nowrap;
+        overflow-x: auto;
       }
       .tab-item{
         display: inline-block;
-        height: 100%;
+        // height: 100%;
+        height: 48px;
+        line-height: 48px;
         padding: 0 20px;
         cursor: pointer;
         font-size: 16px;