import Vue from 'vue' import App from './App' //import MyCommon from '@/components/Common.vue' //import CarLoading from '@/components/Loading.vue' import getOpenId from './utils/init.js' import { newDate, } from '@/utils' //支付宝的 import getALIOpenId from './utils/initALI.js' import 'remixicon/fonts/remixicon.css' import './assets/font/font.css' var IS_WEIXIN = /MicroMessenger/.test(window.navigator.userAgent) var IS_ALI = /AlipayClient/.test(window.navigator.userAgent) // if(IS_WEIXIN){ // } if(IS_ALI){ getALIOpenId.init() }else{ getOpenId.init() } window.wx = {} import mixin from './utils/mixin.js' Vue.config.ignoredElements.push("wx-open-subscribe"); Vue.prototype.carhelp = mixin // 先运行yarn 初始化 import Vconsole from 'vconsole' //import './router' // 引入路由 import router from './bobo-router' // main.js // 先运行yarn 初始化 import uView from "uview-ui"; Vue.use(uView); Vue.config.productionTip = false App.mpType = 'app' const app = new Vue({ ...App }) //Vue.component('my-common',MyCommon) //Vue.component('car-loading',CarLoading) //Vue.use(mixin) Vue.mixin({ updated: function() { this.$nextTick(function() { var nononoElderModeClass = document.getElementById("nononoElderModeClass") if(nononoElderModeClass){ return false; } var g = ''; var aaa=this.carhelp.get("getElderModeClass"); if(aaa == "长辈模式") { g = true; } else { g = false; //g = true; } var style1=""; var style2=""; // 仅在整个视图都被重新渲染之后才会运行的代码 var list = document.getElementsByClassName("oldTextjp") var list2 = document.getElementsByClassName("oldTextjp2") var body= document.getElementsByTagName('uni-page-body')[0].childNodes; classold(g,body); styleold(g,list,true) styleold(g,list2,false) function classold(g,list){ for (var i = 0; i < list.length; i++) { try{ var myclass=list[i].getAttribute("class"); if(myclass){ myclass = myclass.trim().replace("oldTextClassF",""); }else{ myclass = "" } if(g){ myclass = myclass.trim() myclass=" oldTextClassF "+myclass; }else{ } list[i].setAttribute("class",myclass); }catch(e){ console.log("---error--classold--") console.log(list[i]) } } } function styleold(g,list,jp){ for (var i = 0; i < list.length; i++) { var edit = list[i].getAttribute("oldstyle-edit"); if(!edit){ list[i].setAttribute("oldstyle-edit",list[i].style.cssText); }else{ edit="" } if (g) { var str = list[i].getAttribute("oldstyle"); if(jp){ str+=";font-weight:bold !important;" } if(str){ list[i].style = str } }else{ list[i].style=edit } } } var list_u_title = document.getElementsByClassName("u-title") var u_cell_title = document.getElementsByClassName("u-cell_title") style1 ="line-height: 20px;color: rgb(96, 98, 102); font-size: 16px; overflow: unset;" style2 ="color: rgb(96, 98, 102); font-size: 16px; font-weight: normal;" //styleg(g,style1,style2,list_u_title) styleg(g,style1,style2,u_cell_title) style1 ="line-height: 20px;color: rgb(16, 16, 16); font-size: 16px; overflow: unset;" var u_cell__label = document.getElementsByClassName("u-cell__label") styleg(g,style1,style2,u_cell__label) var list_u_value = document.getElementsByClassName("u-cell__value") style1 ="line-height: 20px;color: rgb(96, 98, 102); font-size: 16px; overflow: unset;" style2 ="color: rgb(96, 98, 102); font-size: 15px; font-weight: normal;" styleg(g,style1,style2,list_u_value) function styleg(bl,style1,style2,suzhu){ for (var i = 0; i < suzhu.length; i++) { if (g) { suzhu[i].style =style1; }else{ suzhu[i].style =style2; } } } }) }, onShow(){ }, onReady() { }, onLoad(option) { if (option.test == 'test') { let vConsole = new Vconsole() } this.projectName = process.car.ProjectName; //this.branchParameter=process.car.branchParameter; console.log(process.car.branchParameter) var ProjectName=process.car.ProjectName; if(process.car.NODE_ENV=='dev'||process.car.NODE_ENV=='test'){ ProjectName+='('+process.car.NODE_ENV+')'; } uni.setNavigationBarTitle({ title:ProjectName }) }, methods: { userChargingAmountMethod(obj){ var m=obj.money //m=2760 var sz=[ { num1:3000, num2:999999999, num3:800, }, { num1:2000, num2:2500, num3:427, }, { num1:1000, num2:1500, num3:133, }, { num1:500, num2:750, num3:40, }, ] var obj={} for(var i in sz){ var item=sz[i] if(m-1){ val= val.substring(0,val.indexOf(".")+3); } try{ val = parseFloat(val).toFixed(2); }catch(e){ console.log("error +++"+e) } } return val }, channelNoShow(channelNo,manufacturer,customNo ){ if(customNo){ return customNo } var text=channelNo; if(manufacturer=='szwinline'||manufacturer=='sinexcel'){ switch(channelNo){ case '1': text="A"; break; case '2': text="B"; break; case '3': text="C"; break; case 1: text="A"; break; case 2: text="B"; break; case 3: text="C"; break; } } return text }, discountRatio10(value){ //value=80; var val=value; // if([10,20,30,40,50,60,70,80,90].indexOf(value)!=-1){ // } val=value/10 if(val||val==0){ val=""+val if(val.indexOf(".")>-1){ val= val.substring(0,val.indexOf(".")+2); // if(value<10){ // }else{ // val= val.substring(0,val.indexOf(".")); // } if(parseInt(val)==parseFloat(val)){ val=parseInt(val); } } } if([10,20,30,40,50,60,70,80,90].indexOf(value)!=-1){ val=val+".0" } return val }, gotoUrl(url,bl) { if(bl){ uni.redirectTo({ url: "/" + url }) }else{ uni.navigateTo({ url: "/" + url }) } }, gotoUrl2(url) { var mod = {} mod.clickUrl = url if (mod.clickUrl == null) { } else if (mod.clickUrl.indexOf('http') == 0) { window.location = mod.clickUrl ; } else if (mod.clickUrl.indexOf('#/') == 0) { if (mod.clickUrl.indexOf("?") == -1) { mod.clickUrl += '?'; } var url = mod.clickUrl.split("#")[1] //window.location = mod.clickUrl; uni.navigateTo({ url: url }) } else if (mod.clickUrl == '#' || mod.clickUrl == '') { } else { uni.navigateTo({ url: mod.clickUrl }) } } } }) app.$mount()