Browse Source

陆替换

lihuilin/feature-20250718094329-25周年庆后台
wangxiangwen4 4 weeks ago
parent
commit
131c1ce57c
  1. 6
      activitylink/src/views/zhongchou/gift/index.vue
  2. 20
      activitylink/src/views/zhongchou/index.vue
  3. 119
      activitylink/src/views/zhongchou/user/index.vue
  4. 26
      activitylink/vite.config.js

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

@ -143,7 +143,11 @@ const editForm = ref({
gradeId: '', gradeId: '',
imageUrl: null imageUrl: null
}) })
const uploadUrl = '/hljw/api/aws/upload';
// const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'; //
const uploadUrl = 'http://39.101.133.168:8828/hljw/api/aws/upload'; //
// const uploadUrl = '/hljw/api/aws/upload'
// const uploadUrl = 'https://39.101.133.168:8828/hljw/api/aws/upload'
// const uploadUrl = '/api/upload/upload'
const formRef = ref(null) const formRef = ref(null)
const uploadRef = ref(null) const uploadRef = ref(null)

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

@ -9,6 +9,7 @@ import {
User, User,
HelpFilled HelpFilled
} from '@element-plus/icons-vue' } from '@element-plus/icons-vue'
import { ElMessageBox, ElMessage } from 'element-plus';
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
const router = useRouter() const router = useRouter()
const handleOpen = (key, keyPath) => { const handleOpen = (key, keyPath) => {
@ -18,7 +19,19 @@ const handleClose = (key, keyPath) => {
// console.log(':', key, keyPath) // console.log(':', key, keyPath)
} }
const handleLogout = () => {
ElMessageBox.confirm('确定要退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//
router.push('/homePage');
}).catch(() => {
//
ElMessage.info('已取消退出');
});
};
</script> </script>
<template> <template>
@ -66,6 +79,11 @@ const handleClose = (key, keyPath) => {
<el-icon><User /></el-icon> <el-icon><User /></el-icon>
<span>用户管理</span> <span>用户管理</span>
</el-menu-item> </el-menu-item>
<el-menu-item @click="handleLogout">
<el-icon><Setting /></el-icon>
<span>退出登录</span>
</el-menu-item>
</el-menu> </el-menu>
</el-aside> </el-aside>

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

@ -2,7 +2,7 @@
<el-card style="margin-top: 50px; min-height: 90vh; max-height: 90vh;"> <el-card style="margin-top: 50px; min-height: 90vh; max-height: 90vh;">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<div class="gray-container"> <div class="gray-container">
<h2>中奖管理</h2>
<h2>用户管理</h2>
<el-form :inline="true" class="search-bar"> <el-form :inline="true" class="search-bar">
<el-form-item label="姓名"> <el-form-item label="姓名">
<el-input v-model="searchParams.username" placeholder="请输入姓名"></el-input> <el-input v-model="searchParams.username" placeholder="请输入姓名"></el-input>
@ -14,23 +14,6 @@
@input="handleJingwangIdInput" @input="handleJingwangIdInput"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="中奖等级">
<el-select
v-model="searchParams.gradeId"
placeholder="请选择"
class="prize-level-select"
style="width: 220px"
>
<el-option label="全部" value=""></el-option>
<el-option
v-for="item in gradeOptions"
:key="item.id"
:label="item.gradeName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch">搜索</el-button> <el-button type="primary" @click="handleSearch">搜索</el-button>
</el-form-item> </el-form-item>
@ -38,7 +21,7 @@
<el-button @click="handleReset">重置</el-button> <el-button @click="handleReset">重置</el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleExport">导出数据</el-button>
<el-button type="primary" @click="addusershow">添加用户</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -83,29 +66,15 @@
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
username: "", username: "",
gradeId: "",
jwcode: "" jwcode: ""
}) })
//
const gradeOptions = ref([])
// //
const tableData = ref([]) const tableData = ref([])
const total = ref(0) const total = ref(0)
//
const fetchWinLevelList = async () => {
try {
const res = await getWinLevelList()
if (res.code === 200) {
gradeOptions.value = res.data
}
} catch (error) {
console.error('获取中奖等级列表失败:', error)
}
}
const handleSizeChange = (val) => { const handleSizeChange = (val) => {
searchParams.value.pageSize = val searchParams.value.pageSize = val
searchParams.value.pageNum = 1 searchParams.value.pageNum = 1
@ -121,7 +90,7 @@
try { try {
const requestData = { const requestData = {
username: activityStone.searchUsername, username: activityStone.searchUsername,
gradeId: winStone.searchgradeId,
gradeId: "" ,
jwcode: activityStone.searchJwcode, jwcode: activityStone.searchJwcode,
pageNum: searchParams.value.pageNum, pageNum: searchParams.value.pageNum,
pageSize: searchParams.value.pageSize pageSize: searchParams.value.pageSize
@ -142,55 +111,14 @@
const handleSearch = () => { const handleSearch = () => {
searchParams.value.pageNum = 1 searchParams.value.pageNum = 1
//
activityStone.setSearchUsername(searchParams.value.username)
activityStone.setSearchJwcode(searchParams.value.jwcode)
winStone.setSearchgradeId(searchParams.value.gradeId)
// //
// activityStone.setSearchUsername(searchParams.value.username)
// activityStone.setSearchJwcode(searchParams.value.jwcode)
// winStone.setSearchgradeId(searchParams.value.gradeId)
fetchWinList() fetchWinList()
} }
//
const handleExport = async () => {
try {
const username = activityStone.searchUsername;
const jwcode = activityStone.searchJwcode;
const gradeId = winStone.searchgradeId;
//
const exportData = {
gradeId,
username,
jwcode
};
// blob
const response = await exportWinExcel(exportData);
// Blob
const blob = new Blob([response], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
});
//
const downloadUrl = window.URL.createObjectURL(blob);
// <a>
const link = document.createElement('a');
link.href = downloadUrl;
link.setAttribute('download', '中奖用户.xlsx'); // .xlsx
document.body.appendChild(link);
link.click();
//
link.remove();
window.URL.revokeObjectURL(downloadUrl);
} catch (error) {
console.error('导出数据失败:', error);
ElMessage.error('导出数据失败');
}
};
// //
@ -204,9 +132,9 @@
} }
// //
activityStone.setSearchUsername('')
activityStone.setSearchJwcode('')
winStone.setSearchgradeId('')
// activityStone.setSearchUsername('')
// activityStone.setSearchJwcode('')
// winStone.setSearchgradeId('')
fetchWinList() fetchWinList()
} }
@ -218,23 +146,22 @@
// //
onMounted(() => { onMounted(() => {
fetchWinLevelList()
fetchWinList() fetchWinList()
}) })
onBeforeRouteLeave((to, from, next) => {
// activity/index
if (to.name !== 'zhongchouwinning') {
// winStone gradeId
winStone.setSearchgradeId('')
// onBeforeRouteLeave((to, from, next) => {
// // activity/index
// if (to.name !== 'zhongchouwinning') {
// // winStone gradeId
// winStone.setSearchgradeId('')
// activityStone
activityStone.setSearchUsername('')
activityStone.setSearchJwcode('')
}
// // activityStone
// activityStone.setSearchUsername('')
// activityStone.setSearchJwcode('')
// }
next() // next()
})
// next() // next()
// })
</script> </script>
<style scoped> <style scoped>

26
activitylink/vite.config.js

@ -3,7 +3,6 @@ import vue from '@vitejs/plugin-vue';
import path from 'path'; import path from 'path';
export default defineConfig({ export default defineConfig({
// 设置打包后静态资源的基础路径为 testBack
base: '/testBack/', base: '/testBack/',
plugins: [vue()], plugins: [vue()],
resolve: { resolve: {
@ -13,14 +12,21 @@ export default defineConfig({
}, },
server: { server: {
proxy: { proxy: {
// 新增 /upload 代理
'/hljw/api/aws/upload': {
target: 'http://39.101.133.168:8828', // 目标服务器(HTTP)
changeOrigin: true, // 改变请求头中的 host
secure: false, // 忽略 HTTPS 证书验证(如果目标是 HTTPS)
rewrite: (path) => path // 保持路径不变
},
// 原有 /api 代理
'/api': { '/api': {
target: 'https://dbqb.nfdxy.net', // 后端基础地址
target: 'https://dbqb.nfdxy.net',
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), // 移除 /api 前缀
// 或者更精确的重写(根据后端路径调整):
// rewrite: (path) => path.replace(/^\/api\/admin/, '/admin'),
}
},
},
},
);
rewrite: (path) => path.replace(/^\/api/, '')
},
}
}
});
Loading…
Cancel
Save