Compare commits

..

No commits in common. "f0e850159cd30d0739c7c7c446a6f91603288dcf" and "7e5f06935c47c010004c8c51bb84b89029ad9f6f" have entirely different histories.

5 changed files with 32 additions and 88 deletions

View File

@ -3,8 +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/test/saas',
VITE_APP_BASE_URL: 'https://ifanda.52zaisheng.cn/prod',
VITE_APP_BASE_URL: 'http://cloud.52zaisheng.cn/test/saas',
appid: 'wx9251d74fe0e87028',
}
@ -14,8 +13,7 @@ const test = {
}
const production = {
VITE_APP_BASE_URL: 'https://ifanda.52zaisheng.cn/prod',
// VITE_APP_BASE_URL: 'http://cloud.52zaisheng.cn/test/saas',
VITE_APP_BASE_URL: 'http://cloud.52zaisheng.cn/test/saas',
appid: 'wx9251d74fe0e87028',
}

View File

@ -143,7 +143,6 @@ import LoginLayout from "./components/loginLayout.vue";
import { useMemberStore } from "@/store/index";
import valid from "@/utils/validate";
import pinia from "@/store";
import { onShow } from "@dcloudio/uni-app";
const handleClear = (item: any) => {
setTimeout(() => {
@ -236,43 +235,16 @@ const submit = () => {
});
return;
}
console.log('获取货场信息')
//
ProfileApi.getCommonDbPhone({ phone: model1.userInfo.userName }).then(
(res: any) => {
if (res.code === 200) {
if (res.data.length === 0) {
uni.showToast({
icon: "none",
title: "当前用户暂未分配货场,请联系管理员",
});
} else {
store.setCode(res.data[0].mechanismCode);
if (store.code) {
loginByAccount();
}
}
}
}
);
}
});
};
const loginByAccount = () => {
ProfileApi.loginByAccount(model1.userInfo).then((res: any) => {
if (res.code === 200) {
if (checkGroup.rememberCheck.length === 1) {
uni.setStorageSync("catchLoginInfo", model1.userInfo);
} else {
uni.setStorageSync("catchLoginInfo", {});
}
store.setProfile(res.data);
uni.reLaunch({
url: "/pagesHome/index", //
});
}
});
}
});
};
const handleForgetPwd = () => {
uni.navigateTo({
@ -323,6 +295,7 @@ const handleSelect = (v: any) => {
state.isShow = false;
state.dpObj = v;
model1.userInfo.dpName = v.name;
console.log(v.dbIp);
store.setChildPath(v.dbIp);
};
@ -331,7 +304,8 @@ const state = reactive({
isShow: false,
dpObj: {},
});
//
// //
// ProfileApi.getDbInfo({}).then((res) => {
// if (res.code === 200) {
// state.dpList = res.data.map((item: any) => {
@ -339,14 +313,6 @@ const state = reactive({
// });
// }
// });
onShow(() => {
if (uni.getStorageSync("catchLoginInfo")) {
const { userName, password } = uni.getStorageSync("catchLoginInfo");
model1.userInfo.userName = userName;
model1.userInfo.password = password;
}
});
</script>
<style lang="scss" scoped>

View File

@ -5,17 +5,6 @@
import type { User } from "@/types/user";
import { http } from "@/utils/http";
// console.log(store.profile.childPath)
//查询手机号绑定货场
export const getCommonDbPhone = (data: {phone: string}) => {
return http({
method: "GET",
url: "/api/db/getCommonDbPhone",
data,
});
};
// 登陆
export const loginByAccount = (data: {
userName: string;

View File

@ -15,23 +15,25 @@ export const useMemberStore = defineStore(
},
menusList: [],
menusNameList: [],
childPath: "/test/sh0001",
err: null,
childPath: '/test/sh0001',
err: null
});
// 保存会员信息,登录时使用
const setProfile = (val: any) => {
profile.value = { ...profile.value, ...val };
profile.value = {...profile.value, ...val};
profile.value.menusNameList = _.pluck(val.menusList, "name");
};
const setChildPath = (v: string) => {
profile.value.childPath = v;
};
const setChildPath= (v: string) => {
profile.value.childPath = v
}
const setErr= (v: any) => {
profile.value.err = v
}
const setErr = (v: any) => {
profile.value.err = v;
};
// 清理会员信息,退出时使用
const clearProfile = () => {
@ -43,14 +45,9 @@ export const useMemberStore = defineStore(
},
menusList: [],
menusNameList: [],
childPath: "",
};
code.value = ''
childPath: ''
};
const code = ref<string>();
const setCode = (val: any) => {
code.value = val
};
// 记得 return
@ -59,9 +56,7 @@ export const useMemberStore = defineStore(
setProfile,
setChildPath,
setErr,
clearProfile,
code,
setCode
clearProfile
};
},
{

View File

@ -11,6 +11,7 @@ let baseUrl = "";
const store = useMemberStore(pinia);
baseUrl = (process.env as any).config[(process.env as any).NODE_ENV]
.VITE_APP_BASE_URL;
const obj = {
// 拦截前触发
invoke(options: UniApp.RequestOptions) {
@ -31,14 +32,7 @@ const obj = {
if (token) {
options.header["x-userToken"] = token;
}
// db/getCommonDbPhone 接口code必须是common
if (options.url.indexOf("db/getCommonDbPhone") !== -1) {
options.header["code"] = 'common';
} else {
if (store.code) {
options.header["code"] = store.code;
}
}
options.header["code"] = 'hoe-cs';
},
};
// 请求拦截器
@ -74,7 +68,7 @@ export const http = <T>(options: UniApp.RequestOptions) => {
// #endif
},
timeout: 1800000,
url: baseUrl + options.url, //仅为示例,非真实的接口地址
url: baseUrl + store.profile.childPath + options.url,//仅为示例,非真实的接口地址
fileType: "image",
// #ifdef H5
files: (options as any).data.files,
@ -159,7 +153,9 @@ export const http = <T>(options: UniApp.RequestOptions) => {
let res1: any = JSON.parse(json1);
console.log(res1);
if (res.statusCode >= 200 && res.statusCode < 300) {
if ([1001, 1002, 1003, 1004].indexOf(res1.code) > -1) {
if (
[1001,1002,1003,1004].indexOf(res1.code) > -1
) {
uni.showToast({
icon: "none",
title: (res1 as Data<T>).message || "请求失败",
@ -169,7 +165,7 @@ export const http = <T>(options: UniApp.RequestOptions) => {
url: "/pagesLogin/login/index",
});
return;
} else if ([500, 5001, 10001].indexOf(res1.code) > -1) {
} else if ([500,5001,10001].indexOf(res1.code) > -1) {
uni.showToast({
icon: "none",
title: (res1 as Data<T>).message || "请求失败",