提交 57982d24 编写于 作者: lyf's avatar lyf

修改vuex

上级 274bd541
...@@ -13,10 +13,14 @@ ...@@ -13,10 +13,14 @@
v-loadmore="getOldMSGHistory" v-loadmore="getOldMSGHistory"
class="center BSListWraper" class="center BSListWraper"
> >
<section class="c-header"> <section
v-if="JSON.stringify(currentChat) == '{}'"
class="c-header"
>
<div class="header-line"> <div class="header-line">
<div class="c-header-l"> <div class="c-header-l">
<span class="num">{{ currentChat.diagnoseLogId }}</span> <span class="num">{{
currentChat.diagnoseLogId }}</span>
<span class="dep">&nbsp;{{ currentChat.department }}</span> <span class="dep">&nbsp;{{ currentChat.department }}</span>
</div> </div>
<div class="c-header-edit"> <div class="c-header-edit">
...@@ -832,7 +836,6 @@ ...@@ -832,7 +836,6 @@
content = {}; content = {};
signature = ''; signature = '';
msgIndex = -1; msgIndex = -1;
if (item.type.toLowerCase() == 'custom') { if (item.type.toLowerCase() == 'custom') {
content = JSON.parse(item.content); content = JSON.parse(item.content);
if (content.bizType == -1 || content.bizType == 27) { if (content.bizType == -1 || content.bizType == 27) {
......
<template> <template>
<div class="livebox"> <div class="livebox">
<div class="top"> <div class="top">
<div class="top-left"> <div
v-if="JSON.stringify(currentChat) == '{}'"
class="top-left"
>
<div class="time-message"> <div class="time-message">
<p class="msg-img"> <p class="msg-img">
<img :src="currentChat.diagnoseType == 2 ? im_text : im_video"> <img :src="currentChat.diagnoseType == 2 ? im_text : im_video">
...@@ -288,8 +291,6 @@ ...@@ -288,8 +291,6 @@
} }
if (memberList && memberList.length) { if (memberList && memberList.length) {
memberList.forEach((item) => { memberList.forEach((item) => {
if (item.role == 4) {
}
// 在当前群组中的角色 1: 问诊医生 2: 接诊医生 3: 居民 4: 其他 // 在当前群组中的角色 1: 问诊医生 2: 接诊医生 3: 居民 4: 其他
if (item.role == 1) { if (item.role == 1) {
this.memberList[0] = item; this.memberList[0] = item;
...@@ -350,7 +351,6 @@ ...@@ -350,7 +351,6 @@
// 创建trtcClient // 创建trtcClient
clientLogin() { clientLogin() {
if (Number(this.currentChat.diagnoseType) === 3) { if (Number(this.currentChat.diagnoseType) === 3) {
console.log('问诊类型', this.currentChat.diagnoseType);
return false; return false;
} }
const obj = { const obj = {
......
import { router, store } from '@pica-cli/vue-cli-plugin-pica-cli-plugin/auto'; import { router, store } from '@pica-cli/vue-cli-plugin-pica-cli-plugin/auto';
import '@/router'; import '@/router';
console.log('router, store ', router, store);
console.log('router, store, vueApp: ', router, store); \ No newline at end of file
\ No newline at end of file
...@@ -6,16 +6,17 @@ import getters from './getters'; ...@@ -6,16 +6,17 @@ import getters from './getters';
import state from './state'; import state from './state';
import mutations from './mutations/index'; import mutations from './mutations/index';
import actions from './actions/index'; import actions from './actions/index';
console.log('socket---', socket);
console.log('--init---', state, mutations, getters, actions);
Vue.use(Vuex); Vue.use(Vuex);
export default new Vuex.Store({ export default new Vuex.Store({
state, state,
getters, getters,
mutations, mutations,
actions, actions,
modules: { modules:{
common, socket,
socket common
}, }
}); });
...@@ -20,7 +20,7 @@ const common = { ...@@ -20,7 +20,7 @@ const common = {
changeToken({ commit }, tokenData) { changeToken({ commit }, tokenData) {
commit('CHANGE_TOKEN', tokenData); commit('CHANGE_TOKEN', tokenData);
}, },
changeTime({ commit }) { changeTime({ commit }, tokenData) {
commit('SET_TIME', tokenData); commit('SET_TIME', tokenData);
}, },
......
// ES6 import
import store from '../';
console.log('store---', store);
import io from 'socket.io-client'; import io from 'socket.io-client';
const _VM = this; const socket = {
const socketTimer = null;
export default {
namespaced: true, namespaced: true,
state: { state: {
socketClient: null, socketClient: null,
}, },
actions: { actions: {
initSocket ({ commit }, payload) { initSocket(context, payload) {
console.log('payload--', payload); console.log('payload--', payload);
const socketClient = io.connect(payload.url, { const socketClient = io.connect(payload.url, {
query: { query: {
...@@ -19,7 +14,7 @@ export default { ...@@ -19,7 +14,7 @@ export default {
// reconnection: false, // reconnection: false,
}); });
console.log('-=-=-initSocket次数', socketClient); console.log('-=-=-initSocket次数', socketClient);
commit('SET_SOCKET', socketClient); context.commit('SET_SOCKET', socketClient);
socketClient.on('connect', (socket) => { socketClient.on('connect', (socket) => {
console.log('socket 链接成功', socket, socketClient); console.log('socket 链接成功', socket, socketClient);
}); });
...@@ -33,34 +28,35 @@ export default { ...@@ -33,34 +28,35 @@ export default {
}); });
socketClient.on('diagnose_push_event', (socket) => { socketClient.on('diagnose_push_event', (socket) => {
console.log('diagnose_push_event---', socket); console.log('diagnose_push_event---', socket);
const {list, allSize, countRespList} = socket; const { list, allSize, countRespList } = socket;
console.log('--_VM', _VM.$route); context.commit('updateCurrentDiagList', list);
store.commit('updateCurrentDiagList', list); context.commit('updateAllSize', allSize);
store.commit('updateAllSize', allSize); context.commit('updateCurrentCalList', countRespList);
store.commit('updateCurrentCalList', countRespList);
}); });
socketClient.on('diagnose_call_push_event', (socket) => { socketClient.on('diagnose_call_push_event', (socket) => {
console.log('diagnose_call_push_event---', socket); console.log('diagnose_call_push_event---', socket);
const l = store.state.noticeList; const l = context.state.noticeList;
if(l.length >= 5) { if (l.length >= 5) {
l.shift(); l.shift();
} }
l.push(socket); l.push(socket);
const n = {notifyIndex: l.length, ...socket}; const n = { notifyIndex: l.length, ...socket };
store.commit('updateNoticeList', l); context.commit('updateNoticeList', l);
console.log('--_VM', _VM);
const {path} = _VM.$route;
console.log('n--------', n); console.log('n--------', n);
const operateUserId = store.state.soketQuest.operateUserId ? store.state.soketQuest.operateUserId : ''; const { path } = window._VM.$route;
if(path && String(path).indexOf('workbench') > -1 && n.operateUserId == operateUserId) { const operateUserId = context.state.soketQuest.operateUserId
store.commit('socket/SET_NOTIFY', n); ? context.state.soketQuest.operateUserId
: '';
if (
path &&
String(path).indexOf('workbench') > -1 &&
n.operateUserId == operateUserId
) {
context.commit('socket/SET_NOTIFY', context, n);
} }
}); });
socketClient.on('ping', function () { socketClient.on('ping', function () {
console.log('[E] 心跳请求已发出 →', socketClient); console.log('[E] 心跳请求已发出 →', socketClient);
if(socketTimer) {
clearInterval(socketTimer);
}
}); });
// 收到 // 收到
socketClient.on('pong', function (socket) { socketClient.on('pong', function (socket) {
...@@ -85,22 +81,24 @@ export default { ...@@ -85,22 +81,24 @@ export default {
SET_SOCKET: (state, payload) => { SET_SOCKET: (state, payload) => {
window.socketClient = payload; window.socketClient = payload;
state.socketClient = payload; state.socketClient = payload;
console.log(state);
}, },
SET_NOTIFY: (state, payload) => { SET_NOTIFY: (state, context, payload) => {
console.log('--payload', payload); console.log('--payload', payload);
const doms = document.getElementsByClassName('el-notification'); const doms = document.getElementsByClassName('el-notification');
if (doms.length >= 5) return; if (doms.length >= 5) return;
const h = _VM.$createElement; const h = window._VM.$createElement;
const t = payload.department ? `问诊单${payload.diagnoseLogId}(${payload.department})` : `问诊单${payload.diagnoseLogId}`; const t = payload.department
? `问诊单${payload.diagnoseLogId}(${payload.department})`
: `问诊单${payload.diagnoseLogId}`;
// userCallKfStatus 医助呼叫 // userCallKfStatus 医助呼叫
// doctorCallKfStatus 医生呼叫 // doctorCallKfStatus 医生呼叫
const name = payload.userCallKfStatus == 1 ? payload.userName : payload.doctorName; const name =
const cn = _VM.$notify({ payload.userCallKfStatus == 1 ? payload.userName : payload.doctorName;
const cn = window._VM.$notify({
title: t, title: t,
message: h('p', [ message: h('p', [
h('i', {style: 'color: teal;'}, `${name}正在呼叫你`), h('i', { style: 'color: teal;' }, `${name}正在呼叫你`),
h( h(
'el-button', 'el-button',
...@@ -109,15 +107,16 @@ export default { ...@@ -109,15 +107,16 @@ export default {
on: { on: {
click: function () { click: function () {
console.log('----state', state); console.log('----state', state);
if(state.showChat) { if (state.showChat) {
_VM.$message({ window._VM.$message({
message: '不可同时进入多个诊室,请先退出已进入的诊室,再试。', message:
'不可同时进入多个诊室,请先退出已进入的诊室,再试。',
type: 'warning', type: 'warning',
duration:1000 duration: 1000,
}); });
return false; return false;
} }
store.dispatch('gotoInquiry', payload); context.dispatch('gotoInquiry', payload);
cn.close(); cn.close();
}, },
}, },
...@@ -126,12 +125,12 @@ export default { ...@@ -126,12 +125,12 @@ export default {
), ),
]), ]),
onClose: function () { onClose: function () {
console.log('--onClose', payload ); console.log('--onClose', payload);
}, },
duration: 5000, duration: 5000,
position: 'top-right', position: 'top-right',
}); });
} },
}, },
}; };
export default socket;
...@@ -10,10 +10,10 @@ export default { ...@@ -10,10 +10,10 @@ export default {
changeRawCurrentCalList(state, obj) { changeRawCurrentCalList(state, obj) {
// console.log("obj",obj) // console.log("obj",obj)
const index = state.RawCurrentCalList.findIndex(val => { const index = state.RawCurrentCalList.findIndex((val) => {
return val.status == obj.status; return val.status == obj.status;
}); });
if(index > -1) { if (index > -1) {
state.RawCurrentCalList[index] = obj; state.RawCurrentCalList[index] = obj;
state.currentCalList[index].is_dot = false; state.currentCalList[index].is_dot = false;
} }
...@@ -23,19 +23,19 @@ export default { ...@@ -23,19 +23,19 @@ export default {
}, },
updateCurrentCalList(state, obj) { updateCurrentCalList(state, obj) {
const NewData = obj; const NewData = obj;
if(state.RawCurrentCalList.length == 0) { if (state.RawCurrentCalList.length == 0) {
state.RawCurrentCalList = obj; state.RawCurrentCalList = obj;
} }
const RawData = state.RawCurrentCalList; const RawData = state.RawCurrentCalList;
for (let i = 0; i < NewData.length; i++) { for (let i = 0; i < NewData.length; i++) {
let is_dot = false; let is_dot = false;
if (RawData.length > 0) { if (RawData.length > 0) {
is_dot = NewData[i].count > RawData[i].count ? true : false; is_dot = NewData[i].count > RawData[i].count ? true : false;
} }
NewData[i] = { NewData[i] = {
...NewData[i], ...NewData[i],
is_dot: is_dot, is_dot: is_dot,
}; };
} }
state.currentCalList = NewData; state.currentCalList = NewData;
}, },
...@@ -59,6 +59,7 @@ export default { ...@@ -59,6 +59,7 @@ export default {
state.noticeList = obj; state.noticeList = obj;
}, },
updateIsSuperAdmin(state, obj) { updateIsSuperAdmin(state, obj) {
console.log('obj------', obj);
state.isSuperAdmin = obj; state.isSuperAdmin = obj;
}, },
}; };
...@@ -5,7 +5,9 @@ const state = { ...@@ -5,7 +5,9 @@ const state = {
allSize: 0, allSize: 0,
currentCalList: {}, currentCalList: {},
RawCurrentCalList: [], RawCurrentCalList: [],
currentChat: {}, currentChat: {
diagnoseType:1
},
currentAdvice: {}, currentAdvice: {},
soketQuest: {}, soketQuest: {},
noticeList: [], noticeList: [],
......
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
}, },
watch: { watch: {
isSuperAdmin(newdata, olddata) { isSuperAdmin(newdata, olddata) {
console.log('newdata---', newdata); console.log('newdata---', newdata, this.isSuperAdmin);
if (newdata !== olddata && newdata.userID) { if (newdata !== olddata && newdata.userID) {
console.log('-isSuperAdminisSuperAdmin', newdata); console.log('-isSuperAdminisSuperAdmin', newdata);
const s = storejs.get('soketQuest'); const s = storejs.get('soketQuest');
...@@ -169,18 +169,18 @@ ...@@ -169,18 +169,18 @@
}, },
}, },
created() { created() {
},
mounted() {
console.log('this.isSuperAdmin.userID----------', this.isSuperAdmin);
const s = storejs.get('soketQuest'); const s = storejs.get('soketQuest');
const t = s ? s.returnStatus : 1; const t = s ? s.returnStatus : 1;
this.tabPosition = t; this.tabPosition = t;
const d = s ? s.dateTime : new Date().format('yyyy-MM-dd'); const d = s ? s.dateTime : new Date().format('yyyy-MM-dd');
this.searchParam.dateTime = d; this.searchParam.dateTime = d;
const id = s && s.operateUserId ? s.operateUserId : this.isSuperAdmin.userID;
const id = this.operateUserId = id;
s && s.operateUserId ? s.operateUserId : this.isSuperAdmin.userID;
this.operateUserId = id;
},
mounted() {
console.log('this.isSuperAdmin', this.isSuperAdmin);
}, },
methods: { methods: {
tabChange(val) { tabChange(val) {
......
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
i.isSuper = false; i.isSuper = false;
} }
}); });
console.log('i------------', this.$store);
this.$store.commit('updateIsSuperAdmin', i); this.$store.commit('updateIsSuperAdmin', i);
this.items = vueMenuDtos; this.items = vueMenuDtos;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册