判断是否注册

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,9 +13,6 @@ export function createMobileToken() {
method: 'GET' method: 'GET'
}) })
} }
// 获取微信手机号 // 获取微信手机号
export function getwxPhoneNumber(code) { export function getwxPhoneNumber(code) {
return request({ return request({
@ -23,3 +20,11 @@ export function getwxPhoneNumber(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
@ -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'
}, },
@ -314,9 +315,9 @@
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==""){
@ -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,16 +570,16 @@
}, },
// //
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() {
// // // //