From 06e2bfded66568addf4a50acded38266afdadc62 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 12 Aug 2018 00:36:08 +0800 Subject: [PATCH] 1. add login page --- package-lock.json | 44 ++++++++++++++++++----- package.json | 2 ++ src/App.vue | 39 ++++++++++---------- src/components/HelloWorld.vue | 59 ++---------------------------- src/components/Loading.vue | 18 ++++++++++ src/components/Login/index.vue | 61 ++++++++++++++++++++++++++++++++ src/main.js | 4 +++ src/router.js | 15 +++----- src/store/getters.js | 1 + src/{store.js => store/index.js} | 9 ++--- src/store/mutations/index.js | 5 +++ src/views/About.vue | 5 --- src/views/Home.vue | 18 ---------- vue.config.js | 3 ++ 14 files changed, 161 insertions(+), 122 deletions(-) create mode 100644 src/components/Loading.vue create mode 100644 src/components/Login/index.vue create mode 100644 src/store/getters.js rename src/{store.js => store/index.js} (53%) create mode 100644 src/store/mutations/index.js delete mode 100644 src/views/About.vue delete mode 100644 src/views/Home.vue create mode 100644 vue.config.js diff --git a/package-lock.json b/package-lock.json index 82f709c..14c58ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2087,8 +2087,7 @@ "babel-helper-vue-jsx-merge-props": { "version": "2.0.3", "resolved": "http://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz", - "integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY=", - "dev": true + "integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY=" }, "babel-loader": { "version": "8.0.0-beta.4", @@ -2127,6 +2126,15 @@ "esutils": "2.0.2" } }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "2.5.7", + "regenerator-runtime": "0.11.1" + } + }, "babylon": { "version": "7.0.0-beta.47", "resolved": "http://registry.npm.taobao.org/babylon/download/babylon-7.0.0-beta.47.tgz", @@ -3233,8 +3241,7 @@ "core-js": { "version": "2.5.7", "resolved": "http://registry.npm.taobao.org/core-js/download/core-js-2.5.7.tgz", - "integrity": "sha1-+XJgj/DOrWi4QaFqky0LGDeRgU4=", - "dev": true + "integrity": "sha1-+XJgj/DOrWi4QaFqky0LGDeRgU4=" }, "core-util-is": { "version": "1.0.2", @@ -7269,6 +7276,11 @@ "topo": "3.0.0" } }, + "jquery": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", + "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==" + }, "js-message": { "version": "1.0.5", "resolved": "http://registry.npm.taobao.org/js-message/download/js-message-1.0.5.tgz", @@ -7604,8 +7616,7 @@ "lodash": { "version": "4.17.10", "resolved": "http://registry.npm.taobao.org/lodash/download/lodash-4.17.10.tgz", - "integrity": "sha1-G3eTz3JZ6jj7NmHU04syYK+K5Oc=", - "dev": true + "integrity": "sha1-G3eTz3JZ6jj7NmHU04syYK+K5Oc=" }, "lodash.camelcase": { "version": "4.3.0", @@ -10242,8 +10253,7 @@ "regenerator-runtime": { "version": "0.11.1", "resolved": "http://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.11.1.tgz", - "integrity": "sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk=", - "dev": true + "integrity": "sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk=" }, "regenerator-transform": { "version": "0.12.4", @@ -10681,6 +10691,24 @@ "node-forge": "0.7.5" } }, + "semantic-ui-css": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/semantic-ui-css/-/semantic-ui-css-2.3.3.tgz", + "integrity": "sha512-/UDs+a07LdxmYgVNqkbW9x5Gil1Dt4HnVq4LrHKKUAD/DUDh0fnwmCxbQFyKKD+YsVDQWFqftyVbYKlClBFLDw==", + "requires": { + "jquery": "3.3.1" + } + }, + "semantic-ui-vue": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/semantic-ui-vue/-/semantic-ui-vue-0.2.11.tgz", + "integrity": "sha512-YlkWFP3q5Mp0ZzvI85llg1ih4gIx6balNYN0F+2xNZHfMPRt1+CVgq1X1JN4xRZ1bz2iPPGk0LCB5HIJq0mzFw==", + "requires": { + "babel-helper-vue-jsx-merge-props": "2.0.3", + "babel-runtime": "6.26.0", + "lodash": "4.17.10" + } + }, "semver": { "version": "5.5.0", "resolved": "http://registry.npm.taobao.org/semver/download/semver-5.5.0.tgz", diff --git a/package.json b/package.json index f8352f2..39c47ae 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "semantic-ui-css": "^2.3.3", + "semantic-ui-vue": "^0.2.11", "vue": "^2.5.17", "vue-router": "^3.0.1", "vuex": "^3.0.1" diff --git a/src/App.vue b/src/App.vue index 97c3ca7..e91f8d6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,29 +1,28 @@ - diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index c31bfae..d92d82f 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -1,58 +1,5 @@ - - - - - diff --git a/src/components/Loading.vue b/src/components/Loading.vue new file mode 100644 index 0000000..f7899a8 --- /dev/null +++ b/src/components/Loading.vue @@ -0,0 +1,18 @@ + + + diff --git a/src/components/Login/index.vue b/src/components/Login/index.vue new file mode 100644 index 0000000..93966ac --- /dev/null +++ b/src/components/Login/index.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/src/main.js b/src/main.js index f253456..4eefe56 100644 --- a/src/main.js +++ b/src/main.js @@ -2,6 +2,10 @@ import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store' +import SuiVue from 'semantic-ui-vue' +import 'semantic-ui-css/semantic.min.css' + +Vue.use(SuiVue) Vue.config.productionTip = false diff --git a/src/router.js b/src/router.js index 39650f9..086d36d 100644 --- a/src/router.js +++ b/src/router.js @@ -1,6 +1,7 @@ import Vue from 'vue' import Router from 'vue-router' -import Home from './views/Home.vue' +// import HelloWorld from '@/components/HelloWorld' +import Login from '@/components/Login' Vue.use(Router) @@ -10,16 +11,8 @@ export default new Router({ routes: [ { path: '/', - name: 'home', - component: Home - }, - { - path: '/about', - name: 'about', - // route level code-splitting - // this generates a separate chunk (about.[hash].js) for this route - // which is lazy-loaded when the route is visited. - component: () => import(/* webpackChunkName: "about" */ './views/About.vue') + name: 'Login', + component: Login } ] }) diff --git a/src/store/getters.js b/src/store/getters.js new file mode 100644 index 0000000..61d8371 --- /dev/null +++ b/src/store/getters.js @@ -0,0 +1 @@ +export const getLoading = state => !!state.loading diff --git a/src/store.js b/src/store/index.js similarity index 53% rename from src/store.js rename to src/store/index.js index 3c7424e..45211ae 100644 --- a/src/store.js +++ b/src/store/index.js @@ -1,15 +1,16 @@ import Vue from 'vue' import Vuex from 'vuex' +import mutations from './mutations' +import * as getters from './getters' Vue.use(Vuex) export default new Vuex.Store({ state: { - - }, - mutations: { - + loading: false }, + mutations, + getters, actions: { } diff --git a/src/store/mutations/index.js b/src/store/mutations/index.js new file mode 100644 index 0000000..c23c6cc --- /dev/null +++ b/src/store/mutations/index.js @@ -0,0 +1,5 @@ +export default { + toggleLoading (state, loading = null) { + state.loading = !!loading + } +} diff --git a/src/views/About.vue b/src/views/About.vue deleted file mode 100644 index 3fa2807..0000000 --- a/src/views/About.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/views/Home.vue b/src/views/Home.vue deleted file mode 100644 index fc2e940..0000000 --- a/src/views/Home.vue +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..0ed897c --- /dev/null +++ b/vue.config.js @@ -0,0 +1,3 @@ +module.exports = { + baseUrl: process.env.BASE_URL || '/' +} \ No newline at end of file