Browse Source

Merge branch 'milestone0718-2025周年庆后台' of http://39.101.133.168:8807/lihuilin/AnniversaryBackstage into milestone0718-2025周年庆后台

wangxiangwen/feature-20250716103042-周年活动+众筹前台页面
lihuilin 3 weeks ago
parent
commit
36210dcb05
  1. 50
      activitylink/src/views/zhongchou/activity/index.vue
  2. 27
      activitylink/src/views/zhongchou/gift/importuser/index.vue

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

@ -14,7 +14,7 @@
<div class="content-area">
<div class="table-container">
<el-table :data="currentPageData" style="width: auto" :row-style="{ height: '60px' } ">
<el-table-column prop="activityName" label="活动名称"></el-table-column>
<el-table-column prop="activityName" label="活动名称" show-overflow-tooltip></el-table-column>
<el-table-column prop="marketOne" label="市场一"></el-table-column>
<el-table-column prop="marketTwo" label="市场二"></el-table-column>
@ -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%">
@ -200,9 +204,9 @@ const fetchMarketList = async () => {
} catch (error) {
console.error('请求市场列表失败:', error)
}
}
}//
const isSubmitting = ref(false);
//
const cancel = () => {
centerDialogVisible.value = false;
@ -228,7 +232,15 @@ const addActivityShow = () => {
const addForm = ref(); // addForm ref
const addActivity = async () => {
//
if (isSubmitting.value) {
ElMessage.warning('操作过于频繁,请稍后再试');
return;
}
try {
isSubmitting.value = true; //
const valid = await new Promise((resolve, reject) => {
addForm.value.validate(valid => {
if (valid) {
@ -240,6 +252,22 @@ const addActivity = async () => {
});
if (!valid) {
isSubmitting.value = false; //
return;
}
//
if (!activity.value.activityName || activity.value.activityName.trim() === '') {
ElMessage.error('活动名称不能为空');
isSubmitting.value = false; //
return;
}
//
const cleanedActivityName = activity.value.activityName.replace(/\s/g, '');
if (cleanedActivityName !== activity.value.activityName) {
ElMessage.error('活动名称中不能包含空格');
isSubmitting.value = false; //
return;
}
@ -266,6 +294,11 @@ const addActivity = async () => {
} catch (error) {
console.error('添加活动失败:', error);
ElMessage.error('请求失败,请重试');
} finally {
// 3
setTimeout(() => {
isSubmitting.value = false;
}, 3000);
}
};
@ -317,6 +350,7 @@ const activity = ref({
const rules = {
activityName: [
{ required: true, message: '请输入活动名称', trigger: 'blur' }
//
],
marketOne: [
{ required: true, message: '请选择市场一', trigger: 'change' }
@ -334,7 +368,6 @@ const rules = {
{ required: true, message: '请选择结束时间', trigger: 'change' }
]
}
//
const currentPage = ref(1);
const pageSize = ref(10); // 10
@ -346,6 +379,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;

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

@ -252,4 +252,31 @@ onMounted(() => {
.table-container {
overflow-y: auto;
}
.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