main.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import App from './App'
  2. import Vue from 'vue'
  3. import getOpenId from './apis/utils/init.js'
  4. import getALIOpenId from './apis/utils/initALI.js'
  5. //import './assets/font/font/font.css'
  6. var IS_WEIXIN = /MicroMessenger/.test(window.navigator.userAgent)
  7. var IS_ALI = /AlipayClient/.test(window.navigator.userAgent)
  8. if (IS_ALI) {
  9. getALIOpenId.init()
  10. } else {
  11. getOpenId.init()
  12. }
  13. import mixin from './apis/utils/mixin.js'
  14. Vue.prototype.carhelp = mixin
  15. window.wx = {}
  16. import Vconsole from 'vconsole'
  17. //import uView from "uview-ui";
  18. import uView from '@/uni_modules/uview-ui'
  19. import router from '@/components/bobo-router'
  20. Vue.use(uView);
  21. Vue.mixin({
  22. updated: function() {
  23. },
  24. onReady() {
  25. },
  26. onLoad(option) {
  27. if (option.test == 'test') {
  28. let vConsole = new Vconsole()
  29. }
  30. var ProjectName=process.car.ProjectName;
  31. if(process.car.NODE_ENV=='dev'||process.car.NODE_ENV=='test'){
  32. ProjectName+='('+process.car.NODE_ENV+')';
  33. }
  34. // if(this.carhelp.getUnionPhone()){
  35. // if (currentDomain === 'yjwg.hbjp.com.cn') {
  36. // // ProjectName="壹家物管服务大厅"
  37. // }
  38. // ProjectName="壹家物管运管大厅"
  39. // }
  40. uni.setNavigationBarTitle({
  41. title:ProjectName
  42. })
  43. this.personInfo=this.carhelp.getPersonInfo();
  44. },
  45. methods: {
  46. replaceLastTwoWords(str) {
  47. return str;
  48. },
  49. replaceLastTwoWords2(str) {
  50. if (str.length >= 2 && str.indexOf('总表') !=-1) {
  51. return str.replace('总表', '总电源');
  52. }
  53. if (str.length >= 2 && str.indexOf('电表') !=-1) {
  54. return str.replace('电表', '电源');
  55. }
  56. return str;
  57. },
  58. jpAmount(amount){
  59. if(amount){
  60. return amount.toFixed(2)
  61. }else{
  62. return "0.00"
  63. }
  64. },
  65. substrDate(date){
  66. if(date){
  67. return date.substr(0,11)
  68. }
  69. return ''
  70. },
  71. gotoUrl(url) {
  72. var mod = {}
  73. mod.clickUrl = url
  74. if (mod.clickUrl == null) {
  75. } else if (mod.clickUrl.indexOf('http') == 0) {
  76. window.location = mod.clickUrl ;
  77. } else if (mod.clickUrl.indexOf('#/') == 0) {
  78. if (mod.clickUrl.indexOf("?") == -1) {
  79. mod.clickUrl += '?';
  80. }
  81. var url = mod.clickUrl.split("#")[1]
  82. //window.location = mod.clickUrl;
  83. uni.navigateTo({
  84. url: url
  85. })
  86. } else if (mod.clickUrl == '#' || mod.clickUrl == '') {
  87. } else {
  88. uni.navigateTo({
  89. url: mod.clickUrl
  90. })
  91. }
  92. }
  93. }
  94. })
  95. Vue.config.productionTip = false
  96. App.mpType = 'app'
  97. const app = new Vue({
  98. ...App
  99. })
  100. app.$mount()