main.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. uni.setNavigationBarTitle({
  35. title:ProjectName
  36. })
  37. this.personInfo=this.carhelp.getPersonInfo();
  38. },
  39. methods: {
  40. replaceLastTwoWords(str) {
  41. return str;
  42. },
  43. replaceLastTwoWords2(str) {
  44. if (str.length >= 2 && str.indexOf('总表') !=-1) {
  45. return str.replace('总表', '总电源');
  46. }
  47. if (str.length >= 2 && str.indexOf('电表') !=-1) {
  48. return str.replace('电表', '电源');
  49. }
  50. return str;
  51. },
  52. jpAmount(amount){
  53. if(amount){
  54. return amount.toFixed(2)
  55. }else{
  56. return "0.00"
  57. }
  58. },
  59. substrDate(date){
  60. if(date){
  61. return date.substr(0,11)
  62. }
  63. return ''
  64. },
  65. gotoUrl(url) {
  66. var mod = {}
  67. mod.clickUrl = url
  68. if (mod.clickUrl == null) {
  69. } else if (mod.clickUrl.indexOf('http') == 0) {
  70. window.location = mod.clickUrl ;
  71. } else if (mod.clickUrl.indexOf('#/') == 0) {
  72. if (mod.clickUrl.indexOf("?") == -1) {
  73. mod.clickUrl += '?';
  74. }
  75. var url = mod.clickUrl.split("#")[1]
  76. //window.location = mod.clickUrl;
  77. uni.navigateTo({
  78. url: url
  79. })
  80. } else if (mod.clickUrl == '#' || mod.clickUrl == '') {
  81. } else {
  82. uni.navigateTo({
  83. url: mod.clickUrl
  84. })
  85. }
  86. }
  87. }
  88. })
  89. Vue.config.productionTip = false
  90. App.mpType = 'app'
  91. const app = new Vue({
  92. ...App
  93. })
  94. app.$mount()