main.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import App from './App'
  2. import Vue from 'vue'
  3. import store from './store'
  4. // 引入全局uView
  5. import uView from "@/node_modules/uview-ui";
  6. import {parseIDCardInfo,logout,parseText,getDictLabelName,parseIdCard,getAge,parsePhone,isEmpty,
  7. isLogin,navBack,navTo,getUserInfo,formatHour,dateFormatStr,registerIdCode,updateMsgDot,handleBindCompanyFsUser,
  8. setSource,companyUserIsLogin,checkWechatInstalled,isAndroid,isIos,loginNavTo} from './utils/common.js'
  9. import { showLoginPage,getRegistrationID } from './utils/login.js'
  10. import { formatSeconds,formatDate } from './utils/tools.js'
  11. import { qconfig } from './utils/config.js'
  12. // 时间格式化
  13. import timeFormat from './utils/timeFormat.js'
  14. //数据格式化
  15. import dataProcess from './utils/dataProcess.js'
  16. // Vuex
  17. import Vuex from 'vuex'
  18. // #ifndef VUE3
  19. import './uni.promisify.adaptor'
  20. Vue.config.productionTip = false
  21. App.mpType = 'app'
  22. // Vuex 插件注册
  23. Vue.use(Vuex)
  24. Vue.use(uView);
  25. Vue.prototype.$isLogin = isLogin;
  26. Vue.prototype.$isEmpty = isEmpty;
  27. Vue.prototype.$parsePhone = parsePhone;
  28. Vue.prototype.$showLoginPage = showLoginPage;
  29. Vue.prototype.$getRegistrationID = getRegistrationID;
  30. Vue.prototype.$navBack = navBack;
  31. Vue.prototype.$navTo = navTo;
  32. Vue.prototype.$qconfig = qconfig;
  33. Vue.prototype.$getAge = getAge;
  34. Vue.prototype.$parseIdCard = parseIdCard;
  35. Vue.prototype.$getDictLabelName = getDictLabelName;
  36. Vue.prototype.$parseText = parseText;
  37. Vue.prototype.$logout = logout;
  38. Vue.prototype.$getUserInfo = getUserInfo;
  39. Vue.prototype.$dateFormatStr = dateFormatStr;
  40. Vue.prototype.$registerIdCode = registerIdCode;
  41. Vue.prototype.$formatSeconds = formatSeconds;
  42. Vue.prototype.$formatDate = formatDate;
  43. Vue.prototype.$parseIDCardInfo = parseIDCardInfo;
  44. Vue.prototype.$timeFormat = timeFormat;
  45. Vue.prototype.$formatHour = formatHour;
  46. Vue.prototype.$dataProcess = dataProcess;
  47. // Vue.prototype.$updateMsgDot = updateMsgDot;
  48. Vue.prototype.$handleBindCompanyFsUser = handleBindCompanyFsUser;
  49. Vue.prototype.$setSource = setSource;
  50. Vue.prototype.$companyUserIsLogin = companyUserIsLogin;
  51. Vue.prototype.$checkWechatInstalled = checkWechatInstalled;
  52. Vue.prototype.$isAndroid = isAndroid;
  53. Vue.prototype.$isIos = isIos;
  54. Vue.prototype.$loginNavTo = loginNavTo;
  55. const app = new Vue({
  56. store,
  57. ...App
  58. });
  59. // 引入请求封装
  60. // require("./pages_im/util/request/index")(app);
  61. app.$mount()
  62. // #endif
  63. // #ifdef VUE3
  64. import { createSSRApp } from 'vue'
  65. export function createApp() {
  66. const app = createSSRApp(App)
  67. app.use(uviewPlus)
  68. app.use(Vuex)
  69. app.use(store)
  70. app.config.globalProperties.$isLogin = isLogin
  71. app.config.globalProperties.$isEmpty = isEmpty
  72. app.config.globalProperties.$parsePhone = parsePhone
  73. app.config.globalProperties.$showLoginPage = showLoginPage
  74. app.config.globalProperties.$getRegistrationID = getRegistrationID
  75. app.config.globalProperties.$navBack = navBack
  76. app.config.globalProperties.$navTo = navTo
  77. app.config.globalProperties.$qconfig = qconfig
  78. app.config.globalProperties.$getAge = getAge
  79. app.config.globalProperties.$parseIdCard = parseIdCard
  80. app.config.globalProperties.$getDictLabelName = getDictLabelName
  81. app.config.globalProperties.$parseText = parseText
  82. app.config.globalProperties.$logout = logout,
  83. app.config.globalProperties.$getUserInfo = getUserInfo,
  84. app.config.globalProperties.$dateFormatStr = dateFormatStr,
  85. app.config.globalProperties.$registerIdCode = registerIdCode,
  86. app.config.globalProperties.$formatSeconds = formatSeconds,
  87. app.config.globalProperties.$formatDate = formatDate,
  88. app.config.globalProperties.$parseIDCardInfo = parseIDCardInfo
  89. app.config.globalProperties.$timeFormat = timeFormat;
  90. app.config.globalProperties.$formatHour = formatHour;
  91. app.config.globalProperties.$dataProcess = dataProcess;
  92. // app.config.globalProperties.$updateMsgDot = updateMsgDot;
  93. app.config.globalProperties.$handleBindCompanyFsUser = handleBindCompanyFsUser;
  94. app.config.globalProperties.$setSource = setSource;
  95. app.config.globalProperties.$loginNavTo = loginNavTo;
  96. return {
  97. app
  98. }
  99. }
  100. // #endif