NurseStationApp/pages/disease/disease.vue
2022-10-18 08:54:14 +08:00

156 lines
3.1 KiB
Vue

<template>
<view class="app">
<view style="height: 20rpx;background-color: #F4F5F7;">
</view>
<view class="items">
<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">
<span>其他:</span>
<!-- <input type="text"> -->
<u-input type="text" placeholder='请填写' />
</view>
<view class="btn" @tap='goinformation'>
提交
</view>
</view>
</view>
</template>
<script>
import {
getDiseaseInfo
} from '@/api/disease/index.js'
export default {
data() {
return {
diseaselist: [], //疾病列表
disease: [{ //选择的疾病list
id: 9999,
diseaseName: '无'
}],
};
},
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>
<style lang="scss">
.app {
height: 100%;
padding-bottom: 70rpx;
.btn {
width: 217rpx;
height: 68rpx;
background: #4C7BC9;
border-radius: 26rpx;
font-size: 32rpx;
color: #FFFFFF;
line-height: 68rpx;
margin: 100rpx 0 0 60%;
}
.items {
width: 90%;
margin: 0 auto;
text-align: center;
color: #000000;
.other {
margin: 0 auto;
height: 93rpx;
display: flex;
background-color: #fff;
border-radius: 20rpx;
width: 100%;
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
margin: 20rpx auto;
line-height: 93rpx;
view {
height: 93rpx;
font-size: 32rpx;
line-height: 93rpx;
}
span {
display: inline-block;
line-height: 93rpx;
height: 93rpx;
width: 30%;
font-size: 32rpx;
}
::v-deep .u-input__input {
height: 93rpx;
font-size: 32rpx;
}
::v-deep .uni-input-wrapper {
height: 93rpx;
line-height: 93rpx;
}
::v-deep .u-input {
width: 70%;
height: 93rpx;
line-height: 93rpx;
}
}
.item {
width: 100%;
height: 93rpx;
background: #ffffff;
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 20rpx;
margin: 20rpx auto;
line-height: 93rpx;
}
}
}
</style>