├── static
└── .gitkeep
├── config
├── prod.env.js
├── dev.env.js
└── index.js
├── src
├── assets
│ ├── logo.png
│ └── loginbg.jpg
├── components
│ ├── home
│ │ └── AppIndex.vue
│ ├── HelloWorld.vue
│ └── Login.vue
├── App.vue
├── store
│ └── index.js
├── router
│ └── index.js
└── main.js
├── .editorconfig
├── .gitignore
├── .babelrc
├── .postcssrc.js
├── index.html
├── README.md
└── package.json
/static/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/config/prod.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | module.exports = {
3 | NODE_ENV: '"production"'
4 | }
5 |
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/java-fancl/picture-vue/HEAD/src/assets/logo.png
--------------------------------------------------------------------------------
/src/assets/loginbg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/java-fancl/picture-vue/HEAD/src/assets/loginbg.jpg
--------------------------------------------------------------------------------
/config/dev.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const merge = require('webpack-merge')
3 | const prodEnv = require('./prod.env')
4 |
5 | module.exports = merge(prodEnv, {
6 | NODE_ENV: '"development"'
7 | })
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | /dist/
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Editor directories and files
9 | .idea
10 | .vscode
11 | *.suo
12 | *.ntvs*
13 | *.njsproj
14 | *.sln
15 |
--------------------------------------------------------------------------------
/src/components/home/AppIndex.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | hello world!
4 |
5 |
6 |
7 |
12 |
13 |
16 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false,
5 | "targets": {
6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7 | }
8 | }],
9 | "stage-2"
10 | ],
11 | "plugins": ["transform-vue-jsx", "transform-runtime"]
12 | }
13 |
--------------------------------------------------------------------------------
/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | "postcss-import": {},
6 | "postcss-url": {},
7 | // to edit target browsers: use "browserslist" field in package.json
8 | "autoprefixer": {}
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | picture-vue
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
13 |
14 |
23 |
--------------------------------------------------------------------------------
/src/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex)
5 |
6 | export default new Vuex.Store({
7 | state: {
8 | user: {
9 | username: window.localStorage.getItem('user' || '[]') == null ? '' : JSON.parse(window.localStorage.getItem('user' || '[]')).username
10 | }
11 | },
12 | mutations: {
13 | login (state, user) {
14 | state.user = user
15 | window.localStorage.setItem('user', JSON.stringify(user))
16 | }
17 | }
18 | })
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # picture-vue
2 |
3 | > A Vue.js project
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8080
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 |
17 | # build for production and view the bundle analyzer report
18 | npm run build --report
19 | ```
20 |
21 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
22 |
--------------------------------------------------------------------------------
/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 |
4 | // 导入自定义页面
5 | import AppIndex from "@/components/home/AppIndex"
6 | import Login from "@/components/Login";
7 |
8 | Vue.use(Router)
9 |
10 | export default new Router({
11 | mode: 'history', // history 模式 , 默认为hash模式
12 | routes: [
13 | {
14 | path: '/login',
15 | name: 'Login',
16 | component: Login
17 | },
18 | {
19 | path: '/index',
20 | name: 'AppIndex',
21 | component:AppIndex,
22 | meta: {
23 | requireAuth: true
24 | }
25 | }
26 | ]
27 | })
28 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | // The Vue build version to load with the `import` command
2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 | import Vue from 'vue'
4 | import App from './App'
5 | import router from './router'
6 | import ElementUI from 'element-ui'
7 | import 'element-ui/lib/theme-chalk/index.css'
8 | import store from './store'
9 |
10 | // 设置反向代理,前端请求默认发送到http://localhost:8443/api
11 | var axios = require('axios')
12 | axios.defaults.baseURL = 'http://localhost:8443/api'
13 | // 全局组件,之后可在其他组件中通过this.$axios 发送数据
14 | Vue.prototype.$axios = axios
15 |
16 | Vue.config.productionTip = false
17 |
18 | Vue.use(ElementUI)
19 |
20 | router.beforeEach((to, from, next) => {
21 | if (to.meta.requireAuth) {
22 | if (store.state.user.username) {
23 | next()
24 | } else {
25 | next({
26 | path: 'login',
27 | query: {redirect: to.fullPath}
28 | })
29 | }
30 | } else {
31 | next()
32 | }
33 | }
34 | )
35 | /* eslint-disable no-new */
36 | new Vue({
37 | el: '#app',
38 | render: h => h(App),
39 | router,
40 | store,
41 | components: { App },
42 | template: ''
43 | })
44 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "picture-vue",
3 | "version": "1.0.0",
4 | "description": "A Vue.js project",
5 | "author": "java-fancl ",
6 | "private": true,
7 | "scripts": {
8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
9 | "start": "npm run dev",
10 | "build": "node build/build.js"
11 | },
12 | "dependencies": {
13 | "axios": "^0.19.2",
14 | "element-ui": "^2.13.0",
15 | "vue": "^2.5.2",
16 | "vue-router": "^3.0.1",
17 | "vuex": "^3.1.3"
18 | },
19 | "devDependencies": {
20 | "autoprefixer": "^7.1.2",
21 | "babel-core": "^6.22.1",
22 | "babel-helper-vue-jsx-merge-props": "^2.0.3",
23 | "babel-loader": "^7.1.1",
24 | "babel-plugin-syntax-jsx": "^6.18.0",
25 | "babel-plugin-transform-runtime": "^6.22.0",
26 | "babel-plugin-transform-vue-jsx": "^3.5.0",
27 | "babel-preset-env": "^1.3.2",
28 | "babel-preset-stage-2": "^6.22.0",
29 | "chalk": "^2.0.1",
30 | "copy-webpack-plugin": "^4.0.1",
31 | "css-loader": "^0.28.0",
32 | "extract-text-webpack-plugin": "^3.0.0",
33 | "file-loader": "^1.1.4",
34 | "friendly-errors-webpack-plugin": "^1.6.1",
35 | "html-webpack-plugin": "^2.30.1",
36 | "node-notifier": "^5.1.2",
37 | "optimize-css-assets-webpack-plugin": "^3.2.0",
38 | "ora": "^1.2.0",
39 | "portfinder": "^1.0.13",
40 | "postcss-import": "^11.0.0",
41 | "postcss-loader": "^2.0.8",
42 | "postcss-url": "^7.2.1",
43 | "rimraf": "^2.6.0",
44 | "semver": "^5.3.0",
45 | "shelljs": "^0.7.6",
46 | "uglifyjs-webpack-plugin": "^1.1.1",
47 | "url-loader": "^0.5.8",
48 | "vue-loader": "^13.3.0",
49 | "vue-style-loader": "^3.0.1",
50 | "vue-template-compiler": "^2.5.2",
51 | "webpack": "^3.6.0",
52 | "webpack-bundle-analyzer": "^2.9.0",
53 | "webpack-dev-server": "^2.9.1",
54 | "webpack-merge": "^4.1.0"
55 | },
56 | "engines": {
57 | "node": ">= 6.0.0",
58 | "npm": ">= 3.0.0"
59 | },
60 | "browserslist": [
61 | "> 1%",
62 | "last 2 versions",
63 | "not ie <= 8"
64 | ]
65 | }
66 |
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | // Template version: 1.3.1
3 | // see http://vuejs-templates.github.io/webpack for documentation.
4 |
5 | const path = require('path')
6 |
7 | module.exports = {
8 | dev: {
9 |
10 | // Paths
11 | assetsSubDirectory: 'static',
12 | assetsPublicPath: '/',
13 | // 为了让后端能够访问到前端的资源,需要配置跨域支持
14 | proxyTable: {
15 | '/api' : {
16 | target: 'http://localhost:8443',
17 | changeOrigin: true,
18 | pathRewrite: {
19 | '^/api': ''
20 | }
21 | }
22 | },
23 |
24 | // Various Dev Server settings
25 | host: 'localhost', // can be overwritten by process.env.HOST
26 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
27 | autoOpenBrowser: false,
28 | errorOverlay: true,
29 | notifyOnErrors: true,
30 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
31 |
32 |
33 | /**
34 | * Source Maps
35 | */
36 |
37 | // https://webpack.js.org/configuration/devtool/#development
38 | devtool: 'cheap-module-eval-source-map',
39 |
40 | // If you have problems debugging vue-files in devtools,
41 | // set this to false - it *may* help
42 | // https://vue-loader.vuejs.org/en/options.html#cachebusting
43 | cacheBusting: true,
44 |
45 | cssSourceMap: true
46 | },
47 |
48 | build: {
49 | // Template for index.html
50 | index: path.resolve(__dirname, '../dist/index.html'),
51 |
52 | // Paths
53 | assetsRoot: path.resolve(__dirname, '../dist'),
54 | assetsSubDirectory: 'static',
55 | assetsPublicPath: '/',
56 |
57 | /**
58 | * Source Maps
59 | */
60 |
61 | productionSourceMap: true,
62 | // https://webpack.js.org/configuration/devtool/#production
63 | devtool: '#source-map',
64 |
65 | // Gzip off by default as many popular static hosts such as
66 | // Surge or Netlify already gzip all static assets for you.
67 | // Before setting to `true`, make sure to:
68 | // npm install --save-dev compression-webpack-plugin
69 | productionGzip: false,
70 | productionGzipExtensions: ['js', 'css'],
71 |
72 | // Run the build command with an extra argument to
73 | // View the bundle analyzer report after build finishes:
74 | // `npm run build --report`
75 | // Set to `true` or `false` to always turn it on or off
76 | bundleAnalyzerReport: process.env.npm_config_report
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/components/HelloWorld.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
Essential Links
5 |
48 |
Ecosystem
49 |
83 |
84 |
85 |
86 |
96 |
97 |
98 |
114 |
--------------------------------------------------------------------------------
/src/components/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 | 系统登录
6 |
7 |
9 |
10 |
11 |
13 |
14 |
15 | 登录
16 |
17 |
18 |
19 |
20 |
21 |
55 |
56 |
85 |
--------------------------------------------------------------------------------