用户登录&退出
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
import request from '@/utils/request'
|
||||
const service_name ='oil-identity'
|
||||
const group_name ='weChatCloudAuthorization'
|
||||
const service_name ='xkhl-identity'
|
||||
const group_name ='unionAuth'
|
||||
const Customer_name = 'oilCustomerChannelRelation'
|
||||
const WchatLogin_name ='weChatCloudAuthorization'
|
||||
export default{
|
||||
// 新登录接口 手机密码登录
|
||||
loginByPhonePwd (data) {
|
||||
return request({
|
||||
url: `/${service_name}/${group_name}/loginByPhonePwd`,
|
||||
url: `/${service_name}/${group_name}/loginPwd`,
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
},
|
||||
// 新登录接口 手机密码登录
|
||||
logout () {
|
||||
return request({
|
||||
url: `/${service_name}/${group_name}/logout`,
|
||||
method: 'get',
|
||||
})
|
||||
},
|
||||
// 获取用户信息
|
||||
sendCode(code){
|
||||
return request({
|
||||
|
||||
@@ -164,6 +164,11 @@
|
||||
console.log(res,'这里是自动登录res')
|
||||
if (res.data.authTokenDTO.loginFlag == true) {
|
||||
this.setStored(res)
|
||||
}else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.data.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<view class="bg-white margin padding radius shadow-warp">
|
||||
<view class="cu-form-group">
|
||||
<view class="title mini-label text-black">手机号</view>
|
||||
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input" @blur="bulrInput" />
|
||||
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input" />
|
||||
</view>
|
||||
<view class="cu-form-group padding-top-sm" v-if="showRandom">
|
||||
<view class="title text-black mini-label">验证码</view>
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
|
||||
<script>
|
||||
import cloudSiteApi from '@/api/cloud-site.js'
|
||||
import oilIdentityApi from "@/api/oil-identity";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -98,13 +99,22 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
async loginOut() {
|
||||
// await cloudSiteApi.logout();
|
||||
loginOut() {
|
||||
oilIdentityApi.logout().then(res => {
|
||||
if (res.code===20000){
|
||||
uni.showToast({
|
||||
title: '退出登录成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(()=>{
|
||||
uni.clearStorage()
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/boforeLogin/boforeLogin?type=1' //
|
||||
url: '/pages/login/boforeLogin/boforeLogin?type=1'
|
||||
})
|
||||
},2000)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
getInfo() {
|
||||
this.userInfo = uni.getStorageSync('loginUser')
|
||||
|
||||
@@ -212,7 +212,7 @@ service.interceptors.response.use(
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请求失败!',
|
||||
title: res.msg?res.msg:'请求失败!',
|
||||
icon: "none"
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user