├── .browserslistrc ├── .eslintrc.js ├── .gitignore ├── README.md ├── babel.config.js ├── docker-compose.yaml ├── package-lock.json ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── components │ ├── ImageUpload.vue │ ├── Menu.vue │ ├── Nav.vue │ └── Paginator.vue ├── main.ts ├── models │ ├── permission.ts │ ├── product.ts │ ├── role.ts │ └── user.ts ├── pages │ ├── Dashboard.vue │ ├── Login.vue │ ├── Profile.vue │ ├── Register.vue │ ├── Wrapper.vue │ ├── orders │ │ └── Orders.vue │ ├── products │ │ ├── ProductCreate.vue │ │ ├── ProductEdit.vue │ │ └── Products.vue │ ├── roles │ │ ├── RoleCreate.vue │ │ ├── RoleEdit.vue │ │ └── Roles.vue │ └── users │ │ ├── UserCreate.vue │ │ ├── UserEdit.vue │ │ └── Users.vue ├── router │ └── index.ts ├── shims-vue.d.ts └── store │ ├── UserModule.ts │ └── index.ts └── tsconfig.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/vue3-essential', 8 | 'eslint:recommended', 9 | '@vue/typescript/recommended' 10 | ], 11 | parserOptions: { 12 | ecmaVersion: 2020 13 | }, 14 | rules: { 15 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 16 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 17 | "@typescript-eslint/camelcase": "off" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-admin 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Lints and fixes files 19 | ``` 20 | npm run lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | services: 3 | backend: 4 | image: antoniopapa1991/backend 5 | environment: 6 | DB_HOST: db 7 | DB_DATABASE: admin 8 | DB_USERNAME: root 9 | DB_PASSWORD: root 10 | ports: 11 | - 8000:8000 12 | depends_on: 13 | - db 14 | 15 | db: 16 | image: mysql:5.7.22 17 | restart: always 18 | environment: 19 | MYSQL_DATABASE: admin 20 | MYSQL_USER: root 21 | MYSQL_PASSWORD: root 22 | MYSQL_ROOT_PASSWORD: root 23 | volumes: 24 | - .dbdata:/var/lib/mysql 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-admin", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "@types/axios": "^0.14.0", 12 | "@types/c3": "^0.7.5", 13 | "axios": "^0.21.1", 14 | "c3": "^0.7.20", 15 | "core-js": "^3.6.5", 16 | "vue": "^3.0.0", 17 | "vue-router": "^4.0.0-0", 18 | "vuex": "^4.0.0-0" 19 | }, 20 | "devDependencies": { 21 | "@typescript-eslint/eslint-plugin": "^2.33.0", 22 | "@typescript-eslint/parser": "^2.33.0", 23 | "@vue/cli-plugin-babel": "~4.5.0", 24 | "@vue/cli-plugin-eslint": "~4.5.0", 25 | "@vue/cli-plugin-router": "~4.5.0", 26 | "@vue/cli-plugin-typescript": "~4.5.0", 27 | "@vue/cli-plugin-vuex": "~4.5.0", 28 | "@vue/cli-service": "~4.5.0", 29 | "@vue/compiler-sfc": "^3.0.0", 30 | "@vue/eslint-config-typescript": "^5.0.2", 31 | "eslint": "^6.7.2", 32 | "eslint-plugin-vue": "^7.0.0-0", 33 | "typescript": "~3.9.3" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniopapa/vue-frontend/e5b7f1009660472ea348260e7dac45c7084aa72c/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 11 | 12 | 13 | 17 |
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 107 | -------------------------------------------------------------------------------- /src/components/ImageUpload.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 32 | -------------------------------------------------------------------------------- /src/components/Menu.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 40 | -------------------------------------------------------------------------------- /src/components/Nav.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 40 | 41 | -------------------------------------------------------------------------------- /src/components/Paginator.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 48 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import {createApp} from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import axios from 'axios'; 6 | 7 | axios.defaults.baseURL = 'http://localhost:8000/api/'; 8 | axios.defaults.withCredentials = true; 9 | 10 | createApp(App).use(store).use(router).mount('#app') 11 | -------------------------------------------------------------------------------- /src/models/permission.ts: -------------------------------------------------------------------------------- 1 | export class Permission { 2 | constructor( 3 | public id: number, 4 | public name: string 5 | ) { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/models/product.ts: -------------------------------------------------------------------------------- 1 | export class Product { 2 | constructor( 3 | id: number, 4 | title: string, 5 | description: string, 6 | image: string, 7 | price: number 8 | ) { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/models/role.ts: -------------------------------------------------------------------------------- 1 | export class Role { 2 | constructor( 3 | public id: number = 0, 4 | public name: string = '' 5 | ) { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/models/user.ts: -------------------------------------------------------------------------------- 1 | import {Role} from "@/models/role"; 2 | 3 | export class User { 4 | constructor( 5 | public id: number = 0, 6 | public first_name: string = '', 7 | public last_name: string = '', 8 | public email: string = '', 9 | public role: Role = new Role() 10 | ) { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/pages/Dashboard.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 50 | -------------------------------------------------------------------------------- /src/pages/Login.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 45 | 46 | 95 | -------------------------------------------------------------------------------- /src/pages/Profile.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 82 | 83 | -------------------------------------------------------------------------------- /src/pages/Register.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 59 | 60 | 109 | -------------------------------------------------------------------------------- /src/pages/Wrapper.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 45 | -------------------------------------------------------------------------------- /src/pages/orders/Orders.vue: -------------------------------------------------------------------------------- 1 | 63 | 64 | 108 | 109 | 120 | -------------------------------------------------------------------------------- /src/pages/products/ProductCreate.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 58 | -------------------------------------------------------------------------------- /src/pages/products/ProductEdit.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 68 | -------------------------------------------------------------------------------- /src/pages/products/Products.vue: -------------------------------------------------------------------------------- 1 | 39 | 40 | 79 | -------------------------------------------------------------------------------- /src/pages/roles/RoleCreate.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 71 | -------------------------------------------------------------------------------- /src/pages/roles/RoleEdit.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 82 | -------------------------------------------------------------------------------- /src/pages/roles/Roles.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 62 | -------------------------------------------------------------------------------- /src/pages/users/UserCreate.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 66 | -------------------------------------------------------------------------------- /src/pages/users/UserEdit.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 74 | -------------------------------------------------------------------------------- /src/pages/users/Users.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 76 | -------------------------------------------------------------------------------- /src/router/index.ts: -------------------------------------------------------------------------------- 1 | import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router' 2 | import Dashboard from '@/pages/Dashboard.vue'; 3 | import Register from '@/pages/Register.vue'; 4 | import Wrapper from '@/pages/Wrapper.vue'; 5 | import Login from '@/pages/Login.vue'; 6 | import Users from '@/pages/users/Users.vue'; 7 | import UserCreate from '@/pages/users/UserCreate.vue'; 8 | import UserEdit from '@/pages/users/UserEdit.vue'; 9 | import Roles from '@/pages/roles/Roles.vue'; 10 | import RoleCreate from '@/pages/roles/RoleCreate.vue'; 11 | import RoleEdit from '@/pages/roles/RoleEdit.vue'; 12 | import Products from '@/pages/products/Products.vue'; 13 | import ProductCreate from '@/pages/products/ProductCreate.vue'; 14 | import ProductEdit from '@/pages/products/ProductEdit.vue'; 15 | import Orders from '@/pages/orders/Orders.vue'; 16 | import Profile from '@/pages/Profile.vue'; 17 | 18 | const routes: Array = [ 19 | {path: '/register', component: Register}, 20 | {path: '/login', component: Login}, 21 | { 22 | path: '', 23 | component: Wrapper, 24 | children: [ 25 | {path: '', component: Dashboard}, 26 | {path: '/profile', component: Profile}, 27 | {path: '/users', component: Users}, 28 | {path: '/users/create', component: UserCreate}, 29 | {path: '/users/:id/edit', component: UserEdit}, 30 | {path: '/roles', component: Roles}, 31 | {path: '/roles/create', component: RoleCreate}, 32 | {path: '/roles/:id/edit', component: RoleEdit}, 33 | {path: '/products', component: Products}, 34 | {path: '/products/create', component: ProductCreate}, 35 | {path: '/products/:id/edit', component: ProductEdit}, 36 | {path: '/orders', component: Orders}, 37 | ] 38 | } 39 | ] 40 | 41 | const router = createRouter({ 42 | history: createWebHistory(process.env.BASE_URL), 43 | routes 44 | }) 45 | 46 | export default router 47 | -------------------------------------------------------------------------------- /src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | declare module '*.vue' { 3 | import type { DefineComponent } from 'vue' 4 | const component: DefineComponent<{}, {}, any> 5 | export default component 6 | } 7 | -------------------------------------------------------------------------------- /src/store/UserModule.ts: -------------------------------------------------------------------------------- 1 | import {User} from "@/models/user"; 2 | import {Commit} from "vuex"; 3 | 4 | export default { 5 | namespaced: true, 6 | state: { 7 | user: new User() 8 | }, 9 | mutations: { 10 | SET_USER: (state: { user: User }, user: User) => state.user = user 11 | }, 12 | actions: { 13 | setUser: ({commit}: { commit: Commit }, user: User) => commit('SET_USER', user) 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /src/store/index.ts: -------------------------------------------------------------------------------- 1 | import {createStore} from 'vuex' 2 | import UserModule from "@/store/UserModule"; 3 | 4 | export default createStore({ 5 | state: {}, 6 | mutations: {}, 7 | actions: {}, 8 | modules: { 9 | User: UserModule 10 | } 11 | }) 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "strict": true, 6 | "jsx": "preserve", 7 | "importHelpers": true, 8 | "moduleResolution": "node", 9 | "skipLibCheck": true, 10 | "esModuleInterop": true, 11 | "allowSyntheticDefaultImports": true, 12 | "sourceMap": true, 13 | "baseUrl": ".", 14 | "types": [ 15 | "webpack-env" 16 | ], 17 | "paths": { 18 | "@/*": [ 19 | "src/*" 20 | ] 21 | }, 22 | "lib": [ 23 | "esnext", 24 | "dom", 25 | "dom.iterable", 26 | "scripthost" 27 | ] 28 | }, 29 | "include": [ 30 | "src/**/*.ts", 31 | "src/**/*.tsx", 32 | "src/**/*.vue", 33 | "tests/**/*.ts", 34 | "tests/**/*.tsx" 35 | ], 36 | "exclude": [ 37 | "node_modules" 38 | ] 39 | } 40 | --------------------------------------------------------------------------------