main.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import App from './App'
  2. import store from './store'
  3. import uView from "@/node_modules/uview-ui";
  4. import {isEmpty,parseIDCardInfo,parseText,urlToObj,clearHisSearch,getHisSearch,addHisSearch,logout,getDictLabelNames,
  5. checkToken,getDict,
  6. getDictLabelName,getProvider,parsePhone,isLogin,getAge,parseIdCard,isLoginCourseAuto,reLoginCheck} from './utils/common.js'
  7. // #ifndef VUE3
  8. import Vue from 'vue'
  9. // Vuex 插件注册
  10. import Vuex from 'vuex'
  11. Vue.config.productionTip = false
  12. App.mpType = 'app'
  13. Vue.use(Vuex)
  14. Vue.use(uView);
  15. Vue.prototype.$getProvider = getProvider;
  16. Vue.prototype.$parsePhone = parsePhone;
  17. Vue.prototype.$isLogin = isLogin;
  18. Vue.prototype.$isEmpty = isEmpty;
  19. Vue.prototype.$getAge = getAge;
  20. Vue.prototype.$parseIdCard = parseIdCard;
  21. Vue.prototype.$getDictLabelName = getDictLabelName;
  22. Vue.prototype.$parseText = parseText;
  23. Vue.prototype.$logout = logout;
  24. Vue.prototype.$clearHisSearch = clearHisSearch
  25. Vue.prototype.$getHisSearch = getHisSearch
  26. Vue.prototype.$addHisSearch = addHisSearch
  27. Vue.prototype.$urlToObj = urlToObj
  28. Vue.prototype.$parseText = parseText
  29. Vue.prototype.$parseIDCardInfo = parseIDCardInfo
  30. Vue.prototype.$isLoginCourseAuto = isLoginCourseAuto
  31. Vue.prototype.$reLoginCheck = reLoginCheck
  32. Vue.prototype.$getDictLabelNames = getDictLabelNames
  33. Vue.prototype.$checkToken = checkToken
  34. Vue.prototype.$getDict = getDict
  35. // Vue.prototype.$formatHour = formatHour;
  36. // Vue.prototype.$updateMsgDot = updateMsgDot;
  37. const app = new Vue({
  38. store,
  39. ...App
  40. })
  41. // 引入请求封装
  42. require("./pages_im/util/request/index")(app);
  43. app.$mount()
  44. // #endif
  45. // #ifdef VUE3
  46. import { createSSRApp } from 'vue'
  47. import uviewPlus from '@/uni_modules/uview-plus'
  48. export function createApp() {
  49. const app = createSSRApp(App)
  50. app.config.globalProperties.$getProvider = getProvider
  51. app.config.globalProperties.$parsePhone = parsePhone
  52. app.config.globalProperties.$isLogin = isLogin
  53. app.config.globalProperties.$isEmpty = isEmpty
  54. app.config.globalProperties.$getAge = getAge
  55. app.config.globalProperties.$parseIdCard = parseIdCard
  56. app.config.globalProperties.$getDictLabelName = getDictLabelName
  57. app.config.globalProperties.$logout = logout
  58. app.config.globalProperties.$clearHisSearch = clearHisSearch
  59. app.config.globalProperties.$getHisSearch = getHisSearch
  60. app.config.globalProperties.$addHisSearch = addHisSearch
  61. app.config.globalProperties.$urlToObj = urlToObj
  62. app.config.globalProperties.$parseText = parseText
  63. app.config.globalProperties.$parseIDCardInfo = parseIDCardInfo
  64. app.config.globalProperties.$isLoginCourseAuto = isLoginCourseAuto
  65. app.use(uviewPlus)
  66. return {
  67. app
  68. }
  69. }
  70. // #endif