main.js 3.7 KB

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