main.js 991 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import Vue from 'vue'
  2. import App from './App'
  3. import store from './store'
  4. import {
  5. dayjs
  6. } from '@/uni_modules/iRainna-dayjs/js_sdk/dayjs.min.js'
  7. Vue.prototype.$store = store;
  8. Vue.prototype.$dayjs = dayjs;
  9. Vue.prototype.$toast = msg => {
  10. uni.showToast({
  11. title: msg,
  12. icon: "none"
  13. })
  14. };
  15. Vue.prototype.$navigateTo = (url) => {
  16. if (!uni.getStorageSync('token') && url != '/pages/login/login') {
  17. uni.showToast({
  18. title: '您暂未登录,请先登录~',
  19. icon: "none"
  20. });
  21. url = '/pages/login/login'
  22. setTimeout(() => {
  23. uni.navigateTo({
  24. url: url
  25. })
  26. }, 400)
  27. } else {
  28. uni.navigateTo({
  29. url: url
  30. })
  31. }
  32. }
  33. Vue.prototype.$navigateBack = uni.navigateBack;
  34. import field from './config/field.js'
  35. Vue.prototype.$field = field;
  36. import chat from './uitls/chat.js'
  37. chat.init();
  38. Vue.prototype.$chat = chat;
  39. Vue.config.productionTip = false;
  40. App.mpType = 'app';
  41. const app = new Vue({
  42. store,
  43. ...App
  44. })
  45. app.$mount()