更新
This commit is contained in:
+40
-3
@@ -1,5 +1,8 @@
|
||||
<script setup>
|
||||
|
||||
// 2. 获取组件实例,通过 proxy 访问全局属性
|
||||
import { ref} from "vue";
|
||||
import * as GenerateTestUserSig from "@/debug/GenerateTestUserSig-es.js";
|
||||
import { CallManager } from "@/TUICallKit/src/TUICallService/serve/callManager";
|
||||
import { onLaunch, onShow, onHide, onError } from '@dcloudio/uni-app'
|
||||
import { getCurrentInstance } from 'vue'
|
||||
// 2. 获取组件实例,通过 proxy 访问全局属性
|
||||
@@ -9,8 +12,10 @@ const globalData = {
|
||||
userID: '',
|
||||
userSig: ''
|
||||
};
|
||||
let avatarUrl = ref(""); // 声明为响应式变量
|
||||
uni.CallManager = new CallManager();
|
||||
onLaunch(() => {
|
||||
console.log('---------进入onMounted')
|
||||
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: function (loginRes) {
|
||||
@@ -39,7 +44,10 @@ const wxcode = async (code) => {
|
||||
},
|
||||
}, false) // 不显示加载中
|
||||
uni.setStorageSync('token', res.data.token)
|
||||
uni.setStorageSync('userData', res.data)
|
||||
uni.setStorageSync('userData', res.data)
|
||||
if(res.code==1){
|
||||
video(res.data)
|
||||
}
|
||||
console.log('请求结果:', res.data)
|
||||
} catch (err) {
|
||||
|
||||
@@ -59,6 +67,9 @@ const userinfo = async (code) => {
|
||||
|
||||
wxcode(code)
|
||||
}
|
||||
if(res.code==1){
|
||||
video(res.data)
|
||||
}
|
||||
uni.setStorageSync('userData', res.data)
|
||||
} catch (err) {
|
||||
|
||||
@@ -66,4 +77,30 @@ const userinfo = async (code) => {
|
||||
}
|
||||
|
||||
}
|
||||
const video =async (data)=>{
|
||||
const res = await proxy.apiUrl({
|
||||
url: '/api/tcm/getPatientSignature',
|
||||
method: 'GET',
|
||||
data: {
|
||||
patient_id: data.diagnosis.patient_id
|
||||
},
|
||||
}, false)
|
||||
|
||||
const {userId } = res.data;
|
||||
|
||||
const { userSig, SDKAppID } = GenerateTestUserSig.genTestUserSig({
|
||||
userID:userId,
|
||||
});
|
||||
console.log('获取签名成功:',userSig);
|
||||
getApp().globalData.userID = userId.value;
|
||||
getApp().globalData.userSig = userSig;
|
||||
getApp().globalData.SDKAppID = SDKAppID;
|
||||
|
||||
await uni.CallManager.init({
|
||||
sdkAppID: SDKAppID, // 替换为用户自己的 sdkAppID
|
||||
userID: userId, // 替换为用户自己的 userID
|
||||
userSig: userSig, // 替换为用户自己的 userSig
|
||||
globalCallPagePath: "TUICallKit/src/Components/TUICallKit", // 替换为步骤一里注册的全局监听页面
|
||||
});
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user