update: 网络请求更新

This commit is contained in:
admin 2024-06-04 10:35:28 +08:00
parent 87bd3b0544
commit e99c77e58e
4 changed files with 16 additions and 7 deletions

View File

@ -3,7 +3,7 @@ const development = {
// VITE_APP_BASE_URL: 'http://47.100.31.83:8081',
// VITE_APP_BASE_URL: 'https://47.100.31.83:8081',
// appid: '',
VITE_APP_BASE_URL: 'http://cloud.52zaisheng.cn',
VITE_APP_BASE_URL: 'https://cloud.52zaisheng.cn',
appid: 'wx9251d74fe0e87028',
}
@ -13,7 +13,7 @@ const test = {
}
const production = {
VITE_APP_BASE_URL: 'http://cloud.52zaisheng.cn',
VITE_APP_BASE_URL: 'https://cloud.52zaisheng.cn',
appid: 'wx9251d74fe0e87028',
}

View File

@ -297,8 +297,8 @@ const handleSelect = (v: any) => {
state.isShow = false;
state.dpObj = v;
model1.userInfo.dpName = v.name;
console.log(v.dbIp)
store.setChildPath(v.dbIp)
console.log(v.dbIp);
store.setChildPath(v.dbIp);
};
const state = reactive({
@ -306,13 +306,13 @@ const state = reactive({
isShow: false,
dpObj: {},
});
//
ProfileApi.getDbInfo({}).then((res) => {
if (res.code === 200) {
state.dpList = res.data.map((item: any) => {
return { name: item.dbName, ...item };
});
console.log(state.dpList);
}
});
</script>

View File

@ -15,7 +15,8 @@ export const useMemberStore = defineStore(
},
menusList: [],
menusNameList: [],
childPath: '/test/sh0001'
childPath: '/test/sh0001',
err: null
});
// 保存会员信息,登录时使用
@ -28,6 +29,11 @@ export const useMemberStore = defineStore(
profile.value.childPath = v
}
const setErr= (v: any) => {
profile.value.err = v
}
// 清理会员信息,退出时使用
const clearProfile = () => {
@ -49,6 +55,7 @@ export const useMemberStore = defineStore(
profile,
setProfile,
setChildPath,
setErr,
clearProfile
};
},

View File

@ -18,7 +18,7 @@ const obj = {
options.timeout = 10000;
// 拼接完整路径
if (!options.url.startsWith("http")) {
if ('/prod/gateway/api/db/getDbInfo' !== options.url) {
if (options.url.indexOf('/prod/gateway/api/db/getDbInfo') === -1 ) {
options.url = baseUrl + store.profile.childPath + options.url;
} else {
options.url = baseUrl + options.url;
@ -139,7 +139,9 @@ export const http = <T>(options: UniApp.RequestOptions) => {
fail(err) {
uni.showToast({
icon: "none",
// title: JSON.stringify(err),
title: "网络错误,请检查网络",
});
reject(err);
},