|
|
@@ -53,206 +53,6 @@ const controlStore = defineStore("control", {
|
|
|
},
|
|
|
}),
|
|
|
actions: {
|
|
|
- /**
|
|
|
- * @初始化缓存数据
|
|
|
- */
|
|
|
- initData() {
|
|
|
- var that = this
|
|
|
- var storage = uni.getStorageSync("storage_face");
|
|
|
- if (storage) {
|
|
|
- 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.doorList = {
|
|
|
- id: storage.doorList.id || undefined,
|
|
|
- name: storage.doorList.name || undefined,
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- /**
|
|
|
- * @初始化摄像头
|
|
|
- */
|
|
|
- initCamera() {
|
|
|
- var that = this
|
|
|
- //#ifdef APP-PLUS
|
|
|
- permission.getPermisson("camera").then((res) => {
|
|
|
- res ? that.handleChildren({ funcName: "开启摄像头", data: {} }) : "";
|
|
|
- });
|
|
|
- //#endif
|
|
|
- },
|
|
|
- /**
|
|
|
- * @初始化NFC
|
|
|
- */
|
|
|
- initNfc() {
|
|
|
- var that = this
|
|
|
- //#ifdef APP-PLUS
|
|
|
- nfc.initNFC();
|
|
|
- nfc.readNFC().then((e) => {
|
|
|
- that.openDoor();
|
|
|
- that.initNfc();
|
|
|
- });
|
|
|
- //#endif
|
|
|
- },
|
|
|
- /**
|
|
|
- * @初始化事件
|
|
|
- */
|
|
|
- initHandle() {
|
|
|
- this.handleChildren({ funcName: "初始化事件", data: {} })
|
|
|
- },
|
|
|
- /**
|
|
|
- * @弹窗确定按钮事件
|
|
|
- */
|
|
|
- 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;
|
|
|
- }
|
|
|
-
|
|
|
- if (!this.form.meetingName && this.pageFunction.includes('会议')) {
|
|
|
- modal.msg("请选择绑定会议室");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (!this.form.doorList.name && this.pageFunction.includes('门禁')) {
|
|
|
- modal.msg("请选择绑定门禁");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- uni.setStorageSync("storage_face", this.form);
|
|
|
- this.modalClose();
|
|
|
- },
|
|
|
- /**
|
|
|
- * @弹窗退出按钮事件
|
|
|
- */
|
|
|
- modalCancel() {
|
|
|
- this.modal.show = false;
|
|
|
- //#ifdef APP-PLUS
|
|
|
- keyListen.quitApp();
|
|
|
- //#endif
|
|
|
- },
|
|
|
- /**
|
|
|
- * @弹窗关闭事件
|
|
|
- */
|
|
|
- modalClose() {
|
|
|
- this.handleChildren({ funcName: "开启摄像头", data: {} });
|
|
|
- this.modal.show = false;
|
|
|
- },
|
|
|
- /**
|
|
|
- * @section回调事件
|
|
|
- */
|
|
|
- sectionChange(e) {
|
|
|
- if (e == 1) {
|
|
|
- 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;
|
|
|
- }
|
|
|
-
|
|
|
- var domain = "";
|
|
|
- if (this.form.linkUrl) {
|
|
|
- domain = this.form.linkUrl;
|
|
|
- if (this.form.port) {
|
|
|
- domain += ":" + this.form.port;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.form.domain = domain;
|
|
|
- config.baseUrl = "http://" + this.form.domain + "/prod-api";
|
|
|
- if (this.pageFunction.includes('会议')) {
|
|
|
- this.getMeetingRoomList();
|
|
|
- }
|
|
|
- if (this.pageFunction.includes('门禁')) {
|
|
|
- this.getdoorList();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.subsection.value = e;
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * @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;
|
|
|
- }
|
|
|
- this.picker.show = true;
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * @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.doorList.id = e.value[0].value;
|
|
|
- this.form.doorList.name = e.value[0].name;
|
|
|
- }
|
|
|
- this.picker.show = false;
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * @会议室下拉列表
|
|
|
- */
|
|
|
- getMeetingRoomList() {
|
|
|
- var that = this
|
|
|
- that.meetingRoomList = [];
|
|
|
- meetingApi()
|
|
|
- .GetMeetingRoomList({
|
|
|
- domain: that.form.domain,
|
|
|
- })
|
|
|
- .then((requset) => {
|
|
|
- if (requset.data.length > 0) {
|
|
|
- requset.data.forEach((e) => {
|
|
|
- that.meetingRoomList.push({
|
|
|
- value: e.roomId,
|
|
|
- name: e.roomName,
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- /**
|
|
|
- * @门禁下拉列表
|
|
|
- */
|
|
|
- getdoorList() {
|
|
|
- doorApi()
|
|
|
- .Select({
|
|
|
- current: 1, //页数
|
|
|
- size: 2000, //条数
|
|
|
- domain: this.form.domain, //域名
|
|
|
- })
|
|
|
- .then((requset) => {
|
|
|
- if (requset.data.records.length > 0) {
|
|
|
- requset.data.records.forEach((e) => {
|
|
|
- this.doooList.push({
|
|
|
- value: e.deviceUuid,
|
|
|
- name: e.deviceName,
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
/**
|
|
|
* @门禁开门
|
|
|
*/
|
|
|
@@ -313,71 +113,6 @@ const controlStore = defineStore("control", {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
- /**
|
|
|
- * @人脸验证
|
|
|
- */
|
|
|
- faceVerify(imageBase) {
|
|
|
- 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, true);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- 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, true);
|
|
|
- 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) => { });
|
|
|
- },
|
|
|
/**
|
|
|
* @解析父页面传回的数据
|
|
|
*/
|