Карточка на онлайн пользователя
This commit is contained in:
1 parent
78e4eab353
commit
4471550f7d
6 files changed
+76
-71
No files matched your search
@@ -7,6 +7,8 @@ from rest_framework.response import Response
|
||||
class CalendarEventsAPIView(APIView):
|
||||
|
||||
def get(self, request):
|
||||
|
||||
|
||||
return Response('ku')
|
||||
|
||||
def post(self, request):
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="text-caption font-weight-regular">
|
||||
({{nStaff}} человек в штате)
|
||||
({{nStaff}} активных учетных записей)
|
||||
</div>
|
||||
</v-toolbar>
|
||||
</template>
|
||||
|
||||
@@ -78,13 +78,13 @@ export default {
|
||||
components: { VueCal },
|
||||
|
||||
setup() {
|
||||
const events = ref([
|
||||
|
||||
]);
|
||||
const events = ref([]);
|
||||
function f_generalvacation() {
|
||||
// axiosApiInstance
|
||||
// .get("api/general_vacation/generalvacation/")
|
||||
// .then((data) => {
|
||||
axiosApiInstance
|
||||
.get("api/calendar_of_events/calendarEvents/")
|
||||
.then((data) => {
|
||||
console.log(data, 'dataaaaaaaaaaaaa');
|
||||
})
|
||||
// for (let x in data.data) {
|
||||
// if (x == "План-график") {
|
||||
// data.data[x].map((e) => {
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
<info-user-card
|
||||
:author="author"
|
||||
:opendialog = open
|
||||
:loging="author.login"
|
||||
@update:opendialog="open = $event"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,86 +1,91 @@
|
||||
<template>
|
||||
<div class="align-center d-flex flex-column py-1">
|
||||
|
||||
|
||||
<v-btn
|
||||
variant="text"
|
||||
v-for="x in onlineuser"
|
||||
:key="x"
|
||||
height="50"
|
||||
>
|
||||
<v-avatar
|
||||
size="36px"
|
||||
>
|
||||
<v-img
|
||||
:src="checkremote( `${spravURL}${x}.jpg`)"
|
||||
@click="whatuser(x)"
|
||||
/>
|
||||
<v-btn variant="text" v-for="x in onlineuser" :key="x" height="50">
|
||||
<v-avatar size="36px">
|
||||
<v-img :src="checkremote(`${spravURL}${x}.jpg`)" @click="whatuser(x)" />
|
||||
</v-avatar>
|
||||
</v-btn>
|
||||
<info-user-card
|
||||
|
||||
:opendialog = open
|
||||
:loging="loging"
|
||||
:author="author"
|
||||
:opendialog="open"
|
||||
@update:opendialog="open = $event"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref,watch } from 'vue'
|
||||
import { baseWS } from '@/utils/axios-api'
|
||||
import {useAccountStore} from '@/store/AccountStore'
|
||||
import { spravURL } from '@/utils/axios-api'
|
||||
import {checkremote} from '@/utils/universal_functions'
|
||||
import { ref, watch } from "vue";
|
||||
import { baseWS } from "@/utils/axios-api";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
import { spravURL } from "@/utils/axios-api";
|
||||
import { checkremote } from "@/utils/universal_functions";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const author = ref({});
|
||||
const open = ref(false);
|
||||
const wsfuncs = {
|
||||
onliner: function (data) {
|
||||
let newset = new Set(data);
|
||||
let arr = Array.from(newset);
|
||||
|
||||
arr.splice(
|
||||
arr.findIndex((e) => e == accountStore.user.login),
|
||||
1
|
||||
);
|
||||
onlineuser.value = arr;
|
||||
},
|
||||
};
|
||||
const accountStore = useAccountStore();
|
||||
let onlineuser = ref([]);
|
||||
|
||||
setup(){
|
||||
const loging = ref('')
|
||||
const open = ref(false)
|
||||
const wsfuncs={onliner:function(data){
|
||||
let newset = new Set(data)
|
||||
let arr= Array.from(newset)
|
||||
|
||||
arr.splice(arr.findIndex(e=> e == accountStore.user.login), 1)
|
||||
onlineuser.value = arr
|
||||
}}
|
||||
const accountStore = useAccountStore()
|
||||
let onlineuser= ref([])
|
||||
|
||||
const connect = new WebSocket(baseWS+"ws/watcher/?token="+localStorage.access)
|
||||
const whatuser=(x)=> {
|
||||
loging.value = x
|
||||
open.value = true
|
||||
const connect = new WebSocket(
|
||||
baseWS + "ws/watcher/?token=" + localStorage.access
|
||||
);
|
||||
const whatuser = (x) => {
|
||||
open.value = true;
|
||||
axiosApiInstance
|
||||
.get(`api/accounts/getuser/?userlogin=${x}`)
|
||||
.then((data) => {
|
||||
author.value = {
|
||||
department: data.data.department,
|
||||
fio: data.data.fio,
|
||||
post: data.data.post,
|
||||
email: data.data.email,
|
||||
tel: data.data.tel,
|
||||
room: data.data.room,
|
||||
login: data.data.login,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
connect.onmessage = (e) => {
|
||||
let data = JSON.parse(e.data);
|
||||
|
||||
wsfuncs[data["message"]["action"]](data.message.data);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => accountStore.cod2user,
|
||||
function () {
|
||||
if (!accountStore.cod2user.value) {
|
||||
connect.close();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
connect.onmessage=(e)=>{
|
||||
let data = JSON.parse(e.data)
|
||||
|
||||
wsfuncs[data['message']['action']](data.message.data)
|
||||
}
|
||||
|
||||
watch(()=>accountStore.cod2user,function(){
|
||||
if (!accountStore.cod2user.value){
|
||||
connect.close()
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
loging,
|
||||
author,
|
||||
open,
|
||||
onlineuser,
|
||||
checkremote,
|
||||
spravURL,
|
||||
whatuser,
|
||||
accountStore
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
accountStore,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<style></style>
|
||||
@@ -11,7 +11,6 @@
|
||||
<info-user-card
|
||||
:author=author
|
||||
:opendialog = open
|
||||
:loging="author.login"
|
||||
@update:opendialog="open = $event"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user