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
d55cbe0779
  1. 7
      activitylink/src/views/zhongchou/activity/detail/index.vue
  2. 2
      activitylink/src/views/zhongchou/activity/index.vue
  3. 202
      activitylink/src/views/zhongchou/activity/set/index.vue
  4. 1
      activitylink/src/views/zhongchou/index.vue
  5. 10
      activitylink/src/views/zhongchou/level/index.vue
  6. 2
      activitylink/src/views/zhongchou/user/index.vue

7
activitylink/src/views/zhongchou/activity/detail/index.vue

@ -45,7 +45,12 @@
<!-- 表格 -->
<div class="table-container">
<el-table :data="tableData" style="width: 100%" :row-style="{ height: '55px' }">
<el-table-column prop="id" label="ID" width="100" align="center"></el-table-column>
<el-table-column label="序号" width="100" align="center">
<template #default="scope">
{{ (currentPage - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<!-- <el-table-column prop="id" label="ID" width="100" align="center"></el-table-column> -->
<el-table-column prop="username" label="姓名" width="300" align="center"></el-table-column>
<el-table-column prop="jwcode" label="精网号" width="300" align="center"></el-table-column>
<el-table-column prop="text" label="参与市场" width="300" align="center"></el-table-column>

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

@ -240,7 +240,6 @@ const addActivity = async () => {
});
if (!valid) {
ElMessage.warning('请填写完整表单');
return;
}
@ -259,6 +258,7 @@ const addActivity = async () => {
if (response.code === 200) {
ElMessage.success('活动添加成功');
centerDialogVisible.value = false;
resetForm();
fetchActivityList();
} else {
ElMessage.error(response.message || '活动添加失败');

202
activitylink/src/views/zhongchou/activity/set/index.vue

@ -8,38 +8,41 @@
<h3>数据设置</h3>
<div class="setting-item">
<label>设置初始数据</label>
<el-input-number :precision="0" :min="0" v-model="setinitiaData" placeholder="分钟" size="large"></el-input-number>
&nbsp;&nbsp;分钟
&nbsp;&nbsp;&nbsp;&nbsp;
<el-button type="primary" @click="openInitialConfirmDialog">确认</el-button>
</div>
<!-- 市场一 -->
<div class="setting-item">
<label>当前{{ marketOneName }}市场助力次数{{ markerOneTotal }} </label>
<el-input-number :precision="0" :min="0" v-model="addCountOne" placeholder="设置添加次数" size="large"></el-input-number>
&nbsp;&nbsp;&nbsp;&nbsp;
<el-button type="primary" @click="openConfirmDialog('one')">确认</el-button>
&nbsp;&nbsp;&nbsp;&nbsp;
<label>前端展示次数{{ showOne }} </label>
</div>
<!-- 市场二 -->
<div class="setting-item">
<label>当前{{ marketTwoName }}市场助力次数{{ markerTwoTotal }} </label>
<el-input-number :precision="0" :min="0" v-model="addCountTwo" placeholder="设置添加次数" size="large"></el-input-number>
&nbsp;&nbsp;&nbsp;&nbsp;
<el-button type="primary" @click="openConfirmDialog('two')">确认</el-button>
&nbsp;&nbsp;&nbsp;&nbsp;
<label>前端展示次数{{ showTwo }} </label>
</div>
<!-- <div class="setting-item">
<label>初始数据</label>
<div>{{ initialData }}分钟</div>
</div> -->
<!-- 市场一 -->
<div class="setting-item">
<label class="fixed-label">当前{{ marketOneName }}市场助力次数{{ markerOneTotal }} </label>
<el-input v-model="addCountOne"
placeholder="设置添加次数"
size="large"
class="fixed-input"
@input="handleIntegerInput1"></el-input>
<el-button type="primary" @click="openConfirmDialog('one')" class="fixed-button">确认</el-button>
<label class="fixed-label">前端展示次数{{ showOne }} </label>
</div>
<!-- 市场二 -->
<div class="setting-item">
<label class="fixed-label">当前{{ marketTwoName }}市场助力次数{{ markerTwoTotal }} </label>
<el-input v-model="addCountTwo"
placeholder="设置添加次数"
size="large"
class="fixed-input"
@input="handleIntegerInput2"></el-input>
<el-button type="primary" @click="openConfirmDialog('two')" class="fixed-button">确认</el-button>
<label class="fixed-label">前端展示次数{{ showTwo }} </label>
</div>
<!-- 时间数据 -->
<div class="setting-item">
<!-- <div class="setting-item">
<label>当前初始数据为{{ initialData }} 分钟</label>
</div>
</div> -->
<!-- 确认对话框 -->
<el-dialog v-model="showConfirmDialog" title="确认添加" width="30%">
@ -53,15 +56,15 @@
</el-dialog>
<!-- 初始数据确认对话框 -->
<el-dialog v-model="showInitialConfirmDialog" title="确认设置初始数据" width="30%" @closed="cancelset">
<span>您确定要设置初始数据为 {{ setinitiaData }} 分钟吗</span>
<!-- <el-dialog v-model="showInitialConfirmDialog" title="确认设置初始数据" width="30%" @closed="cancelset">
<span>您确定要设置初始数据为 {{ setinitiaData }} 分钟吗只能修改一次</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="cancelset"> </el-button>
<el-button type="primary" @click="confirmInitialData"> </el-button>
</span>
</template>
</el-dialog>
</el-dialog> -->
</div>
</el-card>
</template>
@ -82,7 +85,7 @@ const addCountTwo = ref(null);
const showConfirmDialog = ref(false);
const showInitialConfirmDialog = ref(false);
const pendingAction = ref(null); // ('one' or 'two')
const isInitialDataSet = ref(false); //
// API
const marketOne = ref(''); //
const marketTwo = ref(''); //
@ -128,7 +131,62 @@ const marketTwoName = ref('');
// }
// };
const timerOne = ref(null);
const timerTwo = ref(null);
const handleIntegerInput1 = (value) => {
//
if (timerOne.value) {
clearTimeout(timerOne.value);
}
// 1.
let filtered = value.replace(/[^-0-9]/g, '');
// 2.
if (filtered.includes('-')) {
const firstChar = filtered[0];
const rest = filtered.slice(1).replace(/-/g, ''); //
filtered = firstChar === '-' ? '-' + rest : rest;
}
// 3. '-'
if (filtered === '-') {
timerOne.value = setTimeout(() => {
addCountOne.value = '';
timerOne.value = null;
}, 1000); // 200ms
} else {
// 4.
addCountOne.value = filtered;
}
};
const handleIntegerInput2 = (value) => {
//
if (timerTwo.value) {
clearTimeout(timerTwo.value);
}
//
let filtered = value.replace(/[^-0-9]/g, '');
if (filtered.includes('-')) {
const firstChar = filtered[0];
const rest = filtered.slice(1).replace(/-/g, '');
filtered = firstChar === '-' ? '-' + rest : rest;
}
// '-'
if (filtered === '-') {
timerTwo.value = setTimeout(() => {
addCountTwo.value = '';
timerTwo.value = null;
}, 1000); // 200ms
} else {
addCountTwo.value = filtered;
}
};
const fetchData = async () => {
try {
//
@ -162,13 +220,23 @@ const fetchData = async () => {
};
const ifshow = () =>{
if(initialData.value >0)
{
isInitialDataSet.value = true;
}
else
{
isInitialDataSet.value = false;
}
}
//
onMounted(() => {
fetchData();
onMounted(async () => {
await fetchData();
ifshow();
});
//
@ -221,6 +289,7 @@ const confirmInitialData = async () => {
showInitialConfirmDialog.value = false
setinitiaData.value=0
ElMessage.success('设置成功')
ifshow();
} else {
ElMessage.error(response.message || '设置失败')
@ -235,7 +304,8 @@ const confirmInitialData = async () => {
const confirmAdd = async () => {
const type = pendingAction.value;
if (type === 'one' && addCountOne.value !== null && addCountOne.value > 0) {
// > 0
if (type === 'one' && addCountOne.value !== null && addCountOne.value !== 0) {
markerOneTotal.value += parseInt(addCountOne.value);
showOne.value = markerOneTotal.value;
@ -256,6 +326,7 @@ const confirmAdd = async () => {
//
markerOneTotal.value -= parseInt(addCountOne.value);
showOne.value = markerOneTotal.value;
fetchData();
}
} catch (error) {
console.error('添加助力次数失败:', error);
@ -267,7 +338,8 @@ const confirmAdd = async () => {
addCountOne.value = null;
} else if (type === 'two' && addCountTwo.value !== null && addCountTwo.value > 0) {
// > 0
} else if (type === 'two' && addCountTwo.value !== null && addCountTwo.value !== 0) {
markerTwoTotal.value += parseInt(addCountTwo.value);
showTwo.value = markerTwoTotal.value;
@ -287,6 +359,7 @@ const confirmAdd = async () => {
//
markerTwoTotal.value -= parseInt(addCountTwo.value);
showTwo.value = markerTwoTotal.value;
fetchData();
}
} catch (error) {
console.error('添加助力次数失败:', error);
@ -325,25 +398,72 @@ const goBack = () => {
display: flex;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
flex-wrap: nowrap;
gap: 15px;
}
.setting-item label {
margin-right: 20px;
font-size: 1.1rem;
min-width: 200px;
white-space: nowrap;
flex: 0 0 auto;
}
/* 专门针对带有展示次数的项(市场一和市场二) */
.setting-item.has-show-label {
flex-wrap: wrap;
}
/* 为市场项添加特殊处理 */
.setting-item:has(.el-input-number) label:first-child {
flex: 0 0 auto;
}
/* 将展示次数标签推向右侧 */
.setting-item:has(.el-input-number) label:last-child {
margin-left: auto;
flex: 0 0 auto;
}
.el-input-number {
width: 180px;
flex: 0 0 auto;
}
.el-button {
height: 40px;
font-size: 1.1rem;
padding: 0 20px;
flex: 0 0 auto;
}
.setting-item {
display: flex;
align-items: center;
margin-bottom: 25px;
}
.fixed-label {
width: 250px; /* 固定宽度 */
text-align: left; /* 右对齐,更美观 */
margin-right: 20px; /* 固定间距 */
white-space: nowrap; /* 防止换行 */
}
.fixed-input {
width: 230px; /* 固定宽度 */
margin-right: 30px; /* 固定间距 */
}
.fixed-button {
margin-right: 20px; /* 固定间距 */
}
/* 确保最后一个 label 不需要右边距 */
.setting-item .fixed-label:last-child {
margin-right: 0;
}
h3 {
font-size: 1.8rem;
margin-bottom: 20px;

1
activitylink/src/views/zhongchou/index.vue

@ -43,7 +43,6 @@ const handleLogout = () => {
console.error('退出错误:', error);
}
}).catch(() => {
// router.back()
ElMessage.info('已取消退出');
});
};

10
activitylink/src/views/zhongchou/level/index.vue

@ -45,7 +45,7 @@
<el-form-item label="数量" align="center">
<el-input
v-model="addForm.amount"
@input="(val) => handleNumberInput('amount', val, addForm, 100000)"
@input="(val) => handleNumberInput('amount', val, addForm, 99999)"
placeholder="请输入数量"
style="width: 100%;"
></el-input>
@ -83,7 +83,7 @@
<el-form-item label="数量" align="center">
<el-input
v-model="editForm.amount"
@input="(val) => handleNumberInput('amount', val, editForm, 100000)"
@input="(val) => handleNumberInput('amount', val, editForm, 99999)"
placeholder="请输入数量"
style="width: 100%;"
></el-input>
@ -277,16 +277,16 @@ const deleteLevel = (row) => {
const handleNumberInput = (field, value, form, maxValue) => {
// 1.
let filteredValue = value.replace(/[^\d]/g, '');
// 2.
if (filteredValue === '') {
form[field] = '';
return;
}
// 3.
let numValue = Number(filteredValue);
// 4.
if (numValue > maxValue) {
form[field] = String(maxValue);

2
activitylink/src/views/zhongchou/user/index.vue

@ -123,7 +123,7 @@ try {
const response = await deleteuserByjwcode({ jwcode: deleteJwcode.value })
if (response.code === 200) {
ElMessage.success('删除成功')
fetchWinList() //
handleReset() //
} else {
ElMessage.error(response.message || '删除失败')
}

Loading…
Cancel
Save