From 6151aa392d80eb5058db2d54431514ba0336164e Mon Sep 17 00:00:00 2001 From: Dariiiii Date: Sat, 7 Dec 2024 20:13:35 +0300 Subject: [PATCH] front update --- backend/app/routes/auth_routes.py | 3 +- frontend/Dockerfile | 4 +- frontend/package.json | 10 +- frontend/src/components/NavBar.vue | 2 + frontend/src/router/index.js | 2 + frontend/src/views/admin/Main.vue | 1 - frontend/src/views/admin/Statistics.vue | 210 ++++++++++++++++++++++++ frontend/src/views/client/Profile.vue | 19 ++- frontend/src/views/client/Request.vue | 81 ++++++--- 9 files changed, 293 insertions(+), 39 deletions(-) create mode 100644 frontend/src/views/admin/Statistics.vue diff --git a/backend/app/routes/auth_routes.py b/backend/app/routes/auth_routes.py index 59d3d3b..f05c66d 100644 --- a/backend/app/routes/auth_routes.py +++ b/backend/app/routes/auth_routes.py @@ -24,7 +24,8 @@ def login(): return jsonify({"message": "Admin logged in successfully", "userId": str(admin.id), "userType": "admin", - "token": token}), 200 + "token": token, + "userName": admin.name}), 200 print(client.password, password) if client and client.password == password: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 0744150..fea05af 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,5 +1,7 @@ FROM node:14.21.3 WORKDIR /app -COPY . . +COPY package*.json ./ RUN npm install +COPY . . +RUN npm run build CMD ["npm", "run", "serve"] \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 3d5119a..ca64db6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,9 +8,13 @@ "dependencies": { "axios": "^0.21.1", "vue": "^3.0.0", - "vue-router": "^4.0.0" + "vue-router": "^4.0.0", + "chart.js": "^3.7.1" }, "devDependencies": { - "@vue/cli-service": "~4.5.0" + "@vue/cli-service": "~4.5.0", + "@babel/core": "^7.15.0", + "@babel/preset-env": "^7.15.0", + "babel-loader": "^8.2.2" } -} \ No newline at end of file +} diff --git a/frontend/src/components/NavBar.vue b/frontend/src/components/NavBar.vue index d8f383b..299f5a1 100644 --- a/frontend/src/components/NavBar.vue +++ b/frontend/src/components/NavBar.vue @@ -5,7 +5,9 @@
  • SCAM-BANK
  • Кредиты
  • Заявки
  • +
  • Cтатистика
  • Заявки
  • +
  • История
  • {{ userName }}
  • {{ userName }}
  • Выход
  • diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index c2a9302..79e9704 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -9,6 +9,7 @@ import AdminRequest from '../views/admin/Request.vue'; import ClientProfile from '../views/client/Profile.vue'; import AdminProfile from '../views/admin/Profile.vue'; import ClientLoanApplication from '../views/client/LoanApplication.vue'; +import Statistics from '../views/admin/Statistics.vue'; const routes = [ // { path: '/', redirect: '/login' }, @@ -21,6 +22,7 @@ const routes = [ { path: '/admin/request', component: AdminRequest }, { path: '/client/profile', component: ClientProfile }, { path: '/admin/profile', component: AdminProfile }, + { path: '/admin/statistics', component: Statistics }, { path: '/client/loan-application', component: ClientLoanApplication }, ]; diff --git a/frontend/src/views/admin/Main.vue b/frontend/src/views/admin/Main.vue index 7abdc33..b4523b4 100644 --- a/frontend/src/views/admin/Main.vue +++ b/frontend/src/views/admin/Main.vue @@ -1,7 +1,6 @@