移动储能车V1版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import App from './App'
  2. // #ifndef VUE3
  3. import Vue from 'vue'
  4. import './uni.promisify.adaptor'
  5. Vue.config.productionTip = false
  6. App.mpType = 'app'
  7. const app = new Vue({
  8. ...App
  9. })
  10. app.$mount()
  11. // #endif
  12. // #ifdef VUE3
  13. import { createSSRApp } from 'vue'
  14. export function createApp() {
  15. const app = createSSRApp(App)
  16. return {
  17. app
  18. }
  19. }
  20. // #endif
  21. import { $http } from './api/http.js'
  22. // import { login } from './api/api'
  23. uni.$http = $http
  24. $http.baseUrl = ''
  25. // uni.$apiKey = 'xxxxxxxxx'
  26. // 请求开始之前
  27. $http.beforeRequest = function (options) {
  28. // uni.showLoading({
  29. // title: '数据加载中...',
  30. // })
  31. // if(options.url!="http://10.168.4.100:80/api/v1/login"){
  32. // console.log(options);
  33. // if (!uni.getStorageSync('token')) {
  34. // login().then(data => {
  35. // // console.log(data);
  36. // if (data.status == 'ok') {
  37. // uni.setStorage({
  38. // key: 'token',
  39. // data: data.data.token,
  40. // success: function(res) {
  41. // console.log(res);
  42. // }
  43. // });
  44. // }else{
  45. // uni.showToast({
  46. // title:data.msg,
  47. // icon: 'none',
  48. // duration: 2000, // 显示时长,单位为毫秒
  49. // });
  50. // }
  51. // });
  52. // }
  53. // }
  54. }
  55. // 请求完成之后
  56. $http.afterRequest = function () {
  57. // uni.hideLoading()
  58. }