<template>
|
<view>
|
|
<view class="body">
|
|
<view class="headClass">新凯迪云制造</view>
|
<view class="main">
|
<view class="circle">
|
<view class="circleBg"></view>
|
</view>
|
|
<view class="mainContent">
|
<u--input placeholder="请输入用户编码" prefixIcon="account" v-model="usercode"
|
prefixIconStyle="font-size: 22px;color: #909399" class="inputClass" style="margin-top: 60rpx;">
|
</u--input>
|
|
|
<u--input class="inputClass" v-show='!isView' password placeholder="请输入用户密码" v-model="userpassword"
|
prefixIcon="lock" prefixIconStyle="font-size: 22px;color: #909399"
|
:suffixIconStyle="{color:!isView? '#909399':'#436df5',fontSize:'22px'}"
|
:suffixIcon="!isView?'eye-off':'eye-fill'">
|
|
</u--input>
|
<u--input class="inputClass" v-show='isView' placeholder="请输入用户密码" v-model="userpassword"
|
prefixIcon="lock" prefixIconStyle="font-size: 22px;color: #909399"
|
:suffixIconStyle="{color:!isView? '#909399':'#436df5',fontSize:'22px'}"
|
:suffixIcon="!isView?'eye-off':'eye-fill'">
|
</u--input>
|
<view class="suffixEyeClass" @click="isViewClick"></view>
|
|
<u-button hairline type="primary"
|
:disabled="!(usercode.trim().length>0&&userpassword.trim().length>0)" text="立即登录"
|
:loading="isDisabledSubmitButton" loadingText="正在登录,请稍等..." class="loginClass"
|
@click="gotoIndex"></u-button>
|
</view>
|
|
|
</view>
|
|
</view>
|
|
<view style="position: absolute;bottom: 6px;
|
width: 34px;margin-left: calc(50% - 17px);
|
color: #fff;font-size: 12px;">
|
{{$appVersion}}
|
</view>
|
|
|
|
</view>
|
</template>
|
|
<script>
|
import {
|
LoginSave,
|
ForcedOffline,
|
} from '../../config/api.js';
|
import {
|
decode
|
} from 'jsonwebtoken';
|
export default {
|
data() {
|
return {
|
// #ifdef H5
|
usercode: '',
|
// #endif
|
|
// #ifdef APP-PLUS
|
usercode: '',
|
// #endif
|
|
userpassword: '',
|
isView: false, //密码是否可见
|
|
isDisabledSubmitButton: false, //提交按钮是否处于加载中
|
|
isShowCancelButton: false,
|
isShow: false,
|
downloadUrl: '', //下载地址
|
|
}
|
},
|
onLoad() {},
|
|
onUnload() {
|
|
},
|
created() {
|
|
},
|
mounted() {
|
|
},
|
methods: {
|
//密码是否查看 显示明文
|
isViewClick() {
|
this.isView = !this.isView
|
},
|
// 点击立即登录时触发
|
gotoIndex() {
|
const data = {
|
username: this.usercode,
|
password: this.userpassword,
|
usertype: 'APP'
|
}
|
// this.isDisabledSubmitButton = true
|
LoginSave({
|
params: data
|
}).then(result => {
|
if (result.code === '200') {
|
uni.setStorageSync("Token", result.data)
|
const jwt = decode(result.data)
|
uni.setStorageSync("usercode", jwt.usercode)
|
uni.setStorageSync("username", jwt.username)
|
uni.setStorageSync("storg_code", jwt.storg_code)
|
uni.setStorageSync("storg_name", jwt.storg_name)
|
uni.redirectTo({
|
//关闭当前页面,跳转到应用内的某个页面。
|
url: '../xtsy/index'
|
});
|
// uni.$u.toast(result.Message)
|
}
|
|
// else if (result.code === '302') {
|
// const data2 = {
|
// // token: uni.getStorageSync('Token'),
|
// token: result.data,
|
// rid: ''
|
// }
|
// const jwt = decode(result.data)
|
// console.log(jwt, 2)
|
// uni.setStorageSync("usercode", jwt.usercode)
|
// uni.setStorageSync("username", jwt.username)
|
// uni.setStorageSync("storg_code", jwt.storg_code)
|
// uni.setStorageSync("storg_name", jwt.storg_name)
|
|
// ForcedOffline('', {
|
// params: data2
|
// }).then(res2 => {
|
// if (res2.code === '200') {
|
// uni.redirectTo({
|
// //关闭当前页面,跳转到应用内的某个页面。
|
// url: '../xtsy/index'
|
// });
|
// }
|
// })
|
// }
|
else {
|
this.isDisabledSubmitButton = false
|
}
|
})
|
},
|
|
// 确认
|
async isShowConfirm() {
|
|
},
|
// 取消
|
isShowCancel() {
|
this.isShow = false
|
},
|
|
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.main {
|
background-color: #fff;
|
width: 90%;
|
height: 700rpx;
|
margin: 20vh auto 0;
|
position: relative;
|
border-radius: 30rpx;
|
|
.circle {
|
background-color: #fff;
|
width: 240rpx;
|
height: 240rpx;
|
border-radius: 50% 50% 0 0;
|
position: absolute;
|
top: -120rpx;
|
left: 32%;
|
|
.circleBg {
|
width: 200rpx;
|
height: 200rpx;
|
background: url('../../static/img/96x96.png') no-repeat;
|
position: absolute;
|
top: 28rpx;
|
left: 8.5%;
|
background-size: 100% 100%;
|
border-radius: 50%;
|
}
|
}
|
|
.mainContent {
|
position: absolute;
|
top: 160rpx;
|
left: 1.8%;
|
|
.inputClass {
|
width: 600rpx;
|
margin: 30rpx auto 0;
|
border: 1px solid #eee;
|
border-radius: 16rpx;
|
}
|
|
.loginClass {
|
width: 650rpx;
|
margin: 80rpx auto 0;
|
border-radius: 16rpx;
|
letter-spacing: 6rpx;
|
}
|
}
|
|
}
|
|
.suffixEyeClass {
|
position: absolute;
|
right: 10rpx;
|
margin-top: -80rpx;
|
width: 80rpx;
|
height: 80rpx;
|
}
|
|
.headClass {
|
display: flex;
|
justify-content: center;
|
align-items: flex-end;
|
width: 100%;
|
height: 120rpx;
|
line-height: 100rpx;
|
color: #fff;
|
font-weight: bolder;
|
letter-spacing: 2rpx;
|
font-family: serif;
|
padding: 20rpx 0;
|
background-color: #0659ff;
|
}
|
|
::v-deep .u-link {
|
font-size: 16px !important;
|
line-height: 20px !important;
|
}
|
</style>
|
<style>
|
page {
|
overflow: hidden;
|
background-color: #0653f7;
|
}
|
</style>
|