123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <!-- 账号密码登录 accountLogin -->
- <template>
- <view>
- <!-- 表单项 -->
- <u-form
- ref="accountLoginRef"
- labelWidth="140"
- labelAlign="left"
- labelPosition="top"
- >
- <u-form-item prop="loginName" label="账号">
- <view class="input-line">
- <u-input
- placeholder="请输入账号"
- v-model="model.loginName"
- border="none"
- ></u-input>
- </view>
- </u-form-item>
- <u-form-item prop="password" label="密码">
- <view class="input-line">
- <u-input
- type="password"
- placeholder="请输入密码"
- v-model="model.password"
- border="none"
- ></u-input>
- </view>
- </u-form-item>
- </u-form>
- </view>
- </template>
- <script>
- import {login} from '@/common/request/apis/login'
- import md5 from '@/common/request/md5.js'
- export default{
- data() {
- return {
- model:{
- loginName:'',
- password:''
- },
- }
- },
- methods:{
- accountLoginSubmit() {
- if(!this.model.loginName){
- return uni.$u.toast("请输入账号");
- }
- if(!this.model.password) {
- return uni.$u.toast("请输入密码");
- }
- let params = {
- ...this.model,
- password: md5(this.model.password)
- }
- login(params)
- .then(res=>{
- if(res.code == 200) {
- let err = {}
- if (res.data.msgTip === 'user can login') {
- let userInfo = {
- token:res.data.token,
- ...res.data.user
- }
- this.$store.dispatch('userLogin',userInfo)
- } else if (res.data.msgTip === 'user is not exist') {
- uni.$u.toast("用户不存在")
- } else if (res.data.msgTip === 'user password error') {
- uni.$u.toast("用户密码不正确")
- } else if (res.data.msgTip === 'user is black') {
- uni.$u.toast("用户被禁用")
- } else if (res.data.msgTip === 'tenant is black') {
- if (loginName === 'jsh') {
- uni.$u.toast("jsh用户已停用,请注册租户进行体验!")
- } else {
- uni.$u.toast("用户所属的租户被禁用")
- }
- } else if (res.data.msgTip === 'tenant is expire') {
- uni.$u.toast("试用期已结束,请联系客服续费")
- } else if (res.data.msgTip === 'access service error') {
- uni.$u.toast("查询服务异常")
- }
-
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- // @import "../index.scss";
- .input-line {
- display: flex;
- align-items: center;
- width: 100%;
- background-color: #f5f7fb;
- border-radius: 16rpx;
- padding-left: 30rpx;
- height: 88rpx;
- box-sizing: border-box;
- }
- </style>
|