main.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import App from './App'
  2. // #ifndef VUE3
  3. import Vue from 'vue'
  4. Vue.config.productionTip = false;
  5. //组件库
  6. import uView from '@/uni_modules/uview-ui'
  7. Vue.use(uView)
  8. //colorui 自定义顶部nav
  9. import cuCustom from './colorui/components/cu-custom.vue'
  10. Vue.component('cu-custom', cuCustom)
  11. import timeHorizon from './components/timeHorizon'
  12. Vue.component('time-horizon', timeHorizon)
  13. import controlItem from "./control/modules/controlItem.vue"
  14. Vue.component('control-item', controlItem)
  15. import My_input from "./control/modules/My_input.vue"
  16. Vue.component('My_input', My_input)
  17. //自定义组件
  18. import My_listbox from './components/My_listbox';
  19. Vue.component('My_listbox', My_listbox);
  20. import My_search from './components/My_search';
  21. Vue.component('My_search', My_search);
  22. import My_form from './components/My_form';
  23. Vue.component('My_form', My_form);
  24. import My_Files from './components/My_Files';
  25. Vue.component('My_Files', My_Files);
  26. import connectingDevice from './control/modules/connectingDevice';
  27. Vue.component('connectingDevice', connectingDevice);
  28. console.log("process.env.NODE_ENV",process.env.NODE_ENV)
  29. //挂载接口
  30. let isDev = ['development','production'].includes(process.env.NODE_ENV);
  31. console.log('运行环境', isDev ? '开发' : '生产');
  32. const http = {};
  33. // #ifdef H5
  34. http.baseUrl = isDev ? "/apis1" : "/apis";
  35. http.socket = isDev ? "/socket1" : "/socket";
  36. // http.baseUrl = "/apis";
  37. // http.socket = "/socket";
  38. // #endif
  39. // #ifndef H5
  40. http.baseUrl = isDev ? "http://61.164.207.46:8100" : "https://www.ibpchina.com.cn";
  41. http.socket = isDev ? "ws://61.164.207.46:8100" : "wss://www.ibpchina.com.cn";
  42. // http.baseUrl = "https://www.ibpchina.com.cn";
  43. // http.socket = "wss://www.ibpchina.com.cn";
  44. // #endif
  45. console.log("接口地址", http)
  46. import {
  47. ApiModel
  48. } from './utils/api'
  49. Vue.prototype.$Http = new ApiModel(http);
  50. import {
  51. Socket
  52. } from './utils/Socket'
  53. Vue.prototype.$Socket = new Socket(http);
  54. App.mpType = 'app'
  55. const app = new Vue({
  56. ...App
  57. })
  58. app.$mount()
  59. // #endif
  60. // #ifdef VUE3
  61. import {
  62. createSSRApp
  63. } from 'vue'
  64. export function createApp() {
  65. const app = createSSRApp(App)
  66. return {
  67. app
  68. }
  69. }
  70. // #endif