diff --git a/.env.development b/.env.development index b661567..d786ffd 100644 --- a/.env.development +++ b/.env.development @@ -1 +1,2 @@ -VITE_API_BASE_URL = http://192.168.0.14:11997 +# VITE_API_BASE_URL = http://192.168.0.14:11997 +VITE_API_BASE_URL = /api diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index 222b0cf..7bc311a 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -162,15 +162,10 @@ const getUserInfo = () => { // 存储用户信息 memberStore.setUserInfo(res.data) - - if (res.data.loginType.includes(1)) { - uni.$u.toast('登录成功') - setTimeout(() => { - uni.switchTab({ url: '/pages/workbenches/index' }) - }, 500) - } else { - uni.$u.toast('当前用户暂无登录APP权限,请联系管理员') - } + uni.$u.toast('登录成功') + setTimeout(() => { + uni.switchTab({ url: '/pages/workbenches/index' }) + }, 500) } }) } diff --git a/src/services/login.js b/src/services/login.js index e47af98..e18d658 100644 --- a/src/services/login.js +++ b/src/services/login.js @@ -1,18 +1,32 @@ import { http } from '@/utils/http' +import { encrypt, decrypt } from '@/utils/encrypt' // 引入加解密方法 // 登录接口 export const loginApi = (data) => { return http({ method: 'POST', - url: '/imgTool/login', - isEncrypt: true, - isPassWord: false, + url: '/imgTool/loginApp', + // isEncrypt: true, + // isPassWord: false, data, header: { 'Content-Type': 'application/x-www-form-urlencoded', }, }) } +// 登录接口 +// export const loginApi = (data) => { +// return http({ +// method: 'POST', +// url: '/imgTool/login', +// isEncrypt: true, +// isPassWord: false, +// data, +// header: { +// 'Content-Type': 'application/x-www-form-urlencoded', +// }, +// }) +// } // 获取用户信息 export const getUserInfoApi = () => { return http({ diff --git a/src/utils/http.js b/src/utils/http.js index 71cbf34..605f160 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -85,6 +85,7 @@ export const http = (options) => { uni.request({ ...options, success(res) { + console.log(res, 'res') // 1. 判断是否请求成功 if (res.statusCode >= 200 && res.statusCode < 300) { if (res.data.code >= 200 && res.data.code < 300) { @@ -105,7 +106,7 @@ export const http = (options) => { } else if (res.data.code === 500) { uni.showToast({ icon: 'none', - title: `${res.data.msg}`, + title: res?.data?.message, }) } } else if (res.statusCode === 401) { @@ -122,7 +123,7 @@ export const http = (options) => { // 3. 其他错误 uni.showToast({ icon: 'none', - title: '请求失败,请切换网络后尝试', + title: res?.data?.message || '请求失败,请切换网络后尝试', }) reject(res) } @@ -131,7 +132,7 @@ export const http = (options) => { fail(err) { uni.showToast({ icon: 'none', - title: '请求失败,请切换网络后尝试', + title: err?.message || '请求失败,请切换网络后尝试', }) console.log(err, '请求失败') reject(err) diff --git a/vite.config.js b/vite.config.js index 164aff8..ab6c0ba 100644 --- a/vite.config.js +++ b/vite.config.js @@ -8,9 +8,9 @@ export default defineConfig({ proxy: { // 在此处编写代理规则 '/api': { - // target: 'http://192.168.0.133:11997', // 梁超 + target: 'http://192.168.0.133:11997', // 梁超 // target: 'http://192.168.0.137:11997', // 方亮 - target: 'http://192.168.0.60:11997', // 赵福海 + // target: 'http://192.168.0.60:11997', // 赵福海 // target: 'http://192.168.0.39:11997', // 陈长文 changeOrigin: true, rewrite: (path) => {