Skip to content

Commit

Permalink
feat: 实现评论回复功能,实现右键部分功能
Browse files Browse the repository at this point in the history
  • Loading branch information
Lansongxx committed Apr 13, 2024
1 parent 24ebf06 commit 62819bd
Show file tree
Hide file tree
Showing 16 changed files with 221 additions and 236 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@

## 2024-04-13

### ✨ Features | 新功能

* 实现评论回复功能

* 实现右键部分功能

## 2024-04-11

### ✨ Features | 新功能
Expand Down
1 change: 1 addition & 0 deletions src/components/navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const props = defineProps(['link'])
watch(() => props.link, (newVal) => {
if (newVal) {
fatherId.value = newVal
console.log("!!!")
router.push('/personal/' + newVal)
}
})
Expand Down
3 changes: 1 addition & 2 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ export const useStore = defineStore('user', {
spaceSize: "",
md5: "",
isDel: 0,
zone: "",
subZone: "",
description: "",
updateAt: "",
createAt: "",
isChoose: false,
}
}
},
Expand Down
1 change: 1 addition & 0 deletions src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export const GetSlidersUrl = "/system/getSliders"

export const GetCommentsUrl = "/comment/getComments"
export const CreateCommentUrl = "/comment/createComment"
export const GetCommentBlocksUrl = "/comment/getCommentBlocks"
// ----------------------------------------Storage----------------------------------------------------------------------

export const StorageDoGetUser = "DoGetUser" // 是否获取过用户信息
Expand Down
1 change: 0 additions & 1 deletion src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ service.interceptors.response.use(
endLoading()
const status = error.response.status
if (status === 401) {
console.log("shuaxin")
if (localStorage.getItem(StorageAutoLogin) === "true") {//自动登录情况
const longToken = localStorage.getItem(StorageLongToken)
if (longToken) {
Expand Down
22 changes: 18 additions & 4 deletions src/utils/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,33 @@ export type SimpleUser = {
url: string,
}
export type Comment = {
id: string,
commentId: string,
subjectId: string,
rootId: string,
fatherId: string,
count: number,
state: number,
attrs: number,
tags: string[],
labels: string[],
author: SimpleUser,
atUserId: string,
content: string,
meta: string,
createTime: 0,
like: 0
like: 0,
commentRelation: {
liked: boolean,
hated: boolean
}
}

export type CommentBlock = {
comment: Comment,
replyList: {
comments: Comment[],
total: number
token: string
}
}

// 文件信息
Expand All @@ -151,4 +164,5 @@ export type File = {
updateAt: string;
createAt: string;
isChoose: boolean;
}
}

11 changes: 7 additions & 4 deletions src/views/personal/drawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ watch(selectType, (newVal) => {
}
else {
const pathList = (sessionStorage.getItem(StoragePathId) as string).split("/")
console.log(sessionStorage.getItem(StoragePathId) as string)
console.log(pathList)
router.push('/personal/' + pathList[pathList.length - 1])
emit('sendDrawerOptions', 'showFiles')
emit('sendDrawerSelectType', newVal)
Expand All @@ -205,6 +207,9 @@ watch(() => props.sendRequest, () => {
if (props.sendRequest.option === 'createFolder') {
isShowCreateFolder.value = true
}
else if(props.sendRequest.option === 'uploadFile') {
// uploadFiles($event)
}
})
const getSelectType = () => {
Expand Down Expand Up @@ -244,11 +249,10 @@ const createFolder = () => {
spaceSize: getFileSize(data.spaceSize),
md5: data.md5,
isDel: 0,
zone: "",
subZone: "",
description: "",
createAt: new Date().toLocaleString(),
updateAt: new Date().toLocaleString(),
isChoose: false,
}
isShowCreateFolder.value = false
// newFolderName.value = res.name
Expand Down Expand Up @@ -294,11 +298,10 @@ const uploadFiles = (event: any) => {
spaceSize: getFileSize(file.size),
md5,
isDel: 0,
zone: "",
subZone: "",
description: "",
createAt: new Date().toLocaleString(),
updateAt: new Date().toLocaleString(),
isChoose: false,
}
filesCount.value--
if (filesCount.value === 0) {
Expand Down
29 changes: 22 additions & 7 deletions src/views/personal/fileOption.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<template>
<div class="file-option-box">
<div class="create-folder" @click="createFolder">新建文件夹</div>
<div class="upload-file">上传文件</div>
<div class="upload-folder">上传文件夹</div>
<div class="create-folder" @click="createFolder" v-if="!props.AllSelect">新建文件夹</div>
<div class="upload-file" @click="uploadFile" v-if="!props.AllSelect">上传文件</div>
<div class="upload-folder" v-if="!props.AllSelect">上传文件夹</div>
<div class="line"></div>
<div class="all-select" @click="allSelect">全选</div>
<div class="download">下载</div>
<div class="recycle" @click="moveToRecycle">移至回收站</div>
<div class="delete">彻底删除</div>
<div class="delete" @click="cleanOut">彻底删除</div>
<div class="line"></div>
<div class="refresh">刷新页面</div>
<div class="refresh" @click="flashPage">刷新页面</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import {ref, watch} from 'vue'
const emit = defineEmits(['sendFilePopupOptions'])
const props = defineProps<{
AllSelect: boolean,
}>()
const allSelect = () => {
emit('sendFilePopupOptions', 'allSelect')
}
Expand All @@ -26,6 +28,19 @@ const moveToRecycle = () => {
const createFolder = () => {
emit('sendFilePopupOptions', "createFolder")
}
const flashPage = () => {
emit('sendFilePopupOptions', "flashPage")
}
const uploadFile = () => {
emit('sendFilePopupOptions', "uploadFile")
}
const cleanOut = () => {
emit('sendFilePopupOptions', "cleanOutFile")
}
</script>
<style scoped lang="css">
.file-option-box {
Expand Down
48 changes: 27 additions & 21 deletions src/views/personal/files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,7 @@ const props = defineProps<{
}>()
//存储页面文件列表
const nowFilesList = ref<responsePrivateFilesList>({
files: [
{
fileId: '',
userId: '',
name: '',
type: '',
path: '',
fatherId: '',
spaceSize: '',
isDel: 0,
zone: '',
subZone: '',
description: '',
updateAt: '',
createAt: '',
}
],
files: [],
total: 0,
token: '',
fatherIdPath: '',
Expand All @@ -130,6 +114,7 @@ const nowFilesList = ref<responsePrivateFilesList>({
onMounted(async() => {
fatherId.value = getPersonalFatherId()
console.log(fatherId.value)
if (fatherId.value !== 'recycle') {
nowFilesList.value = await getPrivateFilesList({
limit: 100,
Expand All @@ -138,6 +123,7 @@ onMounted(async() => {
backward: true,
onlyFatherId: fatherId.value
})
console.log(nowFilesList.value)
sessionStorage.setItem(StoragePathId, nowFilesList.value.fatherIdPath)
sessionStorage.setItem(StoragePathName, nowFilesList.value.fatherNamePath)
emit('loading', true)
Expand All @@ -164,9 +150,12 @@ onBeforeRouteUpdate(async(to) => {
})
watch(() => store.tempFileData, (newVal) => {
console.log("change!!!")
console.log(nowFilesList.value.files);
console.log(newVal)
nowFilesList.value.files.unshift(newVal)
console.log(nowFilesList.value.files);
console.log(nowFilesList.value.files);
})
watch(() => props.sendRequest, async() => {
switch (props.sendRequest.option) {
Expand Down Expand Up @@ -222,6 +211,24 @@ watch(() => props.sendRequest, async() => {
emit('sendOptions', props.sendRequest.option)
emit('sendDetails', fileDetails.value)
break
case 'flashPage':
fatherId.value = getPersonalFatherId()
nowFilesList.value = await getPrivateFilesList({
limit: 100,
offset: 0,
sortType: sortType.value,
backward: true,
onlyFatherId: fatherId.value
})
sessionStorage.setItem(StoragePathId, nowFilesList.value.fatherIdPath)
sessionStorage.setItem(StoragePathName, nowFilesList.value.fatherNamePath)
emit('loading', true)
break
case 'cleanOutFile':
getRecycleFileDetails()
emit('sendOptions', props.sendRequest.option)
emit('sendDetails', fileDetails.value)
break
default:
console.log('其他操作')
break
Expand Down Expand Up @@ -304,11 +311,10 @@ const dropUploadFile = (event: any) => {
spaceSize: getFileSize(file.size),
md5,
isDel: 0,
zone: "",
subZone: "",
description: "",
createAt: new Date().toLocaleString(),
updateAt: new Date().toLocaleString(),
isChoose: false,
}
})
})
Expand Down
1 change: 1 addition & 0 deletions src/views/personal/path.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ const clickSort = () => {
isShowSort.value = !isShowSort.value
}
const toPath = (index: number) => {
console.log("!!!")
router.push({name: 'personal', params: {fatherId: pathData.value.pathId[index]}})
}
Expand Down
45 changes: 30 additions & 15 deletions src/views/personal/personal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
class="file-options"
:style="{left: filePopupLeft + 'px', top: filePopupTop + 'px'}"
@sendFilePopupOptions = "getFilePopupOptionType"
:AllSelect="AllSelect"
></FileOption>
<Files
v-if="isShowFiles"
Expand Down Expand Up @@ -55,6 +56,7 @@ import FileOption from './fileOption.vue'
import router from '@/router'
import { ref } from 'vue'
import {StoragePathId} from "@/utils/consts";
import {send} from "vite";
const RecycleMsg = ref({
option: "",
message: "",
Expand All @@ -68,17 +70,7 @@ const requestDrawerMessage = ref({
})
const fileContents = ref({
option: "",
contents: [{
fileId: "",
userId: "",
name: "",
type: "",
path: "",
fatherId: "",
spaceSize: "",
createAt: "",
updateAt: ""
}]
contents: [],
})
const requestPathMessage = ref({
Expand All @@ -93,12 +85,13 @@ const isShowPopup = ref(false)
const isClickFile = ref(false)
const isShowFiles = ref(!location.href.includes('recycle'))
let isFirst = false
const AllSelect = ref<boolean>(false)
const getPathMsg = (sendPathMsg: any) => {
requestMessage.value = {
option: sendPathMsg.option,
message: sendPathMsg.message
}
AllSelect.value = !AllSelect.value
}
const getFilePopupOptionType = (sendFilePopupOptions: string) => {
Expand All @@ -122,6 +115,23 @@ const getFilePopupOptionType = (sendFilePopupOptions: string) => {
option: sendFilePopupOptions
}
}
else if(sendFilePopupOptions === 'flashPage') {
requestMessage.value = {
option: sendFilePopupOptions,
message: ""
}
}
else if(sendFilePopupOptions === 'uploadFile') {
requestDrawerMessage.value = {
option: sendFilePopupOptions
}
}
else if(sendFilePopupOptions === 'cleanOutFile') {
requestMessage.value = {
option: sendFilePopupOptions,
message: ""
}
}
}
const showFileOperation = (e: any) => {
Expand Down Expand Up @@ -153,12 +163,17 @@ const showFileOperation = (e: any) => {
})
}
const getRecycleTitleOptions = (sendRecycleTitleOptions: string) => {
if(sendRecycleTitleOptions === 'cleanOutRecycle') {
const getRecycleTitleOptions = (sendRecycleTitleOptions: any) => {
if(sendRecycleTitleOptions.option === 'cleanOutRecycle') {
RecycleMsg.value = {
option: sendRecycleTitleOptions,
option: sendRecycleTitleOptions.option,
message: "",
}
} else if(sendRecycleTitleOptions.option === 'AllSelect') {
RecycleMsg.value = {
option: sendRecycleTitleOptions.option,
message: (sendRecycleTitleOptions.msg !== true) ? "true": "false",
}
}
}
const getDrawerOptionType = (sendDrawerOptions: string) => {
Expand Down
Loading

0 comments on commit 62819bd

Please sign in to comment.