相同用户操作判断调整
This commit is contained in:
parent
53335d35ba
commit
04caf21f2f
25
src/App.vue
25
src/App.vue
@ -3,7 +3,30 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { watch, onMounted } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useAuthStore } from 'src/stores/auth-store';
|
||||||
|
import { getLoginUserInfo } from 'src/api/UserApi';
|
||||||
|
import { saveJwtToken } from 'src/configs/TokenManage';
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'App'
|
name: 'App',
|
||||||
|
});
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const authStore = useAuthStore();
|
||||||
|
watch(
|
||||||
|
() => route.params.token,
|
||||||
|
async () => {
|
||||||
|
if (route.params.token) {
|
||||||
|
saveJwtToken(route.params.token as string);
|
||||||
|
const res = await getLoginUserInfo();
|
||||||
|
authStore.setUserId(res.loginUserInfo.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const res = await getLoginUserInfo();
|
||||||
|
authStore.setUserId(res.loginUserInfo.id);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -25,6 +25,7 @@ import { getJwt } from 'src/api/UserApi';
|
|||||||
import { fromUint8Array, toUint8Array } from 'js-base64';
|
import { fromUint8Array, toUint8Array } from 'js-base64';
|
||||||
import { getWebsocketUrl } from 'src/configs/UrlManage';
|
import { getWebsocketUrl } from 'src/configs/UrlManage';
|
||||||
import { sync_data_message } from 'src/protos/sync_data_message';
|
import { sync_data_message } from 'src/protos/sync_data_message';
|
||||||
|
import { useAuthStore } from 'src/stores/auth-store';
|
||||||
// import { getOnlyToken } from 'src/configs/TokenManage';
|
// import { getOnlyToken } from 'src/configs/TokenManage';
|
||||||
|
|
||||||
let drawApp: IDrawApp | null = null;
|
let drawApp: IDrawApp | null = null;
|
||||||
@ -87,6 +88,11 @@ function handleSubscribe(app: IDrawApp) {
|
|||||||
destination: `/rtss_simulation/draft/iscs/${drawStore.draftId}`,
|
destination: `/rtss_simulation/draft/iscs/${drawStore.draftId}`,
|
||||||
messageHandle: (message: Uint8Array) => {
|
messageHandle: (message: Uint8Array) => {
|
||||||
const syncData = sync_data_message.SyncData.deserialize(message);
|
const syncData = sync_data_message.SyncData.deserialize(message);
|
||||||
|
console.log(syncData.userId, useAuthStore().userId, 'userID');
|
||||||
|
if (syncData.userId === useAuthStore().userId) {
|
||||||
|
console.info('当前用户操作');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
syncData.submenu === drawStore.selectSubmenuAndStation.submenu &&
|
syncData.submenu === drawStore.selectSubmenuAndStation.submenu &&
|
||||||
syncData.station === drawStore.selectSubmenuAndStation.station
|
syncData.station === drawStore.selectSubmenuAndStation.station
|
||||||
|
@ -257,6 +257,7 @@ import { successNotify } from 'src/utils/CommonNotify';
|
|||||||
import { saveDrawDatas } from 'src/drawApp/iscsApp';
|
import { saveDrawDatas } from 'src/drawApp/iscsApp';
|
||||||
import { saveDrawToServer } from 'src/drawApp/commonApp';
|
import { saveDrawToServer } from 'src/drawApp/commonApp';
|
||||||
import { sync_data_message } from 'src/protos/sync_data_message';
|
import { sync_data_message } from 'src/protos/sync_data_message';
|
||||||
|
import { useAuthStore } from 'src/stores/auth-store';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@ -533,6 +534,7 @@ function handleRecordData(op) {
|
|||||||
datas: [],
|
datas: [],
|
||||||
submenu: drawStore.selectSubmenuAndStation.submenu,
|
submenu: drawStore.selectSubmenuAndStation.submenu,
|
||||||
station: drawStore.selectSubmenuAndStation.station,
|
station: drawStore.selectSubmenuAndStation.station,
|
||||||
|
userId: useAuthStore().userId,
|
||||||
};
|
};
|
||||||
op.obj.forEach((g) => {
|
op.obj.forEach((g) => {
|
||||||
const gData = g.saveData();
|
const gData = g.saveData();
|
||||||
@ -545,7 +547,7 @@ function handleRecordData(op) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
drawApp.publishMessage(
|
drawApp.publishMessage(
|
||||||
'/rtss_simulation/draft/iscs/7',
|
`/rtss_simulation/draft/iscs/${drawStore.draftId}`,
|
||||||
new sync_data_message.SyncData({ ...syncData }).serialize()
|
new sync_data_message.SyncData({ ...syncData }).serialize()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -121,24 +121,24 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
import SysMenu from 'src/components/SysMenu.vue';
|
import SysMenu from 'src/components/SysMenu.vue';
|
||||||
import { useRoute } from 'vue-router';
|
// import { useRoute } from 'vue-router';
|
||||||
import { clearJwtToken, saveJwtToken } from 'src/configs/TokenManage';
|
import { clearJwtToken } from 'src/configs/TokenManage';
|
||||||
import { Dialog } from 'quasar';
|
import { Dialog } from 'quasar';
|
||||||
import { getLoginUserInfo } from 'src/api/UserApi';
|
// import { getLoginUserInfo } from 'src/api/UserApi';
|
||||||
import { useAuthStore } from 'src/stores/auth-store';
|
// import { useAuthStore } from 'src/stores/auth-store';
|
||||||
|
|
||||||
const route = useRoute();
|
// const route = useRoute();
|
||||||
const authStore = useAuthStore();
|
// const authStore = useAuthStore();
|
||||||
|
|
||||||
onMounted(async () => {
|
// onMounted(async () => {
|
||||||
if (route.params.token) {
|
// if (route.params.token) {
|
||||||
saveJwtToken(route.params.token as string);
|
// saveJwtToken(route.params.token as string);
|
||||||
const res = await getLoginUserInfo();
|
// const res = await getLoginUserInfo();
|
||||||
authStore.setUserId(res.loginUserInfo.id);
|
// authStore.setUserId(res.loginUserInfo.id);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
const leftDrawerOpen = ref(false);
|
const leftDrawerOpen = ref(false);
|
||||||
function toggleLeftDrawer() {
|
function toggleLeftDrawer() {
|
||||||
|
@ -6,6 +6,7 @@ export const useAuthStore = defineStore('auth', {
|
|||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
setUserId(id: number | null) {
|
setUserId(id: number | null) {
|
||||||
|
console.log(id, '----');
|
||||||
this.userId = id;
|
this.userId = id;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user