diff --git a/activitylink/.env.development b/activitylink/.env.development
index 40cb689..38be259 100644
--- a/activitylink/.env.development
+++ b/activitylink/.env.development
@@ -2,5 +2,6 @@ VITE_ENV = 'development'
VITE_OUTPUT_DIR = 'dev'
VITE_PUBLIC_PATH = '/testBack/'
VITE_APP_BASE_API = 'https://dbqb.nfdxy.net/devLotApi/'
+# VITE_APP_BASE_API = 'http://localhost:12699'
VITE_USE_MOCK = true
-VITE_UPLOAD_URL=http://39.101.133.168:8828/hljw/api/aws/upload
\ No newline at end of file
+VITE_UPLOAD_URL='http://39.101.133.168:8828/hljw/api/aws/upload'
\ No newline at end of file
diff --git a/activitylink/.env.production b/activitylink/.env.production
index b4c1ecc..9c652b5 100644
--- a/activitylink/.env.production
+++ b/activitylink/.env.production
@@ -4,4 +4,5 @@ VITE_PUBLIC_PATH = '/testBack/'
VITE_USE_MOCK = true
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/'
\ No newline at end of file
diff --git a/activitylink/.env.test b/activitylink/.env.test
new file mode 100644
index 0000000..9b0e01d
--- /dev/null
+++ b/activitylink/.env.test
@@ -0,0 +1,7 @@
+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'
\ No newline at end of file
diff --git a/activitylink/package.json b/activitylink/package.json
index 7ab17df..4b7951e 100644
--- a/activitylink/package.json
+++ b/activitylink/package.json
@@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite --host",
- "build": "vite build",
+ "build:test": "vite build --mode test",
+ "build:prod": "vite build --mode production",
"preview": "vite preview"
},
"dependencies": {
diff --git a/activitylink/src/api/manage/gift.js b/activitylink/src/api/manage/gift.js
index c1c7fab..c32a17e 100644
--- a/activitylink/src/api/manage/gift.js
+++ b/activitylink/src/api/manage/gift.js
@@ -21,11 +21,14 @@ export function deletePrize(id) {
})
}
//奖品分页查询
-export function getPrizeList(params) {
+export function getPrizeList(data) {
return request({
url: '/admin/prize/list',
method: 'post',
- params: params
+ data: data,
+ headers: {
+ 'Content-Type': 'application/json'
+ }
})
}
// 根据id查询奖品
diff --git a/activitylink/src/api/manage/level.js b/activitylink/src/api/manage/level.js
index 8e3bb68..73210f3 100644
--- a/activitylink/src/api/manage/level.js
+++ b/activitylink/src/api/manage/level.js
@@ -2,11 +2,14 @@
import request from '@/utils/request'
const baseUrl = import.meta.env.VITE_APP_BASE_API
// 等级查询
-export function getLevelList(params) {
+export function getLevelList(data) {
return request({
url: '/admin/grade/list',
method: 'post',
- params: params
+ data: data,
+ headers: {
+ 'Content-Type': 'application/json'
+ }
})
}
// 等级新增
diff --git a/activitylink/src/views/homePage.vue b/activitylink/src/views/homePage.vue
index 68a0a80..3e4ffdd 100644
--- a/activitylink/src/views/homePage.vue
+++ b/activitylink/src/views/homePage.vue
@@ -38,7 +38,7 @@ const loginHandler = async () => {
// router.push('/zhongchou/mainimg')
if (response.code === 200 ) {
const token = response.data.token
- console.log(token)
+ console.log('登录时候的token',token)
localStorage.setItem('token', token)
ElMessage.success('登录成功,欢迎您使用本系统')
router.push('/zhongchou/mainimg')
diff --git a/activitylink/src/views/zhongchou/gift/index.vue b/activitylink/src/views/zhongchou/gift/index.vue
index a9ddfa5..5c8aa80 100644
--- a/activitylink/src/views/zhongchou/gift/index.vue
+++ b/activitylink/src/views/zhongchou/gift/index.vue
@@ -120,7 +120,7 @@ import { useRouter } from 'vue-router';
import { usegiftFixedListStone } from '@/stone/giftFixedListStone';
import { getPrizeList, addPrize, deletePrize, updatePrize } from '@/api/manage/gift';
import { getGradeNameList } from '@/api/manage/level';
-
+const validator = /^[a-zA-Z0-9\u4e00-\u9fa5]+$/ // 中英文和数字
const router = useRouter();
const gradeNames = ref([])
const tableData = ref([])
@@ -143,11 +143,7 @@ const editForm = ref({
gradeId: '',
imageUrl: null
})
-// 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 uploadUrl = import.meta.env.VITE_UPLOAD_URL
const formRef = ref(null)
const uploadRef = ref(null)
@@ -216,6 +212,14 @@ const submitAdd = async () => {
ElMessage.error('请上传图片');
return;
}
+ if(addForm.value.prizeName.length > 15){
+ ElMessage.error('奖品名称最多输入15个字符');
+ return;
+ }
+ if (!validator.test(addForm.value.prizeName)) {
+ ElMessage.error('礼品名称只能输入中英文和数字')
+ return
+ }
try {
const data = {
prizeName: addForm.value.prizeName,
@@ -274,6 +278,14 @@ const submitEdit = async () => {
ElMessage.error('请上传图片');
return;
}
+ if(editForm.value.prizeName.length > 15){
+ ElMessage.error('奖品名称最多输入15个字符');
+ return;
+ }
+ if (!validator.test(editForm.value.prizeName)) {
+ ElMessage.error('礼品名称只能输入中英文和数字')
+ return
+ }
try {
const data = {
id: editForm.value.id,
diff --git a/activitylink/src/views/zhongchou/level/index.vue b/activitylink/src/views/zhongchou/level/index.vue
index 47b6165..dc49ae4 100644
--- a/activitylink/src/views/zhongchou/level/index.vue
+++ b/activitylink/src/views/zhongchou/level/index.vue
@@ -43,16 +43,16 @@
-
+
-
+
-
+
@@ -69,16 +69,16 @@
-
+
-
+
-
+
@@ -96,6 +96,7 @@
import { ref, computed, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getLevelList, addLevel, deleteGrade, updateGrade } from '@/api/manage/level'
+const validator = /^[a-zA-Z0-9\u4e00-\u9fa5]+$/ // 中英文和数字
const tableData = ref([])
const pagination = ref({
pageNum: 1,
@@ -155,6 +156,14 @@ const submitAdd = async () => {
ElMessage.error('请填写完整信息')
return
}
+ if (addForm.value.gradeName.length > 15) {
+ ElMessage.error('等级名称最多输入15个字符')
+ return
+ }
+ if (!validator.test(addForm.value.gradeName)) {
+ ElMessage.error('等级名称只能输入中英文和数字')
+ return
+ }
try {
const data = {
gradeName: String(addForm.value.gradeName),
@@ -183,6 +192,14 @@ const submitEdit = async () => {
ElMessage.error('请填写完整信息')
return
}
+ if (editForm.value.gradeName.length > 15) {
+ ElMessage.error('等级名称最多输入15个字符')
+ return
+ }
+ if (!validator.test(editForm.value.gradeName)) {
+ ElMessage.error('等级名称只能输入中英文和数字')
+ return
+ }
try {
const editData = {
id: editForm.value.id,
diff --git a/activitylink/vite.config.js b/activitylink/vite.config.js
index 4250ced..729ad69 100644
--- a/activitylink/vite.config.js
+++ b/activitylink/vite.config.js
@@ -3,30 +3,23 @@ import vue from '@vitejs/plugin-vue';
import path from 'path';
export default defineConfig({
- base: '/testBack/',
+ base: '/testBack/',
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
},
- server: {
- 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': {
- target: 'https://dbqb.nfdxy.net',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, '')
+ server: {
+ proxy: {
+ '/api': {
+ target: 'https://dbqb.nfdxy.net', // 后端基础地址
+ changeOrigin: true,
+ rewrite: (path) => path.replace(/^\/api/, ''), // 移除 /api 前缀
+ // 或者更精确的重写(根据后端路径调整):
+ // rewrite: (path) => path.replace(/^\/api\/admin/, '/admin'),
+ }
},
-
- }
- }
-});
\ No newline at end of file
+ },
+ },
+);
\ No newline at end of file