From 7611c86d2b45b64112dd4a21cfc283543a46f29d Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期五, 01 十一月 2024 17:02:41 +0800
Subject: [PATCH] 测试完成

---
 src/views/repositoryai/templateku/configurat/measurement.vue |   40 +++++++++++++++++++++-------------------
 src/store/modules/user.js                                    |    7 +++++++
 src/components/Regular/index.vue                             |    7 +++++++
 src/store/getters.js                                         |    1 +
 4 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/src/components/Regular/index.vue b/src/components/Regular/index.vue
index c04cb3a..04dc972 100644
--- a/src/components/Regular/index.vue
+++ b/src/components/Regular/index.vue
@@ -46,6 +46,13 @@
               </el-input> </el-form-item
           ></el-col>
         </el-row>
+        <el-form-item label="缁撴潫瀵硅瘽">
+              <el-radio-group v-model="item.isEnd">
+                <el-radio :label="1">鏄�</el-radio>
+                <el-radio :label="0">鍚�</el-radio>
+              </el-radio-group>
+            </el-form-item>
+
         <el-row :gutter="10" v-if="intent">
           <el-col :span="12"
             ><el-form-item label="澶勭悊">
diff --git a/src/store/getters.js b/src/store/getters.js
index 161fbbf..d7540b0 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -8,6 +8,7 @@
   token: (state) => state.user.token,
   avatar: (state) => state.user.avatar,
   name: (state) => state.user.name,
+  Id: (state) => state.user.Id,
   introduction: (state) => state.user.introduction,
   roles: (state) => state.user.roles,
   permissions: (state) => state.user.permissions,
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index d5b94fa..932aa9d 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -5,6 +5,7 @@
   state: {
     token: getToken(),
     name: '',
+    Id: '',
     avatar: '',
     belongWards:[],
     belongDepts:[],
@@ -85,6 +86,9 @@
     SET_NAME: (state, name) => {
       state.name = name
     },
+    SET_Id: (state, Id) => {
+      state.Id = Id
+    },
     SET_AVATAR: (state, avatar) => {
       state.avatar = avatar
     },
@@ -127,6 +131,8 @@
     GetInfo({ commit, state }) {
       return new Promise((resolve, reject) => {
         getInfo().then(res => {
+          console.log(res.user,'user');
+
           const user = res.user
           const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
           if (res.roles && res.roles.length > 0) { // 楠岃瘉杩斿洖鐨剅oles鏄惁鏄竴涓潪绌烘暟缁�
@@ -136,6 +142,7 @@
             commit('SET_ROLES', ['ROLE_DEFAULT'])
           }
           commit('SET_NAME', user.userName)
+          commit('SET_Id', user.userId)
           commit('SET_leavehospitaldistrictcodes', user.belongWards)
           commit('SET_leaveldeptcodes', user.belongDepts)
           commit('SET_AVATAR', avatar)
diff --git a/src/views/repositoryai/templateku/configurat/measurement.vue b/src/views/repositoryai/templateku/configurat/measurement.vue
index 2c5031c..e9aca3d 100644
--- a/src/views/repositoryai/templateku/configurat/measurement.vue
+++ b/src/views/repositoryai/templateku/configurat/measurement.vue
@@ -100,6 +100,7 @@
   websocketSend,
   closeWebsocket,
 } from "@/websocket/websocket.js";
+import store from "@/store";
 export default {
   data() {
     return {
@@ -120,6 +121,7 @@
 
   created() {
     this.TemplateName = this.$route.query.name;
+    this.userid = store.getters.Id;
     this.requstWs(); //杩涘叆椤甸潰鍒涘缓杩炴帴
   },
   mounted() {
@@ -154,13 +156,13 @@
       console.log(this.id);
       const obj = {
         type: "text",
-        userId: "1",
+        userId: this.userid,
         templateId: this.id,
         content: null,
       };
       // 鍙戣捣ws璇锋眰
       sendWebsocket(
-        "ws://192.168.2.10:8095/chat?userId=1",
+        "ws://192.168.2.10:8095/chat?userId="+this.userId,
         obj,
         this.wsMessage,
         this.wsError
@@ -174,17 +176,17 @@
       dataJson = JSON.parse(dataJson);
       console.log(dataJson, "鏁版嵁");
       // 棣栨鎺ユ敹鏁版嵁
-      if (!this.Answerline[0]) {
-        this.Answerline.push({
-          value: dataJson.kcb,
-          isEat: 1,
-        });
-      }
+      // if (!this.Answerline[0]) {
+      //   this.Answerline.push({
+      //     value: dataJson.kcb,
+      //     isEat: 1,
+      //   });
+      // }
       timerId = setTimeout(() => {
         if (!this.answer) {
           this.sendFn(); // 鍚庤皟鐢�
         }
-    },this.timeout*1000);
+      }, this.timeout * 1000);
       // 浼樺厛鍔犲叆閫氱敤搴撳尮閰嶆枃鏈�
       if (dataJson.nowQuestion.submoduleText) {
         this.Answerline.push({
@@ -215,7 +217,6 @@
       });
       console.log(this.questionList);
 
-
       // IMUI.appendMessage(data);
     },
     //ws閿欒鍥炶皟
@@ -224,19 +225,19 @@
     },
 
     sendFn() {
-      console.log('鍙戦��');
+      console.log("鍙戦��");
 
       // 娑堟伅鍙戦��
       const obj = {
         type: "text",
-        userId: "1",
+        userId: this.userId,
         templateId: "",
         questionMessage: { content: this.answer },
       };
       console.log(obj, "鍏ュ弬");
       // 鍙戣捣ws璇锋眰
       sendWebsocket(
-        "ws://192.168.2.10:8095/chat?userId=1",
+        "ws://192.168.2.10:8095/chat?userId="+this.userId,
         obj,
         this.wsMessage,
         this.wsError
@@ -283,13 +284,14 @@
   overflow: auto;
   .leftside {
     margin-bottom: 30px;
+    width: 600px;
+    margin-left: 20px;
+    padding: 10px;
+    color: #fff;
+    background: rgb(110, 196, 247);
+    border-radius: 10px;
     span {
-      width: 400px;
-      margin-left: 20px;
-      padding: 10px;
-      color: #fff;
-      background: rgb(110, 196, 247);
-      border-radius: 10px;
+      word-wrap: break-word;
     }
   }
   .offside {

--
Gitblit v1.9.3