1. 开方线上功能基本完成

2. 修复了一些抽屉组件的滑动失效问题
This commit is contained in:
李琦
2026-05-14 14:29:51 +08:00
parent e9966af14d
commit eacca1bf7b
40 changed files with 6176 additions and 5335 deletions

34
config/app-env.js Normal file
View File

@@ -0,0 +1,34 @@
/**
* 医生小程序环境唯一开关:旧 HTTP、newApi、WebSocket 均由此派生。
* 发布生产前将 USE_DOCTOR_WX_DEV 改为 false。
*/
// const USE_DOCTOR_WX_DEV = true;
const USE_DOCTOR_WX_DEV = false;
const DEV = {
legacyApiBase: 'http://127.0.0.1:18000/service/v1/',
newApiBase: 'http://127.0.0.1:18001/api/doctor/',
wsUrl: 'ws://127.0.0.1:12080/ws',
};
const PROD = {
legacyApiBase: 'https://app.xiaokang88.com/service/v1/',
newApiBase: 'https://api.xiaokang88.com/api/doctor/',
wsUrl: 'wss://api.ws.g.xiaokang88.com/ws',
};
export function isDoctorWxDev() {
return USE_DOCTOR_WX_DEV;
}
export function getDoctorWxEnv() {
return USE_DOCTOR_WX_DEV ? DEV : PROD;
}
/** 开发 / 生产 WebSocket 地址(与 getDoctorWxEnv 同源,供 websocket 配置展示) */
export function getDoctorWxWsUrls() {
return {
dev: DEV.wsUrl,
prod: PROD.wsUrl,
};
}

View File

@@ -1,11 +1,11 @@
/**
* WebSocket配置文件
* 统一管理WebSocket相关配置
* 统一管理WebSocket相关配置(环境与 config/app-env.js 一致)
*/
// 检查是否为开发环境
// 在uni-app中可以通过条件编译或manifest.json判断
const isDev = true; // TODO: 根据实际环境配置
import { getDoctorWxWsUrls, isDoctorWxDev } from './app-env.js';
const wsUrls = getDoctorWxWsUrls();
/**
* WebSocket配置
@@ -16,19 +16,37 @@ export const websocketConfig = {
* dev: 开发环境WebSocket地址
* prod: 生产环境WebSocket地址
*/
url: {
dev: 'ws://127.0.0.1:12080/ws',
prod: 'wss://api.ws.g.xiaokang88.com/ws'
},
url: wsUrls,
/**
* 获取当前环境的WebSocket URL
* @returns {string} WebSocket URL
*/
getUrl() {
return isDev ? this.url.dev : this.url.prod;
return isDoctorWxDev() ? wsUrls.dev : wsUrls.prod;
},
/**
* 由 WebSocket URL 推导 IM 服务 HTTP 基址(与 WS 同 host用于 Go API
* 例ws://127.0.0.1:12080/ws -> http://127.0.0.1:12080
*/
getHttpBaseUrl() {
const ws = this.getUrl();
if (!ws || typeof ws !== 'string') return '';
let base = ws
.replace(/^wss:\/\//i, 'https://')
.replace(/^ws:\/\//i, 'http://');
base = base.replace(/\/?ws\/?$/i, '');
return base.replace(/\/+$/, '') || base;
},
/** Go IMPOST /api/send-to-user */
getSendToUserApiUrl() {
const base = this.getHttpBaseUrl();
if (!base) return '';
return `${base}/api/send-to-user`;
},
/**
* 重连配置
*/
@@ -37,14 +55,14 @@ export const websocketConfig = {
initialDelay: 1000, // 初始重连延迟(毫秒)
maxDelay: 30000 // 最大重连延迟(毫秒)
},
/**
* 心跳配置
*/
heartbeat: {
interval: 300000 // 心跳间隔毫秒5分钟
},
/**
* 用户标识配置
*/