main.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. import App from './App'
  2. import DictTag from "@/components/DictTag/index.vue"
  3. /* 全局挂载请求库 */
  4. import GraceRequest from '@/Grace6/js/request.js'
  5. import graceJS from "@/Grace6/js/grace.js";
  6. import router from '@/router/router.js'
  7. import {
  8. CCPrintingAPI
  9. } from "@/unit/CCPrintingAPI.min.vue.js";
  10. import {
  11. baseURL
  12. } from '@/api/env.js'
  13. import {
  14. antiShake,
  15. hideBoard,
  16. parseTime
  17. } from "@/unit/default.js"
  18. import {
  19. scanByCamera,
  20. scanByCameraCompat,
  21. normalizeScanText
  22. } from "@/unit/scanCode.js"
  23. import pinia from "@/stores/index.js"
  24. import {
  25. goHome,
  26. goBack
  27. } from "@/unit/navigate.js"
  28. import {
  29. permission
  30. } from "@/unit/rule.js"
  31. // http://192.168.1.94:48080
  32. // http://218.2.10.30:48080
  33. // http://113.105.183.190:8181/
  34. // uni.$baseUrl = "http://192.168.1.44:48080";
  35. // uni.$baseUrl = "http://192.168.1.69:48080";
  36. // uni.$baseUrl = "http://192.168.1.94:48080";
  37. // uni.$baseUrl = "http://2227el9013.iok.la";
  38. // uni.$baseUrl = "http://192.168.1.97:48080";
  39. // uni.$baseUrl = "";
  40. // uni.$baseUrl = "http://113.105.183.190:48028";
  41. // uni.$baseUrl = "http://192.168.1.32:48080";
  42. uni.$baseUrl = "http://113.105.183.190:15980";
  43. // uni.$baseUrl = "http://192.168.1.26:48080";
  44. // uni.$baseUrl = "http://113.105.183.190:15980";
  45. // uni.$baseUrl = "http://113.105.183.190:48159";
  46. // uni.$baseUrl = "http://61.155.26.34:36936";
  47. // uni.$baseUrl = "http://2227el9013.iok.la";
  48. // uni.$baseUrl = "http://218.2.10.30:48080";
  49. // uni.$baseUrl = "http://192.168.1.85:48080"; // dev
  50. // uni.$baseUrl = "https://222jp79013zl.vicp.fun";
  51. // uni.$baseUrl = "http://113.105.183.190:48064";
  52. // uni.$baseUrl = "http://113.105.183.190:48080";
  53. // uni.$baseUrl = "http://113.105.183.190:48163";
  54. // uni.$baseUrl = "http://113.105.183.190:48167";
  55. // uni.$baseUrl = "http://192.168.2.253:48080";
  56. // uni.$baseUrl = "http://47.107.70.17:48080";
  57. // uni.$useStore = useStore;
  58. uni.$debounce = antiShake;
  59. uni.gRequest = GraceRequest;
  60. uni.$grace = graceJS;
  61. uni.$isPda = false;
  62. uni.$isPhone = false;
  63. uni.$isPad = false;
  64. uni.$hideKeyBoard = hideBoard;
  65. // 自定义拦截器
  66. import {
  67. reqAll,
  68. reqGet,
  69. reqPut,
  70. reqPost,
  71. reqDelete
  72. } from '@/api/index.js'
  73. uni.CCPrintingAPI = CCPrintingAPI;
  74. uni.$reqAll = reqAll;
  75. uni.$reqGet = reqGet;
  76. uni.$reqPut = reqPut;
  77. uni.$reqPost = reqPost;
  78. uni.$reqDelete = reqDelete;
  79. uni.$goHome = goHome;
  80. uni.$goBack = goBack;
  81. uni.$scanByCamera = scanByCamera;
  82. uni.$scanByCameraCompat = scanByCameraCompat;
  83. uni.$normalizeScanText = normalizeScanText;
  84. // 判断是否是平板
  85. uni.getSystemInfo({
  86. success: (res) => {
  87. if (res.screenWidth > 620) {
  88. uni.$isPad = true;
  89. }
  90. if (res.screenWidth > 320 && res.screenWidth < 620) {
  91. uni.$isPhone = true;
  92. }
  93. if (res.screenWidth <= 320) {
  94. uni.$isPda = true;
  95. }
  96. }
  97. });
  98. // 解决 global is not defined 报错问题
  99. // if (typeof window.global === "undefined"){
  100. // window.global = window;
  101. // }
  102. // #ifndef VUE3
  103. import Vue from 'vue'
  104. Vue.config.productionTip = false
  105. App.mpType = 'app'
  106. const app = new Vue({
  107. ...App
  108. })
  109. // app.use(Directives);
  110. app.$mount()
  111. // #endif
  112. // #ifdef VUE3
  113. import {
  114. createSSRApp
  115. } from 'vue'
  116. export function createApp() {
  117. const app = createSSRApp(App)
  118. app.component('DictTag', DictTag)
  119. app.use(router)
  120. app.use(pinia)
  121. // 挂载全局指令
  122. app.config.globalProperties.$permission = permission;
  123. app.config.globalProperties.$parseTime = parseTime;
  124. uni.getSystemInfo({
  125. success: (res) => {
  126. if (res.screenWidth > 620) {
  127. app.config.globalProperties.isPad = true;
  128. app.config.globalProperties.padWidth = res.screenWidth;
  129. app.config.globalProperties.padHeight = res.windowHeight;
  130. }
  131. if (res.screenWidth > 320 && res.screenWidth < 620) {
  132. app.config.globalProperties.isPhone = true;
  133. app.config.globalProperties.phoneWidth = res.screenWidth;
  134. app.config.globalProperties.phoneHeight = res.windowHeight;
  135. }
  136. if (res.screenWidth <= 320) {
  137. app.config.globalProperties.isPda = true;
  138. app.config.globalProperties.pdaWidth = res.screenWidth;
  139. app.config.globalProperties.pdaHeight = res.windowHeight;
  140. }
  141. }
  142. });
  143. return {
  144. app
  145. }
  146. }
  147. // #endif