main.js 3.6 KB

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