update: 网络请求更新
This commit is contained in:
parent
87bd3b0544
commit
e99c77e58e
|
@ -3,7 +3,7 @@ const development = {
|
||||||
// VITE_APP_BASE_URL: 'http://47.100.31.83:8081',
|
// VITE_APP_BASE_URL: 'http://47.100.31.83:8081',
|
||||||
// VITE_APP_BASE_URL: 'https://47.100.31.83:8081',
|
// VITE_APP_BASE_URL: 'https://47.100.31.83:8081',
|
||||||
// appid: '',
|
// appid: '',
|
||||||
VITE_APP_BASE_URL: 'http://cloud.52zaisheng.cn',
|
VITE_APP_BASE_URL: 'https://cloud.52zaisheng.cn',
|
||||||
appid: 'wx9251d74fe0e87028',
|
appid: 'wx9251d74fe0e87028',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ const test = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const production = {
|
const production = {
|
||||||
VITE_APP_BASE_URL: 'http://cloud.52zaisheng.cn',
|
VITE_APP_BASE_URL: 'https://cloud.52zaisheng.cn',
|
||||||
appid: 'wx9251d74fe0e87028',
|
appid: 'wx9251d74fe0e87028',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,8 +297,8 @@ const handleSelect = (v: any) => {
|
||||||
state.isShow = false;
|
state.isShow = false;
|
||||||
state.dpObj = v;
|
state.dpObj = v;
|
||||||
model1.userInfo.dpName = v.name;
|
model1.userInfo.dpName = v.name;
|
||||||
console.log(v.dbIp)
|
console.log(v.dbIp);
|
||||||
store.setChildPath(v.dbIp)
|
store.setChildPath(v.dbIp);
|
||||||
};
|
};
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
@ -306,13 +306,13 @@ const state = reactive({
|
||||||
isShow: false,
|
isShow: false,
|
||||||
dpObj: {},
|
dpObj: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取基地信息
|
// 获取基地信息
|
||||||
ProfileApi.getDbInfo({}).then((res) => {
|
ProfileApi.getDbInfo({}).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
state.dpList = res.data.map((item: any) => {
|
state.dpList = res.data.map((item: any) => {
|
||||||
return { name: item.dbName, ...item };
|
return { name: item.dbName, ...item };
|
||||||
});
|
});
|
||||||
console.log(state.dpList);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -15,7 +15,8 @@ export const useMemberStore = defineStore(
|
||||||
},
|
},
|
||||||
menusList: [],
|
menusList: [],
|
||||||
menusNameList: [],
|
menusNameList: [],
|
||||||
childPath: '/test/sh0001'
|
childPath: '/test/sh0001',
|
||||||
|
err: null
|
||||||
});
|
});
|
||||||
|
|
||||||
// 保存会员信息,登录时使用
|
// 保存会员信息,登录时使用
|
||||||
|
@ -28,6 +29,11 @@ export const useMemberStore = defineStore(
|
||||||
profile.value.childPath = v
|
profile.value.childPath = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setErr= (v: any) => {
|
||||||
|
profile.value.err = v
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 清理会员信息,退出时使用
|
// 清理会员信息,退出时使用
|
||||||
const clearProfile = () => {
|
const clearProfile = () => {
|
||||||
|
@ -49,6 +55,7 @@ export const useMemberStore = defineStore(
|
||||||
profile,
|
profile,
|
||||||
setProfile,
|
setProfile,
|
||||||
setChildPath,
|
setChildPath,
|
||||||
|
setErr,
|
||||||
clearProfile
|
clearProfile
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,7 +18,7 @@ const obj = {
|
||||||
options.timeout = 10000;
|
options.timeout = 10000;
|
||||||
// 拼接完整路径
|
// 拼接完整路径
|
||||||
if (!options.url.startsWith("http")) {
|
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;
|
options.url = baseUrl + store.profile.childPath + options.url;
|
||||||
} else {
|
} else {
|
||||||
options.url = baseUrl + options.url;
|
options.url = baseUrl + options.url;
|
||||||
|
@ -139,7 +139,9 @@ export const http = <T>(options: UniApp.RequestOptions) => {
|
||||||
fail(err) {
|
fail(err) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: "none",
|
icon: "none",
|
||||||
|
// title: JSON.stringify(err),
|
||||||
title: "网络错误,请检查网络",
|
title: "网络错误,请检查网络",
|
||||||
|
|
||||||
});
|
});
|
||||||
reject(err);
|
reject(err);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue