Browse Source

我的健康打卡预览图修复

remotes/origin/HEAD
wally 5 years ago
parent
commit
e3e8a8c7e1
  1. 332
      pages/my-code/my-code.vue

332
pages/my-code/my-code.vue

@ -1,187 +1,165 @@
<template> <template>
<view> <view>
<!-- 添加 --> <!-- 添加 -->
<button class="shadow round bg-cyan add-btn iconfont icon-plus" hover-class="cc-active" @tap="openPage('/pages/apply-code/apply-code')"></button> <button class="shadow round bg-cyan add-btn iconfont icon-plus" hover-class="cc-active" @tap="openPage('/pages/apply-code/apply-code')"></button>
<view v-if="tableList && tableList.length>0" class="cu-timeline" :key="index" v-for="(item,index) in tableList"> <view v-if="tableList && tableList.length > 0" class="cu-timeline" :key="index" v-for="(item, index) in tableList">
<view class="cu-time">{{ +item.time | formatDate }}</view> <view class="cu-time">{{ +item.time | formatDate }}</view>
<view class="cu-item text-blue cuIcon-locationfill"> <view class="cu-item text-blue cuIcon-locationfill">
<view class="content shadow-blur bg-blue light"> <view class="content shadow-blur bg-blue light">{{ item.district }}{{ item.address }}</view>
{{ item.district }}{{ item.address }} </view>
</view> <view class="cu-item text-green cuIcon-wefill">
</view> <view class="content shadow-blur light" :class="item.healthLevel === 0 ? 'bg-green' : item.healthLevel === 1 ? 'bg-yellow' : 'bg-red'">
<view class="cu-item text-green cuIcon-wefill"> <view class="margin-bottom flex">
<view class="content shadow-blur light" 体温{{ item.animalHeat }}
:class="item.healthLevel === 0 ? 'bg-green' : item.healthLevel === 1 ? 'bg-yellow' : 'bg-red'" <text v-for="state in status" :key="state.id">
> <text v-if="state.id === item.healthTypeId">状态{{ state.name }}</text>
<view class="margin-bottom flex"> </text>
体温{{ item.animalHeat }} </view>
<text v-for="state in status" :key="state.id"> <view>
<text v-if="state.id === item.healthTypeId">状态{{ state.name }}</text> <text class="radius bg-red margin-tb margin-right padding-xs" v-show="item.touchHubei === 1">武汉接触史</text>
</text> <text class="radius bg-red margin-tb margin-right padding-xs" v-show="item.touchSick === 1">患者接触史</text>
</view> </view>
<view> <view class="margin-tb-sm">
<text class="radius bg-red margin-tb margin-right padding-xs" v-show="item.touchHubei === 1"> <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> <text class="radius bg-green margin-tb margin-right padding-xs" v-else>不在校</text>
<text class="radius bg-red margin-tb margin-right padding-xs" v-show="item.touchSick === 1"> </view>
患者接触史 <view class="margin-top">紧急联系人:{{ item.emergencyName }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ item.emergencyPhone }}</view>
</text> <view class="margin-top" v-show="item.remark || item.filePath.length > 0">
</view> 备注:{{ item.remark }}
<view class="margin-tb-sm"> <view class="padding-top">
<text class="radius bg-red margin-tb margin-right padding-xs" v-show="item.touchOverseas === 1"> <image
境外人员接触史 @tap="viewImage(item.filePath, i)"
</text> :key="i"
<text class="radius bg-green margin-tb margin-right padding-xs" v-if="item.schoolLocation === 1"> v-for="(file, i) in item.filePath"
在校 :src="file"
</text> style="width: 69px;height: 75px;"
<text class="radius bg-green margin-tb margin-right padding-xs" v-else> class="margin-lr-xs"
不在校 ></image>
</text> </view>
</view> </view>
<view class="margin-top">紧急联系人:{{ item.emergencyName }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ item.emergencyPhone }}</view> </view>
<view class="margin-top" v-show="item.remark || item.filePath.length > 0"> </view>
备注:{{ item.remark }} </view>
<view class="margin-top"> <view v-if="tableList && tableList.length === 0" class="padding-lg">您还没有申请健康码请点击右下角加号申请健康码</view>
<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>
</view>
<view v-if="tableList && tableList.length === 0" class="padding-lg">
您还没有申请健康码请点击右下角加号申请健康码
</view>
</view>
</template> </template>
<script> <script>
import { import { formatDate } from 'common/script/filters';
formatDate import { showToast } from 'common/script/util';
} from 'common/script/filters'; import { HEALTH_SIGN_HISTORY } from 'api/api';
import { import { mapState, mapMutations } from 'vuex';
showToast
} from 'common/script/util'; export default {
import { data() {
HEALTH_SIGN_HISTORY return {
} from 'api/api'; tableList: []
import { mapState,mapMutations } from 'vuex'; };
},
computed: mapState('user', ['token', 'userInfo', 'status']),
//
filters: {
formatDate(time) {
var data = new Date(time);
return formatDate(data, 'MM-dd');
}
},
onLoad() {
const startTime = +this.$moment()
.startOf('year')
.format('x');
const endTime = +this.$moment()
.endOf('day')
.format('x');
const params = {
param: {
startTime,
endTime,
token: this.token
}
};
this.getHealthSignHistory(params);
},
export default { methods: {
data() { ...mapMutations('user', ['setStatus', 'setUserInfo']),
return {
tableList: [], //
}; async getHealthSignHistory(params) {
}, try {
const res = await this.$http.post(HEALTH_SIGN_HISTORY, params);
computed: mapState('user', ['token','userInfo','status']), const { success, code, msg, data } = res.data;
if (success && code === 200) {
// this.success = true;
filters: { this.tableList = data;
formatDate(time) { } else {
var data = new Date(time); uni.showToast({
return formatDate(data, 'MM-dd'); title: msg || '获取健康打卡记录失败',
} icon: 'none'
}, });
}
onLoad() { } catch (error) {
const startTime = +this.$moment() console.log('error: ', error);
.startOf('year') if (error.msg) {
.format('x'); uni.showToast({
const endTime = +this.$moment() title: error.msg || '获取健康打卡记录失败',
.endOf('day') icon: 'none'
.format('x'); });
const params = { }
param: { }
startTime, },
endTime,
token: this.token //
} viewImage(filePath, index) {
}; if (filePath && filePath.length > 0) {
this.getHealthSignHistory(params); uni.previewImage({
}, urls: filePath,
current: filePath[index],
methods: { indicator: 'number',
...mapMutations('user', ['setStatus','setUserInfo']), });
}
// }
async getHealthSignHistory(params) { }
try { };
const res = await this.$http.post(HEALTH_SIGN_HISTORY, params);
const {
success,
code,
msg,
data
} = res.data;
if (success && code === 200) {
this.success = true;
this.tableList = data;
} else {
uni.showToast({
title: msg || '获取健康打卡记录失败',
icon: 'none'
});
}
} catch (error) {
console.log('error: ', error);
if (error.msg) {
uni.showToast({
title: error.msg || '获取健康打卡记录失败',
icon: 'none'
});
}
}
},
//
viewImage(filePath,index) {
console.log(filePath,index)
if(filePath && filePath.length > 0){
uni.previewImage({
urls: filePath,
current:filePath[index]
})
}
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.data-wrap { .data-wrap {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: left; align-items: left;
justify-content: flex-start; justify-content: flex-start;
padding: 40rpx 0; padding: 40rpx 0;
.data-item {
display: flex;
flex-wrap: wrap;
align-items: left;
font-size: 36rpx;
margin-bottom: 20rpx;
.data-title {
line-height: 60rpx;
color: $black;
}
}
}
.data-item { .add-btn {
display: flex; position: fixed;
flex-wrap: wrap; bottom: 40rpx;
align-items: left; right: 40rpx;
font-size: 36rpx; width: 96rpx;
margin-bottom: 20rpx; height: 96rpx;
line-height: 96rpx;
.data-title{ padding: 0;
line-height: 60rpx; z-index: 1;
color: $black; }
} .add-btn::after {
} border: none;
} }
.add-btn{
position: fixed;
bottom: 40rpx;
right: 40rpx;
width: 96rpx;
height: 96rpx;
line-height: 96rpx;
padding: 0;
z-index: 1;
}
.add-btn::after{
border: none;
}
</style> </style>

Loading…
Cancel
Save