main.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import App from './App'
  2. import uView from "uview-ui";
  3. // #ifndef VUE3
  4. import Vue from 'vue'
  5. import './uni.promisify.adaptor'
  6. Vue.config.productionTip = false
  7. Vue.config.errorHandler = (err, vm, info) => {
  8. console.error('Vue全局错误:', err, info);
  9. };
  10. Vue.config.warnHandler = (msg, vm, trace) => {
  11. console.warn('Vue警告:', msg, trace);
  12. };
  13. // 组件同步注册(uni-app要求必须为静态字符串)
  14. import My_listbox from './components/My_listbox.vue';
  15. Vue.component("My_listbox", My_listbox);
  16. import My_search from './components/My_search.vue';
  17. Vue.component("My_search", My_search);
  18. import filtrate from './components/filtrate.vue';
  19. Vue.component("filtrate", filtrate);
  20. import appList from './components/appList.vue';
  21. Vue.component("appList", appList);
  22. import floatBut from './components/floatBut.vue';
  23. Vue.component("floatBut", floatBut);
  24. import slideshow from './components/slideshow.vue';
  25. Vue.component("slideshow", slideshow);
  26. import storeInfo from './components/storeInfo.vue';
  27. Vue.component("storeInfo", storeInfo);
  28. import my_form from './components/my_form.vue';
  29. Vue.component("my_form", my_form);
  30. import My_upload from './components/my-upload.vue';
  31. Vue.component("My_upload", My_upload);
  32. import bottomForm from './components/bottomForm.vue';
  33. Vue.component("bottomForm", bottomForm);
  34. import displayCell from './components/displayCell.vue';
  35. Vue.component("displayCell", displayCell);
  36. //挂载接口
  37. let isDev = process.env.NODE_ENV === 'development';
  38. const http = {};
  39. // #ifdef H5
  40. http.baseUrl = isDev ? "/apis1" : "/apis";
  41. http.socket = isDev ? "/socket1" : "/socket";
  42. // #endif
  43. // #ifndef H5
  44. http.baseUrl = isDev ? "http://61.164.207.46:8900" : "https://meida.cnyunl.com:888";
  45. http.socket = isDev ? "ws://61.164.207.46:8900" : "wss://meida.cnyunl.com:888";
  46. // #endif
  47. http.baseUrl = "https://meida.cnyunl.com:888";
  48. http.socket = "wss://meida.cnyunl.com:888";
  49. console.log("接口地址", http)
  50. import { ApiModel } from './utils/api'
  51. Vue.prototype.$Http = new ApiModel(http.baseUrl);
  52. Vue.use(uView);
  53. import { Login } from "./utils/login"
  54. Vue.prototype.$Login = new Login();
  55. Vue.prototype.$Http.wechatLogin = Vue.prototype.$Login.wechatLogin;
  56. Vue.prototype.$Http.autoLogin = Vue.prototype.$Login.autoLogin;
  57. // 登录延迟执行(不阻塞首屏渲染)
  58. setTimeout(() => {
  59. Vue.prototype.$Login.autoLogin().catch(err => {
  60. console.error('自动登录失败:', err);
  61. });
  62. }, 100);
  63. App.mpType = 'app'
  64. const app = new Vue({
  65. ...App
  66. })
  67. app.$mount()
  68. // #endif
  69. // #ifdef VUE3
  70. import { createSSRApp } from 'vue'
  71. export function createApp() {
  72. const app = createSSRApp(App)
  73. return {
  74. app
  75. }
  76. }
  77. // #endif