您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

main.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* eslint-disable */
  2. import Vue from "vue";
  3. import EvaIcons from "vue-eva-icons";
  4. import axios from "axios";
  5. import moment from "moment";
  6. import App from "./App.vue";
  7. import router from "./router";
  8. import store from "./store";
  9. import * as VueGoogleMaps from "vue2-google-maps";
  10. import Vuetify from "vuetify";
  11. import VueShareSocial from "vue-share-social";
  12. import VueCurrencyInput from "vue-currency-input";
  13. Vue.use(VueShareSocial);
  14. Vue.use(EvaIcons);
  15. Vue.use(Vuetify);
  16. Vue.use(VueGoogleMaps, {
  17. load: {
  18. key: "AIzaSyD8k_Kwml_C8IDfs-gX8JFV8acli3L9cAE",
  19. libraries: "places,directions" // This is required if you use the Autocomplete plugin
  20. // OR: libraries: 'places,drawing'
  21. // OR: libraries: 'places,drawing,visualization'
  22. // (as you require)
  23. //// If you want to set the version, you can do so:
  24. // v: '3.26',
  25. }
  26. });
  27. Vue.config.productionTip = false;
  28. //axios.defaults.baseURL = "http://localhost:57260";
  29. axios.defaults.baseURL = "http://training.provision-sa.com:82";
  30. //axios.defaults.baseURL = "http://localhost:8080/";
  31. Vue.prototype.$axios = axios;
  32. const pluginOptions = {
  33. /* see config reference */
  34. globalOptions: { currency: ["ZAR", null, { prefix: "R" }][2] }
  35. };
  36. Vue.use(VueCurrencyInput, pluginOptions);
  37. Vue.prototype.$http = axios;
  38. const token = localStorage.getItem("token");
  39. if (token) {
  40. Vue.prototype.$http.defaults.headers.common.Authorization = token;
  41. }
  42. router.beforeEach((to, from, next) => {
  43. if (to.matched.some(record => record.meta.requiresAuth)) {
  44. if (store.getters.isLoggedIn) {
  45. next();
  46. return;
  47. }
  48. next("/users/login");
  49. } else {
  50. next();
  51. }
  52. });
  53. Vue.filter("toCurrency", value => {
  54. if (typeof value !== "number") {
  55. return value;
  56. }
  57. const formatter = new Intl.NumberFormat("en-US", {
  58. minimumFractionDigits: 2
  59. });
  60. return `R ${formatter.format(value)}`;
  61. });
  62. Vue.filter("toProper", value => {
  63. if (typeof value !== "string") {
  64. console.log(typeof value);
  65. return value;
  66. }
  67. value = value.replace(/([a-z])([A-Z])/g, "$1 $2");
  68. return value.charAt(0).toUpperCase() + value.slice(1);
  69. });
  70. Vue.filter("toDate", value => value.substring(0, value.length > 9 ? 10 : value.length));
  71. Vue.filter("toTime", value => moment(String(value)).format("hh:mm"));
  72. new Vue({
  73. render: h => h(App),
  74. router,
  75. store
  76. }).$mount("#app");