main.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. import Vue from 'vue'
  2. import App from './App'
  3. //import MyCommon from '@/components/Common.vue'
  4. //import CarLoading from '@/components/Loading.vue'
  5. import getOpenId from './utils/init.js'
  6. //支付宝的
  7. import getALIOpenId from './utils/initALI.js'
  8. var IS_WEIXIN = /MicroMessenger/.test(window.navigator.userAgent)
  9. var IS_ALI = /AlipayClient/.test(window.navigator.userAgent)
  10. // if(IS_WEIXIN){
  11. // }
  12. if(IS_ALI){
  13. getALIOpenId.init()
  14. }else{
  15. getOpenId.init()
  16. }
  17. import mixin from './utils/mixin.js'
  18. Vue.config.ignoredElements.push("wx-open-subscribe");
  19. Vue.prototype.carhelp = mixin
  20. // 先运行yarn 初始化
  21. import Vconsole from 'vconsole'
  22. //import './router' // 引入路由
  23. import router from './bobo-router'
  24. // main.js
  25. // 先运行yarn 初始化
  26. import uView from "uview-ui";
  27. Vue.use(uView);
  28. Vue.config.productionTip = false
  29. App.mpType = 'app'
  30. const app = new Vue({
  31. ...App
  32. })
  33. //Vue.component('my-common',MyCommon)
  34. //Vue.component('car-loading',CarLoading)
  35. //Vue.use(mixin)
  36. Vue.mixin({
  37. updated: function() {
  38. this.$nextTick(function() {
  39. var g = '';
  40. var aaa=this.carhelp.get("getElderModeClass");
  41. if(aaa == "长辈模式") {
  42. g = true;
  43. } else {
  44. g = false;
  45. }
  46. var style1="";
  47. var style2="";
  48. // 仅在整个视图都被重新渲染之后才会运行的代码
  49. var list = document.getElementsByClassName("oldTextjp")
  50. var list2 = document.getElementsByClassName("oldTextjp2")
  51. styleold(g,list,true)
  52. styleold(g,list2,false)
  53. function styleold(g,list,jp){
  54. for (var i = 0; i < list.length; i++) {
  55. var edit = list[i].getAttribute("oldstyle-edit");
  56. if(!edit){
  57. list[i].setAttribute("oldstyle-edit",list[i].style.cssText);
  58. }else{
  59. edit=""
  60. }
  61. if (g) {
  62. var str = list[i].getAttribute("oldstyle");
  63. if(jp){
  64. str+=";font-weight:bold !important;"
  65. }
  66. if(str){
  67. list[i].style = str
  68. }
  69. }else{
  70. list[i].style=edit
  71. }
  72. }
  73. }
  74. var list_u_title = document.getElementsByClassName("u-title")
  75. var u_cell_title = document.getElementsByClassName("u-cell_title")
  76. style1 ="line-height: 20px;color: rgb(96, 98, 102); font-size: 16px; overflow: unset;"
  77. style2 ="color: rgb(96, 98, 102); font-size: 13px; font-weight: normal;"
  78. styleg(g,style1,style2,list_u_title)
  79. styleg(g,style1,style2,u_cell_title)
  80. var list_u_value = document.getElementsByClassName("u-cell__value")
  81. style1 ="line-height: 20px;color: rgb(96, 98, 102); font-size: 16px; overflow: unset;"
  82. style2 ="color: rgb(96, 98, 102); font-size: 13px; font-weight: normal;"
  83. styleg(g,style1,style2,list_u_value)
  84. function styleg(bl,style1,style2,suzhu){
  85. for (var i = 0; i < suzhu.length; i++) {
  86. if (g) {
  87. suzhu[i].style =style1;
  88. }else{
  89. suzhu[i].style =style2;
  90. }
  91. }
  92. }
  93. })
  94. },
  95. onReady() {
  96. },
  97. onLoad(option) {
  98. if (option.test == 'test') {
  99. let vConsole = new Vconsole()
  100. }
  101. },
  102. methods: {
  103. gotoUrl(url) {
  104. uni.navigateTo({
  105. url: "/" + url
  106. })
  107. }
  108. }
  109. })
  110. app.$mount()