| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- import QtQuick
- import QtQuick.Controls
- import com.InteractiveTask 1.0
- Item {
- id: facialrecognition
- x: 290
- y: 130
- width: 1600
- height: 920
- Connections {
- target: facialrecognition
- onVisibleChanged: {
- if (facialrecognition.visible === true)
- {
- interactiveFace.setCameraImageCallBack(callback_cameraImageGather, null, callback_cameraImageRemain);
- interactiveFace.cameraImagePlay();
- facialrecognition_text_result.text = "";
- }
- else
- {
- interactiveFace.cameraImageStop();
- }
- }
- }
- // 重新拍摄
- Button {
- id: facialrecognition_btn_retake
- x: 928
- y: 835
- width: 192
- height: 75
- visible: false
- background: Rectangle {
- color: "#ff9900"
- radius: 10
- }
- text: qsTr("重新拍摄")
- font.pixelSize: 30
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: facialrecognition_btn_retake
- onClicked: {
- facialrecognition_btn_affirm.visible = false;
- facialrecognition_btn_retake.visible = false;
- interactiveFace.cameraImagePlay();
- }
- }
- }
- // 确定
- Button {
- id: facialrecognition_btn_affirm
- x: 1168
- y: 835
- width: 192
- height: 75
- visible: false
- background: Rectangle {
- color: "#ff0000" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- text: qsTr("确定")
- font.pixelSize: 30
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: facialrecognition_btn_affirm
- onClicked: {
- var userFace = setView.userFace;
- if (userFace.length > 0)
- {
- var inText = userFace.length > 0 ? "?recordIds=" : "";
- for (var i = 0; i < userFace.length; ++i)
- {
- inText += userFace[i];
- inText += (i !== userFace.length - 1) ? "," : "";
- }
- interactiveCore.appendTask(
- InteractiveTask.TypeHttpPost_deleteSysUserCharacteristicByRecordIds, inText,
- (json)=>{
- var jsonObjData = JSON.parse(json);
- if (jsonObjData.code === 200) {
- var taskType = InteractiveTask.TypeHttpPost_insertUserFace;
- interactiveCore.appendTask(taskType, "", call_insertUserFace_reply);
- facialrecognition_btn_affirm.visible = false;
- facialrecognition_btn_retake.visible = false;
- }
- else
- {
- infoPromptBox.title("人脸特征删除失败");
- infoPromptBox.message(jsonObjData.msg);
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- });
- }
- else
- {
- var taskType = InteractiveTask.TypeHttpPost_insertUserFace;
- interactiveCore.appendTask(taskType, "", call_insertUserFace_reply);
- facialrecognition_btn_affirm.visible = false;
- facialrecognition_btn_retake.visible = false;
- }
- }
- }
- }
- // 返回按钮
- Button {
- id: facialrecognition_btn_return
- x: 1408
- y: 835
- width: 192
- height: 75
- background: Rectangle {
- color: "#055eb3" // 设置背景为透明
- radius: 10 // 可选,设置圆角
- }
- text: qsTr("返回")
- font.pixelSize: 30
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: facialrecognition_btn_return
- onClicked: {
- facialrecognition_btn_affirm.visible = false;
- facialrecognition_btn_retake.visible = false;
- facialrecognition.visible = false
- setView.visible = true;
- }
- }
- }
- Rectangle {
- id: facialrecognition_rect
- width: 1600
- height: 800
- color: "#272b7ae9"
- radius: 20
- clip: true
- Rectangle {
- x: 0
- y: 0
- width: 1600
- height: 800
- color: "#000000"
- border.color: "#47bfff"
- Image {
- id: facialrecognition_image_facial
- anchors.fill: parent
- visible: true
- layer.smooth: true
- layer.enabled: true
- cache: false
- fillMode: Image.PreserveAspectFit
- }
- }
- }
- Rectangle {
- id: delaymatrailstocknotice
- x: 0
- y: 823
- width: 300
- height: 75 // 减去顶部圆角矩形的高度
- color: "#00ffffff"
- visible: true
- // Image {
- // x: 0
- // y: 0
- // width: 75
- // height: 75
- // visible: true
- // source: "qrc:/png/takeback.png"
- // fillMode: Image.PreserveAspectFit
- // }
- Text {
- id: facialrecognition_text_result
- x: 80
- y: 0
- width: 389
- height: 75
- visible: true
- text: ""
- font.pixelSize: 30
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- }
- }
- function callback_cameraImageGather(url)
- {
- facialrecognition_image_facial.source = url;
- }
- function callback_cameraImageRemain(url)
- {
- facialrecognition_btn_affirm.visible = true;
- facialrecognition_btn_retake.visible = true;
- interactiveFace.cameraImageStop();
- facialrecognition_image_facial.source = url;
- }
- // 插入人脸数据回复
- function call_insertUserFace_reply(json)
- {
- console.log("完成人脸提交");
- var jsonObjRoot = JSON.parse(json);
- var text = jsonObjRoot["text"];
- facialrecognition_text_result.text = text;
- }
- }
|