This commit is contained in:
iriska-gri committed 2023-10-30 10:48:31 +03:00
1 parent df5d962413
commit fe115ae140
1132 files changed
+1671 -73

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11
+5
View File
@@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
+7
View File
@@ -0,0 +1,7 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: ['plugin:vue/vue3-essential', 'eslint:recommended', 'plugin:storybook/recommended'],
}
+23
View File
@@ -0,0 +1,23 @@
.DS_Store
front/node_modules/
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
+17
View File
@@ -0,0 +1,17 @@
/** @type { import('@storybook/vue3-vite').StorybookConfig } */
const config = {
stories: ['../src/stories/**/*.stories.js'],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/vue3-vite",
options: {},
},
docs: {
autodocs: "tag",
},
};
export default config;
+14
View File
@@ -0,0 +1,14 @@
/** @type { import('@storybook/vue3').Preview } */
const preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};
export default preview;
+44
View File
@@ -0,0 +1,44 @@
# default
## Project setup
```
# yarn
yarn
# npm
npm install
# pnpm
pnpm install
```
### Compiles and hot-reloads for development
```
# yarn
yarn dev
# npm
npm run dev
# pnpm
pnpm dev
```
### Compiles and minifies for production
```
# yarn
yarn build
# npm
npm run build
# pnpm
pnpm build
```
### Customize configuration
See [Configuration Reference](https://vitejs.dev/config/).
+16
View File
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Портал</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}
+23900
View File
File diff suppressed because it is too large. Load diff
+57
View File
@@ -0,0 +1,57 @@
{
"name": "front",
"version": "0.0.21",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint . --fix --ignore-path .gitignore",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
"@fullcalendar/core": "^6.1.8",
"@fullcalendar/daygrid": "^6.1.8",
"@fullcalendar/interaction": "^6.1.8",
"@fullcalendar/list": "^6.1.8",
"@fullcalendar/multimonth": "^6.1.9",
"@fullcalendar/timegrid": "^6.1.8",
"@fullcalendar/vue3": "^6.1.8",
"@mdi/font": "7.0.96",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.3",
"axios": "^1.4.0",
"chart.js": "^4.4.0",
"date-fns": "^2.30.0",
"express-vue": "^5.16.0",
"pinia": "^2.0.23",
"roboto-fontface": "*",
"v-tooltip": "^2.1.3",
"vue": "^3.2.0",
"vue-chartjs": "^5.2.0",
"vue-jwt-decode": "^0.1.0",
"vue-router": "^4.0.0",
"vue3-autocounter": "^1.0.6",
"vuelidate": "^0.7.7",
"vuetify": "^3.0.0",
"webfontloader": "^1.0.0"
},
"devDependencies": {
"@storybook/addon-essentials": "^7.4.6",
"@storybook/addon-interactions": "^7.4.6",
"@storybook/addon-links": "^7.4.6",
"@storybook/blocks": "^7.4.6",
"@storybook/testing-library": "^0.2.2",
"@storybook/vue3": "^7.4.6",
"@storybook/vue3-vite": "^7.4.6",
"@vitejs/plugin-vue": "^4.0.0",
"eslint": "^8.22.0",
"eslint-plugin-storybook": "^0.6.14",
"eslint-plugin-vue": "^9.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.4.6",
"vite": "^4.2.0",
"vite-plugin-vuetify": "^1.0.0"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+51
View File
@@ -0,0 +1,51 @@
<template>
<router-view />
</template>
<script setup >
import VueJwtDecode from 'vue-jwt-decode'
import {useAccountStore} from '@/store/AccountStore'
const accountStore = useAccountStore()
const checkuser = ()=>{
const token = localStorage.getItem("refresh")
if(token){
const u = VueJwtDecode.decode(token)
accountStore.setUser(u.user)
}
}
checkuser()
</script>
<style>
::-webkit-scrollbar {
width: 1px;
height: 6px;
}
/* Track */
::-webkit-scrollbar-track {
-webkit-border-radius: 6px;
border-radius: 6px;
}
/* Handle */
::-webkit-scrollbar-thumb {
-webkit-border-radius: 6px;
border-radius: 6px;
background: rgb(var(--v-theme-scrollbar))
}
::-webkit-scrollbar-thumb:window-inactive {
background: rgb(var(--v-theme-scrollbar))
}
.pointer {
cursor:pointer
}
</style>
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+6
View File
@@ -0,0 +1,6 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M261.126 140.65L164.624 307.732L256.001 466L377.028 256.5L498.001 47H315.192L261.126 140.65Z" fill="#1697F6"/>
<path d="M135.027 256.5L141.365 267.518L231.64 111.178L268.731 47H256H14L135.027 256.5Z" fill="#AEDDFF"/>
<path d="M315.191 47C360.935 197.446 256 466 256 466L164.624 307.732L315.191 47Z" fill="#1867C0"/>
<path d="M268.731 47C76.0026 47 141.366 267.518 141.366 267.518L268.731 47Z" fill="#7BC6FF"/>
</svg>

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

+137
View File
@@ -0,0 +1,137 @@
<template>
<v-dialog
v-model="menuAuthDialog"
persistent
width="400"
>
<template v-slot:activator="{ props }">
<v-btn
v-bind="props"
append-icon="mdi-login"
>
<template v-slot:prepend>
<v-icon color="white"></v-icon>
</template>
Войти
<template v-slot:append>
<v-icon color="white"/>
</template>
</v-btn>
</template>
<v-card>
<v-card-title>
<span class="text-h5">Вход в портал</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12" class="py-0">
<v-text-field
v-model="anon.username"
label="Логин"
variant="underlined"
:error-messages="errorer('username')"
/>
</v-col>
<v-col cols="12" class="py-0">
<v-text-field
v-model="anon.password"
label="Пароль"
variant="underlined"
type="password"
:error-messages="errorer('password')"
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer/>
<v-btn
color="modal_btn"
variant="text"
@click="menuAuthDialog = false"
>
Отмена
</v-btn>
<v-btn
color="modal_btn"
variant="text"
@click="logging"
>
Войти
</v-btn>
</v-card-actions>
<v-progress-linear v-show="AppStore.loading" indeterminate></v-progress-linear>
</v-card>
</v-dialog>
</template>
<script>
import {useAccountStore} from '@/store/AccountStore'
import {useAppStore} from '@/store/app'
import { useVuelidate } from '@vuelidate/core'
import { required, helpers } from '@vuelidate/validators'
import { ref, reactive, computed, onMounted } from 'vue'
const req= helpers.withMessage('Обязательное поле', required)
export default {
setup(){
const accountStore = useAccountStore()
const AppStore= useAppStore()
const menuAuthDialog = ref(false)
const anon=reactive({
username:"9966-00-125",
password:""
})
const rules = computed(()=> {
return {
username: { req, latin: helpers.withMessage(()=> 'Логин имееет вид "0000-00-000"', (value) => /(\d{4,4}[-]\d{2,2}[-]\d{3,3})+$/.test(value.toString()))}, // Matches state.firstName
password: { req } // Matches state.lastName
}
}
)
const v$ = useVuelidate(rules, anon)
const errorer = (field) => {
let errors = v$.value[field].$error?v$.value[field].$errors[0].$message:''
return errors
}
const logging=async()=>{
if (!v$.value.$error) {
await accountStore.logging(anon)
}
else {
console.log(true);
}
}
onMounted(() => {
v$.value.$validate()
})
return {
accountStore,
AppStore,
menuAuthDialog,
anon,
v$,
logging,
errorer,
}
}
}
</script>
<style>
</style>
@@ -0,0 +1,234 @@
<template>
<full-calendar :options="calendarOptions" />
</template>
<script>
import {reactive, ref, onMounted} from 'vue'
// import '@fullcalendar/core/vdom'
import FullCalendar from '@fullcalendar/vue3'
import dayGridPlugin from '@fullcalendar/daygrid'
import interactionPlugin from '@fullcalendar/interaction'
import listPlugin from '@fullcalendar/list'
import timeGridPlugin from '@fullcalendar/interaction'
import { axiosApiInstance } from '@/utils/axios-api'
import multiMonthPlugin from '@fullcalendar/multimonth'
export default {
name: 'calendar-full',
props: {
initial: {
type: String,
default: 'multiMonthYear'
}
},
components: {
FullCalendar
},
setup(props) {
const calendarOptions = reactive({
plugins: [ dayGridPlugin, interactionPlugin, timeGridPlugin, listPlugin, multiMonthPlugin ],
initialView: props.initial,
dayMaxEventRows: 3
,
locale: 'ru',
buttonText: {
today: 'Сегодня',
month: 'Месяц',
week: 'Неделя',
day: 'День',
list: 'Список',
year: 'Год'
},
firstDay:'1',
events: [],
// eventDidMount: function(info) {
// const dayEl = info.el.closest('.fc-daygrid-day')
// dayEl.style.backgroundColor = 'red'
// },
// datesRender: function(info) {
// const start = info.view.activeStart
// const end = info.view.activeEnd
// let daysEls = document.querySelectorAll('.fc-daygrid-day')
// console.log(daysEls , ' info-------------');
// },
editable: true,
headerToolbar: {
left: 'prev',
center: 'title',
right: 'next'
}
,
// eventRender: function(eventObj, $el) {
// $el.popover({
// title: eventObj.title,
// content: eventObj.description,
// trigger: 'hover',
// placement: 'top',
// container: 'body'
// });
// },
// eventDidMount: function(info) {
// console.log(info.event.extendedProps);
// {description: "Lecture", department: "BioChemistry"}
// },
aspectRatio: 1,
multiMonthMaxColumns: 2,
displayEventEnd: true,
height: '100%',
stickyHeaderDates: true,
dayMaxEventRows: 2,
moreLinkContent: function(arg) {
return arg.shortText + ' события'
},
views: {
multiMonthYear: {
moreLinkContent: function(arg) {
return arg.num
},
},
},
allDayText: 'Весь день',
noEventsContent: 'На сегодня событий нет',
selectable: true,
dateClick: (arg) => {
console.log(arg.date);
}
})
function f_generalvacation() {
axiosApiInstance.get('api/general_vacation/generalvacation/')
.then(data => {
for (let x in data.data) {
if (x=="План-график") {
data.data[x].map(e=>{
calendarOptions.events.push({ description: 'description for All Day Event', title: e.name, start: e.start_work_period, end: e.end_work_period})
}
)
}
}
})
}
onMounted(() => {
f_generalvacation()
})
// genvacation.value[0].planned_date
return { calendarOptions }
}
}
</script>
<style>
#fc-dom-1:first-letter {
text-transform: capitalize;
}
.fc-toolbar {
/* padding: 0px; */
background-color: #f8f8f8;
}
.fc-day-header {
font-weight: bold;
text-align: center;
}
.fc-day {
border: none;
}
.fc-time-grid-event {
background-color: #e6e6e6;
border: none;
color: #000;
}
.fc-event-title {
font-weight: bold;
}
.fc .fc-toolbar.fc-header-toolbar {
padding-bottom: 0.2em;
margin-bottom: 0px;
}
.fc .fc-popover {
top: 0px!important
;
left: 450px!important;
overflow: auto;
min-width: 500px;
height: 380px;
}
.fc-h-event .fc-event-title {
display: initial!important;
}
/* .fc .fc-daygrid-day-events {
margin-top: -7px;
} */
.fc {
/* background-color: #ffffff; */
background-color: var('bg-main_theme');
}
.fc-button {
padding: 1px!important;
border-radius: 1em!important;
line-height: 0!important;
background-color: transparent!important;
border-color: transparent!important;
}
.fc-icon {
color: #000;
display: flex;
}
.fc-button:focus, .fc-icon {
outline: none!important;
}
.fc-button,
.fc-buttonactive,
.fc-button:focus {
border:none!important;
}
.fc-header-toolbar {
background: white !important;
}
</style>
+3
View File
@@ -0,0 +1,3 @@
import myHelper from '@/components/UI/my-helper';
export default [myHelper]
+62
View File
@@ -0,0 +1,62 @@
<template>
<div class="pa-0 align-self-center">
<v-menu
v-model="menu"
:close-on-content-click="false"
:nudge-width="500"
offset-x
>
<template v-slot:activator="{ on, attrs }">
<v-icon
v-bind="attrs"
v-on="on"
size="large"
color="indigo"
icon="mdi-owl"
@click="menu=!menu"
></v-icon>
</template>
<v-card
class="whmy overflow-auto overflow-x-hidden">
<v-row class="ma-3">
<v-col >
<pre>
{{pretext}}
</pre>
</v-col>
</v-row>
</v-card>
</v-menu>
</div>
</template>
<script>
export default {
name: "myHelper",
props: {
pretext: {
type:Object,
default:()=>{}
}
},
data: () => ({
fav: true,
menu: false,
message: false,
hints: true,
}),
}
</script>
<style>
.whmy {
height: 950px!important;
}
</style>
+159
View File
@@ -0,0 +1,159 @@
<template>
<v-card class="pt-2">
<v-card-title>
<span class="text-h5">Обратная связь</span>
</v-card-title>
<v-card-text class="px-2 py-0">
<v-container>
<v-row>
<v-col class="flex-grow-0 py-0 text-no-wrap align-self-center text-button">
Оцените сайт
</v-col>
<v-divider/>
</v-row>
<v-row
v-for="(x, key) in feedbackdata.basecrit"
:key = key
>
<v-col class="flex-grow-0 pb-0">
<v-icon
size="large"
:color="x.color"
:icon="x.ico"
/>
</v-col>
<v-col class="pb-0" lg=3>
{{x.name}}
</v-col>
<v-col class="py-0">
<v-rating
v-model="feedbackdata.nowrating[key].rating"
hover
half-increments
color="stars"
/>
</v-col>
<v-divider/>
</v-row >
<v-row class="mt-6">
<v-col class="pa-0 px-3">
<v-textarea
label="Ваши комментарии сделают портал лучше"
hide-details
variant="outlined"
rows="5"
row-height="15"
v-model="feedbackdata.nowcomment.comment"
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions class="pt-0">
<small v-if="average < 5 || feedbackdata.nowcomment.id!=null" class="pl-5">
Вы оценили сайт на <span class="font-weight-black">{{average}}</span> {{myLabel()}}
</small>
<v-spacer/>
<v-btn
color="modal_btn"
variant="text"
text="Закрыть"
@click="menusCloses"
/>
<v-btn
color="modal_btn"
variant="text"
:text="feedbackdata.nowcomment.id==null?'Отправить':'Обновить'"
@click="feedSend"
/>
</v-card-actions>
</v-card>
</template>
<script>
import { ref, onMounted, computed } from 'vue'
import { axiosApiInstance } from '@/utils/axios-api'
export default {
props: {
LikeDialog: {
type: Boolean,
default: false
}
},
setup(props, context) {
const feedbackdata= ref({nowcomment: {comment: '' }, nowrating: []})
function f_feedbackdata() {
axiosApiInstance.get('api/feedback/feedbackdata/')
.then(data => {
feedbackdata.value = data.data
if (feedbackdata.value.nowrating.length == 0) {
for (let x of feedbackdata.value.basecrit) {
feedbackdata.value.nowrating.push({rating: x.rating, crit: x.id, id: null})
}
}
if (feedbackdata.value.nowcomment === null) {
feedbackdata.value.nowcomment = { comment: '', id: null}
}
})
}
onMounted(() => {
f_feedbackdata()
})
const average = computed(()=> {
const sum = feedbackdata.value.nowrating.reduce((total, obj)=> total + obj.rating, 0)
const sumlen = sum/feedbackdata.value.nowrating.length
const ukr = Number.isInteger(sumlen)?sumlen:sumlen.toFixed(1)
return ukr
})
function myLabel() {
let labels = ''
if (average.value > 0 && average.value <= 3)
labels = 'УПС-С! Мы обязательно все исправим'
else if (average.value > 2 && average.value <= 4)
labels = 'Спасибо за обратную связь, мы обратим на это внимание'
else if (average.value > 4 && average.value < 5)
labels = 'Класс, будем стараться до 5'
else
labels = "Спасибо за отзыв и высокую оценку ^__^"
return labels
}
function menusCloses() {
context.emit('menusClose')
}
function feedSend() {
axiosApiInstance.post(`api/feedback/feedbackdata/`, {nowrating : feedbackdata.value.nowrating, nowcomment: feedbackdata.value.nowcomment} ).then(data => {})
menusCloses()
}
return {feedbackdata, average, menusCloses, myLabel, feedSend}
}
}
</script>
<style>
.custom_subtitle {
opacity: 1;
}
.v-selection-control__input {
width: 46%!important;
height: 46%!important;
border-radius: 0!important;
}
</style>
+148
View File
@@ -0,0 +1,148 @@
<template>
<v-card>
<v-card-title>
<span class="text-h5">Карточка пользователя</span>
</v-card-title>
<v-card-text class="flex-column d-flex pb-0">
<v-row class="flex-grow-0">
<v-divider/>
<v-col
class="pa-0"
lg=4
>
<v-img
class="h-100"
cover
:src="accountStore.user.photo"
/>
</v-col>
<v-col class="pa-0">
<v-list class="pt-0 custom_subtitle">
<v-list-item
v-for="n in basicInformation()"
:key="n"
>
<template #title>
<span class="font-weight-medium">
{{n.title}}
</span>
</template>
<template #subtitle>
<span class="text-subtitle-1">
{{n.info}}
</span>
</template>
</v-list-item>
</v-list>
</v-col>
<v-divider/>
</v-row>
<v-row class="flex-grow-0">
<v-list class="pa-0 pt-3 custom_subtitle">
<v-list-item
v-for="n in subInformation()"
:key="n"
class="py-0"
density
>
<template #title>
<span class="font-weight-medium">
{{n.title}}
</span>
<span class="text-subtitle-1">
{{n.info}}
</span>
</template>
</v-list-item>
</v-list>
</v-row>
</v-card-text>
<v-card-actions class="align-self-end pt-0">
<v-btn
color="modal_btn"
variant="text"
@click="menusCloses"
>
Отмена
</v-btn>
</v-card-actions>
</v-card>
</template>
<script>
import { clearAxios } from '@/utils/axios-api'
import { ref, onMounted } from 'vue'
import {useAccountStore} from '@/store/AccountStore'
export default {
props: {
menuGetUserDialog: {
type: Boolean,
default: false
},
loging: {
type: String,
default: ''
}
},
setup(props, context) {
const accountStore = useAccountStore()
const userlinks = ref([])
const loadlinksUser=async()=>{
// console.log(`accountStore`, accountStore);
const res = await clearAxios.get('api/accounts/getuser/?userlogin='+props.loging)
userlinks.value=res.data
}
const basicInformation = () => [
{title: 'Отдел:', info: userlinks.value.department},
{title: 'ФИО:', info: userlinks.value.fio},
{title: 'Должность:', info: userlinks.value.post},
]
const subInformation = () => [
{title: 'E-mail: ', info: userlinks.value.email},
{title: 'Телефон: ', info: userlinks.value.tel},
{title: 'Комната: ', info: userlinks.value.room},
{title: 'Логин: ', info: userlinks.value.login},
]
function menusCloses() {
context.emit('menusClose')
}
onMounted(() => {
loadlinksUser()
})
return {
menusCloses,
userlinks,
accountStore,
basicInformation,
subInformation
}
}
}
</script>
<style>
.custom_subtitle .v-list-item-subtitle {
opacity: 1!important;
}
</style>
+128
View File
@@ -0,0 +1,128 @@
<template>
<!-- -->
<v-carousel
interval="10000"
cover
height="450"
hide-delimiters
hide-delimiter-background
show-arrows="hover"
color="white"
cycle
>
<v-carousel-item
v-for="(x, i) in carous" :key="i"
:src="`${burl}${x.link}`"
cover
eager
>
<!-- -->
<v-container
fill-height
fluid
pa-0 ma-0 pb-3
class="flex-column h-100 d-flex"
>
<v-card class="bgCard h-100 d-flex flex-column">
<v-card-title class="ma-2 text-h3 text-uppercase titles text-text_carous py-5 flex-column">
<v-row>
<v-col class="pa-0 pl-1 align-self-center">{{x.title}} </v-col>
<!-- {{ burl }} {{ x.sender }} -->
<v-col class="flex-grow-0 pa-0 pr-1">
<v-img
width="50"
:aspect-ratio="1"
:src="`${burl}${x.sender}`"
cover
/>
</v-col>
</v-row>
</v-card-title>
<v-card-text class="ml-2 mb-0 mb-2 w-50 flex-grow-0 pb-3 text-h6 bgText overflow-auto ">
<v-textarea
class="text-text_carous mt-n3 text-black textareas pt-2 font-weight-medium"
:model-value=x.text
variant='plain'
readonly
auto-grow
rows="1"
hide-details
/>
</v-card-text>
</v-card>
</v-container>
</v-carousel-item>
</v-carousel>
</template>
<script>
import { ref, computed } from 'vue'
import {getfromserver} from '@/utils/universal_functions'
import { baseURL } from '@/utils/axios-api'
export default {
setup() {
const burl = baseURL.slice(0,-1)
const carous=ref([{link: ""}])
const imageSrcgrupp=computed(()=> {
return new URL(`@/assets/mc.png`, import.meta.url).href;
})
getfromserver("api/navigation/carousels/", carous)
return { burl, carous, imageSrcgrupp}
}
}
</script>
<style>
.bgCard {
/* #ffffff6b #ffffff8c*/
background: #ffffff38 ;
}
.bgText {
background: #ffffffb0;
line-height: 2.1rem!important;
}
.titles {
font-family: cursive !important;
background: #ffffff8c;
}
.textareas .v-field__input {
font-size: 1.3em!important;
}
</style>
@@ -0,0 +1,100 @@
<template>
<v-card class="d-flex ml-3">
<v-sheet
class="mx-auto"
elevation="0"
max-width="813"
>
<v-slide-group
v-model="model"
class="pa-0"
selected-class="bg-primary"
mandatory
show-arrows
>
<v-slide-group-item
v-for="n in digitalData"
:key="n"
>
<v-card
class="ma-2 mt-4 d-flex flex-column"
height="100"
width="169"
elevation="0"
>
<!-- <v-img
height="100"
:src="`${burl}${n.img}`"
cover
class="text-white"
> -->
<v-card class="h-100 text-center g text-numeral">
<v-card-title class="statstyle my-2 py-0 text-overline font-weight-bold">
{{n.status}}
</v-card-title>
<v-card-text class="numstyle mt-4 py-0 font-weight-bold">
<vue3-autocounter ref='counter' :startAmount='0' :endAmount='Number(n.num)' :duration='1'/>
</v-card-text>
</v-card>
<!-- </v-img> -->
</v-card>
</v-slide-group-item>
</v-slide-group>
</v-sheet>
</v-card>
</template>
<script>
import { ref } from 'vue'
import { baseURL } from '@/utils/axios-api'
export default {
props: {
digitalData: {
type: Object,
default: {}
}
},
setup() {
const burl = baseURL.slice(0,-1)
const model = ref(false)
return {model, burl}
}
}
</script>
<style>
.numstyle {
font-size: 2.875rem!important;
line-height: 2.5rem!important;
font-family: cursive !important;
background: #ffffffb0;
}
.statstyle {
background: #ffffffb0;
font-size: 1rem!important;
}
.g {
/* background-color: rgb(240 248 255 / 35%);; */
background-color: rgb(255 255 255);;
}
</style>
+214
View File
@@ -0,0 +1,214 @@
<template>
<div>
<v-card
:ref="i"
class="mx-auto px-3 pt-3"
:class="i>0?'mt-1':''"
v-for="(x, i) in newss.result" :key= i
>
<v-card-title class="py-1">
{{x.title}}
</v-card-title>
<v-img
:src="`${burl}${x.link}`"
height="164px"
cover
width="92%"
class="mx-auto"
/>
<v-list-item class="w-100">
<div class="justify-self-start mt-1">
<v-icon size="x-small" class="me-1" icon="mdi-account" ></v-icon>
<span class="text-caption me-2">{{splitname(x.author)}}</span>
</div>
<template v-slot:append>
<div class="justify-self-end">
<v-icon size="x-small" class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'" @click="toggleIncrementLike(x.id, true)"></v-icon>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==true).length}}</span>
<span class="me-1">·</span>
<v-icon size="x-small" class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(x.id, false)"/>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
<span class="me-1">·</span>
<v-icon size="x-small" class="me-1" icon="mdi-message-text-outline" @click="openComent(x.id)"/>
<span class="pointer subheading">{{ x.comment.length }}</span>
</div>
</template>
</v-list-item>
<v-divider/>
<v-card-text class="pb-0">
{{limitText(x.text)}}
</v-card-text>
<div class="pt-1 pl-1 pb-2">
<v-btn
color="more_details_btn"
variant="text"
:to='`/news?id=${x.id}`'
size="small"
append-icon="mdi-step-forward-2"
>
Подробнее
</v-btn>
</div>
</v-card>
</div>
</template>
<script>
import { ref, watch, onBeforeUpdate, onMounted } from 'vue'
import {useAccountStore} from '@/store/AccountStore'
import {getfromserver} from '@/utils/universal_functions'
import { baseURL } from '@/utils/axios-api'
import myHelper from './UI/my-helper.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import { format } from 'date-fns'
import { useRoute } from 'vue-router'
const accountStore = useAccountStore()
export default {
components: { myHelper },
setup(){
const divs = ref([])
onBeforeUpdate(() => {
divs.value = []
})
const newss=ref([])
const dialogCommentShow = ref(false)
const burl = baseURL.slice(0,-1)
const textcomment = ref('')
const idnews = ref(0)
const page = ref(1)
const selecnews = ref(2)
const route = useRoute()
let str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
if (route.path == '/news' && 'id' in route.query){
str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}&id=${route.query.id}`
}
getfromserver(str, newss)
const toggleIncrementLike = (news, scores) => {
axiosApiInstance.post(`api/navigation/news/`, {news: news, scores: scores}).then(result => {
newss.value.result[newss.value.result.findIndex(e=> e.id==news)].scores= result.data
})
}
const addComment = () => {
axiosApiInstance.post(`api/navigation/news/`, {news: idnews.value, text: textcomment.value}).then(result => {
dialogCommentShow.value=!dialogCommentShow.value
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
})
textcomment.value=""
}
const deletComment = (id, news) => {
axiosApiInstance.post(`api/navigation/news/`, {delid: id, news: news}).then(result => {
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
})
}
const pagelistNews =() => {
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`, newss)
}
watch(()=>accountStore.cod2user ,(newValue,oldValue)=>{
if(newValue){
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`,newss)
}
}, {deep:true})
watch(()=>selecnews ,(newValue,oldValue)=>{
if(newValue){
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${newValue.value}`, newss)
}
}, {deep:true})
const dateformat = (datas) => {
return format(new Date(datas), 'dd.MM.yyyy HH:mm')
}
const openComent = (news) => {
dialogCommentShow.value=!dialogCommentShow.value
idnews.value = news
}
const limitText=(text)=> {
const t = text.split(' ').slice(0, 25)
return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}`
}
const splitname = (name) => {
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
}
return {
newss,
burl,
limitText,
toggleIncrementLike,
dialogCommentShow,
accountStore,
dateformat,
splitname,
textcomment,
openComent,
addComment,
idnews,
deletComment,
pagelistNews,
divs,
page,
selecnews,
route
}
}
}
</script>
<style scoped>
.pagination {
display: flex;
}
.newsVH {
height: 90vh;
}
.bgchat {
background-color: #efe9f98a;
}
.bgchatnot {
background-color: #eef9efad;
}
/* .bgf {
background: url("@/assets/message.jpg") repeat-y;
} */
</style>
+523
View File
@@ -0,0 +1,523 @@
<template>
<div class="d-flex flex-column py-3 h-100 ">
<v-row class=" flex-grow-1 d-flex h-0 overflow-auto">
<v-col class="pa-0 ">
<v-card
class=" rounded-0"
v-for="(x, i) in newss.result" :key=i>
<v-list-item class="w-100 pl-4 py-2 pt-3">
<template v-slot:prepend>
<v-avatar
color="loading_avatar"
:image="checkremote( `${spravURL}${x.author.login}.jpg`)"></v-avatar>
</template>
<v-list-item-title>{{x.author.fio}}</v-list-item-title>
<v-list-item-subtitle>Участник</v-list-item-subtitle>
</v-list-item>
<v-card-title class="pt-0 pb-1">
{{x.title}}
</v-card-title>
<v-img
:src="`${burl}${x.link}`"
height="350px"
width="96%"
class="mx-auto"
cover
/>
<v-list-item class="w-100">
<template v-slot:append>
<div class="justify-self-end">
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'" @click="toggleIncrementLike(x.id, true)"></v-icon>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==true).length}}</span>
<span class="me-1">·</span>
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(x.id, false)"/>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
<span class="me-1">·</span>
<v-icon class="me-1" icon="mdi-message-text-outline" @click="openComent(x.id)"/>
<span @click="x.showComment=!x.showComment" class="pointer subheading">{{ x.comment.length }}</span>
</div>
</template>
</v-list-item>
<div >
<v-divider/>
<v-card-text>
{{x.text}}
</v-card-text>
<v-divider/>
<v-expand-transition>
<div v-show="x.showComment" v-if="x.comment.length>0">
<div
v-for = "(y, key) in x.comment"
:key="key"
class="d-flex flex-column pa-3"
>
<v-row
class="justify-space-between ma-0 align-center bgchat mr-7"
:class="accountStore.user.login==y.author.login?'bgchatnot':'bgchat'"
>
<v-col class="flex-grow-1 text-subtitle-2 pl-2 pa-0 "
>
{{ accountStore.user.login==y.author.login?'':splitname(y.author) }}
</v-col>
<v-col class="pa-0 text-center text-subtitle-2 ">
{{dateformat(y.cdate)}}
</v-col>
<v-col class="pa-0 pr-2 text-end text-subtitle-2 ">
{{ accountStore.user.login!=y.author.login?'':splitname(y.author) }}
</v-col>
</v-row>
<div class="text-subtitle-2">
</div>
<v-row>
<v-col class="pr-0">
<v-alert
color="bg_comments"
rounded=0
:border="accountStore.user.login==y.author.login?'end':'start'"
:border-color="accountStore.user.login==y.author.login?'success':'deep-purple accent-4'"
elevation=0
>
{{ y.text }}
</v-alert>
</v-col>
<v-col class="flex-grow-0 d-flex pa-0 align-center"
:class="accountStore.user.login==y.author.login?'pa-0':'pa-5'"
>
<v-btn
v-if="accountStore.user.login==y.author.login"
variant="text"
size="small"
icon='mdi-delete'
color="delete_btn"
@click="deletComment(y.id, x.id)"
/>
</v-col>
</v-row>
</div>
</div>
</v-expand-transition>
</div>
</v-card>
</v-col>
</v-row>
<v-row class="flex-grow-0">
<v-col class="ma-0 pa-0 pt-2">
<v-pagination
v-model="page"
:length="newss.allnews"
prev-icon="mdi-menu-left"
next-icon="mdi-menu-right"
@click="pagelistNews"
/>
</v-col>
<v-col class="ma-0 flex-grow-0 mwidth mt-1 pa-0">
<v-select
hide-details
density="compact"
v-model="selecnews"
variant="underlined"
:items="['1', '2', '3', '4', '5', '6']"/>
</v-col>
</v-row>
<v-dialog
v-model="dialogCommentShow"
persistent
width="550"
>
<v-card>
<v-card-title class="text-h5">
Прокоментировать новость
</v-card-title>
<v-card-text>
<v-textarea
variant="solo"
hide-details
rows="5"
v-model="textcomment"
></v-textarea>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="modal_btn"
variant="text"
@click="dialogCommentShow = false"
>
Отмена
</v-btn>
<v-btn
color="modal_btn"
variant="text"
@click="addComment"
>
Отправить
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- <v-row>
<v-col class="pa-0 overflow-auto">
<v-card
class=" rounded-0"
v-for="(x, i) in newss.result" :key=i>
<v-list-item class="w-100 pl-4 py-2 pt-3">
<template v-slot:prepend>
<v-avatar
color="loading_avatar"
:image="checkremote( `${spravURL}${x.author.login}.jpg`)"></v-avatar>
</template>
<v-list-item-title>{{x.author.fio}}</v-list-item-title>
<v-list-item-subtitle>Участник</v-list-item-subtitle>
</v-list-item>
<v-card-title class="pt-0 pb-1">
{{x.title}}
</v-card-title>
<v-img
:src="`${burl}${x.link}`"
height="350px"
width="96%"
class="mx-auto"
cover
/>
<v-list-item class="w-100">
<template v-slot:append>
<div class="justify-self-end">
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'" @click="toggleIncrementLike(x.id, true)"></v-icon>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==true).length}}</span>
<span class="me-1">·</span>
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(x.id, false)"/>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
<span class="me-1">·</span>
<v-icon class="me-1" icon="mdi-message-text-outline" @click="openComent(x.id)"/>
<span @click="x.showComment=!x.showComment" class="pointer subheading">{{ x.comment.length }}</span>
</div>
</template>
</v-list-item>
<div >
<v-divider/>
<v-card-text>
{{x.text}}
</v-card-text>
<v-divider/>
<v-expand-transition>
<div v-show="x.showComment" v-if="x.comment.length>0">
<div
v-for = "(y, key) in x.comment"
:key="key"
class="d-flex flex-column pa-3"
>
<v-row
class="justify-space-between ma-0 align-center bgchat mr-7"
:class="accountStore.user.login==y.author.login?'bgchatnot':'bgchat'"
>
<v-col class="flex-grow-1 text-subtitle-2 pl-2 pa-0 "
>
{{ accountStore.user.login==y.author.login?'':splitname(y.author) }}
</v-col>
<v-col class="pa-0 text-center text-subtitle-2 ">
{{dateformat(y.cdate)}}
</v-col>
<v-col class="pa-0 pr-2 text-end text-subtitle-2 ">
{{ accountStore.user.login!=y.author.login?'':splitname(y.author) }}
</v-col>
</v-row>
<div class="text-subtitle-2">
</div>
<v-row>
<v-col class="pr-0">
<v-alert
color="bg_comments"
rounded=0
:border="accountStore.user.login==y.author.login?'end':'start'"
:border-color="accountStore.user.login==y.author.login?'success':'deep-purple accent-4'"
elevation=0
>
{{ y.text }}
</v-alert>
</v-col>
<v-col class="flex-grow-0 d-flex pa-0 align-center"
:class="accountStore.user.login==y.author.login?'pa-0':'pa-5'"
>
<v-btn
v-if="accountStore.user.login==y.author.login"
variant="text"
size="small"
icon='mdi-delete'
color="delete_btn"
@click="deletComment(y.id, x.id)"
/>
</v-col>
</v-row>
</div>
</div>
</v-expand-transition>
</div>
</v-card>
-->
</div>
</template>
<script>
import {checkremote} from '@/utils/universal_functions'
import { ref, watch, onBeforeUpdate, onMounted } from 'vue'
import {useAccountStore} from '@/store/AccountStore'
import {getfromserver} from '@/utils/universal_functions'
import { baseURL } from '@/utils/axios-api'
import myHelper from './UI/my-helper.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import { format } from 'date-fns'
import { useRoute } from 'vue-router'
import { spravURL } from '@/utils/axios-api'
const accountStore = useAccountStore()
export default {
components: { myHelper },
setup(){
const divs = ref([])
onBeforeUpdate(() => {
divs.value = []
})
const newss=ref([])
const dialogCommentShow = ref(false)
const burl = baseURL.slice(0,-1)
const textcomment = ref('')
const idnews = ref(0)
const page = ref(1)
const selecnews = ref(2)
const route = useRoute()
let str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
if (route.path == '/news' && 'id' in route.query){
str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}&id=${route.query.id}`
}
getfromserver(str, newss)
const toggleIncrementLike = (news, scores) => {
axiosApiInstance.post(`api/navigation/news/`, {news: news, scores: scores}).then(result => {
newss.value.result[newss.value.result.findIndex(e=> e.id==news)].scores= result.data
})
}
const addComment = () => {
axiosApiInstance.post(`api/navigation/news/`, {news: idnews.value, text: textcomment.value}).then(result => {
dialogCommentShow.value=!dialogCommentShow.value
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
})
textcomment.value=""
}
const deletComment = (id, news) => {
axiosApiInstance.post(`api/navigation/news/`, {delid: id, news: news}).then(result => {
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
})
}
const pagelistNews =() => {
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`, newss)
}
watch(()=>route.query,(newValue,oldValue)=>{
if(newValue){
str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
getfromserver(str, newss)
}
}, {deep:true})
watch(()=>selecnews ,(newValue,oldValue)=>{
if(newValue){
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${newValue.value}`, newss)
}
}, {deep:true})
watch(()=>accountStore.cod2user ,(newValue,oldValue)=>{
if(newValue){
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`,newss)
}
}, {deep:true})
const dateformat = (datas) => {
return format(new Date(datas), 'dd.MM.yyyy HH:mm')
}
const openComent = (news) => {
dialogCommentShow.value=!dialogCommentShow.value
idnews.value = news
}
const limitText=(text)=> {
const t = text.split(' ').slice(0, 25)
return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}`
}
const splitname = (name) => {
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
}
return {
newss,
burl,
limitText,
toggleIncrementLike,
dialogCommentShow,
accountStore,
dateformat,
splitname,
textcomment,
openComent,
addComment,
idnews,
deletComment,
pagelistNews,
divs,
page,
selecnews,
checkremote,
route,
spravURL
}
}
}
</script>
<style scoped>
.posFooter {
position: sticky;
margin-top: 12px;
background-color: transparent;
bottom: 5px;
}
.newsVH {
height: 92vh;
}
.bgchat {
background-color: #efe9f98a;
}
.bgchatnot {
background-color: #eef9efad;
}
.mwidth {
min-width: 50px;
}
/* .bgf {
background: url("@/assets/message.jpg") repeat-y;
} */
</style>
+389
View File
@@ -0,0 +1,389 @@
<template>
<v-container class="py-0 newsVH px-0 bg-transparent overflow-auto">
<v-card
v-show="route.path=='/'"
:ref="i"
class="mx-auto"
:class="i>0?'mt-1':''"
v-for="(x, i) in newss.result" :key= i
>
<v-card-title class="py-1">
{{x.title}}
</v-card-title>
<v-img
:src="`${burl}${x.link}`"
height="164px"
cover
width="92%"
class="mx-auto"
/>
<v-list-item class="w-100">
<div class="justify-self-start mt-1">
<v-icon size="x-small" class="me-1" icon="mdi-account" ></v-icon>
<span class="text-caption me-2">{{splitname(x.author)}}</span>
</div>
<template v-slot:append>
<div class="justify-self-end">
<v-icon size="x-small" class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'" @click="toggleIncrementLike(x.id, true)"></v-icon>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==true).length}}</span>
<span class="me-1">·</span>
<v-icon size="x-small" class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(x.id, false)"/>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
<span class="me-1">·</span>
<v-icon size="x-small" class="me-1" icon="mdi-message-text-outline" @click="openComent(x.id)"/>
<span class="pointer subheading">{{ x.comment.length }}</span>
</div>
</template>
</v-list-item>
<v-divider/>
<v-card-text class="pb-0">
{{limitText(x.text)}}
</v-card-text>
<div class="pt-1 pl-1 pb-2">
<v-btn
color="more_details_btn"
variant="text"
:to='`/news?id=${x.id}`'
size="small"
append-icon="mdi-step-forward-2">
Подробнее
</v-btn>
</div>
</v-card>
<!-- ------------------------------ @click="scrollMeTo('porto')"---------------------------------------------------- -->
<div >
<v-card v-show="route.path=='/news'"
class="mx-auto rounded-0"
v-for="(x, i) in newss.result" :key=i
>
<v-list-item class="w-100 pl-4 py-2 pt-3">
<template v-slot:prepend>
<v-avatar
color="loading_avatar"
:image=accountStore.user.photo></v-avatar>
</template>
<v-list-item-title>{{x.author.fio}}</v-list-item-title>
<v-list-item-subtitle>Участник</v-list-item-subtitle>
</v-list-item>
<v-card-title class="pt-0 pb-1">
{{x.title}}
</v-card-title>
<v-img
:src="`${burl}${x.link}`"
height="350px"
width="96%"
class="mx-auto"
cover
/>
<v-list-item class="w-100">
<template v-slot:append>
<div class="justify-self-end">
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'" @click="toggleIncrementLike(x.id, true)"></v-icon>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==true).length}}</span>
<span class="me-1">·</span>
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(x.id, false)"/>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
<span class="me-1">·</span>
<v-icon class="me-1" icon="mdi-message-text-outline" @click="openComent(x.id)"/>
<span @click="x.showComment=!x.showComment" class="pointer subheading">{{ x.comment.length }}</span>
</div>
</template>
</v-list-item>
<div >
<v-divider/>
<v-card-text>
{{x.text}}
</v-card-text>
<v-divider/>
<v-expand-transition>
<div v-show="x.showComment" v-if="x.comment.length>0">
<div
v-for = "(y, key) in x.comment"
:key="key"
class="d-flex flex-column pa-3"
>
<v-row
class="justify-space-between ma-0 align-center bgchat mr-7"
:class="accountStore.user.login==y.author.login?'bgchatnot':'bgchat'"
>
<v-col class="flex-grow-1 text-subtitle-2 pl-2 pa-0 "
>
{{ accountStore.user.login==y.author.login?'':splitname(y.author) }}
</v-col>
<v-col class="pa-0 text-center text-subtitle-2 ">
{{dateformat(y.cdate)}}
</v-col>
<v-col class="pa-0 pr-2 text-end text-subtitle-2 ">
{{ accountStore.user.login!=y.author.login?'':splitname(y.author) }}
</v-col>
</v-row>
<div class="text-subtitle-2">
</div>
<v-row>
<v-col class="pr-0">
<v-alert
color="white"
rounded=0
:border="accountStore.user.login==y.author.login?'end':'start'"
:border-color="accountStore.user.login==y.author.login?'success':'deep-purple accent-4'"
elevation=0>
{{ y.text }}
</v-alert>
</v-col>
<v-col class="flex-grow-0 d-flex pa-0 align-center"
:class="accountStore.user.login==y.author.login?'pa-0':'pa-5'"
>
<v-btn
v-if="accountStore.user.login==y.author.login"
variant="text"
size="small"
icon='mdi-delete'
color="delete_btn"
@click="deletComment(y.id, x.id)"
/>
</v-col>
</v-row>
</div>
</div>
</v-expand-transition>
</div>
</v-card>
</div>
<v-row justify="center">
<v-dialog
v-model="dialogCommentShow"
persistent
width="550">
<v-card>
<v-card-title class="text-h5">
Прокоментировать новость
</v-card-title>
<v-card-text>
<v-textarea
variant="solo"
hide-details
rows="5"
v-model="textcomment"
></v-textarea>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="modal_btn"
variant="text"
@click="dialogCommentShow = false"
>
Отмена
</v-btn>
<v-btn
color="modal_btn"
variant="text"
@click="addComment"
>
Отправить
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</v-container>
<v-container v-show="route.path=='/news'">
<div class="pagination" >
<v-pagination
class="flex-grow-1"
v-model="page"
:length="newss.allnews"
prev-icon="mdi-menu-left"
next-icon="mdi-menu-right"
@click="pagelistNews"
></v-pagination>
<v-select
class="flex-grow-0 pt-2"
density="compact"
v-model="selecnews"
variant="outlined"
:items="['1', '2', '3', '4', '5', '6']"
>
</v-select>
</div>
</v-container>
</template>
<script>
import { ref, watch, onBeforeUpdate, onMounted } from 'vue'
import {useAccountStore} from '@/store/AccountStore'
import {getfromserver} from '@/utils/universal_functions'
import { baseURL } from '@/utils/axios-api'
import myHelper from './UI/my-helper.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import { format } from 'date-fns'
import { useRoute } from 'vue-router'
const accountStore = useAccountStore()
export default {
components: { myHelper },
setup(){
const divs = ref([])
onBeforeUpdate(() => {
divs.value = []
})
const newss=ref([])
const dialogCommentShow = ref(false)
const burl = baseURL.slice(0,-1)
const textcomment = ref('')
const idnews = ref(0)
const page = ref(1)
const selecnews = ref(2)
const route = useRoute()
let str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
if (route.path == '/news' && 'id' in route.query){
str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}&id=${route.query.id}`
}
getfromserver(str, newss)
const toggleIncrementLike = (news, scores) => {
axiosApiInstance.post(`api/navigation/news/`, {news: news, scores: scores}).then(result => {
newss.value.result[newss.value.result.findIndex(e=> e.id==news)].scores= result.data
})
}
const addComment = () => {
axiosApiInstance.post(`api/navigation/news/`, {news: idnews.value, text: textcomment.value}).then(result => {
dialogCommentShow.value=!dialogCommentShow.value
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
})
textcomment.value=""
}
const deletComment = (id, news) => {
axiosApiInstance.post(`api/navigation/news/`, {delid: id, news: news}).then(result => {
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
})
}
const pagelistNews =() => {
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`, newss)
}
watch(()=>accountStore.cod2user ,(newValue,oldValue)=>{
if(newValue){
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`,newss)
}
}, {deep:true})
watch(()=>selecnews ,(newValue,oldValue)=>{
if(newValue){
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${newValue.value}`, newss)
}
}, {deep:true})
const dateformat = (datas) => {
return format(new Date(datas), 'dd.MM.yyyy HH:mm')
}
const openComent = (news) => {
dialogCommentShow.value=!dialogCommentShow.value
idnews.value = news
}
const limitText=(text)=> {
const t = text.split(' ').slice(0, 25)
return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}`
}
const splitname = (name) => {
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
}
return {
newss,
burl,
limitText,
toggleIncrementLike,
dialogCommentShow,
accountStore,
dateformat,
splitname,
textcomment,
openComent,
addComment,
idnews,
deletComment,
pagelistNews,
divs,
page,
selecnews,
route
}
}
}
</script>
<style scoped>
.pagination {
display: flex;
}
.newsVH {
height: 92vh;
}
.bgchat {
background-color: #efe9f98a;
}
.bgchatnot {
background-color: #eef9efad;
}
/* .bgf {
background: url("@/assets/message.jpg") repeat-y;
} */
</style>
+96
View File
@@ -0,0 +1,96 @@
<template>
<div>
<v-list-item v-for="x in onlineuser"
:key="x"
:prepend-avatar="checkremote( `${spravURL}${x}.jpg`)"
title="x"
nav
@click="whatuser(x)">
<v-dialog
v-model="menuGetUserDialog"
persistent
width="600">
{{spravURL}}
<Card-users
:menuGetUserDialog="menuGetUserDialog"
:loging="loging"
@menusClose="menuGetUserDialog=false"/>
</v-dialog>
</v-list-item>
</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 CardUsers from '@/components/cardUsers.vue'
export default {
components: { CardUsers},
setup(){
const loging = ref('')
const menuGetUserDialog=ref(false)
const wsfuncs={onliner:function(data){
let newset = new Set(data)
console.log(Array.from(newset));
let arr= Array.from(newset)
arr.splice(arr.findIndex(e=> e == accountStore.user.login), 1)
console.log(accountStore.user.login,'accountStore');
onlineuser.value = arr
}}
const accountStore = useAccountStore()
let onlineuser= ref([])
// const userlinks = ref([])
// const loadlinksUser=async()=>{
// // console.log(`accountStore`, accountStore);
// const res = await clearAxios.get('api/accounts/getuser/?userlogin='+props.loging)
// userlinks.value=res.data
// }
// const gh = () => {
// console.log('hi');
// }
const connect = new WebSocket(baseWS+"ws/watcher/?token="+localStorage.access)
const whatuser=(x)=> {
loging.value = x
menuGetUserDialog.value=true
}
connect.onmessage=(e)=>{
let data = JSON.parse(e.data)
wsfuncs[data['message']['action']](data.message.data)
}
watch(()=>accountStore.cod2user,function(){
// console.log('newValue')
if (!accountStore.cod2user.value){
connect.close()
}
})
return {loging, menuGetUserDialog, onlineuser, checkremote,spravURL, whatuser, accountStore}
}
}
</script>
<style>
</style>
@@ -0,0 +1,445 @@
<template>
<v-app>
<v-app-bar
:elevation="2"
density="compact"
color="app_bar"
class="pl-4">
<v-icon
v-if="accountStore.cod2user"
class="px-3"
size="20"
:icon="rail ? 'mdi-chevron-right' : 'mdi-chevron-left'"
@click="rail = !rail" />
<v-card
class="bg-transparent py"
density="compact"
:prepend-avatar="imageSrc"
title="Портал МИ ФНС по ЦОД № 2"
variant="text"
:to="'/'" />
<template v-slot:image>
<v-img gradient="to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)" />
</template>
<template v-slot:append>
<template v-if="accountStore.cod2user">
<v-card
class="bg-transparent"
density="compact"
:prepend-avatar="accountStore.user.photo"
:title="accountStore.user.fio"
:subtitle="accountStore.user.post"
variant="text" @click="getcard" />
<v-dialog
v-model="menuGetUserDialog"
persistent width="600">
<Card-users
:menuGetUserDialog="menuGetUserDialog"
:loging="accountStore.user.login"
@menusClose="menuGetUserDialog = false" />
</v-dialog>
<v-tooltip location="bottom">
<template v-slot:activator="{ props }">
<v-btn
v-bind="props"
dark to="/faq"
icon="mdi-comment-question-outline" />
</template>
<span>F.A.Q.</span>
</v-tooltip>
<v-dialog
v-model="LikeDialog"
persistent width="800">
<template v-slot:activator="{ props }">
<v-btn
v-bind="props"
dark icon="mdi-thumb-up-outline" />
</template>
<Card-like
:LikeDialog="LikeDialog"
@menusClose="LikeDialog = false" />
</v-dialog>
<v-btn icon @click="toggleTheme">
<v-icon
class="mr-1"
color="lampa">
mdi-lightbulb-outline
</v-icon>
</v-btn>
<v-btn dark icon="mdi-magnify" />
<v-btn dark icon="mdi-account-multiple-outline" @click="drawer_right = !drawer_right" />
<v-btn dark icon="mdi-logout" @click="accountStore.logout" />
</template>
<template v-else>
<v-row justify="center">
<Auth-form />
</v-row>
</template>
</template>
</v-app-bar>
<v-navigation-drawer v-if="accountStore.cod2user" :width="245" :rail="rail" permanent v-model="drawer">
<v-row class="my-0 h-100">
<v-col class="flex-column d-flex">
<v-row><v-col>
<v-list nav density="compact">
<template v-for="(x, key) in navigations">
<v-list-item v-if="!('submenu' in x)"
:key="x.key"
:title="x.name"
:value="x.name"
:href="x.link"
:to="x.path"
color="navigation">
<template v-slot:prepend>
<v-icon :icon="x.ico"/>
<v-tooltip
v-if="rail"
activator="parent"
location="top">
{{ x.name }}
</v-tooltip>
</template>
</v-list-item>
<v-list-group v-else
:class="rail?'railmenu':''"
:key="key"
:value="x.name">
<template v-slot:activator="{ props }">
<v-list-item
v-bind="props"
:title="x.name"
:prepend-icon="x.ico" />
<v-tooltip
v-if="rail"
activator="parent"
location="top"
>
{{ x.name }}
</v-tooltip>
</template>
<v-list-item v-for="(child, k) in x.submenu"
:href="child.link"
:key="k"
:value="child.name"
:title="!rail?child.name:menuTruncated(child.name)"
:to="child.path"
>
<v-tooltip
v-if="rail"
activator="parent"
location="top"
>
{{ child.name }}
</v-tooltip>
</v-list-item>
</v-list-group>
</template>
</v-list>
<v-list nav density="compact">
<v-list-item v-for="x of mainmenuStore.portallinks"
:key="x.name"
:title="x.name"
:value="x.name"
:href="x.link" color="app_bar">
<template v-slot:prepend>
<v-icon
:icon="x.imagecode" />
<v-tooltip
v-if="rail"
activator="parent"
location="top">
{{ x.name }}
</v-tooltip>
</template>
</v-list-item>
</v-list>
</v-col>
</v-row>
<v-row class="flex-grow-0">
<v-col class="py-0 pl-1 d-flex flex-column">
<v-list class=" d-flex flex-column ">
<v-list-item v-if="!rail" class="text-caption font-weight-bold text-truncate">
<p>Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
<v-divider />
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
<v-divider />
<p>Уникальных посещений: {{ appStore.countvisitor.uniqtoday }}</p>
<v-divider />
</v-list-item>
<v-list-item v-else class="align-center ml-2">
<v-tooltip
v-model="showTooltip"
location="top">
<template v-slot:activator="{ props }">
<v-icon v-bind="props" color="eye_icon">
mdi-account-eye
</v-icon>
</template>
<p>Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
<v-divider />
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
<v-divider />
<p>Уникальных посещений: {{ appStore.countvisitor.uniqtoday }}</p>
</v-tooltip>
</v-list-item>
</v-list>
</v-col>
</v-row>
</v-col>
</v-row>
</v-navigation-drawer>
<!-- <v-navigation-drawer
:width="8"
class="btnNav pointer"
@click="rail = !rail"
>
<v-list>
<v-icon
size="10"
:icon="rail?'mdi-chevron-right':'mdi-chevron-left'"
/>
</v-list>
</v-navigation-drawer> -->
<v-main v-if="accountStore.cod2user" class="d-flex bg-main_theme">
<router-view />
<!-- <div class="mystat d-flex flex-column">
<v-btn
class="mb-1"
prepend-icon="mdi-wikipedia"
size="small"
variant="outlined"
height="30"
>
Wiki
</v-btn>
<v-btn
height="30"
prepend-icon="mdi-apple-finder"
size="small"
variant="outlined"
>
МС
</v-btn>
</div> -->
</v-main>
<v-main v-else class="d-flex justify-center align-center text-h3 bg-teal-lighten-2">
<div>
<p class="text-center">Добро пожаловать на портал МИ ФНС по ЦОД № 2</p>
<p class="mt-3 text-subtitle-1 text-center">Авторизуйтесь, для получения доступа к контенту портала</p>
</div>
</v-main>
<v-navigation-drawer v-if="accountStore.cod2user"
v-model="drawer_right"
rail permanent
location="right"
@click="rail = false">
<Online-users />
<!-- <template v-slot:append>
<v-list lines="one">
<v-list-item
v-for="(val,key) in appStore.countvisitor"
:key="key"
:title="val"
></v-list-item>
</v-list>
</template> -->
</v-navigation-drawer>
</v-app>
</template>
<script>
import { ref, computed, onMounted} from 'vue'
import uf from '@/utils/universal_functions'
import { useAccountStore } from '@/store/AccountStore'
import { useMainmenuStore } from '@/store/MainmenuStore'
import { useAppStore } from '@/store/app'
import { useTheme } from "vuetify";
import AuthForm from '@/components/UI/Auth-form.vue'
import OnlineUsers from '@/components/onlineUsers.vue'
import CardUsers from '@/components/cardUsers.vue'
import CardLike from '@/components/cardLike.vue'
import { pagecounter } from '@/utils/universal_functions'
export default {
components: { AuthForm, OnlineUsers, CardUsers, CardLike },
mixins: [uf],
setup() {
pagecounter()
const appStore = useAppStore()
const theme = useTheme();
const mainmenuStore = useMainmenuStore()
const accountStore = useAccountStore()
const drawer = ref(true)
const drawer_right = ref(true)
const menuGetUserDialog = ref(false)
const LikeDialog = ref(false)
const rail = ref(false)
const showTooltip = ref(false)
const menuTruncated = (menus) => {
return menus.slice(0,2).toUpperCase()
}
const toggleTheme = () => {
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark'
}
mainmenuStore.loadlinks()
const navigations = [
{
name: 'Структура',
ico: 'mdi-source-branch',
submenu: [
{
name: 'ОКиБ',
path: "/okib"
},
]
},
{
name: 'Сотрудники',
ico: 'mdi-account-multiple-outline',
submenu: [
{
name: 'Справочник',
link: 'http://10.252.44.33/accounting6/members.php'
},
]
},
{
name: 'Деятельность',
ico: 'mdi-bulletin-board',
submenu: [
{
name: 'Обеспечивающая',
path: "/providing"
}
]
},
{
name: 'Новости',
ico: 'mdi-newspaper',
path: "/news"
},
{
name: 'Безопасность',
ico: 'mdi-routes',
path: "/securyty"
},
{
name: 'О портале',
ico: 'mdi-information-variant',
path: "/portal"
},
{
name: 'Об инспекции',
ico: 'mdi-city',
path: "/inspection"
}
]
const imageSrc = computed(() => {
return new URL(`@/assets/FNS-logo-xs.png`, import.meta.url).href;
})
const getcard = async () => {
menuGetUserDialog.value = true
}
onMounted(() => {
return drawer.value = accountStore.cod2user ? true : false
})
return {
theme,
mainmenuStore,
accountStore,
drawer,
drawer_right,
toggleTheme,
navigations,
imageSrc,
getcard,
menuGetUserDialog,
LikeDialog,
// userlinks,
appStore,
rail,
showTooltip,
menuTruncated
}
}
}
</script>
<style lang="scss">
.mystat {
position: fixed;
right: 10px;
bottom: 10px;
z-index: 1005;
}
.btnNav .v-navigation-drawer__content {
display: flex;
align-items: center;
}
.railmenu .v-list-group__items .v-list-item {
padding-inline-start: 11px!important;
}
</style>
+32
View File
@@ -0,0 +1,32 @@
/**
* main.js
*
* Bootstraps Vuetify and other plugins then mounts the App`
*/
// Components
import App from './App.vue'
// Composables
import { createApp } from 'vue'
// Plugins
import { registerPlugins } from '@/plugins'
import components from '@/components/UI/index'
import Vue3Autocounter from 'vue3-autocounter';
const app = createApp(App)
components.forEach((component) => {
app.component(component.name, component);
})
app.component('vue3-autocounter', Vue3Autocounter)
// Vue.use(VueScrollTo)
registerPlugins(app)
app.mount('#app')
+19
View File
@@ -0,0 +1,19 @@
/**
* plugins/index.js
*
* Automatically included in `./src/main.js`
*/
// Plugins
import { loadFonts } from './webfontloader'
import vuetify from './vuetify'
import pinia from '../store'
import router from '../router'
export function registerPlugins (app) {
loadFonts()
app
.use(vuetify)
.use(pinia)
.use(router)
}
+62
View File
@@ -0,0 +1,62 @@
import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/styles'
import { createVuetify } from 'vuetify'
export default createVuetify({
theme: {
defaultTheme: 'light'
},
theme: {
themes: {
light: {
colors: {
lampa: '#FFFFFF',
primary: '#1867C0',
secondary: '#5CBBF6',
main_theme: "#f7f7f7",
scrollbar: '#367F8A',
cards: '#F5F5F5',
text_carous: '#242424',
navigation: '#004D40', // Цвет текста и иконок в левом навигационном меню
numeral: '#3C3C3C', // Цвет для карусели с цифрами в работе
modal_btn: '#1E88E5', // Цвет для кнопок в модальных окнах
eye_icon: '#7A7A7A', // Цвет иконки для отображения количества посещений
stars: '#F9A825', // Цвет для звездочек в обратной связи
more_details_btn: '#01579B', // Цвет для кнопки перехода "подробнее"
loading_avatar: '#37474F', // Цвет поля прогрузки аватара пользователя
bg_comments: '#FFFFFF', // Цвет заднего фона для комментариев
delete_btn: '#546E7A', // Цвет для кнопки удаления
app_bar: '#004D40', // Цвет для навигационной (аппбар) панели
back_number_carousel: '#FFFFFF',
},
},
dark: {
colors: {
lampa: '#000000',
primary: '#1867C0',
secondary: '#5CBBF6',
main_theme: "#101311",
scrollbar: '#367F8A',
cards: '#F5F5F5',
text_carous: '#242424',
navigation: '#FDF5E6',
numeral: '#3C3C3C',
modal_btn: '#1E88E5',
eye_icon: '#7A7A7A',
stars: '#F9A825',
more_details_btn: '#01579B',
loading_avatar: '#37474F',
bg_comments: '#FFFFFF',
delete_btn: '#546E7A',
app_bar: '#212121',
back_number_carousel: '#101311',
},
},
options: {
customProperties: true
},
},
},
})
+15
View File
@@ -0,0 +1,15 @@
/**
* plugins/webfontloader.js
*
* webfontloader documentation: https://github.com/typekit/webfontloader
*/
export async function loadFonts () {
const webFontLoader = await import(/* webpackChunkName: "webfontloader" */'webfontloader')
webFontLoader.load({
google: {
families: ['Roboto:100,300,400,500,700,900&display=swap'],
},
})
}
+103
View File
@@ -0,0 +1,103 @@
// Composables
import { createRouter, createWebHistory } from 'vue-router'
const routes = [
{
path: '/',
component: () => import('@/layouts/default/DefaultPortal.vue'),
children: [
{
path: '/',
name: 'HomePage',
component: () => import('@/views/HomePage.vue'),
meta:{
title:"Портал МиФНС по ЦОД №2"
}
},
{
path: '/okib',
name: 'OKiBPage',
component: () => import('@/views/nested_view/o_OKiB.vue'),
meta:{
title:"Отдел кадров и безопасности"
}
},
{
path: '/providing',
name: 'ProvidingActivitiesPage',
component: () => import('@/views/ProvidingActivitiesPage.vue'),
meta:{
title:"Обеспечивающая деятельность"
}
},
{
path: '/faq',
name: 'FAQPage',
component: () => import('@/views/FAQPage.vue'),
meta:{
title:"Часто задаваемые вопросы"
}
},
{
path: '/feedback',
name: 'FeedbackPage',
component: () => import('@/views/FeedbackPage.vue'),
meta:{
title:"Обратная связь"
}
},
{
path: '/labor',
name: 'LaborProtection',
component: () => import('@/views/LaborProtection.vue'),
meta:{
title:"Безопасность"
}
},
{
path: '/securyty',
name: 'SecurityPage',
component: () => import('@/views/SecurityPage.vue'),
meta:{
title:"Охрана труда"
}
},
{
path: '/inspection',
name: 'AboutInspectionPage',
component: () => import('@/views/AboutInspectionPage.vue'),
meta:{
title:"Об инспекции"
}
},
{
path: '/portal',
name: 'AboutPortalPage',
component: () => import('@/views/AboutPortalPage.vue'),
meta:{
title:"О портале"
}
},
{
path: '/news',
name: 'AboutNewsPage',
component: () => import('@/views/NewsPage.vue'),
meta:{
title:"Лента новостей"
}
},
],
},
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes,
})
router.beforeEach((to,from, next)=>{
document.title = to.meta.title;
next()
})
export default router
+54
View File
@@ -0,0 +1,54 @@
// Utilities
import { defineStore } from 'pinia'
import {ref, watch} from 'vue'
import { clearAxios, spravURL } from '@/utils/axios-api'
import VueJwtDecode from 'vue-jwt-decode'
import {checkremote} from '@/utils/universal_functions'
import {useAppStore} from '@/store/app.js'
export const useAccountStore = defineStore('AccountStore', () => {
const AppStore = useAppStore()
const user=ref({})
const cod2user=ref(false)
const setUser = (value)=> {
value.photo = checkremote(`${spravURL}${value.login}.jpg`)
user.value=value
console.log(value.photo, 'value.photo-------------------')
}
//
// геттер бывший
// const getUser=computed(()=> uyser.value)
const logging=async (anon)=>{
console.log(anon)
AppStore.loading = true
const result = await clearAxios.post('api/accounts/token/', anon)
// .then(result => {
localStorage.setItem('access', result.data.access)
localStorage.setItem('refresh', result.data.refresh)
let u = VueJwtDecode.decode(result.data.refresh)
u.user.photo = checkremote( `${spravURL}${u.user.login}.jpg`)
// `${spravURL}${u.user.login}.jpg`
user.value = u.user
AppStore.loading = false
}
const logout =()=>{
user.value = {}
localStorage.removeItem('access')
localStorage.removeItem('refresh')
}
watch(user, (newValue,oldValue)=>{
cod2user.value = 'login' in newValue && newValue.login.startsWith('9966-')?true:false
}, {deep:true})
return {user, setUser,cod2user,logging, logout}
})
+12
View File
@@ -0,0 +1,12 @@
import { defineStore } from 'pinia'
import {ref} from 'vue'
import { clearAxios } from '@/utils/axios-api'
export const useMainmenuStore = defineStore('MainmenuStore', () => {
const portallinks = ref([])
const loadlinks=async()=>{
const res = await clearAxios.get('api/navigation/carousels/')
portallinks.value=res.data
}
return {portallinks,loadlinks}
})
+12
View File
@@ -0,0 +1,12 @@
import { defineStore } from 'pinia'
import {ref} from 'vue'
import { clearAxios } from '@/utils/axios-api'
export const useMainmenuStore = defineStore('MainmenuStore', () => {
const portallinks = ref([])
const loadlinks=async()=>{
const res = await clearAxios.get('api/navigation/carousels/')
portallinks.value=res.data
}
return {portallinks,loadlinks}
})
+22
View File
@@ -0,0 +1,22 @@
import { defineStore } from 'pinia'
import {ref, watch} from 'vue'
import { clearAxios } from '@/utils/axios-api'
export const useMainmenuStore = defineStore('MainmenuStore', () => {
const portallinks = ref([])
// const setUser = (value)=> {links.value=value}
//
// геттер бывший
// const getUser=computed(()=> uyser.value)
// вотч
// watch(()=>movies,(state)=>{
// localStorage.setItem('movies',JSON.stringify(state)),{deep:true}
// }
// )
const loadlinks=async()=>{
const res = await clearAxios.get('api/navigation/links/')
portallinks.value=res.data
}
return {portallinks,loadlinks}
})
+13
View File
@@ -0,0 +1,13 @@
// Utilities
import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useAppStore = defineStore('app', () => {
const loading = ref(false)
const countvisitor = ref({ "totalvisit": 0,
"visittoday":0,
"uniqtoday" : 0})
return {loading,countvisitor}
},
)
+4
View File
@@ -0,0 +1,4 @@
// Utilities
import { createPinia } from 'pinia'
export default createPinia()
+27
View File
@@ -0,0 +1,27 @@
// myBtns.stories.js
import myBtns from '@/components/UI/myBtns'
//👇 This default export determines where your story goes in the story list
export default {
component: myBtns,
};
/*
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
* See https://storybook.js.org/docs/vue/api/csf
* to learn how to use render functions.
*/
export const FirstStory = {
render: (args) => ({
components: { myBtns },
setup() {
return { args };
},
template: '<myBtns v-bind="args" />',
}),
args: {
label:"Сохранить",
filled: true
},
};
+92
View File
@@ -0,0 +1,92 @@
import {useAccountStore} from '@/store/AccountStore'
import axios from "axios";
const spravURL = 'http://10.252.44.33/accounting6/images/photo/'
// const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://${window.location.host}/`;
// const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://${window.location.host}/`;
const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://10.252.44.60:9965/`;
const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://10.252.44.60:9966/`;
// для релизного меняем 'http://ukd/'
// const baseURL = 'http://127.0.0.1:8000/';
async function refreshToken() {
const refresh = localStorage.getItem('refresh');
try {
const result = await axios.post('/api/accounts/token/refresh/', {refresh}, {
baseURL
})
if (result.config.data) localStorage.setItem('refresh', JSON.parse(result.config.data).refresh);
localStorage.setItem('access', result.data.access)
return result.data.access;
}
catch(e) {
const accountStore = useAccountStore()
accountStore.logout()
accountStore.cod2user.value=false
return Promise.reject(e);
}
}
const axiosApiInstance = axios.create({
baseURL,
});
const clearAxios = axios.create({
baseURL,
});
axiosApiInstance.defaults.headers.common['Authorization'] = `Bearer ${localStorage.getItem('access')}`
axiosApiInstance.interceptors.request.use(config => {
const access = localStorage.getItem('access');
if (access) {
config.headers = {
'Authorization': `Bearer ${access}`,
}
}
return config;
}, error => {
return Promise.reject(error);
})
axiosApiInstance.interceptors.response.use(
response => {
return response;
},
async error => {
const originalRequest = error.config;
if ((error.response.status === 401 || error.response.status === 403) && !originalRequest._retry) {
originalRequest._retry = true;
try {
const token = await refreshToken();
axiosApiInstance.defaults.headers.common['Authorization'] = `Bearer ${token}`;
if (originalRequest.data){
originalRequest.data = JSON.parse(originalRequest.data); }
return axiosApiInstance(originalRequest);
} catch(e) {
//
// if (window.location.pathname!='/auth') window.location.reload()
// window.location.reload()
return Promise.reject(error);
}
}
return Promise.reject(error);
})
export { axiosApiInstance, clearAxios, baseURL,spravURL,baseWS }
@@ -0,0 +1,72 @@
const str = 'hello';
import {useAccountStore} from '@/store/AccountStore'
import {useAppStore} from '@/store/app'
import { baseURL } from '@/utils/axios-api'
import { axiosApiInstance, clearAxios } from '@/utils/axios-api'
import { useRouter } from 'vue-router'
export function getfromserver(path, reactive){
try{
axiosApiInstance.get(path).then(result => {
reactive.value = result.data})}
catch(e){
console.log(e);
}
}
export function getfromserverfree(path, reactive){
try{
clearAxios.get(path).then(result => {
reactive.value = result.data})}
catch(e){
console.log(e);
}
}
export function checkremote(filecheck){
return "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg"
// return filecheck
// try{
// let http = new XMLHttpRequest();
// http.open('HEAD', filecheck, false);
// http.send();
// console.log(http.status)
// return "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg"
// }
// catch(e){
// return "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg"
// }
// let tmp = new Image
// tmp.src=filecheck
// if(tmp.complete){
// return filecheck
// }
// else {
// }
}
export default str;
export function pagecounter(){
const router = useRouter()
const accountStore = useAccountStore()
const appStore = useAppStore()
let postdata = {user__id: "user" in accountStore && "id" in accountStore.user? accountStore.user.id: null, page: router.currentRoute.value.meta.title}
clearAxios.post(`${baseURL}api/watcher/counter/`, postdata)
.then(result => {
appStore.countvisitor = result.data})
}
@@ -0,0 +1,23 @@
<template>
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
Об инспекции
</v-col>
</v-row>
</template>
<script>
import {pagecounter} from '@/utils/universal_functions'
export default {
setup(){
pagecounter()
}
}
</script>
<style>
</style>
+91
View File
@@ -0,0 +1,91 @@
<template>
<!-- <div id="app">
<a href="#" id="return-top" v-scroll-to="'#top'">Top</a>
<div ref="top">Hi. I'm #top</div> -->
<!-- </div> -->
<v-row>
<v-col
class="ma-3"
>
<v-table density="compact" class="mt-3">
<thead>
<tr>
<th class="text-left">
Страница
</th>
<th class="text-left">
Количество посещений
</th>
</tr>
</thead>
<tbody>
<tr
v-for="item in visiting.pages"
:key="item.name"
>
<td>{{ item.page }}</td>
<td>{{ item.count__sum }}</td>
</tr>
</tbody>
</v-table>
<v-table density="compact" class="mt-3">
<thead>
<tr>
<th class="text-left">
Пользователь
</th>
<th class="text-left">
Страница
</th>
<th class="text-left">
Количество посещений
</th>
</tr>
</thead>
<tbody>
<tr
v-for="item in visiting.users"
:key="item.name"
>
<td>{{ item.user__username }}</td>
<td>{{ item.page }}</td>
<td>{{ item.count__sum }}</td>
</tr>
</tbody>
</v-table>
</v-col>
</v-row>
</template>
<script>
import { ref } from 'vue'
import {pagecounter} from '@/utils/universal_functions'
import {getfromserver} from '@/utils/universal_functions'
export default {
setup(){
pagecounter()
const visiting = ref({})
getfromserver(`api/watcher/counter/`, visiting)
return {
visiting
}
}
}
</script>
<style>
</style>
+23
View File
@@ -0,0 +1,23 @@
<template>
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
F.A.Q.
</v-col>
</v-row>
</template>
<script>
import {pagecounter} from '@/utils/universal_functions'
export default {
setup(){
pagecounter()
}
}
</script>
<style>
</style>
+23
View File
@@ -0,0 +1,23 @@
<template>
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
Обратная связь
</v-col>
</v-row>
</template>
<script>
import {pagecounter} from '@/utils/universal_functions'
export default {
setup(){
pagecounter()
}
}
</script>
<style>
</style>
+359
View File
@@ -0,0 +1,359 @@
<template>
<v-container fluid class="d-flex mx-0">
<v-row>
<v-col class="d-flex flex-column" lg=7>
<v-row class="flex-grow-0">
<v-col class="pr-0 pb-0">
<Carousel-list/>
</v-col>
</v-row>
<!-- <v-row>
<v-col class="pt-1 pr-0 pb-0 flex-col">
<Calendar-full
:initial="'listYear'"
:head=true
/>
</v-col>
</v-row> -->
<v-row>
<v-col class="pr-0 pt-0 flex-column">
<v-card class="h-100 bg-transparent pa-2 d-flex flex-column">
<v-row class="d-flex">
<v-col> <Calendar-full
/></v-col>
<v-col> <Calendar-full
:initial="'listYear'"
/>
</v-col>
</v-row>
<!-- {{appStore.countvisitor}} -->
</v-card>
</v-col>
<!-- </v-locale-provider> -->
<!-- </v-col> -->
<!-- <v-col>
<v-btn
@click="proba">
Button
</v-btn>
{{appStore.countvisitor.totalvisit}}
</v-col> -->
</v-row>
</v-col>
<v-col class="flex-column d-flex flex-grow-0 px-0" lg="2">
<v-row class="flex-grow-1 ma-0 mx-1">
<v-col class="pt-0">
<v-card v-if="t_daily.length > 0" class="h-100 flex-column" >
<v-row v-for="x in t_daily" :key="x" v-show="x.position!=6">
<v-col >
<v-card
class="ma-2 d-flex flex-column"
height="100"
elevation="0"
>
<v-card class="h-100 text-center g text-numeral bg-back_number_carousel">
<v-card-title class="statstyle py-0 text-overline font-weight-bold bg-back_number_carousel">
{{x.position__name}}
</v-card-title>
<v-card-text @click="detailRound(x.position)" class="numstyle mt-2 py-0 font-weight-bold pointer bg-back_number_carousel">
<vue3-autocounter ref='counter' :startAmount='0' :endAmount='Number(x.user__count)' :duration='2'/>
</v-card-text>
</v-card>
<!-- </v-img> -->
</v-card>
</v-col>
<v-divider/>
</v-row>
</v-card>
<v-card v-else class="h-100 d-flex justify-center bgWithoutNum">
<p class="align-self-center text-h5 text-center">Данные по сотрудникам не загружены</p>
</v-card>
</v-col>
</v-row>
<v-row class="flex-grow-0 ma-0 mx-1">
<v-col class="py-0">
<v-card class="h-100 flex-colmn"
>
<v-row class="ma-3">
<v-col
v-for="x in 6"
:key="x"
lg=6
class="pa-1"
>
<v-btn
prepend-icon="mdi-wikipedia"
block
variant="outlined"
class="ma-1"
>
Wiki
</v-btn>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</v-col>
<v-col class="d-flex flex-column pl-0 justify-space-between" lg=3>
<v-card
class="h-100 bg-transparent flex-column d-flex "
elevation="1"
>
<v-row>
<v-col cols="auto" class="pa-0">
<v-card height="93vh" class="overflow-auto ">
<News-list-home />
</v-card>
</v-col>
</v-row>
<!-- <div class="flex-grow-1 flex-column bg-red overflow-auto"> -->
<!-- <News-list-home/> -->
<!-- </div> -->
<!-- <News-list v-if="accountStore.cod2user"/> -->
</v-card>
</v-col>
</v-row>
<div class="text-center">
<v-dialog
v-model="dialogDetailRound"
width="500"
>
<v-card class="bg-white pa-3 px-0" width="550"
height="600">
<v-card
class="mx-auto overflow-auto mx-0 px-3"
width="550"
height="600"
flat
>
<v-card-title class="fixed-bar bg-white">
<v-toolbar class="bg-teal-lighten-2 ">
<!-- <my-helper :pretext="t_dailyRound"/> -->
<v-row class="ma-0">
<v-col class="pa-3 align-self-center">
<v-toolbar-title>{{t_dailyRound.position}}</v-toolbar-title>
</v-col>
<v-col lg=7 class="pa-0"> <v-textarea
v-model="searchname"
append-inner-icon="mdi-magnify"
hide-details
class="mx-2"
label="Поиск"
rows="1"
></v-textarea></v-col>
</v-row>
<!-- <v-btn variant="text" icon="mdi-magnify"></v-btn> -->
</v-toolbar>
</v-card-title>
{{ searchname}}
<div
v-for="(x, key) in t_dailyRound.daily"
:key="key"
class="px-3" >
<v-list>
<v-list-subheader>{{key}} </v-list-subheader>
</v-list>
<v-card
v-for="item in x"
:key="item"
class="bg-transparent"
density="compact"
:prepend-avatar="checkremote(`${spravURL}${item.login}.jpg`)"
:title="item.fio"
:subtitle="item.post"
variant="text"
>
</v-card>
<!-- @click="getcard" -->
</div>
</v-card>
</v-card>
</v-dialog>
</div>
</v-container>
</template>
<script>
import { ref, onMounted,watch } from 'vue'
import {useAppStore} from '@/store/app'
import {useAccountStore} from '@/store/AccountStore'
import {pagecounter} from '@/utils/universal_functions'
import NewsList from '@/components/news-list.vue'
import CarouselList from '@/components/carousel-list.vue'
import CarouselNumbers from '@/components/carousel-numbers.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import CalendarFull from '@/components/UI/Calendar-full.vue'
import NewsListHome from '@/components/news-list-home.vue'
import { spravURL } from '@/utils/axios-api'
import {checkremote} from '@/utils/universal_functions'
export default {
components: {
NewsList,
CarouselList,
CarouselNumbers,
CalendarFull,
NewsListHome
},
setup(){
const t_baseCriteria = ref([])
const t_daily = ref('')
const t_dailyRound = ref('')
const dialogDetailRound = ref(false)
const searchname = ref('')
const idpos = ref('')
onMounted(() => {
proba(),
dailyfun()
})
const appStore = useAppStore()
pagecounter()
const model= null
const accountStore = useAccountStore()
watch(()=> searchname.value,(newValue,oldValue)=>{
if(newValue){
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${idpos.value}&searchname=${newValue}`)
.then(data => {
console.log(newValue);
// t_daily.value = data.data.daily
})
}
}, {deep:true})
function proba(){
axiosApiInstance.get('api/feedback/feedbackdata/')
.then(data => {
t_baseCriteria.value = data.data.results
})
}
function dailyfun(){
axiosApiInstance.get('api/general_vacation/dailyload/')
.then(data => {
// console.log();
t_daily.value = data.data.daily
})
}
const detailRound = (pos) => {
idpos.value=pos
dialogDetailRound.value=!dialogDetailRound.value
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${pos}`)
.then(data => {
t_dailyRound.value = data.data
})
}
return {
accountStore,
model,
appStore,
proba,
t_daily,
t_dailyRound,
detailRound,
dialogDetailRound,
checkremote,
spravURL,
searchname
}
}
}
</script>
<style lang="scss">
.v-picker-title, .v-picker__header, .v-picker__actions {
display: none;
}
.pik {
height: 97%;
}
.hicard {
height: 40%!important;
overflow: auto;
}
.fg {
height: 240px;
overflow: auto;
}
.bgWithoutNum {
background: url("/src/assets/bg-for-number-carousel.png");
opacity: 0.7;
}
.fixed-bar {
position: sticky;
position: -webkit-sticky; /* for Safari */
top: 0em;
z-index: 2;
}
</style>
+23
View File
@@ -0,0 +1,23 @@
<template>
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
Охрана труда
</v-col>
</v-row>
</template>
<script>
import {pagecounter} from '@/utils/universal_functions'
export default {
setup(){
pagecounter()
}
}
</script>
<style>
</style>
+37
View File
@@ -0,0 +1,37 @@
<template>
<v-row class="justify-center ma-0 ">
<v-col
class="flex-column d-flex"
lg="6"
>
<news-list-news/>
<!-- <News-list
/> -->
</v-col>
</v-row>
</template>
<script>
import NewsList from '@/components/news-list.vue'
import {pagecounter} from '@/utils/universal_functions'
import NewsListNews from '../components/news-list-news.vue'
export default {
components: {
NewsList,
NewsListNews
},
setup(){
pagecounter()
}
}
</script>
<style>
/* .bg {
background: url("@/assets/1.jpg") center center;
} */
</style>
@@ -0,0 +1,60 @@
<template>
<v-row class="align-center">
<v-col
class="mt-4 text--lighten-1 font-weight-light"
>
<v-item-group mandatory>
<v-container>
<v-row class="justify-center ">
<v-col
v-for="n in activates"
:key="n"
cols="4"
md="2"
>
<v-item v-slot="{ isSelected, toggle }">
<v-btn
:color="isSelected ? 'primary' : ''"
class="d-flex align-center pa-6"
dark
:href="n.link"
>
<v-scroll-y-transition>
<div
class="text-h5 text-grey flex-grow-1 text-center"
>
{{n.name}}
</div>
</v-scroll-y-transition>
</v-btn>
</v-item>
</v-col>
</v-row>
</v-container>
</v-item-group>
</v-col>
</v-row>
</template>
<script>
import {pagecounter} from '@/utils/universal_functions'
export default {
setup(){
pagecounter()
const activates = [
{name: 'Комиссии', link: 'http://10.252.44.33/accounting6/SOTRYDNIKI.php#tab_committees'},
{name: 'Ответственность', link: 'http://10.252.44.33/accounting6/SOTRYDNIKI.php#tab_departments'},
]
return {activates}
}
}
</script>
<style>
</style>
+23
View File
@@ -0,0 +1,23 @@
<template>
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
Безопасность
</v-col>
</v-row>
</template>
<script>
import {pagecounter} from '@/utils/universal_functions'
export default {
setup(){
pagecounter()
}
}
</script>
<style>
</style>
+32
View File
@@ -0,0 +1,32 @@
<template>
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
Структура
</v-col>
</v-row>
<!-- <div>
<a href="#" v-scroll-to="'#element'">Scroll to #element</a>
<div ref="element">
Hi. I'm #element.
</div>
</div> -->
</template>
<script>
import {pagecounter} from '@/utils/universal_functions'
export default {
setup(){
pagecounter()
}
}
</script>
<style>
</style>
+108
View File
@@ -0,0 +1,108 @@
<template>
<v-row class="justify-center">
<v-col cols="6"
class="text-h6 text-grey text-center d-flex align-baseline align-self-center text--lighten-1 font-weight-light"
>
{{t_dailyRound}}
<v-btn @click="detailRound">
Тык
</v-btn>
<v-btn
class="mr-2"
color="modal_btn"
@click="excelOp"
>
Скачать
</v-btn>
<!-- <v-spacer></v-spacer> -->
<v-file-input
:rules="[val => (!!val && val.length > 0) || 'Добавьте файл']"
accept=".xlsx"
v-model="dailyfiles"
variant="underlined"
density="compact"
label="Выберите файл"
class="mr-2"></v-file-input>
<!-- <v-spacer></v-spacer> -->
<v-btn
color="modal_btn"
@click="onPickFile">
Загрузить
</v-btn>
</v-col>
</v-row>
</template>
<script>
import { ref } from 'vue'
import { baseURL } from '@/utils/axios-api'
import {getfromserver} from '@/utils/universal_functions'
import { axiosApiInstance } from '@/utils/axios-api'
export default {
setup(){
const dailyfiles = ref('')
const visiting = ref({})
const info = ref({})
const t_dailyRound = ref('')
const excelOp = () => {
axiosApiInstance.get(`api/general_vacation/dailyroundup/`).then(result => {
let link = document.createElement("a")
link.href = baseURL+result.data.path
link.click()
link.remove()
})
}
const onPickFile = () => {
const sdata = new FormData()
sdata.append('dailyfiles', dailyfiles.value[0])
axiosApiInstance.post(`api/general_vacation/dailyroundup/`, sdata).then(result => {
info.value = result.data
console.log(result.data, '----------------')
})
}
const detailRound = () => {
axiosApiInstance.get(`api/general_vacation/dailyload/?id=6`)
.then(data => {
console.log(data.data);
t_dailyRound.value = data.data
})
}
return {
visiting,
excelOp,
baseURL,
dailyfiles,
onPickFile,
info,
detailRound,
t_dailyRound
}
}
}
</script>
<style>
</style>
+38
View File
@@ -0,0 +1,38 @@
// Plugins
import vue from '@vitejs/plugin-vue'
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
// Utilities
import { defineConfig } from 'vite'
import { fileURLToPath, URL } from 'node:url'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue({
template: { transformAssetUrls }
}),
// https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vite-plugin
vuetify({
autoImport: true,
}),
],
define: { 'process.env': {} },
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
extensions: [
'.js',
'.json',
'.jsx',
'.mjs',
'.ts',
'.tsx',
'.vue',
],
},
server: {
port: 3000,
},
})