This commit is contained in:
parent
5ca4929a45
commit
cc16814256
|
|
@ -17,3 +17,7 @@ export const GetRoomRtcToken = (roomNum: string) => Request({
|
||||||
url: `/room/tk/rtc?roomNum=${roomNum}`,
|
url: `/room/tk/rtc?roomNum=${roomNum}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
|
export const GetOpenId = (code: string) => Request({
|
||||||
|
url: `/pub/mini-openid?js_code=${code}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { GetCheckoutRoomNum, PostAnonLogin, GetAgoraConf, GetRoomRtcToken } from '../../api/form/index'
|
import { GetCheckoutRoomNum, PostAnonLogin, GetAgoraConf, GetRoomRtcToken, GetOpenId } from '../../api/form/index'
|
||||||
import { getUUID } from '../../utils/utils'
|
import { getUUID } from '../../utils/utils'
|
||||||
import { Message } from 'tdesign-miniprogram';
|
import { Message } from 'tdesign-miniprogram';
|
||||||
import { startSignalr, onStop } from '../../utils/singlr';
|
import { startSignalr, onStop } from '../../utils/singlr';
|
||||||
|
|
@ -15,14 +15,6 @@ Page({
|
||||||
historicalList: [],
|
historicalList: [],
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
// wx.login({
|
|
||||||
// //成功放回
|
|
||||||
// success: (res) => {
|
|
||||||
// const { code } = res
|
|
||||||
// // appid=wx99885b1c181cda72&secret=edd9cdb04c3f59fe70f2a70c396e5b0d
|
|
||||||
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
const that = this;
|
const that = this;
|
||||||
wx.getStorage({
|
wx.getStorage({
|
||||||
key: 'isConnected',
|
key: 'isConnected',
|
||||||
|
|
@ -150,18 +142,12 @@ Page({
|
||||||
GetCheckoutRoomNum(this.data.meetingForm.roomNum).then(res => {
|
GetCheckoutRoomNum(this.data.meetingForm.roomNum).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
wx.getStorage({
|
wx.login({
|
||||||
key: "deviceId",
|
success: (res) => {
|
||||||
success(res: any) {
|
const { code } = res
|
||||||
navigateToMeeting(res.data)
|
GetOpenId(code).then(res => {
|
||||||
},
|
navigateToMeeting(res.data)
|
||||||
fail() {
|
|
||||||
const uuid = getUUID()
|
|
||||||
wx.setStorage({
|
|
||||||
key: "deviceId",
|
|
||||||
data: uuid
|
|
||||||
})
|
})
|
||||||
navigateToMeeting(uuid)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,6 @@ export const role = {
|
||||||
ID: ['1', '3']
|
ID: ['1', '3']
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getUUID = (): string => {
|
|
||||||
var s = [] as any;
|
|
||||||
var hexDigits = "0123456789abcdef";
|
|
||||||
for (var i = 0; i < 36; i++) {
|
|
||||||
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
||||||
}
|
|
||||||
s[14] = "4";
|
|
||||||
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
|
|
||||||
s[8] = s[13] = s[18] = s[23] = "-";
|
|
||||||
return s.join("")
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getStorage = async (key: string): Promise<void> => {
|
export const getStorage = async (key: string): Promise<void> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wx.getStorage({
|
wx.getStorage({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue