wgl il y a 4 ans
Parent
commit
fdb35f8c3a

+ 1 - 0
package.json

@@ -15,6 +15,7 @@
 		"compression-webpack-plugin": "^6.0.2",
 		"core-js": "^3.6.4",
 		"echarts": "^4.9.0",
+		"qrcodejs2": "^0.0.2",
 		"vconsole": "^3.3.4",
 		"vue": "^2.6.11",
 		"vue-router": "^3.2.0",

+ 11 - 0
src/projects/business/apis/Common/health.js

@@ -36,3 +36,14 @@ export function getCertList(params) {
 		method: 'post',
 	})
 }
+
+//获取健康码
+export function getGreenCode(personId) {
+	return request({
+		url: '/mobile/IndividualLogApi/getGreenCode',
+		data: Qs.stringify({
+			personId: personId
+		}),
+		method: 'post',
+	})
+}

+ 12 - 0
src/projects/business/apis/Master/index.js

@@ -10,3 +10,15 @@ export function savePerson(params) {
 		method: 'post',
 	})
 }
+
+//更新用户身份证
+export function updateIdCard(idCard, name) {
+	return request({
+		url: '/mobile/personInfoApi/updateIdCard',
+		data: Qs.stringify({
+			idCard: idCard,
+			name: name
+		}),
+		method: 'post',
+	})
+}

+ 305 - 0
src/projects/business/components/GreenCode.vue

@@ -0,0 +1,305 @@
+<template>
+	<div>
+		<!--补全身份证-->
+		<div class="fyy-popup-1" v-show="editIdcardVisible">
+			<div class="fyy-popup-bg"></div>
+			<div class="fyy-popup-ceter">
+				<div class="fyy-popup-inner">
+					<h4>请补全身份信息</h4>
+					<form class="mui-input-group">
+						<div class="mui-input-row">
+							<label>姓名</label>
+							<input type="text" v-model="name" placeholder="请输入姓名">
+						</div>
+						<div class="mui-input-row">
+							<label>身份证号</label>
+							<input type="text" v-model="idCard" placeholder="请输入身份证号">
+						</div>
+						<div class="mui-input-row">
+							<div style="text-align: center;"><a class="jp-faq mui-icon mui-icon-help" style="color:#999;font-size: 14px;">用于获取健康码及实名认证服务</a></div>
+						</div>
+						<div class="mui-button-row">
+							<button type="button" class="mui-btn" @click="editIdcardVisible=false">取消</button>
+							<button type="button" class="mui-btn red" @click="updateIdCard">确认</button>
+						</div>
+					</form>
+				</div>
+			</div>
+		</div>
+		<!--二维码展示-->
+
+		<div class="fyy-popup-1" style="z-index: 999" v-show="qrcodeVisible">
+			<div class="fyy-popup-bg" @click="qrcodeVisible=false"></div>
+			<div class="fyy-popup-ceter fyy-popup-center">
+				<div class="fyy-popup-inner">
+					<div class="fyy-popup-title">
+						<div class="mui-col-xs-4">
+							<label>姓名</label>
+							<h5 v-text="showMsg(name,'name')"></h5>
+						</div>
+						<div class="mui-col-xs-8">
+							<label>身份证<span :class="(hideMsg?'icon-yanjing_bi ':'icon-hj ')+'mui-icon iconfont mui-pull-right'" @click="hideMsg=!hideMsg"></span></label>
+							<h5 v-text="showMsg(idCard,'idCard')"></h5>
+						</div>
+					</div>
+					<div class="fyy-popup-ma">
+						<img :src="qrCodeImg" id="qrcode">
+						<h6>更新于 {{qrcodeDetail.date}}</h6>
+					</div>
+					<form class="mui-input-group">
+						<div class="mui-input-row">
+							<label>数据来源</label>
+							<span v-text="qrcodeDetail.sjly" style="line-height: 28px;padding-top:10px;"></span>
+						</div>
+						<div class="mui-input-row" v-show="qrcodeDetail.healthyCode!='00'">
+							<label>原因</label>
+							<span v-text="qrcodeDetail.reason"></span>
+						</div>
+					</form>
+				</div>
+			</div>
+		</div>
+
+		<!-- <loading :visible="isLoading"></loading> -->
+	</div>
+
+</template>
+
+<script>
+	import * as API_Master from '@/apis/Master/index'
+	import * as API_Health from '@/apis/Common/health'
+	import Loading from '$project/components/Loading.vue'
+	import QRCode from 'qrcodejs2'
+	import {
+		convertCanvasToImage,
+		checkIdCard,
+		substrMb
+	} from '$project/utils'
+	import {
+		mapGetters,
+		mapMutations
+	} from 'vuex'
+	export default {
+		name: 'GreenCode',
+		components: {
+			Loading,
+		},
+		props: {
+			personId: {
+				require: true,
+				default: '',
+			},
+		},
+		data() {
+			return {
+				isLoading: false,
+				name: "",
+				idCard: undefined,
+				statusName: '正常',
+				statusTitleColor: '#33BB00',
+				editIdcardVisible: false,
+				qrcodeVisible: false,
+				qrcodeDetail: {
+					healthyCode: '11',
+					date: '',
+					reason: '',
+					sjly: '',
+				},
+				qrcodeColor: {
+					'00': {
+						background: '#FFFFFF',
+						foreground: '#33BB00',
+						title: '正常',
+						name: '绿码',
+					},
+					'01': {
+						background: '#FFFFFF',
+						foreground: '#FFBB00',
+						title: '异常',
+						name: '黄码',
+					},
+					'10': {
+						background: '#FFFFFF',
+						foreground: '#FF6666',
+						title: '异常',
+						name: '红码',
+					},
+					'11': {
+						background: '#FFFFFF',
+						foreground: '#CCCCCC',
+						title: '异常',
+						name: '灰码',
+					},
+				},
+				qrCodeImg: '',
+				hideMsg: true,
+			}
+		},
+		created() {
+
+		},
+		methods: {
+			//获取当前健康码的其作定义对象
+			getCode() {
+				return this.qrcodeColor[this.qrcodeDetail.healthyCode];
+			},
+			//获取绿码信息
+			getGreenCode() {
+				if (this.qrcodeDetail.date) {
+					return;
+				}
+				//传过来的身份证号码才会处理
+				this.isLoading = true;
+				API_Health.getGreenCode(this.personId).then(response => {
+					this.isLoading = false;
+
+					this.idCard = response.idCard;
+					this.name = response.name;
+
+					if (response.hasIdCard) {
+						this.qrcodeDetail = response;
+						//生成二维码
+						this.$nextTick(() => {
+							this.qrcode();
+						});
+						//修改系统色
+						this.$emit('callBack', this.qrcodeColor[this.qrcodeDetail.healthyCode]);
+					}
+				}).catch(error => {
+					this.isLoading = false;
+					//mui.toast(error);
+				})
+			},
+			//显示绿码
+			showGreenCode() {
+				if (this.qrcodeDetail.date) {
+					this.qrcodeVisible = true;
+				} else {
+					if (this.idCard === undefined) {
+						mui.alert(
+							'<div style="text-align:left;">可能由以下原因导致:<br/>1.该用户的身份证号尚未申请湖北健康码;<br/>2.该用户的姓名和身份证号与申请湖北健康码时填写的信息不一致;<br/>3.新申请的湖北健康码,系统数据同步有延时,请等待两天后再次尝试。</div>',
+							'健康码获取失败',
+							function() {
+
+							}
+						);
+					} else {
+						if (this.person_data.id == this.personId) {
+							this.editIdcardVisible = true;
+						}
+					}
+				}
+			},
+			//生成二维码
+			qrcode() {
+				console.log(this.qrcodeColor[this.qrcodeDetail.healthyCode]['foreground']);
+				let qrcode = new QRCode('qrcode', {
+					width: 200,
+					height: 200,
+					text: window.location.href.split("#")[0] + '/business/#/common/health/cert?personId=' + this.personId,
+					correctLevel: QRCode.CorrectLevel.M,
+					// render: 'canvas' // 设置渲染方式(有两种方式 table和canvas,默认是canvas)
+					colorLight: this.qrcodeColor[this.qrcodeDetail.healthyCode]['background'],
+					colorDark: this.qrcodeColor[this.qrcodeDetail.healthyCode]['foreground']
+				})
+				var canvas = document.getElementsByTagName('canvas')[0];
+				this.qrCodeImg = convertCanvasToImage(canvas);
+			},
+			//更新身份证号
+			updateIdCard() {
+				var _this = this
+				var checkIdCardResult = checkIdCard(this.idCard);
+				if (checkIdCardResult !== true) {
+					mui.toast(checkIdCardResult);
+				} else if (!this.name) {
+					mui.toast('请输入姓名');
+				} else {
+					this.isLoading = true;
+					API_Master.updateIdCard(this.idCard, this.name).then(response => {
+						_this.isLoading = false;
+
+						_this.editIdcardVisible = false;
+						//获取绿码,并不会显示
+						_this.getGreenCode();
+
+						this.$emit('updateIdCardAsynCallBack', {
+							idCard: this.idCard,
+							name: this.name
+						});
+
+					}).catch(error => {
+						this.isLoading = false;
+						mui.toast(error);
+					})
+				}
+			},
+			//显示与隐藏信息
+			showMsg(str, type) {
+				if (str) {
+
+				} else {
+					return
+				}
+				if (this.hideMsg) {
+					if (type == 'name') {
+						return substrMb(str, 0, 2) + '**';
+					} else if (type == 'idCard') {
+						return substrMb(str, 0, 1) + '****************' + substrMb(str, str.length - 1, 1);
+					} else {
+						return str;
+					}
+				} else {
+					return str;
+				}
+			},
+
+		},
+		computed: {
+			...mapGetters({
+				person_data: 'person_data',
+				company_data: 'company_data',
+			})
+		},
+		watch: {}
+	}
+</script>
+
+<style scoped src="$project/assets/css/xpwyfyy.css"></style>
+<style scoped src="$project/assets/css/sczpfyy.css"></style>
+<style scoped src="$project/assets/css/iconfont.css"></style>
+<style scoped>
+	.fyy-scon-center .mui-checkbox input[type=checkbox],
+	.fyy-scon-center .mui-radio input[type=radio] {
+		left: 0
+	}
+
+	.fyy-scon-center.mui-card .mui-checkbox input[type=checkbox]:checked:before,
+	.fyy-scon-center.mui-card .mui-radio input[type=radio]:checked:before {
+		color: #096DD9
+	}
+
+	.fyy-scon-center .mui-input-row label {
+		padding-left: 40px;
+	}
+
+	.fyy-scon-center.mui-card {
+		background: #ffffff;
+		padding: 15px 15px 5px;
+		border-radius: 5px;
+	}
+
+	.fyy-popup-1 {
+		margin-left: auto;
+		margin-top: auto;
+		text-align: left;
+	}
+
+	.fyy-popup-1 .iconfont {
+		font-size: 16px;
+		color: #999
+	}
+
+	.mui-popup {
+		width: 300px;
+	}
+</style>

+ 16 - 6
src/projects/business/views/Common/Health/Cert.vue

@@ -2,6 +2,7 @@
 	<div>
 		<common @asynCallBack="asynCallBack"></common>
 		<top-header :pageTitle="pageTitle" :rightLink="rightLink" :doRightLink="doRightLink" :headerStyle="'background-color:'+statusTitleColor"></top-header>
+		<green-code ref="greenCode" :personId="subForm.personId"></green-code>
 
 		<div class="mui-content vongi-jkz-content">
 			<div class="vongi-jkz-content mui-content-padded mui-clearfix">
@@ -19,12 +20,12 @@
 							<div class="vongi-jkz-list">
 								<div class="fyy-statistics-body">
 									<h2>{{detail.name}}<span :style="'color:'+statusTitleColor">{{statusName}}</span></h2>
-									<a class="mui-navigate-right">
-										<span class="mui-icon iconfont icon-erweima1"></span>
+									<a class="mui-navigate-right" @click="showGreenCode">
+										<span class="mui-icon iconfont icon-erweima1" :style="'color: '+statusTitleColor+';margin-right:15px;line-height: 27px'"></span>
 									</a>
 								</div>
-								<div class="mui-ellipsis mui-h5">湖北荆鹏软件集团有限公司</div>
-								<div class="mui-ellipsis mui-h5">信息工程部</div>
+								<div class="mui-ellipsis mui-h5" v-text="detail.parking"></div>
+								<div class="mui-ellipsis mui-h5" v-text="detail.companyName"></div>
 							</div>
 						</li>
 						<li class="mui-table-view-cell mui-media mui-col-xs-6">
@@ -71,6 +72,7 @@
 
 <script>
 	import * as API_Health from '@/apis/Common/health'
+	import GreenCode from '@/components/GreenCode.vue'
 	import echarts from 'echarts/lib/echarts'
 	import 'echarts/lib/chart/line'
 	import 'echarts/lib/component/legend'
@@ -87,7 +89,8 @@
 		components: {
 			Common,
 			Loading,
-			TopHeader
+			TopHeader,
+			GreenCode
 		},
 		data() {
 			return {
@@ -117,7 +120,8 @@
 			}
 		},
 		created() {
-			this.subForm.personId = this.person_data.id;
+			this.subForm.personId = this.$route.query.personId ? this.$route.query.personId : this.person_data.id;
+
 		},
 		methods: {
 			//获取详情
@@ -339,6 +343,10 @@
 					}
 				});
 			},
+			//显示健康码
+			showGreenCode() {
+				this.$refs.greenCode.showGreenCode();
+			},
 			//右上角点击事件
 			doRightLink() {
 				this.$router.push({
@@ -353,6 +361,8 @@
 			this.getDetail();
 			//获取统计图表
 			this.getEcharts();
+
+			this.$refs.greenCode.getGreenCode();
 		},
 		destroyed() {},
 		computed: {

+ 11 - 1
src/projects/home/App.vue

@@ -4,6 +4,17 @@
 	</div>
 </template>
 
+<script>
+	export default {
+		name: 'Home',
+		mounted() {
+			mui('body').on('tap', '.jump', function() {
+				document.location.href = this.href;
+			});
+		}
+	}
+</script>
+
 <style lang="scss">
 	#app {
 		font-family: Avenir, Helvetica, Arial, sans-serif;
@@ -11,4 +22,3 @@
 		-moz-osx-font-smoothing: grayscale;
 	}
 </style>
-

+ 46 - 12
src/projects/home/views/Home.vue

@@ -1,23 +1,23 @@
 <template>
 	<div>
-		<header class="mui-bar mui-bar-nav">
-			<h1 class="mui-title">选择行业</h1>
-		</header>
+		<common @asynCallBack="asynCallBack"></common>
+		<top-header :pageTitle="pageTitle" :leftShow="false"></top-header>
+
 		<div class="mui-content margin60">
 			<div class="vongi-choose">
 				<h1>选择行业</h1>
 				<h5>“小鹏管家”是智慧物业、智慧园区、智慧养老的云管家,是智慧生活的守护神。管家服务于访客、园区(包括小区、居家+机构养老、企事业单位、厂区)人员及管理者。主要功能包括出入管理、健康监管、考勤打卡、物业管理、安全监管、访客管理以及在线缴费等。</h5>
 				<ul class="mui-table-view">
 					<li class="mui-table-view-cell mui-media vongi-choose-yq">
-						<a class="mui-navigate-right">
+						<router-link :to="{name:'Role',query:{project:'business'}}" class="mui-navigate-right jump">
 							<img class="mui-media-object mui-pull-left" src="~$project/assets/img/icon02.png">
 							<div class="mui-media-body">
 								工厂园区
 								<p class='mui-ellipsis'>适用于办公楼、工厂、工业园等场所</p>
 							</div>
-						</a>
+						</router-link>
 					</li>
-					<li class="mui-table-view-cell mui-media vongi-choose-zz">
+					<!-- <li class="mui-table-view-cell mui-media vongi-choose-zz">
 						<a class="mui-navigate-right">
 							<img class="mui-media-object mui-pull-left" src="~$project/assets/img/icon17.png">
 							<div class="mui-media-body">
@@ -34,20 +34,56 @@
 								<p class='mui-ellipsis'>适用于养老院、居家养老等场所</p>
 							</div>
 						</a>
-					</li>
+					</li> -->
 				</ul>
 			</div>
 		</div>
-		<div class="fyy-footer">
+		<!-- <div class="fyy-footer">
 			<div class="bindfyy-btn"><button type="submit" class="mui-btn mui-btn-outlined">我是访客</button></div>
-		</div>
+		</div> -->
 	</div>
 </template>
 
 <script>
+	import Common from '$project/components/Common.vue'
+	import Loading from '$project/components/Loading.vue'
+	import TopHeader from '$project/components/TopHeader.vue'
+	import {
+		mapGetters,
+		mapMutations
+	} from 'vuex'
 	export default {
 		name: 'Home',
-		components: {}
+		components: {
+			Common,
+			Loading,
+			TopHeader
+		},
+		data() {
+			return {
+				pageTitle: '选择行业',
+			}
+		},
+		created() {
+
+		},
+		methods: {
+			asynCallBack() {
+
+			},
+		},
+		mounted() {},
+		destroyed() {
+
+		},
+		computed: {
+			...mapGetters({
+				openId: 'wx_openid',
+				token: 'token',
+				person_data: 'person_data',
+				company_data: 'company_data',
+			})
+		}
 	}
 </script>
 
@@ -55,5 +91,3 @@
 <style scoped src="$project/assets/css/xpwyfyy.css"></style>
 <style scoped>
 </style>
-
-

+ 82 - 29
src/projects/home/views/Role.vue

@@ -1,19 +1,19 @@
 <template>
 	<div>
-		<header class="mui-bar mui-bar-nav">
-			<h1 class="mui-title">匹配身份</h1>
-		</header>
+		<common @asynCallBack="asynCallBack"></common>
+		<top-header :pageTitle="pageTitle" :leftShow="false"></top-header>
+
 		<div class="mui-content margin60">
 			<div class="vongi-choose mui-content-padded">
 				<h5>经过比对,您可以使用下列企业的身份登录: </h5>
 				<ul class="mui-table-view  mui-table-view-radio vongi-pipei">
-					<li class="mui-table-view-cell mui-selected">
+					<li v-show="popedom.indexOf('1')>-1" :class="'mui-table-view-cell '+(role=='1'?'mui-selected':'')" @click="role='1'">
 						<a>
 							<div class="mui-pull-left mui-col-xs-2">
 								<div class="mui-media-object">
-									<img src="~$project/assets/img/03.jpg">	
+									<img src="~$project/assets/img/03.jpg">
 								</div>
-								<p class='mui-ellipsis'>员工</p>
+								<p class='mui-ellipsis'>个人端</p>
 							</div>
 							<div class="mui-media-body mui-col-xs-10">
 								湖北荆鹏软件集团有限公司
@@ -21,13 +21,13 @@
 							</div>
 						</a>
 					</li>
-					<li class="mui-table-view-cell">
+					<li v-show="popedom.indexOf('2')>-1" :class="'mui-table-view-cell '+(role=='2'?'mui-selected':'')" @click="role='2'">
 						<a>
 							<div class="mui-pull-left mui-col-xs-2">
 								<div class="mui-media-object">
-									<img src="~$project/assets/img/03.jpg">	
+									<img src="~$project/assets/img/03.jpg">
 								</div>
-								<p class='mui-ellipsis'>员工</p>
+								<p class='mui-ellipsis'>管理端</p>
 							</div>
 							<div class="mui-media-body mui-col-xs-10">
 								湖北荆鹏软件集团有限公司
@@ -35,13 +35,13 @@
 							</div>
 						</a>
 					</li>
-					<li class="mui-table-view-cell">
+					<li v-show="popedom.indexOf('3')>-1" :class="'mui-table-view-cell '+(role=='3'?'mui-selected':'')" @click="role='3'">
 						<a>
 							<div class="mui-pull-left mui-col-xs-2">
 								<div class="mui-media-object">
-									<img src="~$project/assets/img/03.jpg">	
+									<img src="~$project/assets/img/03.jpg">
 								</div>
-								<p class='mui-ellipsis'>员工</p>
+								<p class='mui-ellipsis'>监管端</p>
 							</div>
 							<div class="mui-media-body mui-col-xs-10">
 								湖北荆鹏软件集团有限公司
@@ -49,33 +49,86 @@
 							</div>
 						</a>
 					</li>
-					<li class="mui-table-view-cell">
-						<a>
-							<div class="mui-pull-left mui-col-xs-2">
-								<div class="mui-media-object">
-									<img src="~$project/assets/img/03.jpg">	
-								</div>
-								<p class='mui-ellipsis'>管理人员</p>
-							</div>
-							<div class="mui-media-body mui-col-xs-10">
-								湖北荆鹏软件集团有限公司
-								<p class='mui-ellipsis'>信息工程中心</p>
-							</div>
-						</a>
-					</li>
-				</ul>				
+				</ul>
 			</div>
 		</div>
 		<div class="fyy-footer">
-			<div class="bindfyy-btn"><button type="submit" class="mui-btn mui-btn-primary">确认选择</button></div>
+			<div class="bindfyy-btn"><button type="submit" class="mui-btn mui-btn-primary" @click="sure">确认选择</button></div>
 		</div>
 	</div>
 </template>
 
 <script>
+	import Common from '$project/components/Common.vue'
+	import Loading from '$project/components/Loading.vue'
+	import TopHeader from '$project/components/TopHeader.vue'
+	import {
+		mapGetters,
+		mapMutations
+	} from 'vuex'
 	export default {
 		name: 'Role',
-		components: {}
+		components: {
+			Common,
+			Loading,
+			TopHeader
+		},
+		data() {
+			return {
+				pageTitle: '选择角色',
+
+				//传递过来的场景项目
+				project: this.$route.query.project,
+
+				role: '',
+			}
+		},
+		created() {
+
+		},
+		methods: {
+			//确认
+			sure() {
+				if (this.project == 'business') {
+					if (this.role == '1') {
+						window.location.href = "../" + this.project + '/#/master';
+					} else if (this.role == '2') {
+						window.location.href = "../" + this.project + '/#/houseKeeper/admin';
+					} else if (this.role == '3') {
+						window.location.href = "../" + this.project + '/#/houseKeeper/control';
+					} else {
+						mui.toast('请选择角色');
+					}
+				} else {
+					mui.toast('未开放场景');
+				}
+			},
+			asynCallBack() {
+
+			},
+		},
+		mounted() {},
+		destroyed() {
+
+		},
+		computed: {
+			popedom: {
+				// getter
+				get: function() {
+					return this.person_data ? this.person_data.popedom.split(',') : [];
+				},
+				// setter
+				set: function(newValue) {
+					console.log(newValue)
+				}
+			},
+			...mapGetters({
+				openId: 'wx_openid',
+				token: 'token',
+				person_data: 'person_data',
+				company_data: 'company_data',
+			})
+		}
 	}
 </script>
 

+ 5 - 0
yarn.lock

@@ -6614,6 +6614,11 @@ q@^1.1.2:
   resolved "https://registry.npm.taobao.org/q/download/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
   integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=
 
+qrcodejs2@^0.0.2:
+  version "0.0.2"
+  resolved "https://registry.npm.taobao.org/qrcodejs2/download/qrcodejs2-0.0.2.tgz#465afe5e39f19facecb932c11f7a186109146ae1"
+  integrity sha1-Rlr+Xjnxn6zsuTLBH3oYYQkUauE=
+
 qs@6.7.0:
   version "6.7.0"
   resolved "https://registry.npm.taobao.org/qs/download/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"