Browse Source

完工

lihuilin/feature-20250718094329-25周年庆后台
lihuilin 4 weeks ago
parent
commit
13da839b12
  1. 64
      activitylink/src/views/zhongchou/gift/index.vue
  2. 19
      activitylink/src/views/zhongchou/level/index.vue
  3. 28
      activitylink/vite.config.js

64
activitylink/src/views/zhongchou/gift/index.vue

@ -1,18 +1,19 @@
<template>
<h2>礼品管理</h2>
<el-card style="min-height: 90vh; max-height: 90vh; display: flex; flex-direction: column;">
<h2>礼品管理</h2>
<el-card style="display: flex; flex-direction: column;">
<div class="gift-management-container" style="flex: 1; overflow-y: auto;">
<div class="action-buttons">
<el-button type="primary" @click="showAdd">添加礼品</el-button>
<el-button type="primary" @click="goToimportUsers">导入抽奖用户</el-button>
</div>
<div class="table-container" style="flex: 1; overflow-y: auto;">
<el-table :data="tableData" style="width: 100%" class="gift-table">
<el-table-column type="index" label="ID" width="100" align="center"></el-table-column>
<el-table :data="tableData" style="width: 100%" class="gift-table" :row-style="{ height: '60px' }">
<el-table-column type="index" label="ID" width="100" align="center">
<template #default="scope">{{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }}</template>
</el-table-column>
<el-table-column label="礼品图片" width="200" align="center">
<template #default="scope">
<img v-if="scope.row.imageUrl" :src="scope.row.imageUrl"
style="max-width: 100px; max-height: 30px;">
<img v-if="scope.row.imageUrl" :src="scope.row.imageUrl" style="max-width: 100px; max-height: 30px;">
<el-icon v-else :size="20" color="#67C23A">
<Check />
</el-icon>
@ -43,20 +44,13 @@
</el-form-item>
<el-form-item label="礼品等级" :rules="{ required: true, message: '请选择礼品等级', trigger: 'change' }">
<el-select v-model="addForm.gradeId" placeholder="请选择礼品等级">
<el-option v-for="item in gradeNames" :key="item.id" :label="item.gradeName" :value="item.id"/>
<el-option v-for="item in gradeNames" :key="item.id" :label="item.gradeName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="礼品图片" :rules="{ required: true, message: '请上传图片', trigger: 'change' }">
<el-upload
ref="uploadRef"
:action="uploadUrl"
list-type="picture-card"
:auto-upload="false"
:on-change="handleImageChange"
:on-success="handleUploadSuccess"
:on-error="handleUploadError"
:before-upload="beforeUpload"
:show-file-list="false">
<el-upload ref="uploadRef" :action="uploadUrl" list-type="picture-card" :auto-upload="false"
:on-change="handleImageChange" :on-success="handleUploadSuccess" :on-error="handleUploadError"
:before-upload="beforeUpload" :show-file-list="false">
<el-icon>
<Plus />
</el-icon>
@ -78,7 +72,7 @@
</span>
</template>
</el-dialog>
<!-- 编辑 -->
<el-dialog v-model="editVisible" :title="dialogTitle" width="40%">
<el-form :model="editForm" label-width="100px" ref="formRef">
@ -87,20 +81,13 @@
</el-form-item>
<el-form-item label="礼品等级" :rules="{ required: true, message: '请选择礼品等级', trigger: 'change' }">
<el-select v-model="editForm.gradeId" placeholder="请选择礼品等级">
<el-option v-for="item in gradeNames" :key="item.id" :label="item.gradeName" :value="item.id"/>
<el-option v-for="item in gradeNames" :key="item.id" :label="item.gradeName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="礼品图片" :rules="{ required: true, message: '请上传图片', trigger: 'change' }">
<el-upload
ref="uploadRef"
:action="uploadUrl"
list-type="picture-card"
:auto-upload="false"
:on-change="handleImageChange"
:on-success="handleUploadSuccess"
:on-error="handleUploadError"
:before-upload="beforeUpload"
:show-file-list="false">
<el-upload ref="uploadRef" :action="uploadUrl" list-type="picture-card" :auto-upload="false"
:on-change="handleImageChange" :on-success="handleUploadSuccess" :on-error="handleUploadError"
:before-upload="beforeUpload" :show-file-list="false">
<el-icon>
<Plus />
</el-icon>
@ -172,12 +159,12 @@ const showAdd = () => {
const editGift = (row) => {
dialogTitle.value = '编辑礼品'
editForm.value = {
editForm.value = {
id: row.id,
prizeName: row.prizeName,
gradeId: row.gradeId,
imageUrl: row.imageUrl
}
}
editVisible.value = true
}
@ -205,7 +192,6 @@ const getPrizes = async () => {
const getGradeNames = async () => {
try {
const res = await getGradeNameList()
if (res.code === 200) {
gradeNames.value = res.data
} else {
@ -221,7 +207,7 @@ const getGradeNames = async () => {
const submitAdd = async () => {
formRef.value.validate((valid) => {
if (!valid) return false;
if (!addForm.value.imageUrl) {
ElMessage.error('请上传图片');
return;
@ -309,14 +295,14 @@ const submitEdit = async () => {
}
const goToimportFixedList = (row) => {
giftStore.setFixedGiftName(row.name);
router.push({
name: 'importFixedList',
query: {
router.push({
name: 'importFixedList',
query: {
prizeName: row.prizeName,
gradeName: row.gradeName,
gradeId: row.id //
}
});
}
});
}
const goToimportUsers = () => {
@ -408,7 +394,7 @@ onMounted(() => {
}
.table-container {
max-height: 600px;
max-height: 650px;
overflow-y: auto;
}

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

@ -1,6 +1,6 @@
<template>
<h2>等级管理</h2>
<el-card style="min-height: 90vh; max-height: 90vh; display: flex; flex-direction: column;">
<el-card style=" display: flex; flex-direction: column;">
<div class="level-management-container" style="flex: 1; overflow-y: auto;">
<!-- 添加等级按钮 -->
<div class="action-buttons">
@ -9,13 +9,17 @@
<!-- 等级表格 -->
<div class="table-container">
<el-table :data="tableData" style="width: 100%" :row-style="{ height: '55px' }">
<el-table-column type="index" label="ID" width="100px" fixed="left" />
<el-table-column prop="gradeName" label="等级名称" width="200" align="center" />
<el-table :data="tableData" style="width: 100%" :row-style="{ height: '60px' }">
<el-table-column type="index" label="ID" width="120px" fixed="left" >
<template #default="scope">
{{ pagination.pageSize * (pagination.pageNum - 1) + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="gradeName" label="等级名称" width="240" align="center" />
<el-table-column prop="amount" label="数量" width="250" align="center" />
<el-table-column prop="perWin" label="每轮抽取人数" width="300" align="center" />
<el-table-column prop="sort" label="排序" width="200" align="center" />
<el-table-column prop="operation" fixed="right" label="操作" align="center">
<el-table-column prop="sort" label="排序" width="240" align="center" />
<el-table-column prop="operation" fixed="right" width="240" label="操作" align="center">
<template #default="scope">
<div style="display: flex; gap: 10px; justify-content: center;">
<el-button text type="warning" @click="editLevel(scope.row)">编辑</el-button>
@ -98,7 +102,6 @@ const pagination = ref({
pageSize: 10,
total:0
})
const addVisible = ref(false)
const editVisible = ref(false)
const dialogTitle = ref('')
@ -273,7 +276,7 @@ onMounted(() => {
}
.table-container {
max-height: 600px;
max-height: 650px;
overflow-y: auto;
}
</style>

28
activitylink/vite.config.js

@ -1,25 +1,23 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
export default defineConfig({
// 设置打包后静态资源的基础路径为 testBack
base: '/testBack/',
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
},
server: {
proxy: {
'/admin': {
target: 'https://dbqb.nfdxy.net/devLotApi', // 后端基础地址
//http://localhost:12699
changeOrigin: true,
rewrite: (path) => path
// 或者更精确的重写(根据后端路径调整):.replace(/^\/api/, '')
// rewrite: (path) => path.replace(/^\/api\/admin/, '/admin'),
},
server: {
proxy: {
'/admin': {
target: 'https://dbqb.nfdxy.net/devLotApi',
changeOrigin: true,
rewrite: (path) => path
},
},
})
},
});
Loading…
Cancel
Save