This commit is contained in:
曹辉 2022-10-18 08:54:14 +08:00
parent b5594d827b
commit e9b8660f69
4 changed files with 149 additions and 45 deletions

View File

@ -10,6 +10,16 @@ export function getRegionAndStreetInfo() {
//完善信息登录
export function information(data) {
return request({
url: `/nurseApp/login/information`,
method: 'POST',
data
})
}
//查询护理类型信息 //查询护理类型信息
export function getNurseType() { export function getNurseType() {
return request({ return request({

View File

@ -2,6 +2,9 @@ import baseurl from './baseurl.js'
var request = function(config) { var request = function(config) {
return new Promise((resolve, rejected) => { return new Promise((resolve, rejected) => {
uni.showLoading({
title: ''
});
uni.request({ uni.request({
url: baseurl + config.url, url: baseurl + config.url,
data: config.data, data: config.data,
@ -25,6 +28,7 @@ var request = function(config) {
// }) // })
// } else { // } else {
// if (res.data.success) { // if (res.data.success) {
uni.hideLoading();
resolve(res.data) resolve(res.data)
// } else { // } else {
// uni.showToast({ // uni.showToast({
@ -35,6 +39,7 @@ var request = function(config) {
// } // }
}, },
fail(err) { fail(err) {
uni.hideLoading();
rejected(err) rejected(err)
} }
}) })

View File

@ -3,10 +3,9 @@
<view style="height: 20rpx;background-color: #F4F5F7;"> <view style="height: 20rpx;background-color: #F4F5F7;">
</view> </view>
<view class="items"> <view class="items">
<view class="item" style="background-color: #4C7BC9;color: #ffffff;"> <view class="item"
:style="disease.find(e => e.id == item.id)?'background-color: #4C7BC9;color: #ffffff;':''"
</view> v-for='(item,index) in diseaselist' :key="index" @tap='choicedisease(item)'>
<view class="item" v-for='(item,index) in diseaselist' :key="index">
{{item.diseaseName}} {{item.diseaseName}}
</view> </view>
<view class="other"> <view class="other">
@ -14,7 +13,7 @@
<!-- <input type="text"> --> <!-- <input type="text"> -->
<u-input type="text" placeholder='请填写' /> <u-input type="text" placeholder='请填写' />
</view> </view>
<view class="btn"> <view class="btn" @tap='goinformation'>
提交 提交
</view> </view>
</view> </view>
@ -28,19 +27,53 @@
export default { export default {
data() { data() {
return { return {
diseaselist: [], diseaselist: [], //
disease: [{ //list
id: 9999,
diseaseName: '无'
}],
}; };
}, },
onLoad() {
this.diseaseinfo()
},
methods: { methods: {
//
choicedisease(item) {
if (this.disease.findIndex(e => e.id == item.id) == -1) {
this.disease.push(item)
} else {
this.disease = this.disease.filter(e => e.id != item.id)
}
if (this.disease.length > 1) {
console.log(this.disease.length)
this.disease = this.disease.filter(e => e.id != 9999)
}
console.log(this.disease)
},
//
diseaseinfo() { diseaseinfo() {
getDiseaseInfo().then(res => { getDiseaseInfo().then(res => {
this.diseaselist = res.data; this.diseaselist = res.data;
this.diseaselist.unshift({
id: 9999,
diseaseName: '无'
})
}) })
}, },
} //
goinformation() {
uni.$emit('disease', {
disease: JSON.stringify(this.disease)
})
uni.navigateBack({
delta: 1
});
}
},
onLoad(options) { //
this.diseaseinfo()
//
this.disease = JSON.parse(options.diseaseInfoList)
console.log(JSON.parse(options.diseaseInfoList))
},
} }
</script> </script>

View File

@ -19,7 +19,6 @@
<view class="userinfo info"> <view class="userinfo info">
<view class="item"> <view class="item">
<span>姓名:</span> <span>姓名:</span>
<!-- <input type="text"> -->
<u-input v-model="query.patientName" type="text" placeholder='' maxlength='5' /> <u-input v-model="query.patientName" type="text" placeholder='' maxlength='5' />
</view> </view>
<view class="item"> <view class="item">
@ -32,9 +31,7 @@
</view> </view>
<view class="item" @tap='areashow=true'> <view class="item" @tap='areashow=true'>
<span>所属区域:</span> <span>所属区域:</span>
<view></view> <view>{{address}}</view>
<u-select v-model="areashow" label-name='areaName' value-name='areaCode' mode="mutil-column-auto"
:list="arealist" @confirm="areaconfirm"></u-select>
</view> </view>
<view class="item"> <view class="item">
<span>详细地址:</span> <span>详细地址:</span>
@ -45,33 +42,37 @@
<view></view> <view></view>
<!-- <u-input type="text" placeholder='' /> --> <!-- <u-input type="text" placeholder='' /> -->
</view> </view>
</view> </view>
<u-select v-model="areashow" mode="mutil-column-auto" label-name='areaName' value-name='areaCode'
:list="arealist" @confirm="areaconfirm"></u-select>
<view class="info"> <view class="info">
<view class="service"> <view class="service">
<view class="title"> <view class="title">
所属服务 所属服务
</view> </view>
<view class="Multiplechoice"> <view class="Multiplechoice">
<view class="choice" @tap="gondisease"> <view :class="query.nurseTypeIdList.find(e => e == item.id)?'choices':'choice'"
服务1 v-for="(item,index) in getNurseTypelist" :key="item.id" @tap="addnurseType(item)">
</view> {{item.nurseTypeName}}
<view class="choice" v-for="(item,index) in getNurseTypelist" :key="index"> </view>
<view @tap="godisease()" :class="query.diseaseInfoList.length>0?'choices':'choice'"
v-for="(item,index) in medicalcarelist" :key="item.id">
{{item.nurseTypeName}} {{item.nurseTypeName}}
</view> </view>
</view> </view>
</view> </view>
<u-button type="primary" style='width:30%;float: right;margin-top: 50rpx;' @tap='informationinfo'>提交
</u-button>
</view> </view>
<u-button type="primary" @tap='a'>主要按钮</u-button> <u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
import { import {
getRegionAndStreetInfo, getRegionAndStreetInfo,
getNurseType getNurseType,
information
} from '@/api/information/index.js' } from '@/api/information/index.js'
export default { export default {
data() { data() {
@ -80,6 +81,8 @@
arealist: [], //list arealist: [], //list
areashow: false, // areashow: false, //
getNurseTypelist: [], // getNurseTypelist: [], //
medicalcarelist: [], //
address: '', //
query: { // query: { //
patientName: "", patientName: "",
cardNo: "", cardNo: "",
@ -91,14 +94,31 @@
} }
}; };
}, },
//
onLoad() {
this.areaInfo()
this.getNurseTypeInfo();
},
methods: { methods: {
a() { //
console.log(this.query) informationinfo() {
information(this.query).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '完善信息成功',
type: 'success',
url: '',
duration: '1500'
})
setInterval(() => {
//TODO
uni.switchTab({
url: '/pages/homepage/homepage',
})
}, 1500);
} else if (res.code == 500) {
this.$refs.uToast.show({
title: res.msg,
type: 'error',
url: ''
})
}
})
}, },
// //
getAddress() { getAddress() {
@ -114,12 +134,14 @@
// //
getNurseTypeInfo() { getNurseTypeInfo() {
getNurseType().then(res => { getNurseType().then(res => {
this.getNurseTypelist = res.data this.medicalcarelist = res.data.filter(e => e.nurseTypeName == '医疗护理')
this.getNurseTypelist = res.data.filter(e => e.nurseTypeName != '医疗护理')
}) })
}, },
// //
areaInfo() { areaInfo() {
getRegionAndStreetInfo().then(res => { getRegionAndStreetInfo().then(res => {
//
res.data.forEach(e => { res.data.forEach(e => {
if (e.children.length == 0) { if (e.children.length == 0) {
e.children.push({ e.children.push({
@ -131,24 +153,49 @@
} }
}) })
this.arealist = res.data; this.arealist = res.data;
console.log(this.arealist)
}) })
}, },
// //
areaconfirm(e) { areaconfirm(e) {
console.log(e) this.query.areaCode = e[e.length - 1].value
// this.form.areaCode = e[e.length - 1].value this.address = e[0].label + '-' + e[1].label
// this.address = e[0].label + '-' + e[1].label
// this.address = e[0].label + '-' + e[1].label + '-' + e[2].label
// console.log(this.address);
}, },
// //
gondisease() { addnurseType(item) {
if (this.query.nurseTypeIdList.findIndex(e => e == item.id) == -1) {
this.query.nurseTypeIdList.push(item.id)
} else {
this.query.nurseTypeIdList = this.query.nurseTypeIdList.filter(e => e != item.id)
}
},
godisease() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/disease/disease' url: `/pages/disease/disease?diseaseInfoList=${JSON.stringify(this.query.diseaseInfoList)}`
}) })
}, },
}, },
//
onLoad() {
this.areaInfo()
this.getNurseTypeInfo();
},
//
onShow() {
let that = this
uni.$on('disease', function(data) {
that.query.diseaseInfoList = JSON.parse(data.disease)
if (that.query.diseaseInfoList.length > 0) {
that.medicalcarelist.forEach(e => {
if (that.query.nurseTypeIdList.findIndex(el => el == e.id) == -1) {
that.query.nurseTypeIdList.push(e.id)
} else {
that.query.nurseTypeIdList = that.query.nurseTypeIdList.filter(ele => ele != e
.id)
}
})
}
})
}
} }
</script> </script>
<style lang="scss"> <style lang="scss">
@ -162,18 +209,27 @@
font-size: 32rpx; font-size: 32rpx;
color: #FFFFFF; color: #FFFFFF;
width: 100%; width: 100%;
display: flex;
flex-wrap: wrap; .choices {
justify-content: space-between; background: #4C7BC9;
display: inline-block;
text-align: center;
line-height: 70rpx;
width: 190rpx;
height: 70rpx;
border-radius: 26rpx;
margin: 30rpx 30rpx 0 0;
}
.choice { .choice {
display: inline-block;
text-align: center; text-align: center;
line-height: 70rpx; line-height: 70rpx;
width: 190rpx; width: 190rpx;
height: 70rpx; height: 70rpx;
background: #BFBFBF; background: #BFBFBF;
border-radius: 26rpx; border-radius: 26rpx;
margin-top: 30rpx; margin: 30rpx 30rpx 0 0;
} }
} }
@ -184,7 +240,7 @@
} }
.info { .info {
width: 90%; width: 94%;
margin: 0 auto 20rpx; margin: 0 auto 20rpx;
background-color: #FFFFFF; background-color: #FFFFFF;
border-radius: 20rpx; border-radius: 20rpx;