├── public ├── robots.txt ├── favicon.ico ├── img │ └── icons │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── mstile-150x150.png │ │ ├── apple-touch-icon.png │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── apple-touch-icon-120x120.png │ │ ├── apple-touch-icon-152x152.png │ │ ├── apple-touch-icon-180x180.png │ │ ├── apple-touch-icon-60x60.png │ │ ├── apple-touch-icon-76x76.png │ │ ├── msapplication-icon-144x144.png │ │ └── safari-pinned-tab.svg ├── manifest.json └── index.html ├── .browserslistrc ├── .env ├── jsconfig.json ├── postcss.config.js ├── .env.development ├── babel.config.js ├── src ├── assets │ └── logo.png ├── plugins │ ├── custom.js │ ├── fortawesome.js │ ├── dialog │ │ └── index.js │ └── vue-material.js ├── store │ ├── mutation-types.js │ └── store.js ├── api │ ├── format.js │ ├── category.js │ ├── auth.js │ ├── book.js │ └── ajax.js ├── main.js ├── const.js ├── router │ └── router.js ├── registerServiceWorker.js ├── App.vue ├── components │ ├── ConfirmDialog.vue │ └── ViewBase.vue └── views │ ├── AboutView.vue │ ├── CreateCard.vue │ ├── HomeView.vue │ ├── LoginView.vue │ └── EditCard.vue ├── .github ├── pull_request_template.md ├── dependabot.yml ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── workflows │ ├── release.yml │ └── check.yml ├── .gitignore ├── .eslintrc.js ├── vue.config.js ├── package.json ├── LICENSE ├── CONTRIBUTING.md └── README.md /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not ie <= 8 4 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # environment variables for common 2 | 3 | VUE_APP_API_ROOT=/ -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "./src/**/*" 4 | ] 5 | } -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.env.development: -------------------------------------------------------------------------------- 1 | # environment variables for development 2 | 3 | VUE_APP_API_ROOT=http://localhost:8080 -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/src/assets/logo.png -------------------------------------------------------------------------------- /src/plugins/custom.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Dialog from '@/plugins/dialog' 3 | 4 | Vue.use(Dialog) -------------------------------------------------------------------------------- /public/img/icons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/favicon-16x16.png -------------------------------------------------------------------------------- /public/img/icons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/favicon-32x32.png -------------------------------------------------------------------------------- /public/img/icons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/mstile-150x150.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/apple-touch-icon.png -------------------------------------------------------------------------------- /public/img/icons/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/android-chrome-192x192.png -------------------------------------------------------------------------------- /public/img/icons/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/android-chrome-512x512.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /public/img/icons/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /public/img/icons/msapplication-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spider-yamet/vuejs-webapp-sample/HEAD/public/img/icons/msapplication-icon-144x144.png -------------------------------------------------------------------------------- /src/store/mutation-types.js: -------------------------------------------------------------------------------- 1 | export const GET_LOGIN_ACCOUNT = 'GET_LOGIN_ACCOUNT' 2 | export const GET_CATEGORY = 'GET_CATEGORY' 3 | export const GET_FORMAT = 'GET_FORMAT' -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Fixes #[ISSUE NUMBER]. 2 | 3 | Changes proposed in this pull request: 4 | 5 | - ... 6 | - ... 7 | - ... 8 | 9 | by [YOUR NAME] 10 | -------------------------------------------------------------------------------- /src/api/format.js: -------------------------------------------------------------------------------- 1 | import Ajax from '@/api/ajax.js' 2 | import { ApiFormat } from '@/const.js' 3 | 4 | export default { 5 | list(success) { 6 | Ajax.get(ApiFormat, {}, success, () => false) 7 | } 8 | } -------------------------------------------------------------------------------- /src/api/category.js: -------------------------------------------------------------------------------- 1 | import Ajax from '@/api/ajax.js' 2 | import { ApiCategory } from '@/const.js' 3 | 4 | export default { 5 | list(success) { 6 | Ajax.get(ApiCategory, {}, success, () => false) 7 | } 8 | } -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | - package-ecosystem: github-actions 8 | directory: "/" 9 | schedule: 10 | interval: daily -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[NEW]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Purpose 11 | > What is it necessary for? 12 | 13 | ## Expected behavior 14 | Expected the follwing behavior. 15 | 16 | ## How to deal with this issue 17 | > How do you fix it? 18 | 19 | ## Notes 20 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from '@/App.vue' 3 | import router from '@/router/router' 4 | import store from '@/store/store' 5 | import '@/registerServiceWorker' 6 | 7 | import '@/plugins/vue-material' 8 | import '@/plugins/fortawesome' 9 | import '@/plugins/custom' 10 | 11 | Vue.config.productionTip = false 12 | 13 | new Vue({ 14 | router, 15 | store, 16 | render: h => h(App) 17 | }).$mount('#app') 18 | -------------------------------------------------------------------------------- /src/plugins/fortawesome.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | import { library } from '@fortawesome/fontawesome-svg-core' 4 | import { faSignOutAlt } from '@fortawesome/free-solid-svg-icons' 5 | import { faGithub } from '@fortawesome/free-brands-svg-icons' 6 | import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' 7 | 8 | library.add(faGithub) 9 | library.add(faSignOutAlt) 10 | Vue.component('font-awesome-icon', FontAwesomeIcon) -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | 'eslint:recommended' 9 | ], 10 | rules: { 11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 13 | }, 14 | parserOptions: { 15 | parser: 'babel-eslint' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/api/auth.js: -------------------------------------------------------------------------------- 1 | import Ajax from '@/api/ajax.js' 2 | import { apiAuth } from '@/const.js' 3 | 4 | export default { 5 | loginStatus(success, failure) { 6 | Ajax.get(apiAuth.LoginStatus, {}, success, failure) 7 | }, 8 | loginAccount(success) { 9 | Ajax.get(apiAuth.LoginAccount, {}, success, () => false) 10 | }, 11 | login(data, success, failure) { 12 | Ajax.post(apiAuth.Login, data, success, failure) 13 | }, 14 | logout(success) { 15 | Ajax.post(apiAuth.Logout, {}, success, () => false) 16 | } 17 | } -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vuejs-webapp-sample", 3 | "short_name": "vuejs-webapp-sample", 4 | "icons": [ 5 | { 6 | "src": "./img/icons/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "./img/icons/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "start_url": "./index.html", 17 | "display": "standalone", 18 | "background_color": "#000000", 19 | "theme_color": "#4DBA87" 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | on: 3 | push: 4 | tags: 5 | - "v[0-9]+.[0-9]+.[0-9]+" 6 | jobs: 7 | Release: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3.2.0 11 | with: 12 | fetch-depth: 50 13 | - uses: notlmn/release-with-changelog@v3.6.1 14 | with: 15 | token: ${{ secrets.GITHUB_TOKEN }} 16 | exclude: '^polish|^bump|^typo' 17 | commit-template: '- {hash} {title}' 18 | template: | 19 | ### Changelog 20 | 21 | {commits} 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Summary 11 | > Write the actual behavior and the purpose to modify. 12 | 13 | ## Cause 14 | > Why such a problem happened? 15 | 16 | ### To reproduce 17 | Perform the follwing steps to reproduce the problem. 18 | 19 | 1. … 20 | 1. … 21 | 22 | ## Expected behavior 23 | Expected the follwing behavior. 24 | 25 | ## How to deal with this issue 26 | > How do you fix it? 27 | 28 | ## Notes 29 | -------------------------------------------------------------------------------- /src/const.js: -------------------------------------------------------------------------------- 1 | 2 | export const AppInfo = { 3 | AppName: "vuejs-webapp-sample", 4 | AppDeveloper: "ybkuroki", 5 | GithubLink: "https://github.com/ybkuroki/vuejs-webapp-sample" 6 | }; 7 | 8 | const api = "/api" 9 | const apiAuthBase = api + "/auth" 10 | 11 | export const ApiBook = api + "/books" 12 | export const ApiCategory = api + "/categories" 13 | export const ApiFormat = api + "/formats" 14 | 15 | export const apiAuth = { 16 | LoginStatus: apiAuthBase + "/loginStatus", 17 | LoginAccount: apiAuthBase + "/loginAccount", 18 | Login: apiAuthBase + "/login", 19 | Logout: apiAuthBase + "/logout" 20 | } -------------------------------------------------------------------------------- /src/plugins/dialog/index.js: -------------------------------------------------------------------------------- 1 | import Confirm from '@/components/ConfirmDialog.vue' 2 | 3 | export default class Dialog { 4 | static install(Vue) { 5 | Vue.mixin({ 6 | methods: { 7 | $confirm(message) { 8 | return new Promise((resolve) => { 9 | const VM = Vue.extend(Confirm); 10 | new VM({ 11 | propsData: { 12 | message, 13 | success: () => resolve(true), 14 | failure: () => resolve(false), 15 | } 16 | }) 17 | }) 18 | } 19 | } 20 | }) 21 | } 22 | } -------------------------------------------------------------------------------- /src/api/book.js: -------------------------------------------------------------------------------- 1 | import Ajax from '@/api/ajax.js' 2 | import { ApiBook } from '@/const.js' 3 | 4 | export default { 5 | get(data, success) { 6 | Ajax.get(ApiBook + `/${data.id}`, "", success, () => false) 7 | }, 8 | search(data, success) { 9 | Ajax.get(ApiBook, data, success, () => false) 10 | }, 11 | create(data, success, failure) { 12 | Ajax.post(ApiBook, data, success, failure) 13 | }, 14 | edit(data, success, failure) { 15 | Ajax.put(ApiBook + `/${data.id}`, data, success, failure) 16 | }, 17 | delete(data, success) { 18 | Ajax.delete(ApiBook + `/${data}`, "", success, () => false) 19 | } 20 | } -------------------------------------------------------------------------------- /src/plugins/vue-material.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | import { 4 | MdApp, MdButton, MdCard, MdContent, MdDrawer, 5 | MdField, MdIcon, MdSnackbar, MdSpeedDial, MdToolbar, 6 | MdProgress, MdList, MdSubheader, MdMenu, MdDialog, MdDialogConfirm 7 | } from 'vue-material/dist/components' 8 | import 'vue-material/dist/vue-material.min.css' 9 | import 'vue-material/dist/theme/default.css' 10 | 11 | Vue.use(MdApp) 12 | Vue.use(MdButton) 13 | Vue.use(MdCard) 14 | Vue.use(MdContent) 15 | Vue.use(MdDrawer) 16 | Vue.use(MdField) 17 | Vue.use(MdIcon) 18 | Vue.use(MdSnackbar) 19 | Vue.use(MdSpeedDial) 20 | Vue.use(MdToolbar) 21 | Vue.use(MdProgress) 22 | Vue.use(MdList) 23 | Vue.use(MdSubheader) 24 | Vue.use(MdMenu) 25 | Vue.use(MdDialog) 26 | Vue.use(MdDialogConfirm) 27 | -------------------------------------------------------------------------------- /src/router/router.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Login from '@/views/LoginView.vue' 4 | import Home from '@/views/HomeView.vue' 5 | import About from '@/views/AboutView.vue' 6 | 7 | Vue.use(Router) 8 | 9 | var router = new Router({ 10 | base: process.env.BASE_URL, 11 | routes: [ 12 | { path: '/login', component: Login, meta: { anonymous: true } }, 13 | { path: '/home', name: 'home', component: Home }, 14 | { path: '/about', name: 'about', component: About }, 15 | { path: '/*', redirect: '/home' } 16 | ] 17 | }) 18 | 19 | router.beforeEach((to, from, next) => { 20 | if (to.matched.some(m => m.meta.anonymous)) { 21 | next() 22 | } else { 23 | Vue.nextTick(() => router.app.$children[0].checkLogin(to, from, next)) 24 | } 25 | }) 26 | export default router -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | devServer: { 3 | port: 3000 4 | }, 5 | productionSourceMap: false, 6 | pwa: { 7 | workboxPluginMode: 'GenerateSW', 8 | workboxOptions: { 9 | cacheId: 'vuejs-webapp-sample', 10 | swDest: 'service-worker.js', 11 | clientsClaim: true, 12 | runtimeCaching: [ 13 | { 14 | urlPattern: new RegExp('/api/*'), 15 | handler: 'NetworkFirst', 16 | options: { 17 | cacheName: 'api', 18 | expiration: { 19 | maxAgeSeconds: 60 * 60 * 24 20 | }, 21 | fetchOptions: { 22 | mode: 'cors', 23 | }, 24 | matchOptions: { 25 | ignoreSearch: true, 26 | }, 27 | } 28 | } 29 | ] 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /.github/workflows/check.yml: -------------------------------------------------------------------------------- 1 | name: check 2 | 3 | on: 4 | pull_request: 5 | branches: [ master ] 6 | 7 | jobs: 8 | check: 9 | name: check 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | node-version: [14.x] 14 | steps: 15 | - uses: actions/checkout@v3.2.0 16 | - name: eslint review 17 | uses: reviewdog/action-eslint@v1.17 18 | with: 19 | github_token: ${{ secrets.github_token }} 20 | reporter: github-pr-review 21 | eslint_flags: 'src/**/*.{vue,js}' 22 | - name: use Node.js ${{ matrix.node-version }} 23 | uses: actions/setup-node@v3.5.1 24 | with: 25 | node-version: ${{ matrix.node-version }} 26 | - name: install package 27 | run: npm install 28 | - name: build vue code 29 | run: npm run build -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 |{{ book.category.name }}
37 |{{ book.format.name }}
38 |