1.新增退出功能

master
杨杰 2 years ago
parent 540f485ed0
commit 5724deb764
  1. 4
      high-unionPay/Utils/Api.js
  2. 68
      high-unionPay/pages/tabBar/user/user.vue

@ -564,6 +564,10 @@ export const phone = params => {
// 获取用户信息 // 获取用户信息
export const findUser = params => { export const findUser = params => {
return POST('POST', `${userbase}/getUserDetail`, params).then(res => res.data); return POST('POST', `${userbase}/getUserDetail`, params).then(res => res.data);
}
// 退出登录
export const loginOut = params => {
return POST('POST', `${userbase}/login/out`, params).then(res => res.data);
} }
// 获取用户余额 // 获取用户余额

@ -174,6 +174,7 @@
<script> <script>
import { import {
findUser, findUser,
loginOut,
getUserAccount, getUserAccount,
getUserOrderList, getUserOrderList,
orderCheck orderCheck
@ -258,6 +259,10 @@
url: '../../login/updatePas/updatePas', url: '../../login/updatePas/updatePas',
text: '支付密码', text: '支付密码',
img: '../../../static/img/user/user11.png' img: '../../../static/img/user/user11.png'
}, {
url: '',
text: '退出登录',
img: '../../../static/img/user/user12.png'
}, { }, {
url: '', url: '',
text: '客服', text: '客服',
@ -275,6 +280,10 @@
url: '../../login/updatePas/resetPas', url: '../../login/updatePas/resetPas',
text: '支付密码', text: '支付密码',
img: '../../../static/img/user/user11.png' img: '../../../static/img/user/user11.png'
}, {
url: '',
text: '退出登录',
img: '../../../static/img/user/user12.png'
}, },
{ {
url: '', url: '',
@ -296,7 +305,7 @@
this.whetherCheckNum = res.return_data.whetherCheckNum; this.whetherCheckNum = res.return_data.whetherCheckNum;
this.orderPayNum = res.return_data.orderPayNum; this.orderPayNum = res.return_data.orderPayNum;
this.rechargeOrderNum = res.return_data.rechargeOrderNum; this.rechargeOrderNum = res.return_data.rechargeOrderNum;
this.geTel(this.user.phone); this.geTel(this.user.phone);
this.getUserOrderList(); this.getUserOrderList();
uni.setStorage({ uni.setStorage({
key: "user", key: "user",
@ -496,12 +505,59 @@
}) })
}, },
toPage(url, item) { toPage(url, item) {
let that = this;
if (item != '客服') { if (item != '客服') {
uni.navigateTo({ uni.navigateTo({
url: url url: url
}) })
} else { }
this.playPhone(); if (item == '客服') {
that.playPhone();
}
if (item == '退出登录') {
uni.showModal({
title: '退出登录',
content: '是否退出当前账号',
success: function(res) {
if (res.confirm) {
loginOut().then(res => {
if (res.return_code == '000000') {
app.globalData.userInfo = '';
app.globalData.token = '';
that.textnum = '';
that.textSend = '';
that.therrNum = '';
that.whetherCheckNum = '';
that.orderPayNum = '';
that.rechargeOrderNum = '';
that.userphone = '';
that.user = '';
uni.setStorage({
key: "user",
data: ''
})
uni.setStorage({
key: "token",
data: ''
})
// location.reload();
uni.showToast({
title: '退出成功',
icon: 'none',
duration: 1500,
success() {
setTimeout(() => {
uni.switchTab({
url: '/pages/tabBar/home/home'
})
}, 1500);
}
})
}
});
}
}
})
} }
}, },
@ -533,8 +589,8 @@
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background-color: #f5f5f5; background-color: #f5f5f5;
overflow: hidden; overflow: hidden;
overflow-y: auto; overflow-y: auto;
} }
@ -790,4 +846,4 @@
} }
} }
} }
</style> </style>
Loading…
Cancel
Save