This commit is contained in:
yziiy
2026-01-27 11:54:31 +08:00
parent a2742df52a
commit aa1185ff4c
7 changed files with 295 additions and 195 deletions

View File

@@ -137,3 +137,17 @@ export const userRelationList = params => {
{ params }
);
}
// 获取封禁理由列表
export const getBanReason = () => {
return http.request<Result>(
"get",
"/adminapi/User/getBanEason"
);
};
// 获取封禁时间列表
export const getBanDay = () => {
return http.request<Result>(
"get",
"/adminapi/User/getBanDay"
);
};

View File

@@ -1,7 +1,7 @@
export const URL = "https://yushengapi.qxyushen.top";
// export const URL = "https://yushengapi.qxyushen.top";
// 预测版
// export const URL = "https://vsyusheng.qxhs.xyz";
// 测试
// export const URL = "https://test.vespa.qxyushen.top";
export const URL = "https://test.vespa.qxyushen.top";
// 声网appId 在这里换
export const appIdBySw = "02f7339ec98947deaeab173599891932";

View File

@@ -1,8 +1,15 @@
<script setup lang="ts">
import { ref } from "vue";
import { ref, onMounted } from "vue";
import { getBanReason, getBanDay } from "@/api/modules/newuserList";
const ruleFormRef = ref();
const formRules = ref({
tag_name: [{ required: true, message: "请输入标签名称", trigger: "blur" }, { min: 1, max: 10, message: '长度在 1 到 10 个字符', trigger: 'blur' }]
type_text: [
{ required: true, message: "请输入禁用IP/设备号", trigger: "blur" }
],
ban_reason: [
{ required: true, message: "请选择封禁理由", trigger: "change" }
],
ban_day: [{ required: true, message: "请选择封禁时间", trigger: "change" }]
});
const props = defineProps(["formInline"]);
const newFormInline = ref(
@@ -12,9 +19,40 @@ const newFormInline = ref(
type: 2,
typeTimeType: 0,
type_text: "",
block_time: ""
block_time: "",
ban_reason: "",
ban_day: ""
}
);
const banReasonOptions = ref([]);
const banDayOptions = ref([]);
// 获取封禁理由列表
const fetchBanReasons = async () => {
const { data, code } = await getBanReason();
if (code) {
banReasonOptions.value = Object.keys(data).map(key => ({
label: data[key],
value: key
}));
}
};
// 获取封禁时间列表
const fetchBanDays = async () => {
const { data, code } = await getBanDay();
if (code) {
banDayOptions.value = Object.keys(data).map(key => ({
label: data[key],
value: key
}));
}
};
onMounted(() => {
fetchBanReasons();
fetchBanDays();
});
function getRef() {
return ruleFormRef.value;
@@ -33,7 +71,17 @@ defineExpose({ getRef });
<el-form-item label="禁用IP/设备号" prop="type_text">
<el-input v-model="newFormInline.type_text" clearable placeholder="请输入禁用IP/设备号" />
</el-form-item>
<el-form-item label="封禁时间" prop="typeTimeType">
<el-form-item label="封禁理由" prop="ban_reason">
<el-select v-model="newFormInline.ban_reason" placeholder="请选择封禁理由" style="width: 100%">
<el-option v-for="item in banReasonOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="封禁时间" prop="ban_day">
<el-select v-model="newFormInline.ban_day" placeholder="请选择封禁时间" style="width: 100%">
<el-option v-for="item in banDayOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<!-- <el-form-item label="封禁时间" prop="typeTimeType">
<el-radio-group v-model="newFormInline.typeTimeType">
<el-radio label="永久" :value="0" />
<el-radio label="设置时间" :value="1" />
@@ -42,6 +90,6 @@ defineExpose({ getRef });
<el-form-item label="禁用时间" prop="time" v-if="newFormInline.typeTimeType === 1">
<el-date-picker type="date" placeholder="选择日期" v-model="newFormInline.block_time" style="width: 100%;"
format="YYYY-MM-DD" value-format="YYYY-MM-DD"></el-date-picker>
</el-form-item>
</el-form-item> -->
</el-form>
</template>

View File

@@ -52,15 +52,14 @@ export function useData() {
slot: "operation"
}
]);
const detailData = ref(null)
const onSearch = async (formData) => {
const detailData = ref(null);
const onSearch = async formData => {
loading.value = true;
searchForm.value = { ...formData }
searchForm.value = { ...formData };
const { data, code } = await queryBanUserList({
...formData,
page: pagination.value.currentPage,
page_limit: pagination.value.pageSize,
page_limit: pagination.value.pageSize
});
if (code) {
detailData.value = data;
@@ -84,8 +83,8 @@ export function useData() {
props: {
formInline: {
type: rowData?.type ?? 2,
type_text: '',
block_time: ''
type_text: "",
block_time: ""
}
},
width: "40%",
@@ -100,8 +99,10 @@ export function useData() {
const formData = {
type: form.type,
type_text: form.type_text,
block_time: form.typeTimeType === 0 ? 0 : form.block_time
}
block_time: form.typeTimeType === 0 ? 0 : form.block_time,
ban_eason: form.ban_reason, // 封禁理由
ban_day: form.ban_day // 封禁时间
};
// console.log(formData)
const { code, msg } = await banUserByIpData(formData);
if (code) {

View File

@@ -1,8 +1,13 @@
<script setup lang="ts">
import { ref } from "vue";
import { ref, onMounted } from "vue";
import { getBanReason, getBanDay } from "@/api/modules/newuserList";
const ruleFormRef = ref();
const formRules = ref({
type: [{ required: true, message: '请选择封禁类型', trigger: 'change' }]
type: [{ required: true, message: "请选择封禁类型", trigger: "change" }],
ban_reason: [
{ required: true, message: "请选择封禁理由", trigger: "change" }
],
ban_day: [{ required: true, message: "请选择封禁时间", trigger: "change" }]
});
const props = defineProps(["formInline", "userData"]);
const newFormInline = ref(
@@ -11,9 +16,40 @@ const newFormInline = ref(
: {
type: 1,
timeType: 0,
status: 1
status: 1,
ban_reason: "",
ban_day: ""
}
);
const banReasonOptions = ref([]);
const banDayOptions = ref([]);
// 获取封禁理由列表
const fetchBanReasons = async () => {
const { data, code } = await getBanReason();
if (code) {
banReasonOptions.value = Object.keys(data).map(key => ({
label: data[key],
value: key
}));
}
};
// 获取封禁时间列表
const fetchBanDays = async () => {
const { data, code } = await getBanDay();
if (code) {
banDayOptions.value = Object.keys(data).map(key => ({
label: data[key],
value: key
}));
}
};
onMounted(() => {
fetchBanReasons();
fetchBanDays();
});
function getRef() {
return ruleFormRef.value;
@@ -22,14 +58,53 @@ defineExpose({ getRef });
</script>
<template>
<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="120px">
<el-form
ref="ruleFormRef"
:model="newFormInline"
:rules="formRules"
label-width="120px"
>
<el-form-item label="封禁类型" prop="type">
<el-radio-group v-model="newFormInline.type">
<el-radio label="禁用账号" :value="1" />
<!-- <el-radio label="禁用设备号" :value="2" />
<el-radio label="禁用IP" :value="3" /> -->
</el-radio-group>
</el-form-item>
<el-form-item
v-if="props.userData.status == 1"
label="封禁理由"
prop="ban_reason"
>
<el-select
v-model="newFormInline.ban_reason"
placeholder="请选择封禁理由"
style="width: 100%"
>
<el-option
v-for="item in banReasonOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item
v-if="props.userData.status == 1"
label="封禁时间"
prop="ban_day"
>
<el-select
v-model="newFormInline.ban_day"
placeholder="请选择封禁时间"
style="width: 100%"
>
<el-option
v-for="item in banDayOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<!-- 禁用账号 -->
<template v-if="newFormInline.type === 1">
<template v-if="props.userData.status == 2">
@@ -41,65 +116,6 @@ defineExpose({ getRef });
</el-radio-group>
</el-form-item>
</template>
<template v-else>
<el-form-item label="封禁时间" prop="timeType">
<el-radio-group v-model="newFormInline.timeType">
<el-radio label="永久" :value="0" />
<el-radio label="设置时间" :value="1" />
</el-radio-group>
</el-form-item>
<el-form-item label="禁用时间" prop="time" v-if="newFormInline.timeType === 1">
<el-date-picker type="date" placeholder="选择日期" v-model="newFormInline.time" style="width: 100%;"
format="YYYY-MM-DD" value-format="YYYY-MM-DD"></el-date-picker>
</el-form-item>
</template>
</template>
<!-- 禁用设备号 -->
<div v-if="newFormInline.type === 2">
<template v-if="props.userData.is_block_mobile === 1">
<!-- 要解封 -->
<el-form-item label="是否解禁" prop="status">
<el-radio-group v-model="newFormInline.status">
<!-- <el-radio label="暂不解封" :value="1" /> -->
<el-radio label="解封" :value="2" />
</el-radio-group>
</el-form-item>
</template>
<template v-else>
<el-form-item label="封禁时间" prop="timeType">
<el-radio-group v-model="newFormInline.timeType">
<el-radio label="永久" :value="0" />
<el-radio label="设置时间" :value="1" />
</el-radio-group>
</el-form-item>
<el-form-item label="禁用时间" prop="time" v-if="newFormInline.timeType === 1">
<el-date-picker type="date" placeholder="选择日期" v-model="newFormInline.time" style="width: 100%;"
format="YYYY-MM-DD" value-format="YYYY-MM-DD"></el-date-picker>
</el-form-item>
</template>
</div>
<!-- 禁用ip -->
<template v-if="newFormInline.type === 3">
<template v-if="props.userData.is_block_ip === 1">
<!-- 要解封 -->
<el-form-item label="是否解禁" prop="status">
<el-radio-group v-model="newFormInline.status">
<el-radio label="解封" :value="2" />
</el-radio-group>
</el-form-item>
</template>
<template v-else>
<el-form-item label="封禁时间" prop="timeType">
<el-radio-group v-model="newFormInline.timeType">
<el-radio label="永久" :value="0" />
<el-radio label="设置时间" :value="1" />
</el-radio-group>
</el-form-item>
<el-form-item label="禁用时间" prop="time" v-if="newFormInline.timeType === 1">
<el-date-picker type="date" placeholder="选择日期" v-model="newFormInline.time" style="width: 100%;"
format="YYYY-MM-DD" value-format="YYYY-MM-DD"></el-date-picker>
</el-form-item>
</template>
</template>
</el-form>
</template>

View File

@@ -1,13 +1,13 @@
import { h, ref, nextTick } from "vue";
import editForm from "./form.vue";
import { ElMessageBox } from "element-plus";
import ExportForm from '@/components/exportDialog/index.vue';
import ExportForm from "@/components/exportDialog/index.vue";
import { utils, writeFile } from "xlsx";
import detailView from './detail.vue';
import banUserView from './banUser.vue';
import changePassView from './password.vue';
import setFundView from './fundSetting.vue';
import searchMoreView from './searchMore.vue';
import detailView from "./detail.vue";
import banUserView from "./banUser.vue";
import changePassView from "./password.vue";
import setFundView from "./fundSetting.vue";
import searchMoreView from "./searchMore.vue";
import { message } from "@/utils/message";
import {
queryList,
@@ -25,21 +25,21 @@ import { addDialog } from "@/components/ReDialog";
export function useData() {
const formRef = ref();
const searchFormMore = ref({
user_code: '',
login_device: '',
nickname: '',
status: '',
coin1: '',
coin2: '',
createtime: ''
})
user_code: "",
login_device: "",
nickname: "",
status: "",
coin1: "",
coin2: "",
createtime: ""
});
const loading = ref(true);
const tableList = ref([]);
const isShow = ref(false);
const totalPrice = ref({
total_coin: 0,
total_earnings: 0
})
});
const pagination = ref({
total: 0,
pageSize: 10,
@@ -48,7 +48,7 @@ export function useData() {
background: true
});
const searchForm = ref({
user_code: '',
user_code: "",
search: "",
is_sys_tester: "",
is_real: "",
@@ -81,8 +81,8 @@ export function useData() {
prop: "order_type",
type: "select",
optionList: [
{ label: "金币", value: 'coin' },
{ label: "钻石", value: 'earnings' }
{ label: "金币", value: "coin" },
{ label: "钻石", value: "earnings" }
]
},
{
@@ -136,7 +136,7 @@ export function useData() {
label: "性别",
prop: "sex",
cellRenderer: ({ row }) => (
<div>{row.sex === 1 ? '男' : row.sex === 2 ? '女' : '未知'}</div>
<div>{row.sex === 1 ? "男" : row.sex === 2 ? "女" : "未知"}</div>
)
},
{
@@ -159,7 +159,7 @@ export function useData() {
},
{
label: "实名状态",
prop: "is_real_str",
prop: "is_real_str"
},
{
label: "邀请码",
@@ -169,7 +169,13 @@ export function useData() {
label: "登录状态",
prop: "status",
cellRenderer: ({ row }) => (
<el-tag type={row.status == 0 ? 'error' : row.status == 2 ? 'warn' : 'success'}>{row.status_str}</el-tag>
<el-tag
type={
row.status == 0 ? "error" : row.status == 2 ? "warn" : "success"
}
>
{row.status_str}
</el-tag>
)
},
{
@@ -179,17 +185,17 @@ export function useData() {
slot: "operation"
}
]);
const onSearch = async (formData) => {
const onSearch = async formData => {
loading.value = true;
searchForm.value = { ...formData }
searchForm.value = { ...formData };
// console.log(searchForm.value, formData, 111)
if (!formData) {
resetFieldsSearch()
resetFieldsSearch();
}
const { data, code } = await queryList({
...formData,
coin1: searchForm.value.coin1 !== '' ? searchForm.value.coin1 : '',
coin2: searchForm.value.coin2 !== '' ? searchForm.value.coin2 : '',
coin1: searchForm.value.coin1 !== "" ? searchForm.value.coin1 : "",
coin2: searchForm.value.coin2 !== "" ? searchForm.value.coin2 : "",
page: pagination.value.currentPage,
page_limit: pagination.value.pageSize
});
@@ -199,7 +205,7 @@ export function useData() {
...ele,
coin: Number(ele.coin),
earnings: Number(ele.earnings)
}
};
});
pagination.value.total = data.count;
totalPrice.value.total_coin = Number(data.total_coin);
@@ -218,10 +224,10 @@ export function useData() {
};
// 编辑会员
const openDialog = async (title = "新增", rowData: any) => {
const userInfoRes = await getUserInfo({ user_id: rowData.id })
const userInfoRes = await getUserInfo({ user_id: rowData.id });
nextTick(() => {
if (userInfoRes.code) {
const { user_info, follow_num } = userInfoRes.data
const { user_info, follow_num } = userInfoRes.data;
addDialog({
title: `${title}会员信息`,
props: {
@@ -236,13 +242,14 @@ export function useData() {
profile: user_info?.profile ?? "",
init_code: user_info?.init_code ?? "",
red_status: user_info?.red_status ?? "",
sex: user_info?.sex ?? '',
is_real: follow_num.is_real === '已实名' ? 1 : 0
sex: user_info?.sex ?? "",
is_real: follow_num.is_real === "已实名" ? 1 : 0
}
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () => h(editForm, { ref: formRef, formInline: null }),
contentRenderer: () =>
h(editForm, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
@@ -271,14 +278,14 @@ export function useData() {
}
});
}
})
});
};
// 查看会员详情
const viewDetail = async (rowData) => {
const userInfoRes = await getUserInfo({ user_id: rowData.id })
const viewDetail = async rowData => {
const userInfoRes = await getUserInfo({ user_id: rowData.id });
nextTick(() => {
if (userInfoRes.code) {
const userData = userInfoRes.data
const userData = userInfoRes.data;
addDialog({
title: `查看会员详情`,
props: {
@@ -287,13 +294,13 @@ export function useData() {
width: "60%",
closeOnClickModal: false,
contentRenderer: () => h(detailView),
beforeSure: (done) => {
done()
beforeSure: done => {
done();
}
});
}
})
}
});
};
// 删除会员
const handleDelete = async rowData => {
const { code } = await removeUserData({ user_id: rowData.id });
@@ -321,18 +328,24 @@ export function useData() {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
const updateUserDataStatus = async form => {
const paramData = { ...form, user_id: rowData.id }
const paramData = {
...form,
user_id: rowData.id,
ban_eason: form.ban_reason, // 封禁理由
ban_day: form.ban_day // 封禁时间
};
if (form.status === 2) {
// 解封
paramData.time = ''
paramData.status = 2
paramData.time = "";
paramData.status = 2;
} else {
if (!form.timeType) {
// 永久解封
paramData.time = ''
paramData.time = "";
}
}
delete paramData.timeType
delete paramData.timeType;
delete paramData.ban_reason; // 删除临时字段使用ban_eason
const { code, msg } = await banUserData(paramData);
if (code) {
message("设置成功", { type: "success" });
@@ -344,7 +357,7 @@ export function useData() {
};
FormRef.validate(valid => {
if (valid) {
updateUserDataStatus(curData)
updateUserDataStatus(curData);
}
});
}
@@ -368,43 +381,44 @@ export function useData() {
},
width: "50%",
closeOnClickModal: false,
contentRenderer: () => h(searchMoreView, { ref: formRef, formInline: null }),
contentRenderer: () =>
h(searchMoreView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
FormRef.validate(valid => {
if (valid) {
searchFormMore.value = { ...curData }
searchFormMore.value = { ...curData };
onSearch({ ...searchForm.value, ...curData });
}
});
done()
done();
}
});
}
const changeSearchValue = (form) => {
};
const changeSearchValue = form => {
Object.keys(form).forEach(ele => {
searchForm.value[ele] = form[ele]
})
console.log(searchForm.value)
}
searchForm.value[ele] = form[ele];
});
console.log(searchForm.value);
};
const resetFieldsSearch = () => {
searchFormMore.value = {
user_code: '',
login_device: '',
nickname: '',
status: '',
coin1: '',
coin2: '',
createtime: ''
}
user_code: "",
login_device: "",
nickname: "",
status: "",
coin1: "",
coin2: "",
createtime: ""
};
searchForm.value = {
search: "",
is_sys_tester: "",
is_real: ""
}
};
onSearch({ ...searchForm.value, ...searchFormMore.value });
}
};
// 设置资金
const setUserFund = async (rowData: any) => {
addDialog({
@@ -438,33 +452,34 @@ export function useData() {
};
FormRef.validate(valid => {
if (valid) {
setMoneyData(curData)
setMoneyData(curData);
}
});
}
});
};
const exportFormRef = ref(null)
const exportFormRef = ref(null);
const exportExcel = () => {
let exportTableList = []
let exportTableList = [];
addDialog({
title: `导出数据`,
props: {
formInline: {
time: ''
time: ""
}
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }),
contentRenderer: () =>
h(ExportForm, { ref: exportFormRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = exportFormRef.value.getRef();
const curData = options.props.formInline;
const exportData = async (formData) => {
const exportData = async formData => {
const { data, code } = await queryList({
...searchForm.value,
coin1: searchForm.value.coin1 ? searchForm.value.coin1 : '',
coin2: searchForm.value.coin2 ? searchForm.value.coin2 : '',
coin1: searchForm.value.coin1 ? searchForm.value.coin1 : "",
coin2: searchForm.value.coin2 ? searchForm.value.coin2 : "",
page: 1,
page_limit: 10000
});
@@ -485,30 +500,35 @@ export function useData() {
const workSheet = utils.aoa_to_sheet(res);
const workBook = utils.book_new();
utils.book_append_sheet(workBook, workSheet, "数据报表");
writeFile(workBook, `想会员列表统计${formData.start_time} - ${formData.end_time}.xlsx`);
writeFile(
workBook,
`想会员列表统计${formData.start_time} - ${formData.end_time}.xlsx`
);
message("导出成功", {
type: "success"
});
done()
done();
} else {
message("获取数据失败,请重试!", {
type: "error"
});
}
}
};
FormRef.validate(valid => {
if (valid) {
if (curData.time && curData.time.length) {
exportData({ start_time: curData.time[0] || '', end_time: curData.time[1] || '' })
exportData({
start_time: curData.time[0] || "",
end_time: curData.time[1] || ""
});
}
}
});
}
});
}
};
// 找回账号
const FindData = async (rowData) => {
const FindData = async rowData => {
// console.log(rowData)
const { code } = await findUserData({ mobile: rowData.mobile });
if (code) {
@@ -517,7 +537,7 @@ export function useData() {
});
onSearch(searchForm.value);
}
}
};
// 修改密码
const changePassword = async (rowData: any) => {
addDialog({
@@ -529,7 +549,8 @@ export function useData() {
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () => h(changePassView, { ref: formRef, formInline: null }),
contentRenderer: () =>
h(changePassView, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;

View File

@@ -39,14 +39,14 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
// "Access-Control-Allow-Origin",
// "http://adminvs.qxhs.xyz"
// );
res.setHeader(
"Access-Control-Allow-Origin",
"http://yushenggliht.qxyushen.top"
);
// res.setHeader(
// "Access-Control-Allow-Origin",
// "https://test.vespa.qxyushen.top"
// "http://yushenggliht.qxyushen.top"
// );
res.setHeader(
"Access-Control-Allow-Origin",
"https://test.vespa.qxyushen.top"
);
res.setHeader(
"Access-Control-Allow-Methods",
"GET, POST, PUT, DELETE, OPTIONS"