-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1055aa
commit ead7f03
Showing
12 changed files
with
645 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import axios from 'axios'; | ||
|
||
export interface IComment { | ||
repliedTo: { | ||
name: string; | ||
id: string; | ||
} | null; | ||
blogId: string; | ||
content: string; | ||
parentId: string; | ||
} | ||
|
||
export const queryComments = (blogId: string, token: string) => { | ||
return new Promise((resolve, reject) => { | ||
axios | ||
.get(`${process.env.VUE_APP_URL}/myWeb/comment`, { | ||
headers: { | ||
authorization: 'Bearer ' + token, | ||
'Content-Type': 'application/json', | ||
}, | ||
params: { blogId }, | ||
}) | ||
.then((res) => { | ||
resolve(res.data); | ||
}) | ||
.catch((err) => { | ||
reject(err); | ||
}); | ||
}); | ||
}; | ||
|
||
export const newComment = (comment: IComment, token: string) => { | ||
return new Promise((resolve, reject) => { | ||
axios | ||
.post( | ||
`${process.env.VUE_APP_URL}/myWeb/comment`, | ||
{ | ||
data: { ...comment }, | ||
}, | ||
{ | ||
headers: { | ||
authorization: 'Bearer ' + token, | ||
'Content-Type': 'application/json', | ||
}, | ||
} | ||
) | ||
.then((res) => { | ||
resolve(res.data); | ||
}) | ||
.catch((err) => { | ||
reject(err); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<template> | ||
<el-drawer | ||
:modal="true" | ||
:modal-append-to-body="true" | ||
:withHeader="false" | ||
:visible="isDrawerShow" | ||
@close="onDrawerClose" | ||
> | ||
<slot></slot> | ||
</el-drawer> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue'; | ||
import Component from 'vue-class-component'; | ||
@Component({ | ||
name: 'Drawer', | ||
props: { | ||
isDrawerShow: Boolean, | ||
}, | ||
}) | ||
export default class Drawer extends Vue { | ||
public onDrawerClose(): void { | ||
this.$emit('toggleDrawer', false) | ||
} | ||
} | ||
</script> | ||
<style lang="scss" scoped> | ||
/deep/ .el-drawer__body { | ||
overflow: scroll; | ||
} | ||
</style> |
Oops, something went wrong.