判断是否注册

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' method: 'GET'
}) })
} }
// 获取微信手机号 // 获取微信手机号
export function getwxPhoneNumber(code) { export function getwxPhoneNumber(code) {
return request({ return request({
url: `/applet/register/getPhone/${code}`, url: `/applet/register/getPhone/${code}`,
method: 'GET' method: 'GET'
}) })
}
// 判断是否注册
export function isRegistered(code) {
return request({
url: `/applet/register/isRegistered/${code}`,
method: 'GET'
})
} }

View File

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

View File

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