Commit 70713ab9 authored by 贺世双's avatar 贺世双

调整登录和退出

parent de139d4c
...@@ -25,11 +25,23 @@ export function authLogin(loginAction, loginCode, data) { ...@@ -25,11 +25,23 @@ export function authLogin(loginAction, loginCode, data) {
export function userMobileOperation(action, data) { export function userMobileOperation(action, data) {
if (action === "logout") { if (action === "logout") {
//退出登录 //退出登录
return Request(`/logout`, data, "GET"); // data: {openId, entryName} return Request(`/api/entry/{mini}/m-action/logout`, data); // data: {openId, entryName}
} else { } else {
return Request(`/api/entry/{mini}/m-action/getUserInfo`, data); return Request(`/api/entry/{mini}/m-action/getUserInfo`, data);
} }
} }
//获取手机验证码
/*export function userMobileSendMessage(data) {
return Request(`/api/auth/app-login/{mini}/sendMessage`, data)
}*/
// 获取手机验证码发送
export function userMobileSendMessage(data) {
return Request(`/handler/sendMessage`, data);
}
//获取地图key //获取地图key
export function getMap() { export function getMap() {
return Request(`/api/query/*/action/getMap`); return Request(`/api/query/*/action/getMap`);
...@@ -333,10 +345,6 @@ export function GetSignUrl(data) { ...@@ -333,10 +345,6 @@ export function GetSignUrl(data) {
); );
} }
// 验证码发送
export function SendMessage(data) {
return Request(`/handler/sendMessage`, data);
}
// 订单轨迹 // 订单轨迹
export function findShipmentLbs(data) { export function findShipmentLbs(data) {
......
...@@ -30,11 +30,12 @@ ...@@ -30,11 +30,12 @@
<bs-customCell label="订舱/托书号 :" :value="propData.sp__booking_no" labelCol="3.5" wrapCol="6" /> <bs-customCell label="订舱/托书号 :" :value="propData.sp__booking_no" labelCol="3.5" wrapCol="6" />
<bs-customCell label="运单号 :" :value="propData.shipment_no" labelCol="2" wrapCol="6" /> <bs-customCell label="运单号 :" :value="propData.shipment_no" labelCol="2" wrapCol="6" />
<bs-customCell label="车牌号 :" :value="propData.truck_no" labelCol="2" wrapCol="6" /> <bs-customCell label="车牌号 :" :value="propData.truck_no" labelCol="2" wrapCol="6" />
<bs-customCell label="回单数量 :" :value="propData.pod_count" labelCol="2.5" wrapCol="6" /> <!-- <bs-customCell label="回单数量 :" :value="propData.pod_count" labelCol="2.5" wrapCol="6" /> -->
</view> </view>
<view class="flex_cen flex_center orderItemButtonGroup" v-if="propData.confirm_status != 'CONFIRMED'"> <view class="flex_cen flex_center orderItemButtonGroup" >
<button class="flex_cen flex_center" @click="onDetailPodSign()">明细上传</button> <button class="flex_cen flex_center" @click="onDetailPodSign()">明细上传</button>
<button class="flex_cen flex_center" @click="onAllPodSign()">整单上传</button> <button class="flex_cen flex_center" @click="onAllPodSign()">整单上传</button>
<!-- <button class="flex_cen flex_center" style="margin-top: 24rpx;" @click="onChangeShippingDate()">修改船期</button> -->
</view> </view>
</view> </view>
......
...@@ -12,14 +12,15 @@ ...@@ -12,14 +12,15 @@
<u-form-item prop="phone"> <u-form-item prop="phone">
<u-input type="number" v-model="formData.phone" placeholder="请输入手机号" /> <u-input type="number" v-model="formData.phone" placeholder="请输入手机号" />
</u-form-item> </u-form-item>
<u-form-item prop="password"> <!-- <u-form-item prop="password">
<u-input type="password" v-model="formData.telPassword" placeholder="请输入密码" /> <u-input type="password" v-model="formData.telPassword" placeholder="请输入密码" />
</u-form-item> </u-form-item> -->
<!-- <u-form-item prop="authCode"> <u-form-item prop="authCode">
<u-input type="number" v-model="formData.authCode" maxlength="6" border="none" placeholder="验证码" /> <u-input type="number" v-model="formData.authCode" maxlength="6" border="none" placeholder="验证码" />
<u-button slot="right" @click="getAuthCode" :text="tips" type="success" size="mini" :disabled="disabled" /> <u-button slot="right" @click="getAuthCode" :text="tips" type="success" size="mini" :disabled="disabled" />
</u-form-item> </u-form-item>
<u-code ref="uCode" @change="onTipsChange" seconds="60" @start="disabled" @end="disabled" />--> <u-code ref="uCode" @change="onTipsChange" seconds="60" @start="start" @end="end" />
</template> </template>
<template v-else> <template v-else>
<u-form-item prop="userName"> <u-form-item prop="userName">
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
<script> <script>
import { MINI, ENV_MODEL, TokenPrefix } from '../../publicConfig/config.js' import { MINI, ENV_MODEL, TokenPrefix } from '../../publicConfig/config.js'
import { userLogin,userCarrierLogin, import { userLogin,userCarrierLogin,
SendMessage,userMobileOperation } from '../../api/apiList.js' userMobileSendMessage,userMobileOperation } from '../../api/apiList.js'
const loginBehavior = require('../../mixins/loginBehavior.js') const loginBehavior = require('../../mixins/loginBehavior.js')
export default { export default {
...@@ -54,7 +55,6 @@ ...@@ -54,7 +55,6 @@
userName: '', //用户名 userName: '', //用户名
password: '', //密码 password: '', //密码
phone: '', //电话号码 phone: '', //电话号码
telPassword:'',//电话
authCode: '' //验证码 authCode: '' //验证码
}, },
isVerifLogin: true, //是否为验证码登录 isVerifLogin: true, //是否为验证码登录
...@@ -93,20 +93,23 @@ ...@@ -93,20 +93,23 @@
}, },
//表单提交前规则校验 //表单提交前规则校验
onSubmitBeforeRule(userName, password, phone, telPassword ){ onSubmitBeforeRule(userName, password, phone, authCode ){
let ruleFlag = true let ruleFlag = true
let tostText = '' let tostText = ''
//表单字段校验 //表单字段校验
if(this.isVerifLogin){ if(this.isVerifLogin){
if(!phone && !telPassword){ if(!phone && !authCode){
tostText = '请输入手机号及码' tostText = '请输入手机号及验证码'
} else if(!phone){ } else if(!phone){
tostText = '请输入手机号' tostText = '请输入手机号'
} else if(!telPassword){ } else if(!authCode){
tostText = '请输入码' tostText = '请输入验证码'
} else if(phone && !uni.$u.test.mobile(phone)){ } else if(phone && !uni.$u.test.mobile(phone)){
tostText = '请输入有效手机号码' tostText = '请输入有效手机号码'
} } else if(authCode && !uni.$u.test.code(authCode, 6)){
tostText = '请输入6位有效验证码'
}
} else { } else {
if(!userName && !password){ if(!userName && !password){
tostText = '请输入用户名及密码' tostText = '请输入用户名及密码'
...@@ -152,13 +155,13 @@ ...@@ -152,13 +155,13 @@
//确认提交 //确认提交
submitForm() { submitForm() {
const { userName, password, phone, telPassword } = this.formData const { userName, password, phone, authCode } = this.formData
if(!this.onSubmitBeforeRule(userName, password, phone, telPassword)) return //规则校验 if(!this.onSubmitBeforeRule(userName, password, phone, authCode)) return //规则校验
let {projectMini} = getApp().globalData; let {projectMini} = getApp().globalData;
let loginAction = 'loginByUserInfo' let loginAction = 'loginByUserInfo'
let reqData = { entryName: projectMini } let reqData = { entryName: projectMini }
if (this.isVerifLogin) { if (this.isVerifLogin) {
reqData = {...reqData, params: {phone, telPassword}} reqData = {...reqData, params: {phone, authCode}}
loginAction = 'loginByCustomAuth' loginAction = 'loginByCustomAuth'
} else { } else {
const encryptedPassword = this.encryptedText(password) const encryptedPassword = this.encryptedText(password)
...@@ -328,12 +331,12 @@ ...@@ -328,12 +331,12 @@
}) })
}) })
}, },
end() {},
start() {},
//提示文本 //提示文本
onTipsChange(text) { onTipsChange(text) {
this.tips = text; this.tips = text;
}, },
//获取手机验证码 //获取手机验证码
getAuthCode() { getAuthCode() {
if (this.$refs.uCode.canGetCode) { if (this.$refs.uCode.canGetCode) {
...@@ -343,19 +346,41 @@ ...@@ -343,19 +346,41 @@
uni.$u.toast('请稍候重试 !'); uni.$u.toast('请稍候重试 !');
} }
}, },
//获取验证码 //获取验证码
sendMessage() { sendMessage() {
var phone = this.formData.phone;
const {projectMini} = getApp().globalData const {projectMini} = getApp().globalData
SendMessage({ var baseData = {
phone: this.formData.phone, "phone": this.formData.phone,
entryName: projectMini "entryName": getApp().globalData.projectMini
}).then(() => { }
if(!phone){
uni.showToast({
title: "请输入手机号",
icon: 'none',
duration: 1500
})
return;
}
if(phone && !uni.$u.test.mobile(phone)){
uni.showToast({
title: "请输入有效手机号码",
icon: 'none',
duration: 1500
})
return;
}
userMobileSendMessage(baseData).then(res => {
// console.log(res)
uni.showLoading({
title: '验证码获取中...'
})
setTimeout(() => { setTimeout(() => {
uni.hideLoading(); uni.hideLoading();
uni.$u.toast('验证码已发送'); // 该提示会被this.start()方法中的提示覆盖 uni.$u.toast('验证码已发送'); // 该提示会被this.start()方法中的提示覆盖
this.$refs.uCode.start(); // 开启倒计时 this.$refs.uCode.start(); // 开启倒计时
}, 1000); }, 1000);
const datas = res.data.data
}) })
}, },
} }
......
...@@ -79,7 +79,12 @@ ...@@ -79,7 +79,12 @@
// #endif // #endif
const { projectMini } = getApp().globalData const { projectMini } = getApp().globalData
const openId = this.userInfo.userExt?.openid const openId = this.userInfo.userExt?.openid
const data = {openId, entryName: projectMini} var data = {
"args": {
"phone": this.userInfo.mobile,
"entryName": getApp().globalData.projectMini
}
}
userMobileOperation('logout', data).then(res => { userMobileOperation('logout', data).then(res => {
if (res.data.messageType === 'success') { if (res.data.messageType === 'success') {
_this.customTost() _this.customTost()
......
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