123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- import Vue from 'vue'
- import App from './App'
- import router from './router'
- import YDUI from 'vue-ydui';
- import 'vue-ydui/dist/ydui.base.css';
- import 'vue-ydui/dist/ydui.rem.css';
- import 'vant/lib/index.css';
- import 'vue-slider-component/theme/default.css'
- import './assets/icon/iconfont.css'
- import axios from 'axios'
- import apiUrl from './global'
- Vue.prototype.GLOBAL = apiUrl;
- axios.defaults.baseURL=apiUrl.BASE_URL;
- Vue.prototype.$http=axios;
- import { Confirm, Alert, Toast, Notify, Loading } from 'vue-ydui/dist/lib.rem/dialog';
- Vue.prototype.$dialog = {
- confirm: Confirm,
- alert: Alert,
- toast: Toast,
- notify: Notify,
- loading: Loading,
- };
- Vue.use(YDUI);
- Vue.config.productionTip = false
- router.beforeEach((to,from,next)=>{
-
-
-
- if(to.name == 'vehicle' || to.name == 'vehicledecode'){
- console.log('ddddddddddddddddd')
-
- next()
- return
- }
- let query = to.query || {};
- if (query.openid) {
- localStorage.setItem('openid', query.openid);
- }
-
- let openid = localStorage.getItem("openid");
- openid = '12222111';
- let loginFlag = false;
-
-
- if (to.meta.role === 'yys') {
- let yysUserid = localStorage.getItem('yysUserid');
- loginFlag = (openid && yysUserid);
- if (to.name === 'yys_login') {
- next();
- } else {
- if (loginFlag) {
- next();
- } else {
- next('/yys_login');
- }
- }
- } else {
-
- let userid = localStorage.getItem('userid');
- let userType = localStorage.getItem('userType');
- loginFlag = (openid && userid && userType);
- if (to.name === 'first') {
- next();
- } else if (to.name ==='login' || to.name === 'register' || to.name === 'reset_pwd') {
- if (userType) {
- next();
- } else {
- next('/');
- }
- } else {
- if (!loginFlag) {
- next('/first');
- } else {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- }
- }
- });
- var u = navigator.userAgent;
- var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
- var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
- if (isAndroid) {
- localStorage.setItem('userAgent', 'android');
- } else if (isiOS) {
- localStorage.setItem('userAgent', 'ios');
- } else {
- localStorage.setItem('userAgent', 'other');
- }
- localStorage.setItem('mainUrl', location.href.split('#')[0]);
- new Vue({
- el: '#app',
- router,
- components: { App },
- template: '<App/>'
- })
|