新增功能

This commit is contained in:
Your Name
2026-03-04 15:32:30 +08:00
parent a07e844c47
commit ab77f5488d
2266 changed files with 177942 additions and 3444 deletions
+198
View File
@@ -0,0 +1,198 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const TUICallKit_src_TUICallService_index = require("../src/TUICallService/index.js");
const TUICallKit_src_TUICallService_CallService_index = require("../src/TUICallService/CallService/index.js");
const TUICallKit_src_TUICallService_const_index = require("../src/TUICallService/const/index.js");
const TUICallKit_src_TUICallService_const_call = require("../src/TUICallService/const/call.js");
if (!Math) {
common_vendor.unref(TUICallKit)();
}
const TUICallKit = () => "../src/Components/TUICallKit.js";
const _sfc_main = {
__name: "call",
setup(__props) {
let patientId = common_vendor.ref("2");
let currentUserId = common_vendor.ref("");
let isLogin = common_vendor.ref(false);
let loading = common_vendor.ref(false);
const callStatus = common_vendor.computed(() => {
const status = TUICallKit_src_TUICallService_CallService_index.TUIStore.getData(TUICallKit_src_TUICallService_const_call.StoreName.CALL, TUICallKit_src_TUICallService_const_index.NAME.CALL_STATUS);
return status || "IDLE";
});
common_vendor.onMounted(() => {
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:52", "=== 页面已挂载 ===");
try {
TUICallKit_src_TUICallService_index.TUICallKitAPI.setLogLevel(1);
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:57", "=== 已设置详细日志级别 ===");
} catch (error) {
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:59", "设置日志级别失败:", error);
}
TUICallKit_src_TUICallService_CallService_index.TUIStore.watch(TUICallKit_src_TUICallService_const_call.StoreName.CALL, {
[TUICallKit_src_TUICallService_const_index.NAME.CALL_STATUS]: (newStatus) => {
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:64", "=== 通话状态变化 ===", newStatus);
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:65", "可能的状态值: idle, calling, connected");
},
[TUICallKit_src_TUICallService_const_index.NAME.IS_GROUP]: (isGroup) => {
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:68", "=== 是否群组通话 ===", isGroup);
},
[TUICallKit_src_TUICallService_const_index.NAME.CALL_ROLE]: (role) => {
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:71", "=== 通话角色 ===", role);
},
[TUICallKit_src_TUICallService_const_index.NAME.CALL_MEDIA_TYPE]: (type) => {
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:74", "=== 通话类型 ===", type);
}
});
});
common_vendor.onUnmounted(() => {
TUICallKit_src_TUICallService_CallService_index.TUIStore.unwatch(TUICallKit_src_TUICallService_const_call.StoreName.CALL, {
[TUICallKit_src_TUICallService_const_index.NAME.CALL_STATUS]: () => {
},
[TUICallKit_src_TUICallService_const_index.NAME.IS_GROUP]: () => {
},
[TUICallKit_src_TUICallService_const_index.NAME.CALL_ROLE]: () => {
},
[TUICallKit_src_TUICallService_const_index.NAME.CALL_MEDIA_TYPE]: () => {
}
});
});
const getSignatureFromServer = async (patientId2) => {
return new Promise((resolve, reject) => {
common_vendor.index.request({
url: "https://api.zzzhengyangtang.cn/api/tcm/getPatientSignature",
// 后端接口地址 // 替换为你的后端地址
method: "GET",
data: {
patient_id: patientId2
},
success: (res) => {
if (res.data && res.data.code === 1) {
resolve(res.data.data);
} else {
reject(new Error(res.data.msg || "获取签名失败"));
}
},
fail: (err) => {
reject(err);
}
});
});
};
const loginHandler = async () => {
if (!patientId.value) {
common_vendor.index.showToast({
title: "请输入患者ID",
icon: "none"
});
return;
}
try {
loading.value = true;
common_vendor.index.showLoading({
title: "正在获取签名..."
});
const signatureData = await getSignatureFromServer(patientId.value);
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:130", "获取签名成功:", signatureData);
const { sdkAppId, userId, userSig } = signatureData;
currentUserId.value = userId;
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:135", "=== 小程序端登录信息 ===");
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:136", "sdkAppId:", sdkAppId);
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:137", "userId:", userId);
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:138", "userSig 长度:", userSig == null ? void 0 : userSig.length);
common_vendor.index.showLoading({
title: "正在初始化..."
});
await TUICallKit_src_TUICallService_index.TUICallKitAPI.init({
sdkAppID: Number(sdkAppId),
// 确保是数字类型
userID: userId,
// 应该是 patient_2 格式
userSig
});
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:151", "TUICallKit 初始化成功, userId:", userId);
await new Promise((resolve) => setTimeout(resolve, 1e3));
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:158", "=== TUICallKit 初始化完成,等待来电 ===");
isLogin.value = true;
await common_vendor.nextTick$1();
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:165", "=== TUICallKit 组件已挂载 ===");
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:166", "当前通话状态:", callStatus.value);
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:167", "完整状态信息:", {
callStatus: TUICallKit_src_TUICallService_CallService_index.TUIStore.getData(TUICallKit_src_TUICallService_const_call.StoreName.CALL, TUICallKit_src_TUICallService_const_index.NAME.CALL_STATUS),
isGroup: TUICallKit_src_TUICallService_CallService_index.TUIStore.getData(TUICallKit_src_TUICallService_const_call.StoreName.CALL, TUICallKit_src_TUICallService_const_index.NAME.IS_GROUP),
callRole: TUICallKit_src_TUICallService_CallService_index.TUIStore.getData(TUICallKit_src_TUICallService_const_call.StoreName.CALL, TUICallKit_src_TUICallService_const_index.NAME.CALL_ROLE),
callMediaType: TUICallKit_src_TUICallService_CallService_index.TUIStore.getData(TUICallKit_src_TUICallService_const_call.StoreName.CALL, TUICallKit_src_TUICallService_const_index.NAME.CALL_MEDIA_TYPE),
localUserInfo: TUICallKit_src_TUICallService_CallService_index.TUIStore.getData(TUICallKit_src_TUICallService_const_call.StoreName.CALL, TUICallKit_src_TUICallService_const_index.NAME.LOCAL_USER_INFO)
});
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: "登录成功",
icon: "success"
});
patientId.value = "";
} catch (error) {
common_vendor.index.__f__("error", "at TUICallKit/pages/call.vue:185", "登录失败:", error);
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: "登录失败: " + (error.message || "未知错误"),
icon: "none",
duration: 3e3
});
} finally {
loading.value = false;
}
};
const callHandler = async () => {
if (!patientId.value) {
common_vendor.index.showToast({
title: "请输入要呼叫的用户ID",
icon: "none"
});
return;
}
try {
loading.value = true;
let targetUserId = patientId.value;
if (/^\d+$/.test(patientId.value)) {
targetUserId = `doctor_${patientId.value}`;
}
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:218", "准备呼叫用户:", targetUserId);
await TUICallKit_src_TUICallService_index.TUICallKitAPI.calls({
userIDList: [targetUserId],
type: 2
// 2 表示视频通话
});
common_vendor.index.__f__("log", "at TUICallKit/pages/call.vue:226", "发起通话成功, 目标用户:", targetUserId);
common_vendor.index.showToast({
title: "正在呼叫...",
icon: "none"
});
} catch (error) {
common_vendor.index.__f__("error", "at TUICallKit/pages/call.vue:234", "发起通话失败:", error);
common_vendor.index.showToast({
title: "发起通话失败: " + (error.message || "未知错误"),
icon: "none",
duration: 3e3
});
} finally {
loading.value = false;
}
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.unref(isLogin)
}, common_vendor.unref(isLogin) ? {} : {}, {
b: !common_vendor.unref(isLogin) ? "请输入患者ID(数字)" : "输入医生ID或完整userId(如:doctor_1",
c: common_vendor.unref(patientId),
d: common_vendor.o(($event) => common_vendor.isRef(patientId) ? patientId.value = $event.detail.value : patientId = $event.detail.value),
e: common_vendor.t(common_vendor.unref(loading) ? "加载中..." : !common_vendor.unref(isLogin) ? "登录" : "呼叫"),
f: common_vendor.o(($event) => !common_vendor.unref(isLogin) ? loginHandler() : callHandler()),
g: common_vendor.unref(loading),
h: common_vendor.unref(isLogin)
}, common_vendor.unref(isLogin) ? {
i: common_vendor.t(common_vendor.unref(currentUserId)),
j: common_vendor.t(callStatus.value)
} : {});
};
}
};
wx.createPage(_sfc_main);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/TUICallKit/pages/call.js.map
@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "uni-app",
"usingComponents": {
"t-u-i-call-kit": "../src/Components/TUICallKit"
}
}
@@ -0,0 +1 @@
<view class="page-container"><view wx:if="{{a}}" class="call-kit-wrapper"><t-u-i-call-kit u-i="0b995cea-0" bind:__l="__l"></t-u-i-call-kit></view><view class="loginBox"><input class="input-box" placeholder="{{b}}" placeholder-style="color:#BBBBBB;" value="{{c}}" bindinput="{{d}}"/><view class="login"><button class="loginBtn" bindtap="{{f}}" disabled="{{g}}">{{e}}</button></view><view wx:if="{{h}}" class="status-info"><text>当前登录: {{i}}</text><text>通话状态: {{j}}</text><text class="tip">提示:呼叫医生请输入医生ID(如:1)或完整ID(如:doctor_1</text></view></view></view>
@@ -0,0 +1,61 @@
.page-container {
width: 100vw;
height: 100vh;
position: relative;
}
.call-kit-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 9999;
}
.loginBox {
margin-top: 200px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
z-index: 1;
}
input {
display: flex;
font-size: 20px;
}
.login {
width: 100vw;
bottom: 5vh;
margin: 70rpx;
}
.login button {
width: 80%;
background-color: #006eff;
border-radius: 50px;
color: white;
}
.login button:disabled {
background-color: #cccccc;
}
.status-info {
margin-top: 20px;
padding: 10px;
background-color: #f0f0f0;
border-radius: 5px;
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
}
.status-info text {
font-size: 14px;
color: #666;
}
.status-info .tip {
font-size: 12px;
color: #999;
text-align: center;
line-height: 1.5;
}