57 lines
1.1 KiB
Vue
57 lines
1.1 KiB
Vue
<template>
|
|
<div v-if="show" class="p-2">
|
|
<FormControl
|
|
:type="'textarea'"
|
|
size="sm"
|
|
variant="subtle"
|
|
placeholder="在此输入您的评论"
|
|
:disabled="false"
|
|
label="评论"
|
|
v-model="newComment"
|
|
/>
|
|
<div class="flex justify-end mt-2">
|
|
<Button
|
|
:variant="'solid'"
|
|
theme="gray"
|
|
size="sm"
|
|
@click="submitComment"
|
|
:disabled="!newComment.trim()"
|
|
>
|
|
评论
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: ['approval_request_name', 'filename', 'line_number'],
|
|
data() {
|
|
return {
|
|
show: true,
|
|
newComment: ''
|
|
};
|
|
},
|
|
methods: {
|
|
submitComment() {
|
|
const commentData = {
|
|
name: this.approval_request_name,
|
|
filename: this.filename,
|
|
line_number: this.line_number,
|
|
comment: this.newComment
|
|
};
|
|
this.$resources.addComment.submit(commentData);
|
|
this.newComment = '';
|
|
this.$emit('comment-submitted');
|
|
}
|
|
},
|
|
resources: {
|
|
addComment() {
|
|
return {
|
|
url: 'jcloud.api.marketplace.add_code_review_comment',
|
|
method: 'POST'
|
|
};
|
|
}
|
|
}
|
|
};
|
|
</script> |