Browse Source

add:未登录操作跳转登录、闸机开门调用摄像头拍照

ZhangJunQuan 2 tháng trước cách đây
mục cha
commit
710252975b
3 tập tin đã thay đổi với 31 bổ sung3 xóa
  1. 23 0
      src/hardware/GateOperate.js
  2. 5 0
      src/login/UserHome.vue
  3. 3 3
      webpack.dev.js

+ 23 - 0
src/hardware/GateOperate.js

@@ -6,6 +6,25 @@ import { LIGHT_NORMAL, LIGHT_OPEN, LIGHT_CLOSE, LIGHT_ALARM, LIGHT_RESTART } fro
  * @param {string} command - 控制命令,支持 'OPEN', 'SHOTOPEN', 'CLOSE', 'REBOOT', 'ALARM'
  * @returns {Promise<void>} 异步操作结果
  */
+
+const photo = async () => {
+    try {
+        $.ajax({
+            url: 'http://127.0.0.1:10088/api/AGVResource/cancelTask',
+            method: 'GET',
+            contentType: 'application/json',
+            success: function (response) {
+                console.log('控制拍照成功:', response);
+            },
+            error: function (error) {
+                console.error('控制拍照失败:', error);
+            },
+        });
+    } catch (error) {
+        console.error('拍照失败:', error);
+    }
+};
+
 const gateController = command => {
     try {
         // 验证输入参数
@@ -21,6 +40,10 @@ const gateController = command => {
         if (command === 'OPEN' || command === 'SHOTOPEN') {
             // 开门命令:控制灯光显示开门状态(绿灯常亮)
             plugin.gateConfig.controlLight(JSON.stringify(LIGHT_OPEN));
+
+            //开门拍照
+            photo();
+           
         } else if (command === 'CLOSE') {
             // 关门命令:控制灯光显示关门状态(红灯常亮)
             plugin.gateConfig.controlLight(JSON.stringify(LIGHT_CLOSE));

+ 5 - 0
src/login/UserHome.vue

@@ -681,6 +681,11 @@ const handleLogout = () => {
 // 处理按钮操作
 const handleAction = action => {
     console.log('Action clicked:', action);
+    if (!localStorage.getItem('#token')) {
+        console.log('用户未登录,跳转到登录页');
+        router.push('/fingerprint-login');
+        return;
+    }
     switch (action) {
     // 外侧屏幕操作
     case 'materialOut':

+ 3 - 3
webpack.dev.js

@@ -43,17 +43,17 @@ module.exports = WebpackMerge.merge(baseConfig, {
         // },
         proxy: {
             '/api': {
-                target: 'http://jb55c494.natappfree.cc/',
+                target: 'http://127.0.0.1:10026/',
                 ws: false,
                 changeOrigin: true,
             },
             '/authApi': {
-                target: 'http://jb55c494.natappfree.cc/',
+                target: 'http://127.0.0.1:10026/',
                 ws: false,
                 changeOrigin: true,
             },
             '/android-device-sdk': {
-                target: 'http://jb55c494.natappfree.cc/',
+                target: 'http://127.0.0.1:10026/',
                 ws: false,
                 changeOrigin: true,
             },