App.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <script>
  2. // #ifdef APP-PLUS
  3. import APPUpdate, {
  4. getCurrentNo
  5. } from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
  6. import {
  7. callErrorCode
  8. } from "@/utils/commonDicts.js";
  9. // #endif
  10. import {
  11. simpleDebounce
  12. } from "@/utils/util.js";
  13. export default {
  14. data() {
  15. return {
  16. g_wakelock: null,
  17. }
  18. },
  19. onLaunch: function() {
  20. //#ifdef APP-PLUS
  21. APPUpdate();
  22. getCurrentNo((data) => {
  23. this.$store.commit("app/SET_CURRENTVERSION", data.versionName);
  24. });
  25. plus.globalEvent.addEventListener('plusMessage', (msg) => {
  26. if (msg.data.args.data.name == 'postMessage') {
  27. const {
  28. type,
  29. data,
  30. action
  31. } = msg.data.args.data.arg;
  32. if (action === "message") {
  33. uni.$u.toast("e:" + data);
  34. } else if (action == "singInState") {
  35. this.$store.commit("app/SET_SIGNINSTATE", data)
  36. } else if (action == "registerInfo") {
  37. this.$store.commit("app/SET_REDIS_INFO", data)
  38. } else if (action == "disconnected") {
  39. // 重连不上 重新创建
  40. this.$store.dispatch("app/createWv");
  41. } else if (action === "phoneStatus") {
  42. this.$store.commit("app/SET_DIALING", data)
  43. } else if (action == "outbound") {
  44. data.action = "outbound";
  45. this.$store.dispatch("app/saveUnionAppCall", data)
  46. } else if (action == "incoming") {
  47. data.action = "incoming";
  48. // this.$store.commit("app/SET_ISREJECT", false);
  49. this.$store.dispatch("app/saveUnionAppCall", data).then(res => {
  50. uni.navigateTo({
  51. url: `/pages/callweb/callweb?phone=${data.phone}`
  52. })
  53. })
  54. }
  55. }
  56. });
  57. // this.addFlags();
  58. // #endif
  59. },
  60. onShow: function() {
  61. this.$store.dispatch("app/register");
  62. },
  63. methods: {
  64. wakeLock() {
  65. //Android
  66. var main = plus.android.runtimeMainActivity();
  67. var Context = plus.android.importClass("android.content.Context");
  68. var PowerManager = plus.android.importClass("android.os.PowerManager");
  69. var pm = main.getSystemService(Context.POWER_SERVICE);
  70. this.g_wakelock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "ANY_NAME");
  71. this.g_wakelock.acquire();
  72. },
  73. // 禁止截屏
  74. addFlags() {
  75. // #ifdef APP-PLUS
  76. let osname = plus.os.name
  77. if (osname == "Android") {
  78. var activity = plus.android.runtimeMainActivity()
  79. plus.android.invoke(plus.android.invoke(activity, "getWindow"), "addFlags", 0x00002000)
  80. }
  81. // #endif
  82. },
  83. clearFlags() {
  84. // #ifdef APP-PLUS
  85. let osname = plus.os.name
  86. if (osname == "Android") {
  87. var activity = plus.android.runtimeMainActivity()
  88. plus.android.invoke(plus.android.invoke(activity, "getWindow"), "clearFlags", 0x00002000)
  89. }
  90. // #endif
  91. },
  92. },
  93. }
  94. </script>
  95. <style lang="scss">
  96. .card_wrap {
  97. margin: 0 20px;
  98. background-color: #fff;
  99. border-radius: 20rpx;
  100. overflow: hidden;
  101. margin-bottom: 20px;
  102. .header_wrap {
  103. display: flex;
  104. justify-content: space-between;
  105. padding: 10px;
  106. border-bottom: 1px solid #ddd;
  107. background-color: #fff;
  108. .header_left {
  109. font-size: 30rpx;
  110. }
  111. .haeder_right {
  112. display: flex;
  113. align-items: center;
  114. text {
  115. font-size: 28rpx;
  116. color: #b8b8b8;
  117. margin-right: 20rpx;
  118. }
  119. ::v-deep .u-icon__icon {
  120. font-size: 24rpx !important;
  121. }
  122. }
  123. }
  124. }
  125. /*#ifndef APP-NVUE*/
  126. .required {
  127. &::after {
  128. content: "*";
  129. color: red;
  130. margin-left: 6rpx;
  131. }
  132. }
  133. .form_required {
  134. position: relative;
  135. &::after {
  136. position: absolute;
  137. left: 12rpx;
  138. top: 50%;
  139. transform: translate(0%, -50%);
  140. content: "*";
  141. color: red;
  142. margin-left: 6rpx;
  143. }
  144. }
  145. /*#endif*/
  146. .u-cell__value {
  147. color: #999999 !important;
  148. }
  149. /*#ifndef APP-NVUE*/
  150. page {
  151. background-color: $uni-bg-color;
  152. }
  153. /*#endif*/
  154. .u-nav-slot {
  155. color: #108cff;
  156. }
  157. // 时间选择器不要高
  158. /*#ifndef APP-NVUE*/
  159. ::v-deep .uni-date__x-input {
  160. height: auto !important;
  161. font-size: 28rpx !important;
  162. }
  163. /*#endif*/
  164. .u-navbar__content__title {
  165. font-weight: bold;
  166. }
  167. @import "@/uni_modules/uview-ui/index.scss";
  168. /*每个页面公共css */
  169. </style>