main.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. var IS_WEIXIN = /MicroMessenger/.test(window.navigator.userAgent)
  6. var IS_ALI = /AlipayClient/.test(window.navigator.userAgent)
  7. if (IS_ALI) {
  8. getALIOpenId.init()
  9. } else {
  10. getOpenId.init()
  11. }
  12. import mixin from './apis/utils/mixin.js'
  13. Vue.prototype.carhelp = mixin
  14. import Vconsole from 'vconsole'
  15. //import uView from "uview-ui";
  16. import uView from '@/uni_modules/uview-ui'
  17. Vue.use(uView);
  18. Vue.mixin({
  19. updated: function() {
  20. this.$nextTick(function() {
  21. var g = '';
  22. var aaa = this.carhelp.get("getElderModeClass");
  23. if (aaa == "长辈模式") {
  24. g = true;
  25. } else {
  26. g = false;
  27. }
  28. var body = document.getElementsByTagName('uni-page-body')[0].childNodes;
  29. classold(g, body);
  30. function classold(g, list) {
  31. for (var i = 0; i < list.length; i++) {
  32. try {
  33. var myclass = list[i].getAttribute("class");
  34. if (myclass) {
  35. myclass = myclass.trim().replace("oldTextClassF", "");
  36. } else {
  37. myclass = ""
  38. }
  39. if (g) {
  40. myclass = myclass.trim()
  41. myclass = " oldTextClassF " + myclass;
  42. } else {
  43. }
  44. list[i].setAttribute("class", myclass);
  45. } catch (e) {
  46. console.log("---error--classold--")
  47. console.log(list[i])
  48. }
  49. }
  50. }
  51. })
  52. },
  53. onReady() {
  54. },
  55. onLoad(option) {
  56. if (option.test == 'test') {
  57. let vConsole = new Vconsole()
  58. }
  59. },
  60. methods: {
  61. showNumJP(val){
  62. if(val||val==0){
  63. val=""+val
  64. if(val.indexOf(".")>-1){
  65. val= val.substring(0,val.indexOf(".")+3);
  66. }
  67. try{
  68. val = parseFloat(val).toFixed(2);
  69. }catch(e){
  70. console.log("error +++"+e)
  71. }
  72. }
  73. return val
  74. },
  75. gotoUrl(url) {
  76. uni.navigateTo({
  77. url: "/" + url
  78. })
  79. }
  80. }
  81. })
  82. Vue.config.productionTip = false
  83. App.mpType = 'app'
  84. const app = new Vue({
  85. ...App
  86. })
  87. app.$mount()