main.js 3.8 KB

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