Commit 7843cb70 by 李伟康

```

refactor(account): 优化账户列表组件类型定义和数据处理逻辑

- 将 get4SStoreList 函数参数类型从 AccountItem 修改为 UTSJSONObject
- 移除冗余的对象属性复制操作,直接使用扩展运算符合并对象
- 简化 chooseAccount 事件的数据传递逻辑
- 更新 Scene 组件中的代码格式和日志输出位置
```
1 parent 70753e8d
...@@ -69,21 +69,11 @@ function getMidleClass(item: AccountItem): string { ...@@ -69,21 +69,11 @@ function getMidleClass(item: AccountItem): string {
return 'midle_5' return 'midle_5'
} }
function get4SStoreList(loginUserObj: AccountItem): void { function get4SStoreList(loginUserObj: UTSJSONObject): void {
console.log('get4SStoreList:', loginUserObj) console.log('get4SStoreList:', loginUserObj)
if (loginUserObj.isSuper == true) { if (loginUserObj.isSuper == true) {
// 转换为 UTSJSONObject emit('chooseAccount', loginUserObj)
const userInfoObj: UTSJSONObject = {
uuid: loginUserObj.uuid,
merchantName: loginUserObj.merchantName,
merchantId: loginUserObj.merchantId,
isSuper: loginUserObj.isSuper,
userType: loginUserObj.userType,
loginRole: loginUserObj.loginRole,
active: loginUserObj.active
}
emit('chooseAccount', userInfoObj)
return return
} }
...@@ -108,13 +98,7 @@ function get4SStoreList(loginUserObj: AccountItem): void { ...@@ -108,13 +98,7 @@ function get4SStoreList(loginUserObj: AccountItem): void {
const storeMerchantId = store['merchantId'] as string | null const storeMerchantId = store['merchantId'] as string | null
const userInfoWithStore: UTSJSONObject = { const userInfoWithStore: UTSJSONObject = {
uuid: loginUserObj.uuid, ...loginUserObj,
merchantName: loginUserObj.merchantName,
merchantId: loginUserObj.merchantId,
isSuper: loginUserObj.isSuper,
userType: loginUserObj.userType,
loginRole: loginUserObj.loginRole,
active: loginUserObj.active,
shopMerchantName: storeMerchantName, shopMerchantName: storeMerchantName,
shopMerchantId: storeMerchantId, shopMerchantId: storeMerchantId,
default4SStoreInfo: { default4SStoreInfo: {
...@@ -138,17 +122,7 @@ function get4SStoreList(loginUserObj: AccountItem): void { ...@@ -138,17 +122,7 @@ function get4SStoreList(loginUserObj: AccountItem): void {
icon: 'none' icon: 'none'
}) })
} else { } else {
// 转换为 UTSJSONObject emit('chooseAccount', loginUserObj)
const userInfoObj: UTSJSONObject = {
uuid: loginUserObj.uuid,
merchantName: loginUserObj.merchantName,
merchantId: loginUserObj.merchantId,
isSuper: loginUserObj.isSuper,
userType: loginUserObj.userType,
loginRole: loginUserObj.loginRole,
active: loginUserObj.active
}
emit('chooseAccount', userInfoObj)
} }
} }
} else { } else {
...@@ -191,7 +165,9 @@ function selectAccountLogin(id: string, merchantName: string, userInfo: AccountI ...@@ -191,7 +165,9 @@ function selectAccountLogin(id: string, merchantName: string, userInfo: AccountI
const loginUserInfoListData = data['loginUserInfoList'] as any[] | null const loginUserInfoListData = data['loginUserInfoList'] as any[] | null
if (loginUserInfoListData != null && loginUserInfoListData.length > 0 && userInfo != null) { if (loginUserInfoListData != null && loginUserInfoListData.length > 0 && userInfo != null) {
console.log('开始获取4S店列表') console.log('开始获取4S店列表')
get4SStoreList(userInfo) console.log(loginUserInfoListData)
let info = loginUserInfoListData[0] as UTSJSONObject
get4SStoreList(info)
} else { } else {
uni.showToast({ uni.showToast({
title: '获取4S店列表失败', title: '获取4S店列表失败',
......
...@@ -50,7 +50,6 @@ function jump(info: UTSJSONObject, data: any | null): void { ...@@ -50,7 +50,6 @@ function jump(info: UTSJSONObject, data: any | null): void {
return; return;
} }
jumpTimer = now; jumpTimer = now;
console.log("跳转进入首页!"); console.log("跳转进入首页!");
uni.hideLoading(); uni.hideLoading();
...@@ -84,7 +83,6 @@ function jump(info: UTSJSONObject, data: any | null): void { ...@@ -84,7 +83,6 @@ function jump(info: UTSJSONObject, data: any | null): void {
} else { } else {
info.channelType = 1; info.channelType = 1;
} }
storage.set("userInfo", info, 0); storage.set("userInfo", info, 0);
const sceneType = info.sceneType as null | number; const sceneType = info.sceneType as null | number;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!