Browse Source

修改样式

songtongtong/feature-20250717104937-众筹
zhangjiahao 4 weeks ago
parent
commit
db6d7f2277
  1. 5
      .env.development
  2. 5
      package-lock.json
  3. 14
      src/api/API.js
  4. 6
      src/main.js
  5. 129
      src/utils/request.js
  6. 396
      src/views/zhongchou/index.vue
  7. 13
      vite.config.js

5
.env.development

@ -5,7 +5,10 @@ VITE_OUTPUT_DIR = 'dev'
VITE_PUBLIC_PATH = / VITE_PUBLIC_PATH = /
#新数据接口 #新数据接口
VITE_APP_API_BASE_URL = "http://39.101.133.168:8828/link"
# VITE_APP_API_BASE_URL = "http://39.101.133.168:8828/link"
# VITE_APP_API_BASE_URL = "http://47.92.148.30:3003/mock/3267"
VITE_APP_API_BASE_URL = "http://dbqb.nfdxy.net/devLotApi"
# Whether to open mock # Whether to open mock

5
package-lock.json

@ -716,9 +716,8 @@
}, },
"node_modules/axios": { "node_modules/axios": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/axios/-/axios-1.10.0.tgz",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.10.0.tgz",
"integrity": "sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==", "integrity": "sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==",
"license": "MIT",
"dependencies": { "dependencies": {
"follow-redirects": "^1.15.6", "follow-redirects": "^1.15.6",
"form-data": "^4.0.0", "form-data": "^4.0.0",
@ -1684,7 +1683,7 @@
}, },
"axios": { "axios": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://mirrors.huaweicloud.com/repository/npm/axios/-/axios-1.10.0.tgz",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.10.0.tgz",
"integrity": "sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==", "integrity": "sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==",
"requires": { "requires": {
"follow-redirects": "^1.15.6", "follow-redirects": "^1.15.6",

14
src/api/API.js

@ -2,3 +2,17 @@ import request from "../utils/request";
const APIurl = import.meta.env.VITE_APP_API_BASE_URL; const APIurl = import.meta.env.VITE_APP_API_BASE_URL;
export function addRecordAPI(data) {
return request({
url: '/Api/api/funding/addRecord',
method: 'post',
data: data
})
}
// 新增:获取活动信息接口
export function getActivity1API() {
return request({
url: '/Api/api/funding/getActivity1',
method: 'post'
})
}

6
src/main.js

@ -3,8 +3,4 @@ import { createApp } from 'vue'
import App from './App.vue' import App from './App.vue'
import router from './router' import router from './router'
// createApp(App).use(router).mount('#app')
const app = createApp(App)
app.use(router)
// app.use(ElementPlus)
app.mount('#app')
createApp(App).use(router).mount('#app')

129
src/utils/request.js

@ -1,128 +1,27 @@
import axios from 'axios' import axios from 'axios'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { config } from '@/config'
const ERROR_MESSAGES = {
badRequest: '请求错误(400)',
unauthorized: '未授权,请登录(401)',
forbidden: '拒绝访问(403)',
notFound: `请求地址出错: ${'[具体 URL 将在这里被替换]'}`,
methodNotAllowed: '请求方法未允许(405)',
requestTimeout: '请求超时(408)',
internalServerError: '服务器内部错误(500)',
notImplemented: '服务未实现(501)',
badGateway: '网络错误(502)',
serviceUnavailable: '服务不可用(503)',
gatewayTimeout: '网络超时(504)',
httpVersionNotSupported: 'HTTP 版本不受支持(505)',
defaultConnectionError: '连接错误: [原始错误消息]',
networkError: '网络异常,请检查后重试!',
serverFailure: '连接到服务器失败,请联系管理员'
}
// 创建基础实例
const service = axios.create({ const service = axios.create({
baseURL: '', // url = base url + request url+
// timeout: 50000,
withCredentials: false // send cookies when cross-domain requests
// headers: {
// // clear cors
// 'Cache-Control': 'no-cache',
// Pragma: 'no-cache'
// }
baseURL: import.meta.env.VITE_APP_BASE_API,
timeout: 10000
}) })
const setErrorMsg = (error) => {
if (error && error.response) {
switch (error.response.status) {
case 400:
error.message = ERROR_MESSAGES.badRequest
break
case 401:
error.message = ERROR_MESSAGES.unauthorized
break
case 403:
error.message = ERROR_MESSAGES.forbidden
break
case 404:
error.message = ERROR_MESSAGES.notFound.replace(
'[具体 URL 将在这里被替换]',
error.response.config.url
)
break
case 405:
error.message = ERROR_MESSAGES.methodNotAllowed
break
case 408:
error.message = ERROR_MESSAGES.requestTimeout
break
case 500:
error.message = ERROR_MESSAGES.internalServerError
break
case 501:
error.message = ERROR_MESSAGES.notImplemented
break
case 502:
error.message = ERROR_MESSAGES.badGateway
break
case 503:
error.message = ERROR_MESSAGES.serviceUnavailable
break
case 504:
error.message = ERROR_MESSAGES.gatewayTimeout
break
case 505:
error.message = ERROR_MESSAGES.httpVersionNotSupported
break
default:
error.message = ERROR_MESSAGES.defaultConnectionError.replace(
'[原始错误消息]',
error.message
)
}
} else {
if (error.message === 'Network Error') {
error.message = ERROR_MESSAGES.networkError
} else {
error.message = ERROR_MESSAGES.serverFailure
}
// 请求拦截器(简化版)
service.interceptors.request.use(config => {
// 添加token逻辑(如果存在)
const token = localStorage.getItem('token')
if (token) {
config.headers['Authorization'] = 'Bearer ' + +SsksARQgUHIbIG3rRnnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w
} }
return error.message
}
// Request interceptors
service.interceptors.request.use(
(config) => {
// 在此处添加请求头等,如添加 token
// if (store.state.token) {
// config.headers['Authorization'] = `Bearer ${store.state.token}`
// }
return config return config
},
(error) => {
return Promise.reject(error)
}
)
})
// Response interceptors
// 响应拦截器(简化版)
service.interceptors.response.use( service.interceptors.response.use(
async (response) => {
// await new Promise(resovle => setTimeout(resovle, 3000));
// if (response.config.loadingInstance) {
// response.config.loadingInstance.close();
// }
const res = response.data
if (res.code !== 200) {
const errorMsg = res.msg || 'Unkonw error'
// ElMessage.error(errorMsg)
// return Promise.reject(new Error(res.msg || 'Error'))
return response.data
} else {
return response.data
}
},
(error) => {
const errorMessage = setErrorMsg(error)
ElMessage.error(errorMessage)
response => response.data,
error => {
ElMessage.error(error.message || '请求错误')
return Promise.reject(error) return Promise.reject(error)
} }
) )

396
src/views/zhongchou/index.vue

@ -27,16 +27,21 @@
<div class="progress-bar"> <div class="progress-bar">
<div class="progress-fill"></div> <div class="progress-fill"></div>
</div> </div>
<!-- 美股区域刻度 -->
<div class="time-markers"> <div class="time-markers">
<div class="marker" v-for="time in [0, 3, 6, 9, 12, 15]" :key="time">
<div class="marker marker-text" v-for="time in timeMarkers" :key="time" :class="{
'reached': (15 - usUsedTime) <= time,
'gold': (15 - usUsedTime) > time
}">
{{ time }} {{ time }}
</div> </div>
</div> </div>
</div> </div>
<!-- 美股剩余时间显示 -->
<div class="stock-info"> <div class="stock-info">
<h3>距美股实时数据</h3> <h3>距美股实时数据</h3>
<h3>还剩15分钟</h3>
<h3>还剩{{ numberToChinese(usDisplayTime) }}分钟</h3>
</div> </div>
</div> </div>
</div> </div>
@ -66,17 +71,22 @@
<div class="stock-content"> <div class="stock-content">
<div class="stock-card hk-card"> <div class="stock-card hk-card">
<div class="card-content hk-content"> <div class="card-content hk-content">
<!-- 港股剩余时间显示 -->
<div class="stock-info"> <div class="stock-info">
<h3>距港股实时数据</h3> <h3>距港股实时数据</h3>
<h3>还剩6分钟</h3>
<h3>还剩{{ numberToChinese(hkDisplayTime) }}分钟</h3>
</div> </div>
<div class="progress-section"> <div class="progress-section">
<div class="progress-bar"> <div class="progress-bar">
<div class="progress-fill"></div> <div class="progress-fill"></div>
</div> </div>
<!-- 港股区域刻度 -->
<div class="time-markers"> <div class="time-markers">
<div class="marker" v-for="time in [0, 3, 6, 9, 12, 15]" :key="time">
<div class="marker marker-text" v-for="time in timeMarkers" :key="time" :class="{
'reached': (15 - hkUsedTime) <= time,
'gold': (15 - hkUsedTime) > time
}">
{{ time }} {{ time }}
</div> </div>
</div> </div>
@ -116,14 +126,142 @@
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'
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)
}
} catch (error) {
console.error('请求错误:', error)
}
}
const numberToChinese = (num) => {
const chineseNumbers = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二', '十三', '十四', '十五']
return chineseNumbers[num] || num.toString()
}
//
const progressBarRef = ref(null)
const progressBarHeight = ref(0)
//
const updateProgressBarHeight = () => {
if (progressBarRef.value) {
progressBarHeight.value = progressBarRef.value.offsetHeight
}
}
// - 015
const timeMarkers = computed(() => {
return [0, 3, 6, 9, 12, 15]
})
// -
const getProgressHeight = (remainingMinutes, totalMinutes = 15) => {
//
// remainingMinutes = totalMinutes 0%
// remainingMinutes = 0 100%
const usedMinutes = totalMinutes - remainingMinutes
return Math.max((usedMinutes / totalMinutes) * 100, 0)
}
//
const showRules = ref(false)
//
const activeArea = ref(null) const activeArea = ref(null)
const usBoostStatus = ref(false) //
const hkBoostStatus = ref(false) //
const showRulesModal = ref(false) //
const usBoostStatus = ref(false)
const hkBoostStatus = ref(false)
const showRulesModal = ref(false)
// -
const usRemainingTime = ref(9) //
const hkRemainingTime = ref(6) //
const usTotalTime = ref(15) // 15
const hkTotalTime = ref(15) // 15
//
const usProgressHeight = computed(() => {
return getProgressHeight(usRemainingTime.value, usTotalTime.value)
})
const hkProgressHeight = computed(() => {
return getProgressHeight(hkRemainingTime.value, hkTotalTime.value)
})
//
const usDisplayTime = computed(() => {
return Math.max(0, usRemainingTime.value)
})
const hkDisplayTime = computed(() => {
return Math.max(0, hkRemainingTime.value)
})
// 使
const usUsedTime = computed(() => {
return usTotalTime.value - usRemainingTime.value
})
const hkUsedTime = computed(() => {
return hkTotalTime.value - hkRemainingTime.value
})
//
watch([usRemainingTime, hkRemainingTime], () => {
nextTick(() => {
updateProgressDisplay()
})
})
//
const updateProgressDisplay = () => {
//
const usFill = document.querySelector('.us-content .progress-fill')
if (usFill) {
usFill.style.height = `${usProgressHeight.value}%`
}
//
const hkFill = document.querySelector('.hk-content .progress-fill')
if (hkFill) {
hkFill.style.height = `${hkProgressHeight.value}%`
}
}
//
onMounted(() => {
nextTick(() => {
updateProgressBarHeight()
updateProgressDisplay()
//
window.addEventListener('resize', () => {
nextTick(() => {
updateProgressBarHeight()
})
})
})
})
//
const simulateTimeDecrease = (area) => {
if (area === 'us' && usRemainingTime.value > 0) {
usRemainingTime.value = Math.max(0, usRemainingTime.value - 1)
} else if (area === 'hk' && hkRemainingTime.value > 0) {
hkRemainingTime.value = Math.max(0, hkRemainingTime.value - 1)
}
}
const handleAreaClick = (area) => { const handleAreaClick = (area) => {
if (activeArea.value === area) { if (activeArea.value === area) {
@ -133,18 +271,51 @@ const handleAreaClick = (area) => {
} }
} }
const handleBoostClick = (area) => {
const handleBoostClick = async (area) => {
if (area === 'us' && !usBoostStatus.value) { if (area === 'us' && !usBoostStatus.value) {
try {
// API
const response = await addRecordAPI({
"activityId": 1,
"marketSign": "usa"
});
if (response.code === 200) {
usBoostStatus.value = true usBoostStatus.value = true
console.log('美股已助力');
// 1
simulateTimeDecrease('us')
console.log('美股助力成功:', response.message)
console.log('美股已助力,剩余时间:', usRemainingTime.value)
} else {
console.error('美股助力失败:', response.message)
}
} catch (error) {
console.error('美股助力请求失败:', error)
}
} else if (area === 'hk' && !hkBoostStatus.value) { } else if (area === 'hk' && !hkBoostStatus.value) {
try {
// API
const response = await addRecordAPI({
"activityId": 1,
"marketSign": "hk"
});
if (response.code === 200) {
hkBoostStatus.value = true hkBoostStatus.value = true
console.log('港股已助力');
// 1
simulateTimeDecrease('hk')
console.log('港股助力成功:', response.message)
console.log('港股已助力,剩余时间:', hkRemainingTime.value)
} else {
console.error('港股助力失败:', response.message)
}
} catch (error) {
console.error('港股助力请求失败:', error)
}
} }
//
} }
const showRules = () => {
const showRulesFunc = () => {
showRulesModal.value = true showRulesModal.value = true
} }
@ -152,7 +323,6 @@ const hideRules = () => {
showRulesModal.value = false showRulesModal.value = false
} }
</script> </script>
<style scoped> <style scoped>
/* 禁用页面滚动 */ /* 禁用页面滚动 */
:global(html, body) { :global(html, body) {
@ -290,7 +460,15 @@ const hideRules = () => {
transform-style: preserve-3d; transform-style: preserve-3d;
transform-origin: center center; transform-origin: center center;
} }
/* 为所有图片添加渲染优化 */
/* .stock-card img,
.rocket-body img,
.base-image img {
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
-webkit-backface-visibility: hidden;
transform: translateZ(0);
} */
/* 美股卡片默认位置 - 火箭左侧,向内倾斜 */ /* 美股卡片默认位置 - 火箭左侧,向内倾斜 */
.left-area { .left-area {
transform: translateX(-25vw) rotateY(25deg) scale(1.5); transform: translateX(-25vw) rotateY(25deg) scale(1.5);
@ -344,7 +522,10 @@ const hideRules = () => {
position: absolute; position: absolute;
z-index: 10; z-index: 10;
transform: translateZ(0); transform: translateZ(0);
transition: opacity 0.5s ease;
/* 新增位置调整 */
top: 80%; /* 垂直居中,可调整为具体像素值如 100px */
left: 50%; /* 水平居中,可调整为具体像素值如 200px */
transform: translate(-50%, -50%) translateZ(0); /* 居中偏移 */
} }
.rocket-area.hidden { .rocket-area.hidden {
@ -404,6 +585,7 @@ const hideRules = () => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
/* 从 flex-start 改为 center */
align-items: center; align-items: center;
min-width: 0; min-width: 0;
/* 允许flex项目收缩到内容以下 */ /* 允许flex项目收缩到内容以下 */
@ -414,7 +596,7 @@ const hideRules = () => {
/* 股票信息标题样式 */ /* 股票信息标题样式 */
.stock-info h3 { .stock-info h3 {
margin: 5px 0; margin: 5px 0;
font-size: 1rem;
font-size: 1.33rem;
line-height: 1.2; line-height: 1.2;
word-wrap: break-word; word-wrap: break-word;
/* 允许长单词换行 */ /* 允许长单词换行 */
@ -424,20 +606,77 @@ const hideRules = () => {
/* 自动断字 */ /* 自动断字 */
} }
/* 进度条区域 */
/* 通用进度条区域样式 */
.progress-section { .progress-section {
display: flex; display: flex;
align-items: flex-start;
align-items: center;
justify-content: center;
gap: 15px; gap: 15px;
} }
/* 美股内容布局 - 进度条在右边,刻度在左边 */
.us-content {
flex-direction: row;
}
.us-content .progress-section {
display: flex;
align-items: center;
justify-content: center;
gap: 15px;
flex-direction: row-reverse;
/* 刻度在左,进度条在右 */
}
/* 港股内容布局 - 进度条在左边,刻度在右边 */
.hk-content {
flex-direction: row;
}
.hk-content .progress-section {
display: flex;
align-items: center;
justify-content: center;
gap: 15px;
flex-direction: row;
/* 进度条在左,刻度在右 */
}
/* 默认进度条容器样式 */
.progress-bar { .progress-bar {
width: 20px; width: 20px;
height: 200px;
background: rgba(255, 255, 255, 0.2);
height: 350px;
border-radius: 10px; border-radius: 10px;
position: relative; position: relative;
overflow: hidden;
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)
);
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)
);
border: 1px solid rgba(255, 87, 34, 0.5);
box-shadow: 0 0 10px rgba(255, 87, 34, 0.3);
}
.time-markers {
display: flex;
flex-direction: column;
height: 350px;
justify-content: space-between;
align-items: center;
} }
/* 股票内容容器 */ /* 股票内容容器 */
@ -467,8 +706,8 @@ const hideRules = () => {
background-size: contain; background-size: contain;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
width: 200px;
height: 60px;
width: 240px;
height: 80px;
} }
/* 美股助力按钮 */ /* 美股助力按钮 */
@ -493,47 +732,114 @@ const hideRules = () => {
/* 底座样式 */ /* 底座样式 */
.base-image { .base-image {
margin-top: -10px;
margin-top: -65px;
z-index: 1; z-index: 1;
} }
.base-image img { .base-image img {
width: auto; width: auto;
height: 40px;
height: 130px;
display: block; display: block;
} }
/* 默认进度条填充样式 */
.progress-fill { .progress-fill {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
background: linear-gradient(to top, #00ff00, #ffaa00, #ff4444);
border-radius: 10px; border-radius: 10px;
transition: height 0.8s ease; 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: '';
position: absolute;
top: -25px;
/* 火箭位置在填充部分顶部上方 */
left: 50%;
transform: translateX(-50%);
width: 100px;
height: 100px;
background-image: url('@/assets/img/zhongchou/rocket.gif');
background-size: contain;
background-repeat: no-repeat;
background-position: center;
z-index: 10;
}
.us-card .progress-fill {
height: 20%;
.marker {
position: relative;
color: #FFD700;
/* 默认金色 */
font-size: 1.4rem;
font-weight: 700;
font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
text-shadow: 0 0 8px rgba(255, 215, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
transition: all 0.5s ease;
letter-spacing: 0.5px;
text-rendering: optimizeLegibility;
}
/* 为刻度数字添加连接线 */
.marker::before {
content: '';
position: absolute;
top: 50%;
width: 15px;
height: 1px;
background-color: currentColor;
opacity: 0.6;
transition: all 0.5s ease;
} }
.hk-card .progress-fill {
height: 60%;
/* 美股刻度连接线 - 从右侧连接到进度条 */
.us-content .marker::before {
right: -20px;
background-color: #00BFFF; /* 蓝色 */
box-shadow: 0 0 4px rgba(0, 191, 255, 0.5);
} }
.time-markers {
display: flex;
flex-direction: column-reverse;
height: 200px;
justify-content: space-between;
align-items: center;
/* 港股刻度连接线 - 从左侧连接到进度条 */
.hk-content .marker::before {
left: -20px;
background-color: #FF4444; /* 红色 */
box-shadow: 0 0 4px rgba(255, 68, 68, 0.5);
}
/* 美股激活刻度 */
.us-content .marker.reached {
color: #00BFFF !important;
text-shadow: 0 0 10px rgba(0, 191, 255, 0.8) !important;
} }
.marker {
color: #fff;
font-size: 0.9rem;
text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
/* 港股激活刻度 */
.hk-content .marker.reached {
color: #FF4444 !important;
text-shadow: 0 0 10px rgba(255, 68, 68, 0.8) !important;
} }
/* 刻度字体增强样式 */
/* .marker-text {
font-weight: bold;
font-family: 'Arial Black', sans-serif;
color: transparent;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
-webkit-background-clip: text;
background-clip: text;
-webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.6);
text-stroke: 1.5px rgba(255, 255, 255, 0.6);
text-shadow: 0 0 10px rgba(255, 255, 255, 0.3), 0 0 20px rgba(255, 255, 255, 0.2);
filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
isolation: isolate;
z-index: 17;
position: relative;
} */
.us-btn { .us-btn {
background: linear-gradient(45deg, #0066cc, #0099ff); background: linear-gradient(45deg, #0066cc, #0099ff);
color: white; color: white;
@ -580,10 +886,10 @@ const hideRules = () => {
} }
.rocket-body img { .rocket-body img {
width: 12vw;
width: 15vw;
height: auto; height: auto;
min-width: 80px;
max-width: 200px;
min-width: 100px;
max-width: 250px;
} }
/* 动画效果 */ /* 动画效果 */

13
vite.config.js

@ -9,5 +9,16 @@ export default defineConfig({
alias: { alias: {
'@': path.resolve(process.cwd(), 'src') '@': path.resolve(process.cwd(), 'src')
} }
}
},
server: {
proxy: {
'/Api': {
target: 'https://dbqb.nfdxy.net/devLotApi', // 后端基础地址
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), // 移除 /api 前缀
// 或者更精确的重写(根据后端路径调整):
// rewrite: (path) => path.replace(/^\/api\/admin/, '/admin'),
},
},
},
}) })
Loading…
Cancel
Save