main.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import App from './App'
  2. import Vue from 'vue'
  3. import store from './store'
  4. import uvUI from '@/uni_modules/uv-ui-tools'
  5. Vue.use(uvUI);
  6. Vue.prototype.$store = store;
  7. import chat from './uitls/chat.js'
  8. chat.init();
  9. import customerServe from './uitls/customerServe.js'
  10. customerServe.init();
  11. Vue.prototype.$chat = chat;
  12. Vue.prototype.$customerServe = customerServe;
  13. Vue.prototype.$toast = msg => {
  14. uni.showToast({
  15. title: msg,
  16. icon: "none"
  17. })
  18. };
  19. Vue.prototype.$navigateTo = (url) => {
  20. if ((!uni.getStorageSync('token') || !uni.getStorageSync('shopMobileToken')) && url != '/pages/login/login') {
  21. url = '/pages/login/login';
  22. }
  23. uni.navigateTo({
  24. url: url
  25. })
  26. };
  27. Vue.prototype.initBadge = () => {
  28. if (uni.getStorageSync('chatBadge')) {
  29. let badge = uni.getStorageSync('chatBadge');
  30. if (badge === '0') {
  31. uni.removeTabBarBadge({
  32. index: 1
  33. })
  34. } else {
  35. uni.setTabBarBadge({
  36. index: 1,
  37. text: badge
  38. })
  39. }
  40. }
  41. };
  42. import config from "@/config";
  43. Vue.prototype.shopImage = (img) => {
  44. return config.baseUrl + '/prod-api/mobile-api/file/getImgStream?idFile=' + img;
  45. }
  46. Vue.config.productionTip = false;
  47. App.mpType = 'app'
  48. const app = new Vue({
  49. ...App
  50. })
  51. app.$mount()