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