115 lines
2.7 KiB
Vue
115 lines
2.7 KiB
Vue
<template>
|
|
<view>
|
|
<scroll-view scroll-y class="page">
|
|
<cu-custom bgColor="bg-cyan"><block slot="content">登录</block></cu-custom>
|
|
<view class="photoView">
|
|
<view class="photoImage">
|
|
<open-data type="userAvatarUrl"></open-data>
|
|
</view>
|
|
</view>
|
|
<form action="">
|
|
<view class="cu-form-group margin-top">
|
|
<view class="title">账号</view>
|
|
<input placeholder="请输入账号" name="account" value="" @input="getAccount"></input>
|
|
</view>
|
|
<view class="cu-form-group">
|
|
<view class="title">密码</view>
|
|
<input placeholder="请输入账号" name="password" type="password" value="" @input="getPassword"></input>
|
|
</view>
|
|
</form>
|
|
<view class="padding flex flex-direction" style="padding-top: 200rpx;">
|
|
<button class="cu-btn round bg-cyan margin-tb-sm lg" @click="buttonClick">登录</button>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
account: '',
|
|
password: ''
|
|
}
|
|
},
|
|
mounted() {
|
|
},
|
|
methods: {
|
|
getAccount: function(e){
|
|
this.account = e.target.value
|
|
},
|
|
getPassword: function(e){
|
|
this.password = e.target.value
|
|
},
|
|
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;
|
|
}
|
|
.photoView {
|
|
padding-top: 50rpx;
|
|
position: relative;
|
|
color: #fff;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
.photoImage {
|
|
overflow:hidden;
|
|
display: block;
|
|
width: 200rpx;
|
|
height: 200rpx;
|
|
margin: 20rpx;
|
|
border-radius: 50%;
|
|
border: 2px solid #fff;
|
|
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
|
|
}
|
|
.cu-form-group .title{
|
|
min-width: calc(4em + 15px);
|
|
font-weight: 600;
|
|
}
|
|
.picker {
|
|
text-align: left;
|
|
}
|
|
</style>
|