Commit ceef09d3 authored by 罗超's avatar 罗超

1

parent 2da2d653
...@@ -217,12 +217,3 @@ export let isLogin = () => { ...@@ -217,12 +217,3 @@ export let isLogin = () => {
} }
} }
//防抖
export function debounce(func) {
let timer = null;
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
func()
}, 1000)
}
\ No newline at end of file
import { isLogin } from './index' import { isLogin } from './index'
import request from './request.js'
export default { export default {
install: (app, options) => { install: (app, options) => {
app.config.globalProperties.$isLogin = isLogin app.config.globalProperties.$isLogin = isLogin
app.config.globalProperties.$request = (url,data,method)=>{
return request({
url,
data,
method,
})
}
} }
} }
\ No newline at end of file
//请求教育接口 //请求教育接口
let host = '' let host = ''
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
host = 'http://192.168.20.17:8017/api' // host = 'http://192.168.20.17:8017/api'
// host = 'http://192.168.20.24:8300/api' host = 'http://192.168.10.65:8085/api'
// host = 'https://eduapi.oytour.com/api' // host = 'https://eduapi.oytour.com/api'
} else { } else {
host = 'https://eduapi.oytour.com/api' host = 'https://eduapi.oytour.com/api'
...@@ -26,22 +26,41 @@ let request = (param) => { ...@@ -26,22 +26,41 @@ let request = (param) => {
if (res.data.Code === 1) { if (res.data.Code === 1) {
resolve(res.data) resolve(res.data)
} else { } else {
Toast({ // Toast({
type: 'fail', // type: 'fail',
message: res.data.Message, // message: res.data.Message,
onClose: () => { // onClose: () => {
// if (res.data.Code === 10001 || res.data.Code === 10000) {
// uni.reLaunch({
// url: '/pages/login/login'
// });
// } else {
// if (res.data.Message.indexOf('用户凭证为空') != -1 || res.data.Message.indexOf('用户凭证失效') != -1) {
// uni.reLaunch({
// url: '/pages/login/login'
// });
// }
// }
// },
// });
uni.showToast({
title: res.data.Message,
duration: 2000,
icon: "error",
success() {
if (res.data.Code === 10001 || res.data.Code === 10000) { if (res.data.Code === 10001 || res.data.Code === 10000) {
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}); });
} else { } else {
if (res.data.Message.indexOf('用户凭证为空') != -1 || res.data.Message.indexOf('用户凭证失效') != -1) { if (res.data.Message.indexOf('用户凭证为空') != -1 || res.data
.Message.indexOf('用户凭证失效') != -1) {
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}); });
} }
} }
}, }
}); });
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment