新增用户头像管理

This commit is contained in:
chenruiye
2025-03-19 15:41:30 +08:00
parent af6f1a922b
commit 5d04652a1e
2 changed files with 184 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import request from "@/utils/request";
// 列表
export const getavatarPaidRecordList = query => {
return request({
url: '/admin/avatarPaidRecord/page',
method: 'get',
params: query,
});
}
// 下架
export const resetAvatarPaidRecord = query => {
return request({
url: '/admin/avatarPaidRecord/reset',
method: 'get',
params: query,
});
}

View File

@@ -0,0 +1,166 @@
<template>
<div class="box">
<div class="inquire">
<span>用户ID</span>
<el-input v-model="formData.erbanNo" placeholder="请输入用户id逗号隔开" class="input"></el-input>
</div>
<div class="inquire">
<span>分区</span>
<el-select v-model="formData.partitionId" placeholder="请选择">
<el-option v-for="item in partitionOptions" :key="item.id" :label="item.desc" :value="item.id">
</el-option>
</el-select>
</div>
<div class="inquire">
<span>状态</span>
<el-select v-model="formData.status" placeholder="请选择">
<el-option label="全部" :value="''"></el-option>
<el-option label="上架" :value="true"></el-option>
<el-option label="下架" :value="false"></el-option>
</el-select>
</div>
<el-button style="" type="primary" @click="getData()">查询</el-button>
<!-- 表格数据 -->
<el-table v-loading="tableData.loading" :data="tableData.data" ref="multipleTable"
@selection-change="handleSelectionChange" border style="width: 100%; margin-top: 25px">
<el-table-column prop="erbanNo" align="center" label="用户ID" />
<el-table-column prop="nick" align="center" label="用户昵称" />
<el-table-column prop="partitionDesc" align="center" label="分区" />
<el-table-column prop="avatar" align="center" label="头像">
<template v-slot="scope">
<el-image style="width: 100px; height: 100px" :src="scope.row.avatarUrl" :zoom-rate="1.1"
:preview-src-list="[scope.row.avatarUrl]" fit="scale-down" preview-teleported="true"
hide-on-click-modal="true" />
</template>
</el-table-column>
<el-table-column prop="status" align="center" label="状态">
<template v-slot="scope">
{{ scope.row.status ? '上架' : '下架' }}
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="300">
<template v-slot="scope">
<el-button class="primary" type="primary" @click="
resetData(scope.row);
" size="default" v-if="scope.row.status">下架</el-button>
</template>
</el-table-column>
<el-table-column prop="adminName" align="center" label="操作人" />
</el-table>
<!-- 分页 -->
<el-pagination style="margin-top: 10px" class="paginationClass" :current-page="formData.page"
:page-size="formData.pageSize" :page-sizes="[10, 20, 50, 100, 200]" layout="sizes, prev, pager, next"
:total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>
</template>
<script>
import { ref, onMounted, reactive } from 'vue'
import { listPartitionInfo } from "@/api/common/partition";
import { getavatarPaidRecordList, resetAvatarPaidRecord } from "@/api/users/userAvatarManagement";
import { ElMessage, ElMessageBox } from "element-plus";
export default {
name: 'userAvatarManagement',
setup() {
const formData = reactive({
erbanNo: '',
page: 1,
pageSize: 10,
partitionId: '',
status: ''
})
const tableData = reactive({
data: [],
loading: false,
total: ''
});
const partitionOptions = ref([]);
const getData = () => {
tableData.loading = true;
getavatarPaidRecordList(formData).then(res => {
if (res.code == 200) {
tableData.data = res.data.rows;
tableData.loading = false;
tableData.total = res.data.total;
} else {
tableData.loading = false;
ElMessage.error(res.message);
}
});
}
const resetData = (obj) => {
ElMessageBox.confirm('是否下架用户ID为' + obj.erbanNo + '的头像', "提示", {
type: "warning",
confirmButtonText: "确定",
cancelButtonText: "取消",
}).then(async () => {
const res = await resetAvatarPaidRecord({
id:obj.id
});
if (res.code == 200) {
ElMessage({
message: '下架成功',
type: 'success',
});
getData()
}
});
}
const handleSizeChange = (val) => {
formData.pageSize = val;
getData();
};
const handleCurrentChange = (val) => {
formData.page = val;
getData();
};
onMounted(() => {
listPartitionInfo().then(res => {
partitionOptions.value = res.data;
});
});
return {
formData,
partitionOptions,
getData,
tableData,
resetData,
handleCurrentChange,
handleSizeChange
}
}
}
</script>
<style lang="less" scoped>
.box {
padding-top: 20px;
background: #ecf0f5;
.inquire {
display: inline-block;
margin-right: 20px;
span {
margin-right: 10px;
}
.input {
width: 180px;
margin-right: 10px;
}
}
.dialogTableVisibleBut {
display: block;
margin: 30px 0 0 830px;
}
.paginationClass {
margin: 15px 0 5px 0px;
}
}
</style>