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() {
return request({

View File

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

View File

@ -3,10 +3,9 @@
<view style="height: 20rpx;background-color: #F4F5F7;">
</view>
<view class="items">
<view class="item" style="background-color: #4C7BC9;color: #ffffff;">
</view>
<view class="item" v-for='(item,index) in diseaselist' :key="index">
<view class="item"
:style="disease.find(e => e.id == item.id)?'background-color: #4C7BC9;color: #ffffff;':''"
v-for='(item,index) in diseaselist' :key="index" @tap='choicedisease(item)'>
{{item.diseaseName}}
</view>
<view class="other">
@ -14,7 +13,7 @@
<!-- <input type="text"> -->
<u-input type="text" placeholder='请填写' />
</view>
<view class="btn">
<view class="btn" @tap='goinformation'>
提交
</view>
</view>
@ -28,19 +27,53 @@
export default {
data() {
return {
diseaselist: [],
diseaselist: [], //
disease: [{ //list
id: 9999,
diseaseName: '无'
}],
};
},
onLoad() {
this.diseaseinfo()
},
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() {
getDiseaseInfo().then(res => {
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>

View File

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