判断是否注册

This commit is contained in:
shidongli 2023-10-11 14:22:12 +08:00
parent a719e9d2c9
commit 8989cabfb0
3 changed files with 181 additions and 147 deletions

View File

@ -13,13 +13,18 @@ export function createMobileToken() {
method: 'GET'
})
}
// 获取微信手机号
export function getwxPhoneNumber(code) {
return request({
url: `/applet/register/getPhone/${code}`,
method: 'GET'
})
}
// 判断是否注册
export function isRegistered(code) {
return request({
url: `/applet/register/isRegistered/${code}`,
method: 'GET'
})
}

View File

@ -12,6 +12,7 @@
import {
appLoginpwd,
getWeChatUser,
isRegistered,
} from '../../api/pages/login/index.js'
import {
createMobileToken
@ -23,7 +24,8 @@
logincode: undefined,
code:undefined,
timer: undefined,
scenenurseStationId: undefined
scenenurseStationId: undefined,
codes:'',
};
},
onShow() {
@ -44,49 +46,76 @@
// uni.$emit('code',loginRes.code)
that.code = loginRes.code
that.pwdlogin();
isRegistered(that.code).then(resp=>{
console.log(resp,'0000')
if(!resp.data){
uni.navigateTo({
url:`/pages/register/register?code=${that.logincode}`
})
}else{
uni.setStorageSync('userinfo', resp.data);
uni.switchTab({
url:'/pages/homepage/homepage'
})
}
}),
that.codes=that.code
that.login()
}
});
}
},
//
isRegisteredget(){
},
login() {
getWeChatUser(this.code).then(res => {
let that = this;
console.log(that.codes,'9999')
getWeChatUser(that.codes).then(res => {
if (res.code == 200) {
uni.setStorageSync("openid", res.data)
uni.setStorageSync("patientId", res.data.id)
uni.setStorageSync("phone", res.data.phone)
this.$refs.uToast.show({
title: '登录成功',
type: 'success',
duration: '1500'
})
console.log(this.logincode)
this.phonecode = undefined
this.logincode = undefined
uni.setStorageSync("Refresh", 'Refresh')
if (this.timer) {
clearTimeout(this.timer)
}
// uni.setStorageSync("patientId", res.data.id)
// uni.setStorageSync("phone", res.data.phone)
// this.$refs.uToast.show({
// title: '',
// type: 'success',
// duration: '1500'
// })
// console.log(this.logincode)
// this.phonecode = undefined
// this.logincode = undefined
// uni.setStorageSync("Refresh", 'Refresh')
// if (this.timer) {
// clearTimeout(this.timer)
// }
// this.timer = setTimeout(e => {
// uni.navigateBack({
// delta: 1
// })
// }, 500)
} else {
this.$refs.uToast.show({
title: '登录失败',
type: 'error',
duration: '1500'
})
// this.$refs.uToast.show({
// title: '',
// type: 'error',
// duration: '1500'
// })
}
})
},
pwdlogin() {
var that = this
uni.clearStorageSync();
uni.navigateTo({
url:`/pages/register/register?code=${this.logincode}`
})
that.login()
// createMobileToken().then(res => {
// uni.setStorageSync("token", res.data.token)

View File

@ -1,7 +1,7 @@
<template>
<view class="register">
<view class="head" @tap="Face">
<image class="Facecollection" :src="query.headPictureUrl" v-if="this.query.headPictureUrl"></image>
<image class="Facecollection" :src="query.headPictureUrl" v-if="query.headPictureUrl"></image>
<image class="Facecollection" src="../../static/pages/Facecollection.png" v-else></image>
<span>人脸采集</span>
@ -15,7 +15,7 @@
<view class="name">
性别
<view class="sex">
<u-radio-group v-model="query.sex" size='30'>
<u-radio-group v-model="query.sexname" size='30'>
<u-radio @change='sexchange' v-for="(item, index) in sexlist" :key="index" :name="item.name"
active-color="#26A888" :disabled="item.disabled">
{{item.name}}
@ -66,11 +66,7 @@
</view>
</view>
<view class="">
<m-city style='z-index: 10076;' :provinceData="list" headTitle="地区选择" ref="cityPicker"
@funcValue="getpickerParentValue" pickerSize="4">
</m-city>
</view>
<view class="name">
基础疾病
<view class="select" @tap="godisease">
@ -122,6 +118,11 @@
</u-mask>
<u-picker mode="time" v-model="timeshow" :params="params" @confirm='timechange' @canel='timeshow=false'>
</u-picker>
<view class="">
<m-city style='z-index: 10076;' :provinceData="list" headTitle="地区选择" ref="cityPicker"
@funcValue="getpickerParentValue" pickerSize="4">
</m-city>
</view>
</view>
</template>
@ -138,7 +139,7 @@
import {
getSubordinateRegions,
} from '@/api/pagesB/modifyAddress/modifyAddress.js';
import gkcity from "../../components/m-city/m-city.vue";
import gkcity from "@/components/m-city/m-city.vue";
import ldSelect from '../../components/ld-select/ld-select.vue';
import {
registerdata
@ -181,7 +182,7 @@
}
],
// radio: 1,
selected: '',
options: [{
value: '1',
@ -205,7 +206,6 @@
localName: "请选择",
children: [],
}, ],
areashow: false, //
maskshow: false, //
getNurseTypelist: [], //
medicalcarelist: [], //
@ -227,6 +227,7 @@
patientId: '',
locationName: '',
sex: '',
sexname:'',
birthDate: '',
cityCode: '1'
},
@ -282,9 +283,9 @@
// onload(){
// },
// onUnload() {
// //
// uni.$off('code');
// onUnload() {
// //
// uni.$off('code');
// },
methods: {
onChange(e) {
@ -311,12 +312,12 @@
// uni.navigateTo({
// url: '/pagesB/information/information'
// })
var that = this
that.query.openid = uni.getStorageSync('openid');
if (that.query.sex == '男') {
if (that.query.sexname == '男') {
that.query.sex = 'MALE';
} else if (that.query.sex == '女') {
} else if (that.query.sexname == '女') {
that.query.sex = 'FEMALE';
}
if(that.query.sex==""){
@ -324,10 +325,10 @@
title: '请选择性别',
type: 'error'
})
}
console.log(that.selected)
if (!that.query.locationName) {
that.$refs.uToast.show({
title: '请选择所在位置',
@ -362,14 +363,14 @@
type: 'success',
duration: '1000',
})
uni.switchTab({
uni.switchTab({
url: '/pages/homepage/homepage' ,
});
}
})
}
} else {
console.log('验证失败');
}
@ -393,82 +394,82 @@
//
informationinfo() {
var that = this
if (that.query.sex == '男') {
that.query.sex = 'MALE';
} else if (that.query.sex == '女') {
that.query.sex = 'FEMALE';
}
if (this.addresslength) {
if (this.addresslength.length > 2) {
const value = uni.getStorageSync('phone');
if (value) {
that.query.phone = value
if (that.radio == 1) {
that.$refs.uToast.show({
title: '请审核并同意用户协议',
type: 'error'
})
} else {
const patientId = uni.getStorageSync('patientId');
AppIdentification(patientId).then(resp => {
if (resp.code == 200) {
if (resp.data.loginFlag) {
that.$refs.uToast.show({
title: '您已完善',
type: 'success',
})
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
uni.navigateBack({
delta: 1
})
}, 1500)
} else {
information(that.query).then(res => {
if (res.code == 200) {
uni.removeStorageSync('invitationPatientId');
that.$refs.uToast.show({
title: '完善信息成功',
type: 'success',
duration: '1500'
})
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
uni.navigateBack({
delta: 1
})
}, 1500)
} else if (res.code == 500) {
that.$refs.uToast.show({
title: res.msg,
type: 'error',
})
}
})
}
}
})
}
}
} else {
that.$refs.uToast.show({
title: '所属区域应选择所在的区或街道,请重新选择!',
type: 'error'
})
}
} else {
that.$refs.uToast.show({
title: '所属区域应选择所在的区或街道,请重新选择!',
type: 'error'
})
}
},
// informationinfo() {
// var that = this
// if (that.query.sex == '') {
// that.query.sex = 'MALE';
// } else if (that.query.sex == '') {
// that.query.sex = 'FEMALE';
// }
// if (this.addresslength) {
// if (this.addresslength.length > 2) {
// const value = uni.getStorageSync('phone');
// if (value) {
// that.query.phone = value
// if (that.radio == 1) {
// that.$refs.uToast.show({
// title: '',
// type: 'error'
// })
// } else {
// const patientId = uni.getStorageSync('patientId');
// AppIdentification(patientId).then(resp => {
// if (resp.code == 200) {
// if (resp.data.loginFlag) {
// that.$refs.uToast.show({
// title: '',
// type: 'success',
// })
// if (that.timer) {
// clearTimeout(that.timer)
// }
// that.timer = setTimeout(e => {
// uni.navigateBack({
// delta: 1
// })
// }, 1500)
// } else {
// information(that.query).then(res => {
// if (res.code == 200) {
// uni.removeStorageSync('invitationPatientId');
// that.$refs.uToast.show({
// title: '',
// type: 'success',
// duration: '1500'
// })
// if (that.timer) {
// clearTimeout(that.timer)
// }
// that.timer = setTimeout(e => {
// uni.navigateBack({
// delta: 1
// })
// }, 1500)
// } else if (res.code == 500) {
// that.$refs.uToast.show({
// title: res.msg,
// type: 'error',
// })
// }
// })
// }
// }
// })
// }
// }
// } else {
// that.$refs.uToast.show({
// title: ',!',
// type: 'error'
// })
// }
// } else {
// that.$refs.uToast.show({
// title: ',!',
// type: 'error'
// })
// }
// },
//
sexchange(e) {
if (e == '男') {
@ -509,12 +510,12 @@
// });
// },
//
getNurseTypeInfo() {
getNurseType().then(res => {
this.medicalcarelist = res.data.filter(e => e.nurseTypeName == '医疗护理')
this.getNurseTypelist = res.data.filter(e => e.nurseTypeName != '医疗护理')
})
},
// getNurseTypeInfo() {
// getNurseType().then(res => {
// this.medicalcarelist = res.data.filter(e => e.nurseTypeName == '')
// this.getNurseTypelist = res.data.filter(e => e.nurseTypeName != '')
// })
// },
//
areaInfo() {
getSubordinateRegions().then(res => {
@ -540,7 +541,6 @@
},
//
showPicker() {
this.areashow = true
this.$refs.cityPicker.show();
},
//
@ -570,20 +570,20 @@
},
//
onLoad(options) {
let that = this
console.log(options, '00')
this.query.headPictureUrl = options.headPictureUrl
let that = this
this.query.couponId = Number(options.couponId)
const value = uni.getStorageSync('patientId');
if (value) {
that.query.patientId = value
}
// this.query.couponId = Number(options.couponId)
// const value = uni.getStorageSync('patientId');
// if (value) {
// that.query.patientId = value
// }
this.areaInfo()
this.getNurseTypeInfo();
// this.getNurseTypeInfo();
},
// onUnload() {
// //
// uni.$off('code');
// onUnload() {
// //
// uni.$off('code');
// },
//
@ -591,8 +591,8 @@
onShow() {
// uni.$on('headPictureUrl',(res)=>{
// console.log(res, '000') // B
// // this.usnerinfo = options;
// })
// // this.usnerinfo = options;
// })
var that = this
const invitationPatientId = uni.getStorageSync('invitationPatientId')
if (invitationPatientId) {
@ -702,7 +702,7 @@
}
.radio-right {
height: 100rpx;
.radio {
display: inline-block;
width: 50rpx;
@ -749,7 +749,7 @@
// margin: 12rpx auto;
border: none;
border-radius: 5rpx;
.u-input__input {
font-size: 26rpx;
@ -938,4 +938,4 @@
/deep/ .u-form-item__message {
padding-left: 0 !important;
}
</style>
</style>