|
@@ -9,31 +9,42 @@
|
|
|
<p @click="handleShow">{{name}} <img src="../images/down.png" /></p>
|
|
|
<div class="slideType" v-if="show">
|
|
|
<ul>
|
|
|
- <li @click="handleType('手机号',1)">手机号</li>
|
|
|
- <li @click="handleType('身份证号',2)">身份证号</li>
|
|
|
- <li @click="handleType('病历号',3)">病历号</li>
|
|
|
- <li @click="handleType('市民卡号',4)" style="border:0 none">市民卡号</li>
|
|
|
+ <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==1?11:type==2?18:type==3?7:type==4?9:30" v-model="value" @input="changeVal" :type="type!=2?'tel':'text'" class="input" type="text" :placeholder="'请输入'+name" >
|
|
|
+ <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} from '@utils/tools.js';
|
|
|
+ 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:'1',
|
|
|
+ type:'103',
|
|
|
name:'手机号',
|
|
|
value:''
|
|
|
}
|
|
@@ -60,28 +71,69 @@
|
|
|
},
|
|
|
changeVal(){
|
|
|
document.activeElement.scrollIntoViewIfNeeded(true);
|
|
|
- if(this.type != 2){
|
|
|
- this.value=this.value.replace(/[^\d]/g,'')
|
|
|
+ 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(type == 1){
|
|
|
- console.log(phoneTest.test(value))
|
|
|
- if(!phoneTest.test(value)){//验证不通过
|
|
|
-
|
|
|
- }
|
|
|
- }else if(type == 2){
|
|
|
|
|
|
- }else if(type == 3){
|
|
|
-
|
|
|
- }else if(type == 4){
|
|
|
-
|
|
|
- }
|
|
|
if(value){
|
|
|
- this.$router.replace({path:'/department'})
|
|
|
+ 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.replace({
|
|
|
+ name:'Department',
|
|
|
+ params:{"result":result.data}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.defaultWaring(res)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ components:{
|
|
|
+ Submit
|
|
|
}
|
|
|
}
|
|
|
</script>
|