123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- 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<item.num2){
- obj=item
- }
- }
- return obj
- },
- tagNameBy(tagName,i){
- var str=""
-
- if(tagName){
-
- if(tagName.indexOf('@')!=-1){
- var sz=tagName.split('@')
- if(i==0){
- str=sz[0]
- }
- if(i==1){
- str=sz[1]
- }
-
- }else{
- if(i==0){
- str=tagName
- }
- }
-
- }
-
- return str
- },
- quickChargeReduceMethod1(station){
- //普通满减活动
- if(station.quickChargeReduceResult&&(!station.quickChargeJoinActivity|| station.quickChargeJoinActivity==0)){
-
- return true
- }
- return false
- },
- quickChargeReduceMethod2(station){
- //转盘
- if(station.quickChargeReduceResult&& station.quickChargeJoinActivity==1){
-
- return true
- }
- return false
- },
- branchParameterBl(val){
-
- if(val=="ud"||val=="youdian"){
-
- return process.car.branchParameter=="youdian"
- }
- return process.car.branchParameter=="51team"
- },
- setValidity(periodOfValidity){
- if(periodOfValidity<=365){
- return periodOfValidity+'天';
- }else{
- return parseInt(periodOfValidity/365)+'年'+(periodOfValidity%365==0?'':periodOfValidity%365+'天')
- }
- },
- showNumJP(val){
- if(val||val==0){
- val=""+val
- if(val.indexOf(".")>-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()
|