diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 0ca5cf6..76bb9dc 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -16,10 +16,10 @@
Home
-
+
Github
-
+
Docs
diff --git a/src/utils/number.js b/src/utils/number.js
index 8b784ac..fecafd5 100644
--- a/src/utils/number.js
+++ b/src/utils/number.js
@@ -30,3 +30,42 @@ export const cutOutNum = (num, decimals) => {
}
return realVal
}
+
+/***
+ * 计算字符串长度(英文占1个字符,中文汉字占2个字符)
+ * @param str
+ * @returns {number}
+ */
+export function strlen(str){
+ var len = 0;
+ for (var i=0; i= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) {
+ len++;
+ }
+ else {
+ len+=2;
+ }
+ }
+ return len;
+}
+
+export function substring10(str){
+ var len = 0;
+ var res = '';
+ for (var i=0; i= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) {
+ len++;
+ }
+ else {
+ len+=2;
+ }
+ if(len <= 10){
+ res += str[i];
+ }
+ }
+ return res;
+}
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 61e98f0..f4739d3 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -3,9 +3,17 @@
-
- {{ item.folder }}
- {{ item.folder }}
+
+
+
+ ...
+ {{ item.folder }}
+ {{ substring10(item.folder) }}...
+ {{ item.folder }}
+ {{ substring10(item.folder) }}...
+
+ {{ item.folder }}
+ {{ substring10(item.folder) }}...
- path: {{ path }}
-
+
v.index === index + 2), this.pathList.length - (index + 2))
} else {
@@ -438,7 +453,8 @@ export default {
},
// 新建文件夹
newFolderNameClick() {
- this.newFolderLoading = true
+ console.log('user', this.$store.state.user);
+ this.newFolderLoading = true
if(this.newFolderName){
api.uploadFolder({
isFolder: true,
@@ -462,7 +478,11 @@ export default {
type: 'success',
duration: 1000
})
- this.getFileList()
+ if (this.listModeSearch) {
+ this.getFileListBySearchMode()
+ } else {
+ this.getFileList()
+ }
}
})
}else{
@@ -478,7 +498,6 @@ export default {
},
searchFile(key) {
if(key){
-
this.pathList = [{ 'folder': '', index: 0 }]
const item1 = {}
item1['folder'] = '搜索: ' + '"'+ key +'"'
@@ -503,16 +522,17 @@ export default {
this.tableLoading = false
this.clientHeight = document.documentElement.clientHeight - 150
this.listModeSearch = true
+ this.path = ''
}).catch(e => {})
}else{
this.handleLink('',0)
}
},
- searchFileAndOpenDir(fileId) {
+ searchFileAndOpenDir(row) {
this.tableLoading = true
api.searchFileAndOpenDir({
userId: this.$store.state.user.userId,
- id: fileId,
+ id: row.id,
currentDirectory: getPath(),
pageIndex: 1,
pageSize: 30
@@ -522,6 +542,7 @@ export default {
this.clientHeight = document.documentElement.clientHeight - 150
this.listModeSearch = true
}).catch(e => {})
+ this.path = row.path + row.name
},
getFileList() {
this.tableLoading = true
@@ -537,6 +558,20 @@ export default {
this.listModeSearch = false
}).catch(e => {})
},
+ getFileListBySearchMode() {
+ this.tableLoading = true
+ api.fileList({
+ userId: this.$store.state.user.userId,
+ currentDirectory: this.path,
+ pageIndex: 1,
+ pageSize: 30
+ }).then(res => {
+ this.fileList = res.data
+ this.tableLoading = false
+ this.clientHeight = document.documentElement.clientHeight - 150
+ this.listModeSearch = true
+ }).catch(e => {})
+ },
getSummaries(param) {
// 合计
const { columns, data } = param
@@ -966,19 +1001,17 @@ export default {
if (row.isFolder) {
// 打开文件夹
if (this.listModeSearch) {
-
const item1 = {}
item1['folder'] = row.name
item1['search'] = true
- item1['fileId'] = row.id
+ item1['row'] = row
item1['index'] = this.pathList.length - 1
const item2 = {}
item2['folder'] = '+'
item2['index'] = this.pathList.length
this.pathList[this.pathList.length - 1] = item1
this.pathList.push(item2)
-
- this.searchFileAndOpenDir(row.id)
+ this.searchFileAndOpenDir(row)
} else {
this.path += '/' + row.name
const item1 = {}
@@ -1006,7 +1039,7 @@ export default {