Преглед изворни кода

customerId及个人中心默认etc账户逻辑修改

master
bjfight пре 2 недеља
родитељ
комит
8cee740b2c
3 измењених фајлова са 38 додато и 9 уклоњено
  1. 35
    7
      login/login.vue
  2. 1
    1
      pages/user/user.vue
  3. 2
    1
      subpackage/personal-center/my-etc-account.vue

+ 35
- 7
login/login.vue Прегледај датотеку

@@ -47,16 +47,16 @@
</view>

<view class="as-layout-vertical as-gravity-center" @click="
state.loginType === 'pwd'
? (state.loginType = 'code')
: (state.loginType = 'pwd')
">
state.loginType === 'pwd'
? (state.loginType = 'code')
: (state.loginType = 'pwd')
">
<view class="bg orange as-gravity-center">
<image :src="`${$imgUrl}login/icon_code.png`" class="img" mode="aspectFill" />
</view>
<view class="label">{{
state.loginType === "pwd" ? "验证码登录" : "密码登录"
}}</view>
state.loginType === "pwd" ? "验证码登录" : "密码登录"
}}</view>
</view>

<view class="as-layout-vertical as-gravity-center" @click="navTo('/login/forget-pwd-step1')">
@@ -77,8 +77,10 @@
import { requestNew} from "@/utils/network/request.js";
import { useUserStore } from "@/stores/user";
import { setItem,getItem } from "@/utils/storage";
import { customerQuery, userInfoIndex } from "@/utils/network/api.js";
const userStore = useUserStore();
const { fetchToken } = userStore;
const { fetchToken, saveUserInfo } = userStore;

const state = reactive({
checked: false, //是否勾选协议
@@ -180,6 +182,32 @@
setItem('mobile', state.username)
subscribeMessages();
msg("登录成功!");
let getUserInfo = requestNew(userInfoIndex, {
type: 2,
data: {},
method: "POST",
showLoading: true,
});
let getEtcAccounts = requestNew(customerQuery, {
type: 2,
data: {},
method: "POST",
showLoading: true,
})
Promise.all([getUserInfo, getEtcAccounts]).then(reses => {
let userInfoRes = reses[0];
if (userInfoRes.mobile) {
saveUserInfo(userInfoRes);
}
let userCustomerId = userInfoRes.customerId || '';
let etcAccounts = reses[1];
let customerObj = etcAccounts.find(val => val.customerId == userCustomerId);
if(customerObj) {
setItem('customerObj', customerObj);
}
})
uni.$emit("refreshOrder");
if (state.back == 1) {
uni.navigateBack({

+ 1
- 1
pages/user/user.vue Прегледај датотеку

@@ -50,7 +50,7 @@
</view>
</view>
<view style="margin-right: 26rpx;">
{{state.customerObj.vehicleCount?state.customerObj.vehicleCount:'无'}}辆车
{{state.customerObj.vehicleCount?state.customerObj.vehicleCount + '辆车':'无车辆'}}
</view>
</view>


+ 2
- 1
subpackage/personal-center/my-etc-account.vue Прегледај датотеку

@@ -136,12 +136,13 @@
}
const switchCustomer = (choiceData) => {
requestNew(etcChange, {
customerId: choiceData.customerId
data:{customerId: choiceData.customerId}
})
.then((res) => {
console.log('用户信息', res)
let userInfo = getItem('userInfo');
userInfo.customerId = choiceData.customerId;
setItem('customerObj', choiceData);
saveUserInfo(userInfo);
uni.navigateBack()
})

Loading…
Откажи
Сачувај