Commit de139d4c authored by 贺世双's avatar 贺世双

获取用户

parent 4848750c
...@@ -5,9 +5,8 @@ import downloadFile from "./downloadFile"; ...@@ -5,9 +5,8 @@ import downloadFile from "./downloadFile";
// 登录接口 // 登录接口
// mimi: 项目名:biz-carrier-wxapp LOGIN_ACTION: loginByUserInfo; miniAppDriverLogin/miniAppServLogin // mimi: 项目名:biz-carrier-wxapp LOGIN_ACTION: loginByUserInfo; miniAppDriverLogin/miniAppServLogin
export function userLogin(loginAction, loginCode, data) { export function userLogin(loginAction, loginCode, data) {
return Request( return Request(`/api/auth/app-login/{mini}/miniAppDriverLogin?weixin_config_key={mini}&code=${loginCode}`,data );
`/api/auth/app-login/{mini}/miniAppDriverLogin?weixin_config_key={mini}&code=${loginCode}`,data
);
} }
export function userCarrierLogin(loginAction, loginCode, data) { export function userCarrierLogin(loginAction, loginCode, data) {
...@@ -28,7 +27,7 @@ export function userMobileOperation(action, data) { ...@@ -28,7 +27,7 @@ export function userMobileOperation(action, data) {
//退出登录 //退出登录
return Request(`/logout`, data, "GET"); // data: {openId, entryName} return Request(`/logout`, data, "GET"); // data: {openId, entryName}
} else { } else {
return Request(`/api/entry/{mini}/m-action/${action}`, data); return Request(`/api/entry/{mini}/m-action/getUserInfo`, data);
} }
} }
//获取地图key //获取地图key
......
...@@ -200,27 +200,30 @@ ...@@ -200,27 +200,30 @@
title: '登录成功!', title: '登录成功!',
duration: 1000 duration: 1000
}) })
/*setTimeout(() => { //获取用户信息
uni.switchTab({ userMobileOperation('getUserInfo').then(res => {
url: "/pages/order/order", var user = res.data.data
}) if(user.user_gid!="DEFAULT.CARRIER_ADMIN"){
}, 1500)*/ getApp().globalData.tabList = [{
getApp().globalData.tabList = [{ "pagePath": "pages/carrierMenu/carrierMenu",
"pagePath": "pages/carrierMenu/carrierMenu", "text": "承运商",
"text": "承运商", "iconPath": "../../static/img/tabbar/shipment.png",
"iconPath": "../../static/img/tabbar/shipment.png", "selectedIconPath": "../../static/img/tabbar/shipment-active.png"
"selectedIconPath": "../../static/img/tabbar/shipment-active.png" },
}, {
{ "pagePath": "pages/user/user",
"pagePath": "pages/user/user", "text": "我的",
"text": "我的", "iconPath": "../../static/img/tabbar/user.png",
"iconPath": "../../static/img/tabbar/user.png", "selectedIconPath": "../../static/img/tabbar/user-active.png"
"selectedIconPath": "../../static/img/tabbar/user-active.png" }
]
uni.switchTab({
url: "/pages/carrierMenu/carrierMenu",
})
} }
]
uni.switchTab({
url: "/pages/carrierMenu/carrierMenu",
}) })
} }
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
...@@ -231,9 +234,6 @@ ...@@ -231,9 +234,6 @@
}) })
}else{ }else{
userLogin(loginAction, res.code, reqData).then(res => { userLogin(loginAction, res.code, reqData).then(res => {
console.log('222=======')
console.log(res)
let token = res.data.renewedToken let token = res.data.renewedToken
if (res.header['Set-Cookie']) { if (res.header['Set-Cookie']) {
const XSRFToken = res.header['Set-Cookie'].split(';')[0].split('=')[1] const XSRFToken = res.header['Set-Cookie'].split(';')[0].split('=')[1]
...@@ -250,27 +250,29 @@ ...@@ -250,27 +250,29 @@
title: '登录成功!', title: '登录成功!',
duration: 1000 duration: 1000
}) })
/*setTimeout(() => { //获取用户信息
uni.switchTab({ userMobileOperation('getUserInfo').then(res => {
url: "/pages/order/order", var user = res.data.data
}) if(user.user_gid=="DEFAULT.CARRIER_ADMIN"){
}, 1500)*/ getApp().globalData.tabList = [{
getApp().globalData.tabList = [{ "pagePath": "pages/dirverMenu/dirverMenu",
"pagePath": "pages/dirverMenu/dirverMenu", "text": "司机",
"text": "司机", "iconPath": "../../static/img/tabbar/receivebill.png",
"iconPath": "../../static/img/tabbar/receivebill.png", "selectedIconPath": "../../static/img/tabbar/receivebill-active.png"
"selectedIconPath": "../../static/img/tabbar/receivebill-active.png" },
}, {
{ "pagePath": "pages/user/user",
"pagePath": "pages/user/user", "text": "我的",
"text": "我的", "iconPath": "../../static/img/tabbar/user.png",
"iconPath": "../../static/img/tabbar/user.png", "selectedIconPath": "../../static/img/tabbar/user-active.png"
"selectedIconPath": "../../static/img/tabbar/user-active.png" }
} ]
] uni.switchTab({
uni.switchTab({ url: "/pages/dirverMenu/dirverMenu",
url: "/pages/dirverMenu/dirverMenu", })
}
}) })
} }
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<image src="../../static/img/empty/userPhoto.png"></image> <image src="../../static/img/empty/userPhoto.png"></image>
</view> </view>
<view class="flex_col flex_cen" style="margin-left: 30rpx;"> <view class="flex_col flex_cen" style="margin-left: 30rpx;">
<text class="user-name" user-select>{{userInfo.name}}</text> <text class="user-name" user-select>{{userInfo.common_name}}</text>
<text class="user-phone" user-select>{{userInfo.mobile}}</text> <text class="user-phone" user-select>{{userInfo.mobile}}</text>
</view> </view>
</view> </view>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</u-cell> --> </u-cell> -->
<u-line color="#F0F0F0" /> <u-line color="#F0F0F0" />
<u-cell title-style="font-weight: bolder" rightIconStyle="font-size: 40rpx" isLink :border="false" <u-cell title-style="font-weight: bolder" rightIconStyle="font-size: 40rpx" isLink :border="false"
title="修改密码" :url="'/subpkg/editPwd/editPwd?userName=' + userInfo.name"> title="修改密码" :url="'/subpkg/editPwd/editPwd?userName=' + userInfo.user_gid">
<view slot="icon" class="t-icon t-icon-lock" /> <view slot="icon" class="t-icon t-icon-lock" />
</u-cell> </u-cell>
</u-cell-group> </u-cell-group>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
} }
}, },
onLoad: function(options) { onLoad: function(options) {
//this.getUserInfo() this.getUserInfo()
}, },
methods: { methods: {
//获取Tab菜单索引 //获取Tab菜单索引
...@@ -57,8 +57,9 @@ ...@@ -57,8 +57,9 @@
//获取用户信息 //获取用户信息
getUserInfo() { getUserInfo() {
userMobileOperation('getUserInfo').then(res => { userMobileOperation('getUserInfo').then(res => {
console.log(res)
let data = res.data.data let data = res.data.data
data.mobile = data.userExt.mobile || '暂无' data.mobile = data.mobile || '暂无'
this.userInfo = { ...data } this.userInfo = { ...data }
}) })
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment