159 lines
3.9 KiB
Vue
159 lines
3.9 KiB
Vue
<template>
|
||
<view>
|
||
<scroll-view scroll-y class="page">
|
||
<cu-custom bgColor="bg-blue"><block slot="content">医疗废物追溯系统</block></cu-custom>
|
||
<view class="photoView">
|
||
<view class="photoImage">
|
||
<open-data type="userAvatarUrl"></open-data>
|
||
</view>
|
||
<text class="welcomeText">欢迎使用</text>
|
||
</view>
|
||
<form action="">
|
||
<view class="cu-form-group login-input">
|
||
<view class="title">账号</view>
|
||
<input placeholder="请输入账号" name="account" value="" @input="getAccount" class="input-field"></input>
|
||
</view>
|
||
<view class="cu-form-group login-input">
|
||
<view class="title">密码</view>
|
||
<input placeholder="请输入密码" name="password" :password="showPassword" value="" @input="getPassword" class="input-field password-input"></input>
|
||
<text class="eye-icon" @click="togglePassword">{{showPassword ? '👁️' : '🙈'}}</text>
|
||
</view>
|
||
</form>
|
||
<view class="padding flex flex-direction" style="padding-top: 10%;">
|
||
<button class="cu-btn round login-btn margin-tb-sm lg" @click="buttonClick">登录</button>
|
||
</view>
|
||
</scroll-view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
account: '',
|
||
password: '',
|
||
showPassword: true
|
||
}
|
||
},
|
||
mounted() {
|
||
},
|
||
methods: {
|
||
getAccount: function(e){
|
||
this.account = e.target.value
|
||
},
|
||
getPassword: function(e){
|
||
this.password = e.target.value
|
||
},
|
||
togglePassword: function(){
|
||
this.showPassword = !this.showPassword
|
||
},
|
||
buttonClick(e) {
|
||
let that = this;
|
||
uni.request({
|
||
url: 'https://lekapi.opmonitor.com/?c=app_api&a=getLogin',
|
||
data: {
|
||
account: that.account,
|
||
password: that.password
|
||
},
|
||
header: {
|
||
'Content-type': 'application/x-www-form-urlencoded'
|
||
},
|
||
method: 'POST',
|
||
success: function(res){
|
||
if(res.data.data.hospital == ''){
|
||
uni.reLaunch({
|
||
url: '/pages/register/login'
|
||
})
|
||
}else{
|
||
// 将这些变量放置globalData中
|
||
getApp().globalData.hospital = res.data.data.hospital
|
||
getApp().globalData.sortHospital = res.data.data.sortHospital
|
||
getApp().globalData.department = res.data.data.department
|
||
getApp().globalData.duty = res.data.data.duty
|
||
getApp().globalData.name = res.data.data.name
|
||
getApp().globalData.phone = res.data.data.phone
|
||
getApp().globalData.openid = res.data.data.openid
|
||
uni.reLaunch({
|
||
url: '/pages/index/index'
|
||
})
|
||
}
|
||
},
|
||
fail: () => {
|
||
console.info('小程序域名不正确,请检查域名正确性')
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.page {
|
||
width: 100vw;
|
||
height: 120Vh;
|
||
background: linear-gradient(180deg, #4a90e2 0%, #357abd 100%);
|
||
}
|
||
.photoView {
|
||
padding-top: 80rpx;
|
||
padding-bottom: 60rpx;
|
||
position: relative;
|
||
color: #fff;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
.photoImage {
|
||
overflow:hidden;
|
||
display: block;
|
||
width: 180rpx;
|
||
height: 180rpx;
|
||
margin: 20rpx;
|
||
border-radius: 50%;
|
||
border: 3px solid rgba(255, 255, 255, 0.9);
|
||
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
|
||
}
|
||
.welcomeText {
|
||
font-size: 36rpx;
|
||
font-weight: 600;
|
||
color: #fff;
|
||
margin-top: 20rpx;
|
||
letter-spacing: 2rpx;
|
||
}
|
||
.login-input {
|
||
background: rgba(255, 255, 255, 0.98);
|
||
border-radius: 16rpx;
|
||
margin: 15rpx 40rpx;
|
||
padding: 10rpx 30rpx;
|
||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
|
||
}
|
||
.cu-form-group .title{
|
||
min-width: calc(4em + 15px);
|
||
font-weight: 600;
|
||
color: #357abd;
|
||
}
|
||
.input-field {
|
||
color: #333;
|
||
}
|
||
.password-input {
|
||
flex: 1;
|
||
}
|
||
.eye-icon {
|
||
font-size: 40rpx;
|
||
margin-left: 20rpx;
|
||
cursor: pointer;
|
||
}
|
||
.login-btn {
|
||
background: linear-gradient(90deg, #4a90e2 0%, #357abd 100%);
|
||
color: #fff;
|
||
font-size: 36rpx;
|
||
font-weight: 600;
|
||
box-shadow: 0 6px 20px rgba(53, 122, 189, 0.4);
|
||
border: none;
|
||
height: 100rpx;
|
||
line-height: 100rpx;
|
||
}
|
||
.picker {
|
||
text-align: left;
|
||
}
|
||
</style>
|