main.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import 'babel-polyfill'
  2. import Vue from 'vue'
  3. import App from './App'
  4. import vuex from 'vuex'
  5. import Toast from '@/components/toast/toast'
  6. import { i18n } from './lang'
  7. import './register-components'
  8. // import axios from './util/http.js'
  9. // import router from './router'
  10. Vue.prototype.$cdn = process.env.IS_INTERNATIONAL ? './' : 'https://4dscene.4dage.com/new4dkk/'
  11. Vue.use(vuex)
  12. Vue.use(Toast)
  13. Vue.prototype.$bus = new Vue()
  14. let axios = require('./util/http.js').default
  15. let router = require('./router').default
  16. Vue.prototype.$http = axios
  17. // Vue.prototype.$serverName = 'http://192.168.0.10:8080/'
  18. Vue.prototype.$serverName = ''
  19. // Vue.prototype.$serverName = 'https://test.4dkankan.com'
  20. Vue.config.productionTip = false
  21. function dateFtt (fmt) {
  22. let date = this
  23. let o = {
  24. 'M+': date.getMonth() + 1,
  25. 'd+': date.getDate(),
  26. 'h+': date.getHours(),
  27. 'm+': date.getMinutes(),
  28. 's+': date.getSeconds(),
  29. 'q+': Math.floor((date.getMonth() + 3) / 3),
  30. 'S': date.getMilliseconds()
  31. }
  32. if (/(y+)/.test(fmt)) {
  33. fmt = fmt.replace(
  34. RegExp.$1,
  35. (date.getFullYear() + '').substr(4 - RegExp.$1.length)
  36. )
  37. }
  38. for (let k in o) {
  39. if (new RegExp('(' + k + ')').test(fmt)) {
  40. fmt = fmt.replace(
  41. RegExp.$1,
  42. RegExp.$1.length === 1
  43. ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
  44. )
  45. }
  46. }
  47. return fmt
  48. }
  49. /* eslint-disable */
  50. Date.prototype.format = dateFtt
  51. /* eslint-enable */
  52. /* eslint-disable no-new */
  53. window.$app = new Vue({
  54. el: '#app',
  55. router,
  56. i18n,
  57. store: require('./store').default,
  58. components: { App },
  59. template: '<App/>'
  60. })