Browse Source

feat(gameEvent): 新增赛事微信小程序码生成功能

- 更新生产环境API地址为https://meet3.sportsrobo.club
- 添加updateGameEventWxCode接口用于重新生成赛事小程序码
- 在赛事列表页增加"生成赛事码"操作按钮
- 调整赛事编辑页布局,注释掉赛事链接上传组件
- 修复赛事链接图片预览字段引用错误的问题
- 更新vite代理配置指向新的生产环境地址
zhou 4 weeks ago
parent
commit
06a901d23c

+ 1 - 1
.env.production

@@ -14,7 +14,7 @@ VITE_APP_MONITOR_ADMIN = '/admin/applications'
 VITE_APP_SNAILJOB_ADMIN = '/snail-job'
 
 # 生产环境
-VITE_APP_BASE_API = 'http://meet2.sportsrobo.club:8080'
+VITE_APP_BASE_API = 'https://meet3.sportsrobo.club'
 
 # 是否在打包时开启压缩,支持 gzip 和 brotli
 VITE_BUILD_COMPRESS = gzip

+ 11 - 0
src/api/system/gameEvent/index.ts

@@ -16,6 +16,17 @@ export const listGameEvent = (query?: GameEventQuery): AxiosPromise<GameEventVO[
   });
 };
 
+/**
+ * 更新赛事微信小程序码
+ * 重新生成赛事的小程序码
+ */
+export const updateGameEventWxCode = (eventId: string | number) => {
+  return request({
+    url: '/system/gameEvent/updateQrCode/' + eventId,
+    method: 'put'
+  });
+};
+
 /**
  * 查询赛事基本信息详细
  * @param eventId

+ 6 - 6
src/config/api.ts

@@ -12,7 +12,7 @@ const API_CONFIG = {
   // 开发环境
   development: import.meta.env.VITE_APP_BASE_API,
   // 生产环境
-  production: 'http://meet2.sportsrobo.club:8080',
+  production: 'https://meet3.sportsrobo.club',
   // 测试环境
   test: 'http://192.168.1.126:8080',
   // 本地环境
@@ -25,14 +25,14 @@ export const getBaseURL = (): string => {
   if (import.meta.env.VITE_APP_BASE_API) {
     return import.meta.env.VITE_APP_BASE_API;
   }
-  
+
   // 根据环境自动选择
   if (isDev) {
     return API_CONFIG.development;
   } else if (isProd) {
     return API_CONFIG.production;
   }
-  
+
   // 默认返回开发环境配置
   return API_CONFIG.development;
 };
@@ -46,17 +46,17 @@ export const API_ENDPOINTS = {
   UPLOAD: '/resource/oss/upload',
   UPLOAD_COMMON: '/common/upload',
   DOWNLOAD: '/resource/oss/download',
-  
+
   // 系统相关
   USER_IMPORT: '/system/user/importData',
   GAME_TEAM_IMPORT: '/system/gameTeam/import',
   GAME_ATHLETE_IMPORT: '/system/gameAthlete/import',
   ENROLL_IMPORT: '/system/enroll/importData',
-  
+
   // WebSocket和SSE
   WEBSOCKET: '/resource/websocket',
   SSE: '/resource/sse',
-  
+
   // 工作流
   WORKFLOW_UI: '/warm-flow-ui/index.html'
 } as const;

+ 2 - 2
src/views/system/gameEvent/edit.vue

@@ -105,11 +105,11 @@
             </el-row>
 
             <el-row :gutter="20">
-              <el-col :span="12">
+              <!-- <el-col :span="12">
                 <el-form-item label="赛事链接" prop="eventUrl">
                   <image-upload-cropper v-model="basicForm.eventUrl" />
                 </el-form-item>
-              </el-col>
+              </el-col> -->
               <el-col :span="12">
                 <el-form-item label="裁判码" prop="refereeUrl">
                   <image-upload-cropper v-model="basicForm.refereeUrl" />

+ 14 - 4
src/views/system/gameEvent/index.vue

@@ -107,11 +107,14 @@
         <el-table-column type="selection" width="55" align="center" />
 
         <!-- 第二列:操作列 -->
-        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
+        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
               <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:gameEvent:edit']"> 修改 </el-button>
             </el-tooltip>
+            <el-tooltip content="生成赛事链接" placement="top">
+              <el-button link type="warning" icon="Edit" @click="handleUpdateCode(scope.row)" v-hasPermi="['system:gameEvent:edit']"> 生成赛事码 </el-button>
+            </el-tooltip>
           </template>
         </el-table-column>
         <el-table-column label="赛事id" align="center" prop="eventId" v-if="columns[0].visible" />
@@ -138,9 +141,9 @@
             <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="赛事链接" align="center" prop="eventUrlUrl" width="100" v-if="columns[8].visible">
+        <el-table-column label="赛事链接" align="center" prop="eventUrl" width="100" v-if="columns[8].visible">
           <template #default="scope">
-            <image-preview :src="scope.row.eventUrlUrl" :width="50" :height="50" />
+            <image-preview :src="scope.row.eventUrl" :width="50" :height="50" />
           </template>
         </el-table-column>
         <el-table-column label="裁判码" align="center" prop="refereeUrlUrl" width="100" v-if="columns[9].visible">
@@ -401,7 +404,7 @@
 </template>
 
 <script setup name="GameEvent" lang="ts">
-import { listGameEvent, changeEventDefault, delGameEvent, addGameEvent, updateGameEvent, generateNumberTable } from '@/api/system/gameEvent';
+import { listGameEvent, changeEventDefault, delGameEvent, addGameEvent, updateGameEvent, updateGameEventWxCode } from '@/api/system/gameEvent';
 import { GameEventVO, GameEventQuery, GameEventForm } from '@/api/system/gameEvent/types';
 import { getEventMdByEventAndType, editEventMd } from '@/api/system/eventMd';
 import { EventMdVO, EventMdForm } from '@/api/system/eventMd/types';
@@ -579,6 +582,13 @@ const handleUpdate = async (row?: GameEventVO) => {
   router.push(`/system/gameEvent/edit/${_eventId}`);
 };
 
+/** 生成赛事码按钮操作 */
+const handleUpdateCode = async (row?: GameEventVO) => {
+  const _eventId = row?.eventId || ids.value[0];
+  await updateGameEventWxCode(_eventId);
+  await getList();
+};
+
 /** 提交按钮 */
 const submitForm = () => {
   gameEventFormRef.value?.validate(async (valid: boolean) => {

+ 2 - 2
vite.config.ts

@@ -24,8 +24,8 @@ export default defineConfig(({ mode, command }) => {
       open: true,
       proxy: {
         [env.VITE_APP_BASE_API]: {
-          // target: 'http://meet2.sportsrobo.club:8080',
-          target: 'http://localhost:8080',
+          target: 'https://meet3.sportsrobo.club',
+          // target: 'http://localhost:8080',
           // target: 'http://192.168.1.126:8080',
           changeOrigin: true,
           ws: true,