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