144 lines
3.8 KiB
Vue
144 lines
3.8 KiB
Vue
<template>
|
||
<div>
|
||
<div class="crumbs">
|
||
<el-breadcrumb separator="/">
|
||
<el-breadcrumb-item>
|
||
<i class="el-icon-warning-outline"></i> User Blacklist
|
||
</el-breadcrumb-item>
|
||
</el-breadcrumb>
|
||
</div>
|
||
|
||
<div class="container">
|
||
<div class="handle-box">
|
||
<el-input v-model="query.keywords" placeholder="Account / Realname / Email"
|
||
style="width: 230px;margin: 0 10px 0 0;">
|
||
</el-input>
|
||
<el-button type="primary" icon="el-icon-search" @click="query.pageIndex = 1;getDate()">Search
|
||
</el-button>
|
||
</div>
|
||
<el-table :data="tableData" border class="table" ref="multipleTable" header-cell-class-name="table-header"
|
||
empty-text="New messages (0)">
|
||
<el-table-column prop="account" label="Account"></el-table-column>
|
||
<el-table-column prop="realname" label="Realname"></el-table-column>
|
||
<el-table-column prop="email" label="Email"></el-table-column>
|
||
<el-table-column label="Black time" width="90px" align="center">
|
||
<template slot-scope="scope">
|
||
{{formatDate(scope.row.black_ctime)}}
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="reason" label="Black reasons"></el-table-column>
|
||
<el-table-column label=" " width="185" align="center" v-if="this.userrole == 0">
|
||
<template slot-scope="scope">
|
||
<el-button plain type="success" icon="el-icon-unlock" @click="handleEdit(scope.row)">Remove
|
||
the blacklist</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<div class="pagination">
|
||
<el-pagination background layout="total, prev, pager, next" :current-page="query.pageIndex"
|
||
:page-size="query.pageSize" :total="link_Total" @current-change="handlePageChange">
|
||
</el-pagination>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
mediaUrl: this.Common.mediaUrl,
|
||
userrole: localStorage.getItem('U_status'),
|
||
tableData: [],
|
||
detailForm: {},
|
||
query: {
|
||
pageIndex: 1,
|
||
pageSize: 15,
|
||
keywords:''
|
||
},
|
||
link_Total: 0,
|
||
};
|
||
},
|
||
mounted() {
|
||
|
||
},
|
||
created() {
|
||
this.getDate()
|
||
},
|
||
methods: {
|
||
// 获取数据
|
||
getDate() {
|
||
this.$api
|
||
.post('api/User/getUserBlackList', this.query)
|
||
.then(res => {
|
||
if (res.code == 0) {
|
||
this.tableData = res.data.blacks;
|
||
this.link_Total = res.data.count || 0;
|
||
} else {
|
||
this.$message.error(res.msg);
|
||
}
|
||
})
|
||
.catch(err => {
|
||
this.$message.error(err);
|
||
});
|
||
},
|
||
// 拉黑操作
|
||
handleEdit(row) {
|
||
// 二次确认更改状态
|
||
this.$confirm('Are you sure you want ' + row.realname + ' to remove blacklist?', 'Tip', {
|
||
type: 'warning'
|
||
})
|
||
.then(() => {
|
||
this.$api
|
||
.post('api/User/clearBlack', row)
|
||
.then(res => {
|
||
if (res.code == 0) {
|
||
this.$message.success('Remove successful!');
|
||
this.getDate();
|
||
} else {
|
||
this.$message.error(res.msg);
|
||
}
|
||
})
|
||
.catch(err => {
|
||
this.$message.error(err);
|
||
});
|
||
})
|
||
.catch(() => {});
|
||
},
|
||
|
||
|
||
// 分页导航
|
||
handlePageChange(val) {
|
||
this.$set(this.query, 'pageIndex', val);
|
||
this.getDate();
|
||
},
|
||
|
||
// 时间转换
|
||
formatDate(timestamp) {
|
||
var date = new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
|
||
var Y = date.getFullYear() + '-';
|
||
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
|
||
var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
|
||
var h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
||
var m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
||
var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
|
||
return Y + M + D;
|
||
},
|
||
|
||
},
|
||
computed: {
|
||
|
||
},
|
||
watch: {
|
||
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style scoped>
|
||
.handle-box {
|
||
margin-bottom: 20px;
|
||
}
|
||
</style>
|