main.js 3.4 KB

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