update pay ui
This commit is contained in:
@@ -63,7 +63,7 @@ if (typeof document !== 'undefined') {
|
||||
*/
|
||||
const fetchIndexKline = async (indexCode) => {
|
||||
try {
|
||||
const response = await fetch(`/api/index/${indexCode}/kline?type=daily`);
|
||||
const response = await fetch(`${getApiBase()}/api/index/${indexCode}/kline?type=daily`);
|
||||
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
||||
const data = await response.json();
|
||||
return data;
|
||||
|
||||
@@ -37,6 +37,7 @@ import ReactECharts from 'echarts-for-react';
|
||||
import { eventService } from '../../../services/eventService';
|
||||
import CitedContent from '../../../components/Citation/CitedContent';
|
||||
import { logger } from '../../../utils/logger';
|
||||
import { getApiBase } from '../../../utils/apiConfig';
|
||||
import { PROFESSIONAL_COLORS } from '../../../constants/professionalTheme';
|
||||
|
||||
// 节点样式配置 - 完全复刻Flask版本
|
||||
@@ -522,7 +523,7 @@ const TransmissionChainAnalysis = ({ eventId }) => {
|
||||
// 获取节点详情 - 完全复刻Flask版本API调用
|
||||
async function getChainNodeDetail(nodeId) {
|
||||
try {
|
||||
const response = await fetch(`/api/events/${eventId}/chain-node/${nodeId}`);
|
||||
const response = await fetch(`${getApiBase()}/api/events/${eventId}/chain-node/${nodeId}`);
|
||||
const result = await response.json();
|
||||
if (result.success) {
|
||||
return result.data;
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
*/
|
||||
|
||||
import type { Exchange } from '../types';
|
||||
import { getApiBase } from '@utils/apiConfig';
|
||||
|
||||
/**
|
||||
* 获取 WebSocket 配置
|
||||
* - 生产环境 (HTTPS): 通过 Nginx 代理使用 wss://
|
||||
* - 生产环境 (HTTPS): 通过 API 服务器 Nginx 代理使用 wss://
|
||||
* - 开发环境 (HTTP): 直连 ws://
|
||||
*/
|
||||
const getWsConfig = (): Record<Exchange, string> => {
|
||||
@@ -19,13 +20,15 @@ const getWsConfig = (): Record<Exchange, string> => {
|
||||
}
|
||||
|
||||
const isHttps = window.location.protocol === 'https:';
|
||||
const host = window.location.host;
|
||||
|
||||
if (isHttps) {
|
||||
// 生产环境:通过 Nginx 代理
|
||||
// 生产环境:通过 API 服务器的 Nginx 代理
|
||||
// CDN 不支持 WebSocket,需要连接到 api.valuefrontier.cn
|
||||
const apiBase = getApiBase();
|
||||
const apiHost = apiBase.replace(/^https?:\/\//, '');
|
||||
return {
|
||||
SSE: `wss://${host}/ws/sse`, // 上交所 - Nginx 代理
|
||||
SZSE: `wss://${host}/ws/szse`, // 深交所 - Nginx 代理
|
||||
SSE: `wss://${apiHost}/ws/sse`, // 上交所 - 通过 API 服务器代理
|
||||
SZSE: `wss://${apiHost}/ws/szse`, // 深交所 - 通过 API 服务器代理
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { logger } from '@utils/logger';
|
||||
import { getApiBase } from '@utils/apiConfig';
|
||||
import { WS_CONFIG, HEARTBEAT_INTERVAL, RECONNECT_INTERVAL } from './constants';
|
||||
import { getExchange, normalizeCode, calcChangePct } from './utils';
|
||||
import type {
|
||||
@@ -337,7 +338,7 @@ const fetchInitialQuotes = async (
|
||||
if (codes.length === 0) return {};
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/flex-screen/quotes', {
|
||||
const response = await fetch(`${getApiBase()}/api/flex-screen/quotes`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ codes, include_order_book: includeOrderBook }),
|
||||
|
||||
@@ -62,6 +62,7 @@ import { useRealtimeQuote } from './hooks';
|
||||
import { getFullCode } from './hooks/utils';
|
||||
import QuoteTile from './components/QuoteTile';
|
||||
import { logger } from '@utils/logger';
|
||||
import { getApiBase } from '@utils/apiConfig';
|
||||
import type { WatchlistItem, ConnectionStatus } from './types';
|
||||
|
||||
// 本地存储 key
|
||||
@@ -179,7 +180,7 @@ const FlexScreen: React.FC = () => {
|
||||
|
||||
setIsSearching(true);
|
||||
try {
|
||||
const response = await fetch(`/api/stocks/search?q=${encodeURIComponent(query)}&limit=10`);
|
||||
const response = await fetch(`${getApiBase()}/api/stocks/search?q=${encodeURIComponent(query)}&limit=10`);
|
||||
const data: SearchApiResponse = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
|
||||
@@ -46,6 +46,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import axios from 'axios';
|
||||
import { getApiBase } from '@utils/apiConfig';
|
||||
import { colors, glassEffect } from '../../../theme/glassTheme';
|
||||
import {
|
||||
ALERT_TYPE_CONFIG,
|
||||
@@ -408,7 +409,7 @@ const AlertDetailDrawer = ({ isOpen, onClose, alertData }) => {
|
||||
setLoadingConcepts(prev => ({ ...prev, [conceptId]: true }));
|
||||
|
||||
try {
|
||||
const response = await axios.get(`/api/concept/${encodeURIComponent(conceptId)}/stocks`);
|
||||
const response = await axios.get(`${getApiBase()}/api/concept/${encodeURIComponent(conceptId)}/stocks`);
|
||||
if (response.data?.success && response.data?.data?.stocks) {
|
||||
setConceptStocks(prev => ({
|
||||
...prev,
|
||||
|
||||
@@ -46,6 +46,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import axios from 'axios';
|
||||
import { getApiBase } from '@utils/apiConfig';
|
||||
import {
|
||||
ALERT_TYPE_CONFIG,
|
||||
METRIC_CONFIG,
|
||||
@@ -692,7 +693,7 @@ const ConceptAlertList = ({
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await axios.get(`/api/concept/${encodeURIComponent(conceptId)}/stocks`);
|
||||
const response = await axios.get(`${getApiBase()}/api/concept/${encodeURIComponent(conceptId)}/stocks`);
|
||||
if (response.data?.success && response.data?.data?.stocks) {
|
||||
setConceptStocks(prev => ({
|
||||
...prev,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
import { useState, useEffect, useCallback, useRef } from 'react';
|
||||
import { logger } from '@utils/logger';
|
||||
import { getApiBase } from '@utils/apiConfig';
|
||||
|
||||
/**
|
||||
* @param {Date|null} selectedDate - 选中的交易日期
|
||||
@@ -40,7 +41,7 @@ export const useHotspotData = (selectedDate) => {
|
||||
const dateParam = selectedDate
|
||||
? `?date=${dateStr}`
|
||||
: '';
|
||||
const response = await fetch(`/api/market/hotspot-overview${dateParam}`);
|
||||
const response = await fetch(`${getApiBase()}/api/market/hotspot-overview${dateParam}`);
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { getApiBase } from '@utils/apiConfig';
|
||||
import {
|
||||
Box,
|
||||
Container,
|
||||
@@ -146,7 +147,7 @@ const StockOverview = () => {
|
||||
setIsSearching(true);
|
||||
try {
|
||||
logger.debug('StockOverview', '开始搜索股票', { query });
|
||||
const response = await fetch(`/api/stocks/search?q=${encodeURIComponent(query)}&limit=10`);
|
||||
const response = await fetch(`${getApiBase()}/api/stocks/search?q=${encodeURIComponent(query)}&limit=10`);
|
||||
const data = await response.json();
|
||||
logger.debug('StockOverview', 'API返回数据', {
|
||||
status: response.status,
|
||||
|
||||
Reference in New Issue
Block a user