81 lines
1.8 KiB
Vue
81 lines
1.8 KiB
Vue
<template>
|
|
<view class="app">
|
|
<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">
|
|
@import './disease.scss';
|
|
</style>
|