Browse Source

健康打卡 添加字段

remotes/origin/HEAD
songsong428 5 years ago
parent
commit
b68c33fb2d
  1. 40
      components/user-agreement/user-agreement.vue
  2. 5
      config/api/api.js
  3. 38
      pages/add-stroke/add-stroke.vue
  4. 219
      pages/apply-code/apply-code.vue
  5. 48
      pages/basic-info/basic-info.vue
  6. 31
      pages/my-code/my-code.vue
  7. 2
      pages/my-trips/my-trips.vue
  8. 227
      pages/punch-the-clock/punch-the-clock.vue
  9. 4
      store/modules/user/actions.js
  10. 2
      utils/user.js

40
components/user-agreement/user-agreement.vue

@ -1,12 +1,30 @@
<template>
<view class="margin flex flex-wrap">
<view class="flex flex-wrap">
<view @click="changeIntentions" class="iconfont agree-box" :class="[agree ? 'text-blue icon-check-square': 'text-gray icon-border']"></view>
<view class="text-df text-black flex-sub agree-text">
请认真阅读
<text class="text-blue" @tap="serviceAgreement">用户服务协议</text>
<text class="text-blue" @tap="privacyAolicy">隐私政策</text>,
勾选代表您已同意此协议
</view>
</view>
<view class="flex flex-wrap margin-tb-sm text-black">
<view class="text-df text-bold flex agree-text">
本人郑重承诺
</view>
<view class="flex">
<view @click="changeIntentions1" class="iconfont agree-box" :class="[agree1 ? 'text-blue icon-check-square': 'text-gray icon-border']"></view>
<view class="text-df flex-sub agree-text">
为疫情防控本人同意以上信息依法提交山西大学统筹管理
</view>
</view>
<view class="flex">
<view @click="changeIntentions2" class="iconfont agree-box" :class="[agree2 ? 'text-blue icon-check-square': 'text-gray icon-border']"></view>
<view class="text-df flex-sub agree-text">
上述信息是我本人填写本人对信息内容的真实性和完整性负责如果信息有误或者缺失本人愿承担相应的法律责任同时本人保证遵守防疫管控的各项规定配合并听从各项措施和要求
</view>
</view>
</view>
</view>
</template>
@ -16,6 +34,8 @@ export default {
data() {
return {
agree: false,
agree1: false,
agree2: false,
};
},
onLoad(op) {},
@ -29,6 +49,24 @@ export default {
this.$emit('changeIntentions',this.agree)
},
changeIntentions1(){
if(!this.agree1){
this.agree1 = true;
}else{
this.agree1 = false;
}
this.$emit('changeIntentions1',this.agree1)
},
changeIntentions2(){
if(!this.agree2){
this.agree2 = true;
}else{
this.agree2 = false;
}
this.$emit('changeIntentions2',this.agree2)
},
//
serviceAgreement(){
console.log('用户服务协议')

5
config/api/api.js

@ -22,6 +22,9 @@ export const HEALTH_TYPE_STATUS = `${health}/type`;
// 健康打卡
export const HEALTH_SIGN = `${health}/upload`;
// 上传备注图片
export const HEALTH_FILE = `${health}/file`;
// 查看自己的打卡记录
export const USER_SIGNS = `${sites}/info`;
@ -42,3 +45,5 @@ export const GET_JOURNEYS = `${journeys}/info`;
// 上报行程
export const SUBMIT_JOURNEYS = `${journeys}/upload`;

38
pages/add-stroke/add-stroke.vue

@ -44,7 +44,7 @@
<input placeholder="请输入同行人" name="input" type="text" v-model="together" />
</view>
</form>
<user-agreement @changeIntentions="changeIntentions"></user-agreement>
<user-agreement @changeIntentions="changeIntentions" @changeIntentions1="changeIntentions1" @changeIntentions2="changeIntentions2"></user-agreement>
<button class="bg-cyan margin primary-btn" hover-class="cc-active" @tap="handleAddStroke">确认提交</button>
<!-- 历史 -->
<button class="shadow round bg-cyan history-btn iconfont icon-history" hover-class="cc-active" @tap="openPage('/pages/my-trips/my-trips')"></button>
@ -62,8 +62,8 @@ export default {
components: {UniCalendar,StartDateSelector,EndDateSelector},
data() {
return {
startTime: this.$moment().format('YYYY-MM-DD'),
endTime: this.$moment().format('YYYY-MM-DD'),
startTime: this.$moment().format('YYYY-MM-DD HH:mm'),
endTime: this.$moment().format('YYYY-MM-DD HH:mm'),
transports: [
{
value: '0',
@ -104,7 +104,9 @@ export default {
together: '',
tripMode: 0,
journeyType: 0,
agree: false
agree: false,
agree1: false,
agree2: false
};
},
methods: {
@ -130,6 +132,12 @@ export default {
changeIntentions(data) {
this.agree = data;
},
changeIntentions1(data) {
this.agree1 = data;
},
changeIntentions2(data) {
this.agree2 = data;
},
/**
* 获取出发时间
@ -163,9 +171,11 @@ export default {
journeyType,
startTime,
together,
tripMode
tripMode,
agree1,
agree2,
} = this;
console.log(startTime,endTime)
const params = {
param: {
carNo,
@ -173,7 +183,9 @@ export default {
journeyType: journeyType+1,
startTime: +this.$moment(startTime).format('x'),
together,
tripMode
tripMode,
healthAgreement: agree1 ? 1 : 0,
selfFill: agree2 ? 1 : 0,
}
};
@ -212,7 +224,7 @@ export default {
//
checkRules() {
const { startTime,endTime,journeyType,tripMode,carNo,agree } = this;
const { startTime,endTime,journeyType,tripMode,carNo,agree,agree1,agree2 } = this;
if (!this.startTime) {
showToast('请选择出发时间');
return;
@ -233,7 +245,15 @@ export default {
showToast('乘坐航班车次或车牌号码及座位号');
return;
}
if (!this.agree) {
if (!agree) {
showToast('请选择是否同意《用户服务协议》和《隐私政策》');
return;
}
if (!this.agree1) {
showToast('请选择是否同意信息提交山西大学管理');
return;
}
if (!this.agree2) {
showToast('请确定是否为本人填写');
return;
}

219
pages/apply-code/apply-code.vue

@ -47,7 +47,7 @@
<input name="input" placeholder="请输入就诊医院" type="text" v-model="hospital" />
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm">最近14天是否有武汉居住史旅游史或武汉亲戚来访</view>
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>最近14天是否有武汉居住史旅游史或武汉亲戚来访</view>
<radio-group @change="TourChange" class="block">
<view class="flex">
<view :key="index" class="flex-sub margin-tb-sm" v-for="(tour,index) in tours">
@ -65,7 +65,7 @@
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm">最近14天是否有新冠肺炎患者或疑似患者接触史</view>
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>最近14天是否有新冠肺炎患者或疑似患者接触史</view>
<radio-group @change="TouchChange" class="block">
<view class="flex">
<view :key="index" class="flex-sub margin-tb-sm" v-for="(touch,index) in touches">
@ -81,14 +81,71 @@
</view>
</radio-group>
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>最近14天有无接触过近期境外返回人员</view>
<radio-group class="block" @change="TouchOverseasChange">
<view class="flex">
<view class="flex-sub margin-tb-sm" v-for="(touch,index) in overseas" :key="index">
<label class="flex justify-between align-center">
<radio class="round margin-right-xs" :checked="index === touchOverseas" :value="touch.value"></radio>
<text class="flex-sub" style="font-size: 34rpx;">{{ touch.name }}</text>
</label>
</view>
</view>
</radio-group>
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>是否在学校所在地</view>
<radio-group class="block" @change="SchoolLocationChange">
<view class="flex">
<view class="flex-sub margin-tb-sm" v-for="(location,index) in locations" :key="location.value">
<label class="flex justify-between align-center">
<radio class="round margin-right-xs" :checked="index === schoolLocation" :value="location.value"></radio>
<text class="flex-sub" style="font-size: 34rpx;">{{ location.name }}</text>
</label>
</view>
</view>
</radio-group>
</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 name="input" placeholder="请输入当前真实体温" type="digit" v-model="animalHeat" />
</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>
<view class="flex">
<input placeholder="姓名" class="flex flex-sub" name="input" type="text" v-model="emergencyName"/>
<input placeholder="联系方式" class="flex flex-sub" name="input" type="number" v-model="emergencyPhone"/>
</view>
</view>
<view class="cu-form-group flex flex-direction padding-tb">
<view class="title padding-bottom-sm">备注选填</view>
<textarea placeholder="请填写具体情况..." name="input" v-model="remark"/>
<!-- 上传图片 -->
<view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
<image :src="imgList[index]" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="ChooseImage" v-if="imgList.length<9">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
</view>
</form>
<user-agreement @changeIntentions="changeIntentions"></user-agreement>
<user-agreement @changeIntentions="changeIntentions" @changeIntentions1="changeIntentions1" @changeIntentions2="changeIntentions2"></user-agreement>
<button @tap="handleHealthSign" class="bg-cyan margin primary-btn" hover-class="cc-active">确认提交</button>
<!-- 历史 -->
<button
@ -101,7 +158,7 @@
<script>
import { showToast } from 'common/script/util';
import { HEALTH_SIGN } from 'api/api';
import { HEALTH_SIGN, HEALTH_FILE } from 'api/api';
import { mapState, mapMutations } from 'vuex';
export default {
@ -131,11 +188,34 @@ export default {
name: '是',
},
],
overseas: [{
value: '0',
name: '无'
}, {
value: '1',
name: '有'
}],
locations: [{
value: '0',
name: '否'
}, {
value: '1',
name: '是'
}],
animalHeat: 0,
healthTypeId: 0,
touchHubei: 0,
touchSick: 0,
touchOverseas: 0,
schoolLocation: 0,
emergencyName: '',
emergencyPhone: '',
remark: '',
fileIdList: [],
imgList: [],
agree: false,
agree1: false,
agree2: false,
};
},
computed: mapState('user', ['token', 'status']),
@ -156,6 +236,12 @@ export default {
changeIntentions(data) {
this.agree = data;
},
changeIntentions1(data) {
this.agree1 = data;
},
changeIntentions2(data) {
this.agree2 = data;
},
//
StateChange: function(evt) {
@ -179,7 +265,6 @@ export default {
//
TouchChange(evt) {
console.log(this.touches, 'aa');
for (let b = 0; b < this.touches.length; b++) {
if (this.touches[b].value === evt.target.value) {
this.touchSick = b;
@ -188,6 +273,86 @@ export default {
}
},
//
TouchOverseasChange(evt) {
for (let i = 0; i < this.overseas.length; i++) {
if (this.overseas[i].value === evt.target.value) {
this.touchOverseas = i;
break;
}
}
},
//
SchoolLocationChange(evt) {
for (let i = 0; i < this.locations.length; i++) {
if (this.locations[i].value === evt.target.value) {
this.schoolLocation = i;
break;
}
}
},
ChooseImage() {
uni.chooseImage({
count: 9, //9
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: (res) => {
if (this.imgList.length != 0) {
this.imgList = this.imgList.concat(res.tempFilePaths)
} else {
this.imgList = res.tempFilePaths
}
uni.uploadFile({
url: `https://test.tall.wiki/gateway${HEALTH_FILE}`,
filePath: res.tempFilePaths[0],
fileType: 'image',
name: 'file',
success: (res) => {
const resData = JSON.parse(res.data)
const {
success,
code,
msg,
data
} = resData;
this.fileIdList.splice(-1,0,resData.data.fileId);
uni.showToast({
title: '图片提交成功',
duration: 1000,
});
},fail: (err) => {
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
});
},
});
},
ViewImage(e) {
uni.previewImage({
urls: this.imgList,
current: e.currentTarget.dataset.url
});
},
DelImg(e) {
uni.showModal({
title: '删除',
content: '确定要删除这张图片吗?',
cancelText: '再想想',
confirmText: '再见',
success: res => {
if (res.confirm) {
this.imgList.splice(e.currentTarget.dataset.index, 1)
this.fileIdList.splice(e.currentTarget.dataset.index, 1)
}
}
})
},
/**
* 申请健康码
*/
@ -204,6 +369,14 @@ export default {
token,
touchHubei,
touchSick,
touchOverseas,
schoolLocation,
emergencyName,
emergencyPhone,
remark,
fileIdList,
agree1,
agree2,
} = this;
const params = {
param: {
@ -215,9 +388,16 @@ export default {
token,
touchHubei,
touchSick,
touchOverseas,
schoolLocation,
emergencyName,
emergencyPhone,
remark,
fileIdList,
healthAgreement: agree1 ? 1 : 0,
selfFill: agree2 ? 1 : 0,
},
};
const res = await this.$http.post(HEALTH_SIGN, params);
const { success, code, msg, data } = res.data;
if (success && code === 200) {
@ -249,7 +429,7 @@ export default {
//
checkRules() {
const { district, address, healthTypeId, animalHeat, agree } = this;
const { district, address, healthTypeId, animalHeat,emergencyName,emergencyPhone, agree,agree1,agree2 } = this;
if (!district || district === '请选择当前所在地区') {
showToast('请选择当前所在地区');
return;
@ -266,12 +446,37 @@ export default {
showToast('请输入当前体温');
return;
}
if (!emergencyName) {
showToast('请输入紧急联系人姓名');
return;
}
if (!this.verifyPhone(emergencyPhone)) {
showToast('请输入正确的紧急联系人手机号');
return;
}
if (!agree) {
showToast('请选择是否同意《用户服务协议》和《隐私政策》');
return;
}
if (!agree1) {
showToast('请选择是否同意信息提交山西大学管理');
return;
}
if (!agree2) {
showToast('请确定是否为本人填写');
return;
}
return true;
},
/**
* 验证手机号格式
* @param {string} phone 手机号
*/
verifyPhone(phone) {
const phoneExg = /^1\d{10}$/;
return phoneExg.test(phone);
},
},
};
</script>

48
pages/basic-info/basic-info.vue

@ -13,7 +13,7 @@
v-model="name"
/>
</view>
<view class="cu-form-group flex flex-direction padding-tb">
<!-- <view class="cu-form-group flex flex-direction padding-tb">
<view class="title padding-bottom-sm">
<span class="text-red padding-right-xs" v-show="!(userInfo && userInfo.id)">*</span>身份证
</view>
@ -24,7 +24,7 @@
type="idcard"
v-model="idCard"
/>
</view>
</view> -->
<view class="cu-form-group flex flex-direction padding-tb">
<view class="title padding-bottom-sm">
<span class="text-red padding-right-xs" v-show="!(userInfo && userInfo.id)">*</span>联系方式
@ -76,7 +76,7 @@
/>
</view>
</form>
<user-agreement @changeIntentions="changeIntentions" v-if="!(userInfo && userInfo.id)"></user-agreement>
<user-agreement @changeIntentions="changeIntentions" @changeIntentions1="changeIntentions1" @changeIntentions2="changeIntentions2" v-if="!(userInfo && userInfo.id)"></user-agreement>
<button
@tap="handleSubmitUserInfo"
class="bg-cyan margin primary-btn"
@ -95,7 +95,7 @@ export default {
data() {
return {
name: '',
idCard: '',
// idCard: '',
phone: '',
identitys: [
{
@ -114,13 +114,15 @@ export default {
studentID: '',
current: 0,
agree: false,
agree1: false,
agree2: false
};
},
created() {
if (this.userInfo) {
this.name = this.userInfo.name;
this.idCard = this.userInfo.idCard;
// this.idCard = this.userInfo.idCard;
this.phone = this.userInfo.phone;
this.studentID = this.userInfo.no;
this.current = this.userInfo.post;
@ -143,6 +145,12 @@ export default {
changeIntentions(data) {
this.agree = data;
},
changeIntentions1(data) {
this.agree1 = data;
},
changeIntentions2(data) {
this.agree2 = data;
},
/**
* 提交基本信息
@ -151,10 +159,10 @@ export default {
try {
if (!this.checkRules()) return;
const { name, idCard, phone, studentID, current, pagePath } = this;
const { name, phone, studentID, current, pagePath } = this;
const params = {
param: {
idCard,
// idCard,
name,
no: studentID,
phone,
@ -197,15 +205,15 @@ export default {
//
checkRules() {
const { name, idCard, phone, identitys, studentID, agree } = this;
const { name, phone, identitys, studentID, agree,agree1,agree2 } = this;
if (!name) {
showToast('请输入姓名');
return;
}
if (!this.verifyIdCard(idCard)) {
showToast('请输入正确的身份证号');
return;
}
// if (!this.verifyIdCard(idCard)) {
// showToast('');
// return;
// }
if (!this.verifyPhone(phone)) {
showToast('请输入正确的手机号');
return false;
@ -222,6 +230,14 @@ export default {
showToast('请选择是否同意《用户服务协议》和《隐私政策》');
return;
}
if (!agree1) {
showToast('请选择是否同意信息提交山西大学管理');
return;
}
if (!agree2) {
showToast('请确定是否为本人填写');
return;
}
return true;
},
@ -238,10 +254,10 @@ export default {
* 验证身份证号格式
* @param {string} idCard 身份证号
*/
verifyIdCard(idCard) {
const idCardExg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
return idCardExg.test(idCard);
},
// verifyIdCard(idCard) {
// const idCardExg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
// return idCardExg.test(idCard);
// },
},
};
</script>

31
pages/my-code/my-code.vue

@ -27,7 +27,24 @@
患者接触史
</text>
</view>
<view class="margin-top" v-show="item.hospital">就诊医院:{{ item.hospital }}</view>
<view class="margin-tb-sm">
<text class="radius bg-red margin-tb margin-right padding-xs" v-show="item.touchOverseas === 1">
境外人员接触史
</text>
<text class="radius bg-green margin-tb margin-right padding-xs" v-if="item.schoolLocation === 1">
在校
</text>
<text class="radius bg-green margin-tb margin-right padding-xs" v-else>
不在校
</text>
</view>
<view class="margin-top">紧急联系人:{{ item.emergencyName }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ item.emergencyPhone }}</view>
<view class="margin-top" v-show="item.remark || item.filePath.length > 0">
备注:{{ item.remark }}
<view class="margin-top">
<image @tap="viewImage(item.filePath,index)" :key="index" v-for="(file,index) in item.filePath" :src="file" style="width: 69px;height: 75px;" class="margin-lr-xs"></image>
</view>
</view>
</view>
</view>
</view>
@ -116,6 +133,18 @@
}
}
},
//
viewImage(filePath,index) {
console.log(filePath,index)
if(filePath && filePath.length > 0){
uni.previewImage({
urls: filePath,
current:filePath[index]
})
}
},
},
};
</script>

2
pages/my-trips/my-trips.vue

@ -96,7 +96,7 @@
formatDate1(time) {
var data = new Date(time);
return formatDate(data, 'MM月dd日 HH:mm');
return formatDate(data, 'MM月dd日 hh:mm');
},
},

227
pages/punch-the-clock/punch-the-clock.vue

@ -31,7 +31,7 @@
<input placeholder="请输入就诊医院" name="input" type="text" v-model="hospital" />
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm">最近14天是否有武汉居住史旅游史或武汉亲戚来访</view>
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>最近14天是否有武汉居住史旅游史或武汉亲戚来访</view>
<radio-group class="block" @change="TourChange">
<view class="flex">
<view class="flex-sub margin-tb-sm" v-for="(tour,index) in tours" :key="index">
@ -45,7 +45,7 @@
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm">最近14天是否有新冠肺炎患者或疑似患者接触史</view>
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>最近14天是否有新冠肺炎患者或疑似患者接触史</view>
<radio-group class="block" @change="TouchChange">
<view class="flex">
<view class="flex-sub margin-tb-sm" v-for="(touch,index) in touches" :key="index">
@ -57,12 +57,67 @@
</view>
</radio-group>
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>最近14天有无接触过近期境外返回人员</view>
<radio-group class="block" @change="TouchOverseasChange">
<view class="flex">
<view class="flex-sub margin-tb-sm" v-for="(touch,index) in overseas" :key="index">
<label class="flex justify-between align-center">
<radio class="round margin-right-xs" :checked="index === touchOverseas" :value="touch.value"></radio>
<text class="flex-sub" style="font-size: 34rpx;">{{ touch.name }}</text>
</label>
</view>
</view>
</radio-group>
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>是否在学校所在地</view>
<radio-group class="block" @change="SchoolLocationChange">
<view class="flex">
<view class="flex-sub margin-tb-sm" v-for="(location,index) in locations" :key="location.value">
<label class="flex justify-between align-center">
<radio class="round margin-right-xs" :checked="index === schoolLocation" :value="location.value"></radio>
<text class="flex-sub" style="font-size: 34rpx;">{{ location.name }}</text>
</label>
</view>
</view>
</radio-group>
</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="digit" v-model="animalHeat"/>
</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>
<view class="flex">
<input placeholder="姓名" class="flex flex-sub" name="input" type="text" v-model="emergencyName"/>
<input placeholder="联系方式" class="flex flex-sub" name="input" type="number" v-model="emergencyPhone"/>
</view>
</view>
<view class="cu-form-group flex flex-direction padding-tb">
<view class="title padding-bottom-sm">备注选填</view>
<textarea placeholder="请填写具体情况..." name="input" v-model="remark"/>
<!-- 上传图片 -->
<view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
<image :src="imgList[index]" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="ChooseImage" v-if="imgList.length<9">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
</view>
</form>
<user-agreement @changeIntentions="changeIntentions"></user-agreement>
<user-agreement @changeIntentions="changeIntentions" @changeIntentions1="changeIntentions1" @changeIntentions2="changeIntentions2"></user-agreement>
<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>
@ -74,7 +129,7 @@
showToast
} from 'common/script/util';
import {
HEALTH_SIGN
HEALTH_SIGN,HEALTH_FILE
} from 'api/api';
import {
mapState,
@ -102,11 +157,34 @@
value: '1',
name: '是'
}],
overseas: [{
value: '0',
name: '无'
}, {
value: '1',
name: '有'
}],
locations: [{
value: '0',
name: '否'
}, {
value: '1',
name: '是'
}],
animalHeat: 0,
healthTypeId: 0,
touchHubei: 0,
touchSick: 0,
touchOverseas: 0,
schoolLocation: 0,
emergencyName: '',
emergencyPhone: '',
remark: '',
fileIdList: [],
imgList: [],
agree: false,
agree1: false,
agree2: false,
};
},
computed: mapState('user', ['token', 'status']),
@ -127,6 +205,12 @@
changeIntentions(data) {
this.agree = data;
},
changeIntentions1(data) {
this.agree1 = data;
},
changeIntentions2(data) {
this.agree2 = data;
},
//
StateChange: function(evt) {
@ -150,7 +234,6 @@
//
TouchChange(evt) {
console.log(this.touches,'aa')
for (let b = 0; b < this.touches.length; b++) {
if (this.touches[b].value === evt.target.value) {
this.touchSick = b;
@ -159,6 +242,88 @@
}
},
//
TouchOverseasChange(evt) {
for (let i = 0; i < this.overseas.length; i++) {
if (this.overseas[i].value === evt.target.value) {
this.touchOverseas = i;
break;
}
}
},
//
SchoolLocationChange(evt) {
for (let i = 0; i < this.locations.length; i++) {
if (this.locations[i].value === evt.target.value) {
this.schoolLocation = i;
break;
}
}
},
ChooseImage() {
uni.chooseImage({
count: 9, //9
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: (res) => {
if (this.imgList.length != 0) {
this.imgList = this.imgList.concat(res.tempFilePaths)
} else {
this.imgList = res.tempFilePaths
}
uni.uploadFile({
url: `https://test.tall.wiki/gateway${HEALTH_FILE}`,
filePath: res.tempFilePaths[0],
fileType: 'image',
name: 'file',
success: (res) => {
const resData = JSON.parse(res.data)
const {
success,
code,
msg,
data
} = resData;
this.fileIdList.splice(-1,0,resData.data.fileId);
uni.showToast({
title: '图片提交成功',
duration: 1000,
});
console.log(this.fileIdList);
},fail: (err) => {
console.log('uploadImage fail', err);
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
});
},
});
},
ViewImage(e) {
uni.previewImage({
urls: this.imgList,
current: e.currentTarget.dataset.url
});
},
DelImg(e) {
uni.showModal({
title: '删除',
content: '确定要删除这张图片吗?',
cancelText: '再想想',
confirmText: '再见',
success: res => {
if (res.confirm) {
this.imgList.splice(e.currentTarget.dataset.index, 1)
this.fileIdList.splice(e.currentTarget.dataset.index, 1)
}
}
})
},
/**
* 申请健康码
*/
@ -174,7 +339,15 @@
hospital,
token,
touchHubei,
touchSick
touchSick,
touchOverseas,
schoolLocation,
emergencyName,
emergencyPhone,
remark,
fileIdList,
agree1,
agree2,
} = this;
const params = {
param: {
@ -185,10 +358,17 @@
hospital,
token,
touchHubei,
touchSick
touchSick,
touchOverseas,
schoolLocation,
emergencyName,
emergencyPhone,
remark,
fileIdList,
healthAgreement: agree1 ? 1 : 0,
selfFill: agree2 ? 1 : 0,
}
};
const res = await this.$http.post(HEALTH_SIGN, params);
const {
success,
@ -230,7 +410,11 @@
address,
healthTypeId,
animalHeat,
agree
emergencyName,
emergencyPhone,
agree,
agree1,
agree2
} = this;
if (!district || district === '请选择当前所在地区') {
showToast('请选择当前所在地区');
@ -248,13 +432,38 @@
showToast('请输入当前体温');
return;
}
if (!emergencyName) {
showToast('请输入紧急联系人姓名');
return;
}
if (!this.verifyPhone(emergencyPhone)) {
showToast('请输入正确的紧急联系人手机号');
return;
}
if (!agree) {
showToast('请选择是否同意《用户服务协议》和《隐私政策》');
return;
}
if (!agree1) {
showToast('请选择是否同意信息提交山西大学管理');
return;
}
if (!agree2) {
showToast('请确定是否为本人填写');
return;
}
return true;
},
/**
* 验证手机号格式
* @param {string} phone 手机号
*/
verifyPhone(phone) {
const phoneExg = /^1\d{10}$/;
return phoneExg.test(phone);
},
},
};
</script>

4
store/modules/user/actions.js

@ -74,8 +74,8 @@ const actions = {
.post(GET_USER_INFO, params)
.then(res => {
hideLoading();
console.log('getUserInfo data: ', res.data);
const { data } = res.data;
console.log('getUserInfo data: ', data);
resolve(data);
// 获取自己的信息采取设置
// 扫别人健康码的时候不用设置
@ -90,7 +90,7 @@ const actions = {
})
.catch(data => {
hideLoading();
showToast(data.msg || '查询个人信息失败');
// showToast(data.msg || '查询个人信息失败');
reject(data);
});
});

2
utils/user.js

@ -55,6 +55,7 @@ export const wxLogin = () => {
type: SIGN_IN_TYPES['mp'],
data: { identifier: response.code, credential: 'health' },
redirect: 'https://test.tall.wiki/gateway/health/initMsg',
// redirect: 'https://www.tall.wiki/gateway/health/initMsg',
};
resolve(params);
} else {
@ -81,6 +82,7 @@ export const wxWorkLogin = () => {
type: SIGN_IN_TYPES['wx_work'],
data: { identifier: response.code, credential: 'health' },
redirect: 'https://test.tall.wiki/gateway/health/initMsg',
// redirect: 'https://www.tall.wiki/gateway/health/initMsg',
};
resolve(params);
} else {

Loading…
Cancel
Save