6 Commits

  1. 7
      activitylink/.env.production
  2. 2
      activitylink/.env.test
  3. 115
      activitylink/src/views/zhongchou/gift/index.vue
  4. 3
      activitylink/src/views/zhongchou/level/index.vue

7
activitylink/.env.production

@ -1,17 +1,16 @@
# VITE_ENV = 'production'
# VITE_OUTPUT_DIR = 'dist'
# VITE_PUBLIC_PATH = '/testBack/'
# VITE_PUBLIC_PATH = '/prodBack/'
# VITE_USE_MOCK = true
# VITE_UPLOAD_URL='https://api.homilychart.com/hljw/api/aws/upload'
# VITE_APP_BASE_API = 'https://dbqb.nfdxy.net/devLotApi'
# VITE_BUILD_COMPRESS = 'none'
# VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
# VITE_UPLOAD_URL='https://api.homilychart.com/hljw/api/aws/upload'
# VITE_APP_BASE_API = 'https://dbqb.nfdxy.net/devLotApi/'
VITE_ENV = 'test'
VITE_OUTPUT_DIR = 'test'
VITE_OUTPUT_DIR = 'dist'
VITE_PUBLIC_PATH = '/testBack/'
VITE_APP_BASE_API = 'https://dbqb.nfdxy.net/devLotApi/'
VITE_USE_MOCK = true

2
activitylink/.env.test

@ -1,5 +1,5 @@
VITE_ENV = 'test'
VITE_OUTPUT_DIR = 'test'
VITE_OUTPUT_DIR = 'dist'
VITE_PUBLIC_PATH = '/testBack/'
VITE_APP_BASE_API = 'https://dbqb.nfdxy.net/devLotApi/'
VITE_USE_MOCK = true

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

@ -20,8 +20,10 @@
</el-icon>
</template>
</el-table-column>
<el-table-column prop="prizeName" label="名称" width="300" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="gradeName" label="等级" width="200" align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="prizeName" label="名称" width="300" align="center"
show-overflow-tooltip></el-table-column>
<el-table-column prop="gradeName" label="等级" width="200" align="center"
show-overflow-tooltip></el-table-column>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button type="primary" text @click="goToimportFixedList(scope.row)">导入内定名单</el-button>
@ -53,18 +55,19 @@
:on-change="handleImageChange" :on-success="handleUploadSuccess" :on-error="handleUploadError"
:before-upload="beforeUpload" :show-file-list="false">
<!-- :action="uploadUrl" -->
<el-icon>
<Plus />
</el-icon>
<template #default>
<img v-if="addForm.imageUrl" :src="addForm.imageUrl"
style="width: 100%; height: 100%; object-fit: cover;">
<el-icon v-else>
<Plus />
</el-icon>
</template>
<template #tip>
<div class="el-upload__tip">
只能上传jpgpng格式的图片且不超过1MB
</div>
</template>
</el-upload>
<div v-if="addForm.imageUrl" class="upload-preview">
<img :src="addForm.imageUrl" alt="预览图" style="max-width: 200px; margin-top: 10px; border-radius: 4px;">
</div>
</el-form-item>
</el-form>
<template #footer>
@ -90,8 +93,9 @@
<el-upload ref="uploadRef" list-type="picture-card" :auto-upload="false" :http-request="customUpload"
:on-change="handleImageChange" :on-success="handleUploadSuccess" :on-error="handleUploadError"
:before-upload="beforeUpload" :show-file-list="false">
<!-- :action="uploadUrl" -->
<el-icon>
<img v-if="editForm.imageUrl" :src="editForm.imageUrl"
style="width: 100%; height: 100%; object-fit: cover;">
<el-icon v-else>
<Plus />
</el-icon>
<template #tip>
@ -100,9 +104,6 @@
</div>
</template>
</el-upload>
<div v-if="editForm.imageUrl" class="upload-preview">
<img :src="editForm.imageUrl" alt="预览图" style="max-width: 200px; margin-top: 10px; border-radius: 4px;">
</div>
</el-form-item>
</el-form>
<template #footer>
@ -360,59 +361,55 @@ const handleUploadSuccess = (response, file, fileList) => {
addForm.value.imageUrl = response.data.url;
} else if (editVisible.value) {
editForm.value.imageUrl = response.data.url;
} else {
if (addVisible.value) {
addForm.value.imageUrl = null;
} else if (editVisible.value) {
editForm.value.imageUrl = null;
}
}
console.log('==========================', response.data.url)
} catch (error) {
console.log('看看报错信息', error)
ElMessage.error(response.msg || '图片上传失败');
}
}
const handleUploadError = (error) => {
console.error('上传失败:', error);
if (addVisible.value) {
addForm.value.imageUrl = null;
} else if (editVisible.value) {
editForm.value.imageUrl = null;
}
ElMessage.error('图片上传失败,请重试');
const handleUploadError = (error) => {
console.error('上传失败:', error);
if (addVisible.value) {
addForm.value.imageUrl = null;
} else if (editVisible.value) {
editForm.value.imageUrl = null;
}
ElMessage.error('图片上传失败,请重试');
}
const beforeUpload = (file) => {
const isJPG = file.type === 'image/jpeg';
const isPNG = file.type === 'image/png';
const isLt1 = file.size / 1024 < 1024;
const beforeUpload = (file) => {
const isJPG = file.type === 'image/jpeg';
const isPNG = file.type === 'image/png';
const isLt1 = file.size / 1024 < 1024;
if (!isJPG && !isPNG) {
ElMessage.error('上传图片只能是 JPG 或 PNG 格式');
return false;
}
if (!isLt1) {
ElMessage.error('上传图片大小不能超过1MB');
return false;
}
return true;
if (!isJPG && !isPNG) {
ElMessage.error('上传图片只能是 JPG 或 PNG 格式');
return false;
}
const handleSizeChange = (val) => {
pagination.value.pageSize = val
pagination.value.pageNum = 1
getPrizes()
if (!isLt1) {
ElMessage.error('上传图片大小不能超过1MB');
return false;
}
return true;
}
const handleCurrentChange = (val) => {
pagination.value.pageNum = val
getPrizes()
}
const handleSizeChange = (val) => {
pagination.value.pageSize = val
pagination.value.pageNum = 1
getPrizes()
}
onMounted(() => {
getPrizes()
getGradeNames()
})
const handleCurrentChange = (val) => {
pagination.value.pageNum = val
getPrizes()
}
onMounted(() => {
getPrizes()
getGradeNames()
})
</script>
<style scoped>
@ -423,14 +420,6 @@ const handleUploadSuccess = (response, file, fileList) => {
min-height: 80vh;
}
.pagination-container {
padding: 10px 20px;
background-color: #fff;
border-top: 1px solid #ebeef5;
display: flex;
justify-content: center;
}
.action-buttons {
margin-bottom: 20px;
}
@ -446,8 +435,4 @@ img {
object-fit: contain;
border-radius: 4px;
}
.upload-preview {
margin-top: 10px;
}
</style>

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

@ -29,11 +29,12 @@
</el-table-column>
</el-table>
</div>
</div>
<!-- 分页 -->
<el-pagination class="pagination" v-model:current-page="pagination.pageNum" v-model:page-size="pagination.pageSize"
layout="total, sizes, prev, pager, next, jumper" :total="pagination.total" :page-sizes="[10, 20, 50, 100]"
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>
<!-- 添加 -->
<el-dialog v-model="addVisible" :title="dialogTitle" width=400px @closed="resetForm">

Loading…
Cancel
Save