main.js 4.4 KB

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