diff --git a/pages/home/home.vue b/pages/home/home.vue index 6c3f9ea..9413851 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -249,6 +249,7 @@ import { } from '../../request/api/api' import { getPlatformQualificationsApi } from '../../request/api/platform' import { getStoreDrugListBySalespersonApi, getHomeTopProductsApi, getHomeZonesApi } from "@/request/api/product"; +import request from "@/request/api/request"; export default { data() { @@ -271,7 +272,8 @@ export default { list: [], info: [], bgShow: false, - isShow_envVersion: true + isShow_envVersion: true, + defaultDoctorId: '39' // 默认医生ID,从API获取 } }, onLoad() { @@ -319,7 +321,7 @@ export default { golist(type) { if (type === 3) { return uni.navigateTo({ - url: '/subPackages/product/product?doctor_id=' + 39 + '®ister_type=3' + url: '/subPackages/product/product?doctor_id=' + this.defaultDoctorId + '®ister_type=3' }) } uni.navigateTo({ @@ -583,7 +585,7 @@ export default { // 直接购买 buyProduct(item) { uni.navigateTo({ - url: `/subPackages/product/product?doctor_id=39®ister_type=3` + url: `/subPackages/product/product?doctor_id=${this.defaultDoctorId}®ister_type=3` }); }, // 预览资质证明 @@ -600,6 +602,20 @@ export default { uni.navigateTo({ url: '/pages/index/platform-info' }); + }, + // 获取默认医生ID + async getDefaultDoctorId() { + try { + const res = await request('/xkApi/online-consultation/get-default-doctor-id', { + method: 'GET' + }, 0); + if (res.data && res.data.result && res.data.result.doctor_id) { + this.defaultDoctorId = res.data.result.doctor_id; + } + } catch (error) { + console.error('获取默认医生ID失败:', error); + // 如果接口失败,保持默认值39 + } } }, mounted() { @@ -623,6 +639,7 @@ export default { this.getHomeTopProducts(); // 获取首页热销商品 this.getPlatformQualifications(); // 获取平台资质证明 this.getHomeZones(); // 获取首页专区入口 + this.getDefaultDoctorId(); // 获取默认医生ID }, } diff --git a/request/api/request.js b/request/api/request.js index 498876e..b82782e 100644 --- a/request/api/request.js +++ b/request/api/request.js @@ -27,8 +27,8 @@ function request(url, params, method = 0) { if (url.split('/').indexOf('imApi') !== -1) { // baseURL = "http://127.0.0.1:12080/api" // baseURL = isDev === true? 'http://127.0.0.1:12080/api': "http://im.xiaokang88.com/api" - // baseURL = isDev === true? 'http://127.0.0.1:12080/api': "https://api.ws.g.xiaokang88.com/api" - baseURL = "https://api.ws.g.xiaokang88.com/api" + baseURL = isDev === true? 'http://127.0.0.1:12080/api': "https://api.ws.g.xiaokang88.com/api" + // baseURL = "https://api.ws.g.xiaokang88.com/api" } if (url.split('/').indexOf('newApi') !== -1) { baseURL = isDev === true? 'http://127.0.0.1:18018/member': "https://shop.xiaokang88.com/member" diff --git a/utils/ws/websocket.js b/utils/ws/websocket.js index 1196cd4..bd838a6 100644 --- a/utils/ws/websocket.js +++ b/utils/ws/websocket.js @@ -204,5 +204,5 @@ export class WebSocketManager { } // 全局WebSocket实例 -// export const webSocketManager = new WebSocketManager('ws://127.0.0.1:12080/ws'); -export const webSocketManager = new WebSocketManager('wss://api.ws.g.xiaokang88.com/ws'); \ No newline at end of file +export const webSocketManager = new WebSocketManager('ws://127.0.0.1:12080/ws'); +// export const webSocketManager = new WebSocketManager('wss://api.ws.g.xiaokang88.com/ws'); \ No newline at end of file