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

调整登录和退出

parent de139d4c
......@@ -25,11 +25,23 @@ export function authLogin(loginAction, loginCode, data) {
export function userMobileOperation(action, data) {
if (action === "logout") {
//退出登录
return Request(`/logout`, data, "GET"); // data: {openId, entryName}
return Request(`/api/entry/{mini}/m-action/logout`, data); // data: {openId, entryName}
} else {
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
export function getMap() {
return Request(`/api/query/*/action/getMap`);
......@@ -333,10 +345,6 @@ export function GetSignUrl(data) {
);
}
// 验证码发送
export function SendMessage(data) {
return Request(`/handler/sendMessage`, data);
}
// 订单轨迹
export function findShipmentLbs(data) {
......
......@@ -30,11 +30,12 @@
<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.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 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="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>
......
......@@ -12,14 +12,15 @@
<u-form-item prop="phone">
<u-input type="number" v-model="formData.phone" placeholder="请输入手机号" />
</u-form-item>
<u-form-item prop="password">
<!-- <u-form-item prop="password">
<u-input type="password" v-model="formData.telPassword" placeholder="请输入密码" />
</u-form-item>
<!-- <u-form-item prop="authCode">
</u-form-item> -->
<u-form-item prop="authCode">
<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-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 v-else>
<u-form-item prop="userName">
......@@ -42,7 +43,7 @@
<script>
import { MINI, ENV_MODEL, TokenPrefix } from '../../publicConfig/config.js'
import { userLogin,userCarrierLogin,
SendMessage,userMobileOperation } from '../../api/apiList.js'
userMobileSendMessage,userMobileOperation } from '../../api/apiList.js'
const loginBehavior = require('../../mixins/loginBehavior.js')
export default {
......@@ -54,7 +55,6 @@
userName: '', //用户名
password: '', //密码
phone: '', //电话号码
telPassword:'',//电话
authCode: '' //验证码
},
isVerifLogin: true, //是否为验证码登录
......@@ -93,20 +93,23 @@
},
//表单提交前规则校验
onSubmitBeforeRule(userName, password, phone, telPassword ){
onSubmitBeforeRule(userName, password, phone, authCode ){
let ruleFlag = true
let tostText = ''
//表单字段校验
if(this.isVerifLogin){
if(!phone && !telPassword){
tostText = '请输入手机号及码'
if(!phone && !authCode){
tostText = '请输入手机号及验证码'
} else if(!phone){
tostText = '请输入手机号'
} else if(!telPassword){
tostText = '请输入码'
} else if(!authCode){
tostText = '请输入验证码'
} else if(phone && !uni.$u.test.mobile(phone)){
tostText = '请输入有效手机号码'
}
} else if(authCode && !uni.$u.test.code(authCode, 6)){
tostText = '请输入6位有效验证码'
}
} else {
if(!userName && !password){
tostText = '请输入用户名及密码'
......@@ -152,13 +155,13 @@
//确认提交
submitForm() {
const { userName, password, phone, telPassword } = this.formData
if(!this.onSubmitBeforeRule(userName, password, phone, telPassword)) return //规则校验
const { userName, password, phone, authCode } = this.formData
if(!this.onSubmitBeforeRule(userName, password, phone, authCode)) return //规则校验
let {projectMini} = getApp().globalData;
let loginAction = 'loginByUserInfo'
let reqData = { entryName: projectMini }
if (this.isVerifLogin) {
reqData = {...reqData, params: {phone, telPassword}}
reqData = {...reqData, params: {phone, authCode}}
loginAction = 'loginByCustomAuth'
} else {
const encryptedPassword = this.encryptedText(password)
......@@ -328,12 +331,12 @@
})
})
},
end() {},
start() {},
//提示文本
onTipsChange(text) {
this.tips = text;
},
//获取手机验证码
getAuthCode() {
if (this.$refs.uCode.canGetCode) {
......@@ -343,19 +346,41 @@
uni.$u.toast('请稍候重试 !');
}
},
//获取验证码
sendMessage() {
var phone = this.formData.phone;
const {projectMini} = getApp().globalData
SendMessage({
phone: this.formData.phone,
entryName: projectMini
}).then(() => {
var baseData = {
"phone": this.formData.phone,
"entryName": getApp().globalData.projectMini
}
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(() => {
uni.hideLoading();
uni.$u.toast('验证码已发送'); // 该提示会被this.start()方法中的提示覆盖
this.$refs.uCode.start(); // 开启倒计时
}, 1000);
const datas = res.data.data
})
},
}
......
......@@ -79,7 +79,12 @@
// #endif
const { projectMini } = getApp().globalData
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 => {
if (res.data.messageType === 'success') {
_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