添加成员+切换账号+注册

This commit is contained in:
shidongli 2023-10-17 16:20:03 +08:00
parent bb428bdcf5
commit 31f4717f78
7 changed files with 545 additions and 447 deletions

View File

@ -20,3 +20,39 @@ export function inviteFriends(patientId) {
},
})
}
// 获取已绑定家庭成员列表
export function getFamilyList(openid,patientCode) {
return request({
url: `/applet/register/switchResident/${openid}/${patientCode}`,
method: 'get',
})
}
// 添加家庭成员
export function registerdata(data) {
return request({
url: '/applet/register',
method: 'POST',
data: data
})
}
// 获取当前注册居民
export function getCurrentUser(openid) {
return request({
url: `/applet/register/getList/${openid}`,
method: 'GET',
header: {
// Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
},
})
}
// 切换
export function switchResident(openid,patientCode) {
return request({
url: `/applet/register/switchResident/${openid}/${patientCode}`,
method: 'GET',
header: {
// Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
},
})
}

View File

@ -3,13 +3,30 @@
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/myinformation/myinformation",
"style": {
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/register/register",
"style": {
"navigationBarTitleText": "注册",
"enablePullDownRefresh": false
}
},
{
"path": "pages/startup/startup",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/startup/startup",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
}, {
"path": "pages/homepage/homepage",
"style": {
"enablePullDownRefresh": false,
@ -22,13 +39,7 @@
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "pages/myinformation/myinformation",
"style": {
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
}, {
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
@ -41,13 +52,7 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/register/register",
"style": {
"navigationBarTitleText": "注册",
"enablePullDownRefresh": false
}
}, {
{
"path": "pages/facecollection/facecollection",
"style": {
"navigationBarTitleText": "人脸采集",
@ -61,8 +66,7 @@
"path": "Behaviorpoints/Behaviorpoints",
"style": {
"navigationBarTitleText": "行为积分",
"onReachBottomDistance": 40, // px
"enablePullDownRefresh": true //true
"enablePullDownRefresh": false
}
},
{
@ -70,6 +74,7 @@
"style": {
"navigationBarTitleText": "预约详情",
"enablePullDownRefresh": false,
// "navigationStyle": "default",
"navigationBarBackgroundColor": "#4ac4ab"
}
},
@ -360,8 +365,7 @@
"path": "PointsMall/PointsMall",
"style": {
"navigationBarTitleText": "积分商城",
"onReachBottomDistance": 40, // px
"enablePullDownRefresh": true //true
"enablePullDownRefresh": false
}
}, {
"path": "screeningResult/screeningResult",
@ -399,8 +403,24 @@
"navigationBarTitleText": "履约详情",
"enablePullDownRefresh": false
}
}
]
},{
"path" : "AddMembers/AddMembers",
"style" :
{
"navigationBarTitleText": "添加成员",
"enablePullDownRefresh": false
}
}
,{
"path" : "Serviceevaluation/Serviceevaluation",
"style" :
{
"navigationBarTitleText": "服务评价",
"enablePullDownRefresh": false
}
}
]
}, {
"root": "pagesC",
"pages": [{
@ -410,13 +430,13 @@
"enablePullDownRefresh": false
}
},
{
"path": "Filinginformation/Filinginformation",
"style": {
"navigationBarTitleText": "查看建档信息"
// "enablePullDownRefresh": false
}
},
// {
// "path": "Filinginformation/Filinginformation",
// "style": {
// "navigationBarTitleText": "查看建档信息"
// // "enablePullDownRefresh": false
// }
// },
{
"path": "Onlinesigning/Onlinesigning",
"style": {
@ -504,13 +524,21 @@
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
},
{
"path": "contractsigningprotocol/contractsigningprotocol",
"style": {
"navigationBarTitleText": "签约协议",
"enablePullDownRefresh": false
}
}
// {
// "path": "contractsigningprotocol/contractsigningprotocol",
// "style": {
// "navigationBarTitleText": "签约协议",
// "enablePullDownRefresh": false
// }
// }
]
}],
"globalStyle": {

View File

@ -162,13 +162,16 @@
},
//
gorecords() {
if (!this.userinfo) {
this.gologin();
} else {
uni.navigateTo({
url: "/pagesC/Screeningrecords/Screeningrecords"
})
}
uni.navigateTo({
url: "/pagesC/Screeningrecords/Screeningrecords"
})
// if (!this.userinfo) {
// this.gologin();
// } else {
// uni.navigateTo({
// url: "/pagesC/Screeningrecords/Screeningrecords"
// })
// }
},
//
healthtest() {
@ -244,4 +247,4 @@
<style lang="scss">
@import "./homepage.scss";
</style>
</style>

View File

@ -89,6 +89,7 @@
let that = this;
isRegistered(that.logincode, that.phonecode).then(resp => {
uni.setStorageSync("openid", resp.data.openid)
uni.setStorageSync("phone", resp.data.phone)
if (resp.data.code == '0') {
that.$refs.uToast.show({
title: '未注册,请先注册',
@ -114,6 +115,7 @@
delta: 1
})
}, 500)
console.log("9999")
} else {
that.$refs.uToast.show({
title: '登录失败',
@ -160,4 +162,4 @@
<style lang="scss">
@import "./login.scss";
</style>
</style>

View File

@ -155,10 +155,13 @@
<view class="mask" v-show="showhome" @click.stop='showhome = false'>
<view class="masktext" @click.stop=''>
<view class="maskcontent">
<!-- <text>{{familyList.patientName}}</text> -->
<template v-for="item in familyList">
<view :class="item.identity === userInfo.identity ? 'p1' : 'p2'" @click.stop="changeFamilyInfo(item)">
<text>{{item.residentName}}</text>
<text>{{item.identity.substring(0,4)}}************{{item.identity.substring(16,18)}}</text>
<view :class="item.cardNo === userinfo.cardNo ? 'p1' : 'p2'"
@click.stop="changeFamilyInfo(item)">
<text>{{item.patientName}}</text>
<text
v-if="item.cardNo">{{item.cardNo.substring(0,4)}}************{{item.cardNo.substring(16,18)}}</text>
</view>
</template>
</view>
@ -167,6 +170,7 @@
</view>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
@ -176,6 +180,10 @@
} from "vuex";
import {
appPersonal,
getFamilyList,
registerdata,
getCurrentUser,
switchResident
} from '@/api/pages/myinformation/myinformation.js';
import {
existPatientInfo
@ -184,6 +192,9 @@
createMobileToken
} from '@/api/pages/login/index.js'
import baseurl from '@/api/baseurl.js'
// import {
// ,
// } from '@/api/pages/homepage/homepage.js'
export default {
data() {
return {
@ -192,21 +203,61 @@
timer: null,
list: {},
showhome: false, //
familyList: {}, //
userinfo: {}, //
valueopenid:'',
};
},
onShow() {
// this.bjimg = baseurl + '/profile/appletPicture/inviteFriendsOne.png'
let that = this
this.baseurl = baseurl
that.userinfo = uni.getStorageSync('userinfo')
console.log(that.userinfo)
that.baseurl = baseurl
const value = uni.getStorageSync('patientId');
this.valueopenid = uni.getStorageSync('openid');
if (value) {
that.myInfo()
} else {
that.appPersonallist = null
}
// getCurrentUser(this.valueopenid).then(res => {
// console.log(res)
// this.familyList = res.data
// })
},
methods: {
//
changeFamilyInfo(e) {
console.log(e,'000')
switchResident(this.valueopenid,e.patientCode).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '切换成功',
type: 'success',
duration: '1000',
})
uni.setStorageSync('userinfo', res.data);
uni.setStorageSync('patientId', res.data.id);
this.myInfo()
}
else{
this.$refs.uToast.show({
title: res.msg,
type: 'error',
duration: '1000',
})
}
})
this.showhome = false
},
remove() {
let that = this
const value = uni.getStorageSync('patientId');
@ -305,11 +356,11 @@
}
},
//
evaluation(){
evaluation() {
uni.navigateTo({
url: '/pagesB/Serviceevaluation/Serviceevaluation'
})
},
//
gologin() {
@ -385,9 +436,13 @@
homeshow() {
// this.getSetting()
// this.listquery.bindingCity = uni.getStorageSync('userInfo').bindingCity
// getFamilyList(this.listquery).then(res => {
// this.familyList = res.data.data
// // })
var patientCode = this.userinfo.patientCode
var openid = uni.getStorageSync('openid')
// getFamilyList(openid, patientCode).then(res => {
// this.familyList = res.data
// console.log(this.familyList, '000')
// })
this.showhome = true
},
//
@ -479,4 +534,4 @@
<style lang="scss">
@import './myinformation.scss'
</style>
</style>

View File

@ -33,12 +33,26 @@
</view>
<span>手机号</span>
<u-form-item prop="phone" :border-bottom="false">
<u-input v-model="query.phone" placeholder="请输入手机号" />
<u-input v-model="query.phone" placeholder="请输入手机号" :disabled="true"/>
</u-form-item>
<span>身份证号</span>
<u-form-item prop="cardNo" :border-bottom="false">
<u-input v-model="query.cardNo" placeholder="请输入身份证号" />
</u-form-item>
<span>户主身份证号</span>
<u-form-item prop="householdCardNo" :border-bottom="false">
<u-input v-model="query.householdCardNo" placeholder="请输入身份证号" />
</u-form-item>
<view class="name">
与户主关系
<view class="select" @click="showNation = true;">
<text v-if="!householdRelationship">请选择与户主关系</text>
<text v-else class="testitem">{{householdRelationship}}</text>
<image src="../../static/huijiantou.png" mode=""></image>
</view>
</view>
<view class="name">
所属区域
<view class="select" @tap='showPicker'>
@ -118,6 +132,7 @@
@funcValue="getpickerParentValue" pickerSize="4">
</m-city>
</view>
<u-select v-model="showNation" :list="actions" @confirm="nationSelect"></u-select>
</view>
</template>
@ -154,6 +169,56 @@
},
data() {
return {
showNation: false, //
actions: [{
value: '1',
label: '户主本人'
},
{
value: '2',
label: '配偶'
},
{
value: '3',
label: '子女'
},{
value: '4',
label: '(外)孙子女'
} ,{
value: '5',
label: '父母'
} ,{
value: '6',
label: '(外)祖父母'
} ,{
value: '7',
label: '兄弟姐妹'
} ,{
value: '8',
label: '儿媳'
} ,{
value: '9',
label: '女婿'
} ,{
value: '10',
label: '孙子女'
} ,{
value: '11',
label: '侄子女'
} ,{
value: '12',
label: '曾孙子女'
},
,{
value: '13',
label: '祖父母'
},
,{
value: '99',
label: '其他'
},
],
tipsText: '',
form: {
name: '',
@ -221,8 +286,11 @@
sex: '',
sexname: '',
birthDate: '',
cityCode: '1'
cityCode: '1',
householdCardNo:'',
householdRelationship:'',
},
householdRelationship:'',
timer: null,
addresslength: null,
patientDiseaseInfoList: [], //
@ -268,6 +336,17 @@
},
message: '请输入正确的身份证号',
trigger: ['blur'],
}],
householdRelationship:[{
message: '请输入户主身份证号',
trigger: ['change', 'blur'],
}, {
validator: (rule, value, callback) => {
return uni.$u.test.idCard(value);
},
message: '请输入正确的身份证号',
trigger: ['blur'],
}]
}
}
@ -280,6 +359,14 @@
// uni.$off('code');
// },
methods: {
//
nationSelect(e) {
console.log(e)
this.query.householdRelationship = e[0].value
this.householdRelationship = e[0].label
// console.log(this.query.householdRelationship)
// this.$refs.uForm.validateField('nation')
},
onChange(e) {
this.selected = e
// console.log(e)
@ -288,12 +375,12 @@
},
//
selectChange(val) {
console.log(val,'999');
console.log(val, '999');
},
cancel() {},
confirm(e) {
this.query.diseaseList = e.map(Number)
console.log(e,'打印e')
this.query.diseaseList = e.map(Number)
console.log(e, '打印e')
},
submit() {
console.log(this.query)
@ -381,83 +468,7 @@
url: '/pages/facecollection/facecollection'
})
},
//
// 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 == '男') {
@ -542,12 +553,12 @@
onLoad(options) {
let that = this
// console.log(options, '00')
uni.$on('headPictureUrl',(res)=>{
console.log(res,'99999')
this.query.headPictureUrl = res.tempImg
uni.$off('headPictureUrl')
// B
})
uni.$on('headPictureUrl', (res) => {
console.log(res, '99999')
this.query.headPictureUrl = res.tempImg
uni.$off('headPictureUrl')
// B
})
// this.query.headPictureUrl = options.headPictureUrl
// this.query.couponId = Number(options.couponId)
@ -570,6 +581,7 @@
that.query.source = 'REGISTER_YOURSELF'
that.query.invitationPatientId = null
}
this.query.phone=uni.getStorageSync("phone")
// const chooseLocation = requirePlugin('chooseLocation');
// const location = chooseLocation.getLocation(); // null
// if (location) {
@ -721,10 +733,11 @@
}
}
::v-deep .u-radio.data-v-643b3322{
::v-deep .u-radio.data-v-643b3322 {
padding-left: 32rpx;
padding-top: 7rpx;
padding-top: 7rpx;
}
::v-deep.input-placeholder {
@ -759,7 +772,7 @@
}
::v-deep .u-radio[data-v-643b3322]{
::v-deep .u-radio[data-v-643b3322] {
margin-top: 8rpx !important;
margin-left: 30rpx !important;

View File

@ -13,70 +13,113 @@
</view>
</view>
<view class="contentbottom">
<u-form :model="form" ref="uForm">
<u-form-item prop="cardNo" :border-bottom="false">
<view class="name">
身份证号
<u-input @blur="inputBlur()" v-model="form.identity" placeholder="请输入身份证号" />
<view class="idScan">
<!-- <u-icon slot="right" name="arrow-right"></u-icon> -->
<image style="width: 28rpx;height: 28rpx;" src="../../static/pagesB/sweep.png" mode="">
</image>
</view>
</view>
<view class="name">
姓名
<u-input v-model="value" placeholder="请输入姓名" />
</view>
<view class="name">
性别
<view class="sex">
<u-radio-group v-model="form.gender" size='30'>
<u-radio @change='changeGender' v-for="(item, index) in sexlist" :key="index"
:name="item.name" active-color="#26A888" :disabled="item.disabled">
{{item.name}}
</u-radio>
</u-radio-group>
</view>
</view>
<view class="name">
民族
<view class="select" @click="showNation = true;">
<text>请选择民族</text>
<image src="../../static/huijiantou.png" mode=""></image>
</view>
</view>
<view class="name">
出生日期
<view class="select">
<text>请选择出生日期</text>
<image src="../../static/huijiantou.png" mode=""></image>
</view>
</view>
<view class="name">
与户主的关系
<view class="select" @click="showRelationshipWithHouseholder = true;">
<text>请选择与户主的关系</text>
<image src="../../static/huijiantou.png" mode=""></image>
</view>
</view>
<view class="name">
身份证号
<u-input v-model="form.cardNo" placeholder="请输入身份证号" />
<view class="idScan">
<!-- <u-icon slot="right" name="arrow-right"></u-icon> -->
<image style="width: 28rpx;height: 28rpx;" src="../../static/pagesB/sweep.png" mode="">
</image>
</view>
</view>
</u-form-item>
<u-form-item prop="patientName" :border-bottom="false">
<view class="name">
姓名
<u-input v-model="form.patientName" placeholder="请输入姓名" />
</view>
</u-form-item>
<u-form-item prop="sex" :border-bottom="false">
<view class="name">
性别
<view class="sex">
<u-radio-group v-model="form.sexname" size='30'>
<u-radio @change='changeGender' v-for="(item, index) in sexlist" :key="index"
:name="item.name" active-color="#26A888" :disabled="item.disabled">
{{item.name}}
</u-radio>
</u-radio-group>
</view>
</view>
</u-form-item>
<u-form-item prop="nation" :border-bottom="false">
<view class="name">
民族
<view class="select" @click="showNation = true;">
<text v-if="!nation">请选择民族</text>
<!-- <text v-if="!householdRelationship">请选择与户主关系</text> -->
<text v-else class="testitem">{{nation}}</text>
<image src="../../static/huijiantou.png" mode=""></image>
</view>
</view>
</u-form-item>
<u-form-item prop="birthDate" :border-bottom="false">
<view class="name">
出生日期
<view class="select" @tap='timeshow=true'>
<text v-if="form.birthDate==''">请选择出生日期</text>
<text v-else class="testitem">{{form.birthDate}}</text>
<image src="../../static/huijiantou.png" mode=""></image>
</view>
</view>
<!-- <view class="name">
出生日期
<view class="select">
<text v-if="!form.birthDate">请选择出生日期</text>
<text v-else class="testitem">{{form.birthDate}}</text>
<image src="../../static/huijiantou.png" mode=""></image>
</view>
</view> -->
</u-form-item>
<u-form-item prop="householdRelationship" :border-bottom="false">
<view class="name">
与户主的关系
<view class="select" @click="showRelationshipWithHouseholder = true;">
<text v-if="!householdRelationship">请选择与户主关系</text>
<text v-else class="testitem">{{householdRelationship}}</text>
</view>
</view>
</u-form-item>
<u-form-item prop="" :border-bottom="false">
<view class="name">
户主身份证号
<u-input v-model="form.householdCardNo" placeholder="请输入身份证号" />
</view>
</u-form-item>
<view class="name">
居住地址
<u-input v-model="form.address" placeholder="请输入居住地址" />
</view>
<view class="name">
手机号
<u-input v-model="form.phone" placeholder="请输入手机号" />
</view>
<u-form-item prop="address" :border-bottom="false">
<view class="name">
居住地址
<u-input v-model="form.address" placeholder="请输入居住地址" />
</view>
</u-form-item>
<u-form-item prop="phone" :border-bottom="false">
<view class="name">
手机号
<u-input v-model="form.phone" placeholder="请输入手机号" />
</view>
</u-form-item>
</u-form>
</view>
<u-select v-model="showNation" :list="actions" @confirm="nationSelect"></u-select>
<u-select v-model="showRelationshipWithHouseholder" :list="actions" @confirm="nationSelect"></u-select>
<u-toast ref="uToast" />
<view class="nextpage" @tap="gonextstep">
<view class="nextpage" @tap="register">
添加
</view>
<!-- 民族 -->
<u-select v-model="showNation" :list="actions" @confirm="nationSelect"></u-select>
<!-- 与户主关系 -->
<u-select v-model="showRelationshipWithHouseholder" :list="relationship" @confirm="relationshipSelect"></u-select>
<!-- 出生日期 -->
<u-picker mode="time" v-model="timeshow" :params="params" @confirm='timechange' @canel='timeshow=false'>
</u-picker>
</view>
</view>
@ -84,6 +127,10 @@
</template>
<script>
import {
registerdata
} from '@/api/pages/register/register.js'
// import {
// bindFamilyUser,
// getDictByType
@ -101,6 +148,15 @@
disabled: false
}
],
timeshow: false, //
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
mode: '',
newTime: '',
barTitle: '添加成员',
@ -113,27 +169,77 @@
// flag
ifSex: '',
form: {
identity: '',
residentName: '',
gender: '',
nation: '汉族',
cardNo: '',
patientName: '',
sexname: '',
nation: '',
address: '',
phone: '',
birthday: '',
relationshipWithHouseholder: '',
bindingCity: ''
birthDate: '',
householdRelationship: '',
},
relationshipWithHouseholder: '',
householdRelationship:'',
userinfo:{},
nation:'',
actions: [{
value: '1',
label: '汉族'
},
{
value: '2',
label: '少数名族'
}
],
relationship: [{
value: '1',
label: '户主本人'
},
{
value: '2',
label: '配偶'
},
{
value: '3',
label: '子女'
}, {
value: '4',
label: '(外)孙子女'
}, {
value: '5',
label: '父母'
}, {
value: '6',
label: '(外)祖父母'
}, {
value: '7',
label: '兄弟姐妹'
}, {
value: '8',
label: '儿媳'
}, {
value: '9',
label: '女婿'
}, {
value: '10',
label: '孙子女'
}, {
value: '11',
label: '侄子女'
}, {
value: '12',
label: '曾孙子女'
}, , {
value: '13',
label: '祖父母'
}, , {
value: '99',
label: '其他'
},
],
radiolist: [{
name: '男',
disabled: false
@ -144,7 +250,7 @@
}
],
rules: {
identity: [{
cardNo: [{
//
required: true,
message: '请输入身份证号',
@ -160,12 +266,12 @@
// blurchange
trigger: ['change', 'blur'],
}],
residentName: [{
patientName: [{
required: true,
message: '请输入姓名',
trigger: ['change', 'blur']
}],
gender: [{
sex: [{
min: 1,
required: true,
message: '请选择性别',
@ -177,18 +283,18 @@
message: '请选择民族',
trigger: ['blur', 'change']
}],
birthday: [{
birthDate: [{
min: 1,
required: true,
message: '请选择出生日期',
trigger: ['blur', 'change']
}],
// relationshipWithHouseholder: [{
// min: 1,
// required: true,
// message: '',
// trigger: ['blur', 'change']
// }],
householdRelationship: [{
min: 1,
required: true,
message: '请选择与户主关系',
trigger: ['blur', 'change']
}],
address: [{
required: true,
message: '请输入居住地址',
@ -228,41 +334,11 @@
},
}
},
onLoad(options) {
console.log(this.address, '546545454');
getDictByType('householderRelationship').then(res => {
this.dictList = res.data.data
console.log(res);
let arr = []
for (let i of res.data.data) {
arr.push(i.dictLabel)
}
this.gxcolumn.push(arr)
})
this.form.openid = uni.getStorageSync('openId')
if (uni.getStorageSync('location') == '德州市') {
this.form.bindingCity = '1'
} else if (uni.getStorageSync('location') == '东营市') {
this.form.bindingCity = '2'
} else if (uni.getStorageSync('location') == '济南市') {
this.form.bindingCity = '3'
}
console.log(this.form.bindingCity);
if (options.mode) {
this.mode = options.mode
this.barTitle = '授权登录'
} else {
return
}
this.form.openid = uni.getStorageSync('openid')
this.qqmapsdk = new QQMapWX({
//
key: 'Q4DBZ-UIMC2-B63UX-CUZ6A-S3UT7-TBF3V'
}),
this.getAddress(),
this.getLocal(),
//
this.getAtTime()
},
onShow() {
if (this.address != uni.getStorageSync('location')) {
@ -270,12 +346,10 @@
delta: 1
})
}
this.address = uni.getStorageSync('location')
// console.log('aaaa',this.address);
},
// onReadyonLoad
onReady() {
// this.$refs.uForm.setRules(this.rules);
this.$refs.uForm.setRules(this.rules);
},
beforeDestroy() {
wx.exitMiniProgram({
@ -285,65 +359,55 @@
})
},
methods: {
//
//
timechange(e) {
this.form.birthDate = e.year + '-' + e.month + '-' + e.day
},
//
register() {
const _this = this
this.$refs.uForm.validate().then(res => {
if (this.form.gender == '男') {
this.form.gender = '1'
} else {
this.form.gender = '2'
}
if (this.form.gender) {
bindFamilyUser(_this.form).then(res => {
if (res.data.code == '0') {
uni.showModal({
title: '提示',
content: res.data.msg,
_this.userinfo = uni.getStorageSync('userinfo');
_this.form.openid = uni.getStorageSync('openid');
_this.form.cityCode=_this.userinfo.cityCode
console.log(_this.form, '000')
if (_this.form.sexname == '男') {
_this.form.sex = 'MALE';
} else if (_this.form.sexname == '女') {
_this.form.sex = 'FEMALE';
}
if (_this.form.sex == "") {
_this.$refs.uToast.show({
title: '请选择性别',
type: 'error'
})
}
_this.$refs.uForm.validate(valid => {
if (valid) {
registerdata(_this.form).then(res => {
if (res.code == 500) {
_this.$refs.uToast.show({
title: res.data.msg,
type: 'error'
})
}
if (res.header.Authorization) {
uni.setStorageSync('token', res.header.Authorization)
}
if (res.data.msg == '请求成功') {
if (_this.mode == '注册') {
uni.setStorageSync('userInfo', res.data.data)
uni.showToast({
title: '注册成功',
duration: 1000
});
setTimeout(function() {
uni.switchTab({
url: '/pages/user/user'
})
}, 1000);
} else {
uni.showToast({
title: '添加成功',
duration: 1000
});
setTimeout(function() {
uni.navigateBack({
delta: 1
})
}, 1000);
}
}else{
_this.$refs.uToast.show({
title: '添加成功',
type: 'success'
})
uni.navigateBack({
delta: 1
})
// this.back()
}
})
} else {
uni.showToast({
title: "校验失败"
})
}
}).catch(errors => {
uni.showToast({
title: "校验失败"
})
})
if (this.ifSex == '') {
this.ifSex = true
}
});
},
back() {
uni.navigateBack({
@ -352,138 +416,24 @@
},
changeGender(e) {
if (e == '男') {
this.form.gender = '1'
} else {
this.form.gender = '2'
this.form.sex = 'MALE';
} else if (e == '女') {
this.form.sex = 'FEMALE';
}
},
//
nationSelect(e) {
this.form.nation = e.name
this.$refs.uForm.validateField('nation')
this.form.nation = e[0].value
this.nation = e[0].label
},
// datanewTime newTime
getAtTime() {
const atNewdate = new Date().getTime();
this.newTime = atNewdate
},
//
inputBlur(e) {
this.$refs.uForm.validateField('identity', (errorsRes) => {
if (errorsRes == '') {
const cutIdYear = e.substr(6, 4) //
const cutIdMonth = e.substr(10, 2) //
const cutIdDay = e.substr(12, 2) //
const newCutId = cutIdYear + "-" + cutIdMonth + "-" + cutIdDay // xxxx-xx-xx
this.form.birthday = newCutId
this.$refs.uForm.validateField('birthday') // bug
//
let mySex = e.substr(16, 1)
console.log(mySex)
if (parseInt(mySex) % 2 === 1) {
this.form.gender = this.radiolist[0].name;
} else {
this.form.gender = this.radiolist[1].name;
}
console.log(mySex);
} else {
this.form.birthday = ''
}
})
},
//
confirm(e) {
this.showBirthday = false //
const timeFormat = uni.$u.timeFormat //
const newDate = timeFormat(e.value, 'yyyy-mm-dd') //
this.form.birthday = newDate //
this.$refs.uForm.validateField('birthday') //
},
//
cancel() {
this.showBirthday = false //
this.$refs.uForm.validateField('birthday') //
},
gxcancel() {
this.showRelationshipWithHouseholder = false
this.$refs.uForm.validateField('relationshipWithHouseholder')
},
gxconfirm(e) {
this.relationshipWithHouseholder = e.value[0]
this.form.relationshipWithHouseholder = this.dictList.find(item => item.dictLabel == e.value[0]).dictValue
this.showRelationshipWithHouseholder = false
this.$refs.uForm.validateField('relationshipWithHouseholder')
},
//
radioChange(e) {
this.ifSex = e
// if(e == '') {
// this.form.gender = '1'
// } else {
// this.form.gender = '2'
// }
//
relationshipSelect(e) {
this.form.householdRelationship = e[0].value
this.householdRelationship = e[0].label
},
//
getAddress() {
//vm === vue
let vm = this;
uni.getLocation({
type: 'wgs84',
//
success: (res) => {
// console.log(res);
vm.addInfo.latitude = res.latitude
vm.addInfo.longitude = res.longitude
//vm.getLocal Vue
vm.getLocal(vm.addInfo.latitude, vm.addInfo.longitude)
},
//
fail: (res) => {
// console.log('fail' + JSON.stringify(res))
uni.showToast({
icon: 'none',
title: '获取地址失败,请打开定位',
})
}
})
},
getLocal(latitude, longitude) {
let vm = this
//qqmap reverseGeocoder
vm.qqmapsdk.reverseGeocoder({
location: {
latitude: latitude,
longitude: longitude
},
success: (res) => {
// vm.address = res.result.ad_info.city
// uni.setStorageSync('location', res.result.ad_info.city)
// if (res.result.ad_info.city == '') {
// this.form.bindingCity = '1'
// } else if (res.result.ad_info.city == '') {
// this.form.bindingCity = '2'
// }
},
fail: (res) => {
// console.log(res)
}
})
},
// goLocation() {
// uni.navigateTo({
// url: '/pages/location/location'
// })
// },
//
// FunConfirm(e) {
// console.log(e);
// this.isShow = false
// this.address = e.value[1]
// },
}
}
</script>
@ -502,6 +452,7 @@
border-radius: 5rpx;
margin: 15rpx auto;
position: relative;
::v-deep .u-input {
width: 630rpx;
height: 63rpx;
@ -509,19 +460,21 @@
color: #8E8E8E;
// border: 1rpx solid red;
// margin: 12rpx auto;
border: none;
border: none !important;
border-radius: 5rpx;
.u-input__input {
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #000000 !important;
padding-left: 20rpx;
}
}
.u-form-item{
padding: 0 0 !important;
}
.text_title {
@ -548,8 +501,8 @@
border-radius: 2rpx;
.text_con_pic {
margin-right: 10rpx;
margin-left: 9rpx;
margin-right: 10rpx;
margin-left: 9rpx;
image {
width: 14rpx;
@ -608,9 +561,9 @@
.idScan {
position: absolute;
top: 87rpx;
top: 75rpx;
right: 60rpx;
transform: translate(0%, -40%);
// transform: translate(0%, -40%);
}
.sex {
@ -643,14 +596,14 @@
// color: #8E8E8E !important;
// font-size: 20rpx !important;
// }
::v-deep.input-placeholder {
color: #8E8E8E !important;
font-size: 20rpx;
font-family: Source Han Sans CN;
font-weight: 400;
}
::v-deep.uni-input-placeholder {
color: #8E8E8E !important;
font-size: 20rpx;
@ -664,9 +617,9 @@
// color: #8E8E8E !important;
// font-size: 20rpx !important;
// }
::v-deep .uni-input-input{
::v-deep .uni-input-input {
padding-left: 20rpx !important;
}
.select {
@ -677,6 +630,14 @@
border-radius: 5rpx;
display: flex;
position: relative;
.testitem {
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #000000;
}
text {
padding-left: 20rpx;