12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import Vue from 'vue'
- import App from './App'
- import { config } from './config/config'
- import store from './store'
- import Request from '@/js_sdk/luch-request/luch-request/index.js';
- const http = new Request();
- http.interceptors.response.use((response) => {
- if (response.data.code == 1) {
- uni.showToast({
- icon:'none',
- mask:false,
- title:`${response.data.msg}`,
- duration: 2000
- });
- return Promise.reject(response)
- };
-
- if(response.data.code == 401){
- uni.showToast({
- title:response.data.message + " 即将跳转到登录页",
- icon:"none",
- duration:2000
- });
- setTimeout(i=>{
- uni.navigateTo({
- url: '/pages/login/loginType',
- fail:function(err){
- console.log(err)
- }
- });
- },2000);
- return Promise.reject(response)
-
- };
-
- if (response.config.custom.verification) {
- return response.data
- }
-
- return response
- }, (response) => {
- console.log(response);
- return Promise.reject(response)
- });
- import './utils/filter'
- const msg = (title, duration=1500, mask=false, icon='none')=>{
- if(Boolean(title) === false){
- return;
- }
- uni.showToast({
- title,
- duration,
- mask,
- icon
- });
- };
- const href = (data,type = 1) =>{
- uni.navigateTo({
- url:data,
- fail:function(err){
- console.log('navigateTo fail',err)
- }
- })
- };
- Vue.config.productionTip = false;
- Vue.prototype.$api = {msg,http,href};
- Vue.prototype.$getimg = config.imgUrl;
- Vue.prototype.$getInnerImg = config.innerImgUrl;
- Vue.prototype.$onlineImg = config.onlineImg;
- Vue.prototype.$placeImg = config.placeImg;
- Vue.prototype.$qnyImg = config.qnyImg;
- Vue.prototype.$store = store;
- Vue.prototype.config = config;
- App.mpType = 'app'
- const app = new Vue({
- ...App
- })
- app.$mount()
|