|
|
@ -3,7 +3,7 @@ |
|
|
|
<form class="padding-lr cu-form-group flex-direction"> |
|
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
|
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>当前所在地区</view> |
|
|
|
<input @tap="handleSelectLocation" placeholder="请输入当前所在地区" name="input" type="btn" v-model="area" /> |
|
|
|
<input @tap="handleSelectLocation" placeholder="请选择当前所在地区" name="input" type="btn" v-model="district" /> |
|
|
|
</view> |
|
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
|
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>当前所在详细地址</view> |
|
|
@ -15,7 +15,7 @@ |
|
|
|
<view class="cu-list menu text-left"> |
|
|
|
<view class="cu-item" v-for="(state,index) in status" :key="index"> |
|
|
|
<label class="flex justify-between align-center"> |
|
|
|
<radio class="round margin-right-xs" :checked="index === current" :value="state.value"></radio> |
|
|
|
<radio class="round margin-right-xs" :checked="index === healthTypeId" :value="state.value"></radio> |
|
|
|
<view class="flex-sub" style="font-size: 34rpx;">{{ state.name }}</view> |
|
|
|
</label> |
|
|
|
</view> |
|
|
@ -32,7 +32,7 @@ |
|
|
|
<view class="flex"> |
|
|
|
<view class="flex-sub margin-tb-sm" v-for="(tour,index) in tours" :key="index"> |
|
|
|
<label class="flex justify-between align-center"> |
|
|
|
<radio class="round margin-right-xs" :checked="index === tourCurrent" :value="tour.value"></radio> |
|
|
|
<radio class="round margin-right-xs" :checked="index === touchHubei" :value="tour.value"></radio> |
|
|
|
<text class="flex-sub" style="font-size: 34rpx;">{{ tour.name }}</text> |
|
|
|
</label> |
|
|
|
</view> |
|
|
@ -46,7 +46,7 @@ |
|
|
|
<view class="flex"> |
|
|
|
<view class="flex-sub margin-tb-sm" v-for="(touch,index) in touches" :key="index"> |
|
|
|
<label class="flex justify-between align-center"> |
|
|
|
<radio class="round margin-right-xs" :checked="index === touchCurrent" :value="touch.value"></radio> |
|
|
|
<radio class="round margin-right-xs" :checked="index === touchSick" :value="touch.value"></radio> |
|
|
|
<text class="flex-sub" style="font-size: 34rpx;">{{ touch.name }}</text> |
|
|
|
</label> |
|
|
|
</view> |
|
|
@ -55,7 +55,7 @@ |
|
|
|
</view> |
|
|
|
<view class="cu-form-group flex flex-direction padding-tb"> |
|
|
|
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>当前体温(℃)</view> |
|
|
|
<input placeholder="请输入当前真实体温" name="input" type="number" v-model="temperature" /> |
|
|
|
<input placeholder="请输入当前真实体温" name="input" type="number" v-model="animalHeat" /> |
|
|
|
</view> |
|
|
|
</form> |
|
|
|
|
|
|
@ -65,7 +65,7 @@ |
|
|
|
以上信息是我本人填写,本人对信息的真实性和完整性负责。 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<button class="bg-cyan margin primary-btn" hover-class="cc-active" @tap="addStroke">确认提交</button> |
|
|
|
<button class="bg-cyan margin primary-btn" hover-class="cc-active" @tap="handleHealthSign">确认提交</button> |
|
|
|
<!-- 历史 --> |
|
|
|
<button class="shadow round bg-cyan history-btn iconfont icon-history" hover-class="cc-active" @tap="openPage('/pages/my-code/my-code')"></button> |
|
|
|
</view> |
|
|
@ -75,11 +75,15 @@ |
|
|
|
import { |
|
|
|
showToast |
|
|
|
} from 'common/script/util'; |
|
|
|
import { |
|
|
|
HEALTH_SIGN |
|
|
|
} from 'api/api'; |
|
|
|
import { mapState,mapMutations } from 'vuex'; |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
area: '请输入当前所在地区', |
|
|
|
district: '请选择当前所在地区', |
|
|
|
address: '', |
|
|
|
status: [{ |
|
|
|
value: '0', |
|
|
@ -87,7 +91,7 @@ |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: '1', |
|
|
|
name: '发烧(377.3度以上)', |
|
|
|
name: '发烧(37.3度以上)', |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: '2', |
|
|
@ -129,24 +133,23 @@ |
|
|
|
name: '否' |
|
|
|
} |
|
|
|
], |
|
|
|
temperature: '', |
|
|
|
current: 0, |
|
|
|
tourCurrent: 0, |
|
|
|
touchCurrent: 0, |
|
|
|
animalHeat: 0, |
|
|
|
healthTypeId: 0, |
|
|
|
touchHubei: 0, |
|
|
|
touchSick: 0, |
|
|
|
agree: false, |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: mapState('user', ['token']), |
|
|
|
methods: { |
|
|
|
...mapMutations('user', ['setHealthCode']), |
|
|
|
handleSelectLocation() { |
|
|
|
const that = this; |
|
|
|
uni.chooseLocation({ |
|
|
|
success: function(res) { |
|
|
|
console.log('位置名称:' + res.name); |
|
|
|
console.log('详细地址:' + res.address); |
|
|
|
console.log('纬度:' + res.latitude); |
|
|
|
console.log('经度:' + res.longitude); |
|
|
|
console.log('diqu', that.area, res.address) |
|
|
|
that.area = res.address; |
|
|
|
that.district = res.address; |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
@ -155,7 +158,7 @@ |
|
|
|
StateChange: function(evt) { |
|
|
|
for (let i = 0; i < this.status.length; i++) { |
|
|
|
if (this.status[i].value === evt.target.value) { |
|
|
|
this.current = i; |
|
|
|
this.healthTypeId = i; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -165,7 +168,7 @@ |
|
|
|
TourChange: function(evt) { |
|
|
|
for (let i = 0; i < this.tours.length; i++) { |
|
|
|
if (this.tours[i].value === evt.target.value) { |
|
|
|
this.tourCurrent = i; |
|
|
|
this.touchHubei = i; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -175,40 +178,95 @@ |
|
|
|
TouchChange: function(evt) { |
|
|
|
for (let i = 0; i < this.touches.length; i++) { |
|
|
|
if (this.touches[i].value === evt.target.value) { |
|
|
|
this.touchCurrent = i; |
|
|
|
this.touchSick = i; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 提交基本信息 |
|
|
|
* 申请健康码 |
|
|
|
*/ |
|
|
|
addStroke() { |
|
|
|
if (!this.area) { |
|
|
|
showToast('请输入当前所在地区'); |
|
|
|
async handleHealthSign() { |
|
|
|
try { |
|
|
|
if (!this.checkRules()) return; |
|
|
|
|
|
|
|
const { |
|
|
|
address, |
|
|
|
animalHeat, |
|
|
|
district, |
|
|
|
healthTypeId, |
|
|
|
hospital, |
|
|
|
token, |
|
|
|
touchHubei, |
|
|
|
touchSick |
|
|
|
} = this; |
|
|
|
const params = { |
|
|
|
param: { |
|
|
|
address, |
|
|
|
animalHeat, |
|
|
|
district, |
|
|
|
healthTypeId, |
|
|
|
hospital, |
|
|
|
token, |
|
|
|
touchHubei, |
|
|
|
touchSick |
|
|
|
} |
|
|
|
}; |
|
|
|
const res = await this.$http.post(HEALTH_SIGN, params); |
|
|
|
const { |
|
|
|
success, |
|
|
|
code, |
|
|
|
msg, |
|
|
|
data |
|
|
|
} = res.data; |
|
|
|
if (success && code === 200) { |
|
|
|
this.setHealthCode(data.healthCode) |
|
|
|
this.success = true; |
|
|
|
uni.reLaunch({ |
|
|
|
url: `/pages/index/index`, |
|
|
|
}); |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: msg || '申请健康码成功', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.log('error: ', error); |
|
|
|
if (error.msg) { |
|
|
|
uni.showToast({ |
|
|
|
title: error.msg || '申请健康码失败', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 验证信息 |
|
|
|
checkRules() { |
|
|
|
const { district,address,healthTypeId,animalHeat,agree } = this; |
|
|
|
if (!district || district === '请选择当前所在地区') { |
|
|
|
showToast('请选择当前所在地区'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.address) { |
|
|
|
if (!address) { |
|
|
|
showToast('请输入当前所在地址'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.status) { |
|
|
|
if (healthTypeId<0) { |
|
|
|
showToast('请选择状态'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.temperature) { |
|
|
|
if (!animalHeat) { |
|
|
|
showToast('请输入当前体温'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.agree) { |
|
|
|
if (!agree) { |
|
|
|
showToast('请确定是否为本人填写'); |
|
|
|
return; |
|
|
|
} |
|
|
|
console.log('信息提交'); |
|
|
|
uni.reLaunch({ |
|
|
|
url: `/pages/index/index`, |
|
|
|
}); |
|
|
|
return true; |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|