main.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import App from './App'
  2. import messages from './locale/index'
  3. let i18nConfig = {
  4. locale: uni.getLocale(),
  5. messages
  6. }
  7. import common from '@/utils/common.js'
  8. Vue.prototype.$common =common
  9. import request from '@/utils/request.js'
  10. Vue.prototype.$http = request.http
  11. Vue.prototype.$request =request
  12. import store from './store'
  13. Vue.prototype.$store = store // 定义成全局组件
  14. //http://112.124.69.194:93/#/ 测试地址
  15. console.log("main.js")
  16. if(common.getHashQuery('token')){
  17. var userInfo={
  18. token:common.getHashQuery('token'),
  19. uid:common.getHashQuery('uid')
  20. }
  21. var wxOpenData={
  22. loginInfo:userInfo
  23. }
  24. console.log(wxOpenData)
  25. store.commit('mutationsuserInfo', userInfo)
  26. store.commit('mutationswxOpenData', wxOpenData)
  27. uni.setStorage({
  28. key: 'wxOpenData',
  29. data: wxOpenData,
  30. success: function () {
  31. }
  32. });
  33. console.log(store.state.userInfo)
  34. }
  35. if(common.getHashQuery('quanxian')){
  36. console.log(common.getHashQuery('quanxian'));
  37. uni.setStorage({
  38. key: 'quanxian',
  39. data: common.getHashQuery('quanxian'),
  40. success: function () { }
  41. });
  42. }
  43. //console.log(common.getHashQuery('token'))
  44. // #ifndef VUE3
  45. import Vue from 'vue'
  46. Vue.config.productionTip = false
  47. App.mpType = 'app'
  48. import VueI18n from 'vue-i18n'
  49. Vue.use(VueI18n)
  50. const i18n = new VueI18n(i18nConfig)
  51. const app = new Vue({
  52. i18n,
  53. ...App
  54. })
  55. app.$mount()
  56. // #endif
  57. // #ifdef VUE3
  58. import { createSSRApp } from 'vue'
  59. mport { createI18n } from 'vue-i18n'
  60. const i18n = createI18n(i18nConfig)
  61. export function createApp() {
  62. const app = createSSRApp(App)
  63. app.use(i18n)
  64. return {
  65. app
  66. }
  67. }
  68. // #endif