feat: 添加获取ticket按钮

This commit is contained in:
fanpeng 2025-06-16 16:23:42 +08:00
parent da39128b21
commit d7c5ad4102

View File

@ -42,6 +42,12 @@
<view v-if="requestFinish" class="mt-4 text-center text-base font-bold text-[#999]">
微信会收到视频通话请求
</view>
<view
class="fixed bottom-120rpx w-400rpx h-88rpx rounded-md leading-88rpx left-1/2 -translate-x-1/2 bg-[#63b8af] text-center text-base font-bold text-[#ffffff]"
@click="getTicket"
>
获取ticket
</view>
</view>
</template>
@ -100,6 +106,41 @@
}
})
const getTicket = async () => {
uni.showLoading({
title: '加载中...'
})
const result = await getInfo()
uni.hideLoading()
if (result.code === 0) {
const ticket = result.data.WXIoTDeviceInfo.SNTicket
uni.showModal({
title: '票据',
content: ticket,
showCancel: false,
confirmText: '复制',
success: ({ confirm }) => {
if (confirm) {
uni.setClipboardData({
data: ticket,
success: () => {
uni.showToast({
title: '复制成功',
icon: 'none'
})
}
})
}
}
})
} else {
uni.showToast({
title: result.message,
icon: 'none'
})
}
}
const getDeviceVoIPList = async () => {
return new Promise(resolve => {
wx.getDeviceVoIPList({