main.js 3.5 KB

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