You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
2.6 KiB
111 lines
2.6 KiB
<template> |
|
<view> |
|
<view class="form_body" style=""> |
|
<view class="form_body_title"> |
|
登录账户<br/> |
|
<text class="form_body_title_text"> |
|
正在使用账号 |
|
</text> |
|
<text style="font-weight: 600;" class="form_body_title_text">{{phone}}</text> |
|
</view> |
|
<view style="margin-top: 49rpx !important;" class="form_body_input"> |
|
<view style="color: #999999; flex-shrink: 1;"> |
|
<uni-icons type="locked" size="24"></uni-icons> |
|
</view> |
|
<uni-easyinput style="flex-grow: 1 !important;" type="password" v-model="password" placeholder="请输入密码"></uni-easyinput> |
|
</view> |
|
<view @tap="switchFn" class="switch">验证码登录</view> |
|
<view style="margin-top: 32rpx !important;" class="form_body_footer"> |
|
<button @tap="sumit" class="form_body_butten">一键登录</button> |
|
</view> |
|
</view> |
|
</view> |
|
</template> |
|
|
|
<script> |
|
/* |
|
* @property {String} phone:输入的手机号 通过 onLoad中uni.$on('state')自定义事件 更新值 |
|
* @property {String} password: 输入的密码 |
|
* @property {Function} switchFn: 切换验证码登录组件 |
|
* @property {Function} sumit: 一键登录 |
|
*/ |
|
import oilIdentityApi from '@/api/oil-identity' |
|
import md5 from 'js-md5' |
|
export default { |
|
props:{ |
|
phone:{ |
|
type:String, |
|
default:' ' |
|
} |
|
}, |
|
data() { |
|
return { |
|
password:'', |
|
} |
|
}, |
|
onLoad() { |
|
console.log(this.phone) |
|
}, |
|
methods: { |
|
switchFn(e){ |
|
let that = this |
|
uni.$emit('state',{ |
|
state:2, |
|
phone:that.phone |
|
}) |
|
}, |
|
sumit(){ |
|
console.log(this.phone,this.password) |
|
if(this.password==''){ |
|
uni.showToast({ |
|
title:"密码不能为空", |
|
icon:"none" |
|
}) |
|
return |
|
} |
|
let data = { |
|
unionId: uni.getStorageSync('unionid') , |
|
loginSystem:'OIL_OMS_WEB_MINI ', |
|
username:this.phone, |
|
password: md5(this.password) |
|
} |
|
oilIdentityApi.weChatLoginOilOmsWebMini(data).then(res=>{ |
|
if(res.code==20000){ |
|
console.log(res) |
|
uni.setStorageSync('Authorization',res.data.authTokenDTO.accessToken) |
|
uni.setStorageSync('accountStatus', res.data.isCompanyAccount) |
|
uni.setStorageSync('user', res.data.authTokenDTO.loginUser) |
|
uni.showToast({ |
|
title: res.msg, |
|
icon: 'none', |
|
complete: (err) => { |
|
setTimeout(() => { |
|
uni.redirectTo({ |
|
url:'../index/newindex' |
|
}) |
|
}, 1000); |
|
} |
|
}) |
|
} |
|
}) |
|
} |
|
} |
|
} |
|
</script> |
|
|
|
<style> |
|
.switch{ |
|
font-size: 28rpx; |
|
font-weight: 500; |
|
color: #000000; |
|
margin-top: 21rpx; |
|
margin-left:29rpx; |
|
} |
|
.is-input-border{ |
|
border: 0px !important; |
|
} |
|
.form_body_title_text{ |
|
font-size: 28rpx; |
|
color: #333333; |
|
} |
|
</style>
|
|
|