Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | <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-avatar>
</v-btn>
<info-user-card
:author="author"
:opendialog="open"
@update:opendialog="open = $event"
/>
</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 { 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([]);
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();
}
}
);
return {
author,
open,
onlineuser,
checkremote,
spravURL,
whatuser,
accountStore,
};
},
};
</script>
<style></style>
|