main.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import Vue from 'vue'
  2. import store from './store'
  3. import App from './App'
  4. import request from './utils/request'
  5. import {
  6. checkPaginationHasMore,
  7. checkSpace,
  8. replaceConByPosition,
  9. getPartNumber,
  10. checkMobile,
  11. checkPwd,
  12. loginGoPage,
  13. formatW,
  14. checkEmail,
  15. diyNavTo,
  16. setCookie,
  17. setStoreIsCookie,
  18. isWeiXinBrower,
  19. weiXinBrowerShare,
  20. weiXinAppShare,
  21. getQueryVariable,
  22. weiXinBrowerPay,
  23. sldCommonTip,
  24. getLoginClient,
  25. formatPercent,
  26. setPointIsCookie,
  27. frequentyleClick,
  28. back,
  29. getCurLanguage,
  30. isShowTime,
  31. formatChatTime,
  32. } from './utils/common.js'
  33. const msg = (title, duration = 1500, mask = false, icon = 'none') => {
  34. //统一提示方便全局修改
  35. if (Boolean(title) === false) {
  36. return;
  37. }
  38. uni.showToast({
  39. title,
  40. duration,
  41. mask,
  42. icon
  43. });
  44. }
  45. const prePage = () => {
  46. let pages = getCurrentPages();
  47. let prePage = pages[pages.length - 2];
  48. // // #ifdef H5
  49. return prePage;
  50. // // #endif
  51. return prePage.$vm;
  52. }
  53. const updateToken = () => {
  54. App.methods.updateAccessToken();
  55. }
  56. Vue.config.productionTip = false
  57. Vue.prototype.$fire = new Vue();
  58. Vue.prototype.$store = store;
  59. Vue.prototype.$request = request;
  60. Vue.prototype.$checkPaginationHasMore = checkPaginationHasMore;
  61. Vue.prototype.$checkSpace = checkSpace;
  62. Vue.prototype.$replaceConByPosition = replaceConByPosition;
  63. Vue.prototype.$getPartNumber = getPartNumber;
  64. Vue.prototype.$checkMobile = checkMobile;
  65. Vue.prototype.$checkPwd = checkPwd;
  66. Vue.prototype.$loginGoPage = loginGoPage;
  67. Vue.prototype.$formatW = formatW;
  68. Vue.prototype.$checkEmail = checkEmail;
  69. Vue.prototype.$diyNavTo = diyNavTo;
  70. Vue.prototype.$setCookie = setCookie;
  71. Vue.prototype.$formatPercent = formatPercent;
  72. Vue.prototype.$setStoreIsCookie = setStoreIsCookie;
  73. Vue.prototype.$setPointIsCookie = setPointIsCookie;
  74. Vue.prototype.$frequentyleClick = frequentyleClick;
  75. Vue.prototype.$L = getCurLanguage;
  76. Vue.prototype.$api = {
  77. msg,
  78. prePage
  79. };
  80. Vue.prototype.$isWeiXinBrower = isWeiXinBrower;
  81. Vue.prototype.$weiXinBrowerShare = weiXinBrowerShare;
  82. Vue.prototype.$weiXinAppShare = weiXinAppShare;
  83. Vue.prototype.$getQueryVariable = getQueryVariable;
  84. Vue.prototype.$weiXinBrowerPay = weiXinBrowerPay;
  85. Vue.prototype.$sldCommonTip = sldCommonTip;
  86. Vue.prototype.$getLoginClient = getLoginClient;
  87. Vue.prototype.$back= back;
  88. Vue.prototype.$isShowTime = isShowTime;
  89. Vue.prototype.$formatChatTime = formatChatTime;
  90. App.mpType = 'app'
  91. //全局注册组件
  92. import loadingState from '@/components/loading-state'
  93. Vue.component('loadingState',loadingState)
  94. // import DiyTabBar from './extra/tshou/component/DiyTabBar'
  95. // Vue.component('DiyTabBar',DiyTabBar)
  96. const app = new Vue({
  97. ...App
  98. })
  99. app.$mount()