Browse Source

Merge branch 'fanghuisheng' of http://47.111.81.118:3000/uskycloud/usky-web-mobile into wangtao-dail# Please enter a commit message to explain why this merge is necessary,

wangtao 2 weeks ago
parent
commit
7145d80aa9
3 changed files with 62 additions and 37 deletions
  1. 3 1
      src/pages/business/ai/conv/index.vue
  2. 3 3
      src/pages/login.vue
  3. 56 33
      src/store/modules/control.js

+ 3 - 1
src/pages/business/ai/conv/index.vue

@@ -55,7 +55,6 @@
             <viwe v-if="item.role === 'user'" class="center-area-item__content">{{ item.content }}</viwe>
             <viwe v-else-if="item.role === 'assistant'" class="center-area-item__content">
               <viwe class="center-area-item__outputReasonContent">{{ item.reasoningContent }}</viwe>
-              <oa-chatSSEClient ref="chatSSEClientRef" @onOpen="openCore" @onError="errorCore" @onMessage="messageCore" @onFinish="finishCore" />
             </viwe>
           </viwe>
         </view>
@@ -91,6 +90,8 @@
       </view>
     </view>
   </uni-popup>
+
+  <oa-chatSSEClient ref="chatSSEClientRef" @onOpen="openCore" @onError="errorCore" @onMessage="messageCore" @onFinish="finishCore" />
 </template>
 
 <script setup>
@@ -241,6 +242,7 @@ async function onSubmit(event) {
 //数据处理
 function processSSEChunk(chunk) {
   state.scrollIntoView = "";
+
   try {
     const jsonData = JSON.parse(chunk);
 

+ 3 - 3
src/pages/login.vue

@@ -194,10 +194,10 @@ function init() {
     linkUrl.value = uni.getStorageSync("serveUrl");
     useStore.GetMobileTenantConfig({ url: linkUrl.value });
   } else {
-    if(config.appInfo.appid == '__UNI__BF1A1F0'){
+    if (config.appInfo.appid == "__UNI__BF1A1F0") {
       uni.setStorageSync("serveUrl", "120.26.164.249:13212");
       commonStore.setServeList("120.26.164.249:13212", "");
-    }else{
+    } else {
       uni.setStorageSync("serveUrl", "manager.usky.cn");
       commonStore.setServeList("manager.usky.cn", "");
     }
@@ -299,7 +299,7 @@ function handlePrivacy() {
 
 onShow(() => {
   // nextTick(() => {
-    init();
+  init();
   // });
 });
 

+ 56 - 33
src/store/modules/control.js

@@ -5,6 +5,7 @@ import { meetingApi, signOnOut } from "@/api/business/meeting.js";
 import { getToken, setToken, removeToken } from "@/utils/auth";
 import dayjs from 'dayjs'
 import config from "@/config";
+import tab from "@/plugins/tab.plugins";
 import nfc from "@/plugins/nfc.plugins.js";
 import modal from "@/plugins/modal.plugins.js";
 import keyListen from "@/plugins/keyListen.plugins.js";
@@ -18,11 +19,13 @@ const controlStore = defineStore("control", {
             linkUrl: "",
             port: "",
             domain: undefined,
-            doorId: undefined,
-            doorName: undefined,
+            doorList: {
+                id: undefined,
+                name: undefined,
+            },
         },
         modal: {
-            show: true,
+            show: false,
         },
         picker: {
             show: false,
@@ -31,7 +34,7 @@ const controlStore = defineStore("control", {
             defaultIndex: 0,
         },
         subsection: {
-            list: ["服务器配置", "其它配置"],
+            list: ["服务器配置", "其它配置", "系统设置"],
             value: 0,
         },
 
@@ -56,13 +59,16 @@ const controlStore = defineStore("control", {
             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.doorId = storage.doorId || undefined;
-                that.form.doorName = storage.doorName || undefined;
+                that.form.doorList = {
+                    id: storage.doorList.id || undefined,
+                    name: storage.doorList.name || undefined,
+                }
             }
         },
         /**
@@ -89,6 +95,12 @@ const controlStore = defineStore("control", {
             });
             //#endif
         },
+        /**
+         * @初始化事件
+         */
+        initHandle() {
+            this.handleChildren({ funcName: "初始化事件", data: {} })
+        },
         /**
          * @弹窗确定按钮事件
          */
@@ -108,7 +120,7 @@ const controlStore = defineStore("control", {
                 return;
             }
 
-            if (!this.form.doorName && this.pageFunction.includes('门禁')) {
+            if (!this.form.doorList.name && this.pageFunction.includes('门禁')) {
                 modal.msg("请选择绑定门禁");
                 return;
             }
@@ -136,32 +148,35 @@ const controlStore = defineStore("control", {
          * @section回调事件
          */
         sectionChange(e) {
-            if (!this.form.linkUrl) {
-                modal.msg("请输入链接地址");
-                return;
-            }
+            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;
-            }
+                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;
+                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.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;
         },
 
@@ -189,8 +204,8 @@ const controlStore = defineStore("control", {
                 this.form.meetingId = e.value[0].value;
                 this.form.meetingName = e.value[0].name;
             } else if (this.picker.title == "绑定门禁") {
-                this.form.doorId = e.value[0].value;
-                this.form.doorName = e.value[0].name;
+                this.form.doorList.id = e.value[0].value;
+                this.form.doorList.name = e.value[0].name;
             }
             this.picker.show = false;
         },
@@ -243,6 +258,11 @@ const controlStore = defineStore("control", {
         openDoor(event) {
             var that = this
 
+            if (!this.form.doorList.name) {
+                modal.msg("请先绑定门禁!");
+                return;
+            }
+
             if (this.isClicked) {
                 modal.msg("请勿重复点击!");
                 return;
@@ -256,7 +276,7 @@ const controlStore = defineStore("control", {
                     userId: !getToken() ? event.userId : undefined,
                     userName: !getToken() ? event.userName : undefined,
                     productCode: "502_USKY",
-                    deviceUuid: !getToken() ? this.form.doorId : event.deviceUuid,
+                    deviceUuid: !getToken() ? this.form.doorList.id : event.deviceUuid,
                     commandCode: "door_onoff",
                     commandValue: 1,
                 })
@@ -283,7 +303,7 @@ const controlStore = defineStore("control", {
                 .RecordInsert({
                     domain: !getToken() ? this.form.domain : undefined, //域名
                     userName: event.userName, //用户姓名
-                    deviceUuid: event.deviceUuid, //设备Uuid
+                    deviceUuid: !getToken() ? this.form.doorList.id : event.deviceUuid,//设备Uuid
                     passType: 3, //通行方式(1、人脸 2、刷卡 3、手机)
                     passTime: dayjs().format("YYYY-MM-DDTHH:mm:ss"), //通行时间
                     passResult: msg, //通行结果
@@ -367,7 +387,10 @@ const controlStore = defineStore("control", {
             if ("funcName" in event) {
                 if (event.funcName == "打开配置") {
                     this.handleChildren({ funcName: "关闭摄像头", data: {} });
-                    this.modal.show = true;
+
+
+                    tab.navigateTo("/pages/door/setting/index")
+                    // this.modal.show = true;
                 } else if (event.funcName == "人脸识别") {
                     this.faceVerify(event.data.imageBase);
                 } else if (event.funcName == "点击开门") {