Skip to content

Commit

Permalink
fix:修复在一目录下筛选文件后路由跳转回根目录的BUG (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
anguoo authored Mar 29, 2024
1 parent aefce30 commit 1742f25
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 38 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

* 修复推荐页面粉丝数量显示的BUG

* 修复在一目录下筛选文件后路由跳转回根目录的BUG

## 2024-03-28

### 🐛 Bug Fixes | Bug 修复
Expand Down
73 changes: 40 additions & 33 deletions src/views/personal/files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import type { responsePrivateFilesList, fileData, requestCreateFile } from './ut
const store = useStore()
const optionTop = ref<number>(0)
const optionLeft = ref<number>(0)
const isClassifyFiles = ref(false)
const fatherId = ref<string>("")
const chooseFileList = ref<boolean[]>([])
const fileDetails = ref<fileData[]>(
Expand Down Expand Up @@ -159,6 +160,9 @@ onMounted(async() => {
})
onBeforeRouteUpdate(async(to) => {
if (isClassifyFiles.value) {
return
}
fatherId.value = to.params.fatherId as string
nowFilesList.value = await getPrivateFilesList({
limit: 100,
Expand Down Expand Up @@ -298,39 +302,41 @@ const optionType = (sendOptions: string) => {
// 文件筛选
const classifyFile = async () => {
let category = 0;
switch (props.sendRequest.message) {
case "file":
category = 1
break;
case "image":
category = 2
break;
case "video":
category = 3
break;
case "music":
category = 4
break;
}
if (category !== 0) {
nowFilesList.value = await getPrivateFilesList({
limit: 100,
offset: 0,
sortType: 3,
backward: true,
onlyFatherId: fatherId.value,
onlyCategory: category,
})
} else {
nowFilesList.value = await getPrivateFilesList({
limit: 100,
offset: 0,
sortType: 3,
backward: true,
onlyFatherId: fatherId.value,
})
}
isClassifyFiles.value = true
let category = 0;
switch (props.sendRequest.message) {
case "file":
category = 1
break;
case "image":
category = 2
break;
case "video":
category = 3
break;
case "music":
category = 4
break;
}
if (category !== 0) {
nowFilesList.value = await getPrivateFilesList({
limit: 100,
offset: 0,
sortType: 3,
backward: true,
onlyFatherId: fatherId.value,
onlyCategory: category,
})
}
else {
nowFilesList.value = await getPrivateFilesList({
limit: 100,
offset: 0,
sortType: 3,
backward: true,
onlyFatherId: fatherId.value,
})
}
}
const textLog = (index: number) => {
Expand All @@ -354,6 +360,7 @@ const getOptions = (file: fileData, event: any, index: number) => {
const toFile = (file: fileData) => {
if (file.type === '文件夹') {
isClassifyFiles.value = false
fatherId.value = file.fileId
router.push({name: 'personal', params: {fatherId: fatherId.value}})
}
Expand Down
6 changes: 1 addition & 5 deletions src/views/personal/personal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ import RecycleTitle from './recycle-title.vue'
import CHeader from '@/components/header.vue'
import router from '@/router'
import { ref } from 'vue'
import { useStore } from '@/store'
const store = useStore()
const requestMessage = ref({
option: "",
message: ""
Expand Down Expand Up @@ -84,9 +82,7 @@ const getDrawerOptionType = (sendDrawerOptions: string) => {
isShowRecycle.value = true
isShowFiles.value = false
}
else {
const userId = store.getUserId()
router.push('/personal/' + userId)
else if (sendDrawerOptions === 'showFiles'){
isShowRecycle.value = false
isShowFiles.value = true
}
Expand Down

0 comments on commit 1742f25

Please sign in to comment.