demo3.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view style="height: 50px"></view>
  3. <view>
  4. <button @click="openUrl">进入房间</button>
  5. <button @click="openUrl2">进入房间2</button>
  6. <button @click="handleCreate">创建房间</button>
  7. <button @click="handleClose">关闭房间</button>
  8. <view>
  9. 房间信息 {{}}
  10. </view>
  11. </view>
  12. </template>
  13. <script setup>
  14. import * as httpApi from '@/api/mianshi.js'
  15. import { ref, reactive } from "vue"
  16. const data = reactive({
  17. room: '',
  18. })
  19. function handleCreate() {
  20. httpApi.getMianshiCreate().then(res =>{
  21. this.data = res.data.room;
  22. uni.showToast({
  23. title:'创建成功'
  24. })
  25. })
  26. }
  27. function handleClose() {
  28. httpApi.getMianshiClose().then(res =>{
  29. if (res.data) {
  30. data.room = null
  31. uni.showToast({
  32. title:'关闭成功'
  33. })
  34. }
  35. })
  36. }
  37. const url =
  38. `https://kf2.mtavip.com/aliyunZhibo/index.html?roomId=900803&appId=dehjl65f&uid=1234&userName=654321&token=000eJxjYGBQsA1url798NJZWaZ%2BjcOiqvN85r2sm1VyiP2c42evb%2F1PlRkYGDhSUjOycsxM0zJjN%2BcveXkvIjOe5StQnM3SwMDCwBjIYjE0MjZhYGQYBUMKAACboBuh`
  39. function openUrl() {
  40. plus.runtime.openURL(url, (err) => {
  41. if (err) {
  42. console.error('打开浏览器失败: ', err);
  43. uni.showToast({
  44. title: '打开链接失败',
  45. icon: 'none'
  46. });
  47. }
  48. });
  49. }
  50. const url2 =
  51. `https://kf2.mtavip.com/aliyunZhibo/index.html?roomId=900803&appId=dehjl65f&uid=1145&userName=123456&token=000eJxjYGBQ%2BNqm4zpNb%2FZc1u5tTh9MFtnfjTM5mMo2%2FZebyk3Rbl%2F19wwMDBwpqRlZOWamaZmxmyfwHU9izYxnFQOKs1kaGFgYGANZLIaGJqYMjAyjYEgBADKGGBo%3D`
  52. function openUrl2() {
  53. plus.runtime.openURL(url2, (err) => {
  54. if (err) {
  55. console.error('打开浏览器失败: ', err);
  56. uni.showToast({
  57. title: '打开链接失败',
  58. icon: 'none'
  59. });
  60. }
  61. });
  62. }
  63. </script>