Skip to content

Commit

Permalink
fix : 修复筛选后路径跳转失败的BUG (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lansongxx authored Mar 30, 2024
1 parent 44bedb9 commit 282bb0b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

## 2024-03-30

### 🐛 Bug Fixes | Bug 修复

* 修复筛选后路径跳转失败的BUG

## 2024-03-29

### ✨ Features | 新功能
Expand Down
3 changes: 3 additions & 0 deletions src/views/personal/drawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ import { useStore } from '@/store/index'
import { cosUploadFile } from '@/utils/cos'
import {postCreateFile, getFileSize, getPersonalFatherId, getCategory} from './utils'
import type { requestCreateFile } from './utils'
import router from "@/router";
const folder = ref()
const store = useStore()
Expand Down Expand Up @@ -187,6 +188,8 @@ watch(selectType, (newVal) => {
emit('sendDrawerOptions', 'showRecycle')
}
else {
const pathList = (sessionStorage.getItem("PathId") as string).split("/")
router.push('/personal/' + pathList[pathList.length - 1])
emit('sendDrawerOptions', 'showFiles')
emit('sendDrawerSelectType', newVal)
}
Expand Down
6 changes: 0 additions & 6 deletions src/views/personal/files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ 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 @@ -160,9 +159,6 @@ 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 @@ -302,7 +298,6 @@ const optionType = (sendOptions: string) => {
// 文件筛选
const classifyFile = async () => {
isClassifyFiles.value = true
let category = 0;
switch (props.sendRequest.message) {
case "file":
Expand Down Expand Up @@ -360,7 +355,6 @@ 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
12 changes: 9 additions & 3 deletions src/views/personal/personal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const isShowRecycle = ref(location.href.includes('recycle'))
const isLoading = ref(false)
const isShowPopup = ref(false)
const isShowFiles = ref(!location.href.includes('recycle'))
let isFirst = false
const getPathMsg = (sendPathMsg: any) => {
requestMessage.value = {
option: sendPathMsg.option,
Expand All @@ -83,15 +83,21 @@ const getDrawerOptionType = (sendDrawerOptions: string) => {
isShowFiles.value = false
}
else if (sendDrawerOptions === 'showFiles'){
const pathList = (sessionStorage.getItem("PathId") as string).split("/")
router.push('/personal/' + pathList[pathList.length - 1])
isShowRecycle.value = false
isShowFiles.value = true
}
}
const getDrawerSelectType = (sendDrawerSelectType: any) => {
if(isFirst) {
requestMessage.value = {
option: "classifyFiles",
message: sendDrawerSelectType
option: "classifyFiles",
message: sendDrawerSelectType
}
} else {
isFirst = true
}
}
const getLoading = (loading: boolean) => {
Expand Down
3 changes: 2 additions & 1 deletion src/views/personal/rename-box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const confirm = () => {
post('/content/updateFile', {
fileId: props.sendName.fileId,
name: name.value
}).then(() => {
}).then((res:any) => {
name.value = res.name
emit('sendRename', {
option: 'confirm',
message: name.value
Expand Down
5 changes: 2 additions & 3 deletions src/views/personal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ const downloadFile = (url: string, fileName: string) => {

// 请求彻底删除文件
export const postCleanOutFile = async(fileIdList: string[]) :Promise<void> => {
const fileId = fileIdList[0]
await post('/content/completelyRemoveFile', {
fileId
fileIds: fileIdList
})
.then(() => {
successMsg('成功彻底删除')
Expand Down Expand Up @@ -189,7 +188,6 @@ export const getRecycleFilesList = async(params: requestPrivateFilesList): Promi
token: res.token,
}
})
console.log(filesList.value);
return filesList.value
}

Expand Down Expand Up @@ -235,6 +233,7 @@ export const getPrivateFilesList = async(params: requestPrivateFilesList): Promi
fatherNamePath: "",
})
const url = '/content/getPrivateFiles' + generateGetRequestURL(params)
console.log(url)
await get(url)
.then ((res: any) => {
filesList.value = {
Expand Down

0 comments on commit 282bb0b

Please sign in to comment.