main.js 3.3 KB

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