This commit is contained in:
张良(004796)
2024-03-28 17:41:21 +08:00
parent a47a4849eb
commit 254d02c762
8 changed files with 627 additions and 2 deletions

53
src/api/cai/anchorTop.js Normal file
View File

@@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询主播限时置顶列表
export function listAnchorTop(query) {
return request({
url: '/cai/anchorTop/list',
method: 'get',
params: query
})
}
// 查询主播限时置顶详细
export function getAnchorTop(id) {
return request({
url: '/cai/anchorTop/' + id,
method: 'get'
})
}
export function getAnchorTopByUserCode(usercode) {
return request({
url: '/cai/anchorTop/getAnchorTopByUserCode',
method: 'get',
params: {'usercode': usercode}
})
}
// 新增主播限时置顶
export function addAnchorTop(data) {
return request({
url: '/cai/anchorTop',
method: 'post',
data: data
})
}
// 修改主播限时置顶
export function updateAnchorTop(data) {
return request({
url: '/cai/anchorTop',
method: 'put',
data: data
})
}
// 删除主播限时置顶
export function delAnchorTop(id) {
return request({
url: '/cai/anchorTop/' + id,
method: 'delete'
})
}

View File

@@ -314,3 +314,10 @@ export const sensitiveTypeList = [
{ value: 2, label: '黑名单', listClass: listClass.danger},
]
// 1-生效 2-过期 3-待生效
export const topStatusList = [
{ value: 1, label: '生效', listClass: listClass.primary},
{ value: 2, label: '过期', listClass: listClass.info},
{ value: 3, label: '待生效', listClass: listClass.warning},
]

View File

@@ -34,6 +34,28 @@
v-hasPermi="['cai:anchor:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-plus"
size="mini"
@click="handleAnchorTop"
v-hasPermi="['cai:anchorTop:add']"
>新增主播置顶
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-query"
size="mini"
@click="handleAnchorTopList"
v-hasPermi="['cai:anchorTop:list']"
>主播置顶快速查询
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -138,6 +160,8 @@
<add-anchor-dialog v-if="addAnchorDialogVisible" ref="addAnchorDialog" @refreshDataList="getList" />
<update-anchor-dialog v-if="updateAnchorDialogVisible" ref="updateAnchorDialog" @refreshDataList="getList" />
<anchor-info-dialog v-if="anchorInfoDialogVisible" ref="anchorInfoDialog" />
<add-anchor-top-dialog v-if="addAnchorTopDialogVisible" ref="addAnchorTopDialog" @refreshDataList="getList" />
<anchor-top-dialog v-if="anchorTopDialogVisible" ref="anchorTopDialog" />
</div>
</template>
@@ -147,10 +171,13 @@ import {genderList, userStatusList, videoStatusList} from '@/constant/statusMap'
import AddAnchorDialog from "@/views/cai/anchor/add-anchor-dialog";
import UpdateAnchorDialog from "@/views/cai/anchor/update-anchor-dialog";
import AnchorInfoDialog from "@/views/cai/anchor/anchor-info-dialog";
import AddAnchorTopDialog from '@/views/cai/anchorTop/add-anchor-top-dialog.vue'
import AnchorTopDialog from '@/views/cai/anchorTop/anchor-top-dialog.vue'
export default {
name: "Anchor",
components:{
AddAnchorTopDialog,AnchorTopDialog,
AddAnchorDialog,UpdateAnchorDialog,AnchorInfoDialog
},
data() {
@@ -160,6 +187,8 @@ export default {
addAnchorDialogVisible: false,
updateAnchorDialogVisible: false,
anchorInfoDialogVisible: false,
addAnchorTopDialogVisible: false,
anchorTopDialogVisible: false,
// 遮罩层
loading: true,
// 选中数组
@@ -286,6 +315,19 @@ export default {
this.loading = false;
});
},
handleAnchorTop(){
this.addAnchorTopDialogVisible = true
this.$nextTick(() => {
this.$refs.addAnchorTopDialog.init()
})
},
handleAnchorTopList(){
this.anchorTopDialogVisible = true
this.$nextTick(() => {
this.$refs.anchorTopDialog.init()
})
},
}
};
</script>

View File

@@ -0,0 +1,145 @@
<template>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item :label="systemName+'号'" prop="usercode">
<el-autocomplete
class="inline-input"
v-model="form.usercode"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="handleSelect"
></el-autocomplete>
</el-form-item>
<el-form-item label="昵称" v-if="info.nickname">
{{ info.nickname }} {{ info.usercode }}
</el-form-item>
<el-form-item label="性别" v-if="info.gender">
<cai-dict-tag :options="genderList" :value="info.gender" />
</el-form-item>
<el-form-item label="头像" v-if="info.avatar">
<image-avatar :src="info.avatar"/>
</el-form-item>
<el-form-item>
注意只有主播才可以上推荐置顶
</el-form-item>
<el-form-item label="开始时间" prop="beginTime">
<el-date-picker
v-model="form.beginTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择置顶开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker
v-model="form.endTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择置顶结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="比重" prop="sortBy">
<el-input v-model="form.sortBy" placeholder="请输入推广比重,数字越大排名越靠前" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getUserByUsercode, listUserByUserCode } from '@/api/cai/user'
import { genderList } from '@/constant/statusMap'
import { addAnchorTop, getAnchorTopByUserCode } from '@/api/cai/anchorTop'
export default {
components: {
},
data () {
return {
systemName: process.env.VUE_APP_SYSTEM_HOME,
genderList,
open: false,
title: '',
form:{
usercode: undefined,
sortBy: undefined,
beginTime: undefined,
endTime: undefined
},
info:{
},
memberPriceList:[],
// 表单校验
rules: {
usercode: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
sortBy: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
beginTime: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
endTime: [
{ required: true, message: "数据不能为空", trigger: "blur" }
]
},
buttonLoading: false,
}
},
created() {
},
methods: {
init (usercode) {
this.open = true;
this.title = "新增或修改主播置顶"
this.info = {};
this.$nextTick(() => {
this.$refs['form'].resetFields();
console.log(usercode)
if(usercode){
getAnchorTopByUserCode(usercode).then(response => {
if(response.data){
this.form = response.data;
}
});
}
})
},
querySearch(querySearch,cb){
listUserByUserCode(querySearch).then(res => {
cb(res.data.map((terminal) => {
return {
value: terminal,
name: terminal,
};
}))
})
},
handleSelect(item){
getUserByUsercode(item.value).then(res => {
this.info = res.data
})
},
// 表单提交
submitForm () {
this.$refs['form'].validate((valid) => {
if (valid) {
this.buttonLoading = true;
addAnchorTop(this.form).then(data => {
this.$modal.msgSuccess("操作主播置顶成功");
this.buttonLoading = false;
this.open = false
this.$emit('refreshDataList')
}).finally(() => {
this.buttonLoading = false;
});
}
})
},
}
}
</script>

View File

@@ -0,0 +1,144 @@
<template>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="1000px" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="systemName+'号'" prop="usercode">
<el-input
v-model="queryParams.usercode"
:placeholder="'请输入'+systemName+'号'"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="置顶状态" prop="topStatus">
<el-select v-model="queryParams.topStatus" placeholder="置顶状态" clearable size="small">
<el-option
v-for="dict in topStatusList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@keyup.enter.native="handleQuery"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="anchorTopList" >
<el-table-column label="置顶状态" align="center" prop="topStatus">
<template v-slot="scope">
<cai-dict-tag :options="topStatusList" :value="scope.row.topStatus"/>
</template>
</el-table-column>
<el-table-column :label="systemName+'号'" align="center" prop="usercode"/>
<el-table-column label="昵称" align="center" prop="nickname"/>
<el-table-column label="手机" align="center" prop="mobile" width="120"/>
<el-table-column label="头像" align="center" prop="avatar">
<template v-slot="scope">
<image-avatar :src="scope.row.avatar"/>
</template>
</el-table-column>
<el-table-column label="性别" align="center" prop="gender">
<template v-slot="scope">
<cai-dict-tag :options="genderList" :value="scope.row.gender"/>
</template>
</el-table-column>
<el-table-column label="年龄" align="center" prop="age"/>
<el-table-column label="开启时间" align="center" prop="beginTime" width="160" fixed="right"/>
<el-table-column label="结束时间" align="center" prop="endTime" width="160" fixed="right"/>
<el-table-column label="比重" align="center" prop="sortBy" fixed="right"/>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div slot="footer" class="dialog-footer">
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { genderList, topStatusList, userStatusList, videoStatusList } from '@/constant/statusMap'
import { listAnchorTop } from '@/api/cai/anchorTop'
export default {
components: {
},
data () {
return {
genderList, userStatusList, videoStatusList,topStatusList,
systemName: process.env.VUE_APP_SYSTEM_HOME,
addAnchorTopDialogVisible: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 主播限时置顶表格数据
anchorTopList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
usercode: undefined,
nickname: undefined,
mobile: undefined,
topStatus: undefined
},
open: false,
title: '',
buttonLoading: false,
}
},
created() {
},
methods: {
init () {
this.open = true;
this.title = "主播置顶快速查询"
this.getList()
},
/** 查询主播限时置顶列表 */
getList() {
this.loading = true
listAnchorTop(this.queryParams).then(response => {
this.anchorTopList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
}
}
</script>

View File

@@ -0,0 +1,233 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="systemName+'号'" prop="usercode">
<el-input
v-model="queryParams.usercode"
:placeholder="'请输入'+systemName+'号'"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="置顶状态" prop="topStatus">
<el-select v-model="queryParams.topStatus" placeholder="置顶状态" clearable size="small">
<el-option
v-for="dict in topStatusList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@keyup.enter.native="handleQuery"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['cai:anchorTop:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['cai:anchorTop:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['cai:anchorTop:remove']"
>删除
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="anchorTopList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="置顶状态" align="center" prop="topStatus">
<template v-slot="scope">
<cai-dict-tag :options="topStatusList" :value="scope.row.topStatus"/>
</template>
</el-table-column>
<el-table-column :label="systemName+'号'" align="center" prop="usercode"/>
<el-table-column label="昵称" align="center" prop="nickname"/>
<el-table-column label="手机" align="center" prop="mobile" width="120"/>
<el-table-column label="头像" align="center" prop="avatar">
<template v-slot="scope">
<image-avatar :src="scope.row.avatar"/>
</template>
</el-table-column>
<el-table-column label="性别" align="center" prop="gender">
<template v-slot="scope">
<cai-dict-tag :options="genderList" :value="scope.row.gender"/>
</template>
</el-table-column>
<el-table-column label="年龄" align="center" prop="age"/>
<el-table-column label="开启时间" align="center" prop="beginTime" width="160"/>
<el-table-column label="结束时间" align="center" prop="endTime" width="160"/>
<el-table-column label="比重" align="center" prop="sortBy"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['cai:anchorTop:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['cai:anchorTop:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<add-anchor-top-dialog v-if="addAnchorTopDialogVisible" ref="addAnchorTopDialog" @refreshDataList="getList" />
</div>
</template>
<script>
import { delAnchorTop, listAnchorTop } from '@/api/cai/anchorTop'
import { genderList, topStatusList, userStatusList, videoStatusList } from '@/constant/statusMap'
import AddAnchorTopDialog from '@/views/cai/anchorTop/add-anchor-top-dialog.vue'
import UpdateAnchorDialog from '@/views/cai/anchor/update-anchor-dialog.vue'
export default {
name: 'AnchorTop',
components: { UpdateAnchorDialog, AddAnchorTopDialog },
data() {
return {
genderList, userStatusList, videoStatusList,topStatusList,
systemName: process.env.VUE_APP_SYSTEM_HOME,
addAnchorTopDialogVisible: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 主播限时置顶表格数据
anchorTopList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
usercode: undefined,
nickname: undefined,
mobile: undefined,
topStatus: undefined
}
}
},
created() {
this.getList()
},
methods: {
/** 查询主播限时置顶列表 */
getList() {
this.loading = true
listAnchorTop(this.queryParams).then(response => {
this.anchorTopList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.addAnchorTopDialogVisible = true
this.$nextTick(() => {
this.$refs.addAnchorTopDialog.init()
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.addAnchorTopDialogVisible = true
this.$nextTick(() => {
this.$refs.addAnchorTopDialog.init(row.usercode)
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除主播限时置顶的数据项?').then(() => {
this.loading = true
return delAnchorTop(ids)
}).then(() => {
this.loading = false
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
}).finally(() => {
this.loading = false
})
}
}
}
</script>

View File

@@ -99,6 +99,7 @@
</template>
</el-table-column>
<el-table-column label="领奖金额" align="center" prop="rankAwardValue" />
</el-table>
<pagination

View File

@@ -35,8 +35,8 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
// target: `http://localhost:8080`,
target: `http://124.222.254.188:9779/prod-api`,
target: `http://localhost:8080`,
// target: `http://124.222.254.188:9779/prod-api`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''