6 Commits

  1. 25
      activitylink/.env.production
  2. 3
      activitylink/package.json
  3. 2
      activitylink/src/views/zhongchou/activity/index.vue
  4. 2
      activitylink/src/views/zhongchou/gift/importFixedList/index.vue
  5. 4
      activitylink/src/views/zhongchou/gift/importuser/index.vue
  6. 104
      activitylink/src/views/zhongchou/gift/index.vue

25
activitylink/.env.production

@ -1,12 +1,19 @@
VITE_ENV = 'production'
VITE_OUTPUT_DIR = 'dist'
VITE_PUBLIC_PATH = '/testBack/'
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_ENV = 'production'
# VITE_OUTPUT_DIR = 'dist'
# VITE_PUBLIC_PATH = '/testBack/'
# 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_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_PUBLIC_PATH = '/testBack/'
VITE_APP_BASE_API = 'https://dbqb.nfdxy.net/devLotApi/'
VITE_USE_MOCK = true
# VITE_UPLOAD_URL='http://39.101.133.168:8828/hljw/api/aws/upload'
VITE_UPLOAD_URL='https://api.homilychart.com/hljw/api/aws/upload'

3
activitylink/package.json

@ -5,8 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite --host",
"build:test": "vite build --mode test",
"build:prod": "vite build --mode production",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {

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

@ -59,7 +59,7 @@
<!-- 删除确认对话框 -->
<el-dialog v-model="deleteConfirmVisible" title="提示" width="30%">
<span>您确定删除该活动吗</span>
<span>此操作会删除对应的活动信息和活动助力详情信息您确定删除该活动吗</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="deleteConfirmVisible = false"> </el-button>

2
activitylink/src/views/zhongchou/gift/importFixedList/index.vue

@ -183,7 +183,7 @@ const submitAdd = async () => {
//
const delUser = (row) => {
ElMessageBox.confirm('确定要删除该用户吗?', '提示', {
ElMessageBox.confirm('确定要删除该内定用户吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'

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

@ -164,7 +164,7 @@ const submitAdd = async () => {
//
const delUser = (row) => {
ElMessageBox.confirm('确定要删除该用户吗?', '提示', {
ElMessageBox.confirm('此操作会删除对应内定用户信息和中奖记录信息,确定要删除该用户吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
@ -192,7 +192,7 @@ const batchDelete = async () => {
ElMessage.warning('请先选择需要删除的用户')
return
}
ElMessageBox.confirm(`确定要删除选中的${selectedIds.value.length}条数据吗?`, '删除确认', {
ElMessageBox.confirm(`此操作会删除对应用户内定信息和中奖记录信息,确定要删除选中的${selectedIds.value.length}条数据吗?`, '删除确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'

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

@ -9,7 +9,8 @@
<div class="table-container" style="flex: 1; overflow-y: auto;">
<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>
<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">
@ -48,7 +49,7 @@
</el-select>
</el-form-item>
<el-form-item label="礼品图片" :rules="{ required: true, message: '请上传图片', trigger: 'change' }">
<el-upload ref="uploadRef" list-type="picture-card" :auto-upload="false" :http-request="customUpload"
<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" -->
@ -57,7 +58,7 @@
</el-icon>
<template #tip>
<div class="el-upload__tip">
只能上传jpgpng格式的图片且不超过500KB
只能上传jpgpng格式的图片且不超过1MB
</div>
</template>
</el-upload>
@ -86,7 +87,7 @@
</el-select>
</el-form-item>
<el-form-item label="礼品图片" :rules="{ required: true, message: '请上传图片', trigger: 'change' }">
<el-upload ref="uploadRef" list-type="picture-card" :auto-upload="false"
<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" -->
@ -95,7 +96,7 @@
</el-icon>
<template #tip>
<div class="el-upload__tip">
只能上传jpgpng格式的图片且不超过500KB
只能上传jpgpng格式的图片且不超过1MB
</div>
</template>
</el-upload>
@ -142,7 +143,7 @@ const addForm = ref({
})
const editForm = ref({
prizeName: '',
gradeId: '',
gradeId: null,
imageUrl: null
})
const uploadUrl = import.meta.env.VITE_UPLOAD_URL
@ -214,7 +215,7 @@ const submitAdd = async () => {
ElMessage.error('请上传图片');
return;
}
if(addForm.value.prizeName.length > 15){
if (addForm.value.prizeName.length > 15) {
ElMessage.error('奖品名称最多输入15个字符');
return;
}
@ -249,7 +250,7 @@ const submitAdd = async () => {
}
//
const deleteGift = (row) => {
ElMessageBox.confirm('确定要删除该礼品吗?', '提示', {
ElMessageBox.confirm('此操作会删除内定对应用户信息和中奖记录信息,确定要删除该礼品吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
@ -280,7 +281,7 @@ const submitEdit = async () => {
ElMessage.error('请上传图片');
return;
}
if(editForm.value.prizeName.length > 15){
if (editForm.value.prizeName.length > 15) {
ElMessage.error('奖品名称最多输入15个字符');
return;
}
@ -333,11 +334,11 @@ const customUpload = async (options) => {
'Authorization': `Bearer ${localStorage.getItem('token')}`
}
});
console.log('看看路径', import.meta.env.VITE_UPLOAD_URL)
if (response.data.code === 200 && response.data.data) {
//
handleUploadSuccess(response.data, options.file);
ElMessage.success('上传成功');
ElMessage.success(response.data.msg || '上传成功');
} else {
ElMessage.error(response.data.msg || '上传失败');
}
@ -354,63 +355,64 @@ const handleImageChange = (file) => {
uploadRef.value.submit();
}
const handleUploadSuccess = (response, file, fileList) => {
if (response.code === 200) {
try {
if (addVisible.value) {
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;
}
}
} else {
} catch (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(response.message || '图片上传失败');
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 isLt500K = file.size / 1024 < 500;
if (!isJPG && !isPNG) {
ElMessage.error('上传图片只能是 JPG 或 PNG 格式');
return false;
}
if (!isLt500K) {
ElMessage.error('上传图片大小不能超过 500KB');
return false;
if (!isJPG && !isPNG) {
ElMessage.error('上传图片只能是 JPG 或 PNG 格式');
return false;
}
if (!isLt1) {
ElMessage.error('上传图片大小不能超过1MB');
return false;
}
return true;
}
return true;
}
const handleSizeChange = (val) => {
pagination.value.pageSize = val
pagination.value.pageNum = 1
getPrizes()
}
const handleSizeChange = (val) => {
pagination.value.pageSize = val
pagination.value.pageNum = 1
getPrizes()
}
const handleCurrentChange = (val) => {
pagination.value.pageNum = val
getPrizes()
}
const handleCurrentChange = (val) => {
pagination.value.pageNum = val
getPrizes()
}
onMounted(() => {
getPrizes()
getGradeNames()
})
onMounted(() => {
getPrizes()
getGradeNames()
})
</script>
<style scoped>

Loading…
Cancel
Save