Browse Source

健康码

梁汉强 5 years ago
parent
commit
bd967e4a63

+ 10 - 4
assets/http/api.js

@@ -137,8 +137,13 @@ let temperatureRecordUrl={
 const temperatureRecord = {
 	page:p => http.get(temperatureRecordUrl.page, {params:p}),
 }
-
-
+//健康码
+let healthCodeUrl={
+	getCode:'/health/getCode'
+}
+const healthCode = {
+	getCode:p => http.post(healthCodeUrl.getCode, p)
+}
 export const api={
 	//上传文件
 	uploadFile,
@@ -165,7 +170,8 @@ export const api={
 	//园区公告
 	notice,
 	//测温记录
-	temperatureRecord
-	
+	temperatureRecord,
+	//健康码
+	healthCode
 	
 }

+ 2 - 1
assets/http/service.js

@@ -8,7 +8,8 @@ import Request from '../../utils/my-request/index.js'
 // let baseURL='http://192.168.2.229:9527/'
 //远程
 // let baseURL='http://139.9.103.171:9527/'
-let baseURL='https://park.58fo.com/api/'
+//let baseURL='https://park.58fo.com/api/'
+let baseURL='http://localhost:9527/'
 
 
 let tokenUrl=baseURL+"blade-auth/oauth/token?tenantId=804981&password=ea3c40c0df5477c525543b0e85548004&username=wpadmin"

File diff suppressed because it is too large
+ 446 - 162
package-lock.json


+ 9 - 0
pages.json

@@ -348,6 +348,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/mine/healthcode/healthcode",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "健康码",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"tabBar": {
 		  "list": [

+ 126 - 0
pages/mine/healthcode/healthcode.vue

@@ -0,0 +1,126 @@
+<template>
+	<view>
+			<view class="codeBox" :class="{ 'bg-red': healthCode.color=='red', 'bg-blue': healthCode.color=='green'}" >
+				<view class="timeBar">{{name}}</view>
+				<view class="timeBar">{{nowStr}}</view>
+				<image class="code" :src="healthCode.code"></image>
+				<view v-if="healthCode.color=='green'" class="timeBar" style="height: 250rpx;letter-spacing: 20rpx;">
+					<icon type="success" size="45"/>
+					未见异常
+				</view>
+				<view v-if="healthCode.color=='red'" class="timeBar" style="height: 250rpx;letter-spacing: 20rpx;">
+					<icon type="warn" size="45"/>
+					体温异常
+				</view>
+			</view>
+			<view class="tips">{{tips}}</view>
+			<view class="link" @click="navigate('/pages/index/staff-temperature/list')"> 测温记录</view>
+	</view>
+</template>
+
+<script>
+	import util from "@/utils/util.js"
+	export default {
+		data() {
+			return {
+				personInfo: {
+					name: "*",
+					idNumber: "*"
+				},
+				timer: '',
+				nowStr: "",
+				healthCode: {
+					code: "http://120.92.153.151:3000/public/recog_images/2021-01-09/06d56a9f7fca42c6",
+					color: "green"
+				},
+				tips: "按照目前掌握的防疫相关数据,暂未发现您存在与防疫相关异常健康状况。防疫相关数据会随着疫情发展及时更新。此次查询并不会排除您的防疫相关健康风险。"
+			}
+		},
+	async	onLoad() {
+			//获取员工是信息
+			let phone = uni.getStorageSync("phone");
+			let staffRes=await this.$api.enterprisestaff.page({phone});
+			this.personInfo.name = staffRes.data.records[0].realName;
+			this.personInfo.idNumber = staffRes.data.records[0].idcard;
+			//获取实时时间
+			this.getDateStr();
+			
+			//获取健康码
+			let codeRes=await this.$api.healthCode.getCode({idCardNumber: this.personInfo.idNumber,userName: this.personInfo.name});
+			this.healthCode.code = codeRes.data.code;
+			this.healthCode.color = codeRes.data.color;
+			
+		},
+		beforeDestroy() {
+			clearInterval(this.timer);
+		},
+		computed:{
+			name(){
+				let chars = this.personInfo.name.split("");
+				return "**"+ chars[chars.length-1]
+			}
+		},
+		methods: {
+			getDateStr(){this.timer = setInterval(()=>{
+				this.nowStr = util.dateFormat(new Date(),"yyyy-MM-dd hh:mm:ss");
+			},1000);
+			},
+			navigate(path){
+				uni.navigateTo({
+					url:path
+				})
+			}
+		}
+	}
+</script>
+
+<style>
+	.timeBar{
+		width: 400rpx;
+		height: 100rpx;
+		color: white;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		font-size: 40rpx;
+		/* background-color: rgba(255,255,255,0.5); */
+	}
+	.code{
+		background: white;
+		border-radius: 15rpx;
+		padding: 5rpx;
+		width: 400rpx;
+		height: 400rpx;
+	}
+	.codeBox{
+		width: 100%;
+		height: 1000rpx;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		border-radius: 5rpx;
+	}
+	.tips{
+		height: 300rpx;
+		width: 90%;
+		text-indent: 2em;
+		margin: auto;
+		color: gray;
+		/* background: #18B566; */
+		font-size: 30rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
+	.link{
+		height: 100rpx;
+		width: 100%;
+		color: #007AFF;
+		display: flex;
+		text-decoration: underline;
+		font-style: italic;
+		align-items: center;
+		justify-content: center;
+	}
+</style>

+ 9 - 0
pages/mine/mine.vue

@@ -142,6 +142,12 @@ export default {
 					name:'changePsw',
 					show:this.loginType!=this.$loginType.STAFF
 				},
+				{
+					itemName: '健康码',
+					itemIcon: '/static/index/blue/healthcode.png',
+					name:'healthcode',
+					show:true
+				},
 				{
 					itemName: '问题反馈',
 					itemIcon: '/static/index/blue/fankui.png',
@@ -273,6 +279,9 @@ export default {
 				case 'changePsw':
 					url="/pages/mine/changePass/changePass"
 					break;
+				case 'healthcode':
+					url="/pages/mine/healthcode/healthcode"
+					break;
 				default:
 					break;
 			}

BIN
static/index/blue/healthcode.png


Some files were not shown because too many files changed in this diff