Browse Source

门禁接口对接/代码优化

fanghuisheng 4 tháng trước cách đây
mục cha
commit
b6bb14328d

+ 5 - 5
src/api/business/door.js

@@ -2,19 +2,19 @@ import { request } from "@/utils/request";
 
 /**
  * 门禁接口集合
- * @method doorControl 门禁开门
- * @method doorList 门禁列表
+ * @method control 门禁开门
+ * @method Select 门禁列表
  */
 export function doorApi() {
     return {
-        doorControl: (data) => {
+        control: (data) => {
             return request({
-                url: `/service-iot/deviceHttp/control`,
+                url: `/service-eg/egDevice/control`,
                 method: 'GET',
                 data,
             });
         },
-        doorList: (data) => {
+        Select: (data) => {
             return request({
                 url: `/service-iot/dmpDeviceInfo/pageWhite`,
                 method: 'POST',

+ 2 - 2
src/api/business/fireIot/deviceManage.js

@@ -56,9 +56,9 @@ export function getList(data) {
 
   
 //设备离线状态更新
-export function doorControl(params) {
+export function deviceStatus(params) {
     return request({
-        url: '/service-iot/deviceHttp/doorControl',
+        url: '/service-iot/deviceHttp/status',
         method: 'get',
         params,
     })

+ 49 - 75
src/pages/business/fireIot/deviceManage/components/goAction.vue

@@ -10,26 +10,20 @@
     :data-theme="'theme-' + proxy.$settingStore.themeColor.name"
   >
     <template #default>
-  
       <view class="centerOne">
         <u--form ref="uForm" :model="form" :rules="rules" labelWidth="130">
           <view style="padding: 10px 0">
             <view style="padding: 10px 10px 20px 10px; background: #ffffff">
               <view style="padding-left: 9px">
                 <u-form-item label="命令" prop="commandName" required :borderBottom="true">
-                  <u-input v-model="form.commandName" placeholder="请输入命令名称" border="none">
-                   
-                  </u-input>
+                  <u-input v-model="form.commandName" placeholder="请输入命令名称" border="none"> </u-input>
                 </u-form-item>
-                <u-form-item label="命令属性" v-if="form.dataType==1" prop="commandValue" required :borderBottom="true" @click="handleAction('命令属性')">
+                <u-form-item label="命令属性" v-if="form.dataType == 1" prop="commandValue" required :borderBottom="true" @click="handleAction('命令属性')">
                   <u-input v-model="form.commandName1" placeholder="请选择命令属性" suffixIcon="arrow-right" suffixIconStyle="color: #909399" border="none" disabledColor="transparent" disabled />
                 </u-form-item>
                 <u-form-item v-else label="参数值" prop="commandValue" required :borderBottom="true">
-                  <u-input v-model="form.commandValue" placeholder="请输入参数值" border="none">
-                    
-                  </u-input>
+                  <u-input v-model="form.commandValue" placeholder="请输入参数值" border="none"> </u-input>
                 </u-form-item>
-                
               </view>
             </view>
           </view>
@@ -43,7 +37,6 @@
         </view>
       </view>
 
-     
       <u-picker
         :show="actionShow"
         :columns="actionsList"
@@ -56,8 +49,6 @@
         @cancel="actionShow = false"
         @confirm="selectAction"
       ></u-picker>
-
-
     </template>
   </oa-scroll>
 </template>
@@ -67,7 +58,7 @@
 import { onLoad, onShow } from "@dcloudio/uni-app";
 import { ref, reactive, toRefs, getCurrentInstance } from "vue";
 /*----------------------------------接口引入-----------------------------------*/
-import { getList,doorControl} from "@/api/business/fireIot/deviceManage.js";
+import { getList, deviceStatus } from "@/api/business/fireIot/deviceManage.js";
 /*----------------------------------组件引入-----------------------------------*/
 /*----------------------------------store引入-----------------------------------*/
 /*----------------------------------公共方法引入-----------------------------------*/
@@ -75,7 +66,7 @@ import { getList,doorControl} from "@/api/business/fireIot/deviceManage.js";
 const { proxy } = getCurrentInstance();
 /*----------------------------------变量声明-----------------------------------*/
 
-const deviceId=ref('')
+const deviceId = ref("");
 
 const dataList = reactive({
   form: {
@@ -85,10 +76,7 @@ const dataList = reactive({
   },
   rules: {
     commandName: [{ required: true, message: "请输入命令", trigger: "blur" }],
-    commandValue:[
-            { required: true},
-            { validator: commandValueScale,trigger: 'blur'}
-          ]
+    commandValue: [{ required: true }, { validator: commandValueScale, trigger: "blur" }],
   },
   actionTitle: "",
   actionShow: false,
@@ -96,43 +84,36 @@ const dataList = reactive({
   actionsList: [[]],
 });
 
-const {
-  form,
-  rules,
-  actionTitle,
-  actionsList,
-  actionShow,
-  actionDefaultIndex,
-} = toRefs(dataList);
+const { form, rules, actionTitle, actionsList, actionShow, actionDefaultIndex } = toRefs(dataList);
 
 const scanBool = ref(false);
 
 //参数值校验范围
 function commandValueScale(rule, value, callback) {
-  console.log(form.value.maximum,222)
-  if(form.value.maximum&&form.value.minimum){
-    if (value > form.value.minimum && value <form.value.maximum) {
-        callback();
-      } else {
-        callback(new Error(`输入的参数值必须大于${form.value.minimum}且小于${form.value.maximum}`));
-      }
-  }else{
+  console.log(form.value.maximum, 222);
+  if (form.value.maximum && form.value.minimum) {
+    if (value > form.value.minimum && value < form.value.maximum) {
+      callback();
+    } else {
+      callback(new Error(`输入的参数值必须大于${form.value.minimum}且小于${form.value.maximum}`));
+    }
+  } else {
     callback();
-  }          
+  }
 }
 
 //详情数据
-function getData(){
+function getData() {
   getList({
     current: 1,
     size: 10,
-    productCode:form.value.productCode,
-    commandCode:form.value.commandCode,
+    productCode: form.value.productCode,
+    commandCode: form.value.commandCode,
   }).then((response) => {
-    form.value=response.data.records[0];
-    form.value.commandDict = form.value.commandDict?JSON.parse(form.value.commandDict):'';
-    rules.value.commandValue[0].message=form.value.dataType==1?'请选择命令属性':"请输入参数值"
-    rules.value.commandValue[0].tigger=form.value.dataType==1?'change':"blur";
+    form.value = response.data.records[0];
+    form.value.commandDict = form.value.commandDict ? JSON.parse(form.value.commandDict) : "";
+    rules.value.commandValue[0].message = form.value.dataType == 1 ? "请选择命令属性" : "请输入参数值";
+    rules.value.commandValue[0].tigger = form.value.dataType == 1 ? "change" : "blur";
   });
 }
 
@@ -144,44 +125,40 @@ function getData(){
  */
 function handleSubmit(value) {
   proxy.$refs["uForm"]
-      .validate()
-      .then((res) => {
-        proxy.$modal.msg("校验通过");
-        var params={
-            commandCode:form.value.commandCode,
-            commandValue:form.value.commandValue,
-            productCode:form.value.productCode,
-            deviceId:deviceId.value,
-          }
-        doorControl(params).then((res) => {
-          if (res.status == "SUCCESS") {
-            if (scanBool.value) {
-              proxy.$tab.reLaunch(`/pages/common/success/index?codeName=提交成功&showNow=${false}`);
-            } else {
-              proxy.$modal.msg("提交成功");
-              setTimeout(() => {  
-                proxy.$tab.redirectTo("/pages/business/fireIot/deviceManage/index"); //返回到需要执行方法的页面
-              }, 2000);
-            }
+    .validate()
+    .then((res) => {
+      proxy.$modal.msg("校验通过");
+      var params = {
+        commandCode: form.value.commandCode,
+        commandValue: form.value.commandValue,
+        productCode: form.value.productCode,
+        deviceId: deviceId.value,
+      };
+      deviceStatus(params).then((res) => {
+        if (res.status == "SUCCESS") {
+          if (scanBool.value) {
+            proxy.$tab.reLaunch(`/pages/common/success/index?codeName=提交成功&showNow=${false}`);
+          } else {
+            proxy.$modal.msg("提交成功");
+            setTimeout(() => {
+              proxy.$tab.redirectTo("/pages/business/fireIot/deviceManage/index"); //返回到需要执行方法的页面
+            }, 2000);
           }
-        })
-      })
-      .catch((errors) => {
-        // proxy.$modal.msg("校验失败");
+        }
       });
+    })
+    .catch((errors) => {
+      // proxy.$modal.msg("校验失败");
+    });
 }
 
-
-
 /**
  * @action弹出框点击事件
  */
 function handleAction(value, index, ind) {
   if (value == "命令属性") {
     actionTitle.value = "命令属性";
-    actionsList.value = [
-      form.value.commandDict
-    ];
+    actionsList.value = [form.value.commandDict];
     if (form.value.commandDict) {
       actionsList.value[0].forEach((el, ind) => {
         if (el.value === form.value.commandValue) {
@@ -207,20 +184,17 @@ function selectAction(e) {
   actionShow.value = false;
 }
 
-
 onLoad((options) => {
   if ("commandCode" in options) {
     form.value.commandCode = options.commandCode;
-    
   }
   if ("productCode" in options) {
     form.value.productCode = options.productCode;
   }
   if ("deviceId" in options) {
-   deviceId.value = options.deviceId;
+    deviceId.value = options.deviceId;
   }
-  getData()
-
+  getData();
 });
 
 onShow(() => {

+ 3 - 3
src/pages/business/meeting/index.vue

@@ -309,9 +309,9 @@ function changeSheet(e) {
  */
 function openDoor(e) {
   doorApi()
-    .doorControl({
-      productCode: "502_KAT",
-      deviceId: e.doorId,
+    .control({
+      productCode: "502_USKY",
+      deviceUuid: e.deviceUuid,
       commandCode: "door_onoff",
       commandValue: 1,
     })

+ 0 - 24
src/pages/face/api.js

@@ -55,28 +55,4 @@ export function signOnOut(data) {
         method: 'POST',
         data
     })
-}
-
-/**
- * 门禁接口集合
- * @method doorControl 门禁开门
- * @method doorList 门禁列表
- */
-export function doorApi() {
-    return {
-        doorControl: (data) => {
-            return request({
-                url: `/service-iot/deviceHttp/control`,
-                method: 'GET',
-                data,
-            });
-        },
-        doorList: (data) => {
-            return request({
-                url: `/service-iot/dmpDeviceInfo/pageWhite`,
-                method: 'POST',
-                data,
-            });
-        },
-    };
 }

+ 8 - 7
src/pages/face/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <web-view v-show="!modal.show" ref="faceView" id="faceView" class="faceView" src="/static/face/index.html" bindmessage="receiveMessage" :webview-styles="webviewStyles" @message="onMessage">
+  <web-view v-show="!modal.show" ref="faceView" id="faceView" class="faceView" src="/static/face/meeting.html" bindmessage="receiveMessage" :webview-styles="webviewStyles" @message="onMessage">
   </web-view>
 
   <u-modal
@@ -80,7 +80,8 @@ import config from "@/config";
 import { onLoad, onShow, onReady, onHide, onLaunch, onUnload, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
 import { ref, reactive, computed, getCurrentInstance, toRefs, inject, nextTick, watch } from "vue";
 /*----------------------------------接口引入-----------------------------------*/
-import { meetingApi, faceApi, signOnOut, doorApi } from "./api.js";
+import { doorApi } from "@/api/business/door.js";
+import { meetingApi, faceApi, signOnOut } from "./api.js";
 /*----------------------------------组件引入-----------------------------------*/
 /*----------------------------------store引入-----------------------------------*/
 /*----------------------------------公共方法引入-----------------------------------*/
@@ -196,10 +197,10 @@ function getMeetingRoomList() {
 function getdoorList() {
   state.meetingDoorList = [];
   doorApi()
-    .doorList({
+    .Select({
       current: 1, //页数
       size: 2000, //条数
-      productCode: "502_KAT", //产品编码
+      productCode: "502_USKY", //产品编码
       deviceStatus: 2, //设备状态;1:在线,2:离线
       domain: state.form.domain, //域名
     })
@@ -207,7 +208,7 @@ function getdoorList() {
       if (requset.data.records.length > 0) {
         requset.data.records.forEach((e) => {
           state.meetingDoorList.push({
-            value: e.deviceId,
+            value: e.deviceUuid,
             name: e.deviceName,
           });
         });
@@ -405,11 +406,11 @@ function meetingVerify(event) {
  */
 function openDoor(item) {
   doorApi()
-    .doorControl({
+    .control({
       domain: state.form.domain,
       userId: item.data.userId || undefined,
       userName: item.data.faceName || undefined,
-      productCode: "502_KAT",
+      productCode: "502_USKY",
       deviceId: state.form.doorId,
       commandCode: "door_onoff",
       commandValue: 1,

+ 12 - 20
src/pages/login.vue

@@ -1,5 +1,5 @@
 <template>
-  <view id="login-container" class="login-container" v-if="xcxData==null">
+  <view id="login-container" class="login-container" v-if="xcxData == null">
     <image class="bgImage" :src="useStore.loginBg" v-if="useStore.loginBg" />
 
     <view class="middle">
@@ -102,7 +102,6 @@ import { reactive, getCurrentInstance, toRefs, inject, nextTick } from "vue";
 /*----------------------------------store引入-----------------------------------*/
 import { useStores, commonStores, xunJianStores } from "@/store/modules/index";
 /*----------------------------------公共方法引入-----------------------------------*/
-import { decrypt } from "@/utils/jsencrypt";
 import config from "@/config";
 import { storageSystem } from "@/utils/storage";
 /*----------------------------------公共变量-----------------------------------*/
@@ -124,10 +123,10 @@ const state = reactive({
   /** 用户隐私协议数据 */
   uChecked: false,
   modalShow: false,
-  xcxData:null
+  xcxData: null,
 });
 
-const { phone, verify, switchText, username, password, isPassword, linkUrl, uChecked, modalShow,xcxData } = toRefs(state);
+const { phone, verify, switchText, username, password, isPassword, linkUrl, uChecked, modalShow, xcxData } = toRefs(state);
 
 /**
  * @跳转服务器配置
@@ -302,22 +301,15 @@ onShow(() => {
 
 onLoad((options) => {
   // console.log(linkUrl.value)
-  console.log('options')
-  console.log(options)
-
-  if(options.dataToken){
-      localStorage.setItem("App-Token", options.dataToken)
-      localStorage.setItem("type", 'innerH5')
-      useStore.GetInfo()
-      proxy.$tab.reLaunch("/pages/index");
-
-      // window.location.href = `${linkUrl.value}pages/index`;
-    }
-
-  // if(options.xcx){
-  //   state.xcxData=decrypt(decodeURIComponent(options.xcx))
-  //   login(state.xcxData)
-  // }
+  console.log("options");
+  console.log(options);
+
+  if (options.dataToken) {
+    localStorage.setItem("App-Token", options.dataToken);
+    localStorage.setItem("type", "innerH5");
+    useStore.GetInfo();
+    proxy.$tab.reLaunch("/pages/index");
+  }
 });
 </script>
 

+ 2 - 1
src/pages/mine.vue

@@ -52,7 +52,7 @@
                 <view>新消息通知</view>
               </view>
             </view>
-            <view class="list-cell list-cell-arrow" @click="proxy.$settingStore.handleAbout()">
+            <view class="list-cell list-cell-arrow" @click="proxy.$settingStore.handleAbout()" v-if="config.appInfo.appid != '__UNI__BF1A1F0'">
               <view class="menu-item">
                 <view class="iconfont oaIcon-aixin menu-item-icon"></view>
                 <view>关于我们</view>
@@ -202,6 +202,7 @@ const state = reactive({
   nickName: useStore.nickName,
   phone: useStore.phonenumber,
   version: config.appInfo.version,
+  appid: config.appInfo.appid,
 
   colorModal: false,
   themeList: proxy.$constData.themeList,

+ 0 - 4
src/plugins/keyListen.plugins.js

@@ -19,10 +19,6 @@ export default {
                 // main.stopLockTask()//按返回键恢复
                 // main.startLockTask()//阻止系统home建和近期任务键
                 // main.unregisterReceiver(receiver); //同时停止接收home和recent点击
-                const pages = getCurrentPages(); // 获取当前页面栈
-                const currentPage = pages[pages.length - 1]; // 最后一个元素即为当前页面
-                xunJianStores().modal.show = currentPage.route === 'pages/login' ? true : false
-                console.log('监听返回')
                 e.preventDefault();
             });
         } else {

+ 0 - 0
src/static/face/index.html → src/static/face/meeting.html


+ 3 - 0
src/store/modules/setting.js

@@ -308,6 +308,9 @@ const settingStores = defineStore("storage-setting", {
             // 智能会议
             else if (config.appInfo.appid === "__UNI__F3963F8") {
             }
+            // 智能门禁
+            else if (config.appInfo.appid === "__UNI__8D6E9FD") {
+            }
 
             modal.loading("加载中");
             checkUpdates(data).then((res) => {

+ 57 - 0
unpackage/config/setting.js

@@ -9,6 +9,9 @@ filesToModify.forEach((file) => {
         let state = JSON.parse(cleanedData);// 解析JSON数据
 
         if (file == './src/manifest.json') {
+            var maps = state["app-plus"].distribute.sdkConfigs.maps
+            var geolocation = state["app-plus"].distribute.sdkConfigs.geolocation
+
             if (args === 'zhiHuiYun') {
                 state.name = '综合智慧云'
                 state.appid = '__UNI__36DE3A0'
@@ -16,6 +19,16 @@ filesToModify.forEach((file) => {
                 state.versionName = "2.2.4"
                 state.versionCode = 24
                 state.h5.title = '综合智慧云'
+
+                maps.amap.name = "amapBOujshtbA"
+                maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
+                maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
+
+                geolocation.amap.name = "amapBOujshtbA"
+                geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
+                geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
+                geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
+                geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
             } else if (args === 'xunJian') {
                 state.name = '智能巡更'
                 state.appid = '__UNI__BF1A1F0'
@@ -23,6 +36,16 @@ filesToModify.forEach((file) => {
                 state.versionName = "2.2.0"
                 state.versionCode = 20
                 state.h5.title = '智能巡更'
+
+                maps.amap.name = "amap_15575941817CWPEQVCyc"
+                maps.amap.appkey_ios = "4da4abbd317d0b083d6c25dd9b509eed"
+                maps.amap.appkey_android = "63bef5d715bfa5433189e7b65516dfa5"
+
+                geolocation.amap.name = "amap_15575941817CWPEQVCyc"
+                geolocation.amap.appkey_ios = "4da4abbd317d0b083d6c25dd9b509eed"
+                geolocation.amap.appkey_android = "63bef5d715bfa5433189e7b65516dfa5"
+                geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
+                geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
             } else if (args === 'huiYi') {
                 state.name = '智能会议'
                 state.appid = '__UNI__F3963F8'
@@ -30,6 +53,33 @@ filesToModify.forEach((file) => {
                 state.versionName = "2.0.5"
                 state.versionCode = 1
                 state.h5.title = '智能会议'
+
+                maps.amap.name = "amapBOujshtbA"
+                maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
+                maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
+
+                geolocation.amap.name = "amapBOujshtbA"
+                geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
+                geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
+                geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
+                geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
+            } else if (args === 'menJin') {
+                state.name = '智能门禁'
+                state.appid = '__UNI__8D6E9FD'
+                state.description = '智能门禁APP,是一款集成了现代信息技术和智能化管理功能的移动应用程序。'
+                state.versionName = "1.0.0"
+                state.versionCode = 1
+                state.h5.title = '智能门禁'
+
+                maps.amap.name = "amapBOujshtbA"
+                maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
+                maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
+
+                geolocation.amap.name = "amapBOujshtbA"
+                geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
+                geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
+                geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
+                geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
             }
         } else if ('./src/pages.json') {
             state.pages.forEach((e, index) => {
@@ -54,6 +104,13 @@ filesToModify.forEach((file) => {
                         }
                     }
                     state.condition.list[0].path = "pages/face/index"
+                } else if (args === 'menJin') {
+                    if (e.style.navigationBarTitleText === "门禁识别") {
+                        if (index != 0) {
+                            state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
+                        }
+                    }
+                    state.condition.list[0].path = "pages/door/index"
                 }
             })
         }