修改配置

This commit is contained in:
jjLv 2024-11-20 10:18:19 +08:00
parent 26c1e3d2dc
commit dad0c6708d
5 changed files with 13 additions and 5 deletions

View File

@ -2,7 +2,7 @@
"version" : "1.0",
"configurations" : [
{
"playground" : "custom",
"playground" : "standard",
"type" : "uni-app:app-android"
},
{

View File

@ -20,9 +20,10 @@
</template>
<script setup>
import { reactive, ref } from 'vue'
import { onMounted, reactive, ref } from 'vue'
import { appLoginAPI, getUserInfoAPI } from '@/services/index.js'
import { useMemberStore } from '@/stores'
import { onLoad } from '@dcloudio/uni-app'
const memberStore = useMemberStore()
//

View File

@ -4,6 +4,7 @@ import { http } from '@/utils/http'
* 登录接口
*/
export const appLoginAPI = (data) => {
console.log('999')
return http({
method: 'POST',
url: '/auth/login',

View File

@ -6,7 +6,7 @@ import { useMemberStore } from '@/stores'
* baseURL 设置请求ip地址和端口
*/
const ENV = process.env.NODE_ENV
export const baseURL = ENV === 'development' ? '/api' : '***'
export const baseURL = ENV === 'development' ? 'http://192.168.2.246:18080' : '***'
/**
* httpInterceptor 分别拦截 request uploadFile 请求
*/
@ -65,7 +65,12 @@ export const http = (options) => {
url: '/pages/login/index',
})
reject(res)
}
} else if (res.data.code === 500) {
uni.showToast({
icon: 'none',
title: `${res.data.msg}`,
})
}
} else if (res.statusCode === 401) {
// 2. 401 表示token过期 去往登录页重新登录
const memberStore = useMemberStore()

View File

@ -20,7 +20,8 @@ export default defineConfig({
proxy: {
// 在此处编写代理规则
'/api': {
target: 'http://192.168.2.76:18080',
// target: 'http://192.168.2.76:18080',
target: 'http://localhost:18080',
changeOrigin: true,
rewrite: (path) => {
return path.replace(/\/api/, '')