初始化
This commit is contained in:
121
Face.Web/Areas/App/Views/CheckinPms/Checkin.cshtml
Normal file
121
Face.Web/Areas/App/Views/CheckinPms/Checkin.cshtml
Normal file
@@ -0,0 +1,121 @@
|
||||
@model List<TBL_ROOM_BASIC_INFO>
|
||||
|
||||
@using Face.Domain.Application;
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Checkin";
|
||||
Layout = "~/Areas/App/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
|
||||
|
||||
<div class="content-wrapper">
|
||||
<section class="content" style="padding:0px;">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<!-- Default box -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span style="font-size:30px">(<span class="info-box-icon bg-success"> </span>=空房/ <span class="info-box-icon bg-warning"> </span>=出租)</span>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse"></button>
|
||||
<button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
@if (Model != null)
|
||||
{
|
||||
foreach (var item in Model)
|
||||
{
|
||||
<div class="col-lg-1 col-3">
|
||||
<!-- small card -->
|
||||
@*<div class="@(item.RoomStatusID == 2 ? "small-box bg-warning" : "small-box bg-success")">*@
|
||||
@*<div class="inner">*@
|
||||
<div style="background-color: #00FF7F; width: 100%;">
|
||||
<div style="text-align: center; color: blue; font-size:23px;">@item.ROOM_NUMBER</div>
|
||||
</div>
|
||||
<div style="background-color: #98FB98; width: 100%;">
|
||||
<span style="text-align:center;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-person-fill" viewBox="0 0 16 16">
|
||||
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" />
|
||||
</svg>
|
||||
2
|
||||
</span>
|
||||
<span style="margin-left: 35%;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-card-image" viewBox="0 0 16 16">
|
||||
<path d="M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z" />
|
||||
<path d="M1.5 2A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-13zm13 1a.5.5 0 0 1 .5.5v6l-3.775-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12v.54A.505.505 0 0 1 1 12.5v-9a.5.5 0 0 1 .5-.5h13z" />
|
||||
</svg>
|
||||
2
|
||||
</span>
|
||||
|
||||
<div class="small-box-footer" style="width: 100%; margin-top: 10%; ">
|
||||
<a onclick="getBarCodeTestLogs('@item.ROOM_NUMBER')">
|
||||
开房
|
||||
</a>
|
||||
<a style="margin-left: 40%;">
|
||||
退房
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@*</div>*@
|
||||
@*</div>*@
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content" style="padding:0px;">
|
||||
<div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="false">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content animated fadeIn">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="RoomName"></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" onclick="closeLog()"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||||
</div>
|
||||
<div class="modal-body" id="modal-body" style="padding:10px">
|
||||
</div>
|
||||
@*<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal" onclick="closeLog()">关闭</button>
|
||||
</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- /.card -->
|
||||
<div class="col-sm-4" id="faceDetailsBox">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
function closeLog() {
|
||||
$("#myModal").css("display", "none");
|
||||
}
|
||||
function getBarCodeTestLogs(Roomane) {
|
||||
console.log(Roomane);
|
||||
$('#RoomName').html(Roomane);
|
||||
$("#myModal").css("display", "block");
|
||||
$("#modal-body").html("查询中...");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/app/CheckinPms/CheckinRoom",
|
||||
cache: false,
|
||||
data: { "Roomane": Roomane },
|
||||
success: function (res) {
|
||||
$("#modal-body").html(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
177
Face.Web/Areas/App/Views/CheckinPms/CheckinRoom.cshtml
Normal file
177
Face.Web/Areas/App/Views/CheckinPms/CheckinRoom.cshtml
Normal file
@@ -0,0 +1,177 @@
|
||||
@{
|
||||
Layout = null;
|
||||
string roomname = (string)ViewData["Roomane"];
|
||||
}
|
||||
<form class="form-horizontal" id="AddresidentFrom">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">客户名字</font></font></label>
|
||||
<input type="email" class="form-control" id="name" placeholder="输入名字">
|
||||
<p></p>
|
||||
<label for="exampleInputEmail1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">客户身份证</font></font></label>
|
||||
<input type="email" class="form-control" id="id_no" placeholder="输入身份证">
|
||||
<p></p>
|
||||
<label for="exampleInputEmail1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">客户电话号码</font></font></label>
|
||||
<input type="email" class="form-control" id="phones" placeholder="输入电话">
|
||||
<p></p>
|
||||
<label for="exampleInputEmail1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">性别</font></font></label>
|
||||
<select class="form-control" id="OrgId" style=" float:left">
|
||||
<option value="1">
|
||||
男
|
||||
</option>
|
||||
<option value="0">
|
||||
女
|
||||
</option>
|
||||
</select>
|
||||
<p></p>
|
||||
<p><label for="exampleInputEmail1"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">客户人脸</font></font></label></p>
|
||||
<video id="videoElement" autoplay style="width:50%;"></video>
|
||||
<button class="btn btn-md btn-primary" id="captureButton">拍照</button>
|
||||
<img id="imageElement" style="width:50%; height:30%;" alt="" class="">
|
||||
<div></div>
|
||||
<div id="pictureShow"></div>
|
||||
<p></p>
|
||||
</div>
|
||||
<p></p>
|
||||
<div class="col-md-offset-3 col-md-9">
|
||||
<button class="btn btn-md btn-primary" type="button" id="btnAddShow" onclick="OpeningOperation()">开房</button>
|
||||
</div>
|
||||
<div style="display:none;" id="roomid">
|
||||
@roomname
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
const videoElement = document.getElementById('videoElement');
|
||||
const captureButton = document.getElementById('captureButton');
|
||||
|
||||
// 捕获视频帧并发送到后端
|
||||
captureButton.addEventListener('click', () => {
|
||||
event.preventDefault(); // 阻止默认的表单提交行为
|
||||
const imageElement = document.getElementById('imageElement'); // 添加一个 <img> 元素的引用
|
||||
const currentTime = new Date();
|
||||
const year = currentTime.getFullYear();
|
||||
const month = currentTime.getMonth() + 1; // 注意月份是从 0 开始的,因此需要加 1
|
||||
const day = currentTime.getDate();
|
||||
const hours = currentTime.getHours();
|
||||
const minutes = currentTime.getMinutes();
|
||||
const seconds = currentTime.getSeconds();
|
||||
const canvas = document.createElement('canvas');
|
||||
const context = canvas.getContext('2d');
|
||||
|
||||
canvas.width = videoElement.videoWidth;
|
||||
canvas.height = videoElement.videoHeight;
|
||||
|
||||
context.drawImage(videoElement, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
canvas.toBlob((blob) => {
|
||||
const formData = new FormData();
|
||||
formData.append('video', blob, `${year}-${month}-${day}${hours}-${minutes}-${seconds}.png`);
|
||||
fetch('/CheckinPms/Save', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
const imageElement = document.getElementById('imageElement');
|
||||
imageElement.src = "data:image/png;base64," + data.imgbase64String;
|
||||
imageElement.className = data.imgpath;
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error saving video:', error);
|
||||
});
|
||||
}, 'video/webm');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//const videoElement = document.getElementById('videoElement');
|
||||
//const captureButton = document.getElementById('captureButton');
|
||||
|
||||
//// 捕获视频帧并保存
|
||||
//captureButton.addEventListener('click', () => {
|
||||
// const canvas = document.createElement('canvas');
|
||||
// const context = canvas.getContext('2d');
|
||||
|
||||
// // 设置canvas的尺寸与视频宽高相同
|
||||
// canvas.width = videoElement.videoWidth;
|
||||
// canvas.height = videoElement.videoHeight;
|
||||
|
||||
// // 将当前视频帧绘制到canvas上
|
||||
// context.drawImage(videoElement, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
// // 将canvas转换为图像数据URL
|
||||
// const imageDataURL = canvas.toDataURL('image/png');
|
||||
|
||||
// // 创建一个链接元素,并设置其下载属性
|
||||
// const link = document.createElement('a');
|
||||
// link.href = imageDataURL;
|
||||
// link.download = 'captured_image.png';
|
||||
|
||||
// // 模拟用户点击链接以触发下载
|
||||
// link.click();
|
||||
//});
|
||||
|
||||
|
||||
|
||||
//function Photograph() {
|
||||
// 获取video元素
|
||||
const video = document.getElementById('videoElement');
|
||||
// 检查浏览器是否支持getUserMedia
|
||||
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
||||
// 请求访问摄像头
|
||||
navigator.mediaDevices.getUserMedia({ video: true })
|
||||
.then(function (stream) {
|
||||
// 将视频流附加到video元素
|
||||
video.srcObject = stream;
|
||||
video.play();
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.error('访问摄像头出错: ', error);
|
||||
});
|
||||
} else {
|
||||
console.error('浏览器不支持getUserMedia');
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
function OpeningOperation() {
|
||||
var name1 = $('#name').val();
|
||||
var id_no = $('#id_no').val();
|
||||
var element = document.getElementById('imageElement');
|
||||
var classes = element.className;
|
||||
var photo = classes;
|
||||
var sex1 = $('#OrgId').val();
|
||||
var roomid = $('#RoomName').html();
|
||||
console.log(roomid);
|
||||
var phone1 = $('#phones').val();
|
||||
var InfoBodyShow = {
|
||||
name: name1,
|
||||
idNumber: id_no,
|
||||
picture: photo,
|
||||
sex: sex1,
|
||||
phone: phone1,
|
||||
roomid: roomid
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/app/CheckinPms/OpeningOperation",
|
||||
cache: false,
|
||||
data: InfoBodyShow ,
|
||||
success: function (res) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user