diff --git a/nezha-fronted/src/assets/css/components/common/globalSearch/globalSearch.scss b/nezha-fronted/src/assets/css/components/common/globalSearch/globalSearch.scss index c87dc4a96..90d508e37 100644 --- a/nezha-fronted/src/assets/css/components/common/globalSearch/globalSearch.scss +++ b/nezha-fronted/src/assets/css/components/common/globalSearch/globalSearch.scss @@ -33,10 +33,13 @@ border-radius: 6px; line-height: 72px; .nz-icon-search { - margin-left: 22px; - margin-right: 20px; + padding-left: 22px; + padding-right: 20px; font-size: 26px; color: $--color-text-primary; + .el-loading-mask{ + transform: scale(0.7); + } } .el-input__inner { border: none !important; @@ -80,6 +83,11 @@ .global-search-content-left { box-shadow: 0 2px 4px 0 rgba(0,0,0,0.14); } + .global-search-content-right{ + .el-skeleton{ + height: 100%; + } + } .list{ height: 100%; width: 100%; diff --git a/nezha-fronted/src/components/common/globalSearch/globalSearch.vue b/nezha-fronted/src/components/common/globalSearch/globalSearch.vue index efea542e6..9e4a515b4 100644 --- a/nezha-fronted/src/components/common/globalSearch/globalSearch.vue +++ b/nezha-fronted/src/components/common/globalSearch/globalSearch.vue @@ -8,38 +8,64 @@ Cancel -
-
+
+
-
    - -
  • -
    - - {{item.name}} -
    -
    - {{ item.sub }} -
    -
  • -
  • - -
+ + + +
- +
@@ -95,7 +121,6 @@ export default { return this.$store.getters.getGlobalShow }, noMore () { - console.log((this.pageObj.pageNo * this.pageObj.pageSize) >= this.pageObj.total) return (this.pageObj.pageNo * this.pageObj.pageSize) >= this.pageObj.total }, disabled () { @@ -110,6 +135,7 @@ export default { nextLoading: false, selectIndex: '', tableData: [], + isNoData: false, pageObj: { pageNo: 1, pageSize: 50, @@ -139,6 +165,7 @@ export default { isSelect: true } ], + skeletonArr: 20, timer: null, searchTimer: null, scopeChangeTimer: null, @@ -194,21 +221,21 @@ export default { window.removeEventListener('keyup', this.keyup) }, scroll () { - // const ulBox = this.$refs.list + const ulBox = this.$refs.list const liBox = this.$refs['item' + this.selectIndex][0] - // const liHeight = liBox.clientHeight - // const height = ulBox.clientHeight - liHeight - // const offsetTop = liBox.offsetTop - liBox.focus() - // if ((this.selectIndex + 1) * liHeight > height) { - // ulBox.scrollTop = (this.selectIndex + 1) * liHeight - height - // } else { - // ulBox.scrollTop = 0 - // } - // console.log(height, liHeight, offsetTop, ulBox.scrollTop) + const liHeight = liBox.clientHeight + const height = ulBox.clientHeight + const offsetTop = liBox.offsetTop - ulBox.offsetTop + const scrollTop = ulBox.scrollTop + // liBox.focus() + // console.log(height, liHeight, offsetTop, scrollTop) + if (offsetTop - scrollTop < 0) { + ulBox.scrollTop = offsetTop + } else if (offsetTop - scrollTop >= height - liHeight) { + ulBox.scrollTop = offsetTop - height + liHeight + } }, changeSelectIndex (index) { - console.log('changeSelectIndex', this.isKeyDown) if (this.isKeyDown) { this.getItemInfo() return @@ -217,7 +244,6 @@ export default { this.getItemInfo() }, keyDown (e) { - console.log('keyDown') // console.log(e, e.target, e.keyCode) if (e.keyCode === 13) { this.jumpTo() @@ -266,6 +292,7 @@ export default { this.searchTimer = null } this.loading = true + this.firstShow = false this.searchTimer = setTimeout(() => { this.selectIndex = 0 this.pageObj.pageNo = 1 @@ -305,6 +332,7 @@ export default { }, 100) }, getData () { + this.isNoData = false const param = { pageNo: this.pageObj.pageNo, pageSize: this.pageObj.pageSize, @@ -316,12 +344,17 @@ export default { this.loading = false this.nextLoading = false return + } else { + this.firstShow = false } this.$get('/stat/search', param).then(res => { this.firstShow = false this.nextLoading = false if (res.code === 200) { this.tableData = this.tableData.concat(res.data.list) + if (!this.tableData.length) { + this.isNoData = true + } this.pageObj.total = res.data.total this.stat = res.stat } else { diff --git a/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue b/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue index 026d1c4cf..f1698f2d6 100644 --- a/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue +++ b/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue @@ -1,16 +1,34 @@