Browse Source

修改了添加活动中能输入空格的bug

wangxiangwen/feature-20250716103042-周年活动+众筹前台页面
wangxiangwen 3 weeks ago
parent
commit
87ae7b11e0
  1. 28
      activitylink/src/views/zhongchou/activity/index.vue
  2. 63
      activitylink/src/views/zhongchou/gift/importuser/index.vue

28
activitylink/src/views/zhongchou/activity/index.vue

@ -79,7 +79,11 @@
>
<el-form ref="addForm" :model="activity" :rules="rules" label-width="80px">
<el-form-item label="活动名称" prop="activityName">
<el-input v-model="activity.activityName" placeholder="请输入活动名称" />
<el-input
v-model="activity.activityName"
placeholder="请输入活动名称"
@input="handleActivityNameInput"
/>
</el-form-item>
<el-form-item label="股票一" prop="marketOne">
<el-select v-model="activity.marketOne" placeholder="请选择市场一" style="width: 100%">
@ -243,6 +247,19 @@ const addActivity = async () => {
return;
}
//
if (!activity.value.activityName || activity.value.activityName.trim() === '') {
ElMessage.error('活动名称不能为空');
return;
}
//
const cleanedActivityName = activity.value.activityName.replace(/\s/g, '');
if (cleanedActivityName !== activity.value.activityName) {
ElMessage.error('活动名称中不能包含空格');
return;
}
//
const activityData = {
activityName: activity.value.activityName,
@ -317,6 +334,7 @@ const activity = ref({
const rules = {
activityName: [
{ required: true, message: '请输入活动名称', trigger: 'blur' }
//
],
marketOne: [
{ required: true, message: '请选择市场一', trigger: 'change' }
@ -334,7 +352,6 @@ const rules = {
{ required: true, message: '请选择结束时间', trigger: 'change' }
]
}
//
const currentPage = ref(1);
const pageSize = ref(10); // 10
@ -346,6 +363,13 @@ const currentPageData = computed(() => {
return tableData.value.slice(start, end);
});
//
const handleActivityNameInput = (value) => {
//
const cleanedValue = value.replace(/\s/g, '');
activity.value.activityName = cleanedValue;
};
//
const handleSizeChange = (val) => {
pageSize.value = val;

63
activitylink/src/views/zhongchou/gift/importuser/index.vue

@ -3,7 +3,7 @@
<el-button type="primary" @click="goBack" style="margin-right:20px">返回</el-button>
<span style="font-size: 1.5em; font-weight: bold;">导入抽奖用户</span>
</div>
<el-card style="min-height: 90vh; max-height: 90vh;">
<el-card style="min-height: 85vh; max-height: 85vh;">
<div style="margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center;">
<div style="display: flex; gap: 10px; align-items: center;">
姓名<el-input v-model="searchObj.username" placeholder="请输入姓名" style="width: 150px;" clearable></el-input>
@ -18,22 +18,24 @@
</div>
</div>
<!-- 用户表格 -->
<el-table :data="tableData" style="width: 100%;" :row-style="{ height: '60px' }"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="200" />
<el-table-column type="index" label="ID" width="250">
<template #default="scope">
{{ pagination.pageSize * (pagination.pageNum - 1) + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="username" label="姓名" width="250" />
<el-table-column prop="jwcode" label="精网号" width="300" />
<el-table-column label="操作">
<template #default="scope">
<el-button text size="small" type="danger" @click="delUser(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-container">
<el-table :data="tableData" style="width: 100%;" :row-style="{ height: '58px' }"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="200" />
<el-table-column type="index" label="ID" width="250">
<template #default="scope">
{{ pagination.pageSize * (pagination.pageNum - 1) + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="username" label="姓名" width="250" />
<el-table-column prop="jwcode" label="精网号" width="300" />
<el-table-column label="操作">
<template #default="scope">
<el-button text size="small" type="danger" @click="delUser(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 底部操作区域 -->
<div style="margin-top: 20px; display: flex; justify-content: space-between; align-items: center;">
<el-button type="danger" @click="batchDelete">批量删除</el-button>
@ -256,4 +258,31 @@ onMounted(() => {
.el-pagination {
margin: 0;
}
.table-container {
height: 650px; /* 设置固定高度 */
overflow-y: auto; /* 启用垂直滚动条 */
overflow-x: hidden; /* 隐藏水平滚动条(如果不需要的话) */
border: 1px solid #ebeef5; /* 可选:添加边框 */
border-radius: 4px; /* 可选:添加圆角 */
}
/* 可选:自定义滚动条样式 */
.table-container::-webkit-scrollbar {
width: 8px;
}
.table-container::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb:hover {
background: #a8a8a8;
}
</style>
Loading…
Cancel
Save