|
|
@@ -1,7 +1,7 @@
|
|
|
import { defineStore } from "pinia";
|
|
|
import { doorApi } from "@/api/business/door.js";
|
|
|
import { faceApi } from "@/api/business/face.js";
|
|
|
-import { meetingApi, signOnOut } from "@/api/business/meeting.js";
|
|
|
+import { deviceApi, meetingApi, signOnOut, escalation } from "@/api/business/meeting.js";
|
|
|
import { getToken, setToken, removeToken } from "@/utils/auth";
|
|
|
import dayjs from 'dayjs'
|
|
|
import config from "@/config";
|
|
|
@@ -10,11 +10,14 @@ import nfc from "@/plugins/nfc.plugins.js";
|
|
|
import modal from "@/plugins/modal.plugins.js";
|
|
|
import keyListen from "@/plugins/keyListen.plugins.js";
|
|
|
import permission from "@/plugins/permission.plugins.js";
|
|
|
+import common from "@/plugins/common.plugins.js";
|
|
|
import time from "@/plugins/time.plugins.js";
|
|
|
import sysPlugins from "@/plugins/device/sys.plugins";
|
|
|
+import yxPlugins from "@/plugins/device/yx.plugins";
|
|
|
|
|
|
const controlStore = defineStore("control", {
|
|
|
state: () => ({
|
|
|
+ ipAddress: "",//设备IP地址
|
|
|
pageFunction: [], //被包含的功能
|
|
|
isClicked: false, //按钮是否被点击
|
|
|
isDataChange: false,//数据是否改变
|
|
|
@@ -33,32 +36,25 @@ const controlStore = defineStore("control", {
|
|
|
modal: {
|
|
|
show: false,
|
|
|
},
|
|
|
- picker: {
|
|
|
- show: false,
|
|
|
- title: "",
|
|
|
- list: [[]],
|
|
|
- defaultIndex: 0,
|
|
|
- },
|
|
|
- subsection: {
|
|
|
- list: ["服务器配置", "其它配置", "系统设置"],
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- doooList: [],
|
|
|
- meetingDoorList: [],
|
|
|
- meetingRoomList: [],
|
|
|
+ doorList: [],
|
|
|
+ meetingDoorList: [],//会议门禁列表数据
|
|
|
+ meetingRoomList: [],//会议室列表数据
|
|
|
meetingTimeList: [],
|
|
|
+ meetingTemplateSrc: "", // 会议模板src
|
|
|
+ meetingTemplateList: {},//会议模板数据
|
|
|
meetingReservaList: {
|
|
|
dataAll: {},
|
|
|
- thisVenueData: [],
|
|
|
+ thisVenueData: {},
|
|
|
thisVenueTime: {},
|
|
|
- nextSceneData: [],
|
|
|
+ nextSceneData: {},
|
|
|
nextSceneTime: {},
|
|
|
timeList: [],
|
|
|
},
|
|
|
-
|
|
|
inter: {
|
|
|
doorDom: null,
|
|
|
meeting: null,
|
|
|
+ meetingEscalation: null,
|
|
|
+ rebootNow: null
|
|
|
},
|
|
|
}),
|
|
|
actions: {
|
|
|
@@ -68,13 +64,19 @@ const controlStore = defineStore("control", {
|
|
|
initData() {
|
|
|
var that = this
|
|
|
var storage = uni.getStorageSync("storage_face");
|
|
|
- if (storage) {
|
|
|
+ if (!storage) return;
|
|
|
+
|
|
|
+ // 智能会议
|
|
|
+ if (config.appInfo.appid === "__UNI__F3963F8") {
|
|
|
+ that.form.meetingId = storage.meetingId || undefined;
|
|
|
+ that.form.meetingName = storage.meetingName || undefined;
|
|
|
+ }
|
|
|
+ // 智能门禁
|
|
|
+ else if (config.appInfo.appid === "__UNI__8D6E9FD") {
|
|
|
config.baseUrl = "http://" + storage.domain + "/prod-api";
|
|
|
that.form.domain = storage.domain;
|
|
|
that.form.linkUrl = storage.linkUrl.indexOf(":") != -1 ? storage.linkUrl.split(":")[0] : storage.linkUrl;
|
|
|
that.form.port = storage.port ? storage.port : "";
|
|
|
- that.form.meetingId = storage.meetingId || undefined;
|
|
|
- that.form.meetingName = storage.meetingName || undefined;
|
|
|
that.form.door = {
|
|
|
id: storage.door.id || undefined,
|
|
|
name: storage.door.name || undefined,
|
|
|
@@ -87,9 +89,11 @@ const controlStore = defineStore("control", {
|
|
|
initCamera() {
|
|
|
var that = this
|
|
|
//#ifdef APP-PLUS
|
|
|
- permission.getPermisson("camera").then((res) => {
|
|
|
- res ? that.handleChildren({ funcName: "开启摄像头", data: {} }) : "";
|
|
|
- });
|
|
|
+ setTimeout(() => {
|
|
|
+ permission.getPermisson("camera").then((res) => {
|
|
|
+ res ? that.handleChildren({ funcName: "开启摄像头", data: {} }) : "";
|
|
|
+ });
|
|
|
+ }, 1000);
|
|
|
//#endif
|
|
|
},
|
|
|
/**
|
|
|
@@ -132,17 +136,38 @@ const controlStore = defineStore("control", {
|
|
|
* @开启定时任务
|
|
|
*/
|
|
|
openInterval(type) {
|
|
|
- if (type == "door") {
|
|
|
+ var _this = this
|
|
|
+ //IP地址
|
|
|
+ if (type == "ipAddress") {
|
|
|
+ setInterval(() => {
|
|
|
+ sysPlugins.getIpAddress({
|
|
|
+ success: (res) => {
|
|
|
+ _this.ipAddress = res;
|
|
|
+ },
|
|
|
+ error: (res) => {
|
|
|
+ _this.ipAddress = "";
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ //门禁
|
|
|
+ else if (type == "door") {
|
|
|
if (this.inter.doorDom) return;
|
|
|
this.getDoorList("updateData");
|
|
|
this.inter.doorDom = setInterval(() => {
|
|
|
this.getDoorList("updateData");
|
|
|
}, 1000 * 3);
|
|
|
- } else if (type == "meeting") {
|
|
|
- if (this.inter.meeting) return;
|
|
|
- getMeetingRoomReservationList();
|
|
|
+ }
|
|
|
+ // 会议
|
|
|
+ else if (type == "meeting") {
|
|
|
+ this.initEscalation();//调用初始化会议心跳方法
|
|
|
+ this.inter.meetingEscalation = setInterval(() => {
|
|
|
+ this.initEscalation();//调用初始化会议心跳方法
|
|
|
+ }, 1000 * 10)
|
|
|
+
|
|
|
+ this.getMeetingDeviceList()
|
|
|
this.inter.meeting = setInterval(() => {
|
|
|
- getMeetingRoomReservationList();
|
|
|
+ this.getMeetingDeviceList()
|
|
|
}, 1000 * 3);
|
|
|
}
|
|
|
},
|
|
|
@@ -159,148 +184,295 @@ const controlStore = defineStore("control", {
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
- * @弹窗确定按钮事件
|
|
|
+ * @弹窗事件
|
|
|
+ * @Confirm 确定
|
|
|
+ * @Cancel 退出应用
|
|
|
+ * @Close 关闭
|
|
|
*/
|
|
|
- modalConfirm(rules) {
|
|
|
- if (!this.form.linkUrl) {
|
|
|
- modal.msg("请输入链接地址");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (!/^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}(?:\.[a-zA-Z0-9]{2,})+$/.test(this.form.linkUrl)) {
|
|
|
- modal.msg("请输入正确的链接地址");
|
|
|
- return;
|
|
|
- }
|
|
|
+ handleModal(type) {
|
|
|
+ if (type == "Confirm") {
|
|
|
+ uni.setStorageSync("storage_face", this.form);
|
|
|
+ } else if (type == 'Cancel') {
|
|
|
+ //#ifdef APP-PLUS
|
|
|
+ keyListen.quitApp();
|
|
|
+ //#endif
|
|
|
+ } else if (type == "Close") {
|
|
|
|
|
|
- if (!this.form.meetingName && this.pageFunction.includes('会议')) {
|
|
|
- modal.msg("请选择绑定会议室");
|
|
|
- return;
|
|
|
}
|
|
|
|
|
|
- if (!this.form.door.name && this.pageFunction.includes('门禁')) {
|
|
|
- modal.msg("请选择绑定门禁");
|
|
|
- return;
|
|
|
- }
|
|
|
+ this.handleChildren({ funcName: "开启摄像头", data: {} });
|
|
|
+ this.modal.show = false;
|
|
|
|
|
|
- uni.setStorageSync("storage_face", this.form);
|
|
|
- this.modalClose();
|
|
|
},
|
|
|
/**
|
|
|
- * @应用退出按钮事件
|
|
|
+ * @Select下拉框回调事件
|
|
|
*/
|
|
|
- modalCancel() {
|
|
|
- this.modal.show = false;
|
|
|
- //#ifdef APP-PLUS
|
|
|
- keyListen.quitApp();
|
|
|
- //#endif
|
|
|
+ handleSelectChange(e) {
|
|
|
+ if (e.type === "绑定门禁") {
|
|
|
+ const match = this.doorList.find(item => item.value === e.value);
|
|
|
+ if (match) {
|
|
|
+ this.form.door.id = match.value;
|
|
|
+ this.form.door.name = match.name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.isDataChange = true;
|
|
|
},
|
|
|
/**
|
|
|
- * @弹窗关闭事件
|
|
|
+ * @初始化设备心跳数据
|
|
|
*/
|
|
|
- modalClose() {
|
|
|
- this.handleChildren({ funcName: "开启摄像头", data: {} });
|
|
|
- this.modal.show = false;
|
|
|
+ initEscalation() {
|
|
|
+ if (!sysPlugins.getDeviceInfo().serial) return;
|
|
|
+ sysPlugins.getIpAddress({
|
|
|
+ success: (res) => {
|
|
|
+ var param = {
|
|
|
+ "deviceCode": sysPlugins.getDeviceInfo().serial,
|
|
|
+ "ipAddr": res,
|
|
|
+ "deviceType": 1,//设备类型(1.会议屏 2.信息发布屏 3.综合屏)
|
|
|
+ "model": sysPlugins.getDeviceInfo().model,
|
|
|
+ "manuFacturer": sysPlugins.getDeviceInfo().manufacturer,
|
|
|
+ "version": sysPlugins.getDeviceInfo().version,
|
|
|
+ "sdk": sysPlugins.getDeviceInfo().Sdk
|
|
|
+ }
|
|
|
+
|
|
|
+ escalation(param)
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
/**
|
|
|
- * @section回调事件
|
|
|
+ * @获取会议设备列表
|
|
|
*/
|
|
|
- sectionChange(e) {
|
|
|
- if (e == 1) {
|
|
|
- if (!this.form.linkUrl) {
|
|
|
- modal.msg("请输入链接地址");
|
|
|
- return;
|
|
|
- }
|
|
|
+ getMeetingDeviceList() {
|
|
|
+ this.meetingTimeList = [];
|
|
|
+ this.meetingReservaList.thisVenueData = [];
|
|
|
+ this.meetingReservaList.thisVenueTime = {};
|
|
|
+ this.meetingReservaList.nextSceneData = [];
|
|
|
+ this.meetingReservaList.nextSceneTime = {};
|
|
|
|
|
|
- if (!/^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}(?:\.[a-zA-Z0-9]{2,})+$/.test(this.form.linkUrl)) {
|
|
|
- modal.msg("请输入正确的链接地址");
|
|
|
- return;
|
|
|
- }
|
|
|
+ // 生成 00:00-23:30 的半小时刻度
|
|
|
+ this.meetingTimeList = Array.from({ length: 48 }, (_, idx) => {
|
|
|
+ const hour = Math.floor(idx / 2);
|
|
|
+ const minute = idx % 2 ? "30" : "00";
|
|
|
+ const time = `${String(hour).padStart(2, "0")}:${minute}`;
|
|
|
|
|
|
- var domain = "";
|
|
|
- if (this.form.linkUrl) {
|
|
|
- domain = this.form.linkUrl;
|
|
|
- if (this.form.port) {
|
|
|
- domain += ":" + this.form.port;
|
|
|
- }
|
|
|
- }
|
|
|
+ return {
|
|
|
+ startTime: time,
|
|
|
+ endTime: time,
|
|
|
+ isEnd: 0,
|
|
|
+ isHave: 0,
|
|
|
+ isReservation: 0,
|
|
|
+ };
|
|
|
+ });
|
|
|
|
|
|
- this.form.domain = domain;
|
|
|
- config.baseUrl = "http://" + this.form.domain + "/prod-api";
|
|
|
- if (this.pageFunction.includes('会议')) {
|
|
|
- this.getMeetingRoomList();
|
|
|
- }
|
|
|
- if (this.pageFunction.includes('门禁')) {
|
|
|
- this.getDoorList();
|
|
|
- }
|
|
|
- }
|
|
|
+ deviceApi()
|
|
|
+ .Select({
|
|
|
+ deviceCode: sysPlugins.getDeviceInfo().serial || "NTECVSG3PL",
|
|
|
+ current: 1,
|
|
|
+ size: 10
|
|
|
+ })
|
|
|
+ .then((requset) => {
|
|
|
+ if (requset.data.records.length > 0) {
|
|
|
+ this.form.meetingId = requset.data.records[0].meetingRoom.roomId
|
|
|
+ this.form.meetingName = requset.data.records[0].meetingRoom.roomName
|
|
|
+ this.meetingTemplateList = requset.data.records[0].meetingTemplate
|
|
|
+
|
|
|
+ if (this.meetingTemplateList && this.meetingTemplateList?.type == 1) {
|
|
|
+ this.meetingTemplateSrc = `/static/face/${this.meetingTemplateList.s1Con}`
|
|
|
+ } else {
|
|
|
+ this.meetingTemplateSrc = "/static/face/meeting_template_preview.html"
|
|
|
+ this.handleChildren({
|
|
|
+ funcName: "初始化模板",
|
|
|
+ data: JSON.stringify(this.meetingTemplateList || {}),
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- this.subsection.value = e;
|
|
|
+ this.getMeetingRoomReservationList();
|
|
|
+ } else {
|
|
|
+ this.form.meetingId = undefined
|
|
|
+ this.form.meetingName = undefined
|
|
|
+ this.meetingReservaList.timeList = this.meetingTimeList;
|
|
|
+ this.handleChildren({
|
|
|
+ funcName: "初始化数据",
|
|
|
+ data: JSON.stringify(this.meetingReservaList),
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+
|
|
|
+ });
|
|
|
},
|
|
|
+ /**
|
|
|
+ * @会议室详情列表
|
|
|
+ */
|
|
|
+ getMeetingRoomReservationList() {
|
|
|
+ var _this = this
|
|
|
+
|
|
|
+ meetingApi()
|
|
|
+ .GetMeetingRoomReservationList({
|
|
|
+ deviceCode: sysPlugins.getDeviceInfo().serial || "NTECVSG3PL",
|
|
|
+ meetingRoomId: this.form.meetingId,
|
|
|
+ date: dayjs().format("YYYY-MM-DD") + " 00:00:00",
|
|
|
+ })
|
|
|
+ .then((requset) => {
|
|
|
+ if (requset.data.length > 0) {
|
|
|
+ _this.meetingReservaList.dataAll = requset.data[0];
|
|
|
+ _this.meetingReservaList.dataAll.dmMeetingList.forEach((e, index) => {
|
|
|
+ //判断开始时间和结束时间是否包含当前时间
|
|
|
+ if (dayjs().isBetween(e.startDate, e.endDate, null, "[]")) {
|
|
|
+ _this.meetingReservaList.thisVenueData = e;
|
|
|
+ _this.meetingReservaList.thisVenueTime = time.timeRestructuring(_this.meetingReservaList.dataAll.meetingRoomUsage[index]);
|
|
|
+ }
|
|
|
+ //判断当前时间是否相同或在其之前
|
|
|
+ if (dayjs().isSameOrBefore(e.startDate) && _this.meetingReservaList.nextSceneData.length < 1) {
|
|
|
+ _this.meetingReservaList.nextSceneData = e;
|
|
|
+ _this.meetingReservaList.nextSceneTime = time.timeRestructuring(_this.meetingReservaList.dataAll.meetingRoomUsage[index]);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
+ _this.meetingReservaList.timeList = _this.showTimeSegments(_this.meetingTimeList);
|
|
|
+ _this.handleChildren({
|
|
|
+ funcName: "初始化数据",
|
|
|
+ data: JSON.stringify(_this.meetingReservaList),
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ _this.meetingReservaList.timeList = _this.meetingTimeList;
|
|
|
+ _this.handleChildren({
|
|
|
+ funcName: "初始化数据",
|
|
|
+ data: JSON.stringify(_this.meetingReservaList),
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => { });
|
|
|
+ },
|
|
|
/**
|
|
|
- * @action弹出框点击事件
|
|
|
+ * @显示时间段的函数
|
|
|
*/
|
|
|
- handlePicker(value, index, ind) {
|
|
|
- if (value == "绑定会议室") {
|
|
|
- this.picker.title = "绑定会议室";
|
|
|
- this.picker.list = [this.meetingRoomList];
|
|
|
- this.picker.defaultIndex = 0;
|
|
|
- } else if (value == "绑定门禁") {
|
|
|
- this.picker.title = "绑定门禁";
|
|
|
- this.picker.list = [this.doooList];
|
|
|
- this.picker.defaultIndex = 0;
|
|
|
+ showTimeSegments(times) {
|
|
|
+ const timesXleList = JSON.parse(JSON.stringify(times));
|
|
|
+
|
|
|
+ for (var i = 0; i < timesXleList.length; i++) {
|
|
|
+ const timeValue = new Date(`${dayjs().format("YYYY-MM-DD")}T${timesXleList[i].startTime}`);
|
|
|
+
|
|
|
+ this.meetingReservaList.dataAll.meetingRoomUsage.forEach((item) => {
|
|
|
+ const timeList = time.timeRestructuring(item);
|
|
|
+ const startValue = new Date(`${dayjs().format("YYYY-MM-DD")}T${timeList.startTime}`);
|
|
|
+ const endValue = new Date(`${dayjs().format("YYYY-MM-DD")}T${timeList.endTime}`);
|
|
|
+
|
|
|
+ if (timeValue.getTime() >= startValue.getTime() && timeValue.getTime() < endValue.getTime()) {
|
|
|
+ timesXleList.splice(i--, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- this.picker.show = true;
|
|
|
- },
|
|
|
|
|
|
+ this.meetingReservaList.dataAll.meetingRoomUsage.forEach((item) => {
|
|
|
+ const timeList = time.timeRestructuring(item);
|
|
|
+ const startValue = new Date(`${dayjs().format("YYYY-MM-DD")}T${timeList.startTime}`);
|
|
|
+ const endValue = new Date(`${dayjs().format("YYYY-MM-DD")}T${timeList.endTime}`);
|
|
|
+
|
|
|
+ if (dayjs().isBetween(startValue, endValue, null, "[]")) {
|
|
|
+ timesXleList.push({
|
|
|
+ ...timeList,
|
|
|
+ isEnd: 0,
|
|
|
+ isHave: 1,
|
|
|
+ isReservation: 0,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if (dayjs().isSameOrAfter(startValue)) {
|
|
|
+ timesXleList.push({
|
|
|
+ ...timeList,
|
|
|
+ isEnd: 1,
|
|
|
+ isHave: 0,
|
|
|
+ isReservation: 0,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (dayjs().isSameOrBefore(startValue)) {
|
|
|
+ timesXleList.push({
|
|
|
+ ...timeList,
|
|
|
+ isEnd: 0,
|
|
|
+ isHave: 0,
|
|
|
+ isReservation: 1,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ var newTimesXleList = common
|
|
|
+ .uniq(timesXleList, "startTime")
|
|
|
+ .sort((a, b) => new Date(`${dayjs().format("YYYY-MM-DD")}T${a.startTime}`) - new Date(`${dayjs().format("YYYY-MM-DD")}T${b.startTime}`));
|
|
|
+ return newTimesXleList;
|
|
|
+ },
|
|
|
/**
|
|
|
- * @action弹出框选择事件
|
|
|
+ * @人脸验证
|
|
|
*/
|
|
|
- pickerConfirm(e) {
|
|
|
- if (this.picker.title == "绑定会议室") {
|
|
|
- this.form.meetingId = e.value[0].value;
|
|
|
- this.form.meetingName = e.value[0].name;
|
|
|
- } else if (this.picker.title == "绑定门禁") {
|
|
|
- this.form.door.id = e.value[0].value;
|
|
|
- this.form.door.name = e.value[0].name;
|
|
|
- }
|
|
|
- this.picker.show = false;
|
|
|
- this.isDataChange = true
|
|
|
+ faceVerify(imageBase) {
|
|
|
+ var that = this
|
|
|
+ faceApi()
|
|
|
+ .faceVef({
|
|
|
+ deviceCode: sysPlugins.getDeviceInfo().serial,
|
|
|
+ imageBase: imageBase,
|
|
|
+ })
|
|
|
+ .then((item) => {
|
|
|
+ if (item.data.code === 200 || item.data.code === 201) {
|
|
|
+ item.data.userName = item.data.faceName;
|
|
|
+ if (that.pageFunction.includes('会议')) {
|
|
|
+ that.meetingVerify(item.data);
|
|
|
+ } else {
|
|
|
+ that.openDoor(item.data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item.data.msg != "人脸验证接口返回异常") {
|
|
|
+ modal.msg(item.data.msg);
|
|
|
+ }
|
|
|
+
|
|
|
+ that.handleChildren({ funcName: "人脸冷却", data: {} });
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ that.handleChildren({ funcName: "人脸冷却", data: {} });
|
|
|
+ });
|
|
|
},
|
|
|
/**
|
|
|
- * @会议室下拉列表
|
|
|
+ * @会议验证
|
|
|
*/
|
|
|
- getMeetingRoomList() {
|
|
|
+ meetingVerify(event) {
|
|
|
var that = this
|
|
|
- that.meetingRoomList = [];
|
|
|
+ if (that.meetingReservaList.thisVenueData.length <= 0) return;
|
|
|
+
|
|
|
meetingApi()
|
|
|
- .GetMeetingRoomList({
|
|
|
- domain: that.form.domain,
|
|
|
+ .Attendee({
|
|
|
+ deviceCode: sysPlugins.getDeviceInfo().serial,
|
|
|
+ meetingId: this.meetingReservaList.thisVenueData.meetingId,
|
|
|
+ userId: event.userId,
|
|
|
+ userName: event.userName,
|
|
|
})
|
|
|
- .then((requset) => {
|
|
|
- if (requset.data.length > 0) {
|
|
|
- requset.data.forEach((e) => {
|
|
|
- that.meetingRoomList.push({
|
|
|
- value: e.roomId,
|
|
|
- name: e.roomName,
|
|
|
- });
|
|
|
- });
|
|
|
+ .then((item) => {
|
|
|
+ if (item.data.status == "1") {
|
|
|
+ that.openDoor(event);
|
|
|
+ that.meetingSign(event);
|
|
|
}
|
|
|
+ modal.msg(item.data.msg);
|
|
|
});
|
|
|
},
|
|
|
+ /**
|
|
|
+ * @会议签到
|
|
|
+ */
|
|
|
+ meetingSign(event) {
|
|
|
+ signOnOut({
|
|
|
+ deviceCode: sysPlugins.getDeviceInfo().serial,
|
|
|
+ meetingId: this.meetingReservaList.thisVenueData.meetingId,
|
|
|
+ userId: event.userId, //参会人Id
|
|
|
+ mothodType: 0, //签到签退类别(0.签到 1.签退)
|
|
|
+ signType: 1, //签到签退方式(0.人工 1.人脸)
|
|
|
+ }).then((item) => { });
|
|
|
+ },
|
|
|
/**
|
|
|
* @门禁下拉列表
|
|
|
*/
|
|
|
getDoorList(type) {
|
|
|
- this.doooList = [];
|
|
|
+ this.doorList = [];
|
|
|
|
|
|
- if (!this.form.domain) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (!this.form.domain) return;
|
|
|
+ if (type == 'updateData' && !this.form.door.id) return;
|
|
|
|
|
|
- if (type == 'updateData' && !this.form.door.id) {
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
doorApi()
|
|
|
.Select({
|
|
|
@@ -310,9 +482,7 @@ const controlStore = defineStore("control", {
|
|
|
deviceUuid: type == 'updateData' ? this.form.door.id : undefined
|
|
|
})
|
|
|
.then((requset) => {
|
|
|
- if (requset.data.records.length <= 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (requset.data.records.length <= 0) return;
|
|
|
|
|
|
if (type == "updateData") {
|
|
|
let data = requset.data.records[0]
|
|
|
@@ -330,9 +500,10 @@ const controlStore = defineStore("control", {
|
|
|
uni.setStorageSync("storage_face", this.form);
|
|
|
} else {
|
|
|
requset.data.records.forEach((e) => {
|
|
|
- this.doooList.push({
|
|
|
+ this.doorList.push({
|
|
|
value: e.deviceUuid,
|
|
|
name: e.deviceName,
|
|
|
+ text: e.deviceName,
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
@@ -344,7 +515,7 @@ const controlStore = defineStore("control", {
|
|
|
openDoor(event) {
|
|
|
var that = this
|
|
|
|
|
|
- if (!this.form.door.name) {
|
|
|
+ if (!this.form.door.id) {
|
|
|
modal.msg("请先绑定门禁!");
|
|
|
return;
|
|
|
}
|
|
|
@@ -400,74 +571,6 @@ const controlStore = defineStore("control", {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
- /**
|
|
|
- * @人脸验证
|
|
|
- */
|
|
|
- faceVerify(imageBase) {
|
|
|
- if (!this.form.domain) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- var that = this
|
|
|
- faceApi()
|
|
|
- .faceVef({
|
|
|
- domain: that.form.domain,
|
|
|
- imageBase: imageBase,
|
|
|
- })
|
|
|
- .then((item) => {
|
|
|
- if (item.data.code === 200 || item.data.code === 201) {
|
|
|
- item.data.userName = item.data.faceName;
|
|
|
- if (that.pageFunction.includes('会议')) {
|
|
|
- that.meetingVerify(item.data);
|
|
|
- } else {
|
|
|
- that.openDoor(item.data);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (item.data.msg != "人脸验证接口返回异常") {
|
|
|
- modal.msg(item.data.msg);
|
|
|
- }
|
|
|
-
|
|
|
- that.handleChildren({ funcName: "人脸冷却", data: {} });
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- that.handleChildren({ funcName: "人脸冷却", data: {} });
|
|
|
- });
|
|
|
- },
|
|
|
- /**
|
|
|
- * @会议验证
|
|
|
- */
|
|
|
- meetingVerify(event) {
|
|
|
- var that = this
|
|
|
- if (that.meetingReservaList.thisVenueData.length > 0) {
|
|
|
- meetingApi()
|
|
|
- .Attendee({
|
|
|
- domain: this.form.domain,
|
|
|
- meetingId: this.meetingReservaList.thisVenueData[0].meetingId,
|
|
|
- userId: event.userId,
|
|
|
- userName: event.userName,
|
|
|
- })
|
|
|
- .then((item) => {
|
|
|
- if (item.data.status == "1") {
|
|
|
- that.openDoor(event);
|
|
|
- that.meetingSign(event);
|
|
|
- }
|
|
|
- modal.msg(item.data.msg);
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- /**
|
|
|
- * @会议签到
|
|
|
- */
|
|
|
- meetingSign(event) {
|
|
|
- signOnOut({
|
|
|
- domain: this.form.domain,
|
|
|
- meetingId: this.meetingReservaList.thisVenueData[0].meetingId,
|
|
|
- userId: event.userId, //参会人Id
|
|
|
- mothodType: 0, //签到签退类别(0.签到 1.签退)
|
|
|
- signType: 1, //签到签退方式(0.人工 1.人脸)
|
|
|
- }).then((item) => { });
|
|
|
- },
|
|
|
/**
|
|
|
* @解析父页面传回的数据
|
|
|
*/
|
|
|
@@ -478,7 +581,8 @@ const controlStore = defineStore("control", {
|
|
|
tab.navigateTo("/pages/door/setting/index")
|
|
|
} else if (event.funcName == "打开会议配置") {
|
|
|
this.handleChildren({ funcName: "关闭摄像头", data: {} });
|
|
|
- this.modal.show = true;
|
|
|
+ // 跳转到密码验证页面
|
|
|
+ tab.navigateTo("/pages/meeting/setting/password");
|
|
|
} else if (event.funcName == "人脸识别") {
|
|
|
this.faceVerify(event.data.imageBase);
|
|
|
} else if (event.funcName == "点击开门") {
|
|
|
@@ -497,15 +601,44 @@ const controlStore = defineStore("control", {
|
|
|
*/
|
|
|
handleChildren(data) {
|
|
|
// #ifdef APP-PLUS
|
|
|
- var pages = getCurrentPages();
|
|
|
- var currentWebview = pages[pages.length - 1].$getAppWebview();
|
|
|
- var wv = currentWebview.children()[0];
|
|
|
- wv.evalJS(`receiveData(${JSON.stringify(data)})`);
|
|
|
+ try {
|
|
|
+ var pages = getCurrentPages();
|
|
|
+ if (!pages || pages.length === 0) return;
|
|
|
+
|
|
|
+ var currentWebview = pages[pages.length - 1].$getAppWebview();
|
|
|
+ if (!currentWebview) return;
|
|
|
+
|
|
|
+ var children = currentWebview.children();
|
|
|
+ if (!children || children.length === 0) return;
|
|
|
+
|
|
|
+ var wv = children[0];
|
|
|
+ if (!wv || !wv.evalJS) return;
|
|
|
+
|
|
|
+ // 确保 receiveData 函数存在,如果不存在则先定义它
|
|
|
+ var jsCode = `
|
|
|
+ if (typeof receiveData === 'function') {
|
|
|
+ receiveData(${JSON.stringify(data)});
|
|
|
+ } else if (window.receiveData && typeof window.receiveData === 'function') {
|
|
|
+ window.receiveData(${JSON.stringify(data)});
|
|
|
+ } else {
|
|
|
+ console.warn('receiveData is not defined');
|
|
|
+ }
|
|
|
+ `;
|
|
|
+ wv.evalJS(jsCode);
|
|
|
+ } catch (error) {
|
|
|
+ console.warn('handleChildren error:', error);
|
|
|
+ }
|
|
|
// #endif
|
|
|
|
|
|
// #ifdef H5
|
|
|
- var iframe = document.getElementById("faceView");
|
|
|
- iframe.contentWindow.postMessage(data, "*");
|
|
|
+ try {
|
|
|
+ var iframe = document.getElementById("faceView");
|
|
|
+ if (iframe && iframe.contentWindow) {
|
|
|
+ iframe.contentWindow.postMessage(data, "*");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.warn('handleChildren H5 error:', error);
|
|
|
+ }
|
|
|
// #endif
|
|
|
},
|
|
|
/**
|
|
|
@@ -519,6 +652,42 @@ const controlStore = defineStore("control", {
|
|
|
return originalStr.replace(regex, '');
|
|
|
}
|
|
|
return originalStr;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @定时重启
|
|
|
+ */
|
|
|
+ timingRebootNow() {
|
|
|
+ var _this = this;
|
|
|
+
|
|
|
+ if (!_this.inter.rebootNow) {
|
|
|
+ checkMorningSix();
|
|
|
+ _this.inter.rebootNow = setInterval(() => {
|
|
|
+ checkMorningSix();
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断是否是早上6点钟
|
|
|
+ function checkMorningSix() {
|
|
|
+ const now = new Date();
|
|
|
+ // 设置时间为早上6点,忽略分钟和秒
|
|
|
+ const targetTime = new Date();
|
|
|
+ targetTime.setHours(6, 0, 0, 0);
|
|
|
+
|
|
|
+ // 比较当前时间是否等于早上6点
|
|
|
+ if (now.getTime() === targetTime.getTime()) {
|
|
|
+ yxPlugins.rebootNow();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @门禁开关
|
|
|
+ */
|
|
|
+ doorControl(value) {
|
|
|
+ if (value) {
|
|
|
+ sysPlugins.openDoor(2, 0);
|
|
|
+ } else {
|
|
|
+ sysPlugins.openDoor(3, 0);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
});
|