main.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. import 'remixicon/fonts/remixicon.css'
  9. var IS_WEIXIN = /MicroMessenger/.test(window.navigator.userAgent)
  10. var IS_ALI = /AlipayClient/.test(window.navigator.userAgent)
  11. // if(IS_WEIXIN){
  12. // }
  13. if(IS_ALI){
  14. getALIOpenId.init()
  15. }else{
  16. getOpenId.init()
  17. }
  18. window.wx = {}
  19. import mixin from './utils/mixin.js'
  20. Vue.config.ignoredElements.push("wx-open-subscribe");
  21. Vue.prototype.carhelp = mixin
  22. // 先运行yarn 初始化
  23. import Vconsole from 'vconsole'
  24. //import './router' // 引入路由
  25. import router from './bobo-router'
  26. // main.js
  27. // 先运行yarn 初始化
  28. import uView from "uview-ui";
  29. Vue.use(uView);
  30. Vue.config.productionTip = false
  31. App.mpType = 'app'
  32. const app = new Vue({
  33. ...App
  34. })
  35. //Vue.component('my-common',MyCommon)
  36. //Vue.component('car-loading',CarLoading)
  37. //Vue.use(mixin)
  38. Vue.mixin({
  39. updated: function() {
  40. this.$nextTick(function() {
  41. var nononoElderModeClass = document.getElementById("nononoElderModeClass")
  42. if(nononoElderModeClass){
  43. return false;
  44. }
  45. var g = '';
  46. var aaa=this.carhelp.get("getElderModeClass");
  47. if(aaa == "长辈模式") {
  48. g = true;
  49. } else {
  50. g = false;
  51. //g = true;
  52. }
  53. var style1="";
  54. var style2="";
  55. // 仅在整个视图都被重新渲染之后才会运行的代码
  56. var list = document.getElementsByClassName("oldTextjp")
  57. var list2 = document.getElementsByClassName("oldTextjp2")
  58. var body= document.getElementsByTagName('uni-page-body')[0].childNodes;
  59. classold(g,body);
  60. styleold(g,list,true)
  61. styleold(g,list2,false)
  62. function classold(g,list){
  63. for (var i = 0; i < list.length; i++) {
  64. try{
  65. var myclass=list[i].getAttribute("class");
  66. if(myclass){
  67. myclass = myclass.trim().replace("oldTextClassF","");
  68. }else{
  69. myclass = ""
  70. }
  71. if(g){
  72. myclass = myclass.trim()
  73. myclass=" oldTextClassF "+myclass;
  74. }else{
  75. }
  76. list[i].setAttribute("class",myclass);
  77. }catch(e){
  78. console.log("---error--classold--")
  79. console.log(list[i])
  80. }
  81. }
  82. }
  83. function styleold(g,list,jp){
  84. for (var i = 0; i < list.length; i++) {
  85. var edit = list[i].getAttribute("oldstyle-edit");
  86. if(!edit){
  87. list[i].setAttribute("oldstyle-edit",list[i].style.cssText);
  88. }else{
  89. edit=""
  90. }
  91. if (g) {
  92. var str = list[i].getAttribute("oldstyle");
  93. if(jp){
  94. str+=";font-weight:bold !important;"
  95. }
  96. if(str){
  97. list[i].style = str
  98. }
  99. }else{
  100. list[i].style=edit
  101. }
  102. }
  103. }
  104. var list_u_title = document.getElementsByClassName("u-title")
  105. var u_cell_title = document.getElementsByClassName("u-cell_title")
  106. style1 ="line-height: 20px;color: rgb(96, 98, 102); font-size: 16px; overflow: unset;"
  107. style2 ="color: rgb(96, 98, 102); font-size: 16px; font-weight: normal;"
  108. //styleg(g,style1,style2,list_u_title)
  109. styleg(g,style1,style2,u_cell_title)
  110. style1 ="line-height: 20px;color: rgb(16, 16, 16); font-size: 16px; overflow: unset;"
  111. var u_cell__label = document.getElementsByClassName("u-cell__label")
  112. styleg(g,style1,style2,u_cell__label)
  113. var list_u_value = document.getElementsByClassName("u-cell__value")
  114. style1 ="line-height: 20px;color: rgb(96, 98, 102); font-size: 16px; overflow: unset;"
  115. style2 ="color: rgb(96, 98, 102); font-size: 15px; font-weight: normal;"
  116. styleg(g,style1,style2,list_u_value)
  117. function styleg(bl,style1,style2,suzhu){
  118. for (var i = 0; i < suzhu.length; i++) {
  119. if (g) {
  120. suzhu[i].style =style1;
  121. }else{
  122. suzhu[i].style =style2;
  123. }
  124. }
  125. }
  126. })
  127. },
  128. onReady() {
  129. },
  130. onLoad(option) {
  131. if (option.test == 'test') {
  132. let vConsole = new Vconsole()
  133. }
  134. },
  135. methods: {
  136. discountRatio10(value){
  137. //value=80;
  138. var val=value;
  139. // if([10,20,30,40,50,60,70,80,90].indexOf(value)!=-1){
  140. // }
  141. val=value/10
  142. if(val||val==0){
  143. val=""+val
  144. if(val.indexOf(".")>-1){
  145. val= val.substring(0,val.indexOf(".")+2);
  146. // if(value<10){
  147. // }else{
  148. // val= val.substring(0,val.indexOf("."));
  149. // }
  150. if(parseInt(val)==parseFloat(val)){
  151. val=parseInt(val);
  152. }
  153. }
  154. }
  155. if([10,20,30,40,50,60,70,80,90].indexOf(value)!=-1){
  156. val=val+".0"
  157. }
  158. return val
  159. },
  160. gotoUrl(url) {
  161. uni.navigateTo({
  162. url: "/" + url
  163. })
  164. }
  165. }
  166. })
  167. app.$mount()