App.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <script>
  2. import Vue from "vue";
  3. // voip相关
  4. import { isWmpf } from "./const";
  5. import { updatePushToken } from "./api/index";
  6. import { config } from "./data/index";
  7. // 引入voip插件
  8. const wmpfVoip = requirePlugin("wmpf-voip").default;
  9. // voip事件监听
  10. wmpfVoip.onVoipEvent((event) => {
  11. console.log(`onVoipEvent`, event);
  12. });
  13. // 设置voip结束页面
  14. wmpfVoip.setVoipEndPagePath({
  15. url: "/pages/home/home",
  16. key: "Call",
  17. });
  18. export default {
  19. onLaunch: function () {
  20. // 初始化云开发
  21. if (wx.cloud) {
  22. wx.cloud.init({});
  23. console.log("云开发初始化成功");
  24. // voip相关设置
  25. wmpfVoip.setCustomBtnText("去开门");
  26. if (isWmpf) {
  27. setTimeout(() => {
  28. wmpf.getWmpfPushToken({
  29. success: (resp) => {
  30. console.log(`getWmpfPushToken`, resp);
  31. updatePushToken({
  32. sn: config.sn,
  33. pushToken: resp.token,
  34. });
  35. },
  36. });
  37. }, 1000);
  38. }
  39. } else {
  40. }
  41. // 获取系统信息
  42. uni.getSystemInfo({
  43. success: function (e) {
  44. // #ifndef MP
  45. Vue.prototype.StatusBar = e.statusBarHeight;
  46. if (e.platform == "android") {
  47. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  48. } else {
  49. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  50. }
  51. // #endif
  52. // #ifdef MP-WEIXIN
  53. Vue.prototype.StatusBar = e.statusBarHeight;
  54. let custom = wx.getMenuButtonBoundingClientRect();
  55. Vue.prototype.Custom = custom;
  56. Vue.prototype.CustomBar =
  57. custom.bottom + custom.top - e.statusBarHeight;
  58. // #endif
  59. // #ifdef MP-ALIPAY
  60. Vue.prototype.StatusBar = e.statusBarHeight;
  61. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  62. // #endif
  63. },
  64. });
  65. },
  66. };
  67. </script>