diff --git a/src/api/API.js b/src/api/API.js index 6d6cc57..42e6bc5 100644 --- a/src/api/API.js +++ b/src/api/API.js @@ -1,10 +1,11 @@ import request from "../utils/request"; - const APIurl = import.meta.env.VITE_APP_API_BASE_URL; +// 开发环境使用代理,生产环境使用环境变量 +// const APIurl = import.meta.env.DEV ? '/Api' : import.meta.env.VITE_APP_API_BASE_URL; export function addRecordAPI(data) { return request({ - url: '/Api/api/funding/addRecord', + url: `Api/api/funding/addRecord`, method: 'post', data: data }) @@ -12,7 +13,7 @@ export function addRecordAPI(data) { // 新增:获取活动信息接口 export function getActivity1API() { return request({ - url: '/Api/api/funding/getActivity1', + url: `Api/api/funding/getActivity1`, method: 'post' }) } \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 3d17edd..53cd1e0 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -12,8 +12,12 @@ service.interceptors.request.use(config => { // 添加token逻辑(如果存在) const token = localStorage.getItem('token') if (token) { - config.headers['Authorization'] = 'Bearer ' + +SsksARQgUHIbIG3rRnnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w + config.headers['Authorization'] = 'Bearer ' + token } + + // 添加固定的 token + config.headers['token'] = '+SsksARQgUHIbIG3rRnnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w' + return config }) diff --git a/src/views/zhongchou/index.vue b/src/views/zhongchou/index.vue index 346a49a..3e8c7b7 100644 --- a/src/views/zhongchou/index.vue +++ b/src/views/zhongchou/index.vue @@ -130,18 +130,18 @@ import { addRecordAPI ,getActivity1API } from '../../api/API' import { ref, computed, onMounted, nextTick, watch } from 'vue' // 在组件中使用 async function fetchActivity() { - try { - const response = await getActivity1API() - if (response.code === 200) { - console.log('活动数据:', response.data) - // 处理返回的数据 - // response.data 包含:marketOne, marketTwo, startTime, endTime 等字段 - } else { - console.error('获取活动失败:', response.message) + try { + const response = await getActivity1API() + if (response.code === 200) { + console.log('活动数据:', response.data) + // 处理返回的数据 + // response.data 包含:marketOne, marketTwo, startTime, endTime 等字段 + } else { + console.error('获取活动失败:', response.message) + } + } catch (error) { + console.error('请求错误:', error) } - } catch (error) { - console.error('请求错误:', error) - } } const numberToChinese = (num) => { const chineseNumbers = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二', '十三', '十四', '十五'] @@ -239,6 +239,8 @@ const updateProgressDisplay = () => { // 组件挂载时初始化 onMounted(() => { nextTick(() => { + // 页面加载时自动获取活动数据 + fetchActivity() updateProgressBarHeight() updateProgressDisplay() @@ -278,7 +280,7 @@ const handleBoostClick = async (area) => { "activityId": 1, "marketSign": "usa" }); - + if (response.code === 200) { usBoostStatus.value = true // 助力后减少1分钟时间 @@ -298,7 +300,7 @@ const handleBoostClick = async (area) => { "activityId": 1, "marketSign": "hk" }); - + if (response.code === 200) { hkBoostStatus.value = true // 助力后减少1分钟时间 @@ -461,6 +463,7 @@ const hideRules = () => { transform-style: preserve-3d; transform-origin: center center; } + /* 为所有图片添加渲染优化 */ /* .stock-card img, .rocket-body img, @@ -523,10 +526,13 @@ const hideRules = () => { position: absolute; z-index: 10; transform: translateZ(0); - /* 新增位置调整 */ - top: 80%; /* 垂直居中,可调整为具体像素值如 100px */ - left: 50%; /* 水平居中,可调整为具体像素值如 200px */ - transform: translate(-50%, -50%) translateZ(0); /* 居中偏移 */ + /* 新增位置调整 */ + top: 80%; + /* 垂直居中,可调整为具体像素值如 100px */ + left: 50%; + /* 水平居中,可调整为具体像素值如 200px */ + transform: translate(-50%, -50%) translateZ(0); + /* 居中偏移 */ } .rocket-area.hidden { @@ -651,23 +657,23 @@ const hideRules = () => { position: relative; overflow: visible; } + /* 美股进度条容器 - 蓝色主题背景 */ .us-content .progress-bar { - background: linear-gradient(to top, - rgba(79, 195, 247, 0.2), - rgba(41, 182, 246, 0.3), - rgba(2, 136, 209, 0.4) - ); + background: linear-gradient(to top, + rgba(79, 195, 247, 0.2), + rgba(41, 182, 246, 0.3), + rgba(2, 136, 209, 0.4)); border: 1px solid rgba(41, 182, 246, 0.5); box-shadow: 0 0 10px rgba(41, 182, 246, 0.3); } + /* 港股进度条容器 - 红色主题背景 */ .hk-content .progress-bar { - background: linear-gradient(to top, - rgba(255, 138, 128, 0.2), - rgba(255, 87, 34, 0.3), - rgba(211, 47, 47, 0.4) - ); + background: linear-gradient(to top, + rgba(255, 138, 128, 0.2), + rgba(255, 87, 34, 0.3), + rgba(211, 47, 47, 0.4)); border: 1px solid rgba(255, 87, 34, 0.5); box-shadow: 0 0 10px rgba(255, 87, 34, 0.3); } @@ -752,14 +758,17 @@ const hideRules = () => { border-radius: 10px; transition: height 0.8s ease; } + /* 美股进度条填充 - 蓝色系渐变 */ .us-content .progress-fill { background: linear-gradient(to top, #4FC3F7, #29B6F6, #0288D1); } + /* 港股进度条填充 - 红色系渐变 */ .hk-content .progress-fill { background: linear-gradient(to top, #FF8A80, #FF5722, #D32F2F); } + /* 在进度条填充部分顶部添加火箭gif */ .progress-fill::after { content: ''; @@ -778,7 +787,7 @@ const hideRules = () => { } .marker { - position: relative; + position: relative; color: #FFD700; /* 默认金色 */ font-size: 1.4rem; @@ -789,6 +798,7 @@ const hideRules = () => { letter-spacing: 0.5px; text-rendering: optimizeLegibility; } + /* 为刻度数字添加连接线 */ .marker::before { content: ''; @@ -803,17 +813,20 @@ const hideRules = () => { /* 美股刻度连接线 - 从右侧连接到进度条 */ .us-content .marker::before { - right: -20px; - background-color: #00BFFF; /* 蓝色 */ + right: -20px; + background-color: #00BFFF; + /* 蓝色 */ box-shadow: 0 0 4px rgba(0, 191, 255, 0.5); } /* 港股刻度连接线 - 从左侧连接到进度条 */ .hk-content .marker::before { left: -20px; - background-color: #FF4444; /* 红色 */ + background-color: #FF4444; + /* 红色 */ box-shadow: 0 0 4px rgba(255, 68, 68, 0.5); } + /* 美股激活刻度 */ .us-content .marker.reached { color: #00BFFF !important; diff --git a/vite.config.js b/vite.config.js index 302d41b..8eb5a65 100644 --- a/vite.config.js +++ b/vite.config.js @@ -15,7 +15,7 @@ export default defineConfig({ '/Api': { target: 'https://dbqb.nfdxy.net/devLotApi', // 后端基础地址 changeOrigin: true, - rewrite: (path) => path.replace(/^\/api/, ''), // 移除 /api 前缀 + rewrite: (path) => path.replace(/^\/Api/, ''), // 移除 /api 前缀 // 或者更精确的重写(根据后端路径调整): // rewrite: (path) => path.replace(/^\/api\/admin/, '/admin'), },