12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import Vue from 'vue';
- import App from './App';
- Vue.config.productionTip = false;
- App.mpType = 'app';
- // 接口封装
- import request from '@/https/http.js'
- Vue.prototype.$http = request;
- // 请求地址
- import { baseUrl } from '@/https/url.js'
- Vue.prototype.$httpUrl = baseUrl; //请求地址上传图片路径
- //校验手机格式
- function checkMobile(mobile) {
- return RegExp(/^1[34578]\d{9}$/).test(mobile);
- }
- // 校验身份证
- var id=/^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}([0-9]|x|X)$/;
- function cardtest (idCard){
- return id.test(idCard)
- };
- Vue.prototype.$checkMobile = checkMobile;
- Vue.prototype.$checkId = cardtest;
- import tabBar from "@/components/tabBar.vue"
- Vue.component('tabBar', tabBar)
- // 引入全局uView
- import uView from 'uview-ui';
- Vue.use(uView);
- Vue.mixin({
- onLoad(option) {
- this.initLogin()
- },
- methods: {
- initLogin(){
- let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
- let curRoute = routes[routes.length - 1].route //获取当前页面路由
- console.log(curRoute)
- if(!uni.getStorageSync('token')){
- if(!(curRoute == 'pages/login/login' || curRoute == 'pages/login/agreement' || curRoute == 'pages/login/forget' || curRoute == 'pages/login/perfect' || curRoute == 'pages/login/change-gongsi')){
- uni.reLaunch({
- url: '/pages/login/login'
- });
- }
- }
- },
- }
- })
- const app = new Vue({
- ...App
- });
- app.$mount();
|