Forráskód Böngészése

首页桌面动态效果

liupeng 3 éve
szülő
commit
7f9c83ff4c

+ 14 - 9
public/static/css/style/style.css

@@ -609,7 +609,8 @@ ul.sds-desktop-shortcut {
 .v-widget-list {
     display: flex;
     flex-direction: column;
-    width: 100%;
+    width: 340px;
+    position: relative;
     min-height: 100%;
 }
 
@@ -1446,16 +1447,16 @@ ul.sds-desktop-shortcut {
     padding-right: 0;
 }
 
-.v-ps.ps__rail-x:hover>.ps__thumb-x,
-.v-ps.ps__rail-x:focus>.ps__thumb-x,
-.v-ps.ps__rail-x.ps--clicking.ps__thumb-x {
-    background-color: rgba(0, 0, 0, .42)
+.v-ps .ps__rail-x:hover>.ps__thumb-x,
+.v-ps .ps__rail-x:focus>.ps__thumb-x,
+.v-ps .ps__rail-x.ps--clicking.ps__thumb-x {
+    background-color: rgba(255, 255, 255, 0.8)
 }
 
-.v-ps.ps__rail-y:hover>.ps__thumb-y,
-.v-ps.ps__rail-y:focus>.ps__thumb-y,
-.v-ps.ps__rail-y.ps--clicking.ps__thumb-y {
-    background-color: rgba(0, 0, 0, .42)
+.v-ps .ps__rail-y:hover>.ps__thumb-y,
+.v-ps .ps__rail-y:focus>.ps__thumb-y,
+.v-ps .ps__rail-y.ps--clicking.ps__thumb-y {
+    background-color: rgba(255, 255, 255, 0.8)
 }
 
 @media screen and (max-height: 456px){
@@ -1532,3 +1533,7 @@ ul.sds-desktop-shortcut {
 .synopkg-toolbar .syno-ux-textfilter {
     width: 100%;
 }
+/* 选择固定窗口的子窗口 */
+.v-menu .v-menu-item-select-selected .v-icon {
+    background-image: url(../../../image/index/select.png);
+}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
public/static/css/syno/syno-vue.css


+ 1 - 1
src/component/Desktop/FixWindow/Changelog/index.vue

@@ -1,6 +1,6 @@
 <template>
     <!-- 文件更改日志 -->
-    <div class="v-widget-item sds-window-v5 syno-sds-widget-item active">
+    <div class="v-widget-item sds-window-v5 syno-sds-widget-item">
         <div class="v-widget-item-header"><img
                 :src="ChangeLog.titleImgUrl"
                 class="v-widget-item-header-icon">

+ 1 - 1
src/component/Desktop/FixWindow/ConnectedUser/index.vue

@@ -1,6 +1,6 @@
 <template>
     <!-- 已连接用户 -->
-    <div class="v-widget-item sds-window-v5 syno-sds-widget-item active">
+    <div class="v-widget-item sds-window-v5 syno-sds-widget-item">
         <div class="v-widget-item-header"><img
                 :src="connectedUserDetail.titleImgUrl"
                 class="v-widget-item-header-icon">

+ 1 - 1
src/component/Desktop/FixWindow/Copy/index.vue

@@ -1,6 +1,6 @@
 <template>
     <!-- 备份 -->
-    <div class="v-widget-item sds-window-v5 syno-sds-widget-item active">
+    <div class="v-widget-item sds-window-v5 syno-sds-widget-item">
         <div class="v-widget-item-header"><img
                 :src="copyDetail.titleImgUrl"
                 class="v-widget-item-header-icon">

+ 1 - 1
src/component/Desktop/FixWindow/NewLog/index.vue

@@ -1,7 +1,7 @@
  
 <template>
     <!-- 最新日志 -->
-    <div class="v-widget-item sds-window-v5 syno-sds-widget-item active">
+    <div class="v-widget-item sds-window-v5 syno-sds-widget-item">
         <div class="v-widget-item-header"><img
                 :src="logDetail.titleImgUrl"
                 class="v-widget-item-header-icon">

+ 1 - 1
src/component/Desktop/FixWindow/ScheduledTask/index.vue

@@ -1,6 +1,6 @@
 <template>
     <!-- 计划的任务 -->
-    <div class="v-widget-item sds-window-v5 syno-sds-widget-item active">
+    <div class="v-widget-item sds-window-v5 syno-sds-widget-item">
         <div class="v-widget-item-header"><img
                 :src="scheduledTaskDetail.titleImgUrl"
                 class="v-widget-item-header-icon">

+ 1 - 1
src/component/Desktop/FixWindow/Storage/index.vue

@@ -1,6 +1,6 @@
 <template>
     <!-- 存储 -->
-    <div class="v-widget-item sds-window-v5 syno-sds-widget-item active">
+    <div class="v-widget-item sds-window-v5 syno-sds-widget-item">
         <div class="v-widget-item-header"><img
                 :src="storageDetail.titleImgUrl"
                 class="v-widget-item-header-icon">

+ 211 - 33
src/component/Desktop/FixWindow/index.vue

@@ -9,7 +9,7 @@
             <div class="v-widget-header">
                 <div class="v-widget-header-left"><button type="button"
                         class="v-btn v-btn-styleless v-btn-grey v-btn-dropdown"><span>
-                            <div class="v-widget-header-tool-icon add"></div>
+                            <div class="v-widget-header-tool-icon add" @click.stop="selectWidgetItem"></div>
                         </span>
                     </button></div>
                 <div class="v-widget-header-right">
@@ -28,22 +28,23 @@
             <div class="v-trap-focus-body">
                 <div tabindex="0" role="application" class="v-trap-focus-indicator"></div>
                 <div class="v-widget-items-wrapper">
-                    <div class="v-ps show ps--active-y" style="overflow: scroll;">
-                        <div class="v-widget-list">
-                            <Copy></Copy>
-                            <NewLog></NewLog>
-                            <ChangeLog></ChangeLog>
-                            <ScheduledTask></ScheduledTask>
-                            <ConnectedUser></ConnectedUser>
-                            <ResourceMonitor></ResourceMonitor>
+                    <div class="v-ps show ps--active-y">
+                        <!--  <div class="v-widget-list" style="overflow-y:scroll;height:100%" @scroll="scrollList"> -->
+                        <div class="v-widget-list" @scroll="scrollList">
                             <RunningState></RunningState>
+                            <ResourceMonitor></ResourceMonitor>
                             <Storage></Storage>
+                            <ConnectedUser></ConnectedUser>
+                            <ScheduledTask></ScheduledTask>
+                            <ChangeLog></ChangeLog>
+                            <NewLog></NewLog>
+                            <Copy></Copy>
                         </div>
                         <div class="ps__rail-x" style="left: 0px; bottom: 0px;">
                             <div class="ps__thumb-x" tabindex="0" style="left: 0px; width: 0px;"></div>
                         </div>
                         <div class="ps__rail-y" style="top: 0px; right: 0px; height: 424px;">
-                            <div class="ps__thumb-y" tabindex="0" style="top: 0px; height: 104px;"></div>
+                            <div class="ps__thumb-y" tabindex="0" style="top: 0px;height: 104px;display:none;" @mousedown="mousedownProgress"></div>
                         </div>
                     </div>
                 </div>
@@ -58,46 +59,223 @@
 </template>
 
 <script>
-import Copy from './Copy' 
-import NewLog from './NewLog' 
-import ChangeLog from './ChangeLog' 
-import ScheduledTask from './ScheduledTask'
-import ConnectedUser from './ConnectedUser'
-import ResourceMonitor from './ResourceMonitor'
 import RunningState from './RunningState'
+import ResourceMonitor from './ResourceMonitor'
 import Storage from './Storage'
+import ConnectedUser from './ConnectedUser'
+import ScheduledTask from './ScheduledTask'
+import ChangeLog from './ChangeLog' 
+import NewLog from './NewLog' 
+import Copy from './Copy' 
 export default {
   data() {
     return {
       zIndex: 9040,
       cls:'',
+      clickMouseY:0,
+      lastY:0,
+      nextY:0,
+      html:'<RunningState></RunningState>',
+      portalDetail:{
+        display: 'none',
+        detailMessageList:[
+            {
+                id:0,
+                title:'系统状况',
+                cls:'v-menu-item-select-selected selected active',
+            },
+            {
+                id:1,
+                title:'资源监控',
+                cls:'v-menu-item-select-selected selected',
+            },
+            {
+                id:2,
+                title:'存储',
+                cls:'',
+            },
+            {
+                id:3,
+                title:'已连接用户',
+                cls:'',
+            },
+            {
+                id:4,
+                title:'计划的任务',
+                cls:'',
+            },
+            {
+                id:5,
+                title:'文件更改日志',
+                cls:'',
+            },
+            {
+                id:6,
+                title:'最新日志',
+                cls:'',
+            },{
+                id:7,
+                title:'备份',
+                cls:'',
+            }
+
+        ]
+      }
     }
   },
   components:{
-    Copy,
-    NewLog,
-    ChangeLog,
-    ScheduledTask,
-    ConnectedUser,
-    ResourceMonitor,
     RunningState,
-    Storage
+    ResourceMonitor,
+    Storage,
+    ConnectedUser,
+    ScheduledTask,
+    ChangeLog,
+    NewLog,
+    Copy,
 
   },
   mounted(){
     this.$bus.on("changeFixWindowZIndex",this.changeFixWindowZIndex)
+    let el = document.querySelector('.ps__thumb-y')
+    let el1 = document.querySelector('.v-widget-list')
+    el.addEventListener('mouseup',this.mouseupProgress)
+    this.$bus.on("showOrHiddenWidgetItem",this.showOrHiddenWidgetItem)
+    this.$bus.on("changeThumbHeight",this.changeThumbHeight)
   },
   methods:{
-      clickFixWindow(){
-          if(this.zIndex == 9040) this.zIndex = 19000
-          this.cls = 'active-win'
-      },
-      changeFixWindowZIndex(){
-          this.zIndex = 9040
-          if(this.cls != '')  this.cls = ''
-      }
+    //点击固定窗口
+    clickFixWindow(){
+        if(this.zIndex == 9040) this.zIndex = 13000
+        this.cls = 'active-win'
+    },
+    // 修改changeFixWindow
+    changeFixWindowZIndex(){
+        this.zIndex = 9040
+        if(this.cls != '')  this.cls = ''
+    },
+    //点击进度条
+    mousedownProgress(e){
+        this.clickMouseY = e.offsetY
+        let el = document.querySelector('.ps__thumb-y')
+        el.addEventListener("mousemove",this.moveProgress)
+    },
+    //移动进度条
+    moveProgress(e){
+        let el = document.querySelector('.ps__thumb-y')
+        let el1 = document.querySelector('.ps__rail-y')
+        let el2 = document.querySelector('.v-widget-list')
+        let moveY
+        if (e.clientY < this.lastY){
+            moveY = this.nextY + (e.clientY - this.lastY)
+        }else{
+            moveY = e.clientY - e.offsetY -71
+        }
+        if(moveY < 0 ) moveY = 0
+        console.log(el.style.top,e.offsetY,el2.offsetHeight)
+        if(moveY > (el2.offsetHeight -this.clickMouseY)){
+            moveY = el2.offsetHeight -this.clickMouseY
+        }
+        // if(el.style.height === '280px'){
+        //     if(moveY > 143.5){
+        //         moveY = 143.5
+        //     }
+        // }else if(el.style.height === '210px'){
+        //     if(moveY > 214){
+        //         moveY = 214
+        //     }
+        // }else if(el.style.height === '167px'){
+        //     if(moveY > 265){
+        //         moveY = 265
+        //     }
+        // }else if(el.style.height === '139px'){
+        //     // if(moveY > 284.5){
+        //     //     moveY = 284.5
+        //     // }
+        // }
+        
+        let moveY2 = - (el2.offsetHeight / el1.offsetHeight ) * moveY
+        // console.log(moveY,moveY2,el2.offsetHeight / el1.offsetHeight)
+        el.style.top = moveY +'px'
+        el2.style.top = moveY2 +'px'
+        el.addEventListener('mouseup',this.mouseupProgress)
+        // el.addEventListener('mouseleave',this.mouseupProgress)
+        el1.addEventListener('mouseleave',this.mouseupProgress)
+        this.lastY = e.clientY
+        this.nextY = moveY
+    },
+    // 进度条鼠标抬起/离开
+    mouseupProgress(){
+        let el = document.querySelector('.ps__thumb-y')
+        let el2 = document.querySelector('.v-widget-list')
+        el.removeEventListener('mousemove',this.moveProgress)
+        el.style.top = '0px'
+        el2.style.top = '0px'
+    },
+    // 滚动窗口列表
+    scrollList(){
+        console.log(1111)
+    },
+    // 点击勾选小窗口的加号
+    selectWidgetItem(){
+        this.$bus.emit('showOrHiddenSelectWidgetItem',this.portalDetail)
+        window.onclick = (e)=>{
+            e.stopPropagation()
+            this.$bus.emit('showOrHiddenSelectWidgetItem','none')
+        }
+    },
+    // 点击选择框的每一项
+    showOrHiddenWidgetItem(obj){
+        // cls:'v-widget-item sds-window-v5 syno-sds-widget-item',
+        //                 index: detailMessageIndex
+        let widgetItemArray = document.querySelectorAll('.v-widget-item')
+        Array.from(widgetItemArray)[obj.index].className = obj.cls
+        // Array.from(widgetItemArray).forEach((item,index)=>{
+        this.portalDetail.detailMessageList[obj.index].cls = obj.cls1
+        this.portalDetail.detailMessageList.forEach(item=>{
+            if(item.cls === 'v-menu-item-select-selected selected active'){
+                item.cls = 'v-menu-item-select-selected selected'
+            }
+        })
+        let index = this.portalDetail.detailMessageList.findIndex(item=>{
+            return item.cls === 'v-menu-item-select-selected selected'
+        })
+        if(index != -1){
+            this.portalDetail.detailMessageList[index].cls = 'v-menu-item-select-selected selected active'
+        }
+        // })           
+    },
+    // 跟随可视小窗口的个数改变进度条高度
+    changeThumbHeight(selectedNum) {
+        let el = document.querySelector('.ps__thumb-y')
+        if(selectedNum > 2){
+            el.style.display = 'block'
+            console.log(selectedNum)
+            if(selectedNum >= 6) {
+                selectedNum = 6
+            }
+            console.log(selectedNum)
+            el.style.height = (7 - selectedNum) * 70 + 'px'
+            console.log((7 - selectedNum) * 70)
+            // if(selectedNum == 3){
+            //     el.style.height = '280px'
+            // }else if(selectedNum == 4){
+            //     el.style.height = '210px'
+            // }else if(selectedNum == 5){
+            //     el.style.height = '167px'
+            // }else if(selectedNum >= 6){
+            //     el.style.height = '139px'
+            // }
+        }else{
+            el.style.display = 'none'
+        }
+    } 
+  },
+   beforeDestroy() {
+    this.$bus.off("changeFixWindowZIndex",this.changeFixWindowZIndex)
   },
   name:'FixWindow',
-
 }
-</script>
+</script>
+<style scoped>
+
+</style>

+ 5 - 0
src/component/Desktop/Menu/index.vue

@@ -106,6 +106,11 @@ export default {
       })
     }
   },
+  beforeDestroy() {
+    this.$bus.off('clickShortcutItem',this.clickShortcutItem)
+    this.$bus.off("changeDialogWindow",this.changeDialogWindow)
+    this.$bus.off('closeDialogWindow',this.closeDialogWindow)
+  },
   name:'Menu',
   
 

+ 10 - 19
src/component/Desktop/Shortcut/ResizablePinned/index.vue

@@ -8,7 +8,7 @@
             v-for="(detailMessage, detailMessageIndex) in resizablePinnedDetail.detailMessageList" :key="detailMessage.id"
             @click.stop="changeDialogWindow(detailMessage.titleImgUrl,detailMessageIndex)">
             <div class="x-dlg-focus tjCenter" tabindex="0" role="application"></div>
-            <div class="x-window-tl">
+            <div class="x-window-tl" @click="moveWindowPosition">
                 <div class="x-window-tr">
                     <div class="x-window-tc">
                         <div class="x-window-header x-panel-icon x-window-draggable"
@@ -141,7 +141,7 @@
                                 </div>
                             </div>
                             <div class="x-window-body x-border-layout-ct" style="width: 100%; height: 484px;">
-                                
+
                             </div>
                         </div>
                     </div>
@@ -235,7 +235,6 @@ export default {
     mounted(){
         this.$bus.on('clickShortcutItem',this.clickShortcutItem)
         this.$bus.on('clickMenuItem',this.clickMenuItem)
-
     },
     methods: {
         // 点击大菜单图标
@@ -293,20 +292,6 @@ export default {
         minMizeWindow(detailMessageIndex){
             this.resizablePinnedDetail.detailMessageList[detailMessageIndex].display = 'none'
             this.countOpenWindowNum()
-            // if(this.openWindowNum == 1){
-            //     this.defaultZIndex = this.resizablePinnedDetail.detailMessageList[detailMessageIndex].zIndex
-            //     this.$bus.emit("changeDialogWindow",this.resizablePinnedDetail.detailMessageList[detailMessageIndex].titleImgUrl) 
-            // }else{
-                
-            // }
-            // let imgUrl = this.resizablePinnedDetail.detailMessageList[detailMessageIndex].titleImgUrl
-            //     let index = this.resizablePinnedDetail.detailMessageList.findIndex(item=>{
-            //         return item.zIndex == (this.defaultZIndex - 10) 
-            //     })
-            //     if(index != -1){
-            //         this.defaultZIndex = this.resizablePinnedDetail.detailMessageList[index].zIndex
-            //         this.$bus.emit("changeDialogWindow",this.resizablePinnedDetail.detailMessageList[index].titleImgUrl)
-            //     }
             let detailMessageList = this.resizablePinnedDetail.detailMessageList.filter(item=>{
                 return item.display == 'block'
             })
@@ -371,12 +356,18 @@ export default {
             var x = e.pageX;
             var y = e.pageY;
             console.log(x,y)
-        
         }
     },
+    beforeDestroy() {
+        this.$bus.off('clickShortcutItem',this.clickShortcutItem)
+        this.$bus.off('clickMenuItem',this.clickMenuItem)
+    },
     components:{
     },
     name:'ResizablePinned', 
 
 }
-</script>
+</script>
+<style scope>
+    
+</style>  

+ 4 - 2
src/component/Desktop/index.vue

@@ -4,7 +4,7 @@
         <Menu></Menu>
         <Shortcut></Shortcut>
         <FixWindow></FixWindow>
-        
+        <Portal></Portal>
     </div>
 </template>
 
@@ -12,6 +12,7 @@
 import Menu from './Menu'
 import Shortcut from './Shortcut'
 import FixWindow from './FixWindow'
+import Portal from './Portal'
 export default {
   data() {
     return {
@@ -20,7 +21,8 @@ export default {
   components:{
       Menu,
       Shortcut,
-      FixWindow
+      FixWindow,
+      Portal
   },
   name:'Desktop',
 }