bug修复
This commit is contained in:
@@ -122,9 +122,7 @@ onShow(async () => {
|
||||
if(isLogin()) {
|
||||
// userStore.getProfile();
|
||||
if(userInfo.value.maOpenId) {
|
||||
if(getCompanyId() === '') {
|
||||
switchCompany();
|
||||
}
|
||||
fetchCompanyList();
|
||||
} else {
|
||||
await userStore.getProfile();
|
||||
}
|
||||
@@ -134,18 +132,52 @@ onShow(async () => {
|
||||
});
|
||||
|
||||
const switchCompany = () => {
|
||||
getCompanyList(userInfo.value.maOpenId).then(res => {
|
||||
const companyList = res.map((res: { company: any }) => res.company);
|
||||
const userList = res.map((res: { user: any }) => res.user);
|
||||
// getCompanyList(userInfo.value.maOpenId).then(res => {
|
||||
// const companyList = res.map((res: { company: any }) => res.company);
|
||||
// const userList = res.map((res: { user: any }) => res.user);
|
||||
// uni.showActionSheet({
|
||||
// itemList: companyList.map((res: { companyName: string }) => res.companyName),
|
||||
// success: (res) => {
|
||||
// userStore.setUserInfo(userList[res.tapIndex]);
|
||||
// userStore.setCompanyInfo(companyList[res.tapIndex]);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
fetchCompanyList((companyList: any[], userList: any[]) => {
|
||||
uni.showActionSheet({
|
||||
itemList: companyList.map((res: { companyName: string }) => res.companyName),
|
||||
success: (res) => {
|
||||
userStore.setUserInfo(userList[res.tapIndex]);
|
||||
userStore.setCompanyInfo(companyList[res.tapIndex]);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const fetchCompanyList = (fn: any = undefined) => {
|
||||
getCompanyList(userInfo.value.maOpenId).then(res => {
|
||||
const companyList = res.map((res: { company: any }) => res.company);
|
||||
const userList = res.map((res: { user: any }) => res.user);
|
||||
if(fn != undefined && fn instanceof Function) {
|
||||
fn(companyList, userList);
|
||||
} else {
|
||||
let index = companyList.findIndex((res: { id: string }) => res.id === getCompanyId());
|
||||
if(index < 0) {
|
||||
index = 0;
|
||||
}
|
||||
userStore.setUserInfo(userList[index]);
|
||||
userStore.setCompanyInfo(companyList[index]);
|
||||
}
|
||||
// uni.showActionSheet({
|
||||
// itemList: companyList.map((res: { companyName: string }) => res.companyName),
|
||||
// success: (res) => {
|
||||
// userStore.setUserInfo(userList[res.tapIndex]);
|
||||
// userStore.setCompanyInfo(companyList[res.tapIndex]);
|
||||
// }
|
||||
// });
|
||||
});
|
||||
};
|
||||
|
||||
const swiperChange = (e: any) => {
|
||||
currentBannerIndex.value = e.detail.current;
|
||||
};
|
||||
|
Reference in New Issue
Block a user