main.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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.jphelp = 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.jphelp.ProjectName;
  31. if(process.jphelp.NODE_ENV=='dev'||process.jphelp.NODE_ENV=='test'){
  32. ProjectName+='('+process.jphelp.NODE_ENV+')';
  33. }
  34. uni.setNavigationBarTitle({
  35. title:ProjectName
  36. })
  37. this.personInfo=this.jphelp.getPersonInfo();
  38. },
  39. methods: {
  40. loginset(response){
  41. var token = response ? response.data.token : '';
  42. this.jphelp.setToken(token);
  43. this.jphelp.setPersonInfo(response.data.user);
  44. this.jphelp.setPersonInfoPlus(response.data)
  45. //this.gotoUrl("pages/user/index")
  46. },
  47. jpAmount(amount){
  48. if(amount){
  49. return amount.toFixed(2)
  50. }else{
  51. return "0.00"
  52. }
  53. },
  54. substrDate(date){
  55. if(date){
  56. return date.substr(0,11)
  57. }
  58. return ''
  59. },
  60. gotoUrl(url) {
  61. var mod = {}
  62. mod.clickUrl = url
  63. if (mod.clickUrl == null) {
  64. } else if (mod.clickUrl.indexOf('http') == 0) {
  65. window.location = mod.clickUrl ;
  66. } else if (mod.clickUrl.indexOf('#/') == 0) {
  67. if (mod.clickUrl.indexOf("?") == -1) {
  68. mod.clickUrl += '?';
  69. }
  70. var url = mod.clickUrl.split("#")[1]
  71. //window.location = mod.clickUrl;
  72. uni.navigateTo({
  73. url: url
  74. })
  75. } else if (mod.clickUrl == '#' || mod.clickUrl == '') {
  76. } else {
  77. uni.navigateTo({
  78. url: mod.clickUrl
  79. })
  80. }
  81. }
  82. }
  83. })
  84. Vue.config.productionTip = false
  85. App.mpType = 'app'
  86. const app = new Vue({
  87. ...App
  88. })
  89. app.$mount()