Merge branch 'master' of https://gitee.com/lvYeJu/lane-crawford-3
This commit is contained in:
@@ -2,7 +2,6 @@ import { createApp } from 'vue'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
// import ElementPlus from 'element-plus'
|
||||
import store from './stores/index'
|
||||
import 'normalize.css/normalize.css'
|
||||
import './assets/css/style.css'
|
||||
@@ -12,14 +11,12 @@ import "virtual:svg-icons-register";
|
||||
|
||||
import flexible from "./utils/flexible.js";
|
||||
|
||||
//引入element-plus相关样式
|
||||
import 'element-plus/dist/index.css'
|
||||
import './assets/main.css'
|
||||
import "./router/router-config" // 路由守卫,做动态路由的地方
|
||||
|
||||
var lastTouchEnd = 0;
|
||||
let lastTouchEnd = 0;
|
||||
document.addEventListener('touchend', function(event) {
|
||||
var now = (new Date()).getTime();
|
||||
const now = (new Date()).getTime();
|
||||
if (now - lastTouchEnd <= 300) {
|
||||
event.preventDefault();
|
||||
}
|
||||
@@ -27,7 +24,6 @@ document.addEventListener('touchend', function(event) {
|
||||
}, false);
|
||||
|
||||
const app = createApp(App)
|
||||
// app.use(ElementPlus)
|
||||
app.use(router)
|
||||
.use(store)
|
||||
.component("SvgIcon", SvgIcon)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import axios from 'axios'
|
||||
// import { Message, Loading, MessageBox } from 'element-ui'
|
||||
import { ElMessage, ElLoading, ElMessageBox } from 'element-plus'
|
||||
import { showToast, showLoading, showConfirmDialog, closeToast } from 'vant'
|
||||
import { useUserInfoStore } from '@/stores/modules/userInfo'
|
||||
const store = useUserInfoStore()
|
||||
import { getLocal } from '@/utils/local'
|
||||
@@ -62,17 +61,18 @@ service.interceptors.response.use(
|
||||
const res = response.data
|
||||
// 处理异常的情况
|
||||
if (res.errCode != 0) {
|
||||
ElMessage({
|
||||
showToast({
|
||||
message: res.errMsg,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
type: 'fail',
|
||||
duration: 5000
|
||||
})
|
||||
// 403:非法的token; 50012:其他客户端登录了; 401:Token 过期了;
|
||||
if (res.errCode === 403 || res.errCode === 50012 || res.errCode === 401) {
|
||||
ElMessageBox.confirm('你已被登出,可以取消继续留在该页面,或者重新登录', '确定登出', {
|
||||
showConfirmDialog({
|
||||
title: '确定登出',
|
||||
message: '你已被登出,可以取消继续留在该页面,或者重新登录',
|
||||
confirmButtonText: '重新登录',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
cancelButtonText: '取消'
|
||||
}).then(() => {
|
||||
store.loginOut().then(() => {
|
||||
location.reload() // 为了重新实例化vue-router对象 避免bug
|
||||
@@ -98,10 +98,10 @@ service.interceptors.response.use(
|
||||
closeLoading()
|
||||
}
|
||||
console.log('err' + error) // for debug
|
||||
ElMessage({
|
||||
showToast({
|
||||
message: error.message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
type: 'fail',
|
||||
duration: 5000
|
||||
})
|
||||
return Promise.reject(error)
|
||||
}
|
||||
@@ -154,18 +154,16 @@ const LoadingInstance: { _target: any; _count: number } = {
|
||||
_count: 0
|
||||
}
|
||||
function openLoading(loadingDom: any) {
|
||||
LoadingInstance._target = ElLoading.service({
|
||||
lock: true,
|
||||
text: '数据正在加载中',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(25, 32, 53, 1)',
|
||||
target: loadingDom || 'body'
|
||||
LoadingInstance._target = showLoading({
|
||||
message: '数据正在加载中',
|
||||
forbidClick: true,
|
||||
background: 'rgba(25, 32, 53, 1)'
|
||||
})
|
||||
}
|
||||
function closeLoading() {
|
||||
if (LoadingInstance._count > 0) LoadingInstance._count--
|
||||
if (LoadingInstance._count === 0) {
|
||||
LoadingInstance._target.close()
|
||||
LoadingInstance._target?.close()
|
||||
LoadingInstance._target = null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user