Skip to content

Commit

Permalink
second commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zoey-shan committed Dec 23, 2020
1 parent 8680c70 commit 0b47f48
Show file tree
Hide file tree
Showing 5 changed files with 413 additions and 141 deletions.
4 changes: 3 additions & 1 deletion src/plugins/ant-design-vue.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from 'vue'
import { Pagination, Button, LocaleProvider, Layout, Menu, Dropdown, Icon, Tabs, List, Card, Modal, Checkbox, Input, FormModel, message, Descriptions, Carousel, Avatar, Divider, PageHeader, Breadcrumb, Upload, Switch, Statistic, Radio, Table, DatePicker, InputNumber, Collapse, Form, Steps, Tag, Tooltip, Select, Comment, Popconfirm, Popover, Rate, Result, Drawer } from 'ant-design-vue'
import { Pagination, Button, LocaleProvider, Layout, Menu, Dropdown, Icon, Tabs, List, Card, Modal, Checkbox, Input, FormModel, message, Descriptions, Carousel, Avatar, Divider, PageHeader, Breadcrumb, Upload, Switch, Statistic, Radio, Table, DatePicker, InputNumber, Collapse, Form, Steps, Tag, Tooltip, Select, Comment, Popconfirm, Popover, Rate, Result, Drawer, Slider } from 'ant-design-vue'
import { Col, Row } from 'ant-design-vue/lib/grid'
import BreadcrumbItem from 'ant-design-vue/lib/breadcrumb/BreadcrumbItem'
import BreadcrumbSeparator from 'ant-design-vue/lib/breadcrumb/BreadcrumbSeparator'
Expand Down Expand Up @@ -84,6 +84,7 @@ Vue.component(Comment.name, Comment)
Vue.component(Tooltip.name, Tooltip)
Vue.component(Breadcrumb.name, Breadcrumb)
Vue.component(Breadcrumb.Item.name, Breadcrumb.Item)
Vue.component(Form.name, Form)
Vue.component(Form.Item.name, Form.Item)
Vue.component(Steps.name, Steps)
Vue.component(Steps.Step.name, Steps.Step)
Expand All @@ -97,3 +98,4 @@ Vue.component(Rate.name, Rate)
Vue.component(Result.name, Result)
// Vue.component(Drawer.name, Drawer)
Vue.use(Drawer)
Vue.component(Slider.name, Slider)
16 changes: 10 additions & 6 deletions src/static/reset.less
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@
.ant-menu.ant-menu-inline.ant-menu-root.ant-menu-dark {
height: 400px;
}
.ant-form.ant-form-horizontal {
border-style: dashed;
border-color: dodgerblue;
border-radius: 25px;
//.ant-form.ant-form-horizontal {
// border-style: dashed;
// border-color: dodgerblue;
// border-radius: 25px;
//}
.ant-list-item-meta-description {
color: white;
}


.ant-select-selection_rendered {
color: darkgray;
}
117 changes: 115 additions & 2 deletions src/views/Admin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@
</a-upload>
</div>
</a-tab-pane>
<a-tab-pane key="4" tab="Reported comments">
<a-table :columns="cols" :data-source="report_back">
<span slot="toDelete" slot-scope="text,record">
<a-button type="danger" shape="round" @click="deleteComment(record)">
Delete
</a-button>
</span>
</a-table>
</a-tab-pane>
</a-tabs>
</a-col>
</a-row>
Expand All @@ -136,7 +145,32 @@

<script>
import qs from 'qs'
const cols = [
{
title: 'Comment ID',
dataIndex: 'comment_id',
key: 'comment_id'
},
{
title: 'Content',
dataIndex: 'content',
key: 'content'
},
{
title: 'Game ID',
dataIndex: 'game_id',
key: 'game_id'
},
{
title: 'Reportee ID',
dataIndex: 'reportee_id',
key: 'reportee_id'
},
{
title: 'Delete Comment',
scopedSlots: { customRender: 'toDelete' }
}
]
export default {
name: 'Admin',
data () {
Expand Down Expand Up @@ -164,9 +198,16 @@ export default {
current_role: '',
headers: {
authorization: 'authorization-text'
}
},
report_back: [],
report_detail: [],
cols,
report_id: 0
}
},
created () {
this.getReport()
},
methods: {
callback (key) {
console.log(key)
Expand Down Expand Up @@ -307,6 +348,78 @@ export default {
} else if (info.file.status === 'error') {
this.$message.error(`${info.file.name} file upload failed.`)
}
},
async getReport () {
await this.$http.get('/api/admin/comment/report/list', {
params: {
page_num: 0,
page_size: 6
}
})
.then((response) => {
// if (response.status === 200 && response.code === 0) {
// this.$message.success('Create successfully')
// } else {
// this.$message.error('Error!')
// }
if (response.status === 200 && response.data.code === 0) {
this.$message.success('get report successfully')
console.log('see what', response.data)
this.report_back = response.data.data
console.log('report back1', this.report_back)
} else {
this.$message.error(response.data.msg)
}
})
.catch((error) => {
console.log(error)
})
console.log('report back2', this.report_back)
for (var i = 0; i < this.report_back.length; i++) {
this.$http.get('/api/admin/comment/report', {
params: {
comment_id: this.report_back[i].comment_id
}
})
.then((response) => {
// if (response.status === 200 && response.code === 0) {
// this.$message.success('Create successfully')
// } else {
// this.$message.error('Error!')
// }
if (response.status === 200 && response.data.code === 0) {
this.$message.success('get detail successfully')
this.report_detail[i] = response.data.data
} else {
this.$message.error(response.data.msg)
}
})
.catch((error) => {
console.log(error)
})
}
},
deleteComment (comment) {
// console.log('post id type',typeof(comment.comment_id))
this.report_id = comment.comment_id
console.log('report id', this.report_id)
this.$http.post('/api/admin/comment/delete', qs.stringify({
comment_id: this.report_id
}))
.then((response) => {
console.log(response)
// if (response.status === 200 && response.code === 0) {
// this.$message.success('Create successfully')
// } else {
// this.$message.error('Error!')
// }
if (response.status === 200 && response.code === 0) {
this.$message.success('Delete successfully')
}
})
.catch((error) => {
console.log(error)
})
}
}
}
Expand Down
Loading

0 comments on commit 0b47f48

Please sign in to comment.