123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <template>
- <div class="login">
- <div class="top">
- <div class="img"><img src="../images/check.png" alt=""></div>
- <h4>欢迎使用智能预问诊</h4>
- </div>
- <div class="main">
- <div class="iptWrap choose">
- <p @click="handleShow">{{name}} <img src="../images/down.png" /></p>
- <div class="slideType" v-if="show">
- <ul>
- <li @click="handleType('手机号',103)">手机号</li>
- <li @click="handleType('身份证号',101)">身份证号</li>
- <li @click="handleType('病历号',102)">病历号</li>
- <li @click="handleType('市民卡号',104)" style="border:0 none">市民卡号</li>
- </ul>
- </div>
- </div>
- <div class="iptWrap number">
- <input @blur="blur" :maxlength="type==103?11:type==101?18:type==102?7:type==104?9:30" v-model="value" @input="changeVal" :type="type==101||type==104?'text':'tel'" class="input" type="text" :placeholder="'请输入'+name" >
- </div>
- <div :class="['btn',value?'btnClick':'btnDis']" @click="handleDepart">进入预问诊</div>
- </div>
- <div class="tip">
- 注:建议您可先输入病情情况,方便医生提前了解情况
- </div>
- <Submit
- v-if="submit"
- :showType="showType"
- :fail="failMsg"
- @showSubmit="showSubmit"
- ></Submit>
- </div>
- </template>
- <script>
- import {phoneTest,identify,jgpattern} from '@utils/tools.js';
- import Submit from '../common/Submit';
- import api from '@utils/api.js';
- export default {
- name: "Login",
- data(){
- return {
- showType: 'fail',
- failMsg:'',
- submit:false,
- show:false,
- type:'103',
- name:'手机号',
- value:''
- }
- },
- methods:{
- handleType(name,type){
- let tmpType=this.type
- if(tmpType != type){
- this.name = name
- this.type = type
- this.value = ''
- }
- this.show = false
- },
- handleShow(){
- const {show} = this
- this.show = !show
- },
- blur(){
- document.activeElement.scrollIntoViewIfNeeded(true);
- setTimeout(()=>{
- document.activeElement.scrollIntoViewIfNeeded(true);
- },300)
- },
- changeVal(){
- document.activeElement.scrollIntoViewIfNeeded(true);
- const {type,value} = this
- if(type == 102||type == 103){
- this.value=value.replace(/[^\d]/g,'')
- }else if(type == 101 || type == 104){
- this.value=value.replace(/[\u4e00-\u9fa5]/g,'')
- }
- },
- defaultWaring(msg){
- this.$store.commit('handleToggleShow', false);
- this.showType = 'fail'
- this.failMsg = msg
- this.submit = true
- let timer = setTimeout(() => {
- this.submit = false
- clearTimeout(timer)
- }, 2000);
- },
- showSubmit(flg) {
- this.submit = flg
- },
- handleDepart(){
- const {type,value} = this
- if(value){
- if(type == 103){
- console.log(phoneTest.test(value))
- if(!phoneTest.test(value)){//验证不通过
- this.defaultWaring('请输入正确的11位手机号码')
- return
- }
- }else if(type == 101){//身份证
- if(!identify.test(value)){//验证不通过
- this.defaultWaring('请输入正确的身份证号')
- return
- }
- }else if(type == 104){//病历号只能输入数字字母
- if(!jgpattern.test(value)){//验证不通过
- this.defaultWaring('请输入正确的市民卡号')
- return
- }
- }
- const param = {
- "patientInfo": this.value,
- "patientInfoType": this.type
- }
- api.signIn(param).then((res) => {
- const result = res.data;
- if (result.code == 0) {
- if(result.data.length>1){
- this.$router.push({
- name:'Department',
- params:{"result":result.data}
- })
- }else if(result.data.length==1){
- let msg = result.data[0]
- let params = {
- hospitalCode:msg.hospitalCode,
- hospitalDeptCode:msg.hospitalDeptCode,
- doctorCode:msg.doctorCode,
- patientCode:msg.patientCode,
- recordId:msg.recordId
- }
- this.$router.push({
- path:'/',
- query:params
- })
- }else{
- }
- }else{
- this.defaultWaring(res)
- }
- }).catch(()=>{
- this.defaultWaring('网络异常请稍后重试')
- })
- }
- }
- },
- components:{
- Submit
- }
- }
- </script>
- <style lang="less" scoped>
- .login {
- height: 100%;
- width: 100%;
- position: fixed;
- background:linear-gradient(180deg,rgba(79,79,255,1) 0%,rgba(79,137,255,1) 100%);
- padding: .3rem .6rem;
- box-sizing: border-box;
- .top {
- .img {
- width: 1.6rem;
- height: 1.6rem;
- background-color: red;
- margin: 1rem auto 0 auto;
- img {
- width: 100%;
- }
- }
- h4 {
- font-size: .42rem;
- text-align: center;
- color: #fff;
- margin-top: 0.5rem;
- margin-bottom: .8rem;
- font-weight: normal;
- }
- }
- .main {
- width:100%;
- height:5.34rem;
- background:#fff;
- border-radius:.2rem;
- padding: .8rem .6rem;
- box-sizing: border-box;
- font-size: .3rem;
- .iptWrap {
- width:100%;
- height:.88rem;
- background:rgba(242,242,245,1);
- border-radius:.1rem;
- padding: .23rem .3rem;
- box-sizing: border-box;
- }
- .choose {
- position: relative;
- p {
- width: 100%;
- position: relative;
- img {
- position: absolute;
- right: 0;
- top: 0;
- width: .4rem;
- height: .4rem;
- }
- }
- .slideType {
- box-sizing: border-box;
- position: absolute;
- z-index: 10;
- width: 100%;
- top: 0.88rem;
- left: 0;
- box-shadow:0px 4px 20px 0px rgba(102,102,102,0.18);
- border-radius:.1rem;
- background-color: #fff;
- padding: .1rem .3rem 0 .3rem;
- box-sizing: border-box;
- font-size: .28rem;
- li {
- border-bottom: 1px solid #F5F5F5;
- height: .6rem;
- line-height: .6rem;
- box-sizing: border-box;
- }
- }
- }
-
- .number {
- margin: .3rem 0 .8rem 0;
- .input{
- float: left;
- color:rgba(51,51,51,1);
- height:.42rem;
- line-height:.42rem;
- width: 100%;
- background-color: transparent;
- }
- }
- .btn {
- width:100%;
- height:.88rem;
- line-height:.88rem;
- text-align: center;
- background:linear-gradient(270deg,rgba(79,139,255,1) 0%,rgba(79,79,255,1) 100%);
- border-radius:.44rem;
- color: #fff;
- font-size: .32rem;
- font-weight: 500;
- }
- .btnDis {
- opacity: 0.3;
- }
- .btnClick {
- opacity:1;
- }
- }
- .tip {
- color: #fff;
- font-size: .24rem;
- margin-top: .6rem;
- }
- }
- </style>
|