main.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import App from './App'
  2. import store from './store'
  3. import common from './pages/utils/common.js'
  4. import constant from './pages/utils/constant.js'
  5. Vue.prototype.$gaodeKey = 'OJ7BZ-ULH6V-XBLPV-ULIMK-APS3H-QHFIP'; //高德地图key
  6. import {
  7. showToast,
  8. transDate
  9. } from './js_sdk/common.js'
  10. // #ifndef VUE3
  11. import Vue from 'vue'
  12. import auth from './js_sdk/auth'
  13. Vue.prototype.$auth = auth
  14. // import "./vite.config"
  15. Vue.prototype.$constant = constant
  16. Vue.prototype.$common = common
  17. Vue.config.productionTip = false
  18. Vue.prototype.$store = store
  19. Vue.prototype.$transDate = transDate
  20. Vue.prototype.$showToast = showToast
  21. import $http from './js_sdk/request/requestConfig';
  22. Vue.prototype.$http = $http;
  23. // 全局mixin引入 是否登录判断
  24. // import {isLoginMixin} from "./common/mixins";
  25. // Vue.mixin(isLoginMixin);
  26. uni.getStorage({
  27. key: 'laocui_user_token',
  28. success: function (res) {
  29. uni.switchTab({
  30. url: "/pages/index/index"
  31. })
  32. },
  33. fail(res) {
  34. uni.showToast({
  35. title: "请重新登陆",
  36. mask: true,
  37. icon: "none"
  38. });
  39. uni.redirectTo({
  40. url: "/pages/login/login"
  41. })
  42. }
  43. });
  44. App.mpType = 'app'
  45. const app = new Vue({
  46. store,
  47. ...App
  48. })
  49. app.$mount()
  50. // #endif
  51. // #ifdef VUE3
  52. import {
  53. createSSRApp
  54. } from 'vue'
  55. export function createApp() {
  56. const app = createSSRApp(App)
  57. app.use(store)
  58. app.config.globalProperties.$adpid = "1111111111"
  59. app.config.globalProperties.$backgroundAudioData = {
  60. playing: false,
  61. playTime: 0,
  62. formatedPlayTime: '00:00:00'
  63. }
  64. return {
  65. app
  66. }
  67. }
  68. // #endif