| | |
| | | </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="处理"> |
| | |
| | | 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, |
| | |
| | | state: { |
| | | token: getToken(), |
| | | name: '', |
| | | Id: '', |
| | | avatar: '', |
| | | belongWards:[], |
| | | belongDepts:[], |
| | |
| | | SET_NAME: (state, name) => { |
| | | state.name = name |
| | | }, |
| | | SET_Id: (state, Id) => { |
| | | state.Id = Id |
| | | }, |
| | | SET_AVATAR: (state, avatar) => { |
| | | state.avatar = avatar |
| | | }, |
| | |
| | | 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) { // 验证返回的roles是否是一个非空数组 |
| | |
| | | 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) |
| | |
| | | websocketSend, |
| | | closeWebsocket, |
| | | } from "@/websocket/websocket.js"; |
| | | import store from "@/store"; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | |
| | | created() { |
| | | this.TemplateName = this.$route.query.name; |
| | | this.userid = store.getters.Id; |
| | | this.requstWs(); //进入页面创建连接 |
| | | }, |
| | | mounted() { |
| | |
| | | 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 |
| | |
| | | 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(); // 后调用 |
| | |
| | | }); |
| | | console.log(this.questionList); |
| | | |
| | | |
| | | // IMUI.appendMessage(data); |
| | | }, |
| | | //ws错误回调 |
| | |
| | | }, |
| | | |
| | | 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 |
| | |
| | | overflow: auto; |
| | | .leftside { |
| | | margin-bottom: 30px; |
| | | span { |
| | | width: 400px; |
| | | width: 600px; |
| | | margin-left: 20px; |
| | | padding: 10px; |
| | | color: #fff; |
| | | background: rgb(110, 196, 247); |
| | | border-radius: 10px; |
| | | span { |
| | | word-wrap: break-word; |
| | | } |
| | | } |
| | | .offside { |